@fluidframework/tool-utils 2.112.0 → 2.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/tool-utils
2
2
 
3
+ ## 2.113.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.112.0
4
8
 
5
9
  Dependency updates only.
@@ -24,14 +24,37 @@ export interface IResources {
24
24
  };
25
25
  }
26
26
  /**
27
+ * Loads the Fluid tool resource cache from `.fluidtoolrc` in the current user's home directory.
28
+ *
29
+ * @returns The parsed resources, or an empty object if the file does not exist or contains invalid
30
+ * JSON.
31
+ * @throws If the file exists but cannot be read.
27
32
  * @internal
28
33
  */
29
34
  export declare function loadRC(): Promise<IResources>;
30
35
  /**
36
+ * Saves the Fluid tool resources to `.fluidtoolrc` in the current user's home directory.
37
+ *
38
+ * On POSIX filesystems, successful completion ensures the file has owner-only read/write
39
+ * permissions. Windows continues to rely on the access controls inherited from the user's home
40
+ * directory.
41
+ *
42
+ * @param rc - The resources to serialize and save.
43
+ * @throws If serialization, writing, or updating the file permissions fails. A permission-update
44
+ * failure occurs after the new contents have already been written.
31
45
  * @internal
32
46
  */
33
47
  export declare function saveRC(rc: IResources): Promise<void>;
34
48
  /**
49
+ * Acquires the inter-process lock for `.fluidtoolrc` in the current user's home directory.
50
+ *
51
+ * The lock may be acquired before the resource file exists. While another process holds the lock,
52
+ * acquisition retries indefinitely. Locks whose modification time has not been updated for 60
53
+ * seconds are considered stale.
54
+ *
55
+ * @returns An asynchronous callback that releases the lock. The caller must invoke it after
56
+ * completing the protected operation, including when that operation fails.
57
+ * @throws If a filesystem error prevents the lock from being acquired.
35
58
  * @internal
36
59
  */
37
60
  export declare function lockRC(): Promise<() => Promise<void>>;
@@ -1 +1 @@
1
- {"version":3,"file":"fluidToolRc.d.ts","sourceRoot":"","sources":["../src/fluidToolRc.ts"],"names":[],"mappings":"AAAA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AAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CACX,MAAM,EACN;YACC,OAAO,CAAC,EAAE,WAAW,CAAC;YACtB,IAAI,CAAC,EAAE,WAAW,CAAC;SACnB,CACD,CAAC;KACF,CAAC;CACF;AAID;;;;;;;GAOG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAclD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,MAAM,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAQ3D"}
@@ -14,9 +14,12 @@ const node_path_1 = __importDefault(require("node:path"));
14
14
  const node_util_1 = __importDefault(require("node:util"));
15
15
  const proper_lockfile_1 = require("proper-lockfile");
16
16
  const getRCFileName = () => node_path_1.default.join(node_os_1.default.homedir(), ".fluidtoolrc");
17
- // TODO: Add documentation
18
- // eslint-disable-next-line jsdoc/require-description
19
17
  /**
18
+ * Loads the Fluid tool resource cache from `.fluidtoolrc` in the current user's home directory.
19
+ *
20
+ * @returns The parsed resources, or an empty object if the file does not exist or contains invalid
21
+ * JSON.
22
+ * @throws If the file exists but cannot be read.
20
23
  * @internal
21
24
  */
