@deliverart/sdk-js-menu 0.0.1
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/.changeset/config.json +11 -0
- package/.github/workflows/workflow.yml +47 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +37 -0
- package/README.md +3 -0
- package/dist/index.cjs +175 -0
- package/dist/index.d.cts +43 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +127 -0
- package/eslint.config.js +41 -0
- package/package.json +46 -0
- package/src/index.ts +1 -0
- package/src/types.ts +172 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "restricted",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- uses: pnpm/action-setup@v2
|
|
18
|
+
with:
|
|
19
|
+
version: 8
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: '20'
|
|
24
|
+
registry-url: 'https://registry.npmjs.org'
|
|
25
|
+
always-auth: true
|
|
26
|
+
env:
|
|
27
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
28
|
+
|
|
29
|
+
- name: Install deps
|
|
30
|
+
run: pnpm install
|
|
31
|
+
|
|
32
|
+
- name: Build
|
|
33
|
+
run: pnpm build
|
|
34
|
+
|
|
35
|
+
- name: Create version and changelog
|
|
36
|
+
run: pnpx @changesets/cli version
|
|
37
|
+
|
|
38
|
+
- name: Publish to NPM
|
|
39
|
+
run: pnpx @changesets/cli publish
|
|
40
|
+
env:
|
|
41
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
42
|
+
|
|
43
|
+
- name: Push updated versions and changelogs
|
|
44
|
+
uses: EndBug/add-and-commit@v9
|
|
45
|
+
with:
|
|
46
|
+
message: 'chore(release): version bump'
|
|
47
|
+
add: '.'
|
package/.prettierrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @deliverart/sdk-js-company
|
|
2
|
+
|
|
3
|
+
## 0.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b8d802e: update dependencise
|
|
8
|
+
|
|
9
|
+
## 0.0.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 65b64b5: Expose types
|
|
14
|
+
|
|
15
|
+
## 0.0.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 83e0325: Expose company path types
|
|
20
|
+
|
|
21
|
+
## 0.0.4
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 36a941d: Upgrade types version
|
|
26
|
+
|
|
27
|
+
## 0.0.3
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- b4fc2d4: Upgrade types version
|
|
32
|
+
|
|
33
|
+
## 0.0.2
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- a9d7757: Upgrade types version
|
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
menuChannelSchema: () => menuChannelSchema,
|
|
24
|
+
menuChannels: () => menuChannels,
|
|
25
|
+
menuItemAllergenSchema: () => menuItemAllergenSchema,
|
|
26
|
+
menuItemAllergens: () => menuItemAllergens,
|
|
27
|
+
menuItemCategoryNullablePathSchema: () => menuItemCategoryNullablePathSchema,
|
|
28
|
+
menuItemCategoryPathSchema: () => menuItemCategoryPathSchema,
|
|
29
|
+
menuItemDietSchema: () => menuItemDietSchema,
|
|
30
|
+
menuItemDiets: () => menuItemDiets,
|
|
31
|
+
menuItemModifierNullablePathSchema: () => menuItemModifierNullablePathSchema,
|
|
32
|
+
menuItemModifierPathSchema: () => menuItemModifierPathSchema,
|
|
33
|
+
menuItemNullablePathSchema: () => menuItemNullablePathSchema,
|
|
34
|
+
menuItemPathSchema: () => menuItemPathSchema,
|
|
35
|
+
menuItemPriceOverrideNullablePathSchema: () => menuItemPriceOverrideNullablePathSchema,
|
|
36
|
+
menuItemPriceOverridePathSchema: () => menuItemPriceOverridePathSchema,
|
|
37
|
+
menuItemPriceOverrideSalesPriceNullablePathSchema: () => menuItemPriceOverrideSalesPriceNullablePathSchema,
|
|
38
|
+
menuItemPriceOverrideSalesPricePathSchema: () => menuItemPriceOverrideSalesPricePathSchema,
|
|
39
|
+
menuItemPriceOverrideTypeSchema: () => menuItemPriceOverrideTypeSchema,
|
|
40
|
+
menuItemPriceOverrideTypes: () => menuItemPriceOverrideTypes,
|
|
41
|
+
menuItemSalesPriceNullablePathSchema: () => menuItemSalesPriceNullablePathSchema,
|
|
42
|
+
menuItemSalesPricePathSchema: () => menuItemSalesPricePathSchema,
|
|
43
|
+
menuItemTypeSchema: () => menuItemTypeSchema,
|
|
44
|
+
menuItemTypes: () => menuItemTypes
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(index_exports);
|
|
47
|
+
|
|
48
|
+
// src/types.ts
|
|
49
|
+
var import_zod = require("zod");
|
|
50
|
+
var menuChannels = ["application", "ecommerce", "deliveroo", "justeat", "glovo"];
|
|
51
|
+
var menuChannelSchema = import_zod.z.enum(menuChannels);
|
|
52
|
+
var menuItemAllergens = [
|
|
53
|
+
"peanuts-and-derivatives",
|
|
54
|
+
"crustaceans",
|
|
55
|
+
"nuts",
|
|
56
|
+
"gluten",
|
|
57
|
+
"milk-and-derivatives",
|
|
58
|
+
"lupins",
|
|
59
|
+
"molluscs",
|
|
60
|
+
"mustard",
|
|
61
|
+
"fish",
|
|
62
|
+
"celery",
|
|
63
|
+
"sesame",
|
|
64
|
+
"sulfur-dioxide",
|
|
65
|
+
"soy",
|
|
66
|
+
"eggs-and-derivatives",
|
|
67
|
+
"mushrooms"
|
|
68
|
+
];
|
|
69
|
+
var menuItemAllergenSchema = import_zod.z.enum(menuItemAllergens);
|
|
70
|
+
var menuItemDiets = ["pending", "confirmed", "rejected"];
|
|
71
|
+
var menuItemDietSchema = import_zod.z.enum(menuItemDiets);
|
|
72
|
+
var menuItemPriceOverrideTypes = ["ITEM", "MODIFIER"];
|
|
73
|
+
var menuItemPriceOverrideTypeSchema = import_zod.z.enum(menuItemPriceOverrideTypes);
|
|
74
|
+
var menuItemTypes = ["ITEM", "CHOICE", "BUNDLE"];
|
|
75
|
+
var menuItemTypeSchema = import_zod.z.enum(menuItemTypes);
|
|
76
|
+
var menuItemPathSchema = import_zod.z.string().refine((val) => /^\/menu_items\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
77
|
+
message: "Invalid menu item path format"
|
|
78
|
+
});
|
|
79
|
+
var menuItemNullablePathSchema = import_zod.z.string().nullable().refine(
|
|
80
|
+
(val) => {
|
|
81
|
+
if (!val) return true;
|
|
82
|
+
return /^\/menu_items\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
message: "Invalid menu item path format"
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
var menuItemSalesPricePathSchema = import_zod.z.string().refine((val) => /^\/menu_items\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
89
|
+
message: "Invalid menu item sales price path format"
|
|
90
|
+
});
|
|
91
|
+
var menuItemSalesPriceNullablePathSchema = import_zod.z.string().nullable().refine(
|
|
92
|
+
(val) => {
|
|
93
|
+
if (!val) return true;
|
|
94
|
+
return /^\/menu_items\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
message: "Invalid menu item sales price path format"
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
var menuItemCategoryPathSchema = import_zod.z.string().refine((val) => /^\/menu_item_categories\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
101
|
+
message: "Invalid menu item category path format"
|
|
102
|
+
});
|
|
103
|
+
var menuItemCategoryNullablePathSchema = import_zod.z.string().nullable().refine(
|
|
104
|
+
(val) => {
|
|
105
|
+
if (!val) return true;
|
|
106
|
+
return /^\/menu_item_categories\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
message: "Invalid menu item category path format"
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
var menuItemModifierPathSchema = import_zod.z.string().refine((val) => /^\/menu_item_modifiers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
113
|
+
message: "Invalid menu item modifier format"
|
|
114
|
+
});
|
|
115
|
+
var menuItemModifierNullablePathSchema = import_zod.z.string().nullable().refine(
|
|
116
|
+
(val) => {
|
|
117
|
+
if (!val) return true;
|
|
118
|
+
return /^\/menu_item_modifiers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
message: "Invalid menu item modifier format"
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
var menuItemPriceOverridePathSchema = import_zod.z.string().refine((val) => /^\/menu_item_price_overrides\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
125
|
+
message: "Invalid menu item price override path format"
|
|
126
|
+
});
|
|
127
|
+
var menuItemPriceOverrideNullablePathSchema = import_zod.z.string().nullable().refine(
|
|
128
|
+
(val) => {
|
|
129
|
+
if (!val) return true;
|
|
130
|
+
return /^\/menu_item_price_overrides\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
message: "Invalid menu item price override path format"
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
var menuItemPriceOverrideSalesPricePathSchema = import_zod.z.string().refine(
|
|
137
|
+
(val) => /^\/menu_item_price_overrides\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val),
|
|
138
|
+
{
|
|
139
|
+
message: "Invalid menu item price override sales price path format"
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
var menuItemPriceOverrideSalesPriceNullablePathSchema = import_zod.z.string().nullable().refine(
|
|
143
|
+
(val) => {
|
|
144
|
+
if (!val) return true;
|
|
145
|
+
return /^\/menu_item_price_overrides\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
message: "Invalid menu item price override sales price path format"
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
+
0 && (module.exports = {
|
|
153
|
+
menuChannelSchema,
|
|
154
|
+
menuChannels,
|
|
155
|
+
menuItemAllergenSchema,
|
|
156
|
+
menuItemAllergens,
|
|
157
|
+
menuItemCategoryNullablePathSchema,
|
|
158
|
+
menuItemCategoryPathSchema,
|
|
159
|
+
menuItemDietSchema,
|
|
160
|
+
menuItemDiets,
|
|
161
|
+
menuItemModifierNullablePathSchema,
|
|
162
|
+
menuItemModifierPathSchema,
|
|
163
|
+
menuItemNullablePathSchema,
|
|
164
|
+
menuItemPathSchema,
|
|
165
|
+
menuItemPriceOverrideNullablePathSchema,
|
|
166
|
+
menuItemPriceOverridePathSchema,
|
|
167
|
+
menuItemPriceOverrideSalesPriceNullablePathSchema,
|
|
168
|
+
menuItemPriceOverrideSalesPricePathSchema,
|
|
169
|
+
menuItemPriceOverrideTypeSchema,
|
|
170
|
+
menuItemPriceOverrideTypes,
|
|
171
|
+
menuItemSalesPriceNullablePathSchema,
|
|
172
|
+
menuItemSalesPricePathSchema,
|
|
173
|
+
menuItemTypeSchema,
|
|
174
|
+
menuItemTypes
|
|
175
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const menuChannels: readonly ["application", "ecommerce", "deliveroo", "justeat", "glovo"];
|
|
4
|
+
declare const menuChannelSchema: z.ZodEnum<["application", "ecommerce", "deliveroo", "justeat", "glovo"]>;
|
|
5
|
+
type MenuChannel = z.infer<typeof menuChannelSchema>;
|
|
6
|
+
declare const menuItemAllergens: readonly ["peanuts-and-derivatives", "crustaceans", "nuts", "gluten", "milk-and-derivatives", "lupins", "molluscs", "mustard", "fish", "celery", "sesame", "sulfur-dioxide", "soy", "eggs-and-derivatives", "mushrooms"];
|
|
7
|
+
declare const menuItemAllergenSchema: z.ZodEnum<["peanuts-and-derivatives", "crustaceans", "nuts", "gluten", "milk-and-derivatives", "lupins", "molluscs", "mustard", "fish", "celery", "sesame", "sulfur-dioxide", "soy", "eggs-and-derivatives", "mushrooms"]>;
|
|
8
|
+
type MenuItemAllergen = z.infer<typeof menuItemAllergenSchema>;
|
|
9
|
+
declare const menuItemDiets: readonly ["pending", "confirmed", "rejected"];
|
|
10
|
+
declare const menuItemDietSchema: z.ZodEnum<["pending", "confirmed", "rejected"]>;
|
|
11
|
+
type MenuItemDiet = z.infer<typeof menuItemDietSchema>;
|
|
12
|
+
declare const menuItemPriceOverrideTypes: readonly ["ITEM", "MODIFIER"];
|
|
13
|
+
declare const menuItemPriceOverrideTypeSchema: z.ZodEnum<["ITEM", "MODIFIER"]>;
|
|
14
|
+
type MenuItemPriceOverrideType = z.infer<typeof menuItemPriceOverrideTypeSchema>;
|
|
15
|
+
declare const menuItemTypes: readonly ["ITEM", "CHOICE", "BUNDLE"];
|
|
16
|
+
declare const menuItemTypeSchema: z.ZodEnum<["ITEM", "CHOICE", "BUNDLE"]>;
|
|
17
|
+
type MenuItemType = z.infer<typeof menuItemTypeSchema>;
|
|
18
|
+
declare const menuItemPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
19
|
+
type MenuItemPath = z.infer<typeof menuItemPathSchema>;
|
|
20
|
+
declare const menuItemNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
21
|
+
type MenuItemNullablePath = z.infer<typeof menuItemNullablePathSchema>;
|
|
22
|
+
declare const menuItemSalesPricePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
23
|
+
type MenuItemSalesPricePath = z.infer<typeof menuItemSalesPricePathSchema>;
|
|
24
|
+
declare const menuItemSalesPriceNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
25
|
+
type MenuItemSalesPriceNullablePath = z.infer<typeof menuItemSalesPriceNullablePathSchema>;
|
|
26
|
+
declare const menuItemCategoryPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
27
|
+
type MenuItemCategoryPath = z.infer<typeof menuItemCategoryPathSchema>;
|
|
28
|
+
declare const menuItemCategoryNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
29
|
+
type MenuItemCategoryNullablePath = z.infer<typeof menuItemCategoryNullablePathSchema>;
|
|
30
|
+
declare const menuItemModifierPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
31
|
+
type MenuItemModifierPath = z.infer<typeof menuItemModifierPathSchema>;
|
|
32
|
+
declare const menuItemModifierNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
33
|
+
type MenuItemModifierNullablePath = z.infer<typeof menuItemModifierNullablePathSchema>;
|
|
34
|
+
declare const menuItemPriceOverridePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
35
|
+
type MenuItemPriceOverridePath = z.infer<typeof menuItemPriceOverridePathSchema>;
|
|
36
|
+
declare const menuItemPriceOverrideNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
37
|
+
type MenuItemPriceOverrideNullablePath = z.infer<typeof menuItemPriceOverrideNullablePathSchema>;
|
|
38
|
+
declare const menuItemPriceOverrideSalesPricePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
39
|
+
type MenuItemPriceOverrideSalesPricePath = z.infer<typeof menuItemPriceOverrideSalesPricePathSchema>;
|
|
40
|
+
declare const menuItemPriceOverrideSalesPriceNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
41
|
+
type MenuItemPriceOverrideSalesPriceNullablePath = z.infer<typeof menuItemPriceOverrideSalesPriceNullablePathSchema>;
|
|
42
|
+
|
|
43
|
+
export { type MenuChannel, type MenuItemAllergen, type MenuItemCategoryNullablePath, type MenuItemCategoryPath, type MenuItemDiet, type MenuItemModifierNullablePath, type MenuItemModifierPath, type MenuItemNullablePath, type MenuItemPath, type MenuItemPriceOverrideNullablePath, type MenuItemPriceOverridePath, type MenuItemPriceOverrideSalesPriceNullablePath, type MenuItemPriceOverrideSalesPricePath, type MenuItemPriceOverrideType, type MenuItemSalesPriceNullablePath, type MenuItemSalesPricePath, type MenuItemType, menuChannelSchema, menuChannels, menuItemAllergenSchema, menuItemAllergens, menuItemCategoryNullablePathSchema, menuItemCategoryPathSchema, menuItemDietSchema, menuItemDiets, menuItemModifierNullablePathSchema, menuItemModifierPathSchema, menuItemNullablePathSchema, menuItemPathSchema, menuItemPriceOverrideNullablePathSchema, menuItemPriceOverridePathSchema, menuItemPriceOverrideSalesPriceNullablePathSchema, menuItemPriceOverrideSalesPricePathSchema, menuItemPriceOverrideTypeSchema, menuItemPriceOverrideTypes, menuItemSalesPriceNullablePathSchema, menuItemSalesPricePathSchema, menuItemTypeSchema, menuItemTypes };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const menuChannels: readonly ["application", "ecommerce", "deliveroo", "justeat", "glovo"];
|
|
4
|
+
declare const menuChannelSchema: z.ZodEnum<["application", "ecommerce", "deliveroo", "justeat", "glovo"]>;
|
|
5
|
+
type MenuChannel = z.infer<typeof menuChannelSchema>;
|
|
6
|
+
declare const menuItemAllergens: readonly ["peanuts-and-derivatives", "crustaceans", "nuts", "gluten", "milk-and-derivatives", "lupins", "molluscs", "mustard", "fish", "celery", "sesame", "sulfur-dioxide", "soy", "eggs-and-derivatives", "mushrooms"];
|
|
7
|
+
declare const menuItemAllergenSchema: z.ZodEnum<["peanuts-and-derivatives", "crustaceans", "nuts", "gluten", "milk-and-derivatives", "lupins", "molluscs", "mustard", "fish", "celery", "sesame", "sulfur-dioxide", "soy", "eggs-and-derivatives", "mushrooms"]>;
|
|
8
|
+
type MenuItemAllergen = z.infer<typeof menuItemAllergenSchema>;
|
|
9
|
+
declare const menuItemDiets: readonly ["pending", "confirmed", "rejected"];
|
|
10
|
+
declare const menuItemDietSchema: z.ZodEnum<["pending", "confirmed", "rejected"]>;
|
|
11
|
+
type MenuItemDiet = z.infer<typeof menuItemDietSchema>;
|
|
12
|
+
declare const menuItemPriceOverrideTypes: readonly ["ITEM", "MODIFIER"];
|
|
13
|
+
declare const menuItemPriceOverrideTypeSchema: z.ZodEnum<["ITEM", "MODIFIER"]>;
|
|
14
|
+
type MenuItemPriceOverrideType = z.infer<typeof menuItemPriceOverrideTypeSchema>;
|
|
15
|
+
declare const menuItemTypes: readonly ["ITEM", "CHOICE", "BUNDLE"];
|
|
16
|
+
declare const menuItemTypeSchema: z.ZodEnum<["ITEM", "CHOICE", "BUNDLE"]>;
|
|
17
|
+
type MenuItemType = z.infer<typeof menuItemTypeSchema>;
|
|
18
|
+
declare const menuItemPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
19
|
+
type MenuItemPath = z.infer<typeof menuItemPathSchema>;
|
|
20
|
+
declare const menuItemNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
21
|
+
type MenuItemNullablePath = z.infer<typeof menuItemNullablePathSchema>;
|
|
22
|
+
declare const menuItemSalesPricePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
23
|
+
type MenuItemSalesPricePath = z.infer<typeof menuItemSalesPricePathSchema>;
|
|
24
|
+
declare const menuItemSalesPriceNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
25
|
+
type MenuItemSalesPriceNullablePath = z.infer<typeof menuItemSalesPriceNullablePathSchema>;
|
|
26
|
+
declare const menuItemCategoryPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
27
|
+
type MenuItemCategoryPath = z.infer<typeof menuItemCategoryPathSchema>;
|
|
28
|
+
declare const menuItemCategoryNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
29
|
+
type MenuItemCategoryNullablePath = z.infer<typeof menuItemCategoryNullablePathSchema>;
|
|
30
|
+
declare const menuItemModifierPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
31
|
+
type MenuItemModifierPath = z.infer<typeof menuItemModifierPathSchema>;
|
|
32
|
+
declare const menuItemModifierNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
33
|
+
type MenuItemModifierNullablePath = z.infer<typeof menuItemModifierNullablePathSchema>;
|
|
34
|
+
declare const menuItemPriceOverridePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
35
|
+
type MenuItemPriceOverridePath = z.infer<typeof menuItemPriceOverridePathSchema>;
|
|
36
|
+
declare const menuItemPriceOverrideNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
37
|
+
type MenuItemPriceOverrideNullablePath = z.infer<typeof menuItemPriceOverrideNullablePathSchema>;
|
|
38
|
+
declare const menuItemPriceOverrideSalesPricePathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
39
|
+
type MenuItemPriceOverrideSalesPricePath = z.infer<typeof menuItemPriceOverrideSalesPricePathSchema>;
|
|
40
|
+
declare const menuItemPriceOverrideSalesPriceNullablePathSchema: z.ZodEffects<z.ZodNullable<z.ZodString>, string | null, string | null>;
|
|
41
|
+
type MenuItemPriceOverrideSalesPriceNullablePath = z.infer<typeof menuItemPriceOverrideSalesPriceNullablePathSchema>;
|
|
42
|
+
|
|
43
|
+
export { type MenuChannel, type MenuItemAllergen, type MenuItemCategoryNullablePath, type MenuItemCategoryPath, type MenuItemDiet, type MenuItemModifierNullablePath, type MenuItemModifierPath, type MenuItemNullablePath, type MenuItemPath, type MenuItemPriceOverrideNullablePath, type MenuItemPriceOverridePath, type MenuItemPriceOverrideSalesPriceNullablePath, type MenuItemPriceOverrideSalesPricePath, type MenuItemPriceOverrideType, type MenuItemSalesPriceNullablePath, type MenuItemSalesPricePath, type MenuItemType, menuChannelSchema, menuChannels, menuItemAllergenSchema, menuItemAllergens, menuItemCategoryNullablePathSchema, menuItemCategoryPathSchema, menuItemDietSchema, menuItemDiets, menuItemModifierNullablePathSchema, menuItemModifierPathSchema, menuItemNullablePathSchema, menuItemPathSchema, menuItemPriceOverrideNullablePathSchema, menuItemPriceOverridePathSchema, menuItemPriceOverrideSalesPriceNullablePathSchema, menuItemPriceOverrideSalesPricePathSchema, menuItemPriceOverrideTypeSchema, menuItemPriceOverrideTypes, menuItemSalesPriceNullablePathSchema, menuItemSalesPricePathSchema, menuItemTypeSchema, menuItemTypes };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// src/types.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var menuChannels = ["application", "ecommerce", "deliveroo", "justeat", "glovo"];
|
|
4
|
+
var menuChannelSchema = z.enum(menuChannels);
|
|
5
|
+
var menuItemAllergens = [
|
|
6
|
+
"peanuts-and-derivatives",
|
|
7
|
+
"crustaceans",
|
|
8
|
+
"nuts",
|
|
9
|
+
"gluten",
|
|
10
|
+
"milk-and-derivatives",
|
|
11
|
+
"lupins",
|
|
12
|
+
"molluscs",
|
|
13
|
+
"mustard",
|
|
14
|
+
"fish",
|
|
15
|
+
"celery",
|
|
16
|
+
"sesame",
|
|
17
|
+
"sulfur-dioxide",
|
|
18
|
+
"soy",
|
|
19
|
+
"eggs-and-derivatives",
|
|
20
|
+
"mushrooms"
|
|
21
|
+
];
|
|
22
|
+
var menuItemAllergenSchema = z.enum(menuItemAllergens);
|
|
23
|
+
var menuItemDiets = ["pending", "confirmed", "rejected"];
|
|
24
|
+
var menuItemDietSchema = z.enum(menuItemDiets);
|
|
25
|
+
var menuItemPriceOverrideTypes = ["ITEM", "MODIFIER"];
|
|
26
|
+
var menuItemPriceOverrideTypeSchema = z.enum(menuItemPriceOverrideTypes);
|
|
27
|
+
var menuItemTypes = ["ITEM", "CHOICE", "BUNDLE"];
|
|
28
|
+
var menuItemTypeSchema = z.enum(menuItemTypes);
|
|
29
|
+
var menuItemPathSchema = z.string().refine((val) => /^\/menu_items\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
30
|
+
message: "Invalid menu item path format"
|
|
31
|
+
});
|
|
32
|
+
var menuItemNullablePathSchema = z.string().nullable().refine(
|
|
33
|
+
(val) => {
|
|
34
|
+
if (!val) return true;
|
|
35
|
+
return /^\/menu_items\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
message: "Invalid menu item path format"
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
var menuItemSalesPricePathSchema = z.string().refine((val) => /^\/menu_items\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
42
|
+
message: "Invalid menu item sales price path format"
|
|
43
|
+
});
|
|
44
|
+
var menuItemSalesPriceNullablePathSchema = z.string().nullable().refine(
|
|
45
|
+
(val) => {
|
|
46
|
+
if (!val) return true;
|
|
47
|
+
return /^\/menu_items\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
message: "Invalid menu item sales price path format"
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
var menuItemCategoryPathSchema = z.string().refine((val) => /^\/menu_item_categories\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
54
|
+
message: "Invalid menu item category path format"
|
|
55
|
+
});
|
|
56
|
+
var menuItemCategoryNullablePathSchema = z.string().nullable().refine(
|
|
57
|
+
(val) => {
|
|
58
|
+
if (!val) return true;
|
|
59
|
+
return /^\/menu_item_categories\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
message: "Invalid menu item category path format"
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
var menuItemModifierPathSchema = z.string().refine((val) => /^\/menu_item_modifiers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
66
|
+
message: "Invalid menu item modifier format"
|
|
67
|
+
});
|
|
68
|
+
var menuItemModifierNullablePathSchema = z.string().nullable().refine(
|
|
69
|
+
(val) => {
|
|
70
|
+
if (!val) return true;
|
|
71
|
+
return /^\/menu_item_modifiers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
message: "Invalid menu item modifier format"
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
var menuItemPriceOverridePathSchema = z.string().refine((val) => /^\/menu_item_price_overrides\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
78
|
+
message: "Invalid menu item price override path format"
|
|
79
|
+
});
|
|
80
|
+
var menuItemPriceOverrideNullablePathSchema = z.string().nullable().refine(
|
|
81
|
+
(val) => {
|
|
82
|
+
if (!val) return true;
|
|
83
|
+
return /^\/menu_item_price_overrides\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
message: "Invalid menu item price override path format"
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
var menuItemPriceOverrideSalesPricePathSchema = z.string().refine(
|
|
90
|
+
(val) => /^\/menu_item_price_overrides\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val),
|
|
91
|
+
{
|
|
92
|
+
message: "Invalid menu item price override sales price path format"
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
var menuItemPriceOverrideSalesPriceNullablePathSchema = z.string().nullable().refine(
|
|
96
|
+
(val) => {
|
|
97
|
+
if (!val) return true;
|
|
98
|
+
return /^\/menu_item_price_overrides\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val);
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
message: "Invalid menu item price override sales price path format"
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
export {
|
|
105
|
+
menuChannelSchema,
|
|
106
|
+
menuChannels,
|
|
107
|
+
menuItemAllergenSchema,
|
|
108
|
+
menuItemAllergens,
|
|
109
|
+
menuItemCategoryNullablePathSchema,
|
|
110
|
+
menuItemCategoryPathSchema,
|
|
111
|
+
menuItemDietSchema,
|
|
112
|
+
menuItemDiets,
|
|
113
|
+
menuItemModifierNullablePathSchema,
|
|
114
|
+
menuItemModifierPathSchema,
|
|
115
|
+
menuItemNullablePathSchema,
|
|
116
|
+
menuItemPathSchema,
|
|
117
|
+
menuItemPriceOverrideNullablePathSchema,
|
|
118
|
+
menuItemPriceOverridePathSchema,
|
|
119
|
+
menuItemPriceOverrideSalesPriceNullablePathSchema,
|
|
120
|
+
menuItemPriceOverrideSalesPricePathSchema,
|
|
121
|
+
menuItemPriceOverrideTypeSchema,
|
|
122
|
+
menuItemPriceOverrideTypes,
|
|
123
|
+
menuItemSalesPriceNullablePathSchema,
|
|
124
|
+
menuItemSalesPricePathSchema,
|
|
125
|
+
menuItemTypeSchema,
|
|
126
|
+
menuItemTypes
|
|
127
|
+
};
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// eslint.config.js per @typescript-eslint v8
|
|
3
|
+
import js from '@eslint/js'
|
|
4
|
+
import prettier from 'eslint-config-prettier'
|
|
5
|
+
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'
|
|
6
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
7
|
+
import tsParser from '@typescript-eslint/parser'
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
js.configs.recommended,
|
|
11
|
+
{
|
|
12
|
+
files: ['**/*.ts'],
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parser: tsParser,
|
|
15
|
+
globals: {
|
|
16
|
+
process: 'readonly',
|
|
17
|
+
fetch: 'readonly',
|
|
18
|
+
Request: 'readonly',
|
|
19
|
+
Response: 'readonly',
|
|
20
|
+
Headers: 'readonly',
|
|
21
|
+
},
|
|
22
|
+
parserOptions: {
|
|
23
|
+
project: ['./tsconfig.json'],
|
|
24
|
+
tsconfigRootDir: process.cwd(),
|
|
25
|
+
sourceType: 'module',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
plugins: {
|
|
29
|
+
'@typescript-eslint': tsPlugin,
|
|
30
|
+
'simple-import-sort': simpleImportSortPlugin,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
'simple-import-sort/imports': 'error',
|
|
34
|
+
'simple-import-sort/exports': 'error',
|
|
35
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
prettier,
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
export const ignores = ['dist', 'node_modules']
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deliverart/sdk-js-menu",
|
|
3
|
+
"description": "Deliverart JavaScript SDK for Menu Management",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@deliverart/sdk-js-core": "0.1.3",
|
|
16
|
+
"@deliverart/sdk-js-global-types": "0.0.15",
|
|
17
|
+
"axios": "1.9.0",
|
|
18
|
+
"zod": "3.25.67"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@changesets/cli": "^2.29.4",
|
|
22
|
+
"@eslint/js": "9.28.0",
|
|
23
|
+
"@types/node": "22.15.30",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "8.33.1",
|
|
25
|
+
"@typescript-eslint/parser": "8.33.1",
|
|
26
|
+
"eslint": "9.28.0",
|
|
27
|
+
"eslint-config-prettier": "10.1.5",
|
|
28
|
+
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
29
|
+
"prettier": "3.5.3",
|
|
30
|
+
"tsup": "8.5.0",
|
|
31
|
+
"typescript": "5.8.3"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsup src/index.ts --dts --format esm,cjs",
|
|
38
|
+
"dev": "tsup src/index.ts --dts --watch",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"lint:fix": "eslint . --fix",
|
|
41
|
+
"prettier": "prettier --check .",
|
|
42
|
+
"prettier:fix": "prettier --write .",
|
|
43
|
+
"version": "@changesets/cli version",
|
|
44
|
+
"release": "@changesets/cli publish"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types'
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const menuChannels = ['application', 'ecommerce', 'deliveroo', 'justeat', 'glovo'] as const
|
|
4
|
+
export const menuChannelSchema = z.enum(menuChannels)
|
|
5
|
+
export type MenuChannel = z.infer<typeof menuChannelSchema>
|
|
6
|
+
|
|
7
|
+
export const menuItemAllergens = [
|
|
8
|
+
'peanuts-and-derivatives',
|
|
9
|
+
'crustaceans',
|
|
10
|
+
'nuts',
|
|
11
|
+
'gluten',
|
|
12
|
+
'milk-and-derivatives',
|
|
13
|
+
'lupins',
|
|
14
|
+
'molluscs',
|
|
15
|
+
'mustard',
|
|
16
|
+
'fish',
|
|
17
|
+
'celery',
|
|
18
|
+
'sesame',
|
|
19
|
+
'sulfur-dioxide',
|
|
20
|
+
'soy',
|
|
21
|
+
'eggs-and-derivatives',
|
|
22
|
+
'mushrooms',
|
|
23
|
+
] as const
|
|
24
|
+
export const menuItemAllergenSchema = z.enum(menuItemAllergens)
|
|
25
|
+
export type MenuItemAllergen = z.infer<typeof menuItemAllergenSchema>
|
|
26
|
+
|
|
27
|
+
export const menuItemDiets = ['pending', 'confirmed', 'rejected'] as const
|
|
28
|
+
export const menuItemDietSchema = z.enum(menuItemDiets)
|
|
29
|
+
export type MenuItemDiet = z.infer<typeof menuItemDietSchema>
|
|
30
|
+
|
|
31
|
+
export const menuItemPriceOverrideTypes = ['ITEM', 'MODIFIER'] as const
|
|
32
|
+
export const menuItemPriceOverrideTypeSchema = z.enum(menuItemPriceOverrideTypes)
|
|
33
|
+
export type MenuItemPriceOverrideType = z.infer<typeof menuItemPriceOverrideTypeSchema>
|
|
34
|
+
|
|
35
|
+
export const menuItemTypes = ['ITEM', 'CHOICE', 'BUNDLE'] as const
|
|
36
|
+
export const menuItemTypeSchema = z.enum(menuItemTypes)
|
|
37
|
+
export type MenuItemType = z.infer<typeof menuItemTypeSchema>
|
|
38
|
+
|
|
39
|
+
export const menuItemPathSchema = z
|
|
40
|
+
.string()
|
|
41
|
+
.refine(val => /^\/menu_items\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
42
|
+
message: 'Invalid menu item path format',
|
|
43
|
+
})
|
|
44
|
+
export type MenuItemPath = z.infer<typeof menuItemPathSchema>
|
|
45
|
+
|
|
46
|
+
export const menuItemNullablePathSchema = z
|
|
47
|
+
.string()
|
|
48
|
+
.nullable()
|
|
49
|
+
.refine(
|
|
50
|
+
val => {
|
|
51
|
+
if (!val) return true
|
|
52
|
+
return /^\/menu_items\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
message: 'Invalid menu item path format',
|
|
56
|
+
},
|
|
57
|
+
)
|
|
58
|
+
export type MenuItemNullablePath = z.infer<typeof menuItemNullablePathSchema>
|
|
59
|
+
|
|
60
|
+
export const menuItemSalesPricePathSchema = z
|
|
61
|
+
.string()
|
|
62
|
+
.refine(val => /^\/menu_items\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
63
|
+
message: 'Invalid menu item sales price path format',
|
|
64
|
+
})
|
|
65
|
+
export type MenuItemSalesPricePath = z.infer<typeof menuItemSalesPricePathSchema>
|
|
66
|
+
|
|
67
|
+
export const menuItemSalesPriceNullablePathSchema = z
|
|
68
|
+
.string()
|
|
69
|
+
.nullable()
|
|
70
|
+
.refine(
|
|
71
|
+
val => {
|
|
72
|
+
if (!val) return true
|
|
73
|
+
return /^\/menu_items\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
message: 'Invalid menu item sales price path format',
|
|
77
|
+
},
|
|
78
|
+
)
|
|
79
|
+
export type MenuItemSalesPriceNullablePath = z.infer<typeof menuItemSalesPriceNullablePathSchema>
|
|
80
|
+
|
|
81
|
+
export const menuItemCategoryPathSchema = z
|
|
82
|
+
.string()
|
|
83
|
+
.refine(val => /^\/menu_item_categories\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
84
|
+
message: 'Invalid menu item category path format',
|
|
85
|
+
})
|
|
86
|
+
export type MenuItemCategoryPath = z.infer<typeof menuItemCategoryPathSchema>
|
|
87
|
+
|
|
88
|
+
export const menuItemCategoryNullablePathSchema = z
|
|
89
|
+
.string()
|
|
90
|
+
.nullable()
|
|
91
|
+
.refine(
|
|
92
|
+
val => {
|
|
93
|
+
if (!val) return true
|
|
94
|
+
return /^\/menu_item_categories\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
message: 'Invalid menu item category path format',
|
|
98
|
+
},
|
|
99
|
+
)
|
|
100
|
+
export type MenuItemCategoryNullablePath = z.infer<typeof menuItemCategoryNullablePathSchema>
|
|
101
|
+
|
|
102
|
+
export const menuItemModifierPathSchema = z
|
|
103
|
+
.string()
|
|
104
|
+
.refine(val => /^\/menu_item_modifiers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
105
|
+
message: 'Invalid menu item modifier format',
|
|
106
|
+
})
|
|
107
|
+
export type MenuItemModifierPath = z.infer<typeof menuItemModifierPathSchema>
|
|
108
|
+
|
|
109
|
+
export const menuItemModifierNullablePathSchema = z
|
|
110
|
+
.string()
|
|
111
|
+
.nullable()
|
|
112
|
+
.refine(
|
|
113
|
+
val => {
|
|
114
|
+
if (!val) return true
|
|
115
|
+
return /^\/menu_item_modifiers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
message: 'Invalid menu item modifier format',
|
|
119
|
+
},
|
|
120
|
+
)
|
|
121
|
+
export type MenuItemModifierNullablePath = z.infer<typeof menuItemModifierNullablePathSchema>
|
|
122
|
+
|
|
123
|
+
export const menuItemPriceOverridePathSchema = z
|
|
124
|
+
.string()
|
|
125
|
+
.refine(val => /^\/menu_item_price_overrides\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
126
|
+
message: 'Invalid menu item price override path format',
|
|
127
|
+
})
|
|
128
|
+
export type MenuItemPriceOverridePath = z.infer<typeof menuItemPriceOverridePathSchema>
|
|
129
|
+
|
|
130
|
+
export const menuItemPriceOverrideNullablePathSchema = z
|
|
131
|
+
.string()
|
|
132
|
+
.nullable()
|
|
133
|
+
.refine(
|
|
134
|
+
val => {
|
|
135
|
+
if (!val) return true
|
|
136
|
+
return /^\/menu_item_price_overrides\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
message: 'Invalid menu item price override path format',
|
|
140
|
+
},
|
|
141
|
+
)
|
|
142
|
+
export type MenuItemPriceOverrideNullablePath = z.infer<
|
|
143
|
+
typeof menuItemPriceOverrideNullablePathSchema
|
|
144
|
+
>
|
|
145
|
+
|
|
146
|
+
export const menuItemPriceOverrideSalesPricePathSchema = z
|
|
147
|
+
.string()
|
|
148
|
+
.refine(
|
|
149
|
+
val => /^\/menu_item_price_overrides\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val),
|
|
150
|
+
{
|
|
151
|
+
message: 'Invalid menu item price override sales price path format',
|
|
152
|
+
},
|
|
153
|
+
)
|
|
154
|
+
export type MenuItemPriceOverrideSalesPricePath = z.infer<
|
|
155
|
+
typeof menuItemPriceOverrideSalesPricePathSchema
|
|
156
|
+
>
|
|
157
|
+
|
|
158
|
+
export const menuItemPriceOverrideSalesPriceNullablePathSchema = z
|
|
159
|
+
.string()
|
|
160
|
+
.nullable()
|
|
161
|
+
.refine(
|
|
162
|
+
val => {
|
|
163
|
+
if (!val) return true
|
|
164
|
+
return /^\/menu_item_price_overrides\/sales_prices\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
message: 'Invalid menu item price override sales price path format',
|
|
168
|
+
},
|
|
169
|
+
)
|
|
170
|
+
export type MenuItemPriceOverrideSalesPriceNullablePath = z.infer<
|
|
171
|
+
typeof menuItemPriceOverrideSalesPriceNullablePathSchema
|
|
172
|
+
>
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"outDir": "dist",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"declarationMap": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"]
|
|
15
|
+
}
|