@flipdish/events 1.25352.0 → 1.26007.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.
@@ -13,4 +13,5 @@ export const OnlineOrderingCommonPropertiesSchema = z.object({
13
13
  menuRevisionId: z.number().int(),
14
14
  legacyMenuId: z.number().int(),
15
15
  referencePriceDispatchType: z.string(),
16
+ publishedAt: z.string().datetime(),
16
17
  });
@@ -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>;
@@ -347,12 +347,10 @@ export type OnlineOrderingMenuPreprocessSuccessItemPricingProfileV1 = z.infer<
347
347
  typeof ItemPricingProfileSchema
348
348
  >;
349
349
 
350
- // Preprocess Success
351
350
  export type OnlineOrderingMenuPreprocessSuccessV1 = z.infer<
352
351
  typeof OnlineOrderingMenuPreprocessSuccessV1Schema
353
352
  >;
354
353
 
355
- // Preprocess Failed
356
354
  export type OnlineOrderingMenuPreprocessFailedV1 = z.infer<
357
355
  typeof OnlineOrderingMenuPreprocessFailedV1Schema
358
356
  >;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/events",
3
- "version": "1.25352.0",
3
+ "version": "1.26007.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",
@@ -1,3 +1,4 @@
1
1
  export const eventTypes = {
2
2
  MENU_PUBLISHED_V1: 'menu.published.v1',
3
+ MENU_VALIDATION_FAILED_V1: 'menu.validation.failed.v1',
3
4
  };
@@ -1,3 +1,4 @@
1
1
  export const eventTypes = {
2
2
  MENU_PUBLISHED_V1: 'menu.published.v1',
3
+ MENU_VALIDATION_FAILED_V1: 'menu.validation.failed.v1',
3
4
  } as const;
@@ -1,7 +1,10 @@
1
1
  import { eventTypes } from './constants.js';
2
2
  import { MenuEventBaseSchema } from './menu.published.v1.js';
3
+ import { MenuValidationFailedEventBaseSchema } from './menu.validation.failed.v1.js';
3
4
  export * from './constants.js';
4
5
  export * from './menu.published.v1.js';
6
+ export * from './menu.validation.failed.v1.js';
5
7
  export const eventSchemaMap = Object.fromEntries([
6
8
  [eventTypes.MENU_PUBLISHED_V1, MenuEventBaseSchema],
9
+ [eventTypes.MENU_VALIDATION_FAILED_V1, MenuValidationFailedEventBaseSchema],
7
10
  ]);
@@ -1,9 +1,12 @@
1
1
  import { eventTypes } from './constants.js';
2
2
  import { MenuEventBaseSchema } from './menu.published.v1.js';
3
+ import { MenuValidationFailedEventBaseSchema } from './menu.validation.failed.v1.js';
3
4
 
4
5
  export * from './constants.js';
5
6
  export * from './menu.published.v1.js';
7
+ export * from './menu.validation.failed.v1.js';
6
8
 
7
9
  export const eventSchemaMap = Object.fromEntries([
8
10
  [eventTypes.MENU_PUBLISHED_V1, MenuEventBaseSchema],
11
+ [eventTypes.MENU_VALIDATION_FAILED_V1, MenuValidationFailedEventBaseSchema],
9
12
  ]);
