@acmekit/test-utils 2.13.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/dist/acmekit-test-runner-utils/bootstrap-app.d.ts +10 -0
- package/dist/acmekit-test-runner-utils/bootstrap-app.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/bootstrap-app.js +113 -0
- package/dist/acmekit-test-runner-utils/bootstrap-app.js.map +1 -0
- package/dist/acmekit-test-runner-utils/clear-instances.d.ts +8 -0
- package/dist/acmekit-test-runner-utils/clear-instances.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/clear-instances.js +14 -0
- package/dist/acmekit-test-runner-utils/clear-instances.js.map +1 -0
- package/dist/acmekit-test-runner-utils/config.d.ts +5 -0
- package/dist/acmekit-test-runner-utils/config.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/config.js +37 -0
- package/dist/acmekit-test-runner-utils/config.js.map +1 -0
- package/dist/acmekit-test-runner-utils/index.d.ts +6 -0
- package/dist/acmekit-test-runner-utils/index.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/index.js +22 -0
- package/dist/acmekit-test-runner-utils/index.js.map +1 -0
- package/dist/acmekit-test-runner-utils/use-db.d.ts +15 -0
- package/dist/acmekit-test-runner-utils/use-db.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/use-db.js +55 -0
- package/dist/acmekit-test-runner-utils/use-db.js.map +1 -0
- package/dist/acmekit-test-runner-utils/utils.d.ts +10 -0
- package/dist/acmekit-test-runner-utils/utils.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/utils.js +25 -0
- package/dist/acmekit-test-runner-utils/utils.js.map +1 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.d.ts +9 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.js +34 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.js.map +1 -0
- package/dist/acmekit-test-runner.d.ts +52 -0
- package/dist/acmekit-test-runner.d.ts.map +1 -0
- package/dist/acmekit-test-runner.js +272 -0
- package/dist/acmekit-test-runner.js.map +1 -0
- package/dist/database.d.ts +29 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +245 -0
- package/dist/database.js.map +1 -0
- package/dist/events.d.ts +17 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +161 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/init-modules.d.ts +19 -0
- package/dist/init-modules.d.ts.map +1 -0
- package/dist/init-modules.js +47 -0
- package/dist/init-modules.js.map +1 -0
- package/dist/jest.d.ts +2 -0
- package/dist/jest.d.ts.map +1 -0
- package/dist/jest.js +24 -0
- package/dist/jest.js.map +1 -0
- package/dist/mock-event-bus-service.d.ts +9 -0
- package/dist/mock-event-bus-service.d.ts.map +1 -0
- package/dist/mock-event-bus-service.js +19 -0
- package/dist/mock-event-bus-service.js.map +1 -0
- package/dist/module-test-runner.d.ts +44 -0
- package/dist/module-test-runner.d.ts.map +1 -0
- package/dist/module-test-runner.js +297 -0
- package/dist/module-test-runner.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
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
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.moduleIntegrationTestRunner = moduleIntegrationTestRunner;
|
|
40
|
+
const logger_1 = require("@acmekit/framework/logger");
|
|
41
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const database_1 = require("./database");
|
|
44
|
+
const init_modules_1 = require("./init-modules");
|
|
45
|
+
const mock_event_bus_service_1 = __importDefault(require("./mock-event-bus-service"));
|
|
46
|
+
const ulid_1 = require("ulid");
|
|
47
|
+
function createMikroOrmWrapper(options) {
|
|
48
|
+
let moduleModels = options.moduleModels ?? [];
|
|
49
|
+
if (!options.moduleModels) {
|
|
50
|
+
const basePath = (0, utils_1.normalizeImportPathWithSource)(options.resolve ?? options.cwd ?? process.cwd());
|
|
51
|
+
const modelsPath = fs.existsSync(`${basePath}/dist/models`)
|
|
52
|
+
? "/dist/models"
|
|
53
|
+
: fs.existsSync(`${basePath}/models`)
|
|
54
|
+
? "/models"
|
|
55
|
+
: "";
|
|
56
|
+
if (modelsPath) {
|
|
57
|
+
moduleModels = (0, utils_1.loadModels)(`${basePath}${modelsPath}`);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
moduleModels = [];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
moduleModels = (0, utils_1.toMikroOrmEntities)(moduleModels);
|
|
64
|
+
const MikroOrmWrapper = (0, database_1.getMikroOrmWrapper)({
|
|
65
|
+
mikroOrmEntities: moduleModels,
|
|
66
|
+
clientUrl: options.dbConfig.clientUrl,
|
|
67
|
+
schema: options.dbConfig.schema,
|
|
68
|
+
});
|
|
69
|
+
return { MikroOrmWrapper, models: moduleModels };
|
|
70
|
+
}
|
|
71
|
+
class ModuleTestRunner {
|
|
72
|
+
constructor(config) {
|
|
73
|
+
this.hooks = {};
|
|
74
|
+
this.connection = null;
|
|
75
|
+
this.moduleModels = [];
|
|
76
|
+
this.modulesConfig = {};
|
|
77
|
+
this.shutdown = async () => void 0;
|
|
78
|
+
this.moduleService = null;
|
|
79
|
+
this.acmekitApp = {};
|
|
80
|
+
const tempName = parseInt(process.env.JEST_WORKER_ID || "1");
|
|
81
|
+
this.moduleName = config.moduleName;
|
|
82
|
+
const moduleName = this.moduleName ?? (0, ulid_1.ulid)();
|
|
83
|
+
this.dbName =
|
|
84
|
+
config.dbName ??
|
|
85
|
+
`acmekit-${moduleName.toLowerCase()}-integration-${tempName}`;
|
|
86
|
+
this.schema = config.schema ?? "public";
|
|
87
|
+
this.debug = config.debug ?? false;
|
|
88
|
+
this.resolve = config.resolve;
|
|
89
|
+
this.cwd = config.cwd;
|
|
90
|
+
this.moduleOptions = config.moduleOptions ?? {};
|
|
91
|
+
this.moduleDependencies = config.moduleDependencies;
|
|
92
|
+
this.joinerConfig = config.joinerConfig ?? [];
|
|
93
|
+
this.injectedDependencies = config.injectedDependencies ?? {};
|
|
94
|
+
this.hooks = config.hooks ?? {};
|
|
95
|
+
this.dbConfig = {
|
|
96
|
+
clientUrl: (0, database_1.getDatabaseURL)(this.dbName),
|
|
97
|
+
schema: this.schema,
|
|
98
|
+
debug: this.debug,
|
|
99
|
+
};
|
|
100
|
+
this.setupProcessHandlers();
|
|
101
|
+
this.initializeConfig(config.moduleModels);
|
|
102
|
+
}
|
|
103
|
+
setupProcessHandlers() {
|
|
104
|
+
process.on("SIGTERM", async () => {
|
|
105
|
+
await this.cleanup();
|
|
106
|
+
process.exit(0);
|
|
107
|
+
});
|
|
108
|
+
process.on("SIGINT", async () => {
|
|
109
|
+
await this.cleanup();
|
|
110
|
+
process.exit(0);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
initializeConfig(moduleModels) {
|
|
114
|
+
const moduleSdkImports = require("@acmekit/framework/modules-sdk");
|
|
115
|
+
// Use a unique connection for all the entire suite
|
|
116
|
+
this.connection = utils_1.ModulesSdkUtils.createPgConnection(this.dbConfig);
|
|
117
|
+
const { MikroOrmWrapper, models } = createMikroOrmWrapper({
|
|
118
|
+
moduleModels,
|
|
119
|
+
resolve: this.resolve,
|
|
120
|
+
dbConfig: this.dbConfig,
|
|
121
|
+
cwd: this.cwd,
|
|
122
|
+
});
|
|
123
|
+
this.MikroOrmWrapper = MikroOrmWrapper;
|
|
124
|
+
this.moduleModels = models;
|
|
125
|
+
this.modulesConfig = {
|
|
126
|
+
[this.moduleName]: {
|
|
127
|
+
definition: moduleSdkImports.ModulesDefinition[this.moduleName],
|
|
128
|
+
resolve: this.resolve,
|
|
129
|
+
dependencies: this.moduleDependencies,
|
|
130
|
+
options: {
|
|
131
|
+
database: this.dbConfig,
|
|
132
|
+
...this.moduleOptions,
|
|
133
|
+
[utils_1.isSharedConnectionSymbol]: true,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
this.moduleOptionsConfig = {
|
|
138
|
+
injectedDependencies: {
|
|
139
|
+
[utils_1.ContainerRegistrationKeys.PG_CONNECTION]: this.connection,
|
|
140
|
+
[utils_1.Modules.EVENT_BUS]: new mock_event_bus_service_1.default(),
|
|
141
|
+
[utils_1.ContainerRegistrationKeys.LOGGER]: console,
|
|
142
|
+
[utils_1.ContainerRegistrationKeys.CONFIG_MODULE]: {
|
|
143
|
+
modules: this.modulesConfig,
|
|
144
|
+
},
|
|
145
|
+
...this.injectedDependencies,
|
|
146
|
+
},
|
|
147
|
+
modulesConfig: this.modulesConfig,
|
|
148
|
+
databaseConfig: this.dbConfig,
|
|
149
|
+
joinerConfig: this.joinerConfig,
|
|
150
|
+
preventConnectionDestroyWarning: true,
|
|
151
|
+
cwd: this.cwd,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
createAcmeKitAppProxy() {
|
|
155
|
+
return new Proxy({}, {
|
|
156
|
+
get: (target, prop) => {
|
|
157
|
+
return this.acmekitApp?.[prop];
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
createServiceProxy() {
|
|
162
|
+
return new Proxy({}, {
|
|
163
|
+
get: (target, prop) => {
|
|
164
|
+
return this.moduleService?.[prop];
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async beforeAll() {
|
|
169
|
+
try {
|
|
170
|
+
this.setupProcessHandlers();
|
|
171
|
+
process.env.LOG_LEVEL = "error";
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
await this.cleanup();
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async beforeEach() {
|
|
179
|
+
try {
|
|
180
|
+
if (this.moduleModels.length) {
|
|
181
|
+
await this.MikroOrmWrapper.setupDatabase();
|
|
182
|
+
}
|
|
183
|
+
if (this.hooks?.beforeModuleInit) {
|
|
184
|
+
await this.hooks.beforeModuleInit();
|
|
185
|
+
}
|
|
186
|
+
const output = await (0, init_modules_1.initModules)(this.moduleOptionsConfig);
|
|
187
|
+
this.shutdown = output.shutdown;
|
|
188
|
+
this.acmekitApp = output.acmekitApp;
|
|
189
|
+
this.moduleService = output.acmekitApp.modules[this.moduleName];
|
|
190
|
+
if (this.hooks?.afterModuleInit) {
|
|
191
|
+
await this.hooks.afterModuleInit(this.acmekitApp, this.moduleService);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
logger_1.logger.error("Error in beforeEach:", error?.message);
|
|
196
|
+
await this.cleanup();
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async afterEach() {
|
|
201
|
+
try {
|
|
202
|
+
if (this.moduleModels.length) {
|
|
203
|
+
await this.MikroOrmWrapper.clearDatabase();
|
|
204
|
+
}
|
|
205
|
+
await this.shutdown();
|
|
206
|
+
this.moduleService = {};
|
|
207
|
+
this.acmekitApp = {};
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
logger_1.logger.error("Error in afterEach:", error?.message);
|
|
211
|
+
throw error;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async cleanup() {
|
|
215
|
+
try {
|
|
216
|
+
process.removeAllListeners("SIGTERM");
|
|
217
|
+
process.removeAllListeners("SIGINT");
|
|
218
|
+
await this.connection?.context?.destroy();
|
|
219
|
+
await this.connection?.destroy();
|
|
220
|
+
this.moduleService = null;
|
|
221
|
+
this.acmekitApp = null;
|
|
222
|
+
this.connection = null;
|
|
223
|
+
if (global.gc) {
|
|
224
|
+
global.gc();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
logger_1.logger.error("Error during cleanup:", error?.message);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
getOptions() {
|
|
232
|
+
return {
|
|
233
|
+
MikroOrmWrapper: this.MikroOrmWrapper,
|
|
234
|
+
acmekitApp: this.createAcmeKitAppProxy(),
|
|
235
|
+
service: this.createServiceProxy(),
|
|
236
|
+
dbConfig: {
|
|
237
|
+
schema: this.schema,
|
|
238
|
+
clientUrl: this.dbConfig.clientUrl,
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function moduleIntegrationTestRunner({ moduleName, moduleModels, moduleOptions = {}, moduleDependencies, joinerConfig = [], schema = "public", dbName, debug = false, testSuite, resolve, injectedDependencies = {}, cwd, hooks, }) {
|
|
244
|
+
const runner = new ModuleTestRunner({
|
|
245
|
+
moduleName,
|
|
246
|
+
moduleModels,
|
|
247
|
+
moduleOptions,
|
|
248
|
+
moduleDependencies,
|
|
249
|
+
joinerConfig,
|
|
250
|
+
schema,
|
|
251
|
+
dbName,
|
|
252
|
+
debug,
|
|
253
|
+
resolve,
|
|
254
|
+
injectedDependencies,
|
|
255
|
+
cwd,
|
|
256
|
+
hooks,
|
|
257
|
+
});
|
|
258
|
+
return describe("", () => {
|
|
259
|
+
let testOptions;
|
|
260
|
+
beforeAll(async () => {
|
|
261
|
+
await runner.beforeAll();
|
|
262
|
+
testOptions = runner.getOptions();
|
|
263
|
+
});
|
|
264
|
+
beforeEach(async () => {
|
|
265
|
+
await runner.beforeEach();
|
|
266
|
+
});
|
|
267
|
+
afterEach(async () => {
|
|
268
|
+
await runner.afterEach();
|
|
269
|
+
});
|
|
270
|
+
afterAll(async () => {
|
|
271
|
+
// Run main cleanup
|
|
272
|
+
await runner.cleanup();
|
|
273
|
+
// Clean references to the test options
|
|
274
|
+
for (const key in testOptions) {
|
|
275
|
+
if (typeof testOptions[key] === "function") {
|
|
276
|
+
testOptions[key] = null;
|
|
277
|
+
}
|
|
278
|
+
else if (typeof testOptions[key] === "object" &&
|
|
279
|
+
testOptions[key] !== null) {
|
|
280
|
+
Object.keys(testOptions[key]).forEach((k) => {
|
|
281
|
+
testOptions[key][k] = null;
|
|
282
|
+
});
|
|
283
|
+
testOptions[key] = null;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// Encourage garbage collection
|
|
287
|
+
// @ts-ignore
|
|
288
|
+
testOptions = null;
|
|
289
|
+
if (global.gc) {
|
|
290
|
+
global.gc();
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
// Run test suite with options
|
|
294
|
+
testSuite(runner.getOptions());
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=module-test-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-test-runner.js","sourceRoot":"","sources":["../src/module-test-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgTA,kEA2FC;AA3YD,sDAAkD;AAClD,oDASiC;AACjC,uCAAwB;AACxB,yCAA6E;AAC7E,iDAAgE;AAChE,sFAAyE;AACzE,+BAA2B;AA8B3B,SAAS,qBAAqB,CAAC,OAK9B;IAIC,IAAI,YAAY,GACd,OAAO,CAAC,YAAY,IAAI,EAAE,CAAA;IAE5B,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAA,qCAA6B,EAC5C,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAChD,CAAA;QAED,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,QAAQ,cAAc,CAAC;YACzD,CAAC,CAAC,cAAc;YAChB,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,QAAQ,SAAS,CAAC;gBACrC,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,EAAE,CAAA;QAEN,IAAI,UAAU,EAAE,CAAC;YACf,YAAY,GAAG,IAAA,kBAAU,EAAC,GAAG,QAAQ,GAAG,UAAU,EAAE,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ts","../src/jest.ts","../src/mock-event-bus-service.ts","../src/module-test-runner.ts","../src/__fixtures__/test-module/index.ts","../src/__fixtures__/test-module/service.ts","../src/__fixtures__/test-module/services/internal.ts","../src/__tests__/events.spec.ts","../src/__tests__/module-test-runner.spec.ts","../src/acmekit-test-runner-utils/bootstrap-app.ts","../src/acmekit-test-runner-utils/clear-instances.ts","../src/acmekit-test-runner-utils/config.ts","../src/acmekit-test-runner-utils/index.ts","../src/acmekit-test-runner-utils/use-db.ts","../src/acmekit-test-runner-utils/utils.ts","../src/acmekit-test-runner-utils/wait-workflow-executions.ts"],"version":"5.9.3"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@acmekit/test-utils",
|
|
3
|
+
"version": "2.13.1",
|
|
4
|
+
"description": "Test utils for AcmeKit",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/acmekit/acmekit",
|
|
9
|
+
"directory": "packages/acmekit-test-utils"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=20"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "yarn run -T rimraf dist && yarn run -T tsc --build",
|
|
16
|
+
"watch": "yarn run -T tsc --build --watch",
|
|
17
|
+
"test": "../../node_modules/.bin/jest --passWithNoTests src"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"!dist/**/__tests__",
|
|
22
|
+
"!dist/**/__mocks__",
|
|
23
|
+
"!dist/**/__fixtures__"
|
|
24
|
+
],
|
|
25
|
+
"author": "AcmeKit",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@acmekit/core-flows": "2.13.1",
|
|
29
|
+
"@acmekit/framework": "2.13.1"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@types/express": "^4.17.21",
|
|
33
|
+
"axios": "^1.13.1",
|
|
34
|
+
"express": "^4.21.0",
|
|
35
|
+
"get-port": "^5.1.1",
|
|
36
|
+
"ulid": "^2.3.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@acmekit/acmekit": "2.13.1",
|
|
40
|
+
"@acmekit/core-flows": "2.13.1",
|
|
41
|
+
"@acmekit/framework": "2.13.1"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"@acmekit/acmekit": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"@acmekit/core-flows": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"gitHead": "81a7ff73d012fda722f6e9ef0bd9ba0232d37808"
|
|
52
|
+
}
|