22
25
  async function loadRC() {
@@ -36,20 +39,44 @@ async function loadRC() {
36
39
  return {};
37
40
  }
38
41
  exports.loadRC = loadRC;
39
- // TODO: Add documentation
40
- // eslint-disable-next-line jsdoc/require-description
41
42
  /**
43
+ * Saves the Fluid tool resources to `.fluidtoolrc` in the current user's home directory.
44
+ *
45
+ * On POSIX filesystems, successful completion ensures the file has owner-only read/write
46
+ * permissions. Windows continues to rely on the access controls inherited from the user's home
47
+ * directory.
48
+ *
49
+ * @param rc - The resources to serialize and save.
50
+ * @throws If serialization, writing, or updating the file permissions fails. A permission-update
51
+ * failure occurs after the new contents have already been written.
42
52
  * @internal
43
53
  */
44
54
  async function saveRC(rc) {
45
55
  const writeFile = node_util_1.default.promisify(node_fs_1.default.writeFile);
56
+ const chmod = node_util_1.default.promisify(node_fs_1.default.chmod);
46
57
  const content = JSON.stringify(rc, undefined, 2);
47
- return writeFile(getRCFileName(), Buffer.from(content, "utf8"));
58
+ const fileName = getRCFileName();
59
+ // This per-user file holds ODSP access tokens and may also hold development secrets.
60
+ // On POSIX filesystems, `mode` creates a new file as owner-readable/writable only (0600).
61
+ // Because `mode` does not change an existing file, chmod also repairs caches that were
62
+ // previously created with broader permissions. On Windows, these calls normally succeed,
63
+ // but Node only uses the write bit: 0600 keeps the file writable without restricting who can
64
+ // read it. Confidentiality therefore depends on ACLs inherited from the user's home directory.
65
+ // If the filesystem rejects chmod, saveRC rejects after the file has already been written.
66
+ await writeFile(fileName, Buffer.from(content, "utf8"), { mode: 0o600 });
67
+ await chmod(fileName, 0o600);
48
68
  }
49
69
  exports.saveRC = saveRC;
50
- // TODO: Add documentation
51
- // eslint-disable-next-line jsdoc/require-description
52
70
  /**
71
+ * Acquires the inter-process lock for `.fluidtoolrc` in the current user's home directory.
72
+ *
73
+ * The lock may be acquired before the resource file exists. While another process holds the lock,
74
+ * acquisition retries indefinitely. Locks whose modification time has not been updated for 60
75
+ * seconds are considered stale.
76
+ *
77
+ * @returns An asynchronous callback that releases the lock. The caller must invoke it after
78
+ * completing the protected operation, including when that operation fails.
79
+ * @throws If a filesystem error prevents the lock from being acquired.
53
80
  * @internal
54
81
  */
55
82
  async function lockRC() {
@@ -1 +1 @@
1
- {"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AE,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC;AAJD,wBAIC;AAED,0BAA0B;AAC1B,qDAAqD;AACrD;;GAEG;AACI,KAAK,UAAU,MAAM;IAC3B,OAAO,IAAA,sBAAI,EAAC,aAAa,EAAE,EAAE;QAC5B,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;SACb;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC;AARD,wBAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport util from \"node:util\";\n\nimport type { IOdspTokens } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { lock } from \"proper-lockfile\";\n\n/**\n * @internal\n */\nexport interface IAsyncCache<TKey, TValue> {\n\tget(key: TKey): Promise<TValue | undefined>;\n\tsave(key: TKey, value: TValue): Promise<void>;\n\tlock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\n/**\n * @internal\n */\nexport interface IResources {\n\ttokens?: {\n\t\tversion?: number;\n\t\tdata: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tstorage?: IOdspTokens;\n\t\t\t\tpush?: IOdspTokens;\n\t\t\t}\n\t\t>;\n\t};\n}\n\nconst getRCFileName = (): string => path.join(os.homedir(), \".fluidtoolrc\");\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @internal\n */\nexport async function loadRC(): Promise<IResources> {\n\tconst readFile = util.promisify(fs.readFile);\n\tconst exists = util.promisify(fs.exists);\n\tconst fileName = getRCFileName();\n\tif (await exists(fileName)) {\n\t\tconst buf = await readFile(fileName);\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn JSON.parse(buf.toString(\"utf8\"));\n\t\t} catch {\n\t\t\t// Nothing\n\t\t}\n\t}\n\treturn {};\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @internal\n */\nexport async function saveRC(rc: IResources): Promise<void> {\n\tconst writeFile = util.promisify(fs.writeFile);\n\tconst content = JSON.stringify(rc, undefined, 2);\n\treturn writeFile(getRCFileName(), Buffer.from(content, \"utf8\"));\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @internal\n */\nexport async function lockRC(): Promise<() => Promise<void>> {\n\treturn lock(getRCFileName(), {\n\t\tretries: {\n\t\t\tforever: true,\n\t\t},\n\t\tstale: 60000,\n\t\trealpath: false,\n\t});\n}\n"]}
1
+ {"version":3,"file":"fluidToolRc.js","sourceRoot":"","sources":["../src/fluidToolRc.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,sDAAyB;AACzB,sDAAyB;AACzB,0DAA6B;AAC7B,0DAA6B;AAG7B,qDAAuC;AA2BvC,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,mBAAI,CAAC,IAAI,CAAC,iBAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAE5E;;;;;;;GAOG;AACI,KAAK,UAAU,MAAM;IAC3B,MAAM,QAAQ,GAAG,mBAAI,CAAC,SAAS,CAAC,iBAAE,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,mBAAI,CAAC,SAAS,CAAC,iBAAE,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,IAAI,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC;YACJ,+DAA+D;YAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACR,UAAU;QACX,CAAC;IACF,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAdD,wBAcC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,MAAM,CAAC,EAAc;IAC1C,MAAM,SAAS,GAAG,mBAAI,CAAC,SAAS,CAAC,iBAAE,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,mBAAI,CAAC,SAAS,CAAC,iBAAE,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,qFAAqF;IACrF,0FAA0F;IAC1F,uFAAuF;IACvF,yFAAyF;IACzF,6FAA6F;IAC7F,+FAA+F;IAC/F,2FAA2F;IAC3F,MAAM,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACzE,MAAM,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC;AAdD,wBAcC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,MAAM;IAC3B,OAAO,IAAA,sBAAI,EAAC,aAAa,EAAE,EAAE;QAC5B,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;SACb;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC;AARD,wBAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport util from \"node:util\";\n\nimport type { IOdspTokens } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { lock } from \"proper-lockfile\";\n\n/**\n * @internal\n */\nexport interface IAsyncCache<TKey, TValue> {\n\tget(key: TKey): Promise<TValue | undefined>;\n\tsave(key: TKey, value: TValue): Promise<void>;\n\tlock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\n/**\n * @internal\n */\nexport interface IResources {\n\ttokens?: {\n\t\tversion?: number;\n\t\tdata: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tstorage?: IOdspTokens;\n\t\t\t\tpush?: IOdspTokens;\n\t\t\t}\n\t\t>;\n\t};\n}\n\nconst getRCFileName = (): string => path.join(os.homedir(), \".fluidtoolrc\");\n\n/**\n * Loads the Fluid tool resource cache from `.fluidtoolrc` in the current user's home directory.\n *\n * @returns The parsed resources, or an empty object if the file does not exist or contains invalid\n * JSON.\n * @throws If the file exists but cannot be read.\n * @internal\n */\nexport async function loadRC(): Promise<IResources> {\n\tconst readFile = util.promisify(fs.readFile);\n\tconst exists = util.promisify(fs.exists);\n\tconst fileName = getRCFileName();\n\tif (await exists(fileName)) {\n\t\tconst buf = await readFile(fileName);\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn JSON.parse(buf.toString(\"utf8\"));\n\t\t} catch {\n\t\t\t// Nothing\n\t\t}\n\t}\n\treturn {};\n}\n\n/**\n * Saves the Fluid tool resources to `.fluidtoolrc` in the current user's home directory.\n *\n * On POSIX filesystems, successful completion ensures the file has owner-only read/write\n * permissions. Windows continues to rely on the access controls inherited from the user's home\n * directory.\n *\n * @param rc - The resources to serialize and save.\n * @throws If serialization, writing, or updating the file permissions fails. A permission-update\n * failure occurs after the new contents have already been written.\n * @internal\n */\nexport async function saveRC(rc: IResources): Promise<void> {\n\tconst writeFile = util.promisify(fs.writeFile);\n\tconst chmod = util.promisify(fs.chmod);\n\tconst content = JSON.stringify(rc, undefined, 2);\n\tconst fileName = getRCFileName();\n\t// This per-user file holds ODSP access tokens and may also hold development secrets.\n\t// On POSIX filesystems, `mode` creates a new file as owner-readable/writable only (0600).\n\t// Because `mode` does not change an existing file, chmod also repairs caches that were\n\t// previously created with broader permissions. On Windows, these calls normally succeed,\n\t// but Node only uses the write bit: 0600 keeps the file writable without restricting who can\n\t// read it. Confidentiality therefore depends on ACLs inherited from the user's home directory.\n\t// If the filesystem rejects chmod, saveRC rejects after the file has already been written.\n\tawait writeFile(fileName, Buffer.from(content, \"utf8\"), { mode: 0o600 });\n\tawait chmod(fileName, 0o600);\n}\n\n/**\n * Acquires the inter-process lock for `.fluidtoolrc` in the current user's home directory.\n *\n * The lock may be acquired before the resource file exists. While another process holds the lock,\n * acquisition retries indefinitely. Locks whose modification time has not been updated for 60\n * seconds are considered stale.\n *\n * @returns An asynchronous callback that releases the lock. The caller must invoke it after\n * completing the protected operation, including when that operation fails.\n * @throws If a filesystem error prevents the lock from being acquired.\n * @internal\n */\nexport async function lockRC(): Promise<() => Promise<void>> {\n\treturn lock(getRCFileName(), {\n\t\tretries: {\n\t\t\tforever: true,\n\t\t},\n\t\tstale: 60000,\n\t\trealpath: false,\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/tool-utils";
8
- export declare const pkgVersion = "2.112.0";
8
+ export declare const pkgVersion = "2.113.1";
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/tool-utils";
11
- exports.pkgVersion = "2.112.0";
11
+ exports.pkgVersion = "2.113.1";
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,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,SAAS,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/tool-utils\";\nexport const pkgVersion = \"2.112.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,SAAS,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/tool-utils\";\nexport const pkgVersion = \"2.113.1\";\n"]}
@@ -24,14 +24,37 @@ export interface IResources {
24
24
  };
25
25
  }
