@fluidframework/container-definitions 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.3.1.0.125672

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.
Files changed (72) hide show
  1. package/.eslintrc.js +20 -9
  2. package/README.md +5 -5
  3. package/api-extractor.json +2 -2
  4. package/dist/audience.d.ts +3 -4
  5. package/dist/audience.d.ts.map +1 -1
  6. package/dist/audience.js.map +1 -1
  7. package/dist/browserPackage.d.ts.map +1 -1
  8. package/dist/browserPackage.js +3 -3
  9. package/dist/browserPackage.js.map +1 -1
  10. package/dist/deltas.d.ts +12 -0
  11. package/dist/deltas.d.ts.map +1 -1
  12. package/dist/deltas.js.map +1 -1
  13. package/dist/error.d.ts.map +1 -1
  14. package/dist/error.js.map +1 -1
  15. package/dist/fluidModule.d.ts.map +1 -1
  16. package/dist/fluidModule.js.map +1 -1
  17. package/dist/fluidPackage.d.ts.map +1 -1
  18. package/dist/fluidPackage.js +5 -6
  19. package/dist/fluidPackage.js.map +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/loader.d.ts +20 -2
  24. package/dist/loader.d.ts.map +1 -1
  25. package/dist/loader.js.map +1 -1
  26. package/dist/runtime.d.ts +2 -1
  27. package/dist/runtime.d.ts.map +1 -1
  28. package/dist/runtime.js.map +1 -1
  29. package/dist/tokenProvider.d.ts.map +1 -1
  30. package/dist/tokenProvider.js.map +1 -1
  31. package/lib/audience.d.ts +3 -4
  32. package/lib/audience.d.ts.map +1 -1
  33. package/lib/audience.js.map +1 -1
  34. package/lib/browserPackage.d.ts.map +1 -1
  35. package/lib/browserPackage.js +3 -3
  36. package/lib/browserPackage.js.map +1 -1
  37. package/lib/deltas.d.ts +12 -0
  38. package/lib/deltas.d.ts.map +1 -1
  39. package/lib/deltas.js.map +1 -1
  40. package/lib/error.d.ts.map +1 -1
  41. package/lib/error.js.map +1 -1
  42. package/lib/fluidModule.d.ts.map +1 -1
  43. package/lib/fluidModule.js.map +1 -1
  44. package/lib/fluidPackage.d.ts.map +1 -1
  45. package/lib/fluidPackage.js +5 -6
  46. package/lib/fluidPackage.js.map +1 -1
  47. package/lib/index.d.ts +1 -1
  48. package/lib/index.d.ts.map +1 -1
  49. package/lib/index.js +1 -1
  50. package/lib/index.js.map +1 -1
  51. package/lib/loader.d.ts +20 -2
  52. package/lib/loader.d.ts.map +1 -1
  53. package/lib/loader.js.map +1 -1
  54. package/lib/runtime.d.ts +2 -1
  55. package/lib/runtime.d.ts.map +1 -1
  56. package/lib/runtime.js.map +1 -1
  57. package/lib/tokenProvider.d.ts.map +1 -1
  58. package/lib/tokenProvider.js.map +1 -1
  59. package/package.json +17 -14
  60. package/prettier.config.cjs +1 -1
  61. package/src/audience.ts +25 -22
  62. package/src/browserPackage.ts +33 -34
  63. package/src/deltas.ts +267 -245
  64. package/src/error.ts +58 -58
  65. package/src/fluidModule.ts +1 -1
  66. package/src/fluidPackage.ts +86 -86
  67. package/src/index.ts +51 -47
  68. package/src/loader.ts +498 -489
  69. package/src/runtime.ts +144 -148
  70. package/src/tokenProvider.ts +2 -2
  71. package/tsconfig.esnext.json +6 -6
  72. package/tsconfig.json +8 -15
package/src/error.ts CHANGED
@@ -9,77 +9,77 @@ import { ITelemetryProperties } from "@fluidframework/common-definitions";
9
9
  * Different error types the Container may report out to the Host
10
10
  */
