@fluidframework/tree-agent-ses 2.71.0 → 2.72.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 +3 -3
- package/CHANGELOG.md +4 -0
- package/dist/executor.js +1 -1
- package/dist/executor.js.map +1 -1
- package/lib/executor.js +1 -1
- package/lib/executor.js.map +1 -1
- package/package.json +8 -8
- package/src/executor.ts +1 -1
package/.eslintrc.cjs
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = {
|
|
|
10
10
|
},
|
|
11
11
|
rules: {
|
|
12
12
|
// Allow reaching into FluidFramework package paths that end with alpha, beta, legacy, or internal
|
|
13
|
-
"import/no-internal-modules": [
|
|
13
|
+
"import-x/no-internal-modules": [
|
|
14
14
|
"error",
|
|
15
15
|
{
|
|
16
16
|
allow: [
|
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
|
29
29
|
project: ["./src/test/tsconfig.json"],
|
|
30
30
|
},
|
|
31
31
|
rules: {
|
|
32
|
-
"import/no-internal-modules": [
|
|
32
|
+
"import-x/no-internal-modules": [
|
|
33
33
|
"error",
|
|
34
34
|
{
|
|
35
35
|
allow: [
|
|
@@ -41,7 +41,7 @@ module.exports = {
|
|
|
41
41
|
],
|
|
42
42
|
},
|
|
43
43
|
],
|
|
44
|
-
"import/no-unresolved": "off",
|
|
44
|
+
"import-x/no-unresolved": "off",
|
|
45
45
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
46
46
|
"@typescript-eslint/no-unsafe-call": "off",
|
|
47
47
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
package/CHANGELOG.md
CHANGED
package/dist/executor.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.createSesEditExecutor = void 0;
|
|
8
|
-
// eslint-disable-next-line import/no-unassigned-import
|
|
8
|
+
// eslint-disable-next-line import-x/no-unassigned-import
|
|
9
9
|
require("ses");
|
|
10
10
|
/**
|
|
11
11
|
* Used to track whether the SES `lockdown` function has already been called by this module.
|
package/dist/executor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAAyD;AACzD,eAAa;AAIb;;GAEG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CAAC,OAGrC;IACA,MAAM,cAAc,GACnB,OAAO,EAAE,kBAAkB,EAAE,OAAO,IAAI,IAAI,GAAG,EAAmB,CAAC;IAEpE,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACd,uFAAuF,CACvF,CAAC;IACH,CAAC;IAED,IAAI,CAAC,CAAC,cAAc,IAAI,UAAU,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC;YACJ,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YACnC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE;gBACjD,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,UAAU,EAAE,KAAK;aACjB,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;gBAC9D,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE;oBACjD,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,KAAK;oBACf,YAAY,EAAE,KAAK;oBACnB,UAAU,EAAE,KAAK;iBACjB,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,KAAK,EAAE,OAAgC,EAAE,IAAY,EAAE,EAAE;QAC/D,MAAM,kBAAkB,GAAG;YAC1B,GAAG,OAAO,EAAE,kBAAkB;YAC9B,OAAO,EAAE;gBACR,GAAG,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC;gBACrC,OAAO;aACP;SACD,CAAC;QAEF,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,GAAG,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC;AACH,CAAC;AAhDD,sDAgDC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,KAAc;IACpC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import-x/no-unassigned-import\nimport \"ses\";\n\nimport type { AsynchronousEditor } from \"@fluidframework/tree-agent/alpha\";\n\n/**\n * Used to track whether the SES `lockdown` function has already been called by this module.\n */\nconst lockdownSymbol = Symbol.for(\"tree-agent.ses.locked\");\n\n/**\n * Create an implementation of {@link @fluidframework/tree-agent#SemanticAgentOptions.executeEdit} that uses the SES library\n * to run the provided code in a secure environment.\n * @param options - Optional configuration for the underlying SES compartment and lockdown invocation.\n * @returns A function that can be used as the {@link @fluidframework/tree-agent#SemanticAgentOptions.executeEdit | executeEdit} callback.\n * @remarks This function will call the SES `lockdown` API the first time it is invoked. For best performance, create the executor once during application initialization.\n * @alpha\n */\nexport function createSesEditExecutor(options?: {\n\tcompartmentOptions?: { globals?: Map<string, unknown>; [key: string]: unknown };\n\tlockdownOptions?: Record<string, unknown>;\n}): AsynchronousEditor {\n\tconst optionsGlobals: Map<string, unknown> =\n\t\toptions?.compartmentOptions?.globals ?? new Map<string, unknown>();\n\n\tif (optionsGlobals.has(\"context\") === true) {\n\t\tthrow new Error(\n\t\t\t\"The 'context' global is reserved and cannot be overridden in the compartment options.\",\n\t\t);\n\t}\n\n\tif (!(lockdownSymbol in globalThis)) {\n\t\ttry {\n\t\t\tlockdown(options?.lockdownOptions);\n\t\t\tObject.defineProperty(globalThis, lockdownSymbol, {\n\t\t\t\tvalue: true,\n\t\t\t\twritable: false,\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t});\n\t\t} catch (error: unknown) {\n\t\t\tif (toErrorString(error).includes(\"SES_ALREADY_LOCKED_DOWN\")) {\n\t\t\t\tObject.defineProperty(globalThis, lockdownSymbol, {\n\t\t\t\t\tvalue: true,\n\t\t\t\t\twritable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn async (context: Record<string, unknown>, code: string) => {\n\t\tconst compartmentOptions = {\n\t\t\t...options?.compartmentOptions,\n\t\t\tglobals: {\n\t\t\t\t...Object.fromEntries(optionsGlobals),\n\t\t\t\tcontext,\n\t\t\t},\n\t\t};\n\n\t\tconst compartment = new Compartment({ ...compartmentOptions, __options__: true });\n\t\tawait compartment.evaluate(code);\n\t};\n}\n\n/**\n * Stringify an unknown error value.\n */\nfunction toErrorString(error: unknown): string {\n\tif (error instanceof Error) {\n\t\treturn error.message;\n\t}\n\ttry {\n\t\treturn JSON.stringify(error);\n\t} catch {\n\t\treturn String(error);\n\t}\n}\n"]}
|
package/lib/executor.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
// eslint-disable-next-line import/no-unassigned-import
|
|
5
|
+
// eslint-disable-next-line import-x/no-unassigned-import
|
|
6
6
|
import "ses";
|
|
7
7
|
/**
|
|
8
8
|
* Used to track whether the SES `lockdown` function has already been called by this module.
|
package/lib/executor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yDAAyD;AACzD,OAAO,KAAK,CAAC;AAIb;;GAEG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAGrC;IACA,MAAM,cAAc,GACnB,OAAO,EAAE,kBAAkB,EAAE,OAAO,IAAI,IAAI,GAAG,EAAmB,CAAC;IAEpE,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACd,uFAAuF,CACvF,CAAC;IACH,CAAC;IAED,IAAI,CAAC,CAAC,cAAc,IAAI,UAAU,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC;YACJ,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YACnC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE;gBACjD,KAAK,EAAE,IAAI;gBACX,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,UAAU,EAAE,KAAK;aACjB,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACzB,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;gBAC9D,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,cAAc,EAAE;oBACjD,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,KAAK;oBACf,YAAY,EAAE,KAAK;oBACnB,UAAU,EAAE,KAAK;iBACjB,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,KAAK,EAAE,OAAgC,EAAE,IAAY,EAAE,EAAE;QAC/D,MAAM,kBAAkB,GAAG;YAC1B,GAAG,OAAO,EAAE,kBAAkB;YAC9B,OAAO,EAAE;gBACR,GAAG,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC;gBACrC,OAAO;aACP;SACD,CAAC;QAEF,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,GAAG,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,KAAc;IACpC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import-x/no-unassigned-import\nimport \"ses\";\n\nimport type { AsynchronousEditor } from \"@fluidframework/tree-agent/alpha\";\n\n/**\n * Used to track whether the SES `lockdown` function has already been called by this module.\n */\nconst lockdownSymbol = Symbol.for(\"tree-agent.ses.locked\");\n\n/**\n * Create an implementation of {@link @fluidframework/tree-agent#SemanticAgentOptions.executeEdit} that uses the SES library\n * to run the provided code in a secure environment.\n * @param options - Optional configuration for the underlying SES compartment and lockdown invocation.\n * @returns A function that can be used as the {@link @fluidframework/tree-agent#SemanticAgentOptions.executeEdit | executeEdit} callback.\n * @remarks This function will call the SES `lockdown` API the first time it is invoked. For best performance, create the executor once during application initialization.\n * @alpha\n */\nexport function createSesEditExecutor(options?: {\n\tcompartmentOptions?: { globals?: Map<string, unknown>; [key: string]: unknown };\n\tlockdownOptions?: Record<string, unknown>;\n}): AsynchronousEditor {\n\tconst optionsGlobals: Map<string, unknown> =\n\t\toptions?.compartmentOptions?.globals ?? new Map<string, unknown>();\n\n\tif (optionsGlobals.has(\"context\") === true) {\n\t\tthrow new Error(\n\t\t\t\"The 'context' global is reserved and cannot be overridden in the compartment options.\",\n\t\t);\n\t}\n\n\tif (!(lockdownSymbol in globalThis)) {\n\t\ttry {\n\t\t\tlockdown(options?.lockdownOptions);\n\t\t\tObject.defineProperty(globalThis, lockdownSymbol, {\n\t\t\t\tvalue: true,\n\t\t\t\twritable: false,\n\t\t\t\tconfigurable: false,\n\t\t\t\tenumerable: false,\n\t\t\t});\n\t\t} catch (error: unknown) {\n\t\t\tif (toErrorString(error).includes(\"SES_ALREADY_LOCKED_DOWN\")) {\n\t\t\t\tObject.defineProperty(globalThis, lockdownSymbol, {\n\t\t\t\t\tvalue: true,\n\t\t\t\t\twritable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn async (context: Record<string, unknown>, code: string) => {\n\t\tconst compartmentOptions = {\n\t\t\t...options?.compartmentOptions,\n\t\t\tglobals: {\n\t\t\t\t...Object.fromEntries(optionsGlobals),\n\t\t\t\tcontext,\n\t\t\t},\n\t\t};\n\n\t\tconst compartment = new Compartment({ ...compartmentOptions, __options__: true });\n\t\tawait compartment.evaluate(code);\n\t};\n}\n\n/**\n * Stringify an unknown error value.\n */\nfunction toErrorString(error: unknown): string {\n\tif (error instanceof Error) {\n\t\treturn error.message;\n\t}\n\ttry {\n\t\treturn JSON.stringify(error);\n\t} catch {\n\t\treturn String(error);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/tree-agent-ses",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.0",
|
|
4
4
|
"description": "SES integration helpers for @fluidframework/tree-agent",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,18 +69,18 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluidframework/tree-agent": "~2.
|
|
72
|
+
"@fluidframework/tree-agent": "~2.72.0",
|
|
73
73
|
"ses": "^1.14.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
77
77
|
"@biomejs/biome": "~1.9.3",
|
|
78
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
79
|
-
"@fluid-tools/build-cli": "^0.
|
|
78
|
+
"@fluid-internal/mocha-test-setup": "~2.72.0",
|
|
79
|
+
"@fluid-tools/build-cli": "^0.60.0",
|
|
80
80
|
"@fluidframework/build-common": "^2.0.3",
|
|
81
|
-
"@fluidframework/build-tools": "^0.
|
|
82
|
-
"@fluidframework/eslint-config-fluid": "
|
|
83
|
-
"@fluidframework/tree": "~2.
|
|
81
|
+
"@fluidframework/build-tools": "^0.60.0",
|
|
82
|
+
"@fluidframework/eslint-config-fluid": "~2.72.0",
|
|
83
|
+
"@fluidframework/tree": "~2.72.0",
|
|
84
84
|
"@microsoft/api-extractor": "7.52.11",
|
|
85
85
|
"@types/mocha": "^10.0.10",
|
|
86
86
|
"@types/node": "^18.19.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"eslint-config-prettier": "~10.1.8",
|
|
93
93
|
"mocha": "^10.8.2",
|
|
94
94
|
"mocha-multi-reporters": "^1.5.1",
|
|
95
|
-
"prettier": "~3.
|
|
95
|
+
"prettier": "~3.6.2",
|
|
96
96
|
"rimraf": "^4.4.0",
|
|
97
97
|
"typescript": "~5.4.5"
|
|
98
98
|
},
|
package/src/executor.ts
CHANGED