@metamask/permission-controller 12.3.0 → 13.0.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +34 -6
  2. package/dist/Permission.cjs.map +1 -1
  3. package/dist/Permission.d.cts +9 -15
  4. package/dist/Permission.d.cts.map +1 -1
  5. package/dist/Permission.d.mts +9 -15
  6. package/dist/Permission.d.mts.map +1 -1
  7. package/dist/Permission.mjs.map +1 -1
  8. package/dist/PermissionController-method-action-types.cjs.map +1 -1
  9. package/dist/PermissionController-method-action-types.d.cts +44 -2
  10. package/dist/PermissionController-method-action-types.d.cts.map +1 -1
  11. package/dist/PermissionController-method-action-types.d.mts +44 -2
  12. package/dist/PermissionController-method-action-types.d.mts.map +1 -1
  13. package/dist/PermissionController-method-action-types.mjs.map +1 -1
  14. package/dist/PermissionController.cjs +23 -26
  15. package/dist/PermissionController.cjs.map +1 -1
  16. package/dist/PermissionController.d.cts +9 -22
  17. package/dist/PermissionController.d.cts.map +1 -1
  18. package/dist/PermissionController.d.mts +9 -22
  19. package/dist/PermissionController.d.mts.map +1 -1
  20. package/dist/PermissionController.mjs +23 -26
  21. package/dist/PermissionController.mjs.map +1 -1
  22. package/dist/createRestrictedMethodMessenger.cjs +20 -0
  23. package/dist/createRestrictedMethodMessenger.cjs.map +1 -0
  24. package/dist/createRestrictedMethodMessenger.d.cts +42 -0
  25. package/dist/createRestrictedMethodMessenger.d.cts.map +1 -0
  26. package/dist/createRestrictedMethodMessenger.d.mts +42 -0
  27. package/dist/createRestrictedMethodMessenger.d.mts.map +1 -0
  28. package/dist/createRestrictedMethodMessenger.mjs +16 -0
  29. package/dist/createRestrictedMethodMessenger.mjs.map +1 -0
  30. package/dist/index.cjs +6 -14
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +4 -3
  33. package/dist/index.d.cts.map +1 -1
  34. package/dist/index.d.mts +4 -3
  35. package/dist/index.d.mts.map +1 -1
  36. package/dist/index.mjs +2 -1
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/permission-middleware.cjs +47 -43
  39. package/dist/permission-middleware.cjs.map +1 -1
  40. package/dist/permission-middleware.d.cts +40 -25
  41. package/dist/permission-middleware.d.cts.map +1 -1
  42. package/dist/permission-middleware.d.mts +40 -25
  43. package/dist/permission-middleware.d.mts.map +1 -1
  44. package/dist/permission-middleware.mjs +44 -41
  45. package/dist/permission-middleware.mjs.map +1 -1
  46. package/dist/utils.cjs.map +1 -1
  47. package/dist/utils.d.cts +0 -23
  48. package/dist/utils.d.cts.map +1 -1
  49. package/dist/utils.d.mts +0 -23
  50. package/dist/utils.d.mts.map +1 -1
  51. package/dist/utils.mjs.map +1 -1
  52. package/package.json +20 -19
  53. package/dist/rpc-methods/getPermissions.cjs +0 -27
  54. package/dist/rpc-methods/getPermissions.cjs.map +0 -1
  55. package/dist/rpc-methods/getPermissions.d.cts +0 -9
  56. package/dist/rpc-methods/getPermissions.d.cts.map +0 -1
  57. package/dist/rpc-methods/getPermissions.d.mts +0 -9
  58. package/dist/rpc-methods/getPermissions.d.mts.map +0 -1
  59. package/dist/rpc-methods/getPermissions.mjs +0 -24
  60. package/dist/rpc-methods/getPermissions.mjs.map +0 -1
  61. package/dist/rpc-methods/index.cjs +0 -12
  62. package/dist/rpc-methods/index.cjs.map +0 -1
  63. package/dist/rpc-methods/index.d.cts +0 -6
  64. package/dist/rpc-methods/index.d.cts.map +0 -1
  65. package/dist/rpc-methods/index.d.mts +0 -6
  66. package/dist/rpc-methods/index.d.mts.map +0 -1
  67. package/dist/rpc-methods/index.mjs +0 -9
  68. package/dist/rpc-methods/index.mjs.map +0 -1
  69. package/dist/rpc-methods/requestPermissions.cjs +0 -36
  70. package/dist/rpc-methods/requestPermissions.cjs.map +0 -1
  71. package/dist/rpc-methods/requestPermissions.d.cts +0 -17
  72. package/dist/rpc-methods/requestPermissions.d.cts.map +0 -1
  73. package/dist/rpc-methods/requestPermissions.d.mts +0 -17
  74. package/dist/rpc-methods/requestPermissions.d.mts.map +0 -1
  75. package/dist/rpc-methods/requestPermissions.mjs +0 -33
  76. package/dist/rpc-methods/requestPermissions.mjs.map +0 -1
  77. package/dist/rpc-methods/revokePermissions.cjs +0 -41
  78. package/dist/rpc-methods/revokePermissions.cjs.map +0 -1
  79. package/dist/rpc-methods/revokePermissions.d.cts +0 -11
  80. package/dist/rpc-methods/revokePermissions.d.cts.map +0 -1
  81. package/dist/rpc-methods/revokePermissions.d.mts +0 -11
  82. package/dist/rpc-methods/revokePermissions.d.mts.map +0 -1
  83. package/dist/rpc-methods/revokePermissions.mjs +0 -38
  84. package/dist/rpc-methods/revokePermissions.mjs.map +0 -1
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRestrictedMethodMessenger = void 0;
4
+ const messenger_1 = require("@metamask/messenger");
5
+ function createRestrictedMethodMessenger({ rootMessenger, namespace, actionNames, }) {
6
+ if (!actionNames?.length) {
7
+ return undefined;
8
+ }
9
+ const restrictedMethodMessenger = new messenger_1.Messenger({
10
+ namespace,
11
+ parent: rootMessenger,
12
+ });
13
+ rootMessenger.delegate({
14
+ actions: actionNames,
15
+ messenger: restrictedMethodMessenger,
16
+ });
17
+ return restrictedMethodMessenger;
18
+ }
19
+ exports.createRestrictedMethodMessenger = createRestrictedMethodMessenger;
20
+ //# sourceMappingURL=createRestrictedMethodMessenger.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRestrictedMethodMessenger.cjs","sourceRoot":"","sources":["../src/createRestrictedMethodMessenger.ts"],"names":[],"mappings":";;;AAKA,mDAAgD;AA2DhD,SAAgB,+BAA+B,CAO7C,EACA,aAAa,EACb,SAAS,EACT,WAAW,GAKZ;IAQC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,yBAAyB,GAAG,IAAI,qBAAS,CAK7C;QACA,SAAS;QACT,MAAM,EAAE,aAAa;KACtB,CAAC,CAAC;IAEH,aAAa,CAAC,QAAQ,CAAC;QACrB,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,yBAAyB;KACrC,CAAC,CAAC;IAEH,OAAO,yBAAyB,CAAC;AACnC,CAAC;AA3CD,0EA2CC","sourcesContent":["import type {\n ActionConstraint,\n EventConstraint,\n MessengerActions,\n} from '@metamask/messenger';\nimport { Messenger } from '@metamask/messenger';\n\n/**\n * The subset of `RootMessenger`'s actions selected by `DelegatedActions`.\n */\ntype SelectedActions<\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n DelegatedActions extends readonly MessengerActions<RootMessenger>['type'][],\n> = Extract<\n MessengerActions<RootMessenger>,\n { type: DelegatedActions[number] }\n>;\n\n/**\n * Create a child messenger scoped to a restricted-method permission\n * specification, delegating only the spec's declared actions from the root\n * messenger. This produces a minimally-scoped messenger whose action surface\n * matches exactly what the spec has declared it needs.\n *\n * Returns `undefined` when `actionNames` is omitted — there is nothing to\n * scope, and the builder can be invoked without a messenger.\n *\n * @param args - The arguments.\n * @param args.rootMessenger - The root messenger to delegate actions from.\n * @param args.namespace - The namespace for the scoped child messenger,\n * typically the spec's `targetName`.\n * @param args.actionNames - The action types the specification requires,\n * typically the spec's declared `actionNames`. Must be a non-empty tuple of\n * action types that exist on the root messenger.\n * @returns A scoped child messenger with the requested actions delegated, or\n * `undefined` if no actions were requested.\n */\nexport function createRestrictedMethodMessenger<\n Namespace extends string,\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n DelegatedActions extends readonly [\n MessengerActions<RootMessenger>['type'],\n ...MessengerActions<RootMessenger>['type'][],\n ],\n>(args: {\n rootMessenger: RootMessenger;\n namespace: Namespace;\n actionNames: DelegatedActions;\n}): Messenger<\n Namespace,\n SelectedActions<RootMessenger, DelegatedActions>,\n never,\n RootMessenger\n>;\n\nexport function createRestrictedMethodMessenger<\n Namespace extends string,\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n>(args: {\n rootMessenger: RootMessenger;\n namespace: Namespace;\n actionNames?: undefined;\n}): undefined;\n\nexport function createRestrictedMethodMessenger<\n Namespace extends string,\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n DelegatedActions extends [\n MessengerActions<RootMessenger>['type'],\n ...MessengerActions<RootMessenger>['type'][],\n ],\n>({\n rootMessenger,\n namespace,\n actionNames,\n}: {\n rootMessenger: RootMessenger;\n namespace: Namespace;\n actionNames?: DelegatedActions;\n}):\n | Messenger<\n Namespace,\n SelectedActions<RootMessenger, DelegatedActions>,\n never,\n RootMessenger\n >\n | undefined {\n if (!actionNames?.length) {\n return undefined;\n }\n\n const restrictedMethodMessenger = new Messenger<\n Namespace,\n SelectedActions<RootMessenger, DelegatedActions>,\n never,\n RootMessenger\n >({\n namespace,\n parent: rootMessenger,\n });\n\n rootMessenger.delegate({\n actions: actionNames,\n messenger: restrictedMethodMessenger,\n });\n\n return restrictedMethodMessenger;\n}\n"]}
@@ -0,0 +1,42 @@
1
+ import type { ActionConstraint, EventConstraint, MessengerActions } from "@metamask/messenger";
2
+ import { Messenger } from "@metamask/messenger";
3
+ /**
4
+ * The subset of `RootMessenger`'s actions selected by `DelegatedActions`.
5
+ */
6
+ type SelectedActions<RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>, DelegatedActions extends readonly MessengerActions<RootMessenger>['type'][]> = Extract<MessengerActions<RootMessenger>, {
7
+ type: DelegatedActions[number];
8
+ }>;
9
+ /**
10
+ * Create a child messenger scoped to a restricted-method permission
11
+ * specification, delegating only the spec's declared actions from the root
12
+ * messenger. This produces a minimally-scoped messenger whose action surface
13
+ * matches exactly what the spec has declared it needs.
14
+ *
15
+ * Returns `undefined` when `actionNames` is omitted — there is nothing to
16
+ * scope, and the builder can be invoked without a messenger.
17
+ *
18
+ * @param args - The arguments.
19
+ * @param args.rootMessenger - The root messenger to delegate actions from.
20
+ * @param args.namespace - The namespace for the scoped child messenger,
21
+ * typically the spec's `targetName`.
22
+ * @param args.actionNames - The action types the specification requires,
23
+ * typically the spec's declared `actionNames`. Must be a non-empty tuple of
24
+ * action types that exist on the root messenger.
25
+ * @returns A scoped child messenger with the requested actions delegated, or
26
+ * `undefined` if no actions were requested.
27
+ */
28
+ export declare function createRestrictedMethodMessenger<Namespace extends string, RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>, DelegatedActions extends readonly [
29
+ MessengerActions<RootMessenger>['type'],
30
+ ...MessengerActions<RootMessenger>['type'][]
31
+ ]>(args: {
32
+ rootMessenger: RootMessenger;
33
+ namespace: Namespace;
34
+ actionNames: DelegatedActions;
35
+ }): Messenger<Namespace, SelectedActions<RootMessenger, DelegatedActions>, never, RootMessenger>;
36
+ export declare function createRestrictedMethodMessenger<Namespace extends string, RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>>(args: {
37
+ rootMessenger: RootMessenger;
38
+ namespace: Namespace;
39
+ actionNames?: undefined;
40
+ }): undefined;
41
+ export {};
42
+ //# sourceMappingURL=createRestrictedMethodMessenger.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRestrictedMethodMessenger.d.cts","sourceRoot":"","sources":["../src/createRestrictedMethodMessenger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACjB,4BAA4B;AAC7B,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAEhD;;GAEG;AACH,KAAK,eAAe,CAClB,aAAa,SAAS,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAC1E,gBAAgB,SAAS,SAAS,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,EAAE,IACzE,OAAO,CACT,gBAAgB,CAAC,aAAa,CAAC,EAC/B;IAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAAE,CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,SAAS,MAAM,EACxB,aAAa,SAAS,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAC1E,gBAAgB,SAAS,SAAS;IAChC,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC;IACvC,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,EAAE;CAC7C,EACD,IAAI,EAAE;IACN,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,GAAG,SAAS,CACX,SAAS,EACT,eAAe,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAChD,KAAK,EACL,aAAa,CACd,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,SAAS,SAAS,MAAM,EACxB,aAAa,SAAS,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAC1E,IAAI,EAAE;IACN,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,GAAG,SAAS,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { ActionConstraint, EventConstraint, MessengerActions } from "@metamask/messenger";
2
+ import { Messenger } from "@metamask/messenger";
3
+ /**
4
+ * The subset of `RootMessenger`'s actions selected by `DelegatedActions`.
5
+ */
6
+ type SelectedActions<RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>, DelegatedActions extends readonly MessengerActions<RootMessenger>['type'][]> = Extract<MessengerActions<RootMessenger>, {
7
+ type: DelegatedActions[number];
8
+ }>;
9
+ /**
10
+ * Create a child messenger scoped to a restricted-method permission
11
+ * specification, delegating only the spec's declared actions from the root
12
+ * messenger. This produces a minimally-scoped messenger whose action surface
13
+ * matches exactly what the spec has declared it needs.
14
+ *
15
+ * Returns `undefined` when `actionNames` is omitted — there is nothing to
16
+ * scope, and the builder can be invoked without a messenger.
17
+ *
18
+ * @param args - The arguments.
19
+ * @param args.rootMessenger - The root messenger to delegate actions from.
20
+ * @param args.namespace - The namespace for the scoped child messenger,
21
+ * typically the spec's `targetName`.
22
+ * @param args.actionNames - The action types the specification requires,
23
+ * typically the spec's declared `actionNames`. Must be a non-empty tuple of
24
+ * action types that exist on the root messenger.
25
+ * @returns A scoped child messenger with the requested actions delegated, or
26
+ * `undefined` if no actions were requested.
27
+ */
28
+ export declare function createRestrictedMethodMessenger<Namespace extends string, RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>, DelegatedActions extends readonly [
29
+ MessengerActions<RootMessenger>['type'],
30
+ ...MessengerActions<RootMessenger>['type'][]
31
+ ]>(args: {
32
+ rootMessenger: RootMessenger;
33
+ namespace: Namespace;
34
+ actionNames: DelegatedActions;
35
+ }): Messenger<Namespace, SelectedActions<RootMessenger, DelegatedActions>, never, RootMessenger>;
36
+ export declare function createRestrictedMethodMessenger<Namespace extends string, RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>>(args: {
37
+ rootMessenger: RootMessenger;
38
+ namespace: Namespace;
39
+ actionNames?: undefined;
40
+ }): undefined;
41
+ export {};
42
+ //# sourceMappingURL=createRestrictedMethodMessenger.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRestrictedMethodMessenger.d.mts","sourceRoot":"","sources":["../src/createRestrictedMethodMessenger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACjB,4BAA4B;AAC7B,OAAO,EAAE,SAAS,EAAE,4BAA4B;AAEhD;;GAEG;AACH,KAAK,eAAe,CAClB,aAAa,SAAS,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAC1E,gBAAgB,SAAS,SAAS,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,EAAE,IACzE,OAAO,CACT,gBAAgB,CAAC,aAAa,CAAC,EAC/B;IAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAAE,CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,+BAA+B,CAC7C,SAAS,SAAS,MAAM,EACxB,aAAa,SAAS,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAC1E,gBAAgB,SAAS,SAAS;IAChC,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC;IACvC,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,EAAE;CAC7C,EACD,IAAI,EAAE;IACN,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,GAAG,SAAS,CACX,SAAS,EACT,eAAe,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAChD,KAAK,EACL,aAAa,CACd,CAAC;AAEF,wBAAgB,+BAA+B,CAC7C,SAAS,SAAS,MAAM,EACxB,aAAa,SAAS,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,eAAe,CAAC,EAC1E,IAAI,EAAE;IACN,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,GAAG,SAAS,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Messenger } from "@metamask/messenger";
2
+ export function createRestrictedMethodMessenger({ rootMessenger, namespace, actionNames, }) {
3
+ if (!actionNames?.length) {
4
+ return undefined;
5
+ }
6
+ const restrictedMethodMessenger = new Messenger({
7
+ namespace,
8
+ parent: rootMessenger,
9
+ });
10
+ rootMessenger.delegate({
11
+ actions: actionNames,
12
+ messenger: restrictedMethodMessenger,
13
+ });
14
+ return restrictedMethodMessenger;
15
+ }
16
+ //# sourceMappingURL=createRestrictedMethodMessenger.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRestrictedMethodMessenger.mjs","sourceRoot":"","sources":["../src/createRestrictedMethodMessenger.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,4BAA4B;AA2DhD,MAAM,UAAU,+BAA+B,CAO7C,EACA,aAAa,EACb,SAAS,EACT,WAAW,GAKZ;IAQC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,yBAAyB,GAAG,IAAI,SAAS,CAK7C;QACA,SAAS;QACT,MAAM,EAAE,aAAa;KACtB,CAAC,CAAC;IAEH,aAAa,CAAC,QAAQ,CAAC;QACrB,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,yBAAyB;KACrC,CAAC,CAAC;IAEH,OAAO,yBAAyB,CAAC;AACnC,CAAC","sourcesContent":["import type {\n ActionConstraint,\n EventConstraint,\n MessengerActions,\n} from '@metamask/messenger';\nimport { Messenger } from '@metamask/messenger';\n\n/**\n * The subset of `RootMessenger`'s actions selected by `DelegatedActions`.\n */\ntype SelectedActions<\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n DelegatedActions extends readonly MessengerActions<RootMessenger>['type'][],\n> = Extract<\n MessengerActions<RootMessenger>,\n { type: DelegatedActions[number] }\n>;\n\n/**\n * Create a child messenger scoped to a restricted-method permission\n * specification, delegating only the spec's declared actions from the root\n * messenger. This produces a minimally-scoped messenger whose action surface\n * matches exactly what the spec has declared it needs.\n *\n * Returns `undefined` when `actionNames` is omitted — there is nothing to\n * scope, and the builder can be invoked without a messenger.\n *\n * @param args - The arguments.\n * @param args.rootMessenger - The root messenger to delegate actions from.\n * @param args.namespace - The namespace for the scoped child messenger,\n * typically the spec's `targetName`.\n * @param args.actionNames - The action types the specification requires,\n * typically the spec's declared `actionNames`. Must be a non-empty tuple of\n * action types that exist on the root messenger.\n * @returns A scoped child messenger with the requested actions delegated, or\n * `undefined` if no actions were requested.\n */\nexport function createRestrictedMethodMessenger<\n Namespace extends string,\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n DelegatedActions extends readonly [\n MessengerActions<RootMessenger>['type'],\n ...MessengerActions<RootMessenger>['type'][],\n ],\n>(args: {\n rootMessenger: RootMessenger;\n namespace: Namespace;\n actionNames: DelegatedActions;\n}): Messenger<\n Namespace,\n SelectedActions<RootMessenger, DelegatedActions>,\n never,\n RootMessenger\n>;\n\nexport function createRestrictedMethodMessenger<\n Namespace extends string,\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n>(args: {\n rootMessenger: RootMessenger;\n namespace: Namespace;\n actionNames?: undefined;\n}): undefined;\n\nexport function createRestrictedMethodMessenger<\n Namespace extends string,\n RootMessenger extends Messenger<string, ActionConstraint, EventConstraint>,\n DelegatedActions extends [\n MessengerActions<RootMessenger>['type'],\n ...MessengerActions<RootMessenger>['type'][],\n ],\n>({\n rootMessenger,\n namespace,\n actionNames,\n}: {\n rootMessenger: RootMessenger;\n namespace: Namespace;\n actionNames?: DelegatedActions;\n}):\n | Messenger<\n Namespace,\n SelectedActions<RootMessenger, DelegatedActions>,\n never,\n RootMessenger\n >\n | undefined {\n if (!actionNames?.length) {\n return undefined;\n }\n\n const restrictedMethodMessenger = new Messenger<\n Namespace,\n SelectedActions<RootMessenger, DelegatedActions>,\n never,\n RootMessenger\n >({\n namespace,\n parent: rootMessenger,\n });\n\n rootMessenger.delegate({\n actions: actionNames,\n messenger: restrictedMethodMessenger,\n });\n\n return restrictedMethodMessenger;\n}\n"]}
package/dist/index.cjs CHANGED
@@ -10,29 +10,21 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
15
  };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
