@fluidframework/driver-web-cache 2.21.0 → 2.22.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/.eslintrc.cjs CHANGED
@@ -17,6 +17,5 @@ module.exports = {
17
17
  "@typescript-eslint/strict-boolean-expressions": "off",
18
18
  "@typescript-eslint/promise-function-async": "off",
19
19
  "@typescript-eslint/no-misused-promises": "off",
20
- "@fluid-internal/fluid/no-unchecked-record-access": "warn",
21
20
  },
22
21
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/driver-web-cache
2
2
 
3
+ ## 2.22.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.21.0
4
8
 
5
9
  Dependency updates only.
package/README.md CHANGED
@@ -104,6 +104,7 @@ When making such a request please include if the configuration already works (an
104
104
  ### Supported Runtimes
105
105
 
106
106
  - NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
107
+ - Running Fluid in a Node.js environment with the `--no-experimental-fetch` flag is not supported.
107
108
  - Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
108
109
 
109
110
  ### Supported Tools
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/driver-web-cache";
8
- export declare const pkgVersion = "2.21.0";
8
+ export declare const pkgVersion = "2.22.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/driver-web-cache";
11
- exports.pkgVersion = "2.21.0";
11
+ exports.pkgVersion = "2.22.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-web-cache\";\nexport const pkgVersion = \"2.21.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-web-cache\";\nexport const pkgVersion = \"2.22.0\";\n"]}
@@ -50,13 +50,12 @@ function ensureIdleCallback(timeout = 0) {
50
50
  function runTasks(filter, shouldContinueRunning) {
51
51
  // The next value for the task queue
52
52
  const newTaskQueue = [];
53
- for (let index = 0; index < taskQueue.length; index += 1) {
53
+ for (const [index, taskQueueItem] of taskQueue.entries()) {
54
54
  if (shouldContinueRunning && !shouldContinueRunning()) {
55
55
  // Add the tasks we didn't get to to the end of the new task queue
56
56
  newTaskQueue.push(...taskQueue.slice(index));
57
57
  break;
58
58
  }
59
- const taskQueueItem = taskQueue[index];
60
59
  if (filter && !filter(taskQueueItem)) {
61
60
  newTaskQueue.push(taskQueueItem);
62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,qBAAqB,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;YACvD,kEAAkE;YAClE,YAAY,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7C,MAAM;QACP,CAAC;QAED,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAEvC,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACP,aAAa,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACF,CAAC;IAED,SAAS,GAAG,YAAY,CAAC;AAC1B,CAAC;AAED,uCAAuC;AACvC,SAAS,gBAAgB,CAAC,QAGzB;IACA,wEAAwE;IACxE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,WAAW,CAAC,CAAC;IAClE,iBAAiB,GAAG,KAAK,CAAC;IAE1B,4EAA4E;IAC5E,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,kBAAkB,EAAE,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\ninterface TaskQueueItem {\n\t/** The task to run */\n\ttask: () => void;\n}\n\n// A set of tasks that still have to be run\nlet taskQueue: TaskQueueItem[] = [];\n\n// Set to true when we have a pending idle task scheduled\nlet idleTaskScheduled = false;\n\n/**\n * A function that schedules a non critical task to be run when the browser has cycles available\n * @param task - The task to be executed\n * @param options - Optional configuration for the task execution\n */\nexport function scheduleIdleTask(task: () => void) {\n\ttaskQueue.push({\n\t\ttask,\n\t});\n\n\tensureIdleCallback(2000);\n}\n\n/**\n * Ensures an idle callback has been scheduled for the remaining tasks\n */\nfunction ensureIdleCallback(timeout: number = 0) {\n\tif (!idleTaskScheduled) {\n\t\t// Exception added when eslint rule was added, this should be revisited when modifying this code\n\t\tif (self.requestIdleCallback) {\n\t\t\tself.requestIdleCallback(idleTaskCallback);\n\t\t} else {\n\t\t\tconst deadline = Date.now() + 50;\n\t\t\tself.setTimeout(\n\t\t\t\t() =>\n\t\t\t\t\tidleTaskCallback({\n\t\t\t\t\t\ttimeRemaining: () => Math.max(deadline - Date.now(), 0),\n\t\t\t\t\t\tdidTimeout: false,\n\t\t\t\t\t}),\n\t\t\t\ttimeout,\n\t\t\t);\n\t\t}\n\t\tidleTaskScheduled = true;\n\t}\n}\n\n/**\n * Runs tasks from the task queue\n * @param filter - An optional function that will be called for each task to see if it should run.\n * Returns false for tasks that should not run. If omitted all tasks run.\n * @param shouldContinueRunning - An optional function that will be called to determine if\n * we have enough time to continue running tasks. If omitted, we don't stop running tasks.\n */\nfunction runTasks(\n\tfilter?: (taskQueueItem: TaskQueueItem) => boolean,\n\tshouldContinueRunning?: () => boolean,\n) {\n\t// The next value for the task queue\n\tconst newTaskQueue: TaskQueueItem[] = [];\n\n\tfor (let index = 0; index < taskQueue.length; index += 1) {\n\t\tif (shouldContinueRunning && !shouldContinueRunning()) {\n\t\t\t// Add the tasks we didn't get to to the end of the new task queue\n\t\t\tnewTaskQueue.push(...taskQueue.slice(index));\n\t\t\tbreak;\n\t\t}\n\n\t\tconst taskQueueItem = taskQueue[index];\n\n\t\tif (filter && !filter(taskQueueItem)) {\n\t\t\tnewTaskQueue.push(taskQueueItem);\n\t\t} else {\n\t\t\ttaskQueueItem.task();\n\t\t}\n\t}\n\n\ttaskQueue = newTaskQueue;\n}\n\n// Runs all the tasks in the task queue\nfunction idleTaskCallback(deadline: {\n\ttimeRemaining: () => number;\n\treadonly didTimeout: boolean;\n}) {\n\t// Minimum time that must be available on deadline to run any more tasks\n\tconst minTaskTime = 10;\n\trunTasks(undefined, () => deadline.timeRemaining() > minTaskTime);\n\tidleTaskScheduled = false;\n\n\t// If we didn't run through the entire queue, schedule another idle callback\n\tif (taskQueue.length > 0) {\n\t\tensureIdleCallback();\n\t}\n}\n"]}
1
+ {"version":3,"file":"scheduleIdleTask.js","sourceRoot":"","sources":["../src/scheduleIdleTask.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,2CAA2C;AAC3C,IAAI,SAAS,GAAoB,EAAE,CAAC;AAEpC,yDAAyD;AACzD,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAE9B;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAgB;IAChD,SAAS,CAAC,IAAI,CAAC;QACd,IAAI;KACJ,CAAC,CAAC;IAEH,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAND,4CAMC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,UAAkB,CAAC;IAC9C,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,gGAAgG;QAChG,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACP,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CACd,GAAG,EAAE,CACJ,gBAAgB,CAAC;gBAChB,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBACvD,UAAU,EAAE,KAAK;aACjB,CAAC,EACH,OAAO,CACP,CAAC;QACH,CAAC;QACD,iBAAiB,GAAG,IAAI,CAAC;IAC1B,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,SAAS,QAAQ,CAChB,MAAkD,EAClD,qBAAqC;IAErC,oCAAoC;IACpC,MAAM,YAAY,GAAoB,EAAE,CAAC;IAEzC,KAAK,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1D,IAAI,qBAAqB,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;YACvD,kEAAkE;YAClE,YAAY,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7C,MAAM;QACP,CAAC;QAED,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACP,aAAa,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACF,CAAC;IAED,SAAS,GAAG,YAAY,CAAC;AAC1B,CAAC;AAED,uCAAuC;AACvC,SAAS,gBAAgB,CAAC,QAGzB;IACA,wEAAwE;IACxE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,WAAW,CAAC,CAAC;IAClE,iBAAiB,GAAG,KAAK,CAAC;IAE1B,4EAA4E;IAC5E,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,kBAAkB,EAAE,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\ninterface TaskQueueItem {\n\t/** The task to run */\n\ttask: () => void;\n}\n\n// A set of tasks that still have to be run\nlet taskQueue: TaskQueueItem[] = [];\n\n// Set to true when we have a pending idle task scheduled\nlet idleTaskScheduled = false;\n\n/**\n * A function that schedules a non critical task to be run when the browser has cycles available\n * @param task - The task to be executed\n * @param options - Optional configuration for the task execution\n */\nexport function scheduleIdleTask(task: () => void) {\n\ttaskQueue.push({\n\t\ttask,\n\t});\n\n\tensureIdleCallback(2000);\n}\n\n/**\n * Ensures an idle callback has been scheduled for the remaining tasks\n */\nfunction ensureIdleCallback(timeout: number = 0) {\n\tif (!idleTaskScheduled) {\n\t\t// Exception added when eslint rule was added, this should be revisited when modifying this code\n\t\tif (self.requestIdleCallback) {\n\t\t\tself.requestIdleCallback(idleTaskCallback);\n\t\t} else {\n\t\t\tconst deadline = Date.now() + 50;\n\t\t\tself.setTimeout(\n\t\t\t\t() =>\n\t\t\t\t\tidleTaskCallback({\n\t\t\t\t\t\ttimeRemaining: () => Math.max(deadline - Date.now(), 0),\n\t\t\t\t\t\tdidTimeout: false,\n\t\t\t\t\t}),\n\t\t\t\ttimeout,\n\t\t\t);\n\t\t}\n\t\tidleTaskScheduled = true;\n\t}\n}\n\n/**\n * Runs tasks from the task queue\n * @param filter - An optional function that will be called for each task to see if it should run.\n * Returns false for tasks that should not run. If omitted all tasks run.\n * @param shouldContinueRunning - An optional function that will be called to determine if\n * we have enough time to continue running tasks. If omitted, we don't stop running tasks.\n */\nfunction runTasks(\n\tfilter?: (taskQueueItem: TaskQueueItem) => boolean,\n\tshouldContinueRunning?: () => boolean,\n) {\n\t// The next value for the task queue\n\tconst newTaskQueue: TaskQueueItem[] = [];\n\n\tfor (const [index, taskQueueItem] of taskQueue.entries()) {\n\t\tif (shouldContinueRunning && !shouldContinueRunning()) {\n\t\t\t// Add the tasks we didn't get to to the end of the new task queue\n\t\t\tnewTaskQueue.push(...taskQueue.slice(index));\n\t\t\tbreak;\n\t\t}\n\n\t\tif (filter && !filter(taskQueueItem)) {\n\t\t\tnewTaskQueue.push(taskQueueItem);\n\t\t} else {\n\t\t\ttaskQueueItem.task();\n\t\t}\n\t}\n\n\ttaskQueue = newTaskQueue;\n}\n\n// Runs all the tasks in the task queue\nfunction idleTaskCallback(deadline: {\n\ttimeRemaining: () => number;\n\treadonly didTimeout: boolean;\n}) {\n\t// Minimum time that must be available on deadline to run any more tasks\n\tconst minTaskTime = 10;\n\trunTasks(undefined, () => deadline.timeRemaining() > minTaskTime);\n\tidleTaskScheduled = false;\n\n\t// If we didn't run through the entire queue, schedule another idle callback\n\tif (taskQueue.length > 0) {\n\t\tensureIdleCallback();\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/driver-web-cache";
8
- export declare const pkgVersion = "2.21.0";
8
+ export declare const pkgVersion = "2.22.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/driver-web-cache";
8
- export const pkgVersion = "2.21.0";
8
+ export const pkgVersion = "2.22.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-web-cache\";\nexport const pkgVersion = \"2.21.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-web-cache\";\nexport const pkgVersion = \"2.22.0\";\n"]}
@@ -46,13 +46,12 @@ function ensureIdleCallback(timeout = 0) {
46
46
  function runTasks(filter, shouldContinueRunning) {
47
47
  // The next value for the task queue
48
48
  const newTaskQueue = [];
49
- for (let index = 0; index < taskQueue.length; index += 1) {
49
+ for (const [index, taskQueueItem] of taskQueue.entries()) {
50
50
  if (shouldContinueRunning && !shouldContinueRunning()) {
51
51
  // Add the tasks we didn't get to to the end of the new task queue
52
52
  newTaskQueue.push(...taskQueue.slice(index));
53
53
  break;
54
54
  }
55
- const taskQueueItem = taskQueue[index];
56
55
  if (filter && !filter(taskQueueItem)) {
57
56
  newTaskQueue.push(taskQueueItem);
58
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scheduleIdleTask.js","sourceRoot":"","sources":["../src/scheduleIdleTask.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,2CAA2C;AAC3C,IAAI,SAAS,GAAoB,EAAE,CAAC;AAEpC,yDAAyD;AACzD,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAE9B;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAChD,SAAS,CAAC,IAAI,CAAC;QACd,IAAI;KACJ,CAAC,CAAC;IAEH,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,UAAkB,CAAC;IAC9C,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,gGAAgG;QAChG,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACP,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CACd,GAAG,EAAE,CACJ,gBAAgB,CAAC;gBAChB,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAA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AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\ninterface TaskQueueItem {\n\t/** The task to run */\n\ttask: () => void;\n}\n\n// A set of tasks that still have to be run\nlet taskQueue: TaskQueueItem[] = [];\n\n// Set to true when we have a pending idle task scheduled\nlet idleTaskScheduled = false;\n\n/**\n * A function that schedules a non critical task to be run when the browser has cycles available\n * @param task - The task to be executed\n * @param options - Optional configuration for the task execution\n */\nexport function scheduleIdleTask(task: () => void) {\n\ttaskQueue.push({\n\t\ttask,\n\t});\n\n\tensureIdleCallback(2000);\n}\n\n/**\n * Ensures an idle callback has been scheduled for the remaining tasks\n */\nfunction ensureIdleCallback(timeout: number = 0) {\n\tif (!idleTaskScheduled) {\n\t\t// Exception added when eslint rule was added, this should be revisited when modifying this code\n\t\tif (self.requestIdleCallback) {\n\t\t\tself.requestIdleCallback(idleTaskCallback);\n\t\t} else {\n\t\t\tconst deadline = Date.now() + 50;\n\t\t\tself.setTimeout(\n\t\t\t\t() =>\n\t\t\t\t\tidleTaskCallback({\n\t\t\t\t\t\ttimeRemaining: () => Math.max(deadline - Date.now(), 0),\n\t\t\t\t\t\tdidTimeout: false,\n\t\t\t\t\t}),\n\t\t\t\ttimeout,\n\t\t\t);\n\t\t}\n\t\tidleTaskScheduled = true;\n\t}\n}\n\n/**\n * Runs tasks from the task queue\n * @param filter - An optional function that will be called for each task to see if it should run.\n * Returns false for tasks that should not run. If omitted all tasks run.\n * @param shouldContinueRunning - An optional function that will be called to determine if\n * we have enough time to continue running tasks. If omitted, we don't stop running tasks.\n */\nfunction runTasks(\n\tfilter?: (taskQueueItem: TaskQueueItem) => boolean,\n\tshouldContinueRunning?: () => boolean,\n) {\n\t// The next value for the task queue\n\tconst newTaskQueue: TaskQueueItem[] = [];\n\n\tfor (let index = 0; index < taskQueue.length; index += 1) {\n\t\tif (shouldContinueRunning && !shouldContinueRunning()) {\n\t\t\t// Add the tasks we didn't get to to the end of the new task queue\n\t\t\tnewTaskQueue.push(...taskQueue.slice(index));\n\t\t\tbreak;\n\t\t}\n\n\t\tconst taskQueueItem = taskQueue[index];\n\n\t\tif (filter && !filter(taskQueueItem)) {\n\t\t\tnewTaskQueue.push(taskQueueItem);\n\t\t} else {\n\t\t\ttaskQueueItem.task();\n\t\t}\n\t}\n\n\ttaskQueue = newTaskQueue;\n}\n\n// Runs all the tasks in the task queue\nfunction idleTaskCallback(deadline: {\n\ttimeRemaining: () => number;\n\treadonly didTimeout: boolean;\n}) {\n\t// Minimum time that must be available on deadline to run any more tasks\n\tconst minTaskTime = 10;\n\trunTasks(undefined, () => deadline.timeRemaining() > minTaskTime);\n\tidleTaskScheduled = false;\n\n\t// If we didn't run through the entire queue, schedule another idle callback\n\tif (taskQueue.length > 0) {\n\t\tensureIdleCallback();\n\t}\n}\n"]}
1
+ {"version":3,"file":"scheduleIdleTask.js","sourceRoot":"","sources":["../src/scheduleIdleTask.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,2CAA2C;AAC3C,IAAI,SAAS,GAAoB,EAAE,CAAC;AAEpC,yDAAyD;AACzD,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAE9B;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAChD,SAAS,CAAC,IAAI,CAAC;QACd,IAAI;KACJ,CAAC,CAAC;IAEH,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,UAAkB,CAAC;IAC9C,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,gGAAgG;QAChG,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACP,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CACd,GAAG,EA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F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\ninterface TaskQueueItem {\n\t/** The task to run */\n\ttask: () => void;\n}\n\n// A set of tasks that still have to be run\nlet taskQueue: TaskQueueItem[] = [];\n\n// Set to true when we have a pending idle task scheduled\nlet idleTaskScheduled = false;\n\n/**\n * A function that schedules a non critical task to be run when the browser has cycles available\n * @param task - The task to be executed\n * @param options - Optional configuration for the task execution\n */\nexport function scheduleIdleTask(task: () => void) {\n\ttaskQueue.push({\n\t\ttask,\n\t});\n\n\tensureIdleCallback(2000);\n}\n\n/**\n * Ensures an idle callback has been scheduled for the remaining tasks\n */\nfunction ensureIdleCallback(timeout: number = 0) {\n\tif (!idleTaskScheduled) {\n\t\t// Exception added when eslint rule was added, this should be revisited when modifying this code\n\t\tif (self.requestIdleCallback) {\n\t\t\tself.requestIdleCallback(idleTaskCallback);\n\t\t} else {\n\t\t\tconst deadline = Date.now() + 50;\n\t\t\tself.setTimeout(\n\t\t\t\t() =>\n\t\t\t\t\tidleTaskCallback({\n\t\t\t\t\t\ttimeRemaining: () => Math.max(deadline - Date.now(), 0),\n\t\t\t\t\t\tdidTimeout: false,\n\t\t\t\t\t}),\n\t\t\t\ttimeout,\n\t\t\t);\n\t\t}\n\t\tidleTaskScheduled = true;\n\t}\n}\n\n/**\n * Runs tasks from the task queue\n * @param filter - An optional function that will be called for each task to see if it should run.\n * Returns false for tasks that should not run. If omitted all tasks run.\n * @param shouldContinueRunning - An optional function that will be called to determine if\n * we have enough time to continue running tasks. If omitted, we don't stop running tasks.\n */\nfunction runTasks(\n\tfilter?: (taskQueueItem: TaskQueueItem) => boolean,\n\tshouldContinueRunning?: () => boolean,\n) {\n\t// The next value for the task queue\n\tconst newTaskQueue: TaskQueueItem[] = [];\n\n\tfor (const [index, taskQueueItem] of taskQueue.entries()) {\n\t\tif (shouldContinueRunning && !shouldContinueRunning()) {\n\t\t\t// Add the tasks we didn't get to to the end of the new task queue\n\t\t\tnewTaskQueue.push(...taskQueue.slice(index));\n\t\t\tbreak;\n\t\t}\n\n\t\tif (filter && !filter(taskQueueItem)) {\n\t\t\tnewTaskQueue.push(taskQueueItem);\n\t\t} else {\n\t\t\ttaskQueueItem.task();\n\t\t}\n\t}\n\n\ttaskQueue = newTaskQueue;\n}\n\n// Runs all the tasks in the task queue\nfunction idleTaskCallback(deadline: {\n\ttimeRemaining: () => number;\n\treadonly didTimeout: boolean;\n}) {\n\t// Minimum time that must be available on deadline to run any more tasks\n\tconst minTaskTime = 10;\n\trunTasks(undefined, () => deadline.timeRemaining() > minTaskTime);\n\tidleTaskScheduled = false;\n\n\t// If we didn't run through the entire queue, schedule another idle callback\n\tif (taskQueue.length > 0) {\n\t\tensureIdleCallback();\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/driver-web-cache",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
4
4
  "description": "Implementation of the driver caching API for a web browser",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -47,10 +47,10 @@
47
47
  "main": "lib/index.js",
48
48
  "types": "lib/public.d.ts",
49
49
  "dependencies": {
50
- "@fluidframework/core-interfaces": "~2.21.0",
51
- "@fluidframework/core-utils": "~2.21.0",
52
- "@fluidframework/odsp-driver-definitions": "~2.21.0",
53
- "@fluidframework/telemetry-utils": "~2.21.0",
50
+ "@fluidframework/core-interfaces": "~2.22.0",
51
+ "@fluidframework/core-utils": "~2.22.0",
52
+ "@fluidframework/odsp-driver-definitions": "~2.22.0",
53
+ "@fluidframework/telemetry-utils": "~2.22.0",
54
54
  "idb": "^6.1.2"
55
55
  },
56
56
  "devDependencies": {
@@ -59,7 +59,7 @@
59
59
  "@fluid-tools/build-cli": "^0.51.0",
60
60
  "@fluidframework/build-common": "^2.0.3",
61
61
  "@fluidframework/build-tools": "^0.51.0",
62
- "@fluidframework/driver-web-cache-previous": "npm:@fluidframework/driver-web-cache@2.20.0",
62
+ "@fluidframework/driver-web-cache-previous": "npm:@fluidframework/driver-web-cache@2.21.0",
63
63
  "@fluidframework/eslint-config-fluid": "^5.7.3",
64
64
  "@microsoft/api-extractor": "7.47.8",
65
65
  "@types/jest": "29.5.3",
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/driver-web-cache";
9
- export const pkgVersion = "2.21.0";
9
+ export const pkgVersion = "2.22.0";
@@ -64,15 +64,13 @@ function runTasks(
64
64
  // The next value for the task queue
65
65
  const newTaskQueue: TaskQueueItem[] = [];
66
66
 
67
- for (let index = 0; index < taskQueue.length; index += 1) {
67
+ for (const [index, taskQueueItem] of taskQueue.entries()) {
68
68
  if (shouldContinueRunning && !shouldContinueRunning()) {
69
69
  // Add the tasks we didn't get to to the end of the new task queue
70
70
  newTaskQueue.push(...taskQueue.slice(index));
71
71
  break;
72
72
  }
73
73
 
74
- const taskQueueItem = taskQueue[index];
75
-
76
74
  if (filter && !filter(taskQueueItem)) {
77
75
  newTaskQueue.push(taskQueueItem);
78
76
  } else {
package/tsconfig.json CHANGED
@@ -7,6 +7,5 @@
7
7
  "outDir": "./lib",
8
8
  "skipLibCheck": true,
9
9
  "exactOptionalPropertyTypes": false,
10
- "noUncheckedIndexedAccess": false,
11
10
  },
12
11
  }