lib: remove unused event creation functions (#277)
This commit removes two functions that are not used. Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
parent
3d82fb6291
commit
a86cedcafa
|
@ -1,9 +1,7 @@
|
|||
import Ajv from "ajv";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { ValidationError, isBase64 } from "./validation";
|
||||
|
||||
import { CloudEvent } from "./cloudevent";
|
||||
import { CloudEventV1, CloudEventV1Attributes, CloudEventV03, CloudEventV03Attributes } from "./interfaces";
|
||||
import { CloudEventV1, CloudEventV03 } from "./interfaces";
|
||||
import { schemaV03, schemaV1 } from "./schemas";
|
||||
import CONSTANTS from "../constants";
|
||||
|
||||
|
@ -11,16 +9,6 @@ const ajv = new Ajv({ extendRefs: true });
|
|||
const isValidAgainstSchemaV1 = ajv.compile(schemaV1);
|
||||
const isValidAgainstSchemaV03 = ajv.compile(schemaV03);
|
||||
|
||||
export function createV1(attributes: CloudEventV1Attributes): CloudEventV1 {
|
||||
const event: CloudEventV1 = {
|
||||
specversion: schemaV1.definitions.specversion.const,
|
||||
id: uuidv4(),
|
||||
time: new Date().toISOString(),
|
||||
...attributes,
|
||||
};
|
||||
return new CloudEvent(event);
|
||||
}
|
||||
|
||||
export function validateV1(event: CloudEventV1): boolean {
|
||||
if (!isValidAgainstSchemaV1(event)) {
|
||||
throw new ValidationError("invalid payload", isValidAgainstSchemaV1.errors);
|
||||
|
@ -28,16 +16,6 @@ export function validateV1(event: CloudEventV1): boolean {
|
|||
return true;
|
||||
}
|
||||
|
||||
export function createV03(attributes: CloudEventV03Attributes): CloudEventV03 {
|
||||
const event: CloudEventV03 = {
|
||||
specversion: schemaV03.definitions.specversion.const,
|
||||
id: uuidv4(),
|
||||
time: new Date().toISOString(),
|
||||
...attributes,
|
||||
};
|
||||
return new CloudEvent(event);
|
||||
}
|
||||
|
||||
export function validateV03(event: CloudEventV03): boolean {
|
||||
if (!isValidAgainstSchemaV03(event)) {
|
||||
throw new ValidationError("invalid payload", isValidAgainstSchemaV03.errors);
|
||||
|
|
Loading…
Reference in New Issue