@unchainedshop/api 4.8.3 → 5.0.0-alpha.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.
Files changed (109) hide show
  1. package/lib/acl.js +30 -3
  2. package/lib/api-index.d.ts +3 -1
  3. package/lib/chat/generateImageHandler.js +6 -5
  4. package/lib/context.d.ts +4 -1
  5. package/lib/context.js +9 -3
  6. package/lib/events.d.ts +2 -0
  7. package/lib/events.js +2 -0
  8. package/lib/express/createMCPMiddleware.js +1 -1
  9. package/lib/express/index.d.ts +6 -9
  10. package/lib/express/index.js +52 -125
  11. package/lib/fastify/index.d.ts +6 -9
  12. package/lib/fastify/index.js +51 -117
  13. package/lib/fastify/mcpHandler.js +1 -1
  14. package/lib/loaders/buildTextMap.js +15 -13
  15. package/lib/locale-context.d.ts +4 -2
  16. package/lib/locale-context.js +2 -6
  17. package/lib/mcp/tools/assortment/assortmentManagement.d.ts +2 -2
  18. package/lib/mcp/tools/assortment/assortmentManagement.js +2 -2
  19. package/lib/mcp/tools/assortment/handlers/getAssortment.js +1 -1
  20. package/lib/mcp/tools/assortment/schemas.d.ts +322 -141
  21. package/lib/mcp/tools/assortment/schemas.js +179 -96
  22. package/lib/mcp/tools/filter/filterManagement.d.ts +2 -2
  23. package/lib/mcp/tools/filter/filterManagement.js +2 -2
  24. package/lib/mcp/tools/filter/schemas.d.ts +184 -75
  25. package/lib/mcp/tools/filter/schemas.js +87 -51
  26. package/lib/mcp/tools/localization/getLocalizationsConfig.d.ts +1 -1
  27. package/lib/mcp/tools/localization/localizationManagement.d.ts +2 -2
  28. package/lib/mcp/tools/localization/localizationManagement.js +2 -2
  29. package/lib/mcp/tools/localization/schemas.d.ts +144 -47
  30. package/lib/mcp/tools/localization/schemas.js +51 -36
  31. package/lib/mcp/tools/order/handlers/getTopCustomers.d.ts +2 -0
  32. package/lib/mcp/tools/order/orderManagement.d.ts +2 -2
  33. package/lib/mcp/tools/order/orderManagement.js +2 -2
  34. package/lib/mcp/tools/order/schemas.d.ts +184 -75
  35. package/lib/mcp/tools/order/schemas.js +113 -51
  36. package/lib/mcp/tools/product/handlers/getProduct.js +1 -1
  37. package/lib/mcp/tools/product/productManagement.d.ts +2 -2
  38. package/lib/mcp/tools/product/productManagement.js +2 -2
  39. package/lib/mcp/tools/product/schemas.d.ts +642 -317
  40. package/lib/mcp/tools/product/schemas.js +287 -191
  41. package/lib/mcp/tools/provider/providerManagement.d.ts +2 -2
  42. package/lib/mcp/tools/provider/providerManagement.js +2 -2
  43. package/lib/mcp/tools/provider/schemas.d.ts +142 -47
  44. package/lib/mcp/tools/provider/schemas.js +67 -32
  45. package/lib/mcp/tools/quotation/handlers/getQuotation.d.ts +2 -0
  46. package/lib/mcp/tools/quotation/handlers/listQuotations.d.ts +2 -0
  47. package/lib/mcp/tools/quotation/handlers/makeQuotationProposal.d.ts +2 -0
  48. package/lib/mcp/tools/quotation/handlers/rejectQuotation.d.ts +2 -0
  49. package/lib/mcp/tools/quotation/handlers/verifyQuotation.d.ts +2 -0
  50. package/lib/mcp/tools/quotation/quotationManagement.d.ts +2 -2
  51. package/lib/mcp/tools/quotation/quotationManagement.js +2 -2
  52. package/lib/mcp/tools/quotation/schemas.d.ts +111 -40
  53. package/lib/mcp/tools/quotation/schemas.js +54 -29
  54. package/lib/mcp/tools/system/handlers/countEvents.d.ts +8 -1
  55. package/lib/mcp/tools/system/handlers/countWork.d.ts +10 -1
  56. package/lib/mcp/tools/system/handlers/countWork.js +1 -0
  57. package/lib/mcp/tools/system/handlers/index.d.ts +4 -4
  58. package/lib/mcp/tools/system/handlers/listEvents.d.ts +12 -1
  59. package/lib/mcp/tools/system/handlers/listWork.d.ts +14 -1
  60. package/lib/mcp/tools/system/handlers/listWork.js +1 -0
  61. package/lib/mcp/tools/system/schemas.d.ts +179 -84
  62. package/lib/mcp/tools/system/schemas.js +188 -67
  63. package/lib/mcp/tools/system/systemManagement.d.ts +1 -1
  64. package/lib/mcp/tools/system/systemManagement.js +1 -1
  65. package/lib/mcp/tools/users/handlers/addUserEmail.d.ts +2 -0
  66. package/lib/mcp/tools/users/handlers/createUser.d.ts +2 -0
  67. package/lib/mcp/tools/users/handlers/enrollUser.d.ts +2 -0
  68. package/lib/mcp/tools/users/handlers/getCurrentUser.d.ts +2 -0
  69. package/lib/mcp/tools/users/handlers/getUser.d.ts +2 -0
  70. package/lib/mcp/tools/users/handlers/listUsers.d.ts +2 -0
  71. package/lib/mcp/tools/users/handlers/setUserTags.d.ts +2 -0
  72. package/lib/mcp/tools/users/handlers/setUserUsername.d.ts +2 -0
  73. package/lib/mcp/tools/users/handlers/updateUser.d.ts +2 -0
  74. package/lib/mcp/tools/users/schemas.d.ts +296 -163
  75. package/lib/mcp/tools/users/schemas.js +152 -71
  76. package/lib/mcp/tools/users/usersManagement.d.ts +2 -2
  77. package/lib/mcp/tools/users/usersManagement.js +2 -2
  78. package/lib/mcp/utils/getNormalizedQuotationDetails.d.ts +2 -0
  79. package/lib/mcp/utils/getNormalizedUserDetails.d.ts +2 -0
  80. package/lib/mcp/utils/normalizeMediaUrl.js +1 -1
  81. package/lib/mcp/utils/sanitizeLocalizationEntityData.d.ts +1 -1
  82. package/lib/mcp/utils/sharedSchemas.d.ts +28 -39
  83. package/lib/mcp/utils/sharedSchemas.js +28 -47
  84. package/lib/mcp/utils/validateIsoCode.d.ts +1 -1
  85. package/lib/resolvers/mutations/accounts/changePassword.js +1 -2
  86. package/lib/resolvers/mutations/index.d.ts +1 -6
  87. package/lib/resolvers/mutations/index.js +2 -12
  88. package/lib/resolvers/mutations/orders/updateCart.js +7 -1
  89. package/lib/resolvers/mutations/users/setRoles.d.ts +1 -1
  90. package/lib/resolvers/mutations/users/setRoles.js +8 -1
  91. package/lib/resolvers/queries/events/registeredEventTypes.d.ts +1 -1
  92. package/lib/resolvers/queries/events/registeredEventTypes.js +1 -1
  93. package/lib/resolvers/queries/index.d.ts +1 -1
  94. package/lib/resolvers/queries/index.js +1 -1
  95. package/lib/resolvers/type/index.d.ts +0 -1
  96. package/lib/resolvers/type/login-method-response-types.js +2 -1
  97. package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts +0 -1
  98. package/lib/resolvers/type/order/order-delivery-pickup-types.js +0 -7
  99. package/lib/resolvers/type/shop-types.js +1 -1
  100. package/lib/resolvers/type/user-types.js +3 -3
  101. package/lib/roles/all.js +5 -3
  102. package/lib/roles/index.d.ts +4 -11
  103. package/lib/roles/index.js +16 -11
  104. package/lib/roles/loggedIn.js +2 -0
  105. package/lib/schema/mutation.js +6 -44
  106. package/lib/schema/query.js +5 -5
  107. package/lib/schema/types/index.js +2 -2
  108. package/lib/schema/types/order/delivery.js +0 -2
  109. package/package.json +13 -23