26
26
  /**
27
+ * Loads the Fluid tool resource cache from `.fluidtoolrc` in the current user's home directory.
28
+ *
29
+ * @returns The parsed resources, or an empty object if the file does not exist or contains invalid
30
+ * JSON.
31
+ * @throws If the file exists but cannot be read.
27
32
  * @internal
28
33
  */
29
34
  export declare function loadRC(): Promise<IResources>;
30
35
  /**
36
+ * Saves the Fluid tool resources to `.fluidtoolrc` in the current user's home directory.
37
+ *
38
+ * On POSIX filesystems, successful completion ensures the file has owner-only read/write
39
+ * permissions. Windows continues to rely on the access controls inherited from the user's home
40
+ * directory.
41
+ *
42
+ * @param rc - The resources to serialize and save.
43
+ * @throws If serialization, writing, or updating the file permissions fails. A permission-update
44
+ * failure occurs after the new contents have already been written.
31
45
  * @internal
32
46
  */
33
47
  export declare function saveRC(rc: IResources): Promise<void>;
34
48
  /**
49
+ * Acquires the inter-process lock for `.fluidtoolrc` in the current user's home directory.
50
+ *
51
+ * The lock may be acquired before the resource file exists. While another process holds the lock,
52
+ * acquisition retries indefinitely. Locks whose modification time has not been updated for 60
53
+ * seconds are considered stale.
54
+ *
55
+ * @returns An asynchronous callback that releases the lock. The caller must invoke it after
56
+ * completing the protected operation, including when that operation fails.
57
+ * @throws If a filesystem error prevents the lock from being acquired.
35
58
  * @internal
36
59
  */