@@ -0,0 +1,58 @@
1
+ import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
+ import { z } from 'zod';
3
+ import { orgIdSchema, propertyIdSchema } from '../../../common-schemas.js';
4
+ import { metadataSchema } from '../../../metadata.js';
5
+ import { menuIdSchema, menuPublishIdSchema, revisionIdSchema } from '../schemas/common-schemas.js';
6
+ import { eventTypes } from './constants.js';
7
+ import { MENU_VALIDATION_FAILED_V1_WEBHOOK_EXAMPLE } from './webhook-examples.js';
8
+ // This must be called before defining any schemas
9
+ extendZodWithOpenApi(z);
10
+ // Event properties schema for menu validation failed events
11
+ export const MenuValidationFailedEventPropertiesSchema = z
12
+ .object({
13
+ orgId: orgIdSchema,
14
+ brandId: z.string().openapi({
15
+ description: 'Unique ID of the client’s Brand that owns this menu. This ID remains the same for subsequent updates / revisions of the same menu.',
16
+ example: 'br456',
17
+ }),
18
+ propertyId: propertyIdSchema,
19
+ salesChannelId: z.string().openapi({
20
+ description: 'Unique ID of a Sales Channel, a digital channel tied to a Property and Brand (e.g., kiosk, web, mobile app). This ID remains the same for subsequent updates / revisions of the same menu.',
21
+ example: 'sc123',
22
+ }),
23
+ menuId: menuIdSchema,
24
+ menuRevisionId: revisionIdSchema,
25
+ menuPublishId: menuPublishIdSchema,
26
+ error: z.string().openapi({
27
+ description: 'The error message from the menu validation',
28
+ example: 'Menu validation failed',
29
+ }),
30
+ })
31
+ .openapi('MenuValidationFailedEventPropertiesSchema', {
32
+ description: 'Properties included with menu validation failed events.',
33
+ });
34
+ // =============================================================================
35
+ // MENU VALIDATION FAILED EVENT SCHEMAS
36
+ // =============================================================================
37
+ // EventBridge envelope schema for menu events
38
+ export const MenuValidationFailedEventBaseSchema = z
39
+ .object({
40
+ source: z.string().openapi({
41
+ description: 'Source of the event',
42
+ example: 'rms',
43
+ }),
44
+ 'detail-type': z.literal(eventTypes.MENU_VALIDATION_FAILED_V1),
45
+ detail: z.object({
46
+ properties: MenuValidationFailedEventPropertiesSchema,
47
+ metadata: metadataSchema,
48
+ }),
49
+ })
50
+ .openapi({
51
+ description: 'Emitted when a menu validation fails after a menu publish.',
52
+ 'x-webhook-group': 'Menu Validation',
53
+ 'x-example': MENU_VALIDATION_FAILED_V1_WEBHOOK_EXAMPLE,
54
+ });
55
+ export default {
56
+ MenuValidationFailedEventBaseSchema,
57
+ MenuValidationFailedEventPropertiesSchema,
58
+ };
@@ -0,0 +1,70 @@
1
+ import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
+ import { z } from 'zod';
3
+ import { orgIdSchema, propertyIdSchema } from '../../../common-schemas.js';
4
+ import { metadataSchema } from '../../../metadata.js';
5
+ import { menuIdSchema, menuPublishIdSchema, revisionIdSchema } from '../schemas/common-schemas.js';
6
+ import { eventTypes } from './constants.js';
7
+ import { MENU_VALIDATION_FAILED_V1_WEBHOOK_EXAMPLE } from './webhook-examples.js';
8
+
9
+ // This must be called before defining any schemas
10
+ extendZodWithOpenApi(z);
11
+
12
+ // Event properties schema for menu validation failed events
13
+ export const MenuValidationFailedEventPropertiesSchema = z
14
+ .object({
15
+ orgId: orgIdSchema,
16
+ brandId: z.string().openapi({
17
+ description:
18
+ 'Unique ID of the client’s Brand that owns this menu. This ID remains the same for subsequent updates / revisions of the same menu.',
19
+ example: 'br456',
20
+ }),
21
+ propertyId: propertyIdSchema,
22
+ salesChannelId: z.string().openapi({
23
+ description:
24
+ 'Unique ID of a Sales Channel, a digital channel tied to a Property and Brand (e.g., kiosk, web, mobile app). This ID remains the same for subsequent updates / revisions of the same menu.',
25
+ example: 'sc123',
26
+ }),
27
+ menuId: menuIdSchema,
28
+ menuRevisionId: revisionIdSchema,
29
+ menuPublishId: menuPublishIdSchema,
30
+ error: z.string().openapi({
31
+ description: 'The error message from the menu validation',
32
+ example: 'Menu validation failed',
33
+ }),
34
+ })
35
+ .openapi('MenuValidationFailedEventPropertiesSchema', {
36
+ description: 'Properties included with menu validation failed events.',
37
+ });
38
+ export type MenuValidationFailedEventPropertiesType = z.infer<
39
+ typeof MenuValidationFailedEventPropertiesSchema
40
+ >;
41
+
42
+ // =============================================================================
43
+ // MENU VALIDATION FAILED EVENT SCHEMAS
44
+ // =============================================================================
45
+
46
+ // EventBridge envelope schema for menu events
47
+ export const MenuValidationFailedEventBaseSchema = z
48
+ .object({
49
+ source: z.string().openapi({
50
+ description: 'Source of the event',
51
+ example: 'rms',
52
+ }),
53
+ 'detail-type': z.literal(eventTypes.MENU_VALIDATION_FAILED_V1),
54
+ detail: z.object({
55
+ properties: MenuValidationFailedEventPropertiesSchema,
56
+ metadata: metadataSchema,
57
+ }),
58
+ })
59
+ .openapi({
60
+ description: 'Emitted when a menu validation fails after a menu publish.',
61
+ 'x-webhook-group': 'Menu Validation',
62
+ 'x-example': MENU_VALIDATION_FAILED_V1_WEBHOOK_EXAMPLE,
63
+ });
64
+
65
+ export type MenuValidationFailedEventBaseType = z.infer<typeof MenuValidationFailedEventBaseSchema>;
66
+
67
+ export default {
68
+ MenuValidationFailedEventBaseSchema,
69
+ MenuValidationFailedEventPropertiesSchema,
70
+ };
@@ -357,3 +357,13 @@ export const MENU_PUBLISHED_V1_WEBHOOK_EXAMPLE = {
357
357
  menu: MENU_EXAMPLE,
358
358
  priceBandId: '13a85f64-5717-4562-b3fc-2c963f66afb6',
359
359
  };