16
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.permissionRpcMethods = exports.MethodNames = void 0;
17
+ exports.MethodNames = exports.createPermissionMiddlewareV2 = exports.createPermissionMiddleware = exports.createRestrictedMethodMessenger = void 0;
30
18
  __exportStar(require("./Caveat.cjs"), exports);
19
+ var createRestrictedMethodMessenger_1 = require("./createRestrictedMethodMessenger.cjs");
20
+ Object.defineProperty(exports, "createRestrictedMethodMessenger", { enumerable: true, get: function () { return createRestrictedMethodMessenger_1.createRestrictedMethodMessenger; } });
31
21
  __exportStar(require("./errors.cjs"), exports);
32
22
  __exportStar(require("./Permission.cjs"), exports);
33
23
  __exportStar(require("./PermissionController.cjs"), exports);
24
+ var permission_middleware_1 = require("./permission-middleware.cjs");
25
+ Object.defineProperty(exports, "createPermissionMiddleware", { enumerable: true, get: function () { return permission_middleware_1.createPermissionMiddleware; } });
26
+ Object.defineProperty(exports, "createPermissionMiddlewareV2", { enumerable: true, get: function () { return permission_middleware_1.createPermissionMiddlewareV2; } });
34
27
  var utils_1 = require("./utils.cjs");
