@eventcatalog/sdk 0.0.2 → 0.0.4
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/docs.d.mts +1 -0
- package/dist/docs.d.ts +1 -0
- package/dist/docs.js +80 -2
- package/dist/docs.js.map +1 -1
- package/dist/docs.mjs +73 -1
- package/dist/docs.mjs.map +1 -1
- package/dist/events.d.mts +137 -2
- package/dist/events.d.ts +137 -2
- package/dist/events.js.map +1 -1
- package/dist/events.mjs.map +1 -1
- package/dist/index.d.mts +53 -1
- package/dist/index.d.ts +53 -1
- package/dist/index.js +121 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +121 -8
- package/dist/index.mjs.map +1 -1
- package/dist/services.d.mts +133 -0
- package/dist/services.d.ts +133 -0
- package/dist/services.js +173 -0
- package/dist/services.js.map +1 -0
- package/dist/services.mjs +133 -0
- package/dist/services.mjs.map +1 -0
- package/dist/test/events.test.js +147 -33
- package/dist/test/events.test.js.map +1 -1
- package/dist/test/events.test.mjs +149 -35
- package/dist/test/events.test.mjs.map +1 -1
- package/dist/test/services.test.d.mts +2 -0
- package/dist/test/services.test.d.ts +2 -0
- package/dist/test/services.test.js +16888 -0
- package/dist/test/services.test.js.map +1 -0
- package/dist/test/services.test.mjs +16873 -0
- package/dist/test/services.test.mjs.map +1 -0
- package/dist/types.d.d.mts +53 -12
- package/dist/types.d.d.ts +53 -12
- package/dist/types.d.js.map +1 -1
- package/package.json +1 -1
package/dist/test/events.test.js
CHANGED
|
@@ -16066,7 +16066,7 @@ var VitestIndex = /* @__PURE__ */ Object.freeze({
|
|
|
16066
16066
|
var expectTypeOf = dist.expectTypeOf;
|
|
16067
16067
|
|
|
16068
16068
|
// src/index.ts
|
|
16069
|
-
var
|
|
16069
|
+
var import_node_path5 = require("path");
|
|
16070
16070
|
|
|
16071
16071
|
// src/events.ts
|
|
16072
16072
|
var import_gray_matter = __toESM(require("gray-matter"));
|
|
@@ -16197,6 +16197,72 @@ var addSchemaToEvent = (directory) => async (id, schema, version) => {
|
|
|
16197
16197
|
await addFileToEvent(directory)(id, { content: schema.schema, fileName: schema.fileName }, version);
|
|
16198
16198
|
};
|
|
16199
16199
|
|
|
16200
|
+
// src/services.ts
|
|
16201
|
+
var import_gray_matter2 = __toESM(require("gray-matter"));
|
|
16202
|
+
var import_promises3 = __toESM(require("fs/promises"));
|
|
16203
|
+
var import_node_path4 = require("path");
|
|
16204
|
+
var getService = (directory) => async (id, version) => {
|
|
16205
|
+
const file = await findFileById(directory, id, version);
|
|
16206
|
+
if (!file) throw new Error(`No service found for the given id: ${id}` + (version ? ` and version ${version}` : ""));
|
|
16207
|
+
const { data, content } = import_gray_matter2.default.read(file);
|
|
16208
|
+
return {
|
|
16209
|
+
...data,
|
|
16210
|
+
markdown: content.trim()
|
|
16211
|
+
};
|
|
16212
|
+
};
|
|
16213
|
+
var writeService = (directory) => async (service, options = { path: "" }) => {
|
|
16214
|
+
const path3 = options.path || `/${service.id}`;
|
|
16215
|
+
const exists = await versionExists(directory, service.id, service.version);
|
|
16216
|
+
if (exists) {
|
|
16217
|
+
throw new Error(`Failed to write service as the version ${service.version} already exists`);
|
|
16218
|
+
}
|
|
16219
|
+
const { markdown, ...frontmatter } = service;
|
|
16220
|
+
const document = import_gray_matter2.default.stringify(markdown.trim(), frontmatter);
|
|
16221
|
+
await import_promises3.default.mkdir((0, import_node_path4.join)(directory, path3), { recursive: true });
|
|
16222
|
+
await import_promises3.default.writeFile((0, import_node_path4.join)(directory, path3, "index.md"), document);
|
|
16223
|
+
};
|
|
16224
|
+
var versionService = (directory) => async (id) => {
|
|
16225
|
+
const files = await getFiles(`${directory}/**/index.md`);
|
|
16226
|
+
const matchedFiles = await searchFilesForId(files, id);
|
|
16227
|
+
if (matchedFiles.length === 0) {
|
|
16228
|
+
throw new Error(`No service found with id: ${id}`);
|
|
16229
|
+
}
|
|
16230
|
+
const file = matchedFiles[0];
|
|
16231
|
+
const eventDirectory = (0, import_node_path4.dirname)(file);
|
|
16232
|
+
const { data: { version = "0.0.1" } = {} } = import_gray_matter2.default.read(file);
|
|
16233
|
+
const targetDirectory = (0, import_node_path4.join)(eventDirectory, "versioned", version);
|
|
16234
|
+
await import_promises3.default.mkdir(targetDirectory, { recursive: true });
|
|
16235
|
+
await copyDir(directory, eventDirectory, targetDirectory, (src) => {
|
|
16236
|
+
return !src.includes("versioned");
|
|
16237
|
+
});
|
|
16238
|
+
await import_promises3.default.readdir(eventDirectory).then(async (resourceFiles) => {
|
|
16239
|
+
await Promise.all(
|
|
16240
|
+
resourceFiles.map(async (file2) => {
|
|
16241
|
+
if (file2 !== "versioned") {
|
|
16242
|
+
await import_promises3.default.rm((0, import_node_path4.join)(eventDirectory, file2), { recursive: true });
|
|
16243
|
+
}
|
|
16244
|
+
})
|
|
16245
|
+
);
|
|
16246
|
+
});
|
|
16247
|
+
};
|
|
16248
|
+
var rmService = (directory) => async (path3) => {
|
|
16249
|
+
await import_promises3.default.rm((0, import_node_path4.join)(directory, path3), { recursive: true });
|
|
16250
|
+
};
|
|
16251
|
+
var rmServiceById = (directory) => async (id, version) => {
|
|
16252
|
+
const files = await getFiles(`${directory}/**/index.md`);
|
|
16253
|
+
const matchedFiles = await searchFilesForId(files, id, version);
|
|
16254
|
+
if (matchedFiles.length === 0) {
|
|
16255
|
+
throw new Error(`No service found with id: ${id}`);
|
|
16256
|
+
}
|
|
16257
|
+
await Promise.all(matchedFiles.map((file) => import_promises3.default.rm(file)));
|
|
16258
|
+
};
|
|
16259
|
+
var addFileToService = (directory) => async (id, file, version) => {
|
|
16260
|
+
const pathToEvent = await findFileById(directory, id, version);
|
|
16261
|
+
if (!pathToEvent) throw new Error("Cannot find directory to write file to");
|
|
16262
|
+
const contentDirectory = (0, import_node_path4.dirname)(pathToEvent);
|
|
16263
|
+
await import_promises3.default.writeFile((0, import_node_path4.join)(contentDirectory, file.fileName), file.content);
|
|
16264
|
+
};
|
|
16265
|
+
|
|
16200
16266
|
// src/index.ts
|
|
16201
16267
|
var src_default = (path3) => {
|
|
16202
16268
|
return {
|
|
@@ -16206,7 +16272,7 @@ var src_default = (path3) => {
|
|
|
16206
16272
|
* @param version - Optional id of the version to get
|
|
16207
16273
|
* @returns
|
|
16208
16274
|
*/
|
|
16209
|
-
getEvent: getEvent((0,
|
|
16275
|
+
getEvent: getEvent((0, import_node_path5.join)(path3, "events")),
|
|
16210
16276
|
/**
|
|
16211
16277
|
* Adds an event to EventCatalog
|
|
16212
16278
|
*
|
|
@@ -16214,26 +16280,26 @@ var src_default = (path3) => {
|
|
|
16214
16280
|
* @param options - Optional options to write the event
|
|
16215
16281
|
*
|
|
16216
16282
|
*/
|
|
16217
|
-
writeEvent: writeEvent((0,
|
|
16283
|
+
writeEvent: writeEvent((0, import_node_path5.join)(path3, "events")),
|
|
16218
16284
|
/**
|
|
16219
16285
|
* Remove an event to EventCatalog (modeled on the standard POSIX rm utility)
|
|
16220
16286
|
*
|
|
16221
16287
|
* @param path - The path to your event, e.g. `/Inventory/InventoryAdjusted`
|
|
16222
16288
|
*
|
|
16223
16289
|
*/
|
|
16224
|
-
rmEvent: rmEvent((0,
|
|
16290
|
+
rmEvent: rmEvent((0, import_node_path5.join)(path3, "events")),
|
|
16225
16291
|
/**
|
|
16226
16292
|
* Remove an event by an Event id
|
|
16227
16293
|
*
|
|
16228
16294
|
* @param id - The id of the event you want to remove
|
|
16229
16295
|
*
|
|
16230
16296
|
*/
|
|
16231
|
-
rmEventById: rmEventById((0,
|
|
16297
|
+
rmEventById: rmEventById((0, import_node_path5.join)(path3, "events")),
|
|
16232
16298
|
/**
|
|
16233
16299
|
* Moves a given event id to the version directory
|
|
16234
16300
|
* @param directory
|
|
16235
16301
|
*/
|
|
16236
|
-
versionEvent: versionEvent((0,
|
|
16302
|
+
versionEvent: versionEvent((0, import_node_path5.join)(path3, "events")),
|
|
16237
16303
|
/**
|
|
16238
16304
|
* Adds a file to the given event
|
|
16239
16305
|
* @param id - The id of the event to add the file to
|
|
@@ -16241,7 +16307,7 @@ var src_default = (path3) => {
|
|
|
16241
16307
|
* @param version - Optional version of the event to add the file to
|
|
16242
16308
|
* @returns
|
|
16243
16309
|
*/
|
|
16244
|
-
addFileToEvent: addFileToEvent((0,
|
|
16310
|
+
addFileToEvent: addFileToEvent((0, import_node_path5.join)(path3, "events")),
|
|
16245
16311
|
/**
|
|
16246
16312
|
* Adds a schema to the given event
|
|
16247
16313
|
* @param id - The id of the event to add the schema to
|
|
@@ -16249,20 +16315,68 @@ var src_default = (path3) => {
|
|
|
16249
16315
|
* @param version - Optional version of the event to add the schema to
|
|
16250
16316
|
* @returns
|
|
16251
16317
|
*/
|
|
16252
|
-
addSchemaToEvent: addSchemaToEvent((0,
|
|
16318
|
+
addSchemaToEvent: addSchemaToEvent((0, import_node_path5.join)(path3, "events")),
|
|
16319
|
+
/**
|
|
16320
|
+
* ================================
|
|
16321
|
+
* SERVICES
|
|
16322
|
+
* ================================
|
|
16323
|
+
*/
|
|
16324
|
+
/**
|
|
16325
|
+
* Adds a service to EventCatalog
|
|
16326
|
+
*
|
|
16327
|
+
* @param service - The service to write
|
|
16328
|
+
* @param options - Optional options to write the event
|
|
16329
|
+
*
|
|
16330
|
+
*/
|
|
16331
|
+
writeService: writeService((0, import_node_path5.join)(path3, "services")),
|
|
16332
|
+
/**
|
|
16333
|
+
* Returns a service from EventCatalog
|
|
16334
|
+
* @param id - The id of the service to retrieve
|
|
16335
|
+
* @param version - Optional id of the version to get
|
|
16336
|
+
* @returns
|
|
16337
|
+
*/
|
|
16338
|
+
getService: getService((0, import_node_path5.join)(path3, "services")),
|
|
16339
|
+
/**
|
|
16340
|
+
* Moves a given service id to the version directory
|
|
16341
|
+
* @param directory
|
|
16342
|
+
*/
|
|
16343
|
+
versionService: versionService((0, import_node_path5.join)(path3, "services")),
|
|
16344
|
+
/**
|
|
16345
|
+
* Remove a service from EventCatalog (modeled on the standard POSIX rm utility)
|
|
16346
|
+
*
|
|
16347
|
+
* @param path - The path to your service, e.g. `/InventoryService`
|
|
16348
|
+
*
|
|
16349
|
+
*/
|
|
16350
|
+
rmService: rmService((0, import_node_path5.join)(path3, "services")),
|
|
16351
|
+
/**
|
|
16352
|
+
* Remove an service by an service id
|
|
16353
|
+
*
|
|
16354
|
+
* @param id - The id of the service you want to remove
|
|
16355
|
+
*
|
|
16356
|
+
*/
|
|
16357
|
+
rmServiceById: rmServiceById((0, import_node_path5.join)(path3, "services")),
|
|
16358
|
+
/**
|
|
16359
|
+
* Adds a file to the given service
|
|
16360
|
+
* @param id - The id of the service to add the file to
|
|
16361
|
+
* @param file - File contents to add including the content and the file name
|
|
16362
|
+
* @param version - Optional version of the service to add the file to
|
|
16363
|
+
* @returns
|
|
16364
|
+
*/
|
|
16365
|
+
addFileToService: addFileToService((0, import_node_path5.join)(path3, "services"))
|
|
16253
16366
|
};
|
|
16254
16367
|
};
|
|
16255
16368
|
|
|
16256
16369
|
// src/test/events.test.ts
|
|
16257
|
-
var
|
|
16370
|
+
var import_node_path6 = __toESM(require("path"));
|
|
16258
16371
|
var import_node_fs = __toESM(require("fs"));
|
|
16259
|
-
var CATALOG_PATH =
|
|
16372
|
+
var CATALOG_PATH = import_node_path6.default.join(__dirname, "catalog-events");
|
|
16260
16373
|
var { writeEvent: writeEvent2, getEvent: getEvent2, rmEvent: rmEvent2, rmEventById: rmEventById2, versionEvent: versionEvent2, addFileToEvent: addFileToEvent2, addSchemaToEvent: addSchemaToEvent2 } = src_default(CATALOG_PATH);
|
|
16261
16374
|
beforeEach(() => {
|
|
16262
16375
|
import_node_fs.default.rmSync(CATALOG_PATH, { recursive: true, force: true });
|
|
16263
16376
|
import_node_fs.default.mkdirSync(CATALOG_PATH, { recursive: true });
|
|
16264
16377
|
});
|
|
16265
16378
|
afterEach(() => {
|
|
16379
|
+
import_node_fs.default.rmSync(CATALOG_PATH, { recursive: true, force: true });
|
|
16266
16380
|
});
|
|
16267
16381
|
describe("Events SDK", () => {
|
|
16268
16382
|
describe("getEvent", () => {
|
|
@@ -16334,7 +16448,7 @@ describe("Events SDK", () => {
|
|
|
16334
16448
|
markdown: "# Hello world"
|
|
16335
16449
|
});
|
|
16336
16450
|
const event = await getEvent2("InventoryAdjusted");
|
|
16337
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16451
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(true);
|
|
16338
16452
|
globalExpect(event).toEqual({
|
|
16339
16453
|
id: "InventoryAdjusted",
|
|
16340
16454
|
name: "Inventory Adjusted",
|
|
@@ -16354,7 +16468,7 @@ describe("Events SDK", () => {
|
|
|
16354
16468
|
},
|
|
16355
16469
|
{ path: "/Inventory/InventoryAdjusted" }
|
|
16356
16470
|
);
|
|
16357
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16471
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/Inventory/InventoryAdjusted", "index.md"))).toBe(true);
|
|
16358
16472
|
});
|
|
16359
16473
|
it("throws an error when trying to write an event that already exists", async () => {
|
|
16360
16474
|
const createEvent = async () => writeEvent2({
|
|
@@ -16385,9 +16499,9 @@ describe("Events SDK", () => {
|
|
|
16385
16499
|
summary: "This is a summary",
|
|
16386
16500
|
markdown: "# Hello world"
|
|
16387
16501
|
});
|
|
16388
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16502
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(true);
|
|
16389
16503
|
await rmEvent2("/InventoryAdjusted");
|
|
16390
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16504
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(false);
|
|
16391
16505
|
});
|
|
16392
16506
|
});
|
|
16393
16507
|
describe("rmEventById", () => {
|
|
@@ -16399,9 +16513,9 @@ describe("Events SDK", () => {
|
|
|
16399
16513
|
summary: "This is a summary",
|
|
16400
16514
|
markdown: "# Hello world"
|
|
16401
16515
|
});
|
|
16402
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16516
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(true);
|
|
16403
16517
|
await rmEventById2("InventoryAdjusted");
|
|
16404
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16518
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(false);
|
|
16405
16519
|
});
|
|
16406
16520
|
it("removes an event from eventcatalog by id and version", async () => {
|
|
16407
16521
|
await writeEvent2({
|
|
@@ -16411,9 +16525,9 @@ describe("Events SDK", () => {
|
|
|
16411
16525
|
summary: "This is a summary",
|
|
16412
16526
|
markdown: "# Hello world"
|
|
16413
16527
|
});
|
|
16414
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16528
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(true);
|
|
16415
16529
|
await rmEventById2("InventoryAdjusted", "0.0.1");
|
|
16416
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16530
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(false);
|
|
16417
16531
|
});
|
|
16418
16532
|
it("if version is given, only removes that version and not any other versions of the event", async () => {
|
|
16419
16533
|
await writeEvent2({
|
|
@@ -16431,11 +16545,11 @@ describe("Events SDK", () => {
|
|
|
16431
16545
|
summary: "This is a summary",
|
|
16432
16546
|
markdown: "# Hello world"
|
|
16433
16547
|
});
|
|
16434
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16435
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16548
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(true);
|
|
16549
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted/versioned/0.0.1", "index.md"))).toBe(true);
|
|
16436
16550
|
await rmEventById2("InventoryAdjusted", "0.0.1");
|
|
16437
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16438
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16551
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(true);
|
|
16552
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted/versioned/0.0.2", "index.md"))).toBe(false);
|
|
16439
16553
|
});
|
|
16440
16554
|
});
|
|
16441
16555
|
describe("versionEvent", () => {
|
|
@@ -16448,8 +16562,8 @@ describe("Events SDK", () => {
|
|
|
16448
16562
|
markdown: "# Hello world"
|
|
16449
16563
|
});
|
|
16450
16564
|
await versionEvent2("InventoryAdjusted");
|
|
16451
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16452
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16565
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted/versioned/0.0.2", "index.md"))).toBe(true);
|
|
16566
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(false);
|
|
16453
16567
|
});
|
|
16454
16568
|
it("adds the given event to the versioned directory and all files that are associated to it", async () => {
|
|
16455
16569
|
await writeEvent2({
|
|
@@ -16459,12 +16573,12 @@ describe("Events SDK", () => {
|
|
|
16459
16573
|
summary: "This is a summary",
|
|
16460
16574
|
markdown: "# Hello world"
|
|
16461
16575
|
});
|
|
16462
|
-
await import_node_fs.default.writeFileSync(
|
|
16576
|
+
await import_node_fs.default.writeFileSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "schema.json"), "SCHEMA!");
|
|
16463
16577
|
await versionEvent2("InventoryAdjusted");
|
|
16464
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16465
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16466
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16467
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16578
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted/versioned/0.0.2", "index.md"))).toBe(true);
|
|
16579
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted/versioned/0.0.2", "schema.json"))).toBe(true);
|
|
16580
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "index.md"))).toBe(false);
|
|
16581
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "schema.json"))).toBe(false);
|
|
16468
16582
|
});
|
|
16469
16583
|
});
|
|
16470
16584
|
describe("addFileToEvent", () => {
|
|
@@ -16478,7 +16592,7 @@ describe("Events SDK", () => {
|
|
|
16478
16592
|
markdown: "# Hello world"
|
|
16479
16593
|
});
|
|
16480
16594
|
await addFileToEvent2("InventoryAdjusted", file);
|
|
16481
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16595
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "test.txt"))).toBe(true);
|
|
16482
16596
|
});
|
|
16483
16597
|
it("takes a given file and version and writes the file to the correct location", async () => {
|
|
16484
16598
|
const file = { content: "hello", fileName: "test.txt" };
|
|
@@ -16491,7 +16605,7 @@ describe("Events SDK", () => {
|
|
|
16491
16605
|
});
|
|
16492
16606
|
await versionEvent2("InventoryAdjusted");
|
|
16493
16607
|
await addFileToEvent2("InventoryAdjusted", file, "0.0.1");
|
|
16494
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16608
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted/versioned/0.0.1", "test.txt"))).toBe(true);
|
|
16495
16609
|
});
|
|
16496
16610
|
it("throws an error when trying to write to a event that does not exist", () => {
|
|
16497
16611
|
const file = { content: "hello", fileName: "test.txt" };
|
|
@@ -16520,7 +16634,7 @@ describe("Events SDK", () => {
|
|
|
16520
16634
|
markdown: "# Hello world"
|
|
16521
16635
|
});
|
|
16522
16636
|
await addSchemaToEvent2("InventoryAdjusted", file);
|
|
16523
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16637
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted", "schema.json"))).toBe(true);
|
|
16524
16638
|
});
|
|
16525
16639
|
it("takes a given file and version and writes the file to the correct location", async () => {
|
|
16526
16640
|
const schema = `{
|
|
@@ -16544,7 +16658,7 @@ describe("Events SDK", () => {
|
|
|
16544
16658
|
});
|
|
16545
16659
|
await versionEvent2("InventoryAdjusted");
|
|
16546
16660
|
await addSchemaToEvent2("InventoryAdjusted", file, "0.0.1");
|
|
16547
|
-
globalExpect(import_node_fs.default.existsSync(
|
|
16661
|
+
globalExpect(import_node_fs.default.existsSync(import_node_path6.default.join(CATALOG_PATH, "events/InventoryAdjusted/versioned/0.0.1", "schema.json"))).toBe(true);
|
|
16548
16662
|
});
|
|
16549
16663
|
it("throws an error when trying to write to a event that does not exist", () => {
|
|
16550
16664
|
const file = { schema: "hello", fileName: "test.txt" };
|