@sprucelabs/spruce-event-plugin 77.0.10 → 77.0.12
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.
|
@@ -7,6 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { createRequire } from 'module';
|
|
11
|
+
import { MercuryClientFactory } from '@sprucelabs/mercury-client';
|
|
10
12
|
import { SchemaError } from '@sprucelabs/schema';
|
|
11
13
|
import { eventContractUtil, eventDiskUtil, eventNameUtil, } from '@sprucelabs/spruce-event-utils';
|
|
12
14
|
import { SettingsService, diskUtil, HASH_SPRUCE_DIR_NAME, } from '@sprucelabs/spruce-skill-utils';
|
|
@@ -15,6 +17,7 @@ import dotenv from 'dotenv';
|
|
|
15
17
|
import ListenerCacher from '../cache/ListenerCacher.js';
|
|
16
18
|
import SpruceError from '../errors/SpruceError.js';
|
|
17
19
|
dotenv.config({ quiet: true });
|
|
20
|
+
const requireCompat = createRequire(process.cwd() + '/');
|
|
18
21
|
export class EventFeaturePlugin {
|
|
19
22
|
get settings() {
|
|
20
23
|
if (!this._settings) {
|
|
@@ -249,9 +252,8 @@ export class EventFeaturePlugin {
|
|
|
249
252
|
const contracts = this.shouldConnectToApi() &&
|
|
250
253
|
EventFeaturePlugin.shouldPassEventContractsToMercury &&
|
|
251
254
|
this.combinedContractsFile
|
|
252
|
-
?
|
|
255
|
+
? requireCompat(this.combinedContractsFile).default
|
|
253
256
|
: null;
|
|
254
|
-
const MercuryClientFactory = require('@sprucelabs/mercury-client').MercuryClientFactory;
|
|
255
257
|
const host = this.getHost();
|
|
256
258
|
if (!host) {
|
|
257
259
|
throw new SchemaError({
|
|
@@ -444,7 +446,7 @@ export class EventFeaturePlugin {
|
|
|
444
446
|
loadContracts() {
|
|
445
447
|
return __awaiter(this, void 0, void 0, function* () {
|
|
446
448
|
if (this.shouldConnectToApi() && this.combinedContractsFile) {
|
|
447
|
-
const contracts =
|
|
449
|
+
const contracts = requireCompat(this.combinedContractsFile).default;
|
|
448
450
|
this.log.info(`Loading ${contracts.length} contracts.`);
|
|
449
451
|
contracts.forEach((contract) => {
|
|
450
452
|
const named = eventContractUtil.getNamedEventSignatures(contract);
|
|
@@ -492,7 +494,7 @@ export class EventFeaturePlugin {
|
|
|
492
494
|
friendlyMessage: `I could not find your listener map at ${this.listenerLookup}. Try generating one with 'spruce sync.listeners'.`,
|
|
493
495
|
});
|
|
494
496
|
}
|
|
495
|
-
const listeners =
|
|
497
|
+
const listeners = requireCompat(this.listenersPath).default;
|
|
496
498
|
const cacher = new ListenerCacher({
|
|
497
499
|
cwd: this.skill.rootDir,
|
|
498
500
|
listeners,
|
|
@@ -514,7 +516,7 @@ export class EventFeaturePlugin {
|
|
|
514
516
|
}
|
|
515
517
|
getNamespace() {
|
|
516
518
|
return __awaiter(this, void 0, void 0, function* () {
|
|
517
|
-
const pkg =
|
|
519
|
+
const pkg = requireCompat(this.skill.activeDir + '/../package.json');
|
|
518
520
|
return pkg.skill.namespace;
|
|
519
521
|
});
|
|
520
522
|
}
|
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.EventFeaturePlugin = void 0;
|
|
7
|
+
const module_1 = require("module");
|
|
8
|
+
const mercury_client_1 = require("@sprucelabs/mercury-client");
|
|
7
9
|
const schema_1 = require("@sprucelabs/schema");
|
|
8
10
|
const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
|
|
9
11
|
const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
|
|
@@ -12,6 +14,7 @@ const dotenv_1 = __importDefault(require("dotenv"));
|
|
|
12
14
|
const ListenerCacher_1 = __importDefault(require("../cache/ListenerCacher"));
|
|
13
15
|
const SpruceError_1 = __importDefault(require("../errors/SpruceError"));
|
|
14
16
|
dotenv_1.default.config({ quiet: true });
|
|
17
|
+
const requireCompat = (0, module_1.createRequire)(process.cwd() + '/');
|
|
15
18
|
class EventFeaturePlugin {
|
|
16
19
|
get settings() {
|
|
17
20
|
if (!this._settings) {
|
|
@@ -230,9 +233,8 @@ class EventFeaturePlugin {
|
|
|
230
233
|
const contracts = this.shouldConnectToApi() &&
|
|
231
234
|
EventFeaturePlugin.shouldPassEventContractsToMercury &&
|
|
232
235
|
this.combinedContractsFile
|
|
233
|
-
?
|
|
236
|
+
? requireCompat(this.combinedContractsFile).default
|
|
234
237
|
: null;
|
|
235
|
-
const MercuryClientFactory = require('@sprucelabs/mercury-client').MercuryClientFactory;
|
|
236
238
|
const host = this.getHost();
|
|
237
239
|
if (!host) {
|
|
238
240
|
throw new schema_1.SchemaError({
|
|
@@ -242,7 +244,7 @@ class EventFeaturePlugin {
|
|
|
242
244
|
});
|
|
243
245
|
}
|
|
244
246
|
this.log.info('Connecting to Mercury at', host ?? 'Production');
|
|
245
|
-
this.apiClientPromise = this.connectAndAuthenticate(MercuryClientFactory, host, contracts);
|
|
247
|
+
this.apiClientPromise = this.connectAndAuthenticate(mercury_client_1.MercuryClientFactory, host, contracts);
|
|
246
248
|
const { client } = await this.apiClientPromise;
|
|
247
249
|
return client;
|
|
248
250
|
}
|
|
@@ -413,7 +415,7 @@ class EventFeaturePlugin {
|
|
|
413
415
|
}
|
|
414
416
|
async loadContracts() {
|
|
415
417
|
if (this.shouldConnectToApi() && this.combinedContractsFile) {
|
|
416
|
-
const contracts =
|
|
418
|
+
const contracts = requireCompat(this.combinedContractsFile).default;
|
|
417
419
|
this.log.info(`Loading ${contracts.length} contracts.`);
|
|
418
420
|
contracts.forEach((contract) => {
|
|
419
421
|
const named = spruce_event_utils_1.eventContractUtil.getNamedEventSignatures(contract);
|
|
@@ -456,7 +458,7 @@ class EventFeaturePlugin {
|
|
|
456
458
|
friendlyMessage: `I could not find your listener map at ${this.listenerLookup}. Try generating one with 'spruce sync.listeners'.`,
|
|
457
459
|
});
|
|
458
460
|
}
|
|
459
|
-
const listeners =
|
|
461
|
+
const listeners = requireCompat(this.listenersPath).default;
|
|
460
462
|
const cacher = new ListenerCacher_1.default({
|
|
461
463
|
cwd: this.skill.rootDir,
|
|
462
464
|
listeners,
|
|
@@ -476,7 +478,7 @@ class EventFeaturePlugin {
|
|
|
476
478
|
return process.env.HOST;
|
|
477
479
|
}
|
|
478
480
|
async getNamespace() {
|
|
479
|
-
const pkg =
|
|
481
|
+
const pkg = requireCompat(this.skill.activeDir + '/../package.json');
|
|
480
482
|
return pkg.skill.namespace;
|
|
481
483
|
}
|
|
482
484
|
async loadEvents() {
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@sprucelabs/spruce-test-fixtures"
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
|
-
"version": "77.0.
|
|
13
|
+
"version": "77.0.12",
|
|
14
14
|
"files": [
|
|
15
15
|
"build/**/*",
|
|
16
16
|
"!build/__tests__",
|
|
@@ -70,28 +70,28 @@
|
|
|
70
70
|
"lint.tsc": "tsc -p . --noEmit"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@sprucelabs/error": "^8.1.
|
|
74
|
-
"@sprucelabs/mercury-types": "^49.1.
|
|
75
|
-
"@sprucelabs/schema": "^33.2.
|
|
76
|
-
"@sprucelabs/spruce-core-schemas": "^42.1.
|
|
77
|
-
"@sprucelabs/spruce-event-utils": "^43.0.
|
|
78
|
-
"@sprucelabs/spruce-skill-booter": "^77.0.
|
|
79
|
-
"@sprucelabs/spruce-skill-utils": "^34.0.
|
|
80
|
-
"@sprucelabs/spruce-test-fixtures": "^77.0.
|
|
73
|
+
"@sprucelabs/error": "^8.1.12",
|
|
74
|
+
"@sprucelabs/mercury-types": "^49.1.12",
|
|
75
|
+
"@sprucelabs/schema": "^33.2.9",
|
|
76
|
+
"@sprucelabs/spruce-core-schemas": "^42.1.14",
|
|
77
|
+
"@sprucelabs/spruce-event-utils": "^43.0.11",
|
|
78
|
+
"@sprucelabs/spruce-skill-booter": "^77.0.12",
|
|
79
|
+
"@sprucelabs/spruce-skill-utils": "^34.0.18",
|
|
80
|
+
"@sprucelabs/spruce-test-fixtures": "^77.0.12"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@sprucelabs/esm-postbuild": "^9.0.
|
|
84
|
-
"@sprucelabs/jest-json-reporter": "^10.0.
|
|
85
|
-
"@sprucelabs/mercury-client": "^46.1.
|
|
86
|
-
"@sprucelabs/mercury-core-events": "^29.1.
|
|
87
|
-
"@sprucelabs/resolve-path-aliases": "^4.0.
|
|
83
|
+
"@sprucelabs/esm-postbuild": "^9.0.20",
|
|
84
|
+
"@sprucelabs/jest-json-reporter": "^10.0.28",
|
|
85
|
+
"@sprucelabs/mercury-client": "^46.1.10",
|
|
86
|
+
"@sprucelabs/mercury-core-events": "^29.1.12",
|
|
87
|
+
"@sprucelabs/resolve-path-aliases": "^4.0.20",
|
|
88
88
|
"@sprucelabs/semantic-release": "^6.0.0",
|
|
89
|
-
"@sprucelabs/test": "^11.1.
|
|
90
|
-
"@sprucelabs/test-utils": "^7.2.
|
|
89
|
+
"@sprucelabs/test": "^11.1.6",
|
|
90
|
+
"@sprucelabs/test-utils": "^7.2.15",
|
|
91
91
|
"chokidar-cli": "^3.0.0",
|
|
92
92
|
"dotenv": "^17.3.1",
|
|
93
|
-
"eslint": "^10.0.
|
|
94
|
-
"eslint-config-spruce": "^11.2.
|
|
93
|
+
"eslint": "^10.0.2",
|
|
94
|
+
"eslint-config-spruce": "^11.2.35",
|
|
95
95
|
"jest": "^30.2.0",
|
|
96
96
|
"jest-circus": "^30.2.0",
|
|
97
97
|
"prettier": "^3.8.1",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "e92eb64ed2d743f23be8537f63512d7227e6ce48"
|
|
121
121
|
}
|