35
28
  Object.defineProperty(exports, "MethodNames", { enumerable: true, get: function () { return utils_1.MethodNames; } });
36
- exports.permissionRpcMethods = __importStar(require("./rpc-methods/index.cjs"));
37
29
  __exportStar(require("./SubjectMetadataController.cjs"), exports);
38
30
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAyB;AACzB,+CAAyB;AACzB,mDAA6B;AAC7B,6DAAuC;AAwBvC,qCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,gFAAsD;AACtD,kEAA4C","sourcesContent":["export * from './Caveat';\nexport * from './errors';\nexport * from './Permission';\nexport * from './PermissionController';\nexport type {\n PermissionControllerClearStateAction,\n PermissionControllerGetSubjectNamesAction,\n PermissionControllerGetPermissionsAction,\n PermissionControllerHasPermissionAction,\n PermissionControllerHasPermissionsAction,\n PermissionControllerRevokeAllPermissionsAction,\n PermissionControllerRevokePermissionsAction,\n PermissionControllerRevokePermissionForAllSubjectsAction,\n PermissionControllerGetCaveatAction,\n PermissionControllerUpdateCaveatAction,\n PermissionControllerGrantPermissionsAction,\n PermissionControllerGrantPermissionsIncrementalAction,\n PermissionControllerRequestPermissionsAction,\n PermissionControllerRequestPermissionsIncrementalAction,\n PermissionControllerGetEndowmentsAction,\n} from './PermissionController-method-action-types';\nexport type {\n ExtractSpecifications,\n HandlerMiddlewareFunction,\n HookNames,\n PermittedHandlerExport,\n} from './utils';\nexport { MethodNames } from './utils';\nexport * as permissionRpcMethods from './rpc-methods';\nexport * from './SubjectMetadataController';\nexport type {\n SubjectMetadataControllerClearStateAction,\n SubjectMetadataControllerAddSubjectMetadataAction,\n SubjectMetadataControllerGetSubjectMetadataAction,\n SubjectMetadataControllerTrimMetadataStateAction,\n} from './SubjectMetadataController-method-action-types';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAAyB;AACzB,yFAAoF;AAA3E,kJAAA,+BAA+B,OAAA;AACxC,+CAAyB;AACzB,mDAA6B;AAC7B,6DAAuC;AAoBvC,qEAIiC;AAH/B,mIAAA,0BAA0B,OAAA;AAC1B,qIAAA,4BAA4B,OAAA;AAI9B,qCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,kEAA4C","sourcesContent":["export * from './Caveat';\nexport { createRestrictedMethodMessenger } from './createRestrictedMethodMessenger';\nexport * from './errors';\nexport * from './Permission';\nexport * from './PermissionController';\nexport type {\n PermissionControllerClearStateAction,\n PermissionControllerExecuteRestrictedMethodAction,\n PermissionControllerGetCaveatAction,\n PermissionControllerGetEndowmentsAction,\n PermissionControllerGetPermissionsAction,\n PermissionControllerGetSubjectNamesAction,\n PermissionControllerGrantPermissionsAction,\n PermissionControllerGrantPermissionsIncrementalAction,\n PermissionControllerHasPermissionAction,\n PermissionControllerHasPermissionsAction,\n PermissionControllerHasUnrestrictedMethodAction,\n PermissionControllerRequestPermissionsAction,\n PermissionControllerRequestPermissionsIncrementalAction,\n PermissionControllerRevokeAllPermissionsAction,\n PermissionControllerRevokePermissionForAllSubjectsAction,\n PermissionControllerRevokePermissionsAction,\n PermissionControllerUpdateCaveatAction,\n} from './PermissionController-method-action-types';\nexport {\n createPermissionMiddleware,\n createPermissionMiddlewareV2,\n type PermissionMiddlewareActions,\n} from './permission-middleware';\nexport type { ExtractSpecifications } from './utils';\nexport { MethodNames } from './utils';\nexport * from './SubjectMetadataController';\nexport type {\n SubjectMetadataControllerClearStateAction,\n SubjectMetadataControllerAddSubjectMetadataAction,\n SubjectMetadataControllerGetSubjectMetadataAction,\n SubjectMetadataControllerTrimMetadataStateAction,\n} from './SubjectMetadataController-method-action-types';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,11 +1,12 @@
1
1
  export * from "./Caveat.cjs";
