@event-driven-io/emmett 0.43.0-beta.2 → 0.43.0-beta.20

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.
@@ -0,0 +1,131 @@
1
+ //#region src/validation/dates.ts
2
+ const formatDateToUtcYYYYMMDD = (date) => {
3
+ return new Intl.DateTimeFormat("en-CA", {
4
+ timeZone: "UTC",
5
+ year: "numeric",
6
+ month: "2-digit",
7
+ day: "2-digit"
8
+ }).format(date);
9
+ };
10
+ const isValidYYYYMMDD = (dateString) => {
11
+ return /^\d{4}-\d{2}-\d{2}$/.test(dateString);
12
+ };
13
+ const parseDateFromUtcYYYYMMDD = (dateString) => {
14
+ const date = /* @__PURE__ */ new Date(dateString + "T00:00:00Z");
15
+ if (!isValidYYYYMMDD(dateString)) throw new ValidationError("Invalid date format, must be yyyy-mm-dd");
16
+ if (isNaN(date.getTime())) throw new ValidationError("Invalid date format");
17
+ return date;
18
+ };
19
+
20
+ //#endregion
21
+ //#region src/validation/index.ts
22
+ let ValidationErrors = /* @__PURE__ */ function(ValidationErrors) {
23
+ ValidationErrors["NOT_A_NONEMPTY_STRING"] = "NOT_A_NONEMPTY_STRING";
24
+ ValidationErrors["NOT_A_POSITIVE_NUMBER"] = "NOT_A_POSITIVE_NUMBER";
25
+ ValidationErrors["NOT_AN_UNSIGNED_BIGINT"] = "NOT_AN_UNSIGNED_BIGINT";
26
+ return ValidationErrors;
27
+ }({});
28
+ const isNumber = (val) => typeof val === "number" && val === val;
29
+ const isBigint = (val) => typeof val === "bigint" && val === val;
30
+ const isString = (val) => typeof val === "string";
31
+ const assertNotEmptyString = (value) => {
32
+ if (!isString(value) || value.length === 0) throw new ValidationError("NOT_A_NONEMPTY_STRING");
33
+ return value;
34
+ };
35
+ const assertPositiveNumber = (value) => {
36
+ if (!isNumber(value) || value <= 0) throw new ValidationError("NOT_A_POSITIVE_NUMBER");
37
+ return value;
38
+ };
39
+ const assertUnsignedBigInt = (value) => {
40
+ const number = BigInt(value);
41
+ if (number < 0) throw new ValidationError("NOT_AN_UNSIGNED_BIGINT");
42
+ return number;
43
+ };
44
+
45
+ //#endregion
46
+ //#region src/errors/index.ts
47
+ const isErrorConstructor = (expect) => {
48
+ return typeof expect === "function" && expect.prototype && expect.prototype.constructor === expect;
49
+ };
50
+ var EmmettError = class EmmettError extends Error {
51
+ static Codes = {
52
+ ValidationError: 400,
53
+ IllegalStateError: 403,
54
+ NotFoundError: 404,
55
+ ConcurrencyError: 412,
56
+ InternalServerError: 500
57
+ };
58
+ errorCode;
59
+ constructor(options) {
60
+ const errorCode = options && typeof options === "object" && "errorCode" in options ? options.errorCode : isNumber(options) ? options : EmmettError.Codes.InternalServerError;
61
+ const message = options && typeof options === "object" && "message" in options ? options.message : isString(options) ? options : `Error with status code '${errorCode}' ocurred during Emmett processing`;
62
+ super(message);
63
+ this.errorCode = errorCode;
64
+ Object.setPrototypeOf(this, EmmettError.prototype);
65
+ }
66
+ static mapFrom(error) {
67
+ if (EmmettError.isInstanceOf(error)) return error;
68
+ return new EmmettError({
69
+ errorCode: "errorCode" in error && error.errorCode !== void 0 && error.errorCode !== null ? error.errorCode : EmmettError.Codes.InternalServerError,
70
+ message: error.message ?? "An unknown error occurred"
71
+ });
72
+ }
73
+ static isInstanceOf(error, errorCode) {
74
+ return typeof error === "object" && error !== null && "errorCode" in error && isNumber(error.errorCode) && (errorCode === void 0 || error.errorCode === errorCode);
75
+ }
76
+ };
77
+ var ConcurrencyError = class ConcurrencyError extends EmmettError {
78
+ constructor(current, expected, message) {
79
+ super({
80
+ errorCode: EmmettError.Codes.ConcurrencyError,
81
+ message: message ?? `Expected version ${expected.toString()} does not match current ${current?.toString()}`
82
+ });
83
+ this.current = current;
84
+ this.expected = expected;
85
+ Object.setPrototypeOf(this, ConcurrencyError.prototype);
86
+ }
87
+ };
88
+ var ConcurrencyInMemoryDatabaseError = class ConcurrencyInMemoryDatabaseError extends EmmettError {
89
+ constructor(message) {
90
+ super({
91
+ errorCode: EmmettError.Codes.ConcurrencyError,
92
+ message: message ?? `Expected document state does not match current one!`
93
+ });
94
+ Object.setPrototypeOf(this, ConcurrencyInMemoryDatabaseError.prototype);
95
+ }
96
+ };
97
+ var ValidationError = class ValidationError extends EmmettError {
98
+ constructor(message) {
99
+ super({
100
+ errorCode: EmmettError.Codes.ValidationError,
101
+ message: message ?? `Validation Error ocurred during Emmett processing`
102
+ });
103
+ Object.setPrototypeOf(this, ValidationError.prototype);
104
+ }
105
+ };
106
+ var IllegalStateError = class IllegalStateError extends EmmettError {
107
+ constructor(message) {
108
+ super({
109
+ errorCode: EmmettError.Codes.IllegalStateError,
110
+ message: message ?? `Illegal State ocurred during Emmett processing`
111
+ });
112
+ Object.setPrototypeOf(this, IllegalStateError.prototype);
113
+ }
114
+ };
115
+ var NotFoundError = class NotFoundError extends EmmettError {
116
+ constructor(options) {
117
+ super({
118
+ errorCode: EmmettError.Codes.NotFoundError,
119
+ message: options?.message ?? (options?.id ? options.type ? `${options.type} with ${options.id} was not found during Emmett processing` : `State with ${options.id} was not found during Emmett processing` : options?.type ? `${options.type} was not found during Emmett processing` : "State was not found during Emmett processing")
120
+ });
121
+ Object.setPrototypeOf(this, NotFoundError.prototype);
122
+ }
123
+ };
124
+
125
+ //#endregion
126
+ //#region src/config/plugins/index.ts
127
+ const isPluginConfig = (plugin) => plugin !== void 0 && (typeof plugin === "string" || "name" in plugin && plugin.name !== void 0 && typeof plugin.name === "string");
128
+
129
+ //#endregion
130
+ export { isValidYYYYMMDD as _, IllegalStateError as a, isErrorConstructor as c, assertPositiveNumber as d, assertUnsignedBigInt as f, formatDateToUtcYYYYMMDD as g, isString as h, EmmettError as i, ValidationErrors as l, isNumber as m, ConcurrencyError as n, NotFoundError as o, isBigint as p, ConcurrencyInMemoryDatabaseError as r, ValidationError as s, isPluginConfig as t, assertNotEmptyString as u, parseDateFromUtcYYYYMMDD as v };
131
+ //# sourceMappingURL=plugins-DgfqJ5af.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins-DgfqJ5af.js","names":[],"sources":["../src/validation/dates.ts","../src/validation/index.ts","../src/errors/index.ts","../src/config/plugins/index.ts"],"sourcesContent":["import { ValidationError } from '../errors';\n\nexport const formatDateToUtcYYYYMMDD = (date: Date) => {\n // Use the 'en-CA' locale which formats as 'yyyy-mm-dd'\n const formatter = new Intl.DateTimeFormat('en-CA', {\n timeZone: 'UTC',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n });\n\n // Format the date\n return formatter.format(date);\n};\n\n// Function to validate 'yyyy-mm-dd' format\nexport const isValidYYYYMMDD = (dateString: string) => {\n const regex = /^\\d{4}-\\d{2}-\\d{2}$/;\n return regex.test(dateString);\n};\n\nexport const parseDateFromUtcYYYYMMDD = (dateString: string) => {\n const date = new Date(dateString + 'T00:00:00Z');\n\n if (!isValidYYYYMMDD(dateString)) {\n throw new ValidationError('Invalid date format, must be yyyy-mm-dd');\n }\n\n if (isNaN(date.getTime())) {\n throw new ValidationError('Invalid date format');\n }\n\n return date;\n};\n","import { ValidationError } from '../errors';\n\nexport const enum ValidationErrors {\n NOT_A_NONEMPTY_STRING = 'NOT_A_NONEMPTY_STRING',\n NOT_A_POSITIVE_NUMBER = 'NOT_A_POSITIVE_NUMBER',\n NOT_AN_UNSIGNED_BIGINT = 'NOT_AN_UNSIGNED_BIGINT',\n}\n\nexport const isNumber = (val: unknown): val is number =>\n typeof val === 'number' && val === val;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isBigint = (val: any): val is bigint =>\n typeof val === 'bigint' && val === val;\n\nexport const isString = (val: unknown): val is string =>\n typeof val === 'string';\n\nexport const assertNotEmptyString = (value: unknown): string => {\n if (!isString(value) || value.length === 0) {\n throw new ValidationError(ValidationErrors.NOT_A_NONEMPTY_STRING);\n }\n return value;\n};\n\nexport const assertPositiveNumber = (value: unknown): number => {\n if (!isNumber(value) || value <= 0) {\n throw new ValidationError(ValidationErrors.NOT_A_POSITIVE_NUMBER);\n }\n return value;\n};\n\nexport const assertUnsignedBigInt = (value: string): bigint => {\n const number = BigInt(value);\n if (number < 0) {\n throw new ValidationError(ValidationErrors.NOT_AN_UNSIGNED_BIGINT);\n }\n return number;\n};\n\nexport * from './dates';\n","import { isNumber, isString } from '../validation';\n\nexport type ErrorConstructor<ErrorType extends Error> = new (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...args: any[]\n) => ErrorType;\n\nexport const isErrorConstructor = <ErrorType extends Error>(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n expect: Function,\n): expect is ErrorConstructor<ErrorType> => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (\n typeof expect === 'function' &&\n expect.prototype &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n expect.prototype.constructor === expect\n );\n};\n\nexport class EmmettError extends Error {\n public static readonly Codes = {\n ValidationError: 400,\n IllegalStateError: 403,\n NotFoundError: 404,\n ConcurrencyError: 412,\n InternalServerError: 500,\n };\n\n public errorCode: number;\n\n constructor(\n options?: { errorCode: number; message?: string } | string | number,\n ) {\n const errorCode =\n options && typeof options === 'object' && 'errorCode' in options\n ? options.errorCode\n : isNumber(options)\n ? options\n : EmmettError.Codes.InternalServerError;\n const message =\n options && typeof options === 'object' && 'message' in options\n ? options.message\n : isString(options)\n ? options\n : `Error with status code '${errorCode}' ocurred during Emmett processing`;\n\n super(message);\n this.errorCode = errorCode;\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, EmmettError.prototype);\n }\n\n public static mapFrom(\n error: Error | { message?: string; errorCode?: number },\n ): EmmettError {\n if (EmmettError.isInstanceOf(error)) {\n return error;\n }\n\n return new EmmettError({\n errorCode:\n 'errorCode' in error &&\n error.errorCode !== undefined &&\n error.errorCode !== null\n ? error.errorCode\n : EmmettError.Codes.InternalServerError,\n message: error.message ?? 'An unknown error occurred',\n });\n }\n\n public static isInstanceOf<ErrorType extends EmmettError = EmmettError>(\n error: unknown,\n errorCode?: (typeof EmmettError.Codes)[keyof typeof EmmettError.Codes],\n ): error is ErrorType {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'errorCode' in error &&\n isNumber(error.errorCode) &&\n (errorCode === undefined || error.errorCode === errorCode)\n );\n }\n}\n\nexport class ConcurrencyError extends EmmettError {\n constructor(\n public current: string | undefined,\n public expected: string,\n message?: string,\n ) {\n super({\n errorCode: EmmettError.Codes.ConcurrencyError,\n message:\n message ??\n `Expected version ${expected.toString()} does not match current ${current?.toString()}`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ConcurrencyError.prototype);\n }\n}\n\n// TODO: Make it derive from ConcurrencyError to avoid code duplication\n// Or add additional type to distinguinsh both errors\nexport class ConcurrencyInMemoryDatabaseError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: EmmettError.Codes.ConcurrencyError,\n message: message ?? `Expected document state does not match current one!`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ConcurrencyInMemoryDatabaseError.prototype);\n }\n}\n\nexport class ValidationError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: EmmettError.Codes.ValidationError,\n message: message ?? `Validation Error ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport class IllegalStateError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: EmmettError.Codes.IllegalStateError,\n message: message ?? `Illegal State ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, IllegalStateError.prototype);\n }\n}\n\nexport class NotFoundError extends EmmettError {\n constructor(options?: { id: string; type: string; message?: string }) {\n super({\n errorCode: EmmettError.Codes.NotFoundError,\n message:\n options?.message ??\n (options?.id\n ? options.type\n ? `${options.type} with ${options.id} was not found during Emmett processing`\n : `State with ${options.id} was not found during Emmett processing`\n : options?.type\n ? `${options.type} was not found during Emmett processing`\n : 'State was not found during Emmett processing'),\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","export type EmmettPluginConfig =\n | {\n name: string;\n register: EmmettPluginRegistration[];\n }\n | string;\n\nexport type EmmettPluginType = 'cli';\n\nexport type EmmettCliPluginRegistration = { pluginType: 'cli'; path?: string };\n\nexport type EmmettPluginRegistration = EmmettCliPluginRegistration;\n\nexport type EmmettCliCommand = {\n addCommand<CliCommand>(command: CliCommand): CliCommand;\n};\n\nexport type EmmettCliPlugin = {\n pluginType: 'cli';\n name: string;\n registerCommands: (program: EmmettCliCommand) => Promise<void> | void;\n};\n\nexport type EmmettPlugin = EmmettCliPlugin;\n\nexport const isPluginConfig = (\n plugin: Partial<EmmettPluginConfig> | string | undefined,\n): plugin is EmmettPluginConfig =>\n plugin !== undefined &&\n (typeof plugin === 'string' ||\n ('name' in plugin &&\n plugin.name !== undefined &&\n typeof plugin.name === 'string'));\n"],"mappings":";AAEA,MAAa,2BAA2B,SAAe;AAUrD,QAAO,IARe,KAAK,eAAe,SAAS;EACjD,UAAU;EACV,MAAM;EACN,OAAO;EACP,KAAK;EACN,CAGe,CAAC,OAAO,KAAK;;AAI/B,MAAa,mBAAmB,eAAuB;AAErD,QAAO,sBAAM,KAAK,WAAW;;AAG/B,MAAa,4BAA4B,eAAuB;CAC9D,MAAM,uBAAO,IAAI,KAAK,aAAa,aAAa;AAEhD,KAAI,CAAC,gBAAgB,WAAW,CAC9B,OAAM,IAAI,gBAAgB,0CAA0C;AAGtE,KAAI,MAAM,KAAK,SAAS,CAAC,CACvB,OAAM,IAAI,gBAAgB,sBAAsB;AAGlD,QAAO;;;;;AC9BT,IAAkB,mBAAX;AACL;AACA;AACA;;KACD;AAED,MAAa,YAAY,QACvB,OAAO,QAAQ,YAAY,QAAQ;AAGrC,MAAa,YAAY,QACvB,OAAO,QAAQ,YAAY,QAAQ;AAErC,MAAa,YAAY,QACvB,OAAO,QAAQ;AAEjB,MAAa,wBAAwB,UAA2B;AAC9D,KAAI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,YACE,AAAO,SACP,AAAO,UACP,SACA;AACA,QAAM;GACJ,WAAW,YAAY,MAAM;GAC7B,SACE,WACA,oBAAoB,SAAS,UAAU,CAAC,0BAA0B,SAAS,UAAU;GACxF,CAAC;EATK;EACA;AAWP,SAAO,eAAe,MAAM,iBAAiB,UAAU;;;AAM3D,IAAa,mCAAb,MAAa,yCAAyC,YAAY;CAChE,YAAY,SAAkB;AAC5B,QAAM;GACJ,WAAW,YAAY,MAAM;GAC7B,SAAS,WAAW;GACrB,CAAC;AAGF,SAAO,eAAe,MAAM,iCAAiC,UAAU;;;AAI3E,IAAa,kBAAb,MAAa,wBAAwB,YAAY;CAC/C,YAAY,SAAkB;AAC5B,QAAM;GACJ,WAAW,YAAY,MAAM;GAC7B,SAAS,WAAW;GACrB,CAAC;AAGF,SAAO,eAAe,MAAM,gBAAgB,UAAU;;;AAI1D,IAAa,oBAAb,MAAa,0BAA0B,YAAY;CACjD,YAAY,SAAkB;AAC5B,QAAM;GACJ,WAAW,YAAY,MAAM;GAC7B,SAAS,WAAW;GACrB,CAAC;AAGF,SAAO,eAAe,MAAM,kBAAkB,UAAU;;;AAI5D,IAAa,gBAAb,MAAa,sBAAsB,YAAY;CAC7C,YAAY,SAA0D;AACpE,QAAM;GACJ,WAAW,YAAY,MAAM;GAC7B,SACE,SAAS,YACR,SAAS,KACN,QAAQ,OACN,GAAG,QAAQ,KAAK,QAAQ,QAAQ,GAAG,2CACnC,cAAc,QAAQ,GAAG,2CAC3B,SAAS,OACP,GAAG,QAAQ,KAAK,2CAChB;GACT,CAAC;AAGF,SAAO,eAAe,MAAM,cAAc,UAAU;;;;;;ACrIxD,MAAa,kBACX,WAEA,WAAW,WACV,OAAO,WAAW,YAChB,UAAU,UACT,OAAO,SAAS,UAChB,OAAO,OAAO,SAAS"}
@@ -0,0 +1,298 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (!no_symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
19
+ return target;
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
+ key = keys[i];
25
+ if (!__hasOwnProp.call(to, key) && key !== except) {
26
+ __defProp(to, key, {
27
+ get: ((k) => from[k]).bind(null, key),
28
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
+ });
30
+ }
31
+ }
32
+ }
33
+ return to;
34
+ };
35
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
37
+ value: mod,
38
+ enumerable: true
39
+ }) : target, mod));
40
+
41
+ //#endregion
42
+
43
+ //#region src/validation/dates.ts
44
+ const formatDateToUtcYYYYMMDD = (date) => {
45
+ return new Intl.DateTimeFormat("en-CA", {
46
+ timeZone: "UTC",
47
+ year: "numeric",
48
+ month: "2-digit",
49
+ day: "2-digit"
50
+ }).format(date);
51
+ };
52
+ const isValidYYYYMMDD = (dateString) => {
53
+ return /^\d{4}-\d{2}-\d{2}$/.test(dateString);
54
+ };
55
+ const parseDateFromUtcYYYYMMDD = (dateString) => {
56
+ const date = /* @__PURE__ */ new Date(dateString + "T00:00:00Z");
57
+ if (!isValidYYYYMMDD(dateString)) throw new ValidationError("Invalid date format, must be yyyy-mm-dd");
58
+ if (isNaN(date.getTime())) throw new ValidationError("Invalid date format");
59
+ return date;
60
+ };
61
+
62
+ //#endregion
63
+ //#region src/validation/index.ts
64
+ let ValidationErrors = /* @__PURE__ */ function(ValidationErrors) {
65
+ ValidationErrors["NOT_A_NONEMPTY_STRING"] = "NOT_A_NONEMPTY_STRING";
66
+ ValidationErrors["NOT_A_POSITIVE_NUMBER"] = "NOT_A_POSITIVE_NUMBER";
67
+ ValidationErrors["NOT_AN_UNSIGNED_BIGINT"] = "NOT_AN_UNSIGNED_BIGINT";
68
+ return ValidationErrors;
69
+ }({});
70
+ const isNumber = (val) => typeof val === "number" && val === val;
71
+ const isBigint = (val) => typeof val === "bigint" && val === val;
72
+ const isString = (val) => typeof val === "string";
73
+ const assertNotEmptyString = (value) => {
74
+ if (!isString(value) || value.length === 0) throw new ValidationError("NOT_A_NONEMPTY_STRING");
75
+ return value;
76
+ };
77
+ const assertPositiveNumber = (value) => {
78
+ if (!isNumber(value) || value <= 0) throw new ValidationError("NOT_A_POSITIVE_NUMBER");
79
+ return value;
80
+ };
81
+ const assertUnsignedBigInt = (value) => {
82
+ const number = BigInt(value);
83
+ if (number < 0) throw new ValidationError("NOT_AN_UNSIGNED_BIGINT");
84
+ return number;
85
+ };
86
+
87
+ //#endregion
88
+ //#region src/errors/index.ts
89
+ const isErrorConstructor = (expect) => {
90
+ return typeof expect === "function" && expect.prototype && expect.prototype.constructor === expect;
91
+ };
92
+ var EmmettError = class EmmettError extends Error {
93
+ static Codes = {
94
+ ValidationError: 400,
95
+ IllegalStateError: 403,
96
+ NotFoundError: 404,
97
+ ConcurrencyError: 412,
98
+ InternalServerError: 500
99
+ };
100
+ errorCode;
101
+ constructor(options) {
102
+ const errorCode = options && typeof options === "object" && "errorCode" in options ? options.errorCode : isNumber(options) ? options : EmmettError.Codes.InternalServerError;
103
+ const message = options && typeof options === "object" && "message" in options ? options.message : isString(options) ? options : `Error with status code '${errorCode}' ocurred during Emmett processing`;
104
+ super(message);
105
+ this.errorCode = errorCode;
106
+ Object.setPrototypeOf(this, EmmettError.prototype);
107
+ }
108
+ static mapFrom(error) {
109
+ if (EmmettError.isInstanceOf(error)) return error;
110
+ return new EmmettError({
111
+ errorCode: "errorCode" in error && error.errorCode !== void 0 && error.errorCode !== null ? error.errorCode : EmmettError.Codes.InternalServerError,
112
+ message: error.message ?? "An unknown error occurred"
113
+ });
114
+ }
115
+ static isInstanceOf(error, errorCode) {
116
+ return typeof error === "object" && error !== null && "errorCode" in error && isNumber(error.errorCode) && (errorCode === void 0 || error.errorCode === errorCode);
117
+ }
118
+ };
119
+ var ConcurrencyError = class ConcurrencyError extends EmmettError {
120
+ constructor(current, expected, message) {
121
+ super({
122
+ errorCode: EmmettError.Codes.ConcurrencyError,
123
+ message: message ?? `Expected version ${expected.toString()} does not match current ${current?.toString()}`
124
+ });
125
+ this.current = current;
126
+ this.expected = expected;
127
+ Object.setPrototypeOf(this, ConcurrencyError.prototype);
128
+ }
129
+ };
130
+ var ConcurrencyInMemoryDatabaseError = class ConcurrencyInMemoryDatabaseError extends EmmettError {
131
+ constructor(message) {
132
+ super({
133
+ errorCode: EmmettError.Codes.ConcurrencyError,
134
+ message: message ?? `Expected document state does not match current one!`
135
+ });
136
+ Object.setPrototypeOf(this, ConcurrencyInMemoryDatabaseError.prototype);
137
+ }
138
+ };
139
+ var ValidationError = class ValidationError extends EmmettError {
140
+ constructor(message) {
141
+ super({
142
+ errorCode: EmmettError.Codes.ValidationError,
143
+ message: message ?? `Validation Error ocurred during Emmett processing`
144
+ });
145
+ Object.setPrototypeOf(this, ValidationError.prototype);
146
+ }
147
+ };
148
+ var IllegalStateError = class IllegalStateError extends EmmettError {
149
+ constructor(message) {
150
+ super({
151
+ errorCode: EmmettError.Codes.IllegalStateError,
152
+ message: message ?? `Illegal State ocurred during Emmett processing`
153
+ });
154
+ Object.setPrototypeOf(this, IllegalStateError.prototype);
155
+ }
156
+ };
157
+ var NotFoundError = class NotFoundError extends EmmettError {
158
+ constructor(options) {
159
+ super({
160
+ errorCode: EmmettError.Codes.NotFoundError,
161
+ message: options?.message ?? (options?.id ? options.type ? `${options.type} with ${options.id} was not found during Emmett processing` : `State with ${options.id} was not found during Emmett processing` : options?.type ? `${options.type} was not found during Emmett processing` : "State was not found during Emmett processing")
162
+ });
163
+ Object.setPrototypeOf(this, NotFoundError.prototype);
164
+ }
165
+ };
166
+
167
+ //#endregion
168
+ //#region src/config/plugins/index.ts
169
+ const isPluginConfig = (plugin) => plugin !== void 0 && (typeof plugin === "string" || "name" in plugin && plugin.name !== void 0 && typeof plugin.name === "string");
170
+
171
+ //#endregion
172
+ Object.defineProperty(exports, 'ConcurrencyError', {
173
+ enumerable: true,
174
+ get: function () {
175
+ return ConcurrencyError;
176
+ }
177
+ });
178
+ Object.defineProperty(exports, 'ConcurrencyInMemoryDatabaseError', {
179
+ enumerable: true,
180
+ get: function () {
181
+ return ConcurrencyInMemoryDatabaseError;
182
+ }
183
+ });
184
+ Object.defineProperty(exports, 'EmmettError', {
185
+ enumerable: true,
186
+ get: function () {
187
+ return EmmettError;
188
+ }
189
+ });
190
+ Object.defineProperty(exports, 'IllegalStateError', {
191
+ enumerable: true,
192
+ get: function () {
193
+ return IllegalStateError;
194
+ }
195
+ });
196
+ Object.defineProperty(exports, 'NotFoundError', {
197
+ enumerable: true,
198
+ get: function () {
199
+ return NotFoundError;
200
+ }
201
+ });
202
+ Object.defineProperty(exports, 'ValidationError', {
203
+ enumerable: true,
204
+ get: function () {
205
+ return ValidationError;
206
+ }
207
+ });
208
+ Object.defineProperty(exports, 'ValidationErrors', {
209
+ enumerable: true,
210
+ get: function () {
211
+ return ValidationErrors;
212
+ }
213
+ });
214
+ Object.defineProperty(exports, '__exportAll', {
215
+ enumerable: true,
216
+ get: function () {
217
+ return __exportAll;
218
+ }
219
+ });
220
+ Object.defineProperty(exports, '__reExport', {
221
+ enumerable: true,
222
+ get: function () {
223
+ return __reExport;
224
+ }
225
+ });
226
+ Object.defineProperty(exports, '__toESM', {
227
+ enumerable: true,
228
+ get: function () {
229
+ return __toESM;
230
+ }
231
+ });
232
+ Object.defineProperty(exports, 'assertNotEmptyString', {
233
+ enumerable: true,
234
+ get: function () {
235
+ return assertNotEmptyString;
236
+ }
237
+ });
238
+ Object.defineProperty(exports, 'assertPositiveNumber', {
239
+ enumerable: true,
240
+ get: function () {
241
+ return assertPositiveNumber;
242
+ }
243
+ });
244
+ Object.defineProperty(exports, 'assertUnsignedBigInt', {
245
+ enumerable: true,
246
+ get: function () {
247
+ return assertUnsignedBigInt;
248
+ }
249
+ });
250
+ Object.defineProperty(exports, 'formatDateToUtcYYYYMMDD', {
251
+ enumerable: true,
252
+ get: function () {
253
+ return formatDateToUtcYYYYMMDD;
254
+ }
255
+ });
256
+ Object.defineProperty(exports, 'isBigint', {
257
+ enumerable: true,
258
+ get: function () {
259
+ return isBigint;
260
+ }
261
+ });
262
+ Object.defineProperty(exports, 'isErrorConstructor', {
263
+ enumerable: true,
264
+ get: function () {
265
+ return isErrorConstructor;
266
+ }
267
+ });
268
+ Object.defineProperty(exports, 'isNumber', {
269
+ enumerable: true,
270
+ get: function () {
271
+ return isNumber;
272
+ }
273
+ });
274
+ Object.defineProperty(exports, 'isPluginConfig', {
275
+ enumerable: true,
276
+ get: function () {
277
+ return isPluginConfig;
278
+ }
279
+ });
280
+ Object.defineProperty(exports, 'isString', {
281
+ enumerable: true,
282
+ get: function () {
283
+ return isString;
284
+ }
285
+ });
286
+ Object.defineProperty(exports, 'isValidYYYYMMDD', {
287
+ enumerable: true,
288
+ get: function () {
289
+ return isValidYYYYMMDD;
290
+ }
291
+ });
292
+ Object.defineProperty(exports, 'parseDateFromUtcYYYYMMDD', {
293
+ enumerable: true,
294
+ get: function () {
295
+ return parseDateFromUtcYYYYMMDD;
296
+ }
297
+ });
298
+ //# sourceMappingURL=plugins-iXublZYn.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins-iXublZYn.cjs","names":[],"sources":["../src/validation/dates.ts","../src/validation/index.ts","../src/errors/index.ts","../src/config/plugins/index.ts"],"sourcesContent":["import { ValidationError } from '../errors';\n\nexport const formatDateToUtcYYYYMMDD = (date: Date) => {\n // Use the 'en-CA' locale which formats as 'yyyy-mm-dd'\n const formatter = new Intl.DateTimeFormat('en-CA', {\n timeZone: 'UTC',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n });\n\n // Format the date\n return formatter.format(date);\n};\n\n// Function to validate 'yyyy-mm-dd' format\nexport const isValidYYYYMMDD = (dateString: string) => {\n const regex = /^\\d{4}-\\d{2}-\\d{2}$/;\n return regex.test(dateString);\n};\n\nexport const parseDateFromUtcYYYYMMDD = (dateString: string) => {\n const date = new Date(dateString + 'T00:00:00Z');\n\n if (!isValidYYYYMMDD(dateString)) {\n throw new ValidationError('Invalid date format, must be yyyy-mm-dd');\n }\n\n if (isNaN(date.getTime())) {\n throw new ValidationError('Invalid date format');\n }\n\n return date;\n};\n","import { ValidationError } from '../errors';\n\nexport const enum ValidationErrors {\n NOT_A_NONEMPTY_STRING = 'NOT_A_NONEMPTY_STRING',\n NOT_A_POSITIVE_NUMBER = 'NOT_A_POSITIVE_NUMBER',\n NOT_AN_UNSIGNED_BIGINT = 'NOT_AN_UNSIGNED_BIGINT',\n}\n\nexport const isNumber = (val: unknown): val is number =>\n typeof val === 'number' && val === val;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isBigint = (val: any): val is bigint =>\n typeof val === 'bigint' && val === val;\n\nexport const isString = (val: unknown): val is string =>\n typeof val === 'string';\n\nexport const assertNotEmptyString = (value: unknown): string => {\n if (!isString(value) || value.length === 0) {\n throw new ValidationError(ValidationErrors.NOT_A_NONEMPTY_STRING);\n }\n return value;\n};\n\nexport const assertPositiveNumber = (value: unknown): number => {\n if (!isNumber(value) || value <= 0) {\n throw new ValidationError(ValidationErrors.NOT_A_POSITIVE_NUMBER);\n }\n return value;\n};\n\nexport const assertUnsignedBigInt = (value: string): bigint => {\n const number = BigInt(value);\n if (number < 0) {\n throw new ValidationError(ValidationErrors.NOT_AN_UNSIGNED_BIGINT);\n }\n return number;\n};\n\nexport * from './dates';\n","import { isNumber, isString } from '../validation';\n\nexport type ErrorConstructor<ErrorType extends Error> = new (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...args: any[]\n) => ErrorType;\n\nexport const isErrorConstructor = <ErrorType extends Error>(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n expect: Function,\n): expect is ErrorConstructor<ErrorType> => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (\n typeof expect === 'function' &&\n expect.prototype &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n expect.prototype.constructor === expect\n );\n};\n\nexport class EmmettError extends Error {\n public static readonly Codes = {\n ValidationError: 400,\n IllegalStateError: 403,\n NotFoundError: 404,\n ConcurrencyError: 412,\n InternalServerError: 500,\n };\n\n public errorCode: number;\n\n constructor(\n options?: { errorCode: number; message?: string } | string | number,\n ) {\n const errorCode =\n options && typeof options === 'object' && 'errorCode' in options\n ? options.errorCode\n : isNumber(options)\n ? options\n : EmmettError.Codes.InternalServerError;\n const message =\n options && typeof options === 'object' && 'message' in options\n ? options.message\n : isString(options)\n ? options\n : `Error with status code '${errorCode}' ocurred during Emmett processing`;\n\n super(message);\n this.errorCode = errorCode;\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, EmmettError.prototype);\n }\n\n public static mapFrom(\n error: Error | { message?: string; errorCode?: number },\n ): EmmettError {\n if (EmmettError.isInstanceOf(error)) {\n return error;\n }\n\n return new EmmettError({\n errorCode:\n 'errorCode' in error &&\n error.errorCode !== undefined &&\n error.errorCode !== null\n ? error.errorCode\n : EmmettError.Codes.InternalServerError,\n message: error.message ?? 'An unknown error occurred',\n });\n }\n\n public static isInstanceOf<ErrorType extends EmmettError = EmmettError>(\n error: unknown,\n errorCode?: (typeof EmmettError.Codes)[keyof typeof EmmettError.Codes],\n ): error is ErrorType {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'errorCode' in error &&\n isNumber(error.errorCode) &&\n (errorCode === undefined || error.errorCode === errorCode)\n );\n }\n}\n\nexport class ConcurrencyError extends EmmettError {\n constructor(\n public current: string | undefined,\n public expected: string,\n message?: string,\n ) {\n super({\n errorCode: EmmettError.Codes.ConcurrencyError,\n message:\n message ??\n `Expected version ${expected.toString()} does not match current ${current?.toString()}`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ConcurrencyError.prototype);\n }\n}\n\n// TODO: Make it derive from ConcurrencyError to avoid code duplication\n// Or add additional type to distinguinsh both errors\nexport class ConcurrencyInMemoryDatabaseError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: EmmettError.Codes.ConcurrencyError,\n message: message ?? `Expected document state does not match current one!`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ConcurrencyInMemoryDatabaseError.prototype);\n }\n}\n\nexport class ValidationError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: EmmettError.Codes.ValidationError,\n message: message ?? `Validation Error ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport class IllegalStateError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: EmmettError.Codes.IllegalStateError,\n message: message ?? `Illegal State ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, IllegalStateError.prototype);\n }\n}\n\nexport class NotFoundError extends EmmettError {\n constructor(options?: { id: string; type: string; message?: string }) {\n super({\n errorCode: EmmettError.Codes.NotFoundError,\n message:\n options?.message ??\n (options?.id\n ? options.type\n ? `${options.type} with ${options.id} was not found during Emmett processing`\n : `State with ${options.id} was not found during Emmett processing`\n : options?.type\n ? `${options.type} was not found during Emmett processing`\n : 'State was not found during Emmett processing'),\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","export type EmmettPluginConfig =\n | {\n name: string;\n register: EmmettPluginRegistration[];\n }\n | string;\n\nexport type EmmettPluginType = 'cli';\n\nexport type EmmettCliPluginRegistration = { pluginType: 'cli'; path?: string };\n\nexport type EmmettPluginRegistration = EmmettCliPluginRegistration;\n\nexport type EmmettCliCommand = {\n addCommand<CliCommand>(command: CliCommand): CliCommand;\n};\n\nexport type EmmettCliPlugin = {\n pluginType: 'cli';\n name: string;\n registerCommands: (program: EmmettCliCommand) => Promise<void> | void;\n};\n\nexport type EmmettPlugin = EmmettCliPlugin;\n\nexport const isPluginConfig = (\n plugin: Partial<EmmettPluginConfig> | string | undefined,\n): plugin is EmmettPluginConfig =>\n plugin !== undefined &&\n (typeof plugin === 'string' ||\n ('name' in plugin &&\n plugin.name !== undefined &&\n typeof plugin.name === 'string'));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,2BAA2B,SAAe;AAUrD,QAAO,IARe,KAAK,eAAe,SAAS;EACjD,UAAU;EACV,MAAM;EACN,OAAO;EACP,KAAK;EACN,CAGe,CAAC,OAAO,KAAK;;AAI/B,MAAa,mBAAmB,eAAuB;AAErD,QAAO,sBAAM,KAAK,WAAW;;AAG/B,MAAa,4BAA4B,eAAuB;CAC9D,MAAM,uBAAO,IAAI,KAAK,aAAa,aAAa;AAEhD,KAAI,CAAC,gBAAgB,WAAW,CAC9B,OAAM,IAAI,gBAAgB,0CAA0C;AAGtE,KAAI,MAAM,KAAK,SAAS,CAAC,CACvB,OAAM,IAAI,gBAAgB,sBAAsB;AAGlD,QAAO;;;;;AC9BT,IAAkB,mBAAX;AACL;AACA;AACA;;KACD;AAED,MAAa,YAAY,QACvB,OAAO,QAAQ,YAAY,QAAQ;AAGrC,MAAa,YAAY,QACvB,OAAO,QAAQ,YAAY,QAAQ;AAErC,MAAa,YAAY,QACvB,OAAO,QAAQ;AAEjB,MAAa,wBAAwB,UAA2B;A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4
+ "version": "0.43.0-beta.20",
5
5
  "description": "Emmett - Event Sourcing development made simple",