11
11
  export enum ContainerErrorType {
12
- /**
13
- * Some error, most likely an exception caught by runtime and propagated to container as critical error
14
- */
15
- genericError = "genericError",
12
+ /**
13
+ * Some error, most likely an exception caught by runtime and propagated to container as critical error
14
+ */
15
+ genericError = "genericError",
16
16
 
17
- /**
18
- * Throttling error from server. Server is busy and is asking not to reconnect for some time
19
- */
20
- throttlingError = "throttlingError",
17
+ /**
18
+ * Throttling error from server. Server is busy and is asking not to reconnect for some time
19
+ */
20
+ throttlingError = "throttlingError",
21
21
 
22
- /**
23
- * Data loss error detected by Container / DeltaManager. Likely points to storage issue.
24
- */
25
- dataCorruptionError = "dataCorruptionError",
22
+ /**
23
+ * Data loss error detected by Container / DeltaManager. Likely points to storage issue.
24
+ */
25
+ dataCorruptionError = "dataCorruptionError",
26
26
 
27
- /**
28
- * Error encountered when processing an operation. May correlate with data corruption.
29
- */
30
- dataProcessingError = "dataProcessingError",
27
+ /**
28
+ * Error encountered when processing an operation. May correlate with data corruption.
29
+ */
30
+ dataProcessingError = "dataProcessingError",
31
31
 
32
- /**
33
- * Error indicating an API is being used improperly resulting in an invalid operation.
34
- */
35
- usageError = "usageError",
32
+ /**
33
+ * Error indicating an API is being used improperly resulting in an invalid operation.
34
+ */
35
+ usageError = "usageError",
36
36
 
37
- /**
38
- * Error indicating an client session has expired. Currently this only happens when GC is allowed on a document and
39
- * aids in safely deleting unused objects.
40
- */
41
- clientSessionExpiredError = "clientSessionExpiredError",
37
+ /**
38
+ * Error indicating an client session has expired. Currently this only happens when GC is allowed on a document and
39
+ * aids in safely deleting unused objects.
40
+ */
41
+ clientSessionExpiredError = "clientSessionExpiredError",
42
42
  }
43
43
 
44
44
  /**
45
45
  * Base interface for all errors and warnings at container level
46
46
  */
47
47
  export interface IErrorBase extends Partial<Error> {
48
- /** errorType is a union of error types from
49
- * - container
50
- * - runtime
51
- * - drivers
52
- */
53
- readonly errorType: string;
48
+ /** errorType is a union of error types from
49
+ * - container
50
+ * - runtime
51
+ * - drivers
52
+ */
53
+ readonly errorType: string;
54
54
 
55
- /**
56
- * See Error.message
57
- * Privacy Note - This is a freeform string that we may not control in all cases (e.g. a dependency throws an error)
58
- * If there are known cases where this contains privacy-sensitive data it will be tagged and included in the result
59
- * of getTelemetryProperties. When logging, consider fetching it that way rather than straight from this field.
60
- */
61
- readonly message: string;
62
- /** See Error.name */
63
- readonly name?: string;
64
- /** See Error.stack */
65
- readonly stack?: string;
66
- /**
67
- * Returns all properties of this error object that are either safe to log
68
- * or explicitly tagged as containing privacy-sensitive data.
69
- */
70
- getTelemetryProperties?(): ITelemetryProperties;
55
+ /**
56
+ * See Error.message
57
+ * Privacy Note - This is a freeform string that we may not control in all cases (e.g. a dependency throws an error)
58
+ * If there are known cases where this contains privacy-sensitive data it will be tagged and included in the result
59
+ * of getTelemetryProperties. When logging, consider fetching it that way rather than straight from this field.
60
+ */
61
+ readonly message: string;
62
+ /** See Error.name */
63
+ readonly name?: string;
64
+ /** See Error.stack */
65
+ readonly stack?: string;
66
+ /**
67
+ * Returns all properties of this error object that are either safe to log
68
+ * or explicitly tagged as containing privacy-sensitive data.
69
+ */
70
+ getTelemetryProperties?(): ITelemetryProperties;
71
71
  }
72
72
 
73
73
  /**
74
74
  * Represents warnings raised on container.
75
75
  */
76
76
  export interface ContainerWarning extends IErrorBase {
77
- /**
78
- * Whether this error has already been logged. Used to avoid logging errors twice.
79
- *
80
- * @defaultValue `false`
81
- */
82
- logged?: boolean;
77
+ /**
78
+ * Whether this error has already been logged. Used to avoid logging errors twice.
79
+ *
80
+ * @defaultValue `false`
81
+ */
82
+ logged?: boolean;
83
83
  }
84
84
 
85
85
  /**
@@ -91,21 +91,21 @@ export type ICriticalContainerError = IErrorBase;
91
91
  * Generic wrapper for an unrecognized/uncategorized error object
92
92
  */
93
93
  export interface IGenericError extends IErrorBase {
94
- readonly errorType: ContainerErrorType.genericError;
95
- error?: any;
94
+ readonly errorType: ContainerErrorType.genericError;
95
+ error?: any;
96
96
  }
97
97
 