2
+ export { createRestrictedMethodMessenger } from "./createRestrictedMethodMessenger.cjs";
2
3
  export * from "./errors.cjs";
3
4
  export * from "./Permission.cjs";
4
5
  export * from "./PermissionController.cjs";
5
- export type { PermissionControllerClearStateAction, PermissionControllerGetSubjectNamesAction, PermissionControllerGetPermissionsAction, PermissionControllerHasPermissionAction, PermissionControllerHasPermissionsAction, PermissionControllerRevokeAllPermissionsAction, PermissionControllerRevokePermissionsAction, PermissionControllerRevokePermissionForAllSubjectsAction, PermissionControllerGetCaveatAction, PermissionControllerUpdateCaveatAction, PermissionControllerGrantPermissionsAction, PermissionControllerGrantPermissionsIncrementalAction, PermissionControllerRequestPermissionsAction, PermissionControllerRequestPermissionsIncrementalAction, PermissionControllerGetEndowmentsAction, } from "./PermissionController-method-action-types.cjs";
6
- export type { ExtractSpecifications, HandlerMiddlewareFunction, HookNames, PermittedHandlerExport, } from "./utils.cjs";
6
+ export type { PermissionControllerClearStateAction, PermissionControllerExecuteRestrictedMethodAction, PermissionControllerGetCaveatAction, PermissionControllerGetEndowmentsAction, PermissionControllerGetPermissionsAction, PermissionControllerGetSubjectNamesAction, PermissionControllerGrantPermissionsAction, PermissionControllerGrantPermissionsIncrementalAction, PermissionControllerHasPermissionAction, PermissionControllerHasPermissionsAction, PermissionControllerHasUnrestrictedMethodAction, PermissionControllerRequestPermissionsAction, PermissionControllerRequestPermissionsIncrementalAction, PermissionControllerRevokeAllPermissionsAction, PermissionControllerRevokePermissionForAllSubjectsAction, PermissionControllerRevokePermissionsAction, PermissionControllerUpdateCaveatAction, } from "./PermissionController-method-action-types.cjs";
7
+ export { createPermissionMiddleware, createPermissionMiddlewareV2, type PermissionMiddlewareActions, } from "./permission-middleware.cjs";
8
+ export type { ExtractSpecifications } from "./utils.cjs";
7
9
  export { MethodNames } from "./utils.cjs";
8
- export * as permissionRpcMethods from "./rpc-methods/index.cjs";
9
10
  export * from "./SubjectMetadataController.cjs";
10
11
  export type { SubjectMetadataControllerClearStateAction, SubjectMetadataControllerAddSubjectMetadataAction, SubjectMetadataControllerGetSubjectMetadataAction, SubjectMetadataControllerTrimMetadataStateAction, } from "./SubjectMetadataController-method-action-types.cjs";
11
12
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAAyB;AACzB,6BAAyB;AACzB,iCAA6B;AAC7B,2CAAuC;AACvC,YAAY,EACV,oCAAoC,EACpC,yCAAyC,EACzC,wCAAwC,EACxC,uCAAuC,EACvC,wCAAwC,EACxC,8CAA8C,EAC9C,2CAA2C,EAC3C,wDAAwD,EACxD,mCAAmC,EACnC,sCAAsC,EACtC,0CAA0C,EAC1C,qDAAqD,EACrD,4CAA4C,EAC5C,uDAAuD,EACvD,uCAAuC,GACxC,uDAAmD;AACpD,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,SAAS,EACT,sBAAsB,GACvB,oBAAgB;AACjB,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,KAAK,oBAAoB,gCAAsB;AACtD,gDAA4C;AAC5C,YAAY,EACV,yCAAyC,EACzC,iDAAiD,EACjD,iDAAiD,EACjD,gDAAgD,GACjD,4DAAwD"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAAyB;AACzB,OAAO,EAAE,+BAA+B,EAAE,8CAA0C;AACpF,6BAAyB;AACzB,iCAA6B;AAC7B,2CAAuC;AACvC,YAAY,EACV,oCAAoC,EACpC,iDAAiD,EACjD,mCAAmC,EACnC,uCAAuC,EACvC,wCAAwC,EACxC,yCAAyC,EACzC,0CAA0C,EAC1C,qDAAqD,EACrD,uCAAuC,EACvC,wCAAwC,EACxC,+CAA+C,EAC/C,4CAA4C,EAC5C,uDAAuD,EACvD,8CAA8C,EAC9C,wDAAwD,EACxD,2CAA2C,EAC3C,sCAAsC,GACvC,uDAAmD;AACpD,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,KAAK,2BAA2B,GACjC,oCAAgC;AACjC,YAAY,EAAE,qBAAqB,EAAE,oBAAgB;AACrD,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,gDAA4C;AAC5C,YAAY,EACV,yCAAyC,EACzC,iDAAiD,EACjD,iDAAiD,EACjD,gDAAgD,GACjD,4DAAwD"}
package/dist/index.d.mts CHANGED
@@ -1,11 +1,12 @@
1
1
  export * from "./Caveat.mjs";
2
+ export { createRestrictedMethodMessenger } from "./createRestrictedMethodMessenger.mjs";
2
3
  export * from "./errors.mjs";
