@fluidframework/fluid-static 2.41.0 → 2.43.0-343119

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.
@@ -12,6 +12,7 @@ import {
12
12
  import type { IRuntimeFactory } from "@fluidframework/container-definitions/internal";
13
13
  import {
14
14
  FluidDataStoreRegistry,
15
+ type IContainerRuntimeOptions,
15
16
  type MinimumVersionForCollab,
16
17
  } from "@fluidframework/container-runtime/internal";
17
18
  import type {
@@ -21,6 +22,7 @@ import type {
21
22
  import type {
22
23
  FluidObject,
23
24
  FluidObjectKeys,
25
+ IFluidHandle,
24
26
  IFluidLoadable,
25
27
  } from "@fluidframework/core-interfaces";
26
28
  import { assert } from "@fluidframework/core-utils/internal";
@@ -140,9 +142,6 @@ class RootDataObject
140
142
  await Promise.all(loadInitialObjectsP);
141
143
  }
142
144
 
143
- /**
144
- * {@inheritDoc IRootDataObject.initialObjects}
145
- */
146
145
  public get initialObjects(): LoadableObjectRecord {
147
146
  if (Object.keys(this._initialObjects).length === 0) {
148
147
  throw new Error("Initial Objects were not correctly initialized");
@@ -150,9 +149,6 @@ class RootDataObject
150
149
  return this._initialObjects;
151
150
  }
152
151
 
153
- /**
154
- * {@inheritDoc IRootDataObject.create}
155
- */
156
152
  public async create<T>(objectClass: SharedObjectKind<T>): Promise<T> {
157
153
  const internal = objectClass as unknown as LoadableObjectKind<T & IFluidLoadable>;
158
154
  if (isDataObjectKind(internal)) {
@@ -163,6 +159,10 @@ class RootDataObject
163
159
  throw new Error("Could not create new Fluid object because an unknown object was passed");
164
160
  }
165
161
 
162
+ public async uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {
163
+ return this.runtime.uploadBlob(blob);
164
+ }
165
+
166
166
  private async createDataObject<T extends IFluidLoadable>(
167
167
  dataObjectClass: DataObjectKind<T>,
168
168
  ): Promise<T> {
@@ -206,6 +206,18 @@ export function createDOProviderContainerRuntimeFactory(props: {
206
206
  * If not provided, one will be created based on the schema.
207
207
  */
208
208
  rootDataStoreRegistry?: IFluidDataStoreRegistry;
209
+ /**
210
+ * Optional overrides for the container runtime options.
211
+ * If not provided, only the default options for the given compatibilityMode will be used.
212
+ */
213
+ runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
214
+ /**
215
+ * Optional override for minimum version for collab.
216
+ * If not provided, the default for the given compatibilityMode will be used.
217
+ * @remarks
218
+ * This is useful when runtime options are overridden and change the minimum version for collab.
219
+ */
220
+ minVersionForCollabOverride?: MinimumVersionForCollab;
209
221
  }): IRuntimeFactory {
210
222
  const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(props.schema);
211
223
  const registry = props.rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);
@@ -214,6 +226,10 @@ export function createDOProviderContainerRuntimeFactory(props: {
214
226
  props.schema,
215
227
  props.compatibilityMode,
216
228
  new RootDataObjectFactory(sharedObjects, registry),
229
+ {
230
+ runtimeOptions: props.runtimeOptionOverrides,
231
+ minVersionForCollab: props.minVersionForCollabOverride,
232
+ },
217
233
  );
218
234
  }
219
235
 
@@ -278,20 +294,26 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
278
294
  RootDataObject,
279
295
  { InitialState: RootDataObjectProps }
280
296
  >,
297
+ overrides?: Partial<{
298
+ runtimeOptions: Partial<IContainerRuntimeOptions>;
299
+ minVersionForCollab: MinimumVersionForCollab;
300
+ }>,
281
301
  ) {
282
302
  super({
283
303
  registryEntries: [rootDataObjectFactory.registryEntry],
284
- runtimeOptions: compatibilityModeRuntimeOptions[compatibilityMode],
304
+ runtimeOptions: {
305
+ ...compatibilityModeRuntimeOptions[compatibilityMode],
306
+ ...overrides?.runtimeOptions,
307
+ },
285
308
  provideEntryPoint,
286
- minVersionForCollab: compatibilityModeToMinVersionForCollab[compatibilityMode],
309
+ minVersionForCollab:
310
+ overrides?.minVersionForCollab ??
311
+ compatibilityModeToMinVersionForCollab[compatibilityMode],
287
312
  });
288
313
  this.rootDataObjectFactory = rootDataObjectFactory;
289
314
  this.initialObjects = schema.initialObjects;
290
315
  }
291
316
 
292
- /**
293
- * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}
294
- */
295
317
  protected async containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void> {
296
318
  // The first time we create the container we create the RootDataObject
297
319
  await this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {
@@ -36,8 +36,6 @@ export function createServiceAudience<TMember extends IMember = IMember>(props:
36
36
  * the user and client details returned in {@link IMember}.
37
37
  *
38
38
  * @typeParam TMember - A service-specific {@link IMember} implementation.
39
- *
40
- * @internal
41
39
  */
42
40
  class ServiceAudience<TMember extends IMember = IMember>
43
41
  extends TypedEventEmitter<IServiceAudienceEvents<TMember>>
package/src/types.ts CHANGED
@@ -5,7 +5,12 @@
5
5
 
6
6
  import type { DataObjectKind } from "@fluidframework/aqueduct/internal";
7
7
  import type { ContainerExtensionStore } from "@fluidframework/container-runtime-definitions/internal";
8
- import type { IEvent, IEventProvider, IFluidLoadable } from "@fluidframework/core-interfaces";
8
+ import type {
9
+ IEvent,
10
+ IEventProvider,
11
+ IFluidHandle,
12
+ IFluidLoadable,
13
+ } from "@fluidframework/core-interfaces";
9
14
  import type { SharedObjectKind } from "@fluidframework/shared-object-base";
10
15
  import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
11
16
 
@@ -20,7 +25,6 @@ export type CompatibilityMode = "1" | "2";
20
25
 
21
26
  /**
22
27
  * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
23
- * @internal
24
28
  */
25
29
  export type LoadableObjectRecord = Record<string, IFluidLoadable>;
26
30
 
@@ -98,7 +102,6 @@ export interface ContainerSchema {
98
102
  /**
99
103
  * Holds the collection of objects that the container was initially created with, as well as provides the ability
100
104
  * to dynamically create further objects during usage.
101
- * @internal
102
105
  */
103
106
  export interface IRootDataObject {
104
107
  /**
@@ -114,6 +117,16 @@ export interface IRootDataObject {
114
117
  * @typeParam T - The class of the `DataObject` or `SharedObject`.
115
118
  */
116
119
  create<T>(objectClass: SharedObjectKind<T>): Promise<T>;
120
+
121
+ /**
122
+ * Upload a blob of data.
123
+ * Although it is marked as internal, there is external usage of this function for experimental purposes.
124
+ * Please contact yunho-microsoft or vladsud if you need to change it.
125
+ * @param blob - blob to be uploaded.
126
+ *
127
+ * @remarks This method is used to expose uploadBlob to the IFluidContainer level. UploadBlob will upload data to server side (as of now, ODSP only). There is no downloadBlob provided as it is not needed(blob lifetime managed by server).
128
+ */
129
+ uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
117
130
  }
118
131
 
119
132
  interface IProvideStaticEntryPoint {
@@ -121,7 +134,7 @@ interface IProvideStaticEntryPoint {
121
134
  }
122
135
 
123
136
  /**
124
- * @internal
137
+ * This is the internal entry point fluid-static creates.
125
138
  */
126
139
  export interface IStaticEntryPoint extends IProvideStaticEntryPoint {
127
140
  readonly rootDataObject: IRootDataObject;