98
98
  /**
99
99
  * Error indicating an API is being used improperly resulting in an invalid operation.
100
100
  */
101
101
  export interface IUsageError extends IErrorBase {
102
- readonly errorType: ContainerErrorType.usageError;
102
+ readonly errorType: ContainerErrorType.usageError;
103
103
  }
104
104
 
105
105
  /**
106
106
  * Warning emitted when requests to storage are being throttled
107
107
  */
108
108
  export interface IThrottlingWarning extends IErrorBase {
109
- readonly errorType: ContainerErrorType.throttlingError;
110
- readonly retryAfterSeconds: number;
109
+ readonly errorType: ContainerErrorType.throttlingError;
110
+ readonly retryAfterSeconds: number;
111
111
  }
@@ -8,5 +8,5 @@ import { IProvideFluidCodeDetailsComparer } from "./fluidPackage";
8
8
  import { IRuntimeFactory } from "./runtime";
9
9
 
10
10
  export interface IFluidModule {
11
- fluidExport: FluidObject<IRuntimeFactory & IProvideFluidCodeDetailsComparer>;
11
+ fluidExport: FluidObject<IRuntimeFactory & IProvideFluidCodeDetailsComparer>;
12
12
  }
@@ -7,26 +7,27 @@
7
7
  * Specifies an environment on Fluid property of a IFluidPackage.
8
8
  */
9
9
  export interface IFluidPackageEnvironment {
10
+ /**
11
+ * The name of the target. For a browser environment, this could be umd for scripts
12
+ * or css for styles.
13
+ */
14
+ [target: string]:
15
+ | undefined
16
+ | {
17
+ /**
18
+ * List of files for the target. These can be relative or absolute.
19
+ * The code loader should resolve relative paths, and validate all
20
+ * full urls.
21
+ */
22
+ files: string[];
10
23
 
11
- /**
12
- * The name of the target. For a browser environment, this could be umd for scripts
13
- * or css for styles.
14
- */
15
- [target: string]: undefined | {
16
- /**
17
- * List of files for the target. These can be relative or absolute.
18
- * The code loader should resolve relative paths, and validate all
19
- * full urls.
20
- */
21
- files: string[];
22
-
23
- /**
24
- * General access for extended fields as specific usages will
25
- * likely have additional infornamation like a definition
26
- * of Library, the entrypoint for umd packages.
27
- */
28
- [key: string]: unknown;
29
- };
24
+ /**
25
+ * General access for extended fields as specific usages will
26
+ * likely have additional infornamation like a definition
27
+ * of Library, the entrypoint for umd packages.
28
+ */
29
+ [key: string]: unknown;
30
+ };
30
31
  }
31
32
 
32
33
  /**
@@ -36,26 +37,26 @@ export interface IFluidPackageEnvironment {
36
37
  * {@link https://stackoverflow.com/questions/10065564/add-custom-metadata-or-config-to-package-json-is-it-valid}
37
38
  */
38
39
  export interface IFluidPackage {
39
- /**
40
- * The name of the package that this code represnets
41
- */
42
- name: string;
43
- /**
44
- * This object represents the Fluid specific properties of the package
45
- */
46
- fluid: {
47
- /**
48
- * The name of the of the environment. This should be something like browser, or node
49
- * and contain the necessary targets for loading this code in that environment.
50
- */
51
- [environment: string]: undefined | IFluidPackageEnvironment;
52
- };
53
- /**
54
- * General access for extended fields as specific usages will
55
- * likely have additional infornamation like a definition of
56
- * compatible versions, or deployment information like rings or rollouts.
57
- */
58
- [key: string]: unknown;
40
+ /**
41
+ * The name of the package that this code represnets
42
+ */
43
+ name: string;
44
+ /**
45
+ * This object represents the Fluid specific properties of the package
46
+ */
47
+ fluid: {
48
+ /**
49
+ * The name of the of the environment. This should be something like browser, or node
50
+ * and contain the necessary targets for loading this code in that environment.
51
+ */
52
+ [environment: string]: undefined | IFluidPackageEnvironment;
53
+ };
54
+ /**
55
+ * General access for extended fields as specific usages will
56
+ * likely have additional infornamation like a definition of
57
+ * compatible versions, or deployment information like rings or rollouts.
58
+ */
59
+ [key: string]: unknown;
59
60
  }
60
61
 
61
62
  /**
@@ -63,77 +64,76 @@ export interface IFluidPackage {
63
64
  * @param pkg - the package json data to check if it is a Fluid package.
64
65
  */
65
66
  export const isFluidPackage = (pkg: any): pkg is Readonly<IFluidPackage> =>