3
4
  export * from "./Permission.mjs";
4
5
  export * from "./PermissionController.mjs";
5
- export type { PermissionControllerClearStateAction, PermissionControllerGetSubjectNamesAction, PermissionControllerGetPermissionsAction, PermissionControllerHasPermissionAction, PermissionControllerHasPermissionsAction, PermissionControllerRevokeAllPermissionsAction, PermissionControllerRevokePermissionsAction, PermissionControllerRevokePermissionForAllSubjectsAction, PermissionControllerGetCaveatAction, PermissionControllerUpdateCaveatAction, PermissionControllerGrantPermissionsAction, PermissionControllerGrantPermissionsIncrementalAction, PermissionControllerRequestPermissionsAction, PermissionControllerRequestPermissionsIncrementalAction, PermissionControllerGetEndowmentsAction, } from "./PermissionController-method-action-types.mjs";
6
- export type { ExtractSpecifications, HandlerMiddlewareFunction, HookNames, PermittedHandlerExport, } from "./utils.mjs";
6
+ export type { PermissionControllerClearStateAction, PermissionControllerExecuteRestrictedMethodAction, PermissionControllerGetCaveatAction, PermissionControllerGetEndowmentsAction, PermissionControllerGetPermissionsAction, PermissionControllerGetSubjectNamesAction, PermissionControllerGrantPermissionsAction, PermissionControllerGrantPermissionsIncrementalAction, PermissionControllerHasPermissionAction, PermissionControllerHasPermissionsAction, PermissionControllerHasUnrestrictedMethodAction, PermissionControllerRequestPermissionsAction, PermissionControllerRequestPermissionsIncrementalAction, PermissionControllerRevokeAllPermissionsAction, PermissionControllerRevokePermissionForAllSubjectsAction, PermissionControllerRevokePermissionsAction, PermissionControllerUpdateCaveatAction, } from "./PermissionController-method-action-types.mjs";
7
+ export { createPermissionMiddleware, createPermissionMiddlewareV2, type PermissionMiddlewareActions, } from "./permission-middleware.mjs";
8
+ export type { ExtractSpecifications } from "./utils.mjs";
7
9
  export { MethodNames } from "./utils.mjs";
8
- export * as permissionRpcMethods from "./rpc-methods/index.mjs";
9
10
  export * from "./SubjectMetadataController.mjs";
10
11
  export type { SubjectMetadataControllerClearStateAction, SubjectMetadataControllerAddSubjectMetadataAction, SubjectMetadataControllerGetSubjectMetadataAction, SubjectMetadataControllerTrimMetadataStateAction, } from "./SubjectMetadataController-method-action-types.mjs";
11
12
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAAyB;AACzB,6BAAyB;AACzB,iCAA6B;AAC7B,2CAAuC;AACvC,YAAY,EACV,oCAAoC,EACpC,yCAAyC,EACzC,wCAAwC,EACxC,uCAAuC,EACvC,wCAAwC,EACxC,8CAA8C,EAC9C,2CAA2C,EAC3C,wDAAwD,EACxD,mCAAmC,EACnC,sCAAsC,EACtC,0CAA0C,EAC1C,qDAAqD,EACrD,4CAA4C,EAC5C,uDAAuD,EACvD,uCAAuC,GACxC,uDAAmD;AACpD,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,SAAS,EACT,sBAAsB,GACvB,oBAAgB;AACjB,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,KAAK,oBAAoB,gCAAsB;AACtD,gDAA4C;AAC5C,YAAY,EACV,yCAAyC,EACzC,iDAAiD,EACjD,iDAAiD,EACjD,gDAAgD,GACjD,4DAAwD"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAAyB;AACzB,OAAO,EAAE,+BAA+B,EAAE,8CAA0C;AACpF,6BAAyB;AACzB,iCAA6B;AAC7B,2CAAuC;AACvC,YAAY,EACV,oCAAoC,EACpC,iDAAiD,EACjD,mCAAmC,EACnC,uCAAuC,EACvC,wCAAwC,EACxC,yCAAyC,EACzC,0CAA0C,EAC1C,qDAAqD,EACrD,uCAAuC,EACvC,wCAAwC,EACxC,+CAA+C,EAC/C,4CAA4C,EAC5C,uDAAuD,EACvD,8CAA8C,EAC9C,wDAAwD,EACxD,2CAA2C,EAC3C,sCAAsC,GACvC,uDAAmD;AACpD,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,KAAK,2BAA2B,GACjC,oCAAgC;AACjC,YAAY,EAAE,qBAAqB,EAAE,oBAAgB;AACrD,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,gDAA4C;AAC5C,YAAY,EACV,yCAAyC,EACzC,iDAAiD,EACjD,iDAAiD,EACjD,gDAAgD,GACjD,4DAAwD"}
package/dist/index.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  export * from "./Caveat.mjs";
2
+ export { createRestrictedMethodMessenger } from "./createRestrictedMethodMessenger.mjs";
2
3
  export * from "./errors.mjs";
3
4
  export * from "./Permission.mjs";
4
5
  export * from "./PermissionController.mjs";
6
+ export { createPermissionMiddleware, createPermissionMiddlewareV2 } from "./permission-middleware.mjs";
5
7
  export { MethodNames } from "./utils.mjs";
6
- export * as permissionRpcMethods from "./rpc-methods/index.mjs";
7
8
  export * from "./SubjectMetadataController.mjs";
8
9
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAAyB;AACzB,6BAAyB;AACzB,iCAA6B;AAC7B,2CAAuC;AAwBvC,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,KAAK,oBAAoB,gCAAsB;AACtD,gDAA4C","sourcesContent":["export * from './Caveat';\nexport * from './errors';\nexport * from './Permission';\nexport * from './PermissionController';\nexport type {\n PermissionControllerClearStateAction,\n PermissionControllerGetSubjectNamesAction,\n PermissionControllerGetPermissionsAction,\n PermissionControllerHasPermissionAction,\n PermissionControllerHasPermissionsAction,\n PermissionControllerRevokeAllPermissionsAction,\n PermissionControllerRevokePermissionsAction,\n PermissionControllerRevokePermissionForAllSubjectsAction,\n PermissionControllerGetCaveatAction,\n PermissionControllerUpdateCaveatAction,\n PermissionControllerGrantPermissionsAction,\n PermissionControllerGrantPermissionsIncrementalAction,\n PermissionControllerRequestPermissionsAction,\n PermissionControllerRequestPermissionsIncrementalAction,\n PermissionControllerGetEndowmentsAction,\n} from './PermissionController-method-action-types';\nexport type {\n ExtractSpecifications,\n HandlerMiddlewareFunction,\n HookNames,\n PermittedHandlerExport,\n} from './utils';\nexport { MethodNames } from './utils';\nexport * as permissionRpcMethods from './rpc-methods';\nexport * from './SubjectMetadataController';\nexport type {\n SubjectMetadataControllerClearStateAction,\n SubjectMetadataControllerAddSubjectMetadataAction,\n SubjectMetadataControllerGetSubjectMetadataAction,\n SubjectMetadataControllerTrimMetadataStateAction,\n} from './SubjectMetadataController-method-action-types';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAAyB;AACzB,OAAO,EAAE,+BAA+B,EAAE,8CAA0C;AACpF,6BAAyB;AACzB,iCAA6B;AAC7B,2CAAuC;AAoBvC,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAE7B,oCAAgC;AAEjC,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,gDAA4C","sourcesContent":["export * from './Caveat';\nexport { createRestrictedMethodMessenger } from './createRestrictedMethodMessenger';\nexport * from './errors';\nexport * from './Permission';\nexport * from './PermissionController';\nexport type {\n PermissionControllerClearStateAction,\n PermissionControllerExecuteRestrictedMethodAction,\n PermissionControllerGetCaveatAction,\n PermissionControllerGetEndowmentsAction,\n PermissionControllerGetPermissionsAction,\n PermissionControllerGetSubjectNamesAction,\n PermissionControllerGrantPermissionsAction,\n PermissionControllerGrantPermissionsIncrementalAction,\n PermissionControllerHasPermissionAction,\n PermissionControllerHasPermissionsAction,\n PermissionControllerHasUnrestrictedMethodAction,\n PermissionControllerRequestPermissionsAction,\n PermissionControllerRequestPermissionsIncrementalAction,\n PermissionControllerRevokeAllPermissionsAction,\n PermissionControllerRevokePermissionForAllSubjectsAction,\n PermissionControllerRevokePermissionsAction,\n PermissionControllerUpdateCaveatAction,\n} from './PermissionController-method-action-types';\nexport {\n createPermissionMiddleware,\n createPermissionMiddlewareV2,\n type PermissionMiddlewareActions,\n} from './permission-middleware';\nexport type { ExtractSpecifications } from './utils';\nexport { MethodNames } from './utils';\nexport * from './SubjectMetadataController';\nexport type {\n SubjectMetadataControllerClearStateAction,\n SubjectMetadataControllerAddSubjectMetadataAction,\n SubjectMetadataControllerGetSubjectMetadataAction,\n SubjectMetadataControllerTrimMetadataStateAction,\n} from './SubjectMetadataController-method-action-types';\n"]}
@@ -1,55 +1,59 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPermissionMiddlewareFactory = void 0;
3
+ exports.createPermissionMiddlewareV2 = exports.createPermissionMiddleware = void 0;
4
4
  const json_rpc_engine_1 = require("@metamask/json-rpc-engine");
