@fluidframework/aqueduct 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419

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 (178) hide show
  1. package/README.md +67 -29
  2. package/dist/aqueduct-alpha.d.ts +365 -0
  3. package/dist/aqueduct-beta.d.ts +100 -0
  4. package/dist/aqueduct-public.d.ts +100 -0
  5. package/dist/aqueduct-untrimmed.d.ts +365 -0
  6. package/dist/container-runtime-factories/{baseContainerRuntimeFactory.js → baseContainerRuntimeFactory.cjs} +33 -19
  7. package/dist/container-runtime-factories/baseContainerRuntimeFactory.cjs.map +1 -0
  8. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +20 -8
  9. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  10. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs +66 -0
  11. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs.map +1 -0
  12. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +21 -2
  13. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  14. package/dist/container-runtime-factories/index.cjs +12 -0
  15. package/dist/container-runtime-factories/index.cjs.map +1 -0
  16. package/dist/container-runtime-factories/index.d.ts +2 -2
  17. package/dist/container-runtime-factories/index.d.ts.map +1 -1
  18. package/dist/data-object-factories/{dataObjectFactory.js → dataObjectFactory.cjs} +3 -2
  19. package/dist/data-object-factories/dataObjectFactory.cjs.map +1 -0
  20. package/dist/data-object-factories/dataObjectFactory.d.ts +1 -0
  21. package/dist/data-object-factories/dataObjectFactory.d.ts.map +1 -1
  22. package/dist/data-object-factories/index.cjs +12 -0
  23. package/dist/data-object-factories/index.cjs.map +1 -0
  24. package/dist/data-object-factories/index.d.ts +2 -2
  25. package/dist/data-object-factories/index.d.ts.map +1 -1
  26. package/dist/data-object-factories/{pureDataObjectFactory.js → pureDataObjectFactory.cjs} +27 -10
  27. package/dist/data-object-factories/pureDataObjectFactory.cjs.map +1 -0
  28. package/dist/data-object-factories/pureDataObjectFactory.d.ts +2 -5
  29. package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  30. package/dist/data-objects/{dataObject.js → dataObject.cjs} +4 -21
  31. package/dist/data-objects/dataObject.cjs.map +1 -0
  32. package/dist/data-objects/dataObject.d.ts +1 -5
  33. package/dist/data-objects/dataObject.d.ts.map +1 -1
  34. package/dist/data-objects/{index.js → index.cjs} +3 -3
  35. package/dist/data-objects/index.cjs.map +1 -0
  36. package/dist/data-objects/pureDataObject.cjs +120 -0
  37. package/dist/data-objects/pureDataObject.cjs.map +1 -0
  38. package/dist/data-objects/pureDataObject.d.ts +8 -29
  39. package/dist/data-objects/pureDataObject.d.ts.map +1 -1
  40. package/dist/data-objects/{types.js → types.cjs} +1 -1
  41. package/dist/data-objects/types.cjs.map +1 -0
  42. package/dist/data-objects/types.d.ts +5 -2
  43. package/dist/data-objects/types.d.ts.map +1 -1
  44. package/dist/index.cjs +31 -0
  45. package/dist/index.cjs.map +1 -0
  46. package/dist/index.d.ts +5 -8
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/tsdoc-metadata.json +11 -0
  49. package/lib/aqueduct-alpha.d.mts +365 -0
  50. package/lib/aqueduct-beta.d.mts +100 -0
  51. package/lib/aqueduct-public.d.mts +100 -0
  52. package/lib/aqueduct-untrimmed.d.mts +365 -0
  53. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.mts +59 -0
  54. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.mts.map +1 -0
  55. package/lib/container-runtime-factories/{baseContainerRuntimeFactory.js → baseContainerRuntimeFactory.mjs} +33 -20
  56. package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs.map +1 -0
  57. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.mts +45 -0
  58. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.mts.map +1 -0
  59. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs +62 -0
  60. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs.map +1 -0
  61. package/lib/container-runtime-factories/index.d.mts +7 -0
  62. package/lib/container-runtime-factories/index.d.mts.map +1 -0
  63. package/lib/container-runtime-factories/index.mjs +7 -0
  64. package/lib/container-runtime-factories/index.mjs.map +1 -0
  65. package/lib/data-object-factories/dataObjectFactory.d.mts +23 -0
  66. package/lib/data-object-factories/dataObjectFactory.d.mts.map +1 -0
  67. package/lib/data-object-factories/{dataObjectFactory.js → dataObjectFactory.mjs} +4 -3
  68. package/lib/data-object-factories/dataObjectFactory.mjs.map +1 -0
  69. package/lib/data-object-factories/index.d.mts +7 -0
  70. package/lib/data-object-factories/index.d.mts.map +1 -0
  71. package/lib/data-object-factories/index.mjs +7 -0
  72. package/lib/data-object-factories/index.mjs.map +1 -0
  73. package/lib/data-object-factories/pureDataObjectFactory.d.mts +91 -0
  74. package/lib/data-object-factories/pureDataObjectFactory.d.mts.map +1 -0
  75. package/lib/data-object-factories/{pureDataObjectFactory.js → pureDataObjectFactory.mjs} +27 -10
  76. package/lib/data-object-factories/pureDataObjectFactory.mjs.map +1 -0
  77. package/lib/data-objects/dataObject.d.mts +38 -0
  78. package/lib/data-objects/dataObject.d.mts.map +1 -0
  79. package/lib/data-objects/{dataObject.js → dataObject.mjs} +4 -21
  80. package/lib/data-objects/dataObject.mjs.map +1 -0
  81. package/lib/data-objects/index.d.mts +8 -0
  82. package/lib/data-objects/index.d.mts.map +1 -0
  83. package/lib/data-objects/index.mjs +7 -0
  84. package/lib/data-objects/index.mjs.map +1 -0
  85. package/lib/data-objects/pureDataObject.d.mts +94 -0
  86. package/lib/data-objects/pureDataObject.d.mts.map +1 -0
  87. package/lib/data-objects/{pureDataObject.js → pureDataObject.mjs} +37 -70
  88. package/lib/data-objects/pureDataObject.mjs.map +1 -0
  89. package/lib/data-objects/types.d.mts +36 -0
  90. package/lib/data-objects/types.d.mts.map +1 -0
  91. package/lib/data-objects/{types.js → types.mjs} +1 -1
  92. package/lib/data-objects/types.mjs.map +1 -0
  93. package/lib/index.d.mts +8 -0
  94. package/lib/index.d.mts.map +1 -0
  95. package/lib/index.mjs +8 -0
  96. package/lib/index.mjs.map +1 -0
  97. package/package.json +141 -70
  98. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js.map +0 -1
  99. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +0 -35
  100. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +0 -1
  101. package/dist/container-runtime-factories/index.js +0 -19
  102. package/dist/container-runtime-factories/index.js.map +0 -1
  103. package/dist/container-services/containerServices.d.ts +0 -27
  104. package/dist/container-services/containerServices.d.ts.map +0 -1
  105. package/dist/container-services/containerServices.js +0 -84
  106. package/dist/container-services/containerServices.js.map +0 -1
  107. package/dist/container-services/index.d.ts +0 -6
  108. package/dist/container-services/index.d.ts.map +0 -1
  109. package/dist/container-services/index.js +0 -18
  110. package/dist/container-services/index.js.map +0 -1
  111. package/dist/data-object-factories/dataObjectFactory.js.map +0 -1
  112. package/dist/data-object-factories/index.js +0 -19
  113. package/dist/data-object-factories/index.js.map +0 -1
  114. package/dist/data-object-factories/pureDataObjectFactory.js.map +0 -1
  115. package/dist/data-objects/dataObject.js.map +0 -1
  116. package/dist/data-objects/index.js.map +0 -1
  117. package/dist/data-objects/pureDataObject.js +0 -153
  118. package/dist/data-objects/pureDataObject.js.map +0 -1
  119. package/dist/data-objects/types.js.map +0 -1
  120. package/dist/index.js +0 -37
  121. package/dist/index.js.map +0 -1
  122. package/dist/request-handlers/index.d.ts +0 -6
  123. package/dist/request-handlers/index.d.ts.map +0 -1
  124. package/dist/request-handlers/index.js +0 -18
  125. package/dist/request-handlers/index.js.map +0 -1
  126. package/dist/request-handlers/requestHandlers.d.ts +0 -36
  127. package/dist/request-handlers/requestHandlers.d.ts.map +0 -1
  128. package/dist/request-handlers/requestHandlers.js +0 -83
  129. package/dist/request-handlers/requestHandlers.js.map +0 -1
  130. package/dist/test/containerServices.spec.js +0 -121
  131. package/dist/test/containerServices.spec.js.map +0 -1
  132. package/dist/test/defaultRoute.spec.js +0 -72
  133. package/dist/test/defaultRoute.spec.js.map +0 -1
  134. package/dist/test/tsconfig.tsbuildinfo +0 -1
  135. package/dist/test/types/validateAqueductPrevious.js +0 -43
  136. package/dist/test/types/validateAqueductPrevious.js.map +0 -1
  137. package/dist/utils/attachUtils.d.ts +0 -7
  138. package/dist/utils/attachUtils.d.ts.map +0 -1
  139. package/dist/utils/attachUtils.js +0 -20
  140. package/dist/utils/attachUtils.js.map +0 -1
  141. package/dist/utils/containerInteractions.d.ts +0 -36
  142. package/dist/utils/containerInteractions.d.ts.map +0 -1
  143. package/dist/utils/containerInteractions.js +0 -70
  144. package/dist/utils/containerInteractions.js.map +0 -1
  145. package/dist/utils/index.d.ts +0 -7
  146. package/dist/utils/index.d.ts.map +0 -1
  147. package/dist/utils/index.js +0 -19
  148. package/dist/utils/index.js.map +0 -1
  149. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +0 -1
  150. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +0 -31
  151. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +0 -1
  152. package/lib/container-runtime-factories/index.js +0 -7
  153. package/lib/container-runtime-factories/index.js.map +0 -1
  154. package/lib/container-services/containerServices.js +0 -79
  155. package/lib/container-services/containerServices.js.map +0 -1
  156. package/lib/container-services/index.js +0 -6
  157. package/lib/container-services/index.js.map +0 -1
  158. package/lib/data-object-factories/dataObjectFactory.js.map +0 -1
  159. package/lib/data-object-factories/index.js +0 -7
  160. package/lib/data-object-factories/index.js.map +0 -1
  161. package/lib/data-object-factories/pureDataObjectFactory.js.map +0 -1
  162. package/lib/data-objects/dataObject.js.map +0 -1
  163. package/lib/data-objects/index.js +0 -7
  164. package/lib/data-objects/index.js.map +0 -1
  165. package/lib/data-objects/pureDataObject.js.map +0 -1
  166. package/lib/data-objects/types.js.map +0 -1
  167. package/lib/index.js +0 -25
  168. package/lib/index.js.map +0 -1
  169. package/lib/request-handlers/index.js +0 -6
  170. package/lib/request-handlers/index.js.map +0 -1
  171. package/lib/request-handlers/requestHandlers.js +0 -77
  172. package/lib/request-handlers/requestHandlers.js.map +0 -1
  173. package/lib/utils/attachUtils.js +0 -16
  174. package/lib/utils/attachUtils.js.map +0 -1
  175. package/lib/utils/containerInteractions.js +0 -64
  176. package/lib/utils/containerInteractions.js.map +0 -1
  177. package/lib/utils/index.js +0 -7
  178. package/lib/utils/index.js.map +0 -1
