@sprucelabs/spruce-permission-plugin 31.0.98 → 31.0.99

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.
@@ -4,6 +4,7 @@ export declare class PermissionFeature implements SkillFeature {
4
4
  private skill;
5
5
  private bootHandler?;
6
6
  private log;
7
+ private resolvePreReq?;
7
8
  constructor(skill: Skill);
8
9
  execute(): Promise<void>;
9
10
  private setupContext;
@@ -12,19 +12,19 @@ import { AuthService, diskUtil, SettingsService, } from '@sprucelabs/spruce-skil
12
12
  import permissionDiskUtil from './utilities/permissionDiskUtil.js';
13
13
  export class PermissionFeature {
14
14
  constructor(skill) {
15
+ this.resolvePreReq = () => { };
15
16
  this.skill = skill;
16
17
  this.log = skill.buildLog('Permission.Feature');
17
18
  }
18
19
  execute() {
19
20
  return __awaiter(this, void 0, void 0, function* () {
20
- var _a;
21
+ var _a, _b;
21
22
  const events = this.skill.getFeatureByCode('event');
22
23
  AuthorizerFactory.setConnectToApi(() => events.connectToApi());
23
24
  this.setupContext();
24
25
  if (this.shouldRegisterPermissions()) {
25
- let resolvePreReq = () => { };
26
26
  events.addPreReq(new Promise((r) => {
27
- resolvePreReq = r;
27
+ this.resolvePreReq = r;
28
28
  }));
29
29
  const client = yield events.connectToApi();
30
30
  const contracts = this.importContracts();
@@ -38,10 +38,10 @@ export class PermissionFeature {
38
38
  this.log.info(`Done syncing permission contracts`);
39
39
  }
40
40
  finally {
41
- resolvePreReq();
41
+ (_a = this.resolvePreReq) === null || _a === void 0 ? void 0 : _a.call(this);
42
42
  }
43
43
  }
44
- yield ((_a = this.bootHandler) === null || _a === void 0 ? void 0 : _a.call(this));
44
+ yield ((_b = this.bootHandler) === null || _b === void 0 ? void 0 : _b.call(this));
45
45
  });
46
46
  }
47
47
  setupContext() {
@@ -80,7 +80,10 @@ export class PermissionFeature {
80
80
  });
81
81
  }
82
82
  destroy() {
83
- return __awaiter(this, void 0, void 0, function* () { });
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ var _a;
85
+ (_a = this.resolvePreReq) === null || _a === void 0 ? void 0 : _a.call(this);
86
+ });
84
87
  }
85
88
  isBooted() {
86
89
  return false;
@@ -4,6 +4,7 @@ export declare class PermissionFeature implements SkillFeature {
4
4
  private skill;
5
5
  private bootHandler?;
6
6
  private log;
7
+ private resolvePreReq?;
7
8
  constructor(skill: Skill);
8
9
  execute(): Promise<void>;
9
10
  private setupContext;
@@ -9,18 +9,18 @@ const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
9
9
  const permissionDiskUtil_1 = __importDefault(require("./utilities/permissionDiskUtil"));
10
10
  class PermissionFeature {
11
11
  constructor(skill) {
12
+ this.resolvePreReq = () => { };
12
13
  this.skill = skill;
13
14
  this.log = skill.buildLog('Permission.Feature');
14
15
  }
15
16
  async execute() {
16
- var _a;
17
+ var _a, _b;
17
18
  const events = this.skill.getFeatureByCode('event');
18
19
  spruce_permission_utils_1.AuthorizerFactory.setConnectToApi(() => events.connectToApi());
19
20
  this.setupContext();
20
21
  if (this.shouldRegisterPermissions()) {
21
- let resolvePreReq = () => { };
22
22
  events.addPreReq(new Promise((r) => {
23
- resolvePreReq = r;
23
+ this.resolvePreReq = r;
24
24
  }));
25
25
  const client = await events.connectToApi();
26
26
  const contracts = this.importContracts();
@@ -34,10 +34,10 @@ class PermissionFeature {
34
34
  this.log.info(`Done syncing permission contracts`);
35
35
  }
36
36
  finally {
37
- resolvePreReq();
37
+ (_a = this.resolvePreReq) === null || _a === void 0 ? void 0 : _a.call(this);
38
38
  }
39
39
  }
40
- await ((_a = this.bootHandler) === null || _a === void 0 ? void 0 : _a.call(this));
40
+ await ((_b = this.bootHandler) === null || _b === void 0 ? void 0 : _b.call(this));
41
41
  }
42
42
  setupContext() {
43
43
  const authorizer = spruce_permission_utils_1.AuthorizerFactory.getInstance();
@@ -70,7 +70,10 @@ class PermissionFeature {
70
70
  const settings = new spruce_skill_utils_1.SettingsService(this.skill.rootDir);
71
71
  return settings.isMarkedAsInstalled('permission');
72
72
  }
73
- async destroy() { }
73
+ async destroy() {
74
+ var _a;
75
+ (_a = this.resolvePreReq) === null || _a === void 0 ? void 0 : _a.call(this);
76
+ }
74
77
  isBooted() {
75
78
  return false;
76
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-permission-plugin",
3
- "version": "31.0.98",
3
+ "version": "31.0.99",
4
4
  "repository": "https://github.com/sprucelabsai-community/spruce-permission-plugin.git",
5
5
  "skill": {
6
6
  "namespace": "spruce-permission-plugin",