@flipdish/events 1.25351.0 → 1.25364.0
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/oom/currency.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import currencyCodes from 'currency-codes';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Currency Code Schema to validate ISO 4217 currency codes
|
|
4
|
+
export const CurrencyCodeSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.trim()
|
|
7
|
+
.toUpperCase()
|
|
8
|
+
.pipe(z.string().refine((code) => Boolean(currencyCodes.code(code)), {
|
|
9
|
+
message: 'Invalid ISO 4217 currency code',
|
|
10
|
+
}));
|
package/oom/currency.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import currencyCodes from 'currency-codes';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
// Currency Code Schema to validate ISO 4217 currency codes
|
|
5
|
+
export const CurrencyCodeSchema = z
|
|
6
|
+
.string()
|
|
7
|
+
.trim()
|
|
8
|
+
.toUpperCase()
|
|
9
|
+
.pipe(
|
|
10
|
+
z.string().refine((code) => Boolean(currencyCodes.code(code)), {
|
|
11
|
+
message: 'Invalid ISO 4217 currency code',
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export type Currency = z.infer<typeof CurrencyCodeSchema>;
|
|
@@ -15,6 +15,7 @@ export const OnlineOrderingCommonPropertiesSchema = z.object({
|
|
|
15
15
|
menuRevisionId: z.number().int(),
|
|
16
16
|
legacyMenuId: z.number().int(),
|
|
17
17
|
referencePriceDispatchType: z.string(),
|
|
18
|
+
publishedAt: z.string().datetime(),
|
|
18
19
|
});
|
|
19
20
|
|
|
20
21
|
export type OnlineOrderingCommonProperties = z.infer<typeof OnlineOrderingCommonPropertiesSchema>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CurrencyCodeSchema } from './currency.js';
|
|
2
3
|
import { OnlineOrderingCommonPropertiesSchema, OnlineOrderingMenusSource, } from './online.ordering.common.js';
|
|
3
4
|
// Event types defined locally to avoid circular imports
|
|
4
5
|
export const PreProcessEventTypes = {
|
|
@@ -220,6 +221,7 @@ export const OnlineOrderingMenuPreprocessSuccessV1PublicMenuSchema = z.object({
|
|
|
220
221
|
legacyId: z.number(),
|
|
221
222
|
name: z.string().nullable(),
|
|
222
223
|
type: z.string(),
|
|
224
|
+
currency: CurrencyCodeSchema,
|
|
223
225
|
categories: z.array(MenuCategoriesSchema).nullable(),
|
|
224
226
|
categoryGroups: z.array(MenuCategoryGroupSchema).nullable(),
|
|
225
227
|
taxType: TaxTypeSchema,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CurrencyCodeSchema } from './currency.js';
|
|
2
3
|
import {
|
|
3
4
|
OnlineOrderingCommonPropertiesSchema,
|
|
4
5
|
OnlineOrderingMenusSource,
|
|
@@ -287,6 +288,7 @@ export const OnlineOrderingMenuPreprocessSuccessV1PublicMenuSchema = z.object({
|
|
|
287
288
|
legacyId: z.number(),
|
|
288
289
|
name: z.string().nullable(),
|
|
289
290
|
type: z.string(),
|
|
291
|
+
currency: CurrencyCodeSchema,
|
|
290
292
|
categories: z.array(MenuCategoriesSchema).nullable(),
|
|
291
293
|
categoryGroups: z.array(MenuCategoryGroupSchema).nullable(),
|
|
292
294
|
taxType: TaxTypeSchema,
|
|
@@ -345,12 +347,10 @@ export type OnlineOrderingMenuPreprocessSuccessItemPricingProfileV1 = z.infer<
|
|
|
345
347
|
typeof ItemPricingProfileSchema
|
|
346
348
|
>;
|
|
347
349
|
|
|
348
|
-
// Preprocess Success
|
|
349
350
|
export type OnlineOrderingMenuPreprocessSuccessV1 = z.infer<
|
|
350
351
|
typeof OnlineOrderingMenuPreprocessSuccessV1Schema
|
|
351
352
|
>;
|
|
352
353
|
|
|
353
|
-
// Preprocess Failed
|
|
354
354
|
export type OnlineOrderingMenuPreprocessFailedV1 = z.infer<
|
|
355
355
|
typeof OnlineOrderingMenuPreprocessFailedV1Schema
|
|
356
356
|
>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flipdish/events",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25364.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --max-old-space-size=4096 --max-semi-space-size=512 ./node_modules/.bin/jest --config=jest.config.ts --verbose",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@jest/types": "^29.6.3",
|
|
28
28
|
"@types/node": "^22.13.9",
|
|
29
29
|
"aws-sdk": "^2.1692.0",
|
|
30
|
+
"currency-codes": "^2.2.0",
|
|
30
31
|
"dotenv": "^16.3.1",
|
|
31
32
|
"zod": "^3.24.2"
|
|
32
33
|
},
|