6
6
  "scripts": {
7
- "build": "tsup",
7
+ "build": "tsdown",
8
8
  "build:ts": "tsc",
9
9
  "build:ts:watch": "tsc -b --watch",
10
10
  "test": "run-s test:unit test:int test:e2e",
11
- "test:unit": "glob-bin -c \"node --import tsx --test\" **/*.unit.spec.ts",
12
- "test:int": "glob-bin -c \"node --import tsx --test\" **/*.int.spec.ts",
13
- "test:e2e": "glob-bin -c \"node --import tsx --test\" **/*.e2e.spec.ts",
14
- "test:watch": "node --import tsx --test --watch",
15
- "test:unit:watch": "glob-bin -c \"node --import tsx --test --watch\" **/*.unit.spec.ts",
16
- "test:int:watch": "glob-bin -c \"node --import tsx --test --watch\" **/*.int.spec.ts",
17
- "test:e2e:watch": "glob-bin -c \"node --import tsx --test --watch\" **/*.e2e.spec.ts"
11
+ "test:unit": "vitest run \".unit.spec\"",
12
+ "test:int": "vitest run \".int.spec\"",
13
+ "test:e2e": "vitest run \".e2e.spec\"",
14
+ "test:watch": "vitest",
15
+ "test:unit:watch": "vitest \".unit.spec\"",
16
+ "test:int:watch": "vitest \".int.spec\"",
17
+ "test:e2e:watch": "vitest \".e2e.spec\""
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -66,10 +66,13 @@
66
66
  "bin": {
67
67
  "emmett": "dist/cli.js"
68
68
  },
69
- "peerDependencies": {
69
+ "dependencies": {
70
+ "@event-driven-io/almanac": "0.1.0-beta.14",
70
71
  "@types/async-retry": "^1.4.9",
71
- "async-retry": "^1.3.3",
72
- "commander": "^14.0.2",
73
- "uuid": "^13.0.0"
72
+ "async-retry": "^1.3.3"
73
+ },
74
+ "peerDependencies": {
75
+ "commander": "^14.0.3",
76
+ "uuid": "^14.0.0"
74
77
  }
75
78
  }