5
- const errors_1 = require("./errors.cjs");
6
5
  /**
7
- * Creates a permission middleware function factory. Intended for internal use
8
- * in the {@link PermissionController}. Like any {@link JsonRpcEngine}
9
- * middleware, each middleware will only receive requests from a particular
10
- * subject / origin. However, each middleware also requires access to some
11
- * `PermissionController` internals, which is why this "factory factory" exists.
6
+ * Creates a JSON-RPC middleware that enforces permissions for a single subject.
12
7
  *
13
- * The middlewares returned by the factory will pass through requests for
14
- * unrestricted methods, and attempt to execute restricted methods. If a method
15
- * is neither restricted nor unrestricted, a "method not found" error will be
16
- * returned.
17
- * If a method is restricted, the middleware will first attempt to retrieve the
18
- * subject's permission for that method. If the permission is found, the method
19
- * will be executed. Otherwise, an "unauthorized" error will be returned.
8
+ * The middleware passes through unrestricted methods, and otherwise dispatches
9
+ * restricted methods to the `PermissionController` via messenger actions. If
10
+ * the subject lacks the required permission, or if the method does not exist,
11
+ * the corresponding error is propagated to the JSON-RPC response.
20
12
  *
13
+ * @deprecated Use {@link createPermissionMiddlewareV2} with `JsonRpcEngineV2`.
21
14
  * @param options - Options bag.
22
- * @param options.executeRestrictedMethod - `PermissionController.executeRestrictedMethod`.
23
- * @param options.getRestrictedMethod - {@link PermissionController.getRestrictedMethod}.
24
- * @param options.isUnrestrictedMethod - A function that checks whether a
25
- * particular method is unrestricted.
26
- * @returns A permission middleware factory function.
15
+ * @param options.messenger - A messenger with the
16
+ * `PermissionController:executeRestrictedMethod` and
17
+ * `PermissionController:hasUnrestrictedMethod` actions.
18
+ * @param options.origin - The origin of the subject for which to create the middleware.
19
+ * @returns A `json-rpc-engine` middleware.
27
20
  */