37
60
  export declare function lockRC(): Promise<() => Promise<void>>;
@@ -1 +1 @@
1
- {"version":3,"file":"fluidToolRc.d.ts","sourceRoot":"","sources":["../src/fluidToolRc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAG9E;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,MAAM;IACxC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CACX,MAAM,EACN;YACC,OAAO,CAAC,EAAE,WAAW,CAAC;YACtB,IAAI,CAAC,EAAE,WAAW,CAAC;SACnB,CACD,CAAC;KACF,CAAC;CACF;AAMD;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAclD;AAID;;GAEG;AACH,wBAAsB,MAAM,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAI1D;AAID;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAQ3D"}
1
+ {"version":3,"file":"fluidToolRc.d.ts","sourceRoot":"","sources":["../src/fluidToolRc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAG9E;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,MAAM;IACxC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CACX,MAAM,EACN;YACC,OAAO,CAAC,EAAE,WAAW,CAAC;YACtB,IAAI,CAAC,EAAE,WAAW,CAAC;SACnB,CACD,CAAC;KACF,CAAC;CACF;AAID;;;;;;;GAOG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAclD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,MAAM,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAc1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAQ3D"}
@@ -8,9 +8,12 @@ import path from "node:path";
8
8
  import util from "node:util";
9
9
  import { lock } from "proper-lockfile";
10
10
  const getRCFileName = () => path.join(os.homedir(), ".fluidtoolrc");
11
- // TODO: Add documentation
12
- // eslint-disable-next-line jsdoc/require-description
13
11
  /**
12
+ * Loads the Fluid tool resource cache from `.fluidtoolrc` in the current user's home directory.
13
+ *
14
+ * @returns The parsed resources, or an empty object if the file does not exist or contains invalid
15
+ * JSON.
16
+ * @throws If the file exists but cannot be read.
14
17
  * @internal
15
18
  */
16
19
  export async function loadRC() {
@@ -29,19 +32,43 @@ export async function loadRC() {
29
32
  }
30
33
  return {};
31
34
  }
32
- // TODO: Add documentation
33
- // eslint-disable-next-line jsdoc/require-description
34
35
  /**
36
+ * Saves the Fluid tool resources to `.fluidtoolrc` in the current user's home directory.
37
+ *
38
+ * On POSIX filesystems, successful completion ensures the file has owner-only read/write
39
+ * permissions. Windows continues to rely on the access controls inherited from the user's home
40
+ * directory.
41
+ *
42
+ * @param rc - The resources to serialize and save.
43
+ * @throws If serialization, writing, or updating the file permissions fails. A permission-update
44
+ * failure occurs after the new contents have already been written.
35
45
  * @internal
36
46
  */
37
47
  export async function saveRC(rc) {
38
48
  const writeFile = util.promisify(fs.writeFile);
49
+ const chmod = util.promisify(fs.chmod);
39
50
  const content = JSON.stringify(rc, undefined, 2);
40
- return writeFile(getRCFileName(), Buffer.from(content, "utf8"));
51
+ const fileName = getRCFileName();
52
+ // This per-user file holds ODSP access tokens and may also hold development secrets.
53
+ // On POSIX filesystems, `mode` creates a new file as owner-readable/writable only (0600).
54
+ // Because `mode` does not change an existing file, chmod also repairs caches that were
55
+ // previously created with broader permissions. On Windows, these calls normally succeed,
56
+ // but Node only uses the write bit: 0600 keeps the file writable without restricting who can
57
+ // read it. Confidentiality therefore depends on ACLs inherited from the user's home directory.
58
+ // If the filesystem rejects chmod, saveRC rejects after the file has already been written.
59
+ await writeFile(fileName, Buffer.from(content, "utf8"), { mode: 0o600 });
60
+ await chmod(fileName, 0o600);
41
61
  }
42
- // TODO: Add documentation
43
- // eslint-disable-next-line jsdoc/require-description
44
62
  /**
63
+ * Acquires the inter-process lock for `.fluidtoolrc` in the current user's home directory.
64
+ *
65
+ * The lock may be acquired before the resource file exists. While another process holds the lock,
66
+ * acquisition retries indefinitely. Locks whose modification time has not been updated for 60
67
+ * seconds are considered stale.
68
+ *
69
+ * @returns An asynchronous callback that releases the lock. The caller must invoke it after
70
+ * completing the protected operation, including when that operation fails.
71
+ * @throws If a filesystem error prevents the lock from being acquired.
45
72
  * @internal
46
73
  */
47
74
  export async function lockRC() {
@@ -1 +1 @@
1
- {"version":3,"file":"fluidToolRc.js","sourceRoot":"","sources":["../src/fluidToolRc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA2BvC,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAE5E,0BAA0B;AAC1B,qDAAqD;AACrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,IAAI,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC;YACJ,+DAA+D;YAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACR,UAAU;QACX,CAAC;IACF,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED,0BAA0B;AAC1B,qDAAqD;AACrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,EAAc;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACjD,OAAO,SAAS,CAAC,aAAa,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,0BAA0B;AAC1B,qDAAqD;AACrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,OAAO,IAAI,CAAC,aAAa,EAAE,EAAE;QAC5B,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;SACb;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport util from \"node:util\";\n\nimport type { IOdspTokens } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { lock } from \"proper-lockfile\";\n\n/**\n * @internal\n */\nexport interface IAsyncCache<TKey, TValue> {\n\tget(key: TKey): Promise<TValue | undefined>;\n\tsave(key: TKey, value: TValue): Promise<void>;\n\tlock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\n/**\n * @internal\n */\nexport interface IResources {\n\ttokens?: {\n\t\tversion?: number;\n\t\tdata: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tstorage?: IOdspTokens;\n\t\t\t\tpush?: IOdspTokens;\n\t\t\t}\n\t\t>;\n\t};\n}\n\nconst getRCFileName = (): string => path.join(os.homedir(), \".fluidtoolrc\");\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @internal\n */\nexport async function loadRC(): Promise<IResources> {\n\tconst readFile = util.promisify(fs.readFile);\n\tconst exists = util.promisify(fs.exists);\n\tconst fileName = getRCFileName();\n\tif (await exists(fileName)) {\n\t\tconst buf = await readFile(fileName);\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn JSON.parse(buf.toString(\"utf8\"));\n\t\t} catch {\n\t\t\t// Nothing\n\t\t}\n\t}\n\treturn {};\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @internal\n */\nexport async function saveRC(rc: IResources): Promise<void> {\n\tconst writeFile = util.promisify(fs.writeFile);\n\tconst content = JSON.stringify(rc, undefined, 2);\n\treturn writeFile(getRCFileName(), Buffer.from(content, \"utf8\"));\n}\n\n// TODO: Add documentation\n// eslint-disable-next-line jsdoc/require-description\n/**\n * @internal\n */\nexport async function lockRC(): Promise<() => Promise<void>> {\n\treturn lock(getRCFileName(), {\n\t\tretries: {\n\t\t\tforever: true,\n\t\t},\n\t\tstale: 60000,\n\t\trealpath: false,\n\t});\n}\n"]}
1
+ {"version":3,"file":"fluidToolRc.js","sourceRoot":"","sources":["../src/fluidToolRc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA2BvC,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAE5E;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,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AAK;QACZ,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport util from \"node:util\";\n\nimport type { IOdspTokens } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { lock } from \"proper-lockfile\";\n\n/**\n * @internal\n */\nexport interface IAsyncCache<TKey, TValue> {\n\tget(key: TKey): Promise<TValue | undefined>;\n\tsave(key: TKey, value: TValue): Promise<void>;\n\tlock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\n/**\n * @internal\n */\nexport interface IResources {\n\ttokens?: {\n\t\tversion?: number;\n\t\tdata: Record<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tstorage?: IOdspTokens;\n\t\t\t\tpush?: IOdspTokens;\n\t\t\t}\n\t\t>;\n\t};\n}\n\nconst getRCFileName = (): string => path.join(os.homedir(), \".fluidtoolrc\");\n\n/**\n * Loads the Fluid tool resource cache from `.fluidtoolrc` in the current user's home directory.\n *\n * @returns The parsed resources, or an empty object if the file does not exist or contains invalid\n * JSON.\n * @throws If the file exists but cannot be read.\n * @internal\n */\nexport async function loadRC(): Promise<IResources> {\n\tconst readFile = util.promisify(fs.readFile);\n\tconst exists = util.promisify(fs.exists);\n\tconst fileName = getRCFileName();\n\tif (await exists(fileName)) {\n\t\tconst buf = await readFile(fileName);\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn JSON.parse(buf.toString(\"utf8\"));\n\t\t} catch {\n\t\t\t// Nothing\n\t\t}\n\t}\n\treturn {};\n}\n\n/**\n * Saves the Fluid tool resources to `.fluidtoolrc` in the current user's home directory.\n *\n * On POSIX filesystems, successful completion ensures the file has owner-only read/write\n * permissions. Windows continues to rely on the access controls inherited from the user's home\n * directory.\n *\n * @param rc - The resources to serialize and save.\n * @throws If serialization, writing, or updating the file permissions fails. A permission-update\n * failure occurs after the new contents have already been written.\n * @internal\n */\nexport async function saveRC(rc: IResources): Promise<void> {\n\tconst writeFile = util.promisify(fs.writeFile);\n\tconst chmod = util.promisify(fs.chmod);\n\tconst content = JSON.stringify(rc, undefined, 2);\n\tconst fileName = getRCFileName();\n\t// This per-user file holds ODSP access tokens and may also hold development secrets.\n\t// On POSIX filesystems, `mode` creates a new file as owner-readable/writable only (0600).\n\t// Because `mode` does not change an existing file, chmod also repairs caches that were\n\t// previously created with broader permissions. On Windows, these calls normally succeed,\n\t// but Node only uses the write bit: 0600 keeps the file writable without restricting who can\n\t// read it. Confidentiality therefore depends on ACLs inherited from the user's home directory.\n\t// If the filesystem rejects chmod, saveRC rejects after the file has already been written.\n\tawait writeFile(fileName, Buffer.from(content, \"utf8\"), { mode: 0o600 });\n\tawait chmod(fileName, 0o600);\n}\n\n/**\n * Acquires the inter-process lock for `.fluidtoolrc` in the current user's home directory.\n *\n * The lock may be acquired before the resource file exists. While another process holds the lock,\n * acquisition retries indefinitely. Locks whose modification time has not been updated for 60\n * seconds are considered stale.\n *\n * @returns An asynchronous callback that releases the lock. The caller must invoke it after\n * completing the protected operation, including when that operation fails.\n * @throws If a filesystem error prevents the lock from being acquired.\n * @internal\n */\nexport async function lockRC(): Promise<() => Promise<void>> {\n\treturn lock(getRCFileName(), {\n\t\tretries: {\n\t\t\tforever: true,\n\t\t},\n\t\tstale: 60000,\n\t\trealpath: false,\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/tool-utils";
8
- export declare const pkgVersion = "2.112.0";
8
+ export declare const pkgVersion = "2.113.1";
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/tool-utils";
8
- export const pkgVersion = "2.112.0";
8
+ export const pkgVersion = "2.113.1";
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,4BAA4B,CAAC;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,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/tool-utils\";\nexport const pkgVersion = \"2.112.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,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/tool-utils\";\nexport const pkgVersion = \"2.113.1\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tool-utils",
3
- "version": "2.112.0",
3
+ "version": "2.113.1",
4
4
  "description": "Common utilities for Fluid tools",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -59,10 +59,10 @@
59
59
  "temp-directory": "nyc/.nyc_output"
60
60
  },
61
61
  "dependencies": {
62
- "@fluidframework/core-utils": "~2.112.0",
63
- "@fluidframework/driver-definitions": "~2.112.0",
64
- "@fluidframework/driver-utils": "~2.112.0",
65
- "@fluidframework/odsp-doclib-utils": "~2.112.0",
62
+ "@fluidframework/core-utils": "~2.113.1",
63
+ "@fluidframework/driver-definitions": "~2.113.1",
64
+ "@fluidframework/driver-utils": "~2.113.1",
65
+ "@fluidframework/odsp-doclib-utils": "~2.113.1",
66
66
  "async-mutex": "^0.3.1",
67
67
  "debug": "^4.3.4",
68
68
  "proper-lockfile": "^4.1.2"
@@ -70,7 +70,7 @@
70
70
  "devDependencies": {
71
71
  "@arethetypeswrong/cli": "^0.18.2",
72
72
  "@biomejs/biome": "~2.4.5",
73
- "@fluid-internal/mocha-test-setup": "~2.112.0",
73
+ "@fluid-internal/mocha-test-setup": "~2.113.1",
74
74
  "@fluid-tools/build-cli": "^0.65.0",
75
75
  "@fluidframework/build-common": "^2.0.3",
76
76
  "@fluidframework/build-tools": "^0.65.0",
@@ -38,9 +38,12 @@ export interface IResources {
38
38
 
39
39
  const getRCFileName = (): string => path.join(os.homedir(), ".fluidtoolrc");
40
40
 
41
- // TODO: Add documentation
42
- // eslint-disable-next-line jsdoc/require-description
43
41
  /**
42
+ * Loads the Fluid tool resource cache from `.fluidtoolrc` in the current user's home directory.
43
+ *
44
+ * @returns The parsed resources, or an empty object if the file does not exist or contains invalid
45
+ * JSON.
46
+ * @throws If the file exists but cannot be read.
44
47
  * @internal
45
48
  */
46
49
  export async function loadRC(): Promise<IResources> {
@@ -59,20 +62,44 @@ export async function loadRC(): Promise<IResources> {
59
62
  return {};
60
63
  }
61
64
 
62
- // TODO: Add documentation
63
- // eslint-disable-next-line jsdoc/require-description
64
65
  /**
66
+ * Saves the Fluid tool resources to `.fluidtoolrc` in the current user's home directory.
67
+ *
68
+ * On POSIX filesystems, successful completion ensures the file has owner-only read/write
69
+ * permissions. Windows continues to rely on the access controls inherited from the user's home
70
+ * directory.
71
+ *
72
+ * @param rc - The resources to serialize and save.
73
+ * @throws If serialization, writing, or updating the file permissions fails. A permission-update
74
+ * failure occurs after the new contents have already been written.
65
75
  * @internal
66
76
  */
67
77
  export async function saveRC(rc: IResources): Promise<void> {
68
78
  const writeFile = util.promisify(fs.writeFile);
79
+ const chmod = util.promisify(fs.chmod);
69
80
  const content = JSON.stringify(rc, undefined, 2);
70
- return writeFile(getRCFileName(), Buffer.from(content, "utf8"));
81
+ const fileName = getRCFileName();
82
+ // This per-user file holds ODSP access tokens and may also hold development secrets.
83
+ // On POSIX filesystems, `mode` creates a new file as owner-readable/writable only (0600).
84
+ // Because `mode` does not change an existing file, chmod also repairs caches that were
85
+ // previously created with broader permissions. On Windows, these calls normally succeed,
86
+ // but Node only uses the write bit: 0600 keeps the file writable without restricting who can
87
+ // read it. Confidentiality therefore depends on ACLs inherited from the user's home directory.
88
+ // If the filesystem rejects chmod, saveRC rejects after the file has already been written.
89
+ await writeFile(fileName, Buffer.from(content, "utf8"), { mode: 0o600 });
90
+ await chmod(fileName, 0o600);
71
91
  }
72
92
 
73
- // TODO: Add documentation
74
- // eslint-disable-next-line jsdoc/require-description
75
93
  /**
94
+ * Acquires the inter-process lock for `.fluidtoolrc` in the current user's home directory.
95
+ *
96
+ * The lock may be acquired before the resource file exists. While another process holds the lock,
97
+ * acquisition retries indefinitely. Locks whose modification time has not been updated for 60
98
+ * seconds are considered stale.
99
+ *
100
+ * @returns An asynchronous callback that releases the lock. The caller must invoke it after
101
+ * completing the protected operation, including when that operation fails.
102
+ * @throws If a filesystem error prevents the lock from being acquired.
76
103
  * @internal
77
104
  */
78
105
  export async function lockRC(): Promise<() => Promise<void>> {
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tool-utils";
9
- export const pkgVersion = "2.112.0";
9
+ export const pkgVersion = "2.113.1";