66
- typeof pkg === "object"
67
- && typeof pkg?.name === "string"
68
- && typeof pkg?.fluid === "object";
67
+ typeof pkg === "object" && typeof pkg?.name === "string" && typeof pkg?.fluid === "object";
69
68
 
70
69
  /**
71
70
  * Package manager configuration. Provides a key value mapping of config values
72
71
  */
73
72
  export interface IFluidCodeDetailsConfig {
74
- readonly [key: string]: string;
73
+ readonly [key: string]: string;
75
74
  }
76
75
 
77
76
  /**
78
77
  * Data structure used to describe the code to load on the Fluid document
79
78
  */
80
79
  export interface IFluidCodeDetails {
81
- /**
82
- * The code package to be used on the Fluid document. This is either the package name which will be loaded
83
- * from a package manager. Or the expanded Fluid package.
84
- */
85
- readonly package: string | Readonly<IFluidPackage>;
80
+ /**
81
+ * The code package to be used on the Fluid document. This is either the package name which will be loaded
82
+ * from a package manager. Or the expanded Fluid package.
83
+ */
84
+ readonly package: string | Readonly<IFluidPackage>;
86
85
 
87
- /**
88
- * Configuration details. This includes links to the package manager and base CDNs.
89
- *
90
- * @remarks This is strictly consumer-defined data.
91
- * Its contents and semantics (including whether or not this data is present) are completely up to the consumer.
92
- */
93
- readonly config?: IFluidCodeDetailsConfig;
86
+ /**
87
+ * Configuration details. This includes links to the package manager and base CDNs.
88
+ *
89
+ * @remarks This is strictly consumer-defined data.
90
+ * Its contents and semantics (including whether or not this data is present) are completely up to the consumer.
91
+ */
92
+ readonly config?: IFluidCodeDetailsConfig;
94
93
  }
95
94
 
96
95
  export const isFluidCodeDetails = (details: unknown): details is Readonly<IFluidCodeDetails> => {
97
- const maybeCodeDetails = details as Partial<IFluidCodeDetails> | undefined;
98
- return typeof maybeCodeDetails === "object"
99
- && (typeof maybeCodeDetails?.package === "string" || isFluidPackage(maybeCodeDetails?.package))
100
- && (maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === "object");
96
+ const maybeCodeDetails = details as Partial<IFluidCodeDetails> | undefined;
97
+ return (
98
+ typeof maybeCodeDetails === "object" &&
99
+ (typeof maybeCodeDetails?.package === "string" ||
100
+ isFluidPackage(maybeCodeDetails?.package)) &&
101
+ (maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === "object")
102
+ );
101
103
  };
102
104
 
103
- export const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer = "IFluidCodeDetailsComparer";
105
+ export const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer =
106
+ "IFluidCodeDetailsComparer";
104
107
 
105
108
  export interface IProvideFluidCodeDetailsComparer {
106
- readonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer ;
109
+ readonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer;
107
110
  }
108
111
 
109
112
  /**
110
113
  * Provides capability to compare Fluid code details.
111
114
  */
112
115
  export interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {
116
+ /**
117
+ * Determines if the `candidate` code details satisfy the constraints specified in `constraint` code details.
118
+ *
119
+ * Similar semantics to:
120
+ * {@link https://github.com/npm/node-semver#usage}
121
+ */
122
+ satisfies(candidate: IFluidCodeDetails, constraint: IFluidCodeDetails): Promise<boolean>;
113
123
 
114
- /**
115
- * Determines if the `candidate` code details satisfy the constraints specified in `constraint` code details.
116
- *
117
- * Similar semantics to:
118
- * {@link https://github.com/npm/node-semver#usage}
119
- */
120
- satisfies(candidate: IFluidCodeDetails, constraint: IFluidCodeDetails): Promise<boolean>;
121
-
122
- /* eslint-disable max-len */
123
- /**
124
- * Return a number representing the ascending sort order of the `a` and `b` code details:
125
- *
126
- * - `< 0` if `a < b`.
127
- *
128
- * - `= 0` if `a === b`.
129
- *
130
- * - `> 0` if `a > b`.
131
- *
132
- * - `undefined` if `a` is not comparable to `b`.
133
- *
134
- * Similar semantics to:
135
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description | Array.sort}
136
- */
137
- compare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined>;
138
- /* eslint-enable max-len */
124
+ /**
125
+ * Return a number representing the ascending sort order of the `a` and `b` code details:
126
+ *
127
+ * - `< 0` if `a < b`.
128
+ *
129
+ * - `= 0` if `a === b`.
130
+ *
131
+ * - `> 0` if `a > b`.
132
+ *
133
+ * - `undefined` if `a` is not comparable to `b`.
134
+ *
135
+ * Similar semantics to:
136
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description | Array.sort}
137
+ */
138
+ compare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined>;
139
139
  }