@@ -2,66 +2,63 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert, EventForwarder } from "@fluidframework/common-utils";
6
- import { FluidObjectHandle } from "@fluidframework/datastore";
7
- import { handleFromLegacyUri } from "@fluidframework/request-handler";
8
- import { serviceRoutePathRoot } from "../container-services";
9
- import { defaultFluidObjectRequestHandler } from "../request-handlers";
5
+ import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
+ import { assert } from "@fluidframework/core-utils";
7
+ import { create404Response } from "@fluidframework/runtime-utils";
10
8
  /**
11
9
  * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
12
10
  * You probably don't want to inherit from this data store directly unless
13
11
  * you are creating another base data store class
14
12
  *
15
13
  * @typeParam I - The optional input types used to strongly type the data object
14
+ * @alpha
16
15
  */
17
- export class PureDataObject extends EventForwarder {
16
+ export class PureDataObject extends TypedEventEmitter {
17
+ get id() {
18
+ return this.runtime.id;
19
+ }
20
+ get IFluidLoadable() {
21
+ return this;
22
+ }
23
+ get IFluidHandle() {
24
+ return this.handle;
25
+ }
26
+ /**
27
+ * Handle to a data store
28
+ */
29
+ get handle() {
30
+ // PureDataObjectFactory already provides an entryPoint initialization function to the data store runtime,
31
+ // so this object should always have access to a non-null entryPoint. Need to cast because PureDataObject
32
+ // tried to be too smart with its typing for handles :).
33
+ assert(this.runtime.entryPoint !== undefined, 0x46b /* EntryPoint was undefined */);
34
+ return this.runtime.entryPoint;
35
+ }
36
+ static async getDataObject(runtime) {
37
+ const obj = await runtime.entryPoint.get();
38
+ return obj;
39
+ }
18
40
  constructor(props) {
19
41
  super();
20
- this._disposed = false;
21
42
  this.runtime = props.runtime;
22
43
  this.context = props.context;
23
44
  this.providers = props.providers;
24
45
  this.initProps = props.initProps;
25
46
  assert(this.runtime._dataObject === undefined, 0x0bd /* "Object runtime already has DataObject!" */);
26
47
  this.runtime._dataObject = this;
27
- // Create a FluidObjectHandle with empty string as `path`. This is because reaching this PureDataObject is the
28
- // same as reaching its routeContext (FluidDataStoreRuntime) so the relative path to it from the
29
- // routeContext is empty.
30
- this.innerHandle = new FluidObjectHandle(this, "", this.runtime.objectsRoutingContext);
31
- // Container event handlers
32
- this.runtime.once("dispose", () => {
33
- this._disposed = true;
34
- this.dispose();
35
- });
36
48
  }
37
- get disposed() { return this._disposed; }
38
- get id() { return this.runtime.id; }
39
- get IFluidRouter() { return this; }
40
- get IFluidLoadable() { return this; }
41
- get IFluidHandle() { return this.innerHandle; }
42
- /**
43
- * Handle to a data store
44
- */
45
- get handle() { return this.innerHandle; }
46
- static async getDataObject(runtime) {
47
- const obj = runtime._dataObject;
48
- assert(obj !== undefined, 0x0bc /* "Runtime has no DataObject!" */);
49
- await obj.finishInitialization(true);
50
- return obj;
51
- }
52
- // #region IFluidRouter
53
49
  /**
54
50
  * Return this object if someone requests it directly
55
51
  * We will return this object in two scenarios:
56
- * 1. the request url is a "/"
57
- * 2. the request url is empty
52
+ *
53
+ * 1. the request url is a "/"
54
+ *
55
+ * 2. the request url is empty
58
56
  */
59
57
  async request(req) {
60
- return defaultFluidObjectRequestHandler(this, req);
58
+ return req.url === "" || req.url === "/" || req.url.startsWith("/?")
59
+ ? { mimeType: "fluid/object", status: 200, value: this }
60
+ : create404Response(req);
61
61
  }
62
- // #endregion IFluidRouter
63
- // #region IFluidLoadable
64
- // #endregion IFluidLoadable
65
62
  /**
66
63
  * Call this API to ensure PureDataObject is fully initialized.
67
64
  * Initialization happens on demand, only on as-needed bases.
@@ -84,40 +81,16 @@ export class PureDataObject extends EventForwarder {
84
81
  * responsible for ensuring this is only invoked once.
85
82
  */
86
83
  async initializeInternal(existing) {
87
- var _a;
88
84
  await this.preInitialize();
89
85
  if (existing) {
90
86
  assert(this.initProps === undefined, 0x0be /* "Trying to initialize from existing while initProps is set!" */);
91
87
  await this.initializingFromExisting();
92
88
  }
93
89
  else {
94
- await this.initializingFirstTime((_a = this.context.createProps) !== null && _a !== void 0 ? _a : this.initProps);
90
+ await this.initializingFirstTime(this.context.createProps ?? this.initProps);
95
91
  }
96
92
  await this.hasInitialized();
97
93
  }
98
- /**
99
- * Retrieve Fluid object using the handle get
100
- *
101
- * @param key - key that object (handle/id) is stored with in the directory
102
- * @param directory - directory containing the object
103
- * @param getObjectFromDirectory - optional callback for fetching object from the directory, allows users to
104
- * define custom types/getters for object retrieval
105
- */
106
- async getFluidObjectFromDirectory(key, directory, getObjectFromDirectory) {
107
- const handleMaybe = getObjectFromDirectory ? getObjectFromDirectory(key, directory) : directory.get(key);
108
- const handle = handleMaybe === null || handleMaybe === void 0 ? void 0 : handleMaybe.IFluidHandle;
109
- if (handle) {
110
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
111
- return handle.get();
112
- }
113
- }
114
- /**
115
- * Gets the service at a given id.
116
- * @param id - service id
117
- */
118
- async getService(id) {
119
- return handleFromLegacyUri(`/${serviceRoutePathRoot}/${id}`, this.context.containerRuntime).get();
120
- }
121
94
  /**
122
95
  * Called every time the data store is initialized, before initializingFirstTime or
123
96
  * initializingFromExisting is called.
@@ -139,11 +112,5 @@ export class PureDataObject extends EventForwarder {
139
112
  * Called every time the data store is initialized after create or existing.
140
113
  */
141
114
  async hasInitialized() { }
142
- /**
143
- * Called when the host container closes and disposes itself
144
- */
145
- dispose() {
146
- super.dispose();
147
- }
148
115
  }
149
- //# sourceMappingURL=pureDataObject.js.map
116
+ //# sourceMappingURL=pureDataObject.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pureDataObject.mjs","sourceRoot":"","sources":["../../src/data-objects/pureDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAY5C,EAAE,iBAAiB,EAAE,MAAM,+BAA+B;AAGjE;;;;;;;GAOG;AACH,MAAM,OAAgB,cACrB,SAAQ,iBAAuC;IA0B/C,IAAW,EAAE;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IACxB,CAAC;IACD,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QAChB,0GAA0G;QAC1G,yGAAyG;QACzG,wDAAwD;QACxD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,OAAO,CAAC,UAAgC,CAAC;IACtD,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,OAA+B;QAChE,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;QAC3C,OAAO,GAAqB,CAAC;IAC9B,CAAC;IAED,YAAmB,KAA0B;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAEjC,MAAM,CACJ,IAAI,CAAC,OAAe,CAAC,WAAW,KAAK,SAAS,EAC/C,KAAK,CAAC,8CAA8C,CACpD,CAAC;QACD,IAAI,CAAC,OAAe,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1C,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,OAAO,CAAC,GAAa;QACjC,OAAO,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;YACnE,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE;YACxD,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,oBAAoB,CAAC,QAAiB;QAClD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;YACnC,OAAO,IAAI,CAAC,WAAW,CAAC;SACxB;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,kBAAkB,CAAC,QAAiB;QAChD,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC3B,IAAI,QAAQ,EAAE;YACb,MAAM,CACL,IAAI,CAAC,SAAS,KAAK,SAAS,EAC5B,KAAK,CAAC,kEAAkE,CACxE,CAAC;YACF,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;SACtC;aAAM;YACN,MAAM,IAAI,CAAC,qBAAqB,CAC9B,IAAI,CAAC,OAAO,CAAC,WAAiC,IAAI,IAAI,CAAC,SAAS,CACjE,CAAC;SACF;QACD,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,aAAa,KAAmB,CAAC;IAEjD;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAAyB,IAAkB,CAAC;IAElF;;;OAGG;IACO,KAAK,CAAC,wBAAwB,KAAmB,CAAC;IAE5D;;OAEG;IACO,KAAK,CAAC,cAAc,KAAmB,CAAC;CAClD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tIEvent,\n\tIFluidHandle,\n\tIFluidLoadable,\n\tIProvideFluidHandle,\n\tIRequest,\n\tIResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { create404Response } from \"@fluidframework/runtime-utils\";\nimport { DataObjectTypes, IDataObjectProps } from \"./types\";\n\n/**\n * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.\n * You probably don't want to inherit from this data store directly unless\n * you are creating another base data store class\n *\n * @typeParam I - The optional input types used to strongly type the data object\n * @alpha\n */\nexport abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes>\n\textends TypedEventEmitter<I[\"Events\"] & IEvent>\n\timplements IFluidLoadable, IProvideFluidHandle\n{\n\t/**\n\t * This is your FluidDataStoreRuntime object\n\t */\n\tprotected readonly runtime: IFluidDataStoreRuntime;\n\n\t/**\n\t * This context is used to talk up to the ContainerRuntime\n\t */\n\tprotected readonly context: IFluidDataStoreContext;\n\n\t/**\n\t * Providers are FluidObject keyed objects that provide back\n\t * a promise to the corresponding FluidObject or undefined.\n\t * Providers injected/provided by the Container and/or HostingApplication\n\t *\n\t * To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store\n\t */\n\tprotected readonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\n\tprotected initProps?: I[\"InitialState\"];\n\n\tprotected initializeP: Promise<void> | undefined;\n\n\tpublic get id() {\n\t\treturn this.runtime.id;\n\t}\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\tpublic get IFluidHandle() {\n\t\treturn this.handle;\n\t}\n\n\t/**\n\t * Handle to a data store\n\t */\n\tpublic get handle(): IFluidHandle<this> {\n\t\t// PureDataObjectFactory already provides an entryPoint initialization function to the data store runtime,\n\t\t// so this object should always have access to a non-null entryPoint. Need to cast because PureDataObject\n\t\t// tried to be too smart with its typing for handles :).\n\t\tassert(this.runtime.entryPoint !== undefined, 0x46b /* EntryPoint was undefined */);\n\t\treturn this.runtime.entryPoint as IFluidHandle<this>;\n\t}\n\n\tpublic static async getDataObject(runtime: IFluidDataStoreRuntime) {\n\t\tconst obj = await runtime.entryPoint.get();\n\t\treturn obj as PureDataObject;\n\t}\n\n\tpublic constructor(props: IDataObjectProps<I>) {\n\t\tsuper();\n\t\tthis.runtime = props.runtime;\n\t\tthis.context = props.context;\n\t\tthis.providers = props.providers;\n\t\tthis.initProps = props.initProps;\n\n\t\tassert(\n\t\t\t(this.runtime as any)._dataObject === undefined,\n\t\t\t0x0bd /* \"Object runtime already has DataObject!\" */,\n\t\t);\n\t\t(this.runtime as any)._dataObject = this;\n\t}\n\n\t/**\n\t * Return this object if someone requests it directly\n\t * We will return this object in two scenarios:\n\t *\n\t * 1. the request url is a \"/\"\n\t *\n\t * 2. the request url is empty\n\t */\n\tpublic async request(req: IRequest): Promise<IResponse> {\n\t\treturn req.url === \"\" || req.url === \"/\" || req.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(req);\n\t}\n\n\t/**\n\t * Call this API to ensure PureDataObject is fully initialized.\n\t * Initialization happens on demand, only on as-needed bases.\n\t * In most cases you should allow factory/object to decide when to finish initialization.\n\t * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods\n\t * and need a fully initialized object, then you can call this API to ensure object is fully initialized.\n\t */\n\tpublic async finishInitialization(existing: boolean): Promise<void> {\n\t\tif (this.initializeP !== undefined) {\n\t\t\treturn this.initializeP;\n\t\t}\n\t\tthis.initializeP = this.initializeInternal(existing);\n\t\treturn this.initializeP;\n\t}\n\n\t/**\n\t * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should\n\t * generally not be done.\n\t *\n\t * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is\n\t * responsible for ensuring this is only invoked once.\n\t */\n\tpublic async initializeInternal(existing: boolean): Promise<void> {\n\t\tawait this.preInitialize();\n\t\tif (existing) {\n\t\t\tassert(\n\t\t\t\tthis.initProps === undefined,\n\t\t\t\t0x0be /* \"Trying to initialize from existing while initProps is set!\" */,\n\t\t\t);\n\t\t\tawait this.initializingFromExisting();\n\t\t} else {\n\t\t\tawait this.initializingFirstTime(\n\t\t\t\t(this.context.createProps as I[\"InitialState\"]) ?? this.initProps,\n\t\t\t);\n\t\t}\n\t\tawait this.hasInitialized();\n\t}\n\n\t/**\n\t * Called every time the data store is initialized, before initializingFirstTime or\n\t * initializingFromExisting is called.\n\t */\n\tprotected async preInitialize(): Promise<void> {}\n\n\t/**\n\t * Called the first time the data store is initialized (new creations with a new\n\t * data store runtime)\n\t *\n\t * @param props - Optional props to be passed in on create\n\t */\n\tprotected async initializingFirstTime(props?: I[\"InitialState\"]): Promise<void> {}\n\n\t/**\n\t * Called every time but the first time the data store is initialized (creations\n\t * with an existing data store runtime)\n\t */\n\tprotected async initializingFromExisting(): Promise<void> {}\n\n\t/**\n\t * Called every time the data store is initialized after create or existing.\n\t */\n\tprotected async hasInitialized(): Promise<void> {}\n}\n"]}
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IEvent, FluidObject } from "@fluidframework/core-interfaces";
6
+ import { AsyncFluidObjectProvider } from "@fluidframework/synthesize";
7
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
8
+ import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
9
+ /**
10
+ * This type is used as the base generic input to DataObject and PureDataObject.
11
+ * @alpha
12
+ */
13
+ export interface DataObjectTypes {
14
+ /**
15
+ * represents a type that will define optional providers that will be injected
16
+ */
17
+ OptionalProviders?: FluidObject;
18
+ /**
19
+ * the initial state type that the produced data object may take during creation
20
+ */
21
+ InitialState?: any;
22
+ /**
23
+ * represents events that will be available in the EventForwarder
24
+ */
25
+ Events?: IEvent;
26
+ }
27
+ /**
28
+ * @alpha
29
+ */
30
+ export interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
31
+ readonly runtime: IFluidDataStoreRuntime;
32
+ readonly context: IFluidDataStoreContext;
33
+ readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
34
+ readonly initProps?: I["InitialState"];
35
+ }
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iCAAiC;OAC9D,EAAE,wBAAwB,EAAE,MAAM,4BAA4B;OAC9D,EAAE,sBAAsB,EAAE,MAAM,qCAAqC;OACrE,EAAE,sBAAsB,EAAE,MAAM,uCAAuC;AAE9E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC5E,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;CACvC"}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=types.js.map
6
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/data-objects/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { AsyncFluidObjectProvider } from \"@fluidframework/synthesize\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\n\n/**\n * This type is used as the base generic input to DataObject and PureDataObject.\n * @alpha\n */\nexport interface DataObjectTypes {\n\t/**\n\t * represents a type that will define optional providers that will be injected\n\t */\n\tOptionalProviders?: FluidObject;\n\t/**\n\t * the initial state type that the produced data object may take during creation\n\t */\n\tInitialState?: any;\n\t/**\n\t * represents events that will be available in the EventForwarder\n\t */\n\tEvents?: IEvent;\n}\n\n/**\n * @alpha\n */\nexport interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly context: IFluidDataStoreContext;\n\treadonly providers: AsyncFluidObjectProvider<I[\"OptionalProviders\"]>;\n\treadonly initProps?: I[\"InitialState\"];\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { DataObjectFactory, PureDataObjectFactory } from "./data-object-factories/index.mjs";
6
+ export { DataObject, DataObjectTypes, IDataObjectProps, PureDataObject } from "./data-objects/index.mjs";
7
+ export { BaseContainerRuntimeFactory, ContainerRuntimeFactoryWithDefaultDataStore, } from "./container-runtime-factories/index.mjs";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAiBI,EAAE,iBAAiB,EAAE,qBAAqB,EAAE;OAC5C,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE;OACjE,EACN,2BAA2B,EAC3B,2CAA2C,GAC3C"}
package/lib/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { DataObjectFactory, PureDataObjectFactory } from "./data-object-factories/index.mjs";
6
+ export { DataObject, PureDataObject } from "./data-objects/index.mjs";
7
+ export { BaseContainerRuntimeFactory, ContainerRuntimeFactoryWithDefaultDataStore, } from "./container-runtime-factories/index.mjs";
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAiBI,EAAE,iBAAiB,EAAE,qBAAqB,EAAE;OAC5C,EAAE,UAAU,EAAqC,cAAc,EAAE;OACjE,EACN,2BAA2B,EAC3B,2CAA2C,GAC3C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `aqueduct` package is a library for building Fluid objects and Fluid\n * containers within the Fluid Framework. Its goal is to provide a thin base\n * layer over the existing Fluid Framework interfaces that allows developers to\n * get started quickly.\n *\n * @remarks\n * About the library name: An \"aqueduct\" is a way to transport water from a source\n * to another location. The library name was chosen because its purpose is to\n * facilitate using lower level constructs and therefore handle 'fluid' items\n * same as an aqueduct.\n *\n * @packageDocumentation\n */\n\nexport { DataObjectFactory, PureDataObjectFactory } from \"./data-object-factories\";\nexport { DataObject, DataObjectTypes, IDataObjectProps, PureDataObject } from \"./data-objects\";\nexport {\n\tBaseContainerRuntimeFactory,\n\tContainerRuntimeFactoryWithDefaultDataStore,\n} from \"./container-runtime-factories\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/aqueduct",
3
- "version": "1.4.0-115997",
3
+ "version": "2.0.0-dev-rc.1.0.0.224419",
4
4
  "description": "A set of implementations for Fluid Framework interfaces.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,47 +11,37 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
