@fluidframework/container-definitions 2.51.0 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/api-report/container-definitions.beta.api.md +8 -4
- package/api-report/container-definitions.legacy.alpha.api.md +29 -5
- package/api-report/container-definitions.legacy.public.api.md +8 -4
- package/api-report/container-definitions.public.api.md +8 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- package/dist/loader.d.ts +23 -7
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +33 -1
- package/dist/loader.js.map +1 -1
- package/dist/runtime.d.ts +101 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -0
- package/lib/loader.d.ts +23 -7
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +32 -0
- package/lib/loader.js.map +1 -1
- package/lib/runtime.d.ts +101 -3
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +2 -3
- package/src/loader.ts +23 -7
- package/src/runtime.ts +127 -3
package/lib/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH;;;;GAIG;AACH,MAAM,CAAN,IAAY,WAiBX;AAjBD,WAAY,WAAW;IACtB;;;OAGG;IACH,oCAAqB,CAAA;IAErB;;OAEG;IACH,sCAAuB,CAAA;IAEvB;;;OAGG;IACH,oCAAqB,CAAA;AACtB,CAAC,EAjBW,WAAW,KAAX,WAAW,QAiBtB;AAqLD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAiC,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tFluidObject,\n\tIDisposable,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tIClientDetails,\n\tIQuorumClients,\n\tISummaryTree,\n} from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentStorageService,\n\tISnapshot,\n\tIDocumentMessage,\n\tISnapshotTree,\n\tISummaryContent,\n\tIVersion,\n\tMessageType,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport type { IAudience } from \"./audience.js\";\nimport type { IDeltaManager } from \"./deltas.js\";\nimport type { ICriticalContainerError } from \"./error.js\";\nimport type { ILoader } from \"./loader.js\";\n\n/**\n * The attachment state of some Fluid data (e.g. a container or data store), denoting whether it is uploaded to the\n * service. The transition from detached to attached state is a one-way transition.\n * @public\n */\nexport enum AttachState {\n\t/**\n\t * In detached state, the data is only present on the local client's machine. It has not yet been uploaded\n\t * to the service.\n\t */\n\tDetached = \"Detached\",\n\n\t/**\n\t * In attaching state, the data has started the upload to the service, but has not yet completed.\n\t */\n\tAttaching = \"Attaching\",\n\n\t/**\n\t * In attached state, the data has completed upload to the service. It can be accessed by other clients after\n\t * reaching attached state.\n\t */\n\tAttached = \"Attached\",\n}\n\n/**\n * The IRuntime represents an instantiation of a code package within a Container.\n * Primarily held by the ContainerContext to be able to interact with the running instance of the Container.\n *\n * @legacy\n * @alpha\n */\nexport interface IRuntime extends IDisposable {\n\t/**\n\t * Notifies the runtime of a change in the connection state\n\t * @param canSendOps - true if the runtime is allowed to send ops\n\t * @param clientId - the ID of the client that is connecting or disconnecting\n\t */\n\tsetConnectionState(canSendOps: boolean, clientId?: string);\n\n\t/**\n\t * Processes the given op (message)\n\t * @param message - delta message received from the server\n\t * @param local - true if the message was originally generated by the client receiving it.\n\t */\n\tprocess(message: ISequencedDocumentMessage, local: boolean);\n\n\t/**\n\t * Processes the given signal\n\t */\n\t// TODO: use `unknown` instead (API breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprocessSignal(message: any, local: boolean);\n\n\t/**\n\t * Create a summary. Used when attaching or serializing a detached container.\n\t *\n\t * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n\t * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n\t * new storage IDs so requests can be redirected.\n\t */\n\tcreateSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;\n\n\t/**\n\t * Propagate the container state when container is attaching or attached.\n\t * @param attachState - State of the container.\n\t */\n\tsetAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;\n\n\t/**\n\t * Get pending local state in a serializable format to be given back to a newly loaded container\n\t */\n\tgetPendingLocalState(props?: IGetPendingLocalStateProps): unknown;\n\n\t/**\n\t * Notify runtime that we have processed a saved message, so that it can do async work (applying\n\t * stashed ops) after having processed it.\n\t */\n\tnotifyOpReplay?(message: ISequencedDocumentMessage): Promise<void>;\n\n\t/**\n\t * Exposes the entryPoint for the container runtime.\n\t * Use this as the primary way of getting access to the user-defined logic within the container runtime.\n\t *\n\t * @see {@link IContainer.getEntryPoint}\n\t */\n\tgetEntryPoint(): Promise<FluidObject>;\n}\n\n/**\n * Payload type for IContainerContext.submitBatchFn()\n * @legacy\n * @alpha\n */\nexport interface IBatchMessage {\n\tcontents?: string;\n\tmetadata?: Record<string, unknown>;\n\tcompression?: string;\n\treferenceSequenceNumber?: number;\n}\n\n/**\n * IContainerContext is fundamentally just the set of things that an IRuntimeFactory (and IRuntime) will consume from the\n * loader layer.\n * It gets passed into the {@link (IRuntimeFactory:interface).instantiateRuntime} call.\n *\n * @privateremarks\n * Only include members on this interface if you intend them to be consumed/called from the runtime layer.\n *\n * TODO: once `@alpha` tag is removed, `unknown` should be removed from submitSignalFn.\n * See {@link https://dev.azure.com/fluidframework/internal/_workitems/edit/7462}\n *\n * @legacy\n * @alpha\n */\nexport interface IContainerContext {\n\t/**\n\t * Not recommended for general use, is used in some cases to control various runtime behaviors.\n\t *\n\t * @remarks\n\t * Used to be ILoaderOptions, this is staging for eventual removal.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treadonly options: Record<string | number, any>;\n\treadonly clientId: string | undefined;\n\treadonly clientDetails: IClientDetails;\n\treadonly storage: IDocumentStorageService;\n\treadonly connected: boolean;\n\treadonly baseSnapshot: ISnapshotTree | undefined;\n\t/**\n\t * @deprecated Please use submitBatchFn & submitSummaryFn\n\t */\n\treadonly submitFn: (\n\t\ttype: MessageType,\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tcontents: any,\n\t\tbatch: boolean,\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tappData?: any,\n\t) => number;\n\t/**\n\t * @returns clientSequenceNumber of last message in a batch\n\t */\n\treadonly submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number;\n\treadonly submitSummaryFn: (\n\t\tsummaryOp: ISummaryContent,\n\t\treferenceSequenceNumber?: number,\n\t) => number;\n\treadonly submitSignalFn: (contents: unknown, targetClientId?: string) => void;\n\treadonly disposeFn?: (error?: ICriticalContainerError) => void;\n\treadonly closeFn: (error?: ICriticalContainerError) => void;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\treadonly quorum: IQuorumClients;\n\treadonly audience: IAudience;\n\treadonly loader: ILoader;\n\t// The logger implementation, which would support tagged events, should be provided by the loader.\n\treadonly taggedLogger: ITelemetryBaseLogger;\n\tpendingLocalState?: unknown;\n\n\t/**\n\t * Ambient services provided with the context\n\t */\n\treadonly scope: FluidObject;\n\n\t/**\n\t * Get an absolute url for a provided container-relative request.\n\t * @param relativeUrl - A relative request within the container\n\t *\n\t * TODO: Optional for backwards compatibility. Make non-optional in version 0.19\n\t */\n\tgetAbsoluteUrl?(relativeUrl: string): Promise<string | undefined>;\n\n\t/**\n\t * Indicates the attachment state of the container to a host service.\n\t */\n\treadonly attachState: AttachState;\n\n\tgetLoadedFromVersion(): IVersion | undefined;\n\n\tupdateDirtyContainerState(dirty: boolean): void;\n\n\t/**\n\t * @deprecated - This has been deprecated. It was used internally and there is no replacement.\n\t */\n\treadonly supportedFeatures?: ReadonlyMap<string, unknown>;\n\n\t/**\n\t * WARNING: this id is meant for telemetry usages ONLY, not recommended for other consumption\n\t * This id is not supposed to be exposed anywhere else. It is dependant on usage or drivers\n\t * and scenarios which can change in the future.\n\t * @deprecated 2.0.0-internal.5.2.0 - The docId is already logged by the {@link IContainerContext.taggedLogger} for\n\t * telemetry purposes, so this is generally unnecessary for telemetry.\n\t * If the id is needed for other purposes it should be passed to the consumer explicitly.\n\t *\n\t * @privateremarks Tracking in AB#5714\n\t */\n\treadonly id: string;\n\n\t/**\n\t * This contains all parts of a snapshot like blobContents, ops etc.\n\t */\n\treadonly snapshotWithContents?: ISnapshot;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport const IRuntimeFactory: keyof IProvideRuntimeFactory = \"IRuntimeFactory\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IProvideRuntimeFactory {\n\treadonly IRuntimeFactory: IRuntimeFactory;\n}\n\n/**\n * Exported module definition\n *\n * Provides the entry point for the ContainerContext to load the proper IRuntime\n * to start up the running instance of the Container.\n * @legacy\n * @alpha\n */\nexport interface IRuntimeFactory extends IProvideRuntimeFactory {\n\t/**\n\t * Instantiates a new IRuntime for the given IContainerContext to proxy to\n\t * This is the main entry point to the Container's business logic\n\t *\n\t * @param context - container context to be supplied to the runtime\n\t * @param existing - whether to instantiate for the first time or from an existing context\n\t */\n\tinstantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;\n}\n\n/**\n * Defines list of properties expected for getPendingLocalState\n * @legacy\n * @alpha\n */\nexport interface IGetPendingLocalStateProps {\n\t/**\n\t * Indicates the container will close after getting the pending state. Used internally\n\t * to wait for blobs to be attached to a DDS and collect generated ops before closing.\n\t */\n\treadonly notifyImminentClosure: boolean;\n\n\t/**\n\t * Abort signal to stop waiting for blobs to get attached to a DDS. When triggered,\n\t * only blobs attached will be collected in the pending state.\n\t * Intended to be used in the very rare scenario in which getLocalPendingState go stale due\n\t * to a blob failed to be referenced. Such a blob will be lost but the rest of the state will\n\t * be preserved and collected.\n\t */\n\treadonly stopBlobAttachingSignal?: AbortSignal;\n\n\t/**\n\t * Date to be used as the starting time of a session. This date is updated in case we refresh the\n\t * base snapshot since we won't be referencing ops older than the new snapshot.\n\t */\n\treadonly sessionExpiryTimerStarted?: number;\n\n\t/**\n\t * Snapshot sequence number. It will help the runtime to know which ops should still be stashed.\n\t */\n\treadonly snapshotSequenceNumber?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiCH;;;;GAIG;AACH,MAAM,CAAN,IAAY,WAiBX;AAjBD,WAAY,WAAW;IACtB;;;OAGG;IACH,oCAAqB,CAAA;IAErB;;OAEG;IACH,sCAAuB,CAAA;IAEvB;;;OAGG;IACH,oCAAqB,CAAA;AACtB,CAAC,EAjBW,WAAW,KAAX,WAAW,QAiBtB;AA4SD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAiC,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tFluidObject,\n\tIDisposable,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tIClientDetails,\n\tIQuorumClients,\n\tISummaryTree,\n} from \"@fluidframework/driver-definitions\";\nimport type {\n\tISnapshot,\n\tIDocumentMessage,\n\tISnapshotTree,\n\tISummaryContent,\n\tIVersion,\n\tMessageType,\n\tISequencedDocumentMessage,\n\tICreateBlobResponse,\n\tISummaryContext,\n\tISnapshotFetchOptions,\n\tFetchSource,\n\tIDocumentStorageServicePolicies,\n\tISummaryHandle,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport type { IAudience } from \"./audience.js\";\nimport type { IDeltaManager } from \"./deltas.js\";\nimport type { ICriticalContainerError } from \"./error.js\";\nimport type { ConnectionState, ILoader } from \"./loader.js\";\n\n/**\n * The attachment state of some Fluid data (e.g. a container or data store), denoting whether it is uploaded to the\n * service. The transition from detached to attached state is a one-way transition.\n * @public\n */\nexport enum AttachState {\n\t/**\n\t * In detached state, the data is only present on the local client's machine. It has not yet been uploaded\n\t * to the service.\n\t */\n\tDetached = \"Detached\",\n\n\t/**\n\t * In attaching state, the data has started the upload to the service, but has not yet completed.\n\t */\n\tAttaching = \"Attaching\",\n\n\t/**\n\t * In attached state, the data has completed upload to the service. It can be accessed by other clients after\n\t * reaching attached state.\n\t */\n\tAttached = \"Attached\",\n}\n\n/**\n * The IRuntime represents an instantiation of a code package within a Container.\n * Primarily held by the ContainerContext to be able to interact with the running instance of the Container.\n *\n * @legacy\n * @alpha\n */\nexport interface IRuntime extends IDisposable {\n\t/**\n\t * Notifies the runtime of a change in the connection state\n\t * @param canSendOps - true if the runtime is allowed to send ops\n\t * @param clientId - the ID of the client that is connecting or disconnecting\n\t */\n\tsetConnectionState(canSendOps: boolean, clientId?: string);\n\n\t/**\n\t * Processes the given op (message)\n\t * @param message - delta message received from the server\n\t * @param local - true if the message was originally generated by the client receiving it.\n\t */\n\tprocess(message: ISequencedDocumentMessage, local: boolean);\n\n\t/**\n\t * Processes the given signal\n\t */\n\t// TODO: use `unknown` instead (API breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprocessSignal(message: any, local: boolean);\n\n\t/**\n\t * Create a summary. Used when attaching or serializing a detached container.\n\t *\n\t * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n\t * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n\t * new storage IDs so requests can be redirected.\n\t */\n\tcreateSummary(blobRedirectTable?: Map<string, string>): ISummaryTree;\n\n\t/**\n\t * Propagate the container state when container is attaching or attached.\n\t * @param attachState - State of the container.\n\t */\n\tsetAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;\n\n\t/**\n\t * Get pending local state in a serializable format to be given back to a newly loaded container\n\t */\n\tgetPendingLocalState(props?: IGetPendingLocalStateProps): unknown;\n\n\t/**\n\t * Notify runtime that we have processed a saved message, so that it can do async work (applying\n\t * stashed ops) after having processed it.\n\t */\n\tnotifyOpReplay?(message: ISequencedDocumentMessage): Promise<void>;\n\n\t/**\n\t * Exposes the entryPoint for the container runtime.\n\t * Use this as the primary way of getting access to the user-defined logic within the container runtime.\n\t *\n\t * @see {@link IContainer.getEntryPoint}\n\t */\n\tgetEntryPoint(): Promise<FluidObject>;\n}\n\n/**\n * Payload type for IContainerContext.submitBatchFn()\n * @legacy\n * @alpha\n */\nexport interface IBatchMessage {\n\tcontents?: string;\n\tmetadata?: Record<string, unknown>;\n\tcompression?: string;\n\treferenceSequenceNumber?: number;\n}\n\n/**\n * Interface to provide access to snapshots and policies to the Runtime layer. This should follow the Loader / Runtime\n * layer compatibility rules.\n *\n * @remarks It contains a subset of APIs from {@link @fluidframework/driver-definitions#IDocumentStorageService} but\n * allows the Runtime to not support layer compatibility with the Driver layer. Instead, it supports compatibility\n * with the Loader layer which it already does.\n *\n * @legacy\n * @alpha\n */\nexport interface IContainerStorageService {\n\t/**\n\t * Whether or not the object has been disposed.\n\t * If true, the object should be considered invalid, and its other state should be disregarded.\n\t *\n\t * @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as\n\t * it is unused in the Runtime layer.\n\t */\n\treadonly disposed?: boolean;\n\n\t/**\n\t * Dispose of the object and its resources.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was\n\t * disposed as the result of an error.\n\t *\n\t * @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as\n\t * it is unused in the Runtime layer.\n\t */\n\tdispose?(error?: Error): void;\n\n\t/**\n\t * Policies implemented/instructed by driver.\n\t *\n\t * @deprecated - This will be removed in a future release. The Runtime layer only needs `maximumCacheDurationMs`\n\t * policy which is added as a separate property.\n\t */\n\treadonly policies?: IDocumentStorageServicePolicies | undefined;\n\n\t/**\n\t * See {@link @fluidframework/driver-definitions#IDocumentStorageServicePolicies.maximumCacheDurationMs}\n\t */\n\treadonly maximumCacheDurationMs?: IDocumentStorageServicePolicies[\"maximumCacheDurationMs\"];\n\n\t/**\n\t * Returns the snapshot tree.\n\t * @param version - Version of the snapshot to be fetched.\n\t * @param scenarioName - scenario in which this api is called. This will be recorded by server and would help\n\t * in debugging purposes to see why this call was made.\n\t */\n\t// TODO: use `undefined` instead.\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tgetSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;\n\n\t/**\n\t * Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from\n\t * `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot.\n\t * @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the\n\t * driver when fetching the snapshot.\n\t */\n\tgetSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;\n\n\t/**\n\t * Retrieves all versions of the document starting at the specified versionId - or null if from the head\n\t * @param versionId - Version id of the requested version.\n\t * @param count - Number of the versions to be fetched.\n\t * @param scenarioName - scenario in which this api is called. This will be recorded by server and would help\n\t * in debugging purposes to see why this call was made.\n\t * @param fetchSource - Callers can specify the source of the response. For ex. Driver may choose to cache\n\t * requests and serve data from cache. That will result in stale info returned. Callers can disable this\n\t * functionality by passing fetchSource = noCache and ensuring that driver will return latest information\n\t * from storage.\n\t */\n\tgetVersions(\n\t\t// TODO: use `undefined` instead.\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]>;\n\n\t/**\n\t * Creates a blob out of the given buffer\n\t */\n\tcreateBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;\n\n\t/**\n\t * Reads the object with the given ID, returns content in arrayBufferLike\n\t */\n\treadBlob(id: string): Promise<ArrayBufferLike>;\n\n\t/**\n\t * Uploads a summary tree to storage using the given context for reference of previous summary handle.\n\t * The ISummaryHandles in the uploaded tree should have paths to indicate which summary object they are\n\t * referencing from the previously acked summary.\n\t * Returns the uploaded summary handle.\n\t */\n\tuploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;\n\n\t/**\n\t * Retrieves the commit that matches the packfile handle. If the packfile has already been committed and the\n\t * server has deleted it this call may result in a broken promise.\n\t *\n\t * @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as\n\t * it is unused in the Runtime and below layers.\n\t */\n\tdownloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;\n}\n\n/**\n * IContainerContext is fundamentally just the set of things that an IRuntimeFactory (and IRuntime) will consume from the\n * loader layer.\n * It gets passed into the {@link (IRuntimeFactory:interface).instantiateRuntime} call.\n *\n * @privateremarks\n * Only include members on this interface if you intend them to be consumed/called from the runtime layer.\n *\n * TODO: once `@alpha` tag is removed, `unknown` should be removed from submitSignalFn.\n * See {@link https://dev.azure.com/fluidframework/internal/_workitems/edit/7462}\n *\n * @legacy\n * @alpha\n */\nexport interface IContainerContext {\n\t/**\n\t * Not recommended for general use, is used in some cases to control various runtime behaviors.\n\t *\n\t * @remarks\n\t * Used to be ILoaderOptions, this is staging for eventual removal.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treadonly options: Record<string | number, any>;\n\treadonly clientId: string | undefined;\n\treadonly clientDetails: IClientDetails;\n\treadonly storage: IContainerStorageService;\n\treadonly connected: boolean;\n\treadonly baseSnapshot: ISnapshotTree | undefined;\n\n\t/**\n\t * Gets the current connection state of the container.\n\t *\n\t * @remarks\n\t * This provides more detailed connection state information beyond the simple boolean `connected` property.\n\t * Available starting from version 2.52.0. Property is not present in older versions.\n\t */\n\treadonly getConnectionState?: () => ConnectionState;\n\t/**\n\t * @deprecated Please use submitBatchFn & submitSummaryFn\n\t */\n\treadonly submitFn: (\n\t\ttype: MessageType,\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tcontents: any,\n\t\tbatch: boolean,\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tappData?: any,\n\t) => number;\n\t/**\n\t * @returns clientSequenceNumber of last message in a batch\n\t */\n\treadonly submitBatchFn: (batch: IBatchMessage[], referenceSequenceNumber?: number) => number;\n\treadonly submitSummaryFn: (\n\t\tsummaryOp: ISummaryContent,\n\t\treferenceSequenceNumber?: number,\n\t) => number;\n\treadonly submitSignalFn: (contents: unknown, targetClientId?: string) => void;\n\treadonly disposeFn?: (error?: ICriticalContainerError) => void;\n\treadonly closeFn: (error?: ICriticalContainerError) => void;\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\treadonly quorum: IQuorumClients;\n\treadonly audience: IAudience;\n\treadonly loader: ILoader;\n\t// The logger implementation, which would support tagged events, should be provided by the loader.\n\treadonly taggedLogger: ITelemetryBaseLogger;\n\tpendingLocalState?: unknown;\n\n\t/**\n\t * Ambient services provided with the context\n\t */\n\treadonly scope: FluidObject;\n\n\t/**\n\t * Get an absolute url for a provided container-relative request.\n\t * @param relativeUrl - A relative request within the container\n\t *\n\t * TODO: Optional for backwards compatibility. Make non-optional in version 0.19\n\t */\n\tgetAbsoluteUrl?(relativeUrl: string): Promise<string | undefined>;\n\n\t/**\n\t * Indicates the attachment state of the container to a host service.\n\t */\n\treadonly attachState: AttachState;\n\n\tgetLoadedFromVersion(): IVersion | undefined;\n\n\tupdateDirtyContainerState(dirty: boolean): void;\n\n\t/**\n\t * @deprecated - This has been deprecated. It was used internally and there is no replacement.\n\t */\n\treadonly supportedFeatures?: ReadonlyMap<string, unknown>;\n\n\t/**\n\t * WARNING: this id is meant for telemetry usages ONLY, not recommended for other consumption\n\t * This id is not supposed to be exposed anywhere else. It is dependant on usage or drivers\n\t * and scenarios which can change in the future.\n\t * @deprecated 2.0.0-internal.5.2.0 - The docId is already logged by the {@link IContainerContext.taggedLogger} for\n\t * telemetry purposes, so this is generally unnecessary for telemetry.\n\t * If the id is needed for other purposes it should be passed to the consumer explicitly.\n\t *\n\t * @privateremarks Tracking in AB#5714\n\t */\n\treadonly id: string;\n\n\t/**\n\t * This contains all parts of a snapshot like blobContents, ops etc.\n\t */\n\treadonly snapshotWithContents?: ISnapshot;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport const IRuntimeFactory: keyof IProvideRuntimeFactory = \"IRuntimeFactory\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IProvideRuntimeFactory {\n\treadonly IRuntimeFactory: IRuntimeFactory;\n}\n\n/**\n * Exported module definition\n *\n * Provides the entry point for the ContainerContext to load the proper IRuntime\n * to start up the running instance of the Container.\n * @legacy\n * @alpha\n */\nexport interface IRuntimeFactory extends IProvideRuntimeFactory {\n\t/**\n\t * Instantiates a new IRuntime for the given IContainerContext to proxy to\n\t * This is the main entry point to the Container's business logic\n\t *\n\t * @param context - container context to be supplied to the runtime\n\t * @param existing - whether to instantiate for the first time or from an existing context\n\t */\n\tinstantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;\n}\n\n/**\n * Defines list of properties expected for getPendingLocalState\n * @legacy\n * @alpha\n */\nexport interface IGetPendingLocalStateProps {\n\t/**\n\t * Indicates the container will close after getting the pending state. Used internally\n\t * to wait for blobs to be attached to a DDS and collect generated ops before closing.\n\t */\n\treadonly notifyImminentClosure: boolean;\n\n\t/**\n\t * Abort signal to stop waiting for blobs to get attached to a DDS. When triggered,\n\t * only blobs attached will be collected in the pending state.\n\t * Intended to be used in the very rare scenario in which getLocalPendingState go stale due\n\t * to a blob failed to be referenced. Such a blob will be lost but the rest of the state will\n\t * be preserved and collected.\n\t */\n\treadonly stopBlobAttachingSignal?: AbortSignal;\n\n\t/**\n\t * Date to be used as the starting time of a session. This date is updated in case we refresh the\n\t * base snapshot since we won't be referencing ops older than the new snapshot.\n\t */\n\treadonly sessionExpiryTimerStarted?: number;\n\n\t/**\n\t * Snapshot sequence number. It will help the runtime to know which ops should still be stashed.\n\t */\n\treadonly snapshotSequenceNumber?: number;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-definitions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.52.0",
|
|
4
4
|
"description": "Fluid container definitions",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"main": "lib/index.js",
|
|
48
48
|
"types": "lib/public.d.ts",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@fluidframework/core-interfaces": "~2.
|
|
51
|
-
"@fluidframework/driver-definitions": "~2.
|
|
50
|
+
"@fluidframework/core-interfaces": "~2.52.0",
|
|
51
|
+
"@fluidframework/driver-definitions": "~2.52.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
55
55
|
"@biomejs/biome": "~1.9.3",
|
|
56
|
-
"@fluid-tools/build-cli": "^0.
|
|
56
|
+
"@fluid-tools/build-cli": "^0.57.0",
|
|
57
57
|
"@fluidframework/build-common": "^2.0.3",
|
|
58
|
-
"@fluidframework/build-tools": "^0.
|
|
59
|
-
"@fluidframework/container-definitions-previous": "npm:@fluidframework/container-definitions@2.
|
|
58
|
+
"@fluidframework/build-tools": "^0.57.0",
|
|
59
|
+
"@fluidframework/container-definitions-previous": "npm:@fluidframework/container-definitions@2.51.0",
|
|
60
60
|
"@fluidframework/eslint-config-fluid": "^5.7.4",
|
|
61
61
|
"@microsoft/api-extractor": "7.52.8",
|
|
62
62
|
"concurrently": "^8.2.1",
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,6 @@ export { isIDeltaManagerFull } from "./deltas.js";
|
|
|
29
29
|
export type { ContainerWarning, ICriticalContainerError } from "./error.js";
|
|
30
30
|
export { ContainerErrorTypes } from "./error.js";
|
|
31
31
|
export type {
|
|
32
|
-
ConnectionState,
|
|
33
32
|
ICodeDetailsLoader,
|
|
34
33
|
IContainer,
|
|
35
34
|
IContainerEvents,
|
|
@@ -45,7 +44,7 @@ export type {
|
|
|
45
44
|
IResolvedFluidCodeDetails,
|
|
46
45
|
ISnapshotTreeWithBlobContents,
|
|
47
46
|
} from "./loader.js";
|
|
48
|
-
export { LoaderHeader } from "./loader.js";
|
|
47
|
+
export { ConnectionState, LoaderHeader } from "./loader.js";
|
|
49
48
|
export type { IFluidModule } from "./fluidModule.js";
|
|
50
49
|
export type {
|
|
51
50
|
IFluidPackage,
|
|
@@ -66,7 +65,7 @@ export type {
|
|
|
66
65
|
IRuntime,
|
|
67
66
|
IGetPendingLocalStateProps,
|
|
68
67
|
} from "./runtime.js";
|
|
69
|
-
export { AttachState, IRuntimeFactory } from "./runtime.js";
|
|
68
|
+
export { AttachState, IRuntimeFactory, type IContainerStorageService } from "./runtime.js";
|
|
70
69
|
|
|
71
70
|
export type {
|
|
72
71
|
/**
|
package/src/loader.ts
CHANGED
|
@@ -283,26 +283,42 @@ export namespace ConnectionState {
|
|
|
283
283
|
* or may remain disconnected until explicitly told to connect.
|
|
284
284
|
* @public
|
|
285
285
|
*/
|
|
286
|
-
export
|
|
286
|
+
export const Disconnected = 0;
|
|
287
|
+
/**
|
|
288
|
+
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Disconnected:variable)}
|
|
289
|
+
*/
|
|
290
|
+
export type Disconnected = typeof Disconnected;
|
|
287
291
|
|
|
288
292
|
/**
|
|
289
293
|
* The container is disconnected but actively trying to establish a new connection.
|
|
290
294
|
* PLEASE NOTE that this numerical value falls out of the order you may expect for this state.
|
|
291
295
|
* @public
|
|
292
296
|
*/
|
|
293
|
-
export
|
|
297
|
+
export const EstablishingConnection = 3;
|
|
298
|
+
/**
|
|
299
|
+
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(EstablishingConnection:variable)}
|
|
300
|
+
*/
|
|
301
|
+
export type EstablishingConnection = typeof EstablishingConnection;
|
|
294
302
|
|
|
295
303
|
/**
|
|
296
304
|
* The container has an inbound connection only, and is catching up to the latest known state from the service.
|
|
297
305
|
* @public
|
|
298
306
|
*/
|
|
299
|
-
export
|
|
307
|
+
export const CatchingUp = 1;
|
|
308
|
+
/**
|
|
309
|
+
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(CatchingUp:variable)}
|
|
310
|
+
*/
|
|
311
|
+
export type CatchingUp = typeof CatchingUp;
|
|
300
312
|
|
|
301
313
|
/**
|
|
302
314
|
* The container is fully connected and syncing.
|
|
303
315
|
* @public
|
|
304
316
|
*/
|
|
305
|
-
export
|
|
317
|
+
export const Connected = 2;
|
|
318
|
+
/**
|
|
319
|
+
* {@inheritdoc @fluidframework/container-definitions#(ConnectionState:namespace).(Connected:variable)}
|
|
320
|
+
*/
|
|
321
|
+
export type Connected = typeof Connected;
|
|
306
322
|
}
|
|
307
323
|
|
|
308
324
|
/**
|
|
@@ -462,7 +478,7 @@ export interface IContainer extends IEventProvider<IContainerEvents> {
|
|
|
462
478
|
*
|
|
463
479
|
* @remarks
|
|
464
480
|
*
|
|
465
|
-
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Connected}, and the
|
|
481
|
+
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Connected:variable)}, and the
|
|
466
482
|
* "connected" event will be fired if/when connection succeeds.
|
|
467
483
|
*/
|
|
468
484
|
connect(): void;
|
|
@@ -472,7 +488,7 @@ export interface IContainer extends IEventProvider<IContainerEvents> {
|
|
|
472
488
|
*
|
|
473
489
|
* @remarks
|
|
474
490
|
*
|
|
475
|
-
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).Disconnected}, and the
|
|
491
|
+
* {@link IContainer.connectionState} will be set to {@link (ConnectionState:namespace).(Disconnected:variable)}, and the
|
|
476
492
|
* "disconnected" event will be fired when disconnection completes.
|
|
477
493
|
*/
|
|
478
494
|
disconnect(): void;
|
|
@@ -485,7 +501,7 @@ export interface IContainer extends IEventProvider<IContainerEvents> {
|
|
|
485
501
|
/**
|
|
486
502
|
* The server provided ID of the client.
|
|
487
503
|
*
|
|
488
|
-
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).Connected},
|
|
504
|
+
* Set once {@link IContainer.connectionState} is {@link (ConnectionState:namespace).(Connected:variable)},
|
|
489
505
|
* otherwise will be `undefined`.
|
|
490
506
|
*/
|
|
491
507
|
readonly clientId?: string | undefined;
|
package/src/runtime.ts
CHANGED
|
@@ -14,7 +14,6 @@ import type {
|
|
|
14
14
|
ISummaryTree,
|
|
15
15
|
} from "@fluidframework/driver-definitions";
|
|
16
16
|
import type {
|
|
17
|
-
IDocumentStorageService,
|
|
18
17
|
ISnapshot,
|
|
19
18
|
IDocumentMessage,
|
|
20
19
|
ISnapshotTree,
|
|
@@ -22,12 +21,18 @@ import type {
|
|
|
22
21
|
IVersion,
|
|
23
22
|
MessageType,
|
|
24
23
|
ISequencedDocumentMessage,
|
|
24
|
+
ICreateBlobResponse,
|
|
25
|
+
ISummaryContext,
|
|
26
|
+
ISnapshotFetchOptions,
|
|
27
|
+
FetchSource,
|
|
28
|
+
IDocumentStorageServicePolicies,
|
|
29
|
+
ISummaryHandle,
|
|
25
30
|
} from "@fluidframework/driver-definitions/internal";
|
|
26
31
|
|
|
27
32
|
import type { IAudience } from "./audience.js";
|
|
28
33
|
import type { IDeltaManager } from "./deltas.js";
|
|
29
34
|
import type { ICriticalContainerError } from "./error.js";
|
|
30
|
-
import type { ILoader } from "./loader.js";
|
|
35
|
+
import type { ConnectionState, ILoader } from "./loader.js";
|
|
31
36
|
|
|
32
37
|
/**
|
|
33
38
|
* The attachment state of some Fluid data (e.g. a container or data store), denoting whether it is uploaded to the
|
|
@@ -129,6 +134,116 @@ export interface IBatchMessage {
|
|
|
129
134
|
referenceSequenceNumber?: number;
|
|
130
135
|
}
|
|
131
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Interface to provide access to snapshots and policies to the Runtime layer. This should follow the Loader / Runtime
|
|
139
|
+
* layer compatibility rules.
|
|
140
|
+
*
|
|
141
|
+
* @remarks It contains a subset of APIs from {@link @fluidframework/driver-definitions#IDocumentStorageService} but
|
|
142
|
+
* allows the Runtime to not support layer compatibility with the Driver layer. Instead, it supports compatibility
|
|
143
|
+
* with the Loader layer which it already does.
|
|
144
|
+
*
|
|
145
|
+
* @legacy
|
|
146
|
+
* @alpha
|
|
147
|
+
*/
|
|
148
|
+
export interface IContainerStorageService {
|
|
149
|
+
/**
|
|
150
|
+
* Whether or not the object has been disposed.
|
|
151
|
+
* If true, the object should be considered invalid, and its other state should be disregarded.
|
|
152
|
+
*
|
|
153
|
+
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as
|
|
154
|
+
* it is unused in the Runtime layer.
|
|
155
|
+
*/
|
|
156
|
+
readonly disposed?: boolean;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Dispose of the object and its resources.
|
|
160
|
+
* @param error - Optional error indicating the reason for the disposal, if the object was
|
|
161
|
+
* disposed as the result of an error.
|
|
162
|
+
*
|
|
163
|
+
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as
|
|
164
|
+
* it is unused in the Runtime layer.
|
|
165
|
+
*/
|
|
166
|
+
dispose?(error?: Error): void;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Policies implemented/instructed by driver.
|
|
170
|
+
*
|
|
171
|
+
* @deprecated - This will be removed in a future release. The Runtime layer only needs `maximumCacheDurationMs`
|
|
172
|
+
* policy which is added as a separate property.
|
|
173
|
+
*/
|
|
174
|
+
readonly policies?: IDocumentStorageServicePolicies | undefined;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* See {@link @fluidframework/driver-definitions#IDocumentStorageServicePolicies.maximumCacheDurationMs}
|
|
178
|
+
*/
|
|
179
|
+
readonly maximumCacheDurationMs?: IDocumentStorageServicePolicies["maximumCacheDurationMs"];
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Returns the snapshot tree.
|
|
183
|
+
* @param version - Version of the snapshot to be fetched.
|
|
184
|
+
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help
|
|
185
|
+
* in debugging purposes to see why this call was made.
|
|
186
|
+
*/
|
|
187
|
+
// TODO: use `undefined` instead.
|
|
188
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
189
|
+
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from
|
|
193
|
+
* `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot.
|
|
194
|
+
* @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the
|
|
195
|
+
* driver when fetching the snapshot.
|
|
196
|
+
*/
|
|
197
|
+
getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Retrieves all versions of the document starting at the specified versionId - or null if from the head
|
|
201
|
+
* @param versionId - Version id of the requested version.
|
|
202
|
+
* @param count - Number of the versions to be fetched.
|
|
203
|
+
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help
|
|
204
|
+
* in debugging purposes to see why this call was made.
|
|
205
|
+
* @param fetchSource - Callers can specify the source of the response. For ex. Driver may choose to cache
|
|
206
|
+
* requests and serve data from cache. That will result in stale info returned. Callers can disable this
|
|
207
|
+
* functionality by passing fetchSource = noCache and ensuring that driver will return latest information
|
|
208
|
+
* from storage.
|
|
209
|
+
*/
|
|
210
|
+
getVersions(
|
|
211
|
+
// TODO: use `undefined` instead.
|
|
212
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
213
|
+
versionId: string | null,
|
|
214
|
+
count: number,
|
|
215
|
+
scenarioName?: string,
|
|
216
|
+
fetchSource?: FetchSource,
|
|
217
|
+
): Promise<IVersion[]>;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Creates a blob out of the given buffer
|
|
221
|
+
*/
|
|
222
|
+
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Reads the object with the given ID, returns content in arrayBufferLike
|
|
226
|
+
*/
|
|
227
|
+
readBlob(id: string): Promise<ArrayBufferLike>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Uploads a summary tree to storage using the given context for reference of previous summary handle.
|
|
231
|
+
* The ISummaryHandles in the uploaded tree should have paths to indicate which summary object they are
|
|
232
|
+
* referencing from the previously acked summary.
|
|
233
|
+
* Returns the uploaded summary handle.
|
|
234
|
+
*/
|
|
235
|
+
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Retrieves the commit that matches the packfile handle. If the packfile has already been committed and the
|
|
239
|
+
* server has deleted it this call may result in a broken promise.
|
|
240
|
+
*
|
|
241
|
+
* @deprecated - This API is deprecated and will be removed in a future release. No replacement is planned as
|
|
242
|
+
* it is unused in the Runtime and below layers.
|
|
243
|
+
*/
|
|
244
|
+
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
245
|
+
}
|
|
246
|
+
|
|
132
247
|
/**
|
|
133
248
|
* IContainerContext is fundamentally just the set of things that an IRuntimeFactory (and IRuntime) will consume from the
|
|
134
249
|
* loader layer.
|
|
@@ -154,9 +269,18 @@ export interface IContainerContext {
|
|
|
154
269
|
readonly options: Record<string | number, any>;
|
|
155
270
|
readonly clientId: string | undefined;
|
|
156
271
|
readonly clientDetails: IClientDetails;
|
|
157
|
-
readonly storage:
|
|
272
|
+
readonly storage: IContainerStorageService;
|
|
158
273
|
readonly connected: boolean;
|
|
159
274
|
readonly baseSnapshot: ISnapshotTree | undefined;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Gets the current connection state of the container.
|
|
278
|
+
*
|
|
279
|
+
* @remarks
|
|
280
|
+
* This provides more detailed connection state information beyond the simple boolean `connected` property.
|
|
281
|
+
* Available starting from version 2.52.0. Property is not present in older versions.
|
|
282
|
+
*/
|
|
283
|
+
readonly getConnectionState?: () => ConnectionState;
|
|
160
284
|
/**
|
|
161
285
|
* @deprecated Please use submitBatchFn & submitSummaryFn
|
|
162
286
|
*/
|