360
+ export const MENU_VALIDATION_FAILED_V1_WEBHOOK_EXAMPLE = {
361
+ orgId: 'org123',
362
+ brandId: 'br456',
363
+ propertyId: 'p789',
364
+ salesChannelId: 'sc123',
365
+ menuId: '123e4567-e89b-12d3-a456-426614174000',
366
+ menuPublishId: '123e4567-e89b-12d3-a456-426614174000',
367
+ menuRevisionId: 1,
368
+ error: 'Menu validation failed',
369
+ };
@@ -361,3 +361,14 @@ export const MENU_PUBLISHED_V1_WEBHOOK_EXAMPLE = {
361
361
  menu: MENU_EXAMPLE,
362
362
  priceBandId: '13a85f64-5717-4562-b3fc-2c963f66afb6',
363
363
  };
364
+
365
+ export const MENU_VALIDATION_FAILED_V1_WEBHOOK_EXAMPLE = {
366
+ orgId: 'org123',
367
+ brandId: 'br456',
368
+ propertyId: 'p789',
369
+ salesChannelId: 'sc123',
370
+ menuId: '123e4567-e89b-12d3-a456-426614174000',
371
+ menuPublishId: '123e4567-e89b-12d3-a456-426614174000',
372
+ menuRevisionId: 1,
373
+ error: 'Menu validation failed',
374
+ };
@@ -1,6 +1,7 @@
1
1
  import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
2
  import { z } from 'zod';
3
3
  import MenuEventSchemas from './events/menu.published.v1.js';
4
+ import MenuValidationFailedEventSchemas from './events/menu.validation.failed.v1.js';
4
5
  import CategoryGroupSchemas from './schemas/category-group.js';
5
6
  import CategorySchemas from './schemas/category.js';
6
7
  import ChargeSchemas from './schemas/charge.js';
@@ -27,5 +28,6 @@ export const Schemas = {
27
28
  ...TaxConfigSchemas,
28
29
  ...MenuSchemas,
29
30
  ...MenuEventSchemas,
31
+ ...MenuValidationFailedEventSchemas,
30
32
  };
31
33
  export default Schemas;
@@ -1,6 +1,7 @@
1
1
  import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
2
  import { z } from 'zod';
3
3
  import MenuEventSchemas from './events/menu.published.v1.js';
4
+ import MenuValidationFailedEventSchemas from './events/menu.validation.failed.v1.js';
4
5
  import CategoryGroupSchemas from './schemas/category-group.js';
5
6
  import CategorySchemas from './schemas/category.js';
6
7
  import ChargeSchemas from './schemas/charge.js';
@@ -30,6 +31,7 @@ export const Schemas = {
30
31
  ...TaxConfigSchemas,
31
32
  ...MenuSchemas,
32
33
  ...MenuEventSchemas,
34
+ ...MenuValidationFailedEventSchemas,
33
35
  };
34
36
 
35
37
  export default Schemas;
package/webhooks/index.js CHANGED
@@ -3,6 +3,7 @@ import { eventSchemaMap as rmsSalesEventSchemaMap, eventTypes as rmsSalesEvents,
3
3
  import { eventSchemaMap as rmsSnoozeEventSchemaMap, eventTypes as rmsSnoozeEvents, } from '../rms/snoozes/index.js';
4
4
  export const webhookEventTypes = [
5
5
  rmsMenuEvents.MENU_PUBLISHED_V1,
6
+ rmsMenuEvents.MENU_VALIDATION_FAILED_V1,
6
7
  rmsSnoozeEvents.MENU_ITEM_SNOOZED_V1,
7
8
  rmsSnoozeEvents.MENU_ITEM_UNSNOOZED_V1,
8
9
  rmsSnoozeEvents.SALES_CHANNEL_SNOOZED_V1,
package/webhooks/index.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
 
14
14
  export const webhookEventTypes = [
15
15
  rmsMenuEvents.MENU_PUBLISHED_V1,
16
+ rmsMenuEvents.MENU_VALIDATION_FAILED_V1,
16
17
  rmsSnoozeEvents.MENU_ITEM_SNOOZED_V1,
17
18
  rmsSnoozeEvents.MENU_ITEM_UNSNOOZED_V1,
18
19
  rmsSnoozeEvents.SALES_CHANNEL_SNOOZED_V1,