- "main": "dist/index.js",
15
- "module": "lib/index.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./lib/index.d.mts",
18
+ "default": "./lib/index.mjs"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.cjs"
23
+ }
24
+ }
25
+ },
26
+ "main": "dist/index.cjs",
27
+ "module": "lib/index.mjs",
16
28
  "types": "dist/index.d.ts",
17
29
  "files": [
18
30
  "dist/**/*",
31
+ "!dist/test/**",
19
32
  "lib/**/*"
20
33
  ],
21
- "scripts": {
22
- "build": "concurrently npm:build:compile npm:lint && npm run build:docs",
23
- "build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
24
- "build:compile": "concurrently npm:build:commonjs npm:build:esnext",
25
- "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
26
- "build:esnext": "tsc --project ./tsconfig.esnext.json",
27
- "build:full": "npm run build",
28
- "build:full:compile": "npm run build:compile",
29
- "build:test": "tsc --project ./src/test/tsconfig.json",
30
- "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
31
- "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
32
- "eslint": "eslint --format stylish src",
33
- "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
34
- "lint": "npm run eslint",
35
- "lint:fix": "npm run eslint:fix",
36
- "test": "npm run test:mocha",
37
- "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
38
- "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
39
- "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
40
- "tsc": "tsc",
41
- "typetests:gen": "flub generate typetests --generate --dir . --no-generateInName",
42
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
43
- },
44
- "nyc": {
34
+ "c8": {
45
35
  "all": true,
46
36
  "cache-dir": "nyc/.cache",
47
37
  "exclude": [
48
- "src/test/**/*.ts",
49
- "dist/test/**/*.js"
38
+ "src/test/**/*.*ts",
39
+ "dist/test/**/*.*js"
50
40
  ],
51
41
  "exclude-after-remap": false,
52
42
  "include": [
53
- "src/**/*.ts",
54
- "dist/**/*.js"
43
+ "src/**/*.*ts",
44
+ "dist/**/*.*js"
55
45
  ],
56
46
  "report-dir": "nyc/report",
57
47
  "reporter": [
@@ -62,48 +52,129 @@
62
52
  "temp-directory": "nyc/.nyc_output"
63
53
  },
64
54
  "dependencies": {
65
- "@fluidframework/common-definitions": "^0.20.1",
66
- "@fluidframework/common-utils": "^0.32.1",
67
- "@fluidframework/container-definitions": "1.4.0-115997",
68
- "@fluidframework/container-loader": "1.4.0-115997",
69
- "@fluidframework/container-runtime": "1.4.0-115997",
70
- "@fluidframework/container-runtime-definitions": "1.4.0-115997",
71
- "@fluidframework/core-interfaces": "1.4.0-115997",
72
- "@fluidframework/datastore": "1.4.0-115997",
73
- "@fluidframework/datastore-definitions": "1.4.0-115997",
74
- "@fluidframework/map": "1.4.0-115997",
75
- "@fluidframework/request-handler": "1.4.0-115997",
76
- "@fluidframework/runtime-definitions": "1.4.0-115997",
77
- "@fluidframework/runtime-utils": "1.4.0-115997",
78
- "@fluidframework/synthesize": "1.4.0-115997",
79
- "@fluidframework/view-interfaces": "1.4.0-115997",
80
- "uuid": "^8.3.1"
55
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.1.0.0.224419",
56
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.1.0.0.224419",
57
+ "@fluidframework/container-runtime": "2.0.0-dev-rc.1.0.0.224419",
58
+ "@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.1.0.0.224419",
59
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.224419",
60
+ "@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.224419",
61
+ "@fluidframework/datastore": "2.0.0-dev-rc.1.0.0.224419",
62
+ "@fluidframework/datastore-definitions": "2.0.0-dev-rc.1.0.0.224419",
63
+ "@fluidframework/map": "2.0.0-dev-rc.1.0.0.224419",
64
+ "@fluidframework/request-handler": "2.0.0-dev-rc.1.0.0.224419",
65
+ "@fluidframework/runtime-definitions": "2.0.0-dev-rc.1.0.0.224419",
66
+ "@fluidframework/runtime-utils": "2.0.0-dev-rc.1.0.0.224419",
67
+ "@fluidframework/synthesize": "2.0.0-dev-rc.1.0.0.224419",
68
+ "@fluidframework/view-interfaces": "2.0.0-dev-rc.1.0.0.224419",
69
+ "uuid": "^9.0.0"
81
70
  },
82
71
  "devDependencies": {
83
- "@fluidframework/aqueduct-previous": "npm:@fluidframework/aqueduct@1.3.1",
84
- "@fluidframework/build-common": "^0.24.0",
85
- "@fluidframework/build-tools": "^0.6.0-110101",
86
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
87
- "@fluidframework/mocha-test-setup": "1.4.0-115997",
88
- "@microsoft/api-extractor": "^7.22.2",
89
- "@rushstack/eslint-config": "^2.5.1",
72
+ "@arethetypeswrong/cli": "^0.13.3",
73
+ "@fluid-tools/build-cli": "0.29.0-222379",
74
+ "@fluidframework/aqueduct-previous": "npm:@fluidframework/aqueduct@2.0.0-internal.7.2.0",
75
+ "@fluidframework/build-common": "^2.0.3",
76
+ "@fluidframework/build-tools": "0.29.0-222379",
77
+ "@fluidframework/eslint-config-fluid": "^3.1.0",
78
+ "@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.224419",
79
+ "@microsoft/api-extractor": "^7.38.3",
80
+ "@types/events": "^3.0.0",
90
81
  "@types/mocha": "^9.1.1",
91
- "@types/node": "^14.18.0",
92
- "concurrently": "^6.2.0",
93
- "copyfiles": "^2.1.0",
94
- "cross-env": "^7.0.2",
95
- "eslint": "~8.6.0",
96
- "mocha": "^10.0.0",
97
- "nyc": "^15.0.0",
98
- "rimraf": "^2.6.2",
99
- "typescript": "~4.5.5",
100
- "typescript-formatter": "7.1.0"
82
+ "@types/node": "^18.19.0",
83
+ "c8": "^7.7.1",
84
+ "copyfiles": "^2.4.1",
85
+ "cross-env": "^7.0.3",
86
+ "eslint": "~8.50.0",
87
+ "mocha": "^10.2.0",
88
+ "mocha-json-output-reporter": "^2.0.1",
89
+ "mocha-multi-reporters": "^1.5.1",
90
+ "moment": "^2.21.0",
91
+ "prettier": "~3.0.3",
92
+ "renamer": "^4.0.0",
93
+ "rimraf": "^4.4.0",
94
+ "tsc-multi": "^1.1.0",
95
+ "typescript": "~5.1.6"
96
+ },
97
+ "fluidBuild": {
98
+ "tasks": {
99
+ "build:docs": {
100
+ "dependsOn": [
101
+ "...",
102
+ "api-extractor:commonjs",
103
+ "api-extractor:esnext"
104
+ ],
105
+ "script": false
106
+ }
107
+ }
101
108
  },
102
- "module:es5": "es5/index.js",
103
109
  "typeValidation": {
104
- "version": "1.4.0",
105
- "baselineRange": "~1.3.0",
106
- "baselineVersion": "1.3.1",
107
- "broken": {}
110
+ "broken": {
111
+ "RemovedFunctionDeclaration_getDefaultObjectFromContainer": {
112
+ "forwardCompat": false,
113
+ "backCompat": false
114
+ },
115
+ "RemovedFunctionDeclaration_getObjectFromContainer": {
116
+ "forwardCompat": false,
117
+ "backCompat": false
118
+ },
119
+ "RemovedFunctionDeclaration_getObjectWithIdFromContainer": {
120
+ "forwardCompat": false,
121
+ "backCompat": false
122
+ },
123
+ "RemovedFunctionDeclaration_defaultFluidObjectRequestHandler": {
124
+ "forwardCompat": false,
125
+ "backCompat": false
126
+ },
127
+ "RemovedVariableDeclaration_defaultRouteRequestHandler": {
128
+ "forwardCompat": false,
129
+ "backCompat": false
130
+ },
131
+ "RemovedVariableDeclaration_mountableViewRequestHandler": {
132
+ "forwardCompat": false,
133
+ "backCompat": false
134
+ },
135
+ "ClassDeclaration_DataObject": {
136
+ "backCompat": false
137
+ },
138
+ "RemovedInterfaceDeclaration_IRootDataObjectFactory": {
139
+ "forwardCompat": false,
140
+ "backCompat": false
141
+ },
142
+ "ClassDeclaration_PureDataObject": {
143
+ "backCompat": false
144
+ },
145
+ "InterfaceDeclaration_IDataObjectProps": {
146
+ "backCompat": false
147
+ }
148
+ }
149
+ },
150
+ "scripts": {
151
+ "api": "fluid-build . --task api",
152
+ "api-extractor:commonjs": "api-extractor run --local",
153
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
154
+ "build": "fluid-build . --task build",
155
+ "build:commonjs": "fluid-build . --task commonjs",
156
+ "build:compile": "fluid-build . --task compile",
157
+ "build:docs": "fluid-build . --task api",
158
+ "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
159
+ "build:rename-types": "renamer \"lib/**\" -f .d.ts -r .d.mts --force",
160
+ "build:test": "tsc-multi --config ./tsc-multi.test.json",
161
+ "check:are-the-types-wrong": "attw --pack",
162
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
163
+ "ci:build:docs": "api-extractor run",
164
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
165
+ "eslint": "eslint --format stylish src",
166
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
167
+ "format": "npm run prettier:fix",
168
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
169
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
170
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
171
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
172
+ "test": "npm run test:mocha",
173
+ "test:coverage": "c8 npm test",
174
+ "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
175
+ "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
176
+ "tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
177
+ "typetests:gen": "fluid-type-test-generator",
178
+ "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
108
179
  }
109
- }
180
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAI2C;AAC3C,iGAEuD;AACvD,qEAGyC;AAMzC,2DAIoC;AACpC,iEAAqE;AAGrE;;;;GAIG;AACH,MAAa,2BACT,SAAQ,oCAAoB;IAK5B;;;;;OAKG;IACH,YACqB,eAAmD,EACnD,mBAAiD,EACjD,kBAA2C,EAAE,EAC7C,cAAyC;QAE1D,KAAK,EAAE,CAAC;QALS,oBAAe,GAAf,eAAe,CAAoC;QACnD,wBAAmB,GAAnB,mBAAmB,CAA8B;QACjD,oBAAe,GAAf,eAAe,CAA8B;QAC7C,mBAAc,GAAd,cAAc,CAA2B;QAG1D,IAAI,CAAC,QAAQ,GAAG,IAAI,0CAAsB,CAAC,eAAe,CAAC,CAAC;IAChE,CAAC;IAjBD,IAAW,uBAAuB,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAmBvD,KAAK,CAAC,oBAAoB,CAAC,OAAyB;QACvD,MAAM,IAAI,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;QAC1D,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,aAAa,CACtB,OAA0B,EAC1B,QAAiB;QAEjB,MAAM,KAAK,GAAgD,OAAO,CAAC,KAAK,CAAC;QACzE,MAAM,EAAE,GAAG,IAAI,gCAAmB,CAC9B,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACjE,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC;QAEvC,MAAM,OAAO,GAAqB,MAAM,oCAAgB,CAAC,IAAI,CACzD,OAAO,EACP,IAAI,CAAC,eAAe,EACpB,IAAA,4CAA0B,EACtB,GAAG,IAAI,CAAC,eAAe,CAAC,EAC5B,IAAI,CAAC,cAAc,EACnB,KAAK,EACL,QAAQ,CACX,CAAC;QAEF,wFAAwF;QACxF,EAAE,CAAC,QAAQ,CAAC,iDAAiB,EAAE,OAAO,CAAC,CAAC;QAExC,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B,IAAI,CAAC;IAE9E;;;;OAIG;IACO,KAAK,CAAC,uBAAuB,CAAC,OAA0B,IAAI,CAAC;CAC1E;AArED,kEAqEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainerContext } from \"@fluidframework/container-definitions\";\nimport {\n IContainerRuntimeOptions,\n FluidDataStoreRegistry,\n ContainerRuntime,\n} from \"@fluidframework/container-runtime\";\nimport {\n IContainerRuntime,\n} from \"@fluidframework/container-runtime-definitions\";\nimport {\n RuntimeRequestHandler,\n buildRuntimeRequestHandler,\n} from \"@fluidframework/request-handler\";\nimport {\n IFluidDataStoreRegistry,\n IProvideFluidDataStoreRegistry,\n NamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n DependencyContainer,\n IFluidDependencySynthesizer,\n IProvideFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * BaseContainerRuntimeFactory produces container runtimes with a given data store and service registry, as well as\n * given request handlers. It can be subclassed to implement a first-time initialization procedure for the containers\n * it creates.\n */\nexport class BaseContainerRuntimeFactory\n extends RuntimeFactoryHelper\n implements IProvideFluidDataStoreRegistry {\n public get IFluidDataStoreRegistry() { return this.registry; }\n private readonly registry: IFluidDataStoreRegistry;\n\n /**\n * @param registryEntries - The data store registry for containers produced\n * @param serviceRegistry - The service registry for containers produced\n * @param requestHandlers - Request handlers for containers produced\n * @param runtimeOptions - The runtime options passed to the ContainerRuntime when instantiating it\n */\n constructor(\n private readonly registryEntries: NamedFluidDataStoreRegistryEntries,\n private readonly dependencyContainer?: IFluidDependencySynthesizer,\n private readonly requestHandlers: RuntimeRequestHandler[] = [],\n private readonly runtimeOptions?: IContainerRuntimeOptions,\n ) {\n super();\n this.registry = new FluidDataStoreRegistry(registryEntries);\n }\n\n public async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n await this.containerInitializingFirstTime(runtime);\n await this.containerHasInitialized(runtime);\n }\n\n public async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n await this.containerHasInitialized(runtime);\n }\n\n public async preInitialize(\n context: IContainerContext,\n existing: boolean,\n ): Promise<ContainerRuntime> {\n const scope: Partial<IProvideFluidDependencySynthesizer> = context.scope;\n const dc = new DependencyContainer<FluidObject<IContainerRuntime>>(\n this.dependencyContainer, scope.IFluidDependencySynthesizer);\n scope.IFluidDependencySynthesizer = dc;\n\n const runtime: ContainerRuntime = await ContainerRuntime.load(\n context,\n this.registryEntries,\n buildRuntimeRequestHandler(\n ...this.requestHandlers),\n this.runtimeOptions,\n scope,\n existing,\n );\n\n // we register the runtime so developers of providers can use it in the factory pattern.\n dc.register(IContainerRuntime, runtime);\n\n return runtime;\n }\n\n /**\n * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container\n * is created. This likely includes creating any initial data stores that are expected to be there at the outset.\n * @param runtime - The container runtime for the container being initialized\n */\n protected async containerInitializingFirstTime(runtime: IContainerRuntime) { }\n\n /**\n * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.\n * This likely includes loading any data stores that are expected to be there at the outset.\n * @param runtime - The container runtime for the container being initialized\n */\n protected async containerHasInitialized(runtime: IContainerRuntime) { }\n}\n"]}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ContainerRuntimeFactoryWithDefaultDataStore = void 0;
8
- const request_handlers_1 = require("../request-handlers");
9
- const baseContainerRuntimeFactory_1 = require("./baseContainerRuntimeFactory");
10
- const defaultDataStoreId = "default";
11
- /**
12
- * A ContainerRuntimeFactory that initializes Containers with a single default data store, which can be requested from
13
- * the container with an empty URL.
14
- *
15
- * This factory should be exposed as fluidExport off the entry point to your module.
16
- */
17
- class ContainerRuntimeFactoryWithDefaultDataStore extends baseContainerRuntimeFactory_1.BaseContainerRuntimeFactory {
18
- constructor(defaultFactory, registryEntries, dependencyContainer, requestHandlers = [], runtimeOptions) {
19
- super(registryEntries, dependencyContainer, [
20
- (0, request_handlers_1.defaultRouteRequestHandler)(defaultDataStoreId),
21
- ...requestHandlers,
22
- ], runtimeOptions);
23
- this.defaultFactory = defaultFactory;
24
- }
25
- /**
26
- * {@inheritDoc BaseContainerRuntimeFactory.containerInitializingFirstTime}
27
- */
28
- async containerInitializingFirstTime(runtime) {
29
- const dataStore = await runtime.createDataStore(this.defaultFactory.type);
30
- await dataStore.trySetAlias(defaultDataStoreId);
31
- }
32
- }
33
- exports.ContainerRuntimeFactoryWithDefaultDataStore = ContainerRuntimeFactoryWithDefaultDataStore;
34
- ContainerRuntimeFactoryWithDefaultDataStore.defaultDataStoreId = defaultDataStoreId;
35
- //# sourceMappingURL=containerRuntimeFactoryWithDefaultDataStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerRuntimeFactoryWithDefaultDataStore.js","sourceRoot":"","sources":["../../src/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,0DAAiE;AACjE,+EAA4E;AAE5E,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAErC;;;;;GAKG;AACH,MAAa,2CAA4C,SAAQ,yDAA2B;IAGxF,YACuB,cAAsC,EACzD,eAAmD,EACnD,mBAAiD,EACjD,kBAA2C,EAAE,EAC7C,cAAyC;QAEzC,KAAK,CACD,eAAe,EACf,mBAAmB,EACnB;YACI,IAAA,6CAA0B,EAAC,kBAAkB,CAAC;YAC9C,GAAG,eAAe;SACrB,EACD,cAAc,CACjB,CAAC;QAdiB,mBAAc,GAAd,cAAc,CAAwB;IAe7D,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACrE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1E,MAAM,SAAS,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACpD,CAAC;;AA3BL,kGA4BC;AA3B0B,8DAAkB,GAAG,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IFluidDataStoreFactory, NamedFluidDataStoreRegistryEntries } from \"@fluidframework/runtime-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IFluidDependencySynthesizer } from \"@fluidframework/synthesize\";\nimport { RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { defaultRouteRequestHandler } from \"../request-handlers\";\nimport { BaseContainerRuntimeFactory } from \"./baseContainerRuntimeFactory\";\n\nconst defaultDataStoreId = \"default\";\n\n/**\n * A ContainerRuntimeFactory that initializes Containers with a single default data store, which can be requested from\n * the container with an empty URL.\n *\n * This factory should be exposed as fluidExport off the entry point to your module.\n */\nexport class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {\n public static readonly defaultDataStoreId = defaultDataStoreId;\n\n constructor(\n protected readonly defaultFactory: IFluidDataStoreFactory,\n registryEntries: NamedFluidDataStoreRegistryEntries,\n dependencyContainer?: IFluidDependencySynthesizer,\n requestHandlers: RuntimeRequestHandler[] = [],\n runtimeOptions?: IContainerRuntimeOptions,\n ) {\n super(\n registryEntries,\n dependencyContainer,\n [\n defaultRouteRequestHandler(defaultDataStoreId),\n ...requestHandlers,\n ],\n runtimeOptions,\n );\n }\n\n /**\n * {@inheritDoc BaseContainerRuntimeFactory.containerInitializingFirstTime}\n */\n protected async containerInitializingFirstTime(runtime: IContainerRuntime) {\n const dataStore = await runtime.createDataStore(this.defaultFactory.type);\n await dataStore.trySetAlias(defaultDataStoreId);\n }\n}\n"]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./baseContainerRuntimeFactory"), exports);
18
- __exportStar(require("./containerRuntimeFactoryWithDefaultDataStore"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/container-runtime-factories/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,gEAA8C;AAC9C,gFAA8D","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./baseContainerRuntimeFactory\";\nexport * from \"./containerRuntimeFactoryWithDefaultDataStore\";\n"]}
@@ -1,27 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IResponse, IFluidRouter, IRequest, FluidObject } from "@fluidframework/core-interfaces";
6
- import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
7
- import { RuntimeRequestHandler } from "@fluidframework/request-handler";
8
- export declare const serviceRoutePathRoot = "_services";
9
- export declare type ContainerServiceRegistryEntries = Iterable<[
10
- string,
11
- (runtime: IContainerRuntime) => Promise<FluidObject>
12
- ]>;
13
- /**
14
- * This class is a simple starter class for building a Container Service. It simply provides routing
15
- */
16
- export declare abstract class BaseContainerService implements IFluidRouter {
17
- protected readonly runtime: IContainerRuntime;
18
- get IFluidRouter(): this;
19
- constructor(runtime: IContainerRuntime);
20
- request(request: IRequest): Promise<IResponse>;
21
- }
22
- /**
23
- * Given a collection of IContainerServices will produce a RequestHandler for them all
24
- * @param serviceRegistry - Collection of Container Services
25
- */
26
- export declare const generateContainerServicesRequestHandler: (serviceRegistry: ContainerServiceRegistryEntries) => RuntimeRequestHandler;
27
- //# sourceMappingURL=containerServices.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerServices.d.ts","sourceRoot":"","sources":["../../src/container-services/containerServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAQxE,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,oBAAY,+BAA+B,GAAG,QAAQ,CAAC;IAAC,MAAM;IAAE,CAAC,OAAO,EAAE,iBAAiB,KACvF,OAAO,CAAC,WAAW,CAAC;CAAC,CAAC,CAAC;AAE3B;;GAEG;AACH,8BAAsB,oBAAqB,YAAW,YAAY;IAGlD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB;IAFzD,IAAW,YAAY,SAAmB;gBAEX,OAAO,EAAE,iBAAiB;IAG5C,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CAO9D;AAoBD;;;GAGG;AACH,eAAO,MAAM,uCAAuC,wDACI,qBA0CnD,CAAC"}