28
- function getPermissionMiddlewareFactory({ executeRestrictedMethod, getRestrictedMethod, isUnrestrictedMethod, }) {
29
- return function createPermissionMiddleware(subject) {
30
- const { origin } = subject;
31
- if (typeof origin !== 'string' || !origin) {
32
- throw new Error('The subject "origin" must be a non-empty string.');
21
+ function createPermissionMiddleware({ messenger, origin, }) {
22
+ const permissionsMiddleware = async (request, response, next) => {
23
+ const { method, params } = request;
24
+ if (messenger.call('PermissionController:hasUnrestrictedMethod', method)) {
25
+ return next();
33
26
  }
34
- const permissionsMiddleware = async (req, res, next) => {
35
- const { method, params } = req;
36
- // Skip registered unrestricted methods.
37
- if (isUnrestrictedMethod(method)) {
38
- return next();
39
- }
40
- // This will throw if no restricted method implementation is found.
41
- const methodImplementation = getRestrictedMethod(method, origin);
42
- // This will throw if the permission does not exist.
43
- const result = await executeRestrictedMethod(methodImplementation, subject, method, params);
44
- if (result === undefined) {
45
- res.error = (0, errors_1.internalError)(`Request for method "${req.method}" returned undefined result.`, { request: req });
46
- return undefined;
47
- }
48
- res.result = result;
49
- return undefined;
50
- };
51
- return (0, json_rpc_engine_1.createAsyncMiddleware)(permissionsMiddleware);
27
+ response.result = await messenger.call('PermissionController:executeRestrictedMethod', origin, method, params);
28
+ return undefined;
52
29
  };
30
+ return (0, json_rpc_engine_1.createAsyncMiddleware)(permissionsMiddleware);
53
31
  }
54
- exports.getPermissionMiddlewareFactory = getPermissionMiddlewareFactory;
32
+ exports.createPermissionMiddleware = createPermissionMiddleware;
33
+ /**
34
+ * Creates a `JsonRpcEngineV2` middleware that enforces permissions for a
35
+ * single subject.
36
+ *
37
+ * The middleware passes through unrestricted methods, and otherwise dispatches
38
+ * restricted methods to the `PermissionController` via messenger actions. If
39
+ * the subject lacks the required permission, or if the method does not exist,
40
+ * the corresponding error is thrown.
41
+ *
42
+ * @param options - Options bag.
43
+ * @param options.messenger - A messenger with the
44
+ * `PermissionController:executeRestrictedMethod` and
45
+ * `PermissionController:hasUnrestrictedMethod` actions.
46
+ * @param options.origin - The origin of the subject for which to create the middleware.
47
+ * @returns A `JsonRpcEngineV2` middleware.
48
+ */
49
+ function createPermissionMiddlewareV2({ messenger, origin, }) {
50
+ return async ({ request, next }) => {
51
+ const { method, params } = request;
52
+ if (messenger.call('PermissionController:hasUnrestrictedMethod', method)) {
53
+ return next();
54
+ }
55
+ return messenger.call('PermissionController:executeRestrictedMethod', origin, method, params);
56
+ };
57
+ }
58
+ exports.createPermissionMiddlewareV2 = createPermissionMiddlewareV2;
55
59
  //# sourceMappingURL=permission-middleware.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"permission-middleware.cjs","sourceRoot":"","sources":["../src/permission-middleware.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AAmBlE,yCAAyC;AAiBzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,8BAA8B,CAAC,EAC7C,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACe;IACnC,OAAO,SAAS,0BAA0B,CACxC,OAAkC;QAElC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,qBAAqB,GAAG,KAAK,EACjC,GAA+C,EAC/C,GAA2B,EAC3B,IAAoC,EACrB,EAAE;YACjB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;YAE/B,wCAAwC;YACxC,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;gBACjC,OAAO,IAAI,EAAE,CAAC;YAChB,CAAC;YAED,mEAAmE;YACnE,MAAM,oBAAoB,GAAG,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAEjE,oDAAoD;YACpD,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAC1C,oBAAoB,EACpB,OAAO,EACP,MAAM,EACN,MAAM,CACP,CAAC;YAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,GAAG,CAAC,KAAK,GAAG,IAAA,sBAAa,EACvB,uBAAuB,GAAG,CAAC,MAAM,8BAA8B,EAC/D,EAAE,OAAO,EAAE,GAAG,EAAE,CACjB,CAAC;gBACF,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;YACpB,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC;QAEF,OAAO,IAAA,uCAAqB,EAAC,qBAAqB,CAAC,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC;AAlDD,wEAkDC","sourcesContent":["import { createAsyncMiddleware } from '@metamask/json-rpc-engine';\nimport type {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n JsonRpcEngine,\n JsonRpcMiddleware,\n AsyncJsonRpcEngineNextCallback,\n} from '@metamask/json-rpc-engine';\nimport type {\n Json,\n PendingJsonRpcResponse,\n JsonRpcRequest,\n} from '@metamask/utils';\n\nimport type {\n GenericPermissionController,\n PermissionSubjectMetadata,\n RestrictedMethod,\n RestrictedMethodParameters,\n} from '.';\nimport { internalError } from './errors';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { PermissionController } from './PermissionController';\n\ntype ExecuteRestrictedMethod = (\n methodImplementation: RestrictedMethod<RestrictedMethodParameters, Json>,\n subject: PermissionSubjectMetadata,\n method: string,\n params?: RestrictedMethodParameters,\n) => ReturnType<RestrictedMethod<RestrictedMethodParameters, Json>>;\n\ntype PermissionMiddlewareFactoryOptions = {\n executeRestrictedMethod: ExecuteRestrictedMethod;\n getRestrictedMethod: GenericPermissionController['getRestrictedMethod'];\n isUnrestrictedMethod: (method: string) => boolean;\n};\n\n/**\n * Creates a permission middleware function factory. Intended for internal use\n * in the {@link PermissionController}. Like any {@link JsonRpcEngine}\n * middleware, each middleware will only receive requests from a particular\n * subject / origin. However, each middleware also requires access to some\n * `PermissionController` internals, which is why this \"factory factory\" exists.\n *\n * The middlewares returned by the factory will pass through requests for\n * unrestricted methods, and attempt to execute restricted methods. If a method\n * is neither restricted nor unrestricted, a \"method not found\" error will be\n * returned.\n * If a method is restricted, the middleware will first attempt to retrieve the\n * subject's permission for that method. If the permission is found, the method\n * will be executed. Otherwise, an \"unauthorized\" error will be returned.\n *\n * @param options - Options bag.\n * @param options.executeRestrictedMethod - `PermissionController.executeRestrictedMethod`.\n * @param options.getRestrictedMethod - {@link PermissionController.getRestrictedMethod}.\n * @param options.isUnrestrictedMethod - A function that checks whether a\n * particular method is unrestricted.\n * @returns A permission middleware factory function.\n */\nexport function getPermissionMiddlewareFactory({\n executeRestrictedMethod,\n getRestrictedMethod,\n isUnrestrictedMethod,\n}: PermissionMiddlewareFactoryOptions) {\n return function createPermissionMiddleware(\n subject: PermissionSubjectMetadata,\n ): JsonRpcMiddleware<RestrictedMethodParameters, Json> {\n const { origin } = subject;\n if (typeof origin !== 'string' || !origin) {\n throw new Error('The subject \"origin\" must be a non-empty string.');\n }\n\n const permissionsMiddleware = async (\n req: JsonRpcRequest<RestrictedMethodParameters>,\n res: PendingJsonRpcResponse,\n next: AsyncJsonRpcEngineNextCallback,\n ): Promise<void> => {\n const { method, params } = req;\n\n // Skip registered unrestricted methods.\n if (isUnrestrictedMethod(method)) {\n return next();\n }\n\n // This will throw if no restricted method implementation is found.\n const methodImplementation = getRestrictedMethod(method, origin);\n\n // This will throw if the permission does not exist.\n const result = await executeRestrictedMethod(\n methodImplementation,\n subject,\n method,\n params,\n );\n\n if (result === undefined) {\n res.error = internalError(\n `Request for method \"${req.method}\" returned undefined result.`,\n { request: req },\n );\n return undefined;\n }\n\n res.result = result;\n return undefined;\n };\n\n return createAsyncMiddleware(permissionsMiddleware);\n };\n}\n"]}
1
+ {"version":3,"file":"permission-middleware.cjs","sourceRoot":"","sources":["../src/permission-middleware.ts"],"names":[],"mappings":";;;AAAA,+DAAkE;AA+BlE;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,MAAM,GAC4B;IAIlC,MAAM,qBAAqB,GAAG,KAAK,EACjC,OAAmD,EACnD,QAAgC,EAChC,IAAoC,EACrB,EAAE;QACjB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAEnC,IAAI,SAAS,CAAC,IAAI,CAAC,4CAA4C,EAAE,MAAM,CAAC,EAAE,CAAC;YACzE,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;QAED,QAAQ,CAAC,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,CACpC,8CAA8C,EAC9C,MAAM,EACN,MAAM,EACN,MAAM,CACP,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,IAAA,uCAAqB,EAAC,qBAAqB,CAAC,CAAC;AACtD,CAAC;AA5BD,gEA4BC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,4BAA4B,CAAC,EAC3C,SAAS,EACT,MAAM,GAC4B;IAClC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;QACjC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAEnC,IAAI,SAAS,CAAC,IAAI,CAAC,4CAA4C,EAAE,MAAM,CAAC,EAAE,CAAC;YACzE,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;QAED,OAAO,SAAS,CAAC,IAAI,CACnB,8CAA8C,EAC9C,MAAM,EACN,MAAM,EACN,MAAM,CACP,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAlBD,oEAkBC","sourcesContent":["import { createAsyncMiddleware } from '@metamask/json-rpc-engine';\nimport type {\n AsyncJsonRpcEngineNextCallback,\n JsonRpcMiddleware,\n} from '@metamask/json-rpc-engine';\nimport type { JsonRpcMiddleware as JsonRpcMiddlewareV2 } from '@metamask/json-rpc-engine/v2';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n Json,\n JsonRpcRequest,\n PendingJsonRpcResponse,\n} from '@metamask/utils';\n\nimport type { RestrictedMethodParameters } from './Permission';\nimport type {\n PermissionControllerExecuteRestrictedMethodAction,\n PermissionControllerHasUnrestrictedMethodAction,\n} from './PermissionController-method-action-types';\n\n/**\n * The set of messenger actions required by the permission middleware.\n */\nexport type PermissionMiddlewareActions =\n | PermissionControllerExecuteRestrictedMethodAction\n | PermissionControllerHasUnrestrictedMethodAction;\n\nexport type CreatePermissionMiddlewareOptions = {\n messenger: Messenger<string, PermissionMiddlewareActions>;\n origin: string;\n};\n\n/**\n * Creates a JSON-RPC middleware that enforces permissions for a single subject.\n *\n * The middleware passes through unrestricted methods, and otherwise dispatches\n * restricted methods to the `PermissionController` via messenger actions. If\n * the subject lacks the required permission, or if the method does not exist,\n * the corresponding error is propagated to the JSON-RPC response.\n *\n * @deprecated Use {@link createPermissionMiddlewareV2} with `JsonRpcEngineV2`.\n * @param options - Options bag.\n * @param options.messenger - A messenger with the\n * `PermissionController:executeRestrictedMethod` and\n * `PermissionController:hasUnrestrictedMethod` actions.\n * @param options.origin - The origin of the subject for which to create the middleware.\n * @returns A `json-rpc-engine` middleware.\n */\nexport function createPermissionMiddleware({\n messenger,\n origin,\n}: CreatePermissionMiddlewareOptions): JsonRpcMiddleware<\n RestrictedMethodParameters,\n Json\n> {\n const permissionsMiddleware = async (\n request: JsonRpcRequest<RestrictedMethodParameters>,\n response: PendingJsonRpcResponse,\n next: AsyncJsonRpcEngineNextCallback,\n ): Promise<void> => {\n const { method, params } = request;\n\n if (messenger.call('PermissionController:hasUnrestrictedMethod', method)) {\n return next();\n }\n\n response.result = await messenger.call(\n 'PermissionController:executeRestrictedMethod',\n origin,\n method,\n params,\n );\n return undefined;\n };\n\n return createAsyncMiddleware(permissionsMiddleware);\n}\n\n/**\n * Creates a `JsonRpcEngineV2` middleware that enforces permissions for a\n * single subject.\n *\n * The middleware passes through unrestricted methods, and otherwise dispatches\n * restricted methods to the `PermissionController` via messenger actions. If\n * the subject lacks the required permission, or if the method does not exist,\n * the corresponding error is thrown.\n *\n * @param options - Options bag.\n * @param options.messenger - A messenger with the\n * `PermissionController:executeRestrictedMethod` and\n * `PermissionController:hasUnrestrictedMethod` actions.\n * @param options.origin - The origin of the subject for which to create the middleware.\n * @returns A `JsonRpcEngineV2` middleware.\n */\nexport function createPermissionMiddlewareV2({\n messenger,\n origin,\n}: CreatePermissionMiddlewareOptions): JsonRpcMiddlewareV2 {\n return async ({ request, next }) => {\n const { method, params } = request;\n\n if (messenger.call('PermissionController:hasUnrestrictedMethod', method)) {\n return next();\n }\n\n return messenger.call(\n 'PermissionController:executeRestrictedMethod',\n origin,\n method,\n params,\n );\n };\n}\n"]}
@@ -1,34 +1,49 @@
1
1
  import type { JsonRpcMiddleware } from "@metamask/json-rpc-engine";
2
+ import type { JsonRpcMiddleware as JsonRpcMiddlewareV2 } from "@metamask/json-rpc-engine/v2";
3
+ import type { Messenger } from "@metamask/messenger";
2
4
  import type { Json } from "@metamask/utils";
3
- import type { GenericPermissionController, PermissionSubjectMetadata, RestrictedMethod, RestrictedMethodParameters } from "./index.cjs";
4
- type ExecuteRestrictedMethod = (methodImplementation: RestrictedMethod<RestrictedMethodParameters, Json>, subject: PermissionSubjectMetadata, method: string, params?: RestrictedMethodParameters) => ReturnType<RestrictedMethod<RestrictedMethodParameters, Json>>;
5
- type PermissionMiddlewareFactoryOptions = {
6
- executeRestrictedMethod: ExecuteRestrictedMethod;
7
- getRestrictedMethod: GenericPermissionController['getRestrictedMethod'];
8
- isUnrestrictedMethod: (method: string) => boolean;
5
+ import type { RestrictedMethodParameters } from "./Permission.cjs";
6
+ import type { PermissionControllerExecuteRestrictedMethodAction, PermissionControllerHasUnrestrictedMethodAction } from "./PermissionController-method-action-types.cjs";
7
+ /**
8
+ * The set of messenger actions required by the permission middleware.
9
+ */
10
+ export type PermissionMiddlewareActions = PermissionControllerExecuteRestrictedMethodAction | PermissionControllerHasUnrestrictedMethodAction;
11
+ export type CreatePermissionMiddlewareOptions = {
12
+ messenger: Messenger<string, PermissionMiddlewareActions>;
13
+ origin: string;
9
14
  };
10
15
  /**
11
- * Creates a permission middleware function factory. Intended for internal use
12
- * in the {@link PermissionController}. Like any {@link JsonRpcEngine}
13
- * middleware, each middleware will only receive requests from a particular
14
- * subject / origin. However, each middleware also requires access to some
15
- * `PermissionController` internals, which is why this "factory factory" exists.
16
+ * Creates a JSON-RPC middleware that enforces permissions for a single subject.
17
+ *
18
+ * The middleware passes through unrestricted methods, and otherwise dispatches
19
+ * restricted methods to the `PermissionController` via messenger actions. If
20
+ * the subject lacks the required permission, or if the method does not exist,
21
+ * the corresponding error is propagated to the JSON-RPC response.
22
+ *
23
+ * @deprecated Use {@link createPermissionMiddlewareV2} with `JsonRpcEngineV2`.
24
+ * @param options - Options bag.
25
+ * @param options.messenger - A messenger with the
26
+ * `PermissionController:executeRestrictedMethod` and
27
+ * `PermissionController:hasUnrestrictedMethod` actions.
28
+ * @param options.origin - The origin of the subject for which to create the middleware.
29
+ * @returns A `json-rpc-engine` middleware.
30
+ */
31
+ export declare function createPermissionMiddleware({ messenger, origin, }: CreatePermissionMiddlewareOptions): JsonRpcMiddleware<RestrictedMethodParameters, Json>;
32
+ /**
33
+ * Creates a `JsonRpcEngineV2` middleware that enforces permissions for a
34
+ * single subject.
16
35
  *
17
- * The middlewares returned by the factory will pass through requests for
18
- * unrestricted methods, and attempt to execute restricted methods. If a method
19
- * is neither restricted nor unrestricted, a "method not found" error will be
20
- * returned.
21
- * If a method is restricted, the middleware will first attempt to retrieve the
22
- * subject's permission for that method. If the permission is found, the method
23
- * will be executed. Otherwise, an "unauthorized" error will be returned.
36
+ * The middleware passes through unrestricted methods, and otherwise dispatches
37
+ * restricted methods to the `PermissionController` via messenger actions. If
38
+ * the subject lacks the required permission, or if the method does not exist,
39
+ * the corresponding error is thrown.
24
40
  *
25
41
  * @param options - Options bag.
26
- * @param options.executeRestrictedMethod - `PermissionController.executeRestrictedMethod`.
27
- * @param options.getRestrictedMethod - {@link PermissionController.getRestrictedMethod}.
28
- * @param options.isUnrestrictedMethod - A function that checks whether a
29
- * particular method is unrestricted.
30
- * @returns A permission middleware factory function.
42
+ * @param options.messenger - A messenger with the
43
+ * `PermissionController:executeRestrictedMethod` and
44
+ * `PermissionController:hasUnrestrictedMethod` actions.
45
+ * @param options.origin - The origin of the subject for which to create the middleware.
46
+ * @returns A `JsonRpcEngineV2` middleware.
31
47
  */
32
- export declare function getPermissionMiddlewareFactory({ executeRestrictedMethod, getRestrictedMethod, isUnrestrictedMethod, }: PermissionMiddlewareFactoryOptions): (subject: PermissionSubjectMetadata) => JsonRpcMiddleware<RestrictedMethodParameters, Json>;
33
- export {};
48
+ export declare function createPermissionMiddlewareV2({ messenger, origin, }: CreatePermissionMiddlewareOptions): JsonRpcMiddlewareV2;
34
49
  //# sourceMappingURL=permission-middleware.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permission-middleware.d.cts","sourceRoot":"","sources":["../src/permission-middleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,iBAAiB,EAElB,kCAAkC;AACnC,OAAO,KAAK,EACV,IAAI,EAGL,wBAAwB;AAEzB,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,gBAAgB,EAChB,0BAA0B,EAC3B,oBAAU;AAKX,KAAK,uBAAuB,GAAG,CAC7B,oBAAoB,EAAE,gBAAgB,CAAC,0BAA0B,EAAE,IAAI,CAAC,EACxE,OAAO,EAAE,yBAAyB,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,0BAA0B,KAChC,UAAU,CAAC,gBAAgB,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC,CAAC;AAEpE,KAAK,kCAAkC,GAAG;IACxC,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,mBAAmB,EAAE,2BAA2B,CAAC,qBAAqB,CAAC,CAAC;IACxE,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,8BAA8B,CAAC,EAC7C,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACrB,EAAE,kCAAkC,aAExB,yBAAyB,KACjC,kBAAkB,0BAA0B,EAAE,IAAI,CAAC,CA2CvD"}
1
+ {"version":3,"file":"permission-middleware.d.cts","sourceRoot":"","sources":["../src/permission-middleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EAClB,kCAAkC;AACnC,OAAO,KAAK,EAAE,iBAAiB,IAAI,mBAAmB,EAAE,qCAAqC;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,IAAI,EAGL,wBAAwB;AAEzB,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAqB;AAC/D,OAAO,KAAK,EACV,iDAAiD,EACjD,+CAA+C,EAChD,uDAAmD;AAEpD;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,iDAAiD,GACjD,+CAA+C,CAAC;AAEpD,MAAM,MAAM,iCAAiC,GAAG;IAC9C,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IAC1D,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,MAAM,GACP,EAAE,iCAAiC,GAAG,iBAAiB,CACtD,0BAA0B,EAC1B,IAAI,CACL,CAsBA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,SAAS,EACT,MAAM,GACP,EAAE,iCAAiC,GAAG,mBAAmB,CAezD"}