@@ -1,85 +1,119 @@
1
- import { z } from 'zod/v4-mini';
1
+ import { z } from 'zod';
2
2
  import { SortDirection } from '@unchainedshop/utils';
3
+ export type LocalizationType = 'COUNTRY' | 'CURRENCY' | 'LANGUAGE';
4
+ export interface LocalizationModuleConfig {
5
+ module: any;
6
+ NotFoundError: any;
7
+ entityName: string;
8
+ idField: string;
9
+ existsMethod: any;
10
+ findMethod: any;
11
+ findMultipleMethod: any;
12
+ }
13
+ export interface LocalizationEntity {
14
+ isoCode: string;
15
+ contractAddress?: string;
16
+ decimals?: number;
17
+ }
18
+ export interface LocalizationUpdateEntity {
19
+ isoCode?: string;
20
+ contractAddress?: string;
21
+ decimals?: number;
22
+ }
23
+ export interface LocalizationListOptions {
24
+ limit?: number;
25
+ offset?: number;
26
+ includeInactive?: boolean;
27
+ queryString?: string;
28
+ sort?: {
29
+ key: string;
30
+ value: 'ASC' | 'DESC';
31
+ }[];
32
+ }
33
+ export interface LocalizationCountOptions {
34
+ includeInactive?: boolean;
35
+ queryString?: string;
36
+ }
3
37
  export declare const sortDirectionKeys: [keyof typeof SortDirection, ...(keyof typeof SortDirection)[]];