package/src/index.ts CHANGED
@@ -10,62 +10,66 @@
10
10
  */
11
11
 
12
12
  export { IAudience, IAudienceOwner } from "./audience";
13
- export { IFluidBrowserPackage, IFluidBrowserPackageEnvironment, isFluidBrowserPackage } from "./browserPackage";
14
13
  export {
15
- IConnectionDetails,
16
- IDeltaHandlerStrategy,
17
- IDeltaManager,
18
- IDeltaManagerEvents,
19
- IDeltaSender,
20
- IDeltaQueue,
21
- IDeltaQueueEvents,
22
- ReadOnlyInfo,
14
+ IFluidBrowserPackage,
15
+ IFluidBrowserPackageEnvironment,
16
+ isFluidBrowserPackage,
17
+ } from "./browserPackage";
18
+ export {
19
+ IConnectionDetails,
20
+ IDeltaHandlerStrategy,
21
+ IDeltaManager,
22
+ IDeltaManagerEvents,
23
+ IDeltaSender,
24
+ IDeltaQueue,
25
+ IDeltaQueueEvents,
26
+ ReadOnlyInfo,
23
27
  } from "./deltas";
24
28
  export {
25
- ContainerErrorType,
26
- ContainerWarning,
27
- ICriticalContainerError,
28
- IErrorBase,
29
- IGenericError,
30
- IUsageError,
31
- IThrottlingWarning,
29
+ ContainerErrorType,
30
+ ContainerWarning,
31
+ ICriticalContainerError,
32
+ IErrorBase,
33
+ IGenericError,
34
+ IUsageError,
35
+ IThrottlingWarning,
32
36
  } from "./error";
33
37
  export {
34
- ConnectionState,
35
- ICodeAllowList,
36
- ICodeDetailsLoader,
37
- IContainer,
38
- IContainerEvents,
39
- IContainerLoadMode,
40
- IFluidCodeResolver,
41
- IFluidModuleWithDetails,
42
- IHostLoader,
43
- ILoader,
44
- ILoaderHeader,
45
- ILoaderOptions,
46
- IPendingLocalState,
47
- IProvideLoader,
48
- IResolvedFluidCodeDetails,
49
- ISnapshotTreeWithBlobContents,
50
- LoaderHeader,
38
+ ConnectionState,
39
+ ICodeAllowList,
40
+ ICodeDetailsLoader,
41
+ IContainer,
42
+ IContainerEvents,
43
+ IContainerLoadMode,
44
+ IFluidCodeResolver,
45
+ IFluidModuleWithDetails,
46
+ IHostLoader,
47
+ ILoader,
48
+ ILoaderHeader,
49
+ ILoaderOptions,
50
+ IPendingLocalState,
51
+ IProvideLoader,
52
+ IResolvedFluidCodeDetails,
53
+ ISnapshotTreeWithBlobContents,
54
+ LoaderHeader,
51
55
  } from "./loader";
52
56
  export { IFluidModule } from "./fluidModule";
53
57
  export {
54
- IFluidPackage,
55
- IFluidPackageEnvironment,
56
- IFluidCodeDetails,
57
- IFluidCodeDetailsComparer,
58
- IFluidCodeDetailsConfig,
59
- IProvideFluidCodeDetailsComparer,
60
- isFluidPackage,
61
- isFluidCodeDetails,
58
+ IFluidPackage,
59
+ IFluidPackageEnvironment,
60
+ IFluidCodeDetails,
61
+ IFluidCodeDetailsComparer,
62
+ IFluidCodeDetailsConfig,
63
+ IProvideFluidCodeDetailsComparer,
64
+ isFluidPackage,
65
+ isFluidCodeDetails,
62
66
  } from "./fluidPackage";
63
67
  export {
64
- AttachState,
65
- IBatchMessage,
66
- IContainerContext,
67
- IProvideRuntimeFactory,
68
- IRuntime,
69
- IRuntimeFactory,
68
+ AttachState,
69
+ IBatchMessage,
70
+ IContainerContext,
71
+ IProvideRuntimeFactory,
72
+ IRuntime,
73
+ IRuntimeFactory,
70
74
  } from "./runtime";
71
75
  export { IFluidTokenProvider, IProvideFluidTokenProvider } from "./tokenProvider";