4
- export declare const LocalizationTypeEnum: z.ZodMiniEnum<{
38
+ export declare const LocalizationTypeEnum: z.ZodEnum<{
5
39
  COUNTRY: "COUNTRY";
6
40
  CURRENCY: "CURRENCY";
7
41
  LANGUAGE: "LANGUAGE";
8
42
  }>;
9
- export declare const LocalizationEntitySchema: z.ZodMiniObject<{
10
- isoCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
11
- isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
12
- defaultCurrencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
13
- contractAddress: z.ZodMiniOptional<z.ZodMiniString<string>>;
14
- decimals: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
43
+ export declare const LocalizationEntitySchema: z.ZodObject<{
44
+ isoCode: z.ZodOptional<z.ZodString>;
45
+ isActive: z.ZodOptional<z.ZodBoolean>;
46
+ defaultCurrencyCode: z.ZodOptional<z.ZodString>;
47
+ contractAddress: z.ZodOptional<z.ZodString>;
48
+ decimals: z.ZodOptional<z.ZodNumber>;
15
49
  }, z.core.$strip>;
16
50
  export declare const actionValidators: {
17
- readonly CREATE: z.ZodMiniObject<{
18
- localizationType: z.ZodMiniEnum<{
51
+ readonly CREATE: z.ZodObject<{
52
+ localizationType: z.ZodEnum<{
19
53
  COUNTRY: "COUNTRY";
20
54
  CURRENCY: "CURRENCY";
21
55
  LANGUAGE: "LANGUAGE";
22
56
  }>;
23
- entity: z.ZodMiniObject<{
24
- isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
25
- defaultCurrencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
26
- contractAddress: z.ZodMiniOptional<z.ZodMiniString<string>>;
27
- decimals: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
28
- isoCode: z.ZodMiniString<string>;
57
+ entity: z.ZodObject<{
58
+ isActive: z.ZodOptional<z.ZodBoolean>;
59
+ defaultCurrencyCode: z.ZodOptional<z.ZodString>;
60
+ contractAddress: z.ZodOptional<z.ZodString>;
61
+ decimals: z.ZodOptional<z.ZodNumber>;
62
+ isoCode: z.ZodString;
29
63
  }, z.core.$strip>;
30
64
  }, z.core.$strip>;
31
- readonly UPDATE: z.ZodMiniObject<{
32
- localizationType: z.ZodMiniEnum<{
65
+ readonly UPDATE: z.ZodObject<{
66
+ localizationType: z.ZodEnum<{
33
67
  COUNTRY: "COUNTRY";
34
68
  CURRENCY: "CURRENCY";
35
69
  LANGUAGE: "LANGUAGE";
36
70
  }>;
37
- entityId: z.ZodMiniString<string>;
38
- entity: z.ZodMiniObject<{
39
- isoCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
40
- isActive: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
41
- defaultCurrencyCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
42
- contractAddress: z.ZodMiniOptional<z.ZodMiniString<string>>;
43
- decimals: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
71
+ entityId: z.ZodString;
72
+ entity: z.ZodObject<{
73
+ isoCode: z.ZodOptional<z.ZodString>;
74
+ isActive: z.ZodOptional<z.ZodBoolean>;
75
+ defaultCurrencyCode: z.ZodOptional<z.ZodString>;
76
+ contractAddress: z.ZodOptional<z.ZodString>;
77
+ decimals: z.ZodOptional<z.ZodNumber>;
44
78
  }, z.core.$strip>;
45
79
  }, z.core.$strip>;
46
- readonly REMOVE: z.ZodMiniObject<{
47
- localizationType: z.ZodMiniEnum<{
80
+ readonly REMOVE: z.ZodObject<{
81
+ localizationType: z.ZodEnum<{
48
82
  COUNTRY: "COUNTRY";
49
83
  CURRENCY: "CURRENCY";
50
84
  LANGUAGE: "LANGUAGE";
51
85
  }>;
52
- entityId: z.ZodMiniString<string>;
86
+ entityId: z.ZodString;
53
87
  }, z.core.$strip>;
54
- readonly GET: z.ZodMiniObject<{
55
- localizationType: z.ZodMiniEnum<{
88
+ readonly GET: z.ZodObject<{
89
+ localizationType: z.ZodEnum<{
56
90
  COUNTRY: "COUNTRY";
57
91
  CURRENCY: "CURRENCY";
58
92
  LANGUAGE: "LANGUAGE";
59
93
  }>;
60
- entityId: z.ZodMiniString<string>;
94
+ entityId: z.ZodString;
61
95
  }, z.core.$strip>;
62
- readonly LIST: z.ZodMiniObject<{
63
- queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
64
- includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
65
- sort: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
66
- key: z.ZodMiniString<string>;
67
- value: z.ZodMiniEnum<{
96
+ readonly LIST: z.ZodObject<{
97
+ queryString: z.ZodOptional<z.ZodString>;
98
+ includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
99
+ sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
+ key: z.ZodString;
101
+ value: z.ZodEnum<{
68
102
  [x: string]: string;
69
103
  }>;
70
104
  }, z.core.$strip>>>;
71
- limit: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
72
- offset: z.ZodMiniOptional<z.ZodMiniNumberFormat>;
73
- localizationType: z.ZodMiniEnum<{
105
+ limit: z.ZodOptional<z.ZodNumber>;
106
+ offset: z.ZodOptional<z.ZodNumber>;
107
+ localizationType: z.ZodEnum<{
74
108
  COUNTRY: "COUNTRY";
75
109
  CURRENCY: "CURRENCY";
76
110
  LANGUAGE: "LANGUAGE";
77
111
  }>;
78
112
  }, z.core.$strip>;
79
- readonly COUNT: z.ZodMiniObject<{
80
- queryString: z.ZodMiniOptional<z.ZodMiniString<string>>;
81
- includeInactive: z.ZodMiniDefault<z.ZodMiniBoolean<boolean>>;
82
- localizationType: z.ZodMiniEnum<{
113
+ readonly COUNT: z.ZodObject<{
114
+ queryString: z.ZodOptional<z.ZodString>;
115
+ includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
116
+ localizationType: z.ZodEnum<{
83
117
  COUNTRY: "COUNTRY";
84
118
  CURRENCY: "CURRENCY";
85
119
  LANGUAGE: "LANGUAGE";
@@ -87,9 +121,72 @@ export declare const actionValidators: {
87
121
  }, z.core.$strip>;
88
122
  };
89
123
  export declare const LocalizationManagementSchema: {
90
- action: z.core.$ZodType<string>;
91
- } & Record<string, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
92
- export type { ManagementParams as LocalizationManagementParams } from '../../utils/sharedSchemas.ts';
124
+ queryString: z.ZodOptional<z.ZodString>;
125
+ includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
126
+ sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
127
+ key: z.ZodString;
128
+ value: z.ZodEnum<{
129
+ [x: string]: string;
130
+ }>;
131
+ }, z.core.$strip>>>;
132
+ limit: z.ZodOptional<z.ZodNumber>;
133
+ offset: z.ZodOptional<z.ZodNumber>;
134
+ action: z.ZodEnum<{
135
+ GET: "GET";
136
+ CREATE: "CREATE";
137
+ UPDATE: "UPDATE";
138
+ REMOVE: "REMOVE";
139
+ LIST: "LIST";
140
+ COUNT: "COUNT";
141
+ }>;
142
+ localizationType: z.ZodEnum<{
143
+ COUNTRY: "COUNTRY";
144
+ CURRENCY: "CURRENCY";
145
+ LANGUAGE: "LANGUAGE";
146
+ }>;
147
+ entity: z.ZodOptional<z.ZodObject<{
148
+ isoCode: z.ZodOptional<z.ZodString>;
149
+ isActive: z.ZodOptional<z.ZodBoolean>;
150
+ defaultCurrencyCode: z.ZodOptional<z.ZodString>;
151
+ contractAddress: z.ZodOptional<z.ZodString>;
152
+ decimals: z.ZodOptional<z.ZodNumber>;
153
+ }, z.core.$strip>>;
154
+ entityId: z.ZodOptional<z.ZodString>;
155
+ };
156
+ export declare const LocalizationManagementZodSchema: z.ZodObject<{
157
+ queryString: z.ZodOptional<z.ZodString>;
158
+ includeInactive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
159
+ sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
+ key: z.ZodString;
161
+ value: z.ZodEnum<{
162
+ [x: string]: string;
163
+ }>;
164
+ }, z.core.$strip>>>;
165
+ limit: z.ZodOptional<z.ZodNumber>;
166
+ offset: z.ZodOptional<z.ZodNumber>;
167
+ action: z.ZodEnum<{
168
+ GET: "GET";
169
+ CREATE: "CREATE";
170
+ UPDATE: "UPDATE";
171
+ REMOVE: "REMOVE";
172
+ LIST: "LIST";
173
+ COUNT: "COUNT";
174
+ }>;
175
+ localizationType: z.ZodEnum<{
176
+ COUNTRY: "COUNTRY";
177
+ CURRENCY: "CURRENCY";
178
+ LANGUAGE: "LANGUAGE";
179
+ }>;
180
+ entity: z.ZodOptional<z.ZodObject<{
181
+ isoCode: z.ZodOptional<z.ZodString>;
182
+ isActive: z.ZodOptional<z.ZodBoolean>;
183
+ defaultCurrencyCode: z.ZodOptional<z.ZodString>;
184
+ contractAddress: z.ZodOptional<z.ZodString>;
185
+ decimals: z.ZodOptional<z.ZodNumber>;
186
+ }, z.core.$strip>>;
187
+ entityId: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strip>;
189
+ export type LocalizationManagementParams = z.infer<typeof LocalizationManagementZodSchema>;
93
190
  export type ActionName = keyof typeof actionValidators;
94
191
  export type Params<T extends ActionName> = z.infer<(typeof actionValidators)[T]>;
95
192
  export type Handler<T extends ActionName> = (localizationModule: any, params: Params<T>) => Promise<unknown>;
@@ -1,68 +1,83 @@
1
- import { z } from 'zod/v4-mini';
1
+ import { z } from 'zod';
2
2
  import { SortDirection } from '@unchainedshop/utils';
3
- import { PaginationSchema, SortingSchema, SearchSchema, createManagementSchemaFromValidators, } from "../../utils/sharedSchemas.js";
3
+ import { PaginationSchema, SortingSchema, SearchSchema } from "../../utils/sharedSchemas.js";
4
4
  export const sortDirectionKeys = Object.keys(SortDirection);
5
5
  export const LocalizationTypeEnum = z
6
6
  .enum(['COUNTRY', 'CURRENCY', 'LANGUAGE'])
7
- .check(z.describe('Type of localization entity - COUNTRY for geographic regions (US, DE, CH), CURRENCY for monetary units (USD, EUR, CHF), LANGUAGE for locale support (en, de, fr)'));
7
+ .describe('Type of localization entity - COUNTRY for geographic regions (US, DE, CH), CURRENCY for monetary units (USD, EUR, CHF), LANGUAGE for locale support (en, de, fr)');
8
8
  export const LocalizationEntitySchema = z.object({
9
9
  isoCode: z
10
- .optional(z.string().check(z.minLength(1)))
11
- .check(z.describe('ISO identifier: Countries need 2-letter codes (US, DE), Currencies need 3-letter codes (USD, EUR), Languages accept 2-10 characters (en, de-CH). isoCode is required for both CREATE and UPDATE operations')),
10
+ .string()
11
+ .min(1)
12
+ .optional()
13
+ .describe('ISO identifier: Countries need 2-letter codes (US, DE), Currencies need 3-letter codes (USD, EUR), Languages accept 2-10 characters (en, de-CH). isoCode is required for both CREATE and UPDATE operations'),
12
14
  isActive: z
13
- .optional(z.boolean())
14
- .check(z.describe('Active status for the entity - used for all localization types (COUNTRY, CURRENCY, LANGUAGE)')),
15
+ .boolean()
16
+ .optional()
17
+ .describe('Active status for the entity - used for all localization types (COUNTRY, CURRENCY, LANGUAGE)'),
15
18
  defaultCurrencyCode: z
16
- .optional(z.string())
17
- .check(z.describe('Default currency code for the country - only used when localizationType is COUNTRY, ignored otherwise')),
19
+ .string()
20
+ .optional()
21
+ .describe('Default currency code for the country - only used when localizationType is COUNTRY, ignored otherwise'),
18
22
  contractAddress: z
19
- .optional(z
20
23
  .string()
21
- .check(z.regex(/^0x[a-fA-F0-9]{40}$/, 'Must be a valid 42-character blockchain address starting with 0x')))
22
- .check(z.describe('Blockchain contract address for tokenized currencies - only used when localizationType is CURRENCY, ignored otherwise')),
24
+ .regex(/^0x[a-fA-F0-9]{40}$/, 'Must be a valid 42-character blockchain address starting with 0x')
25
+ .optional()
26
+ .describe('Blockchain contract address for tokenized currencies - only used when localizationType is CURRENCY, ignored otherwise'),
23
27
  decimals: z
24
- .optional(z.int().check(z.nonnegative()))
25
- .check(z.describe('Decimal precision for currency calculations - only used when localizationType is CURRENCY (2 for traditional currencies like USD, 18 for crypto tokens), ignored otherwise')),
28
+ .number()
29
+ .int()
30
+ .nonnegative()
31
+ .optional()
32
+ .describe('Decimal precision for currency calculations - only used when localizationType is CURRENCY (2 for traditional currencies like USD, 18 for crypto tokens), ignored otherwise'),
26
33
  });
27
34
  export const actionValidators = {
28
35
  CREATE: z.object({
29
- localizationType: LocalizationTypeEnum.check(z.describe('Type of localization system to operate on')),
30
- entity: z
31
- .extend(LocalizationEntitySchema, {
36
+ localizationType: LocalizationTypeEnum.describe('Type of localization system to operate on'),
37
+ entity: LocalizationEntitySchema.extend({
32
38
  isoCode: z
33
39
  .string()
34
- .check(z.minLength(1), z.describe('ISO identifier: Countries need 2-letter codes (US, DE), Currencies need 3-letter codes (USD, EUR), Languages accept 2-10 characters (en, de-CH)')),
35
- })
36
- .check(z.describe('Entity configuration data (required for CREATE)')),
40
+ .min(1)
41
+ .describe('ISO identifier: Countries need 2-letter codes (US, DE), Currencies need 3-letter codes (USD, EUR), Languages accept 2-10 characters (en, de-CH)'),
42
+ }).describe('Entity configuration data (required for CREATE)'),
37
43
  }),
38
44
  UPDATE: z.object({
39
- localizationType: LocalizationTypeEnum.check(z.describe('Type of localization system to operate on, wj')),
40
- entityId: z
41
- .string()
42
- .check(z.minLength(1), z.describe('Database ID of the specific entity instance')),
43
- entity: LocalizationEntitySchema.check(z.describe('Entity data to update')),
45
+ localizationType: LocalizationTypeEnum.describe('Type of localization system to operate on, wj'),
46
+ entityId: z.string().min(1).describe('Database ID of the specific entity instance'),
47
+ entity: LocalizationEntitySchema.describe('Entity data to update'),
44
48
  }),
45
49
  REMOVE: z.object({
46
- localizationType: LocalizationTypeEnum.check(z.describe('Type of localization system to operate on')),
47
- entityId: z
48
- .string()
49
- .check(z.minLength(1), z.describe('Database ID of the specific entity instance')),
50
+ localizationType: LocalizationTypeEnum.describe('Type of localization system to operate on'),
51
+ entityId: z.string().min(1).describe('Database ID of the specific entity instance'),
50
52
  }),
51
53
  GET: z.object({
52
- localizationType: LocalizationTypeEnum.check(z.describe('Type of localization system to operate on')),
53
- entityId: z
54
- .string()
55
- .check(z.minLength(1), z.describe('Database ID of the specific entity instance')),
54
+ localizationType: LocalizationTypeEnum.describe('Type of localization system to operate on'),
55
+ entityId: z.string().min(1).describe('Database ID of the specific entity instance'),
56
56
  }),
57
57
  LIST: z.object({
58
- localizationType: LocalizationTypeEnum.check(z.describe('Type of localization system to operate on')),
58
+ localizationType: LocalizationTypeEnum.describe('Type of localization system to operate on'),
59
59
  ...PaginationSchema,
60
60
  ...SortingSchema,
61
61
  ...SearchSchema,
62
62
  }),
63
63
  COUNT: z.object({
64
- localizationType: LocalizationTypeEnum.check(z.describe('Type of localization system to operate on')),
64
+ localizationType: LocalizationTypeEnum.describe('Type of localization system to operate on'),
65
65
  ...SearchSchema,
66
66
  }),
67
67
  };
68
- export const LocalizationManagementSchema = createManagementSchemaFromValidators(actionValidators);
68
+ export const LocalizationManagementSchema = {
69
+ action: z
70
+ .enum(['CREATE', 'UPDATE', 'REMOVE', 'GET', 'LIST', 'COUNT'])
71
+ .describe('Localization action: CREATE (new entity), UPDATE (modify existing), REMOVE (soft delete), GET (retrieve single), LIST (find multiple with pagination), COUNT (get totals for analytics)'),
72
+ localizationType: LocalizationTypeEnum.describe('Type of localization system to operate on'),
73
+ entity: LocalizationEntitySchema.optional().describe('Entity configuration data (required for CREATE, optional for UPDATE)'),
74
+ entityId: z
75
+ .string()
76
+ .min(1)
77
+ .optional()
78
+ .describe('Database ID of the specific entity instance (required for UPDATE, REMOVE, GET actions)'),
79
+ ...PaginationSchema,
80
+ ...SortingSchema,
81
+ ...SearchSchema,
82
+ };
83
+ export const LocalizationManagementZodSchema = z.object(LocalizationManagementSchema);
@@ -22,6 +22,8 @@ export default function getTopCustomers(context: Context, params: Params<'TOP_CU
22
22
  services: any;
23
23
  pushSubscriptions: import("@unchainedshop/core-users").PushSubscriptionObject[];
24
24
  username?: string | undefined;
25
+ tokenVersion?: number | undefined;
26
+ oidcLogoutAt?: Date | undefined;
25
27
  _id: string;
26
28
  } | null;
27
29
  currencyCode: string | null;
@@ -1,6 +1,6 @@
1
1
  import type { Context } from '../../../context.ts';
2
- import { OrderManagementSchema, type OrderManagementParams } from './schemas.ts';
3
- export { OrderManagementSchema };
2
+ import { OrderManagementSchema, OrderManagementZodSchema, type OrderManagementParams } from './schemas.ts';
3
+ export { OrderManagementSchema, OrderManagementZodSchema };
4
4
  export type { OrderManagementParams };
5
5
  export declare function orderManagement(context: Context, params: OrderManagementParams): Promise<{
6
6
  content: {
@@ -1,8 +1,8 @@
1
1
  import { log } from '@unchainedshop/logger';
2
- import { actionValidators, OrderManagementSchema, } from "./schemas.js";
2
+ import { actionValidators, OrderManagementSchema, OrderManagementZodSchema, } from "./schemas.js";
3
3
  import actionHandlers from "./handlers/index.js";
4
4
  import { createMcpResponse, createMcpErrorResponse } from "../../utils/sharedSchemas.js";
5
- export { OrderManagementSchema };
5
+ export { OrderManagementSchema, OrderManagementZodSchema };
6
6
  export async function orderManagement(context, params) {
7
7
  const { action, ...actionParams } = params;
8
8
  log('MCP handler orderManagement ', { userId: context.userId, params });