@ecomiq/core 0.1.7 → 0.1.9
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/dist/{client-4ZTG2RZ3.d.ts → client-Ba1r_uiO.d.ts} +4 -4
- package/dist/{client-BpX4yR6S.d.cts → client-Cqcnv2tC.d.cts} +4 -4
- package/dist/client.cjs +94 -89
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +94 -89
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +96 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -55
- package/dist/index.d.ts +65 -55
- package/dist/index.js +95 -100
- package/dist/index.js.map +1 -1
- package/dist/models/collections.cjs +7 -1
- package/dist/models/collections.cjs.map +1 -1
- package/dist/models/collections.d.cts +6 -6
- package/dist/models/collections.d.ts +6 -6
- package/dist/models/collections.js +7 -1
- package/dist/models/collections.js.map +1 -1
- package/dist/models/customer-address.cjs +7 -1
- package/dist/models/customer-address.cjs.map +1 -1
- package/dist/models/customer-address.d.cts +4 -4
- package/dist/models/customer-address.d.ts +4 -4
- package/dist/models/customer-address.js +7 -1
- package/dist/models/customer-address.js.map +1 -1
- package/dist/models/customer-order.cjs +14 -8
- package/dist/models/customer-order.cjs.map +1 -1
- package/dist/models/customer-order.d.cts +1 -5
- package/dist/models/customer-order.d.ts +1 -5
- package/dist/models/customer-order.js +14 -8
- package/dist/models/customer-order.js.map +1 -1
- package/dist/models/customer-profile.cjs +8 -2
- package/dist/models/customer-profile.cjs.map +1 -1
- package/dist/models/customer-profile.d.cts +3 -3
- package/dist/models/customer-profile.d.ts +3 -3
- package/dist/models/customer-profile.js +8 -2
- package/dist/models/customer-profile.js.map +1 -1
- package/dist/models/geo.cjs +2 -4
- package/dist/models/geo.cjs.map +1 -1
- package/dist/models/geo.d.cts +14 -14
- package/dist/models/geo.d.ts +14 -14
- package/dist/models/geo.js +2 -4
- package/dist/models/geo.js.map +1 -1
- package/dist/models/ids.cjs +3 -4
- package/dist/models/ids.cjs.map +1 -1
- package/dist/models/ids.d.cts +8 -8
- package/dist/models/ids.d.ts +8 -8
- package/dist/models/ids.js +3 -5
- package/dist/models/ids.js.map +1 -1
- package/dist/models/products.cjs +12 -19
- package/dist/models/products.cjs.map +1 -1
- package/dist/models/products.d.cts +32 -33
- package/dist/models/products.d.ts +32 -33
- package/dist/models/products.js +13 -19
- package/dist/models/products.js.map +1 -1
- package/dist/models/search.cjs +3 -180
- package/dist/models/search.cjs.map +1 -1
- package/dist/models/search.d.cts +5 -5
- package/dist/models/search.d.ts +5 -5
- package/dist/models/search.js +3 -180
- package/dist/models/search.js.map +1 -1
- package/dist/models/settings.cjs +2 -4
- package/dist/models/settings.cjs.map +1 -1
- package/dist/models/settings.d.cts +63 -63
- package/dist/models/settings.d.ts +63 -63
- package/dist/models/settings.js +2 -4
- package/dist/models/settings.js.map +1 -1
- package/dist/models/storefront-cart.cjs +14 -26
- package/dist/models/storefront-cart.cjs.map +1 -1
- package/dist/models/storefront-cart.d.cts +100 -98
- package/dist/models/storefront-cart.d.ts +100 -98
- package/dist/models/storefront-cart.js +15 -26
- package/dist/models/storefront-cart.js.map +1 -1
- package/dist/models/storefront-checkout.cjs +44 -34
- package/dist/models/storefront-checkout.cjs.map +1 -1
- package/dist/models/storefront-checkout.d.cts +660 -2278
- package/dist/models/storefront-checkout.d.ts +660 -2278
- package/dist/models/storefront-checkout.js +44 -35
- package/dist/models/storefront-checkout.js.map +1 -1
- package/dist/models/storefront-reviews.cjs +8 -187
- package/dist/models/storefront-reviews.cjs.map +1 -1
- package/dist/models/storefront-reviews.d.cts +17 -17
- package/dist/models/storefront-reviews.d.ts +17 -17
- package/dist/models/storefront-reviews.js +8 -187
- package/dist/models/storefront-reviews.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
|
|
5
|
+
// src/models/customer-profile.ts
|
|
6
|
+
var EntityIdSchema = zod.z.string().min(1, "Expected resource id");
|
|
7
|
+
zod.z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
8
|
+
EntityIdSchema.nullable();
|
|
9
|
+
EntityIdSchema.optional();
|
|
10
|
+
|
|
5
11
|
// src/models/customer-profile.ts
|
|
6
12
|
var DEFAULT_COUNTRY_CODE = "PE";
|
|
7
13
|
var CustomerRegisterRequestSchema = zod.z.object({
|
|
@@ -45,8 +51,8 @@ var CustomerProfileSchema = zod.z.object({
|
|
|
45
51
|
});
|
|
46
52
|
var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
|
|
47
53
|
var CustomerMeSchema = zod.z.object({
|
|
48
|
-
id:
|
|
49
|
-
storeId:
|
|
54
|
+
id: EntityIdSchema,
|
|
55
|
+
storeId: EntityIdSchema.optional(),
|
|
50
56
|
email: zod.z.string().email(),
|
|
51
57
|
firstName: zod.z.string(),
|
|
52
58
|
lastName: zod.z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/customer-profile.ts"],"names":["z"],"mappings":";;;;;AAEA,IAAM,oBAAA,GAAuB,IAAA;AAGtB,IAAM,6BAAA,GAAgCA,MAAE,MAAA,CAAO;AAAA,EACpD,KAAA,EAAOA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM;AAAA,EACxB,WAAWA,KAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EAClC,UAAUA,KAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EACjC,gBAAgBA,KAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,OAAO,CAAC,CAAA;AAAA,EAC1C,QAAA,EAAUA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC1B,KAAA,EAAOA,MAAE,M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AA,IAAkB;AAAA,GAC3C,CAAA;AACH","file":"customer-profile.cjs","sourcesContent":["import { z } from 'zod'\n\nconst DEFAULT_COUNTRY_CODE = 'PE'\n\n/** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */\nexport const CustomerRegisterRequestSchema = z.object({\n email: z.string().email(),\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n countryIsoCode: z.string().trim().length(2),\n password: z.string().min(1),\n phone: z.string().trim().min(1).optional(),\n})\n\nexport type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>\n\n/** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */\nexport const CustomerProfilePatchSchema = z.object({\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n phone: z.string().trim(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n consent: z.boolean(),\n countryIsoCode: z.string().trim().length(2),\n})\n\nexport type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>\n\n/** Perfil mostrado en cuenta (subset de GET customer). */\nexport const CustomerProfileSchema = z.object({\n firstName: z.string(),\n lastName: z.string(),\n phone: z.string(),\n email: z.string().email(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n countryIsoCode: z.string(),\n consent: z.boolean(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n})\n\nexport type CustomerProfile = z.infer<typeof CustomerProfileSchema>\n\nconst nullableString = z.string().nullable().optional().transform((v) => v ?? null)\n\n/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */\nexport const CustomerMeSchema = z\n .object({\n id: z.union([z.string(), z.number()]),\n storeId: z.string().optional(),\n email: z.string().email(),\n firstName: z.string(),\n lastName: z.string(),\n phone: z\n .union([z.string(), z.null()])\n .optional()\n .transform((v) => v ?? ''),\n identificationNumber: nullableString,\n identificationType: nullableString,\n entityName: nullableString,\n entityIdentificationNumber: nullableString,\n gender: nullableString,\n role: nullableString,\n companyName: nullableString,\n dateOfBirth: nullableString,\n countryIsoCode: z\n .string()\n .optional()\n .transform((v) => (v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE)),\n consent: z.boolean().optional().transform((v) => v ?? false),\n })\n .passthrough()\n\nexport type CustomerMe = z.infer<typeof CustomerMeSchema>\n\nexport function customerMeToProfile(me: CustomerMe): CustomerProfile {\n return CustomerProfileSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n email: me.email,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n countryIsoCode: me.countryIsoCode,\n consent: me.consent,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n })\n}\n\nexport function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n consent: me.consent,\n countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n\nexport function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: profile.firstName,\n lastName: profile.lastName,\n phone: profile.phone,\n identificationNumber: profile.identificationNumber,\n identificationType: profile.identificationType,\n entityName: profile.entityName,\n entityIdentificationNumber: profile.entityIdentificationNumber,\n gender: profile.gender,\n role: profile.role,\n companyName: profile.companyName,\n dateOfBirth: profile.dateOfBirth,\n consent: profile.consent,\n countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/models/ids.ts","../../src/models/customer-profile.ts"],"names":["z"],"mappings":";;;;;AAGO,IAAM,iBAAiBA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,sBAAsB,CAAA;AAGvCA,KAAA,CAC5B,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB;AAEZ,eAAe,QAAA;AACf,eAAe,QAAA;;;ACVrD,IAAM,oBAAA,GAAuB,IAAA;AAGtB,IAAM,6BAAA,GAAgCA,MAAE,MAAA,CAAO;AAAA,EACpD,KAAA,EAAOA,KAAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM;AAAA,EACxB,WAAWA,KAAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EAClC,UAAUA,KAAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EACjC,gBAAgBA,KAAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,OAAO,CAAC,CAAA;AAAA,EAC1C,QAAA,EAAUA,KAAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC1B,KAAA,EAAOA,MAAE,MAAA,EAAO,CAAE,MAAK,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,QAAA;AAClC,CAAC;AAKM,IAAM,0BAAA,GAA6BA,MAAE,MAAA,CAAO;AAAA,EACjD,WAAWA,KAAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EAClC,UAAUA,KAAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EACjC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AAA;AAAA,IACf,4BAA4B,EAAA,CAAG,0BAAA;AAAA,IAC/B,QAAQ,EAAA,CAAG,MAAA;AAAA,IACX,MAAM,EAAA,CAAG,IAAA;AAAA,IACT,aAAa,EAAA,CAAG,WAAA;AAAA,IAChB,aAAa,EAAA,CAAG,WAAA;AAAA,IAChB,SAAS,EAAA,CAAG,OAAA;AAAA,IACZ,cAAA,EAAgB,GAAG,cAAA,IAAkB;AAAA,GACtC,CAAA;AACH;AAEO,SAAS,uBAAuB,OAAA,EAAgD;AACrF,EAAA,OAAO,2BAA2B,KAAA,CAAM;AAAA,IACtC,WAAW,OAAA,CAAQ,SAAA;AAAA,IACnB,UAAU,OAAA,CAAQ,QAAA;AAAA,IAClB,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,sBAAsB,OAAA,CAAQ,oBAAA;AAAA,IAC9B,oBAAoB,OAAA,CAAQ,kBAAA;AAAA,IAC5B,YAAY,OAAA,CAAQ,UAAA;AAAA,IACpB,4BAA4B,OAAA,CAAQ,0BAAA;AAAA,IACpC,QAAQ,OAAA,CAAQ,MAAA;AAAA,IAChB,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,cAAA,EAAgB,QAAQ,cAAA,IAAkB;AAAA,GAC3C,CAAA;AACH","file":"customer-profile.cjs","sourcesContent":["import { z } from 'zod'\n\n/** Opaque public resource identifier. Consumers must not infer its storage type. */\nexport const EntityIdSchema = z.string().min(1, 'Expected resource id')\n\n/** Opaque token used by storefront cart routes. */\nexport const CartTokenSchema = z\n .string()\n .min(1)\n .max(32)\n .regex(/^[A-Za-z0-9_-]+$/, 'Expected cart token')\n\nexport const NullableEntityIdSchema = EntityIdSchema.nullable()\nexport const OptionalEntityIdSchema = EntityIdSchema.optional()\n\nexport type EntityId = z.infer<typeof EntityIdSchema>\nexport type CartToken = z.infer<typeof CartTokenSchema>\n","import { z } from 'zod'\nimport { EntityIdSchema } from './ids'\n\nconst DEFAULT_COUNTRY_CODE = 'PE'\n\n/** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */\nexport const CustomerRegisterRequestSchema = z.object({\n email: z.string().email(),\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n countryIsoCode: z.string().trim().length(2),\n password: z.string().min(1),\n phone: z.string().trim().min(1).optional(),\n})\n\nexport type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>\n\n/** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */\nexport const CustomerProfilePatchSchema = z.object({\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n phone: z.string().trim(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n consent: z.boolean(),\n countryIsoCode: z.string().trim().length(2),\n})\n\nexport type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>\n\n/** Perfil mostrado en cuenta (subset de GET customer). */\nexport const CustomerProfileSchema = z.object({\n firstName: z.string(),\n lastName: z.string(),\n phone: z.string(),\n email: z.string().email(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n countryIsoCode: z.string(),\n consent: z.boolean(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n})\n\nexport type CustomerProfile = z.infer<typeof CustomerProfileSchema>\n\nconst nullableString = z.string().nullable().optional().transform((v) => v ?? null)\n\n/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */\nexport const CustomerMeSchema = z\n .object({\n id: EntityIdSchema,\n storeId: EntityIdSchema.optional(),\n email: z.string().email(),\n firstName: z.string(),\n lastName: z.string(),\n phone: z\n .union([z.string(), z.null()])\n .optional()\n .transform((v) => v ?? ''),\n identificationNumber: nullableString,\n identificationType: nullableString,\n entityName: nullableString,\n entityIdentificationNumber: nullableString,\n gender: nullableString,\n role: nullableString,\n companyName: nullableString,\n dateOfBirth: nullableString,\n countryIsoCode: z\n .string()\n .optional()\n .transform((v) => (v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE)),\n consent: z.boolean().optional().transform((v) => v ?? false),\n })\n .passthrough()\n\nexport type CustomerMe = z.infer<typeof CustomerMeSchema>\n\nexport function customerMeToProfile(me: CustomerMe): CustomerProfile {\n return CustomerProfileSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n email: me.email,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n countryIsoCode: me.countryIsoCode,\n consent: me.consent,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n })\n}\n\nexport function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n consent: me.consent,\n countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n\nexport function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: profile.firstName,\n lastName: profile.lastName,\n phone: profile.phone,\n identificationNumber: profile.identificationNumber,\n identificationType: profile.identificationType,\n entityName: profile.entityName,\n entityIdentificationNumber: profile.entityIdentificationNumber,\n gender: profile.gender,\n role: profile.role,\n companyName: profile.companyName,\n dateOfBirth: profile.dateOfBirth,\n consent: profile.consent,\n countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n"]}
|
|
@@ -119,7 +119,7 @@ declare const CustomerProfileSchema: z.ZodObject<{
|
|
|
119
119
|
type CustomerProfile = z.infer<typeof CustomerProfileSchema>;
|
|
120
120
|
/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */
|
|
121
121
|
declare const CustomerMeSchema: z.ZodObject<{
|
|
122
|
-
id: z.
|
|
122
|
+
id: z.ZodString;
|
|
123
123
|
storeId: z.ZodOptional<z.ZodString>;
|
|
124
124
|
email: z.ZodString;
|
|
125
125
|
firstName: z.ZodString;
|
|
@@ -136,7 +136,7 @@ declare const CustomerMeSchema: z.ZodObject<{
|
|
|
136
136
|
countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
|
|
137
137
|
consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
|
|
138
138
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
139
|
-
id: z.
|
|
139
|
+
id: z.ZodString;
|
|
140
140
|
storeId: z.ZodOptional<z.ZodString>;
|
|
141
141
|
email: z.ZodString;
|
|
142
142
|
firstName: z.ZodString;
|
|
@@ -153,7 +153,7 @@ declare const CustomerMeSchema: z.ZodObject<{
|
|
|
153
153
|
countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
|
|
154
154
|
consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
|
|
155
155
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
156
|
-
id: z.
|
|
156
|
+
id: z.ZodString;
|
|
157
157
|
storeId: z.ZodOptional<z.ZodString>;
|
|
158
158
|
email: z.ZodString;
|
|
159
159
|
firstName: z.ZodString;
|
|
@@ -119,7 +119,7 @@ declare const CustomerProfileSchema: z.ZodObject<{
|
|
|
119
119
|
type CustomerProfile = z.infer<typeof CustomerProfileSchema>;
|
|
120
120
|
/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */
|
|
121
121
|
declare const CustomerMeSchema: z.ZodObject<{
|
|
122
|
-
id: z.
|
|
122
|
+
id: z.ZodString;
|
|
123
123
|
storeId: z.ZodOptional<z.ZodString>;
|
|
124
124
|
email: z.ZodString;
|
|
125
125
|
firstName: z.ZodString;
|
|
@@ -136,7 +136,7 @@ declare const CustomerMeSchema: z.ZodObject<{
|
|
|
136
136
|
countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
|
|
137
137
|
consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
|
|
138
138
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
139
|
-
id: z.
|
|
139
|
+
id: z.ZodString;
|
|
140
140
|
storeId: z.ZodOptional<z.ZodString>;
|
|
141
141
|
email: z.ZodString;
|
|
142
142
|
firstName: z.ZodString;
|
|
@@ -153,7 +153,7 @@ declare const CustomerMeSchema: z.ZodObject<{
|
|
|
153
153
|
countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
|
|
154
154
|
consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
|
|
155
155
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
156
|
-
id: z.
|
|
156
|
+
id: z.ZodString;
|
|
157
157
|
storeId: z.ZodOptional<z.ZodString>;
|
|
158
158
|
email: z.ZodString;
|
|
159
159
|
firstName: z.ZodString;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
// src/models/customer-profile.ts
|
|
4
|
+
var EntityIdSchema = z.string().min(1, "Expected resource id");
|
|
5
|
+
z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
6
|
+
EntityIdSchema.nullable();
|
|
7
|
+
EntityIdSchema.optional();
|
|
8
|
+
|
|
3
9
|
// src/models/customer-profile.ts
|
|
4
10
|
var DEFAULT_COUNTRY_CODE = "PE";
|
|
5
11
|
var CustomerRegisterRequestSchema = z.object({
|
|
@@ -43,8 +49,8 @@ var CustomerProfileSchema = z.object({
|
|
|
43
49
|
});
|
|
44
50
|
var nullableString = z.string().nullable().optional().transform((v) => v ?? null);
|
|
45
51
|
var CustomerMeSchema = z.object({
|
|
46
|
-
id:
|
|
47
|
-
storeId:
|
|
52
|
+
id: EntityIdSchema,
|
|
53
|
+
storeId: EntityIdSchema.optional(),
|
|
48
54
|
email: z.string().email(),
|
|
49
55
|
firstName: z.string(),
|
|
50
56
|
lastName: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/customer-profile.ts"],"names":[],"mappings":";;;AAEA,IAAM,oBAAA,GAAuB,IAAA;AAGtB,IAAM,6BAAA,GAAgC,EAAE,MAAA,CAAO;AAAA,EACpD,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM;AAAA,EACxB,WAAW,CAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EAClC,UAAU,CAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EACjC,gBAAgB,CAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,OAAO,CAAC,CAAA;AAAA,EAC1C,QAAA,EAAU,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC1B,KAAA,EAAO,EAAE,MAAA,EAAO,CAAE,MAAK,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,QAAA;AAClC,CAAC;AAKM,IAAM,0BAAA,GAA6B,EAAE,MAAA,CAAO;AAAA,EACjD,WAAW,CAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EAClC,UAAU,CAAA,CAAE,MAAA,GAAS,IA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AA,CAAG,oBAAA;AAAA,IACzB,oBAAoB,EAAA,CAAG,kBAAA;AAAA,IACvB,YAAY,EAAA,CAAG,UAAA;AAAA,IACf,4BAA4B,EAAA,CAAG,0BAAA;AAAA,IAC/B,QAAQ,EAAA,CAAG,MAAA;AAAA,IACX,MAAM,EAAA,CAAG,IAAA;AAAA,IACT,aAAa,EAAA,CAAG,WAAA;AAAA,IAChB,aAAa,EAAA,CAAG,WAAA;AAAA,IAChB,SAAS,EAAA,CAAG,OAAA;AAAA,IACZ,cAAA,EAAgB,GAAG,cAAA,IAAkB;AAAA,GACtC,CAAA;AACH;AAEO,SAAS,uBAAuB,OAAA,EAAgD;AACrF,EAAA,OAAO,2BAA2B,KAAA,CAAM;AAAA,IACtC,WAAW,OAAA,CAAQ,SAAA;AAAA,IACnB,UAAU,OAAA,CAAQ,QAAA;AAAA,IAClB,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,sBAAsB,OAAA,CAAQ,oBAAA;AAAA,IAC9B,oBAAoB,OAAA,CAAQ,kBAAA;AAAA,IAC5B,YAAY,OAAA,CAAQ,UAAA;AAAA,IACpB,4BAA4B,OAAA,CAAQ,0BAAA;AAAA,IACpC,QAAQ,OAAA,CAAQ,MAAA;AAAA,IAChB,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,cAAA,EAAgB,QAAQ,cAAA,IAAkB;AAAA,GAC3C,CAAA;AACH","file":"customer-profile.js","sourcesContent":["import { z } from 'zod'\n\nconst DEFAULT_COUNTRY_CODE = 'PE'\n\n/** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */\nexport const CustomerRegisterRequestSchema = z.object({\n email: z.string().email(),\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n countryIsoCode: z.string().trim().length(2),\n password: z.string().min(1),\n phone: z.string().trim().min(1).optional(),\n})\n\nexport type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>\n\n/** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */\nexport const CustomerProfilePatchSchema = z.object({\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n phone: z.string().trim(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n consent: z.boolean(),\n countryIsoCode: z.string().trim().length(2),\n})\n\nexport type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>\n\n/** Perfil mostrado en cuenta (subset de GET customer). */\nexport const CustomerProfileSchema = z.object({\n firstName: z.string(),\n lastName: z.string(),\n phone: z.string(),\n email: z.string().email(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n countryIsoCode: z.string(),\n consent: z.boolean(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n})\n\nexport type CustomerProfile = z.infer<typeof CustomerProfileSchema>\n\nconst nullableString = z.string().nullable().optional().transform((v) => v ?? null)\n\n/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */\nexport const CustomerMeSchema = z\n .object({\n id: z.union([z.string(), z.number()]),\n storeId: z.string().optional(),\n email: z.string().email(),\n firstName: z.string(),\n lastName: z.string(),\n phone: z\n .union([z.string(), z.null()])\n .optional()\n .transform((v) => v ?? ''),\n identificationNumber: nullableString,\n identificationType: nullableString,\n entityName: nullableString,\n entityIdentificationNumber: nullableString,\n gender: nullableString,\n role: nullableString,\n companyName: nullableString,\n dateOfBirth: nullableString,\n countryIsoCode: z\n .string()\n .optional()\n .transform((v) => (v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE)),\n consent: z.boolean().optional().transform((v) => v ?? false),\n })\n .passthrough()\n\nexport type CustomerMe = z.infer<typeof CustomerMeSchema>\n\nexport function customerMeToProfile(me: CustomerMe): CustomerProfile {\n return CustomerProfileSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n email: me.email,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n countryIsoCode: me.countryIsoCode,\n consent: me.consent,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n })\n}\n\nexport function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n consent: me.consent,\n countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n\nexport function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: profile.firstName,\n lastName: profile.lastName,\n phone: profile.phone,\n identificationNumber: profile.identificationNumber,\n identificationType: profile.identificationType,\n entityName: profile.entityName,\n entityIdentificationNumber: profile.entityIdentificationNumber,\n gender: profile.gender,\n role: profile.role,\n companyName: profile.companyName,\n dateOfBirth: profile.dateOfBirth,\n consent: profile.consent,\n countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/models/ids.ts","../../src/models/customer-profile.ts"],"names":["z"],"mappings":";;;AAGO,IAAM,iBAAiB,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,sBAAsB,CAAA;AAGvC,CAAA,CAC5B,MAAA,E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EO,SAAS,uBAAuB,OAAA,EAAgD;AACrF,EAAA,OAAO,2BAA2B,KAAA,CAAM;AAAA,IACtC,WAAW,OAAA,CAAQ,SAAA;AAAA,IACnB,UAAU,OAAA,CAAQ,QAAA;AAAA,IAClB,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,sBAAsB,OAAA,CAAQ,oBAAA;AAAA,IAC9B,oBAAoB,OAAA,CAAQ,kBAAA;AAAA,IAC5B,YAAY,OAAA,CAAQ,UAAA;AAAA,IACpB,4BAA4B,OAAA,CAAQ,0BAAA;AAAA,IACpC,QAAQ,OAAA,CAAQ,MAAA;AAAA,IAChB,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,cAAA,EAAgB,QAAQ,cAAA,IAAkB;AAAA,GAC3C,CAAA;AACH","file":"customer-profile.js","sourcesContent":["import { z } from 'zod'\n\n/** Opaque public resource identifier. Consumers must not infer its storage type. */\nexport const EntityIdSchema = z.string().min(1, 'Expected resource id')\n\n/** Opaque token used by storefront cart routes. */\nexport const CartTokenSchema = z\n .string()\n .min(1)\n .max(32)\n .regex(/^[A-Za-z0-9_-]+$/, 'Expected cart token')\n\nexport const NullableEntityIdSchema = EntityIdSchema.nullable()\nexport const OptionalEntityIdSchema = EntityIdSchema.optional()\n\nexport type EntityId = z.infer<typeof EntityIdSchema>\nexport type CartToken = z.infer<typeof CartTokenSchema>\n","import { z } from 'zod'\nimport { EntityIdSchema } from './ids'\n\nconst DEFAULT_COUNTRY_CODE = 'PE'\n\n/** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */\nexport const CustomerRegisterRequestSchema = z.object({\n email: z.string().email(),\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n countryIsoCode: z.string().trim().length(2),\n password: z.string().min(1),\n phone: z.string().trim().min(1).optional(),\n})\n\nexport type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>\n\n/** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */\nexport const CustomerProfilePatchSchema = z.object({\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n phone: z.string().trim(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n consent: z.boolean(),\n countryIsoCode: z.string().trim().length(2),\n})\n\nexport type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>\n\n/** Perfil mostrado en cuenta (subset de GET customer). */\nexport const CustomerProfileSchema = z.object({\n firstName: z.string(),\n lastName: z.string(),\n phone: z.string(),\n email: z.string().email(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n countryIsoCode: z.string(),\n consent: z.boolean(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n})\n\nexport type CustomerProfile = z.infer<typeof CustomerProfileSchema>\n\nconst nullableString = z.string().nullable().optional().transform((v) => v ?? null)\n\n/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */\nexport const CustomerMeSchema = z\n .object({\n id: EntityIdSchema,\n storeId: EntityIdSchema.optional(),\n email: z.string().email(),\n firstName: z.string(),\n lastName: z.string(),\n phone: z\n .union([z.string(), z.null()])\n .optional()\n .transform((v) => v ?? ''),\n identificationNumber: nullableString,\n identificationType: nullableString,\n entityName: nullableString,\n entityIdentificationNumber: nullableString,\n gender: nullableString,\n role: nullableString,\n companyName: nullableString,\n dateOfBirth: nullableString,\n countryIsoCode: z\n .string()\n .optional()\n .transform((v) => (v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE)),\n consent: z.boolean().optional().transform((v) => v ?? false),\n })\n .passthrough()\n\nexport type CustomerMe = z.infer<typeof CustomerMeSchema>\n\nexport function customerMeToProfile(me: CustomerMe): CustomerProfile {\n return CustomerProfileSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n email: me.email,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n countryIsoCode: me.countryIsoCode,\n consent: me.consent,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n })\n}\n\nexport function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n consent: me.consent,\n countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n\nexport function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: profile.firstName,\n lastName: profile.lastName,\n phone: profile.phone,\n identificationNumber: profile.identificationNumber,\n identificationType: profile.identificationType,\n entityName: profile.entityName,\n entityIdentificationNumber: profile.entityIdentificationNumber,\n gender: profile.gender,\n role: profile.role,\n companyName: profile.companyName,\n dateOfBirth: profile.dateOfBirth,\n consent: profile.consent,\n countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n"]}
|
package/dist/models/geo.cjs
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
|
|
5
5
|
// src/models/geo.ts
|
|
6
|
-
var EntityIdSchema = zod.z.
|
|
7
|
-
|
|
8
|
-
zod.z.string().regex(/^\d+$/, "Expected numeric id")
|
|
9
|
-
]);
|
|
6
|
+
var EntityIdSchema = zod.z.string().min(1, "Expected resource id");
|
|
7
|
+
zod.z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
10
8
|
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
11
9
|
EntityIdSchema.optional();
|
|
12
10
|
|
package/dist/models/geo.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/ids.ts","../../src/models/geo.ts"],"names":["z"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/models/ids.ts","../../src/models/geo.ts"],"names":["z"],"mappings":";;;;;AAGO,IAAM,iBAAiBA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,sBAAsB,CAAA;AAGvCA,KAAA,CAC5B,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB;AAE3C,IAAM,sBAAA,GAAyB,eAAe,QAAA,EAAS;AACxB,eAAe,QAAA;;;ACN9C,IAAM,aAAA,GAAgBA,MAC1B,MAAA,CAAO;AAAA,EACN,IAAA,EAAMA,KAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EACzB,IAAA,EAAMA,KAAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC;AACxB,CAAC,EACA,MAAA;AAII,IAAM,eAAA,GAAkBA,KAAAA,CAAE,KAAA,CAAM,aAAa;AAK7C,IAAM,wBAAwBA,KAAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,QAAA,EAAU,QAAQ,CAAC;AAKnE,IAAM,iBAAA,GAAoBA,MAC9B,MAAA,CAAO;AAAA,EACN,EAAA,EAAI,cAAA;AAAA,EACJ,WAAA,EAAaA,KAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EAChC,IAAA,EAAM,qBAA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,CAAE,QAAQ,EAAE,CAAA;AAAA,EAC7B,KAAA,EAAOA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,QAAA,EAAS,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,OAAA,CAAQ,GAAG;AACzD,CAAC;AAMM,IAAM,cAAA,GAAiB;AAGvB,IAAM,eAAA,GAAkBA,KAAAA,CAAE,KAAA,CAAM,cAAc;AAI9C,IAAM,wBAAA,GAA2BA,MAAE,MAAA,CAAO;AAAA,EAC/C,WAAA,EAAaA,KAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EAChC,YAAA,EAAcA,KAAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC9B,MAAA,EAAQA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,QAAQ,MAAM,CAAA;AAAA,EACxC,MAAA,EAAQA,KAAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,EAAE,CAAA;AAAA,EAC7B,KAAA,EAAOA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,QAAA,EAAS,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,OAAA,CAAQ,GAAG;AACzD,CAAC","file":"geo.cjs","sourcesContent":["import { z } from 'zod'\n\n/** Opaque public resource identifier. Consumers must not infer its storage type. */\nexport const EntityIdSchema = z.string().min(1, 'Expected resource id')\n\n/** Opaque token used by storefront cart routes. */\nexport const CartTokenSchema = z\n .string()\n .min(1)\n .max(32)\n .regex(/^[A-Za-z0-9_-]+$/, 'Expected cart token')\n\nexport const NullableEntityIdSchema = EntityIdSchema.nullable()\nexport const OptionalEntityIdSchema = EntityIdSchema.optional()\n\nexport type EntityId = z.infer<typeof EntityIdSchema>\nexport type CartToken = z.infer<typeof CartTokenSchema>\n","import { z } from 'zod'\nimport {\n EntityIdSchema,\n NullableEntityIdSchema,\n} from './ids'\n\n/** País ISO 3166-1 alpha-2 (`GET /v1/geo/countries`). */\nexport const CountrySchema = z\n .object({\n code: z.string().length(2),\n name: z.string().min(1),\n })\n .strict()\n\nexport type Country = z.infer<typeof CountrySchema>\n\nexport const CountriesSchema = z.array(CountrySchema)\n\nexport type Countries = z.infer<typeof CountriesSchema>\n\n/** Nivel administrativo geo (`level1` = departamento, etc.). */\nexport const GeoDivisionTypeSchema = z.enum(['level1', 'level2', 'level3'])\n\nexport type GeoDivisionType = z.infer<typeof GeoDivisionTypeSchema>\n\n/** División administrativa (`GET /v1/geo/departments`, …). */\nexport const GeoDivisionSchema = z\n .object({\n id: EntityIdSchema,\n countryCode: z.string().length(2),\n type: GeoDivisionTypeSchema,\n code: z.string().min(1),\n name: z.string().min(1),\n parentId: NullableEntityIdSchema,\n source: z.string().min(1),\n })\n .strict()\n\nexport type GeoDivision = z.infer<typeof GeoDivisionSchema>\n\n/** Alias de departamento (level1). */\nexport const DepartmentSchema = GeoDivisionSchema\nexport type Department = GeoDivision\n\nexport const DepartmentsSchema = z.array(DepartmentSchema)\nexport type Departments = z.infer<typeof DepartmentsSchema>\n\n/** Query de `GET /v1/geo/departments`. */\nexport const GetDepartmentsParamsSchema = z.object({\n countryCode: z.string().length(2),\n source: z.string().min(1).default('inei'),\n search: z.string().default(''),\n limit: z.number().int().positive().max(500).default(200),\n})\n\nexport type GetDepartmentsParams = z.input<typeof GetDepartmentsParamsSchema>\nexport type GetDepartmentsParamsParsed = z.output<typeof GetDepartmentsParamsSchema>\n\n/** Alias de provincia (level2). */\nexport const ProvinceSchema = GeoDivisionSchema\nexport type Province = GeoDivision\n\nexport const ProvincesSchema = z.array(ProvinceSchema)\nexport type Provinces = z.infer<typeof ProvincesSchema>\n\n/** Query de `GET /v1/geo/provinces`. */\nexport const GetProvincesParamsSchema = z.object({\n countryCode: z.string().length(2),\n departmentCode: z.string().min(1),\n source: z.string().min(1).default('inei'),\n search: z.string().default(''),\n limit: z.number().int().positive().max(500).default(200),\n})\n\nexport type GetProvincesParams = z.input<typeof GetProvincesParamsSchema>\nexport type GetProvincesParamsParsed = z.output<typeof GetProvincesParamsSchema>\n\n/** Alias de distrito (level3). */\nexport const DistrictSchema = GeoDivisionSchema\nexport type District = GeoDivision\n\nexport const DistrictsSchema = z.array(DistrictSchema)\nexport type Districts = z.infer<typeof DistrictsSchema>\n\n/** Query de `GET /v1/geo/districts`. */\nexport const GetDistrictsParamsSchema = z.object({\n countryCode: z.string().length(2),\n provinceCode: z.string().min(1),\n source: z.string().min(1).default('inei'),\n search: z.string().default(''),\n limit: z.number().int().positive().max(500).default(200),\n})\n\nexport type GetDistrictsParams = z.input<typeof GetDistrictsParamsSchema>\nexport type GetDistrictsParamsParsed = z.output<typeof GetDistrictsParamsSchema>\n"]}
|
package/dist/models/geo.d.cts
CHANGED
|
@@ -28,12 +28,12 @@ declare const GeoDivisionTypeSchema: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
|
28
28
|
type GeoDivisionType = z.infer<typeof GeoDivisionTypeSchema>;
|
|
29
29
|
/** División administrativa (`GET /v1/geo/departments`, …). */
|
|
30
30
|
declare const GeoDivisionSchema: z.ZodObject<{
|
|
31
|
-
id: z.
|
|
31
|
+
id: z.ZodString;
|
|
32
32
|
countryCode: z.ZodString;
|
|
33
33
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
34
34
|
code: z.ZodString;
|
|
35
35
|
name: z.ZodString;
|
|
36
|
-
parentId: z.ZodNullable<z.
|
|
36
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
37
37
|
source: z.ZodString;
|
|
38
38
|
}, "strict", z.ZodTypeAny, {
|
|
39
39
|
code: string;
|
|
@@ -55,12 +55,12 @@ declare const GeoDivisionSchema: z.ZodObject<{
|
|
|
55
55
|
type GeoDivision = z.infer<typeof GeoDivisionSchema>;
|
|
56
56
|
/** Alias de departamento (level1). */
|
|
57
57
|
declare const DepartmentSchema: z.ZodObject<{
|
|
58
|
-
id: z.
|
|
58
|
+
id: z.ZodString;
|
|
59
59
|
countryCode: z.ZodString;
|
|
60
60
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
61
61
|
code: z.ZodString;
|
|
62
62
|
name: z.ZodString;
|
|
63
|
-
parentId: z.ZodNullable<z.
|
|
63
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
64
64
|
source: z.ZodString;
|
|
65
65
|
}, "strict", z.ZodTypeAny, {
|
|
66
66
|
code: string;
|
|
@@ -81,12 +81,12 @@ declare const DepartmentSchema: z.ZodObject<{
|
|
|
81
81
|
}>;
|
|
82
82
|
type Department = GeoDivision;
|
|
83
83
|
declare const DepartmentsSchema: z.ZodArray<z.ZodObject<{
|
|
84
|
-
id: z.
|
|
84
|
+
id: z.ZodString;
|
|
85
85
|
countryCode: z.ZodString;
|
|
86
86
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
87
87
|
code: z.ZodString;
|
|
88
88
|
name: z.ZodString;
|
|
89
|
-
parentId: z.ZodNullable<z.
|
|
89
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
90
90
|
source: z.ZodString;
|
|
91
91
|
}, "strict", z.ZodTypeAny, {
|
|
92
92
|
code: string;
|
|
@@ -127,12 +127,12 @@ type GetDepartmentsParams = z.input<typeof GetDepartmentsParamsSchema>;
|
|
|
127
127
|
type GetDepartmentsParamsParsed = z.output<typeof GetDepartmentsParamsSchema>;
|
|
128
128
|
/** Alias de provincia (level2). */
|
|
129
129
|
declare const ProvinceSchema: z.ZodObject<{
|
|
130
|
-
id: z.
|
|
130
|
+
id: z.ZodString;
|
|
131
131
|
countryCode: z.ZodString;
|
|
132
132
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
133
133
|
code: z.ZodString;
|
|
134
134
|
name: z.ZodString;
|
|
135
|
-
parentId: z.ZodNullable<z.
|
|
135
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
136
136
|
source: z.ZodString;
|
|
137
137
|
}, "strict", z.ZodTypeAny, {
|
|
138
138
|
code: string;
|
|
@@ -153,12 +153,12 @@ declare const ProvinceSchema: z.ZodObject<{
|
|
|
153
153
|
}>;
|
|
154
154
|
type Province = GeoDivision;
|
|
155
155
|
declare const ProvincesSchema: z.ZodArray<z.ZodObject<{
|
|
156
|
-
id: z.
|
|
156
|
+
id: z.ZodString;
|
|
157
157
|
countryCode: z.ZodString;
|
|
158
158
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
159
159
|
code: z.ZodString;
|
|
160
160
|
name: z.ZodString;
|
|
161
|
-
parentId: z.ZodNullable<z.
|
|
161
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
162
162
|
source: z.ZodString;
|
|
163
163
|
}, "strict", z.ZodTypeAny, {
|
|
164
164
|
code: string;
|
|
@@ -202,12 +202,12 @@ type GetProvincesParams = z.input<typeof GetProvincesParamsSchema>;
|
|
|
202
202
|
type GetProvincesParamsParsed = z.output<typeof GetProvincesParamsSchema>;
|
|
203
203
|
/** Alias de distrito (level3). */
|
|
204
204
|
declare const DistrictSchema: z.ZodObject<{
|
|
205
|
-
id: z.
|
|
205
|
+
id: z.ZodString;
|
|
206
206
|
countryCode: z.ZodString;
|
|
207
207
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
208
208
|
code: z.ZodString;
|
|
209
209
|
name: z.ZodString;
|
|
210
|
-
parentId: z.ZodNullable<z.
|
|
210
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
211
211
|
source: z.ZodString;
|
|
212
212
|
}, "strict", z.ZodTypeAny, {
|
|
213
213
|
code: string;
|
|
@@ -228,12 +228,12 @@ declare const DistrictSchema: z.ZodObject<{
|
|
|
228
228
|
}>;
|
|
229
229
|
type District = GeoDivision;
|
|
230
230
|
declare const DistrictsSchema: z.ZodArray<z.ZodObject<{
|
|
231
|
-
id: z.
|
|
231
|
+
id: z.ZodString;
|
|
232
232
|
countryCode: z.ZodString;
|
|
233
233
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
234
234
|
code: z.ZodString;
|
|
235
235
|
name: z.ZodString;
|
|
236
|
-
parentId: z.ZodNullable<z.
|
|
236
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
237
237
|
source: z.ZodString;
|
|
238
238
|
}, "strict", z.ZodTypeAny, {
|
|
239
239
|
code: string;
|
package/dist/models/geo.d.ts
CHANGED
|
@@ -28,12 +28,12 @@ declare const GeoDivisionTypeSchema: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
|
28
28
|
type GeoDivisionType = z.infer<typeof GeoDivisionTypeSchema>;
|
|
29
29
|
/** División administrativa (`GET /v1/geo/departments`, …). */
|
|
30
30
|
declare const GeoDivisionSchema: z.ZodObject<{
|
|
31
|
-
id: z.
|
|
31
|
+
id: z.ZodString;
|
|
32
32
|
countryCode: z.ZodString;
|
|
33
33
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
34
34
|
code: z.ZodString;
|
|
35
35
|
name: z.ZodString;
|
|
36
|
-
parentId: z.ZodNullable<z.
|
|
36
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
37
37
|
source: z.ZodString;
|
|
38
38
|
}, "strict", z.ZodTypeAny, {
|
|
39
39
|
code: string;
|
|
@@ -55,12 +55,12 @@ declare const GeoDivisionSchema: z.ZodObject<{
|
|
|
55
55
|
type GeoDivision = z.infer<typeof GeoDivisionSchema>;
|
|
56
56
|
/** Alias de departamento (level1). */
|
|
57
57
|
declare const DepartmentSchema: z.ZodObject<{
|
|
58
|
-
id: z.
|
|
58
|
+
id: z.ZodString;
|
|
59
59
|
countryCode: z.ZodString;
|
|
60
60
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
61
61
|
code: z.ZodString;
|
|
62
62
|
name: z.ZodString;
|
|
63
|
-
parentId: z.ZodNullable<z.
|
|
63
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
64
64
|
source: z.ZodString;
|
|
65
65
|
}, "strict", z.ZodTypeAny, {
|
|
66
66
|
code: string;
|
|
@@ -81,12 +81,12 @@ declare const DepartmentSchema: z.ZodObject<{
|
|
|
81
81
|
}>;
|
|
82
82
|
type Department = GeoDivision;
|
|
83
83
|
declare const DepartmentsSchema: z.ZodArray<z.ZodObject<{
|
|
84
|
-
id: z.
|
|
84
|
+
id: z.ZodString;
|
|
85
85
|
countryCode: z.ZodString;
|
|
86
86
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
87
87
|
code: z.ZodString;
|
|
88
88
|
name: z.ZodString;
|
|
89
|
-
parentId: z.ZodNullable<z.
|
|
89
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
90
90
|
source: z.ZodString;
|
|
91
91
|
}, "strict", z.ZodTypeAny, {
|
|
92
92
|
code: string;
|
|
@@ -127,12 +127,12 @@ type GetDepartmentsParams = z.input<typeof GetDepartmentsParamsSchema>;
|
|
|
127
127
|
type GetDepartmentsParamsParsed = z.output<typeof GetDepartmentsParamsSchema>;
|
|
128
128
|
/** Alias de provincia (level2). */
|
|
129
129
|
declare const ProvinceSchema: z.ZodObject<{
|
|
130
|
-
id: z.
|
|
130
|
+
id: z.ZodString;
|
|
131
131
|
countryCode: z.ZodString;
|
|
132
132
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
133
133
|
code: z.ZodString;
|
|
134
134
|
name: z.ZodString;
|
|
135
|
-
parentId: z.ZodNullable<z.
|
|
135
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
136
136
|
source: z.ZodString;
|
|
137
137
|
}, "strict", z.ZodTypeAny, {
|
|
138
138
|
code: string;
|
|
@@ -153,12 +153,12 @@ declare const ProvinceSchema: z.ZodObject<{
|
|
|
153
153
|
}>;
|
|
154
154
|
type Province = GeoDivision;
|
|
155
155
|
declare const ProvincesSchema: z.ZodArray<z.ZodObject<{
|
|
156
|
-
id: z.
|
|
156
|
+
id: z.ZodString;
|
|
157
157
|
countryCode: z.ZodString;
|
|
158
158
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
159
159
|
code: z.ZodString;
|
|
160
160
|
name: z.ZodString;
|
|
161
|
-
parentId: z.ZodNullable<z.
|
|
161
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
162
162
|
source: z.ZodString;
|
|
163
163
|
}, "strict", z.ZodTypeAny, {
|
|
164
164
|
code: string;
|
|
@@ -202,12 +202,12 @@ type GetProvincesParams = z.input<typeof GetProvincesParamsSchema>;
|
|
|
202
202
|
type GetProvincesParamsParsed = z.output<typeof GetProvincesParamsSchema>;
|
|
203
203
|
/** Alias de distrito (level3). */
|
|
204
204
|
declare const DistrictSchema: z.ZodObject<{
|
|
205
|
-
id: z.
|
|
205
|
+
id: z.ZodString;
|
|
206
206
|
countryCode: z.ZodString;
|
|
207
207
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
208
208
|
code: z.ZodString;
|
|
209
209
|
name: z.ZodString;
|
|
210
|
-
parentId: z.ZodNullable<z.
|
|
210
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
211
211
|
source: z.ZodString;
|
|
212
212
|
}, "strict", z.ZodTypeAny, {
|
|
213
213
|
code: string;
|
|
@@ -228,12 +228,12 @@ declare const DistrictSchema: z.ZodObject<{
|
|
|
228
228
|
}>;
|
|
229
229
|
type District = GeoDivision;
|
|
230
230
|
declare const DistrictsSchema: z.ZodArray<z.ZodObject<{
|
|
231
|
-
id: z.
|
|
231
|
+
id: z.ZodString;
|
|
232
232
|
countryCode: z.ZodString;
|
|
233
233
|
type: z.ZodEnum<["level1", "level2", "level3"]>;
|
|
234
234
|
code: z.ZodString;
|
|
235
235
|
name: z.ZodString;
|
|
236
|
-
parentId: z.ZodNullable<z.
|
|
236
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
237
237
|
source: z.ZodString;
|
|
238
238
|
}, "strict", z.ZodTypeAny, {
|
|
239
239
|
code: string;
|
package/dist/models/geo.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
// src/models/geo.ts
|
|
4
|
-
var EntityIdSchema = z.
|
|
5
|
-
|
|
6
|
-
z.string().regex(/^\d+$/, "Expected numeric id")
|
|
7
|
-
]);
|
|
4
|
+
var EntityIdSchema = z.string().min(1, "Expected resource id");
|
|
5
|
+
z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
8
6
|
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
9
7
|
EntityIdSchema.optional();
|
|
10
8
|
|
package/dist/models/geo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/ids.ts","../../src/models/geo.ts"],"names":["z"],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../src/models/ids.ts","../../src/models/geo.ts"],"names":["z"],"mappings":";;;AAGO,IAAM,iBAAiB,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,sBAAsB,CAAA;AAGvC,CAAA,CAC5B,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB;AAE3C,IAAM,sBAAA,GAAyB,eAAe,QAAA,EAAS;AACxB,eAAe,QAAA;;;ACN9C,IAAM,aAAA,GAAgBA,EAC1B,MAAA,CAAO;AAAA,EACN,IAAA,EAAMA,CAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EACzB,IAAA,EAAMA,CAAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC;AACxB,CAAC,EACA,MAAA;AAII,IAAM,eAAA,GAAkBA,CAAAA,CAAE,KAAA,CAAM,aAAa;AAK7C,IAAM,wBAAwBA,CAAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,QAAA,EAAU,QAAQ,CAAC;AAKnE,IAAM,iBAAA,GAAoBA,EAC9B,MAAA,CAAO;AAAA,EACN,EAAA,EAAI,cAAA;AAAA,EACJ,WAAA,EAAaA,CAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,C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A,EAAQA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,EAAE,CAAA;AAAA,EAC7B,KAAA,EAAOA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,QAAA,EAAS,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,OAAA,CAAQ,GAAG;AACzD,CAAC;AAMM,IAAM,cAAA,GAAiB;AAGvB,IAAM,eAAA,GAAkBA,CAAAA,CAAE,KAAA,CAAM,cAAc;AAI9C,IAAM,wBAAA,GAA2BA,EAAE,MAAA,CAAO;AAAA,EAC/C,WAAA,EAAaA,CAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EAChC,YAAA,EAAcA,CAAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC9B,MAAA,EAAQA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,QAAQ,MAAM,CAAA;AAAA,EACxC,MAAA,EAAQA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAQ,EAAE,CAAA;AAAA,EAC7B,KAAA,EAAOA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,QAAA,EAAS,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,OAAA,CAAQ,GAAG;AACzD,CAAC","file":"geo.js","sourcesContent":["import { z } from 'zod'\n\n/** Opaque public resource identifier. Consumers must not infer its storage type. */\nexport const EntityIdSchema = z.string().min(1, 'Expected resource id')\n\n/** Opaque token used by storefront cart routes. */\nexport const CartTokenSchema = z\n .string()\n .min(1)\n .max(32)\n .regex(/^[A-Za-z0-9_-]+$/, 'Expected cart token')\n\nexport const NullableEntityIdSchema = EntityIdSchema.nullable()\nexport const OptionalEntityIdSchema = EntityIdSchema.optional()\n\nexport type EntityId = z.infer<typeof EntityIdSchema>\nexport type CartToken = z.infer<typeof CartTokenSchema>\n","import { z } from 'zod'\nimport {\n EntityIdSchema,\n NullableEntityIdSchema,\n} from './ids'\n\n/** País ISO 3166-1 alpha-2 (`GET /v1/geo/countries`). */\nexport const CountrySchema = z\n .object({\n code: z.string().length(2),\n name: z.string().min(1),\n })\n .strict()\n\nexport type Country = z.infer<typeof CountrySchema>\n\nexport const CountriesSchema = z.array(CountrySchema)\n\nexport type Countries = z.infer<typeof CountriesSchema>\n\n/** Nivel administrativo geo (`level1` = departamento, etc.). */\nexport const GeoDivisionTypeSchema = z.enum(['level1', 'level2', 'level3'])\n\nexport type GeoDivisionType = z.infer<typeof GeoDivisionTypeSchema>\n\n/** División administrativa (`GET /v1/geo/departments`, …). */\nexport const GeoDivisionSchema = z\n .object({\n id: EntityIdSchema,\n countryCode: z.string().length(2),\n type: GeoDivisionTypeSchema,\n code: z.string().min(1),\n name: z.string().min(1),\n parentId: NullableEntityIdSchema,\n source: z.string().min(1),\n })\n .strict()\n\nexport type GeoDivision = z.infer<typeof GeoDivisionSchema>\n\n/** Alias de departamento (level1). */\nexport const DepartmentSchema = GeoDivisionSchema\nexport type Department = GeoDivision\n\nexport const DepartmentsSchema = z.array(DepartmentSchema)\nexport type Departments = z.infer<typeof DepartmentsSchema>\n\n/** Query de `GET /v1/geo/departments`. */\nexport const GetDepartmentsParamsSchema = z.object({\n countryCode: z.string().length(2),\n source: z.string().min(1).default('inei'),\n search: z.string().default(''),\n limit: z.number().int().positive().max(500).default(200),\n})\n\nexport type GetDepartmentsParams = z.input<typeof GetDepartmentsParamsSchema>\nexport type GetDepartmentsParamsParsed = z.output<typeof GetDepartmentsParamsSchema>\n\n/** Alias de provincia (level2). */\nexport const ProvinceSchema = GeoDivisionSchema\nexport type Province = GeoDivision\n\nexport const ProvincesSchema = z.array(ProvinceSchema)\nexport type Provinces = z.infer<typeof ProvincesSchema>\n\n/** Query de `GET /v1/geo/provinces`. */\nexport const GetProvincesParamsSchema = z.object({\n countryCode: z.string().length(2),\n departmentCode: z.string().min(1),\n source: z.string().min(1).default('inei'),\n search: z.string().default(''),\n limit: z.number().int().positive().max(500).default(200),\n})\n\nexport type GetProvincesParams = z.input<typeof GetProvincesParamsSchema>\nexport type GetProvincesParamsParsed = z.output<typeof GetProvincesParamsSchema>\n\n/** Alias de distrito (level3). */\nexport const DistrictSchema = GeoDivisionSchema\nexport type District = GeoDivision\n\nexport const DistrictsSchema = z.array(DistrictSchema)\nexport type Districts = z.infer<typeof DistrictsSchema>\n\n/** Query de `GET /v1/geo/districts`. */\nexport const GetDistrictsParamsSchema = z.object({\n countryCode: z.string().length(2),\n provinceCode: z.string().min(1),\n source: z.string().min(1).default('inei'),\n search: z.string().default(''),\n limit: z.number().int().positive().max(500).default(200),\n})\n\nexport type GetDistrictsParams = z.input<typeof GetDistrictsParamsSchema>\nexport type GetDistrictsParamsParsed = z.output<typeof GetDistrictsParamsSchema>\n"]}
|
package/dist/models/ids.cjs
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
|
|
5
5
|
// src/models/ids.ts
|
|
6
|
-
var EntityIdSchema = zod.z.
|
|
7
|
-
|
|
8
|
-
zod.z.string().regex(/^\d+$/, "Expected numeric id")
|
|
9
|
-
]);
|
|
6
|
+
var EntityIdSchema = zod.z.string().min(1, "Expected resource id");
|
|
7
|
+
var CartTokenSchema = zod.z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
10
8
|
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
11
9
|
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
12
10
|
|
|
11
|
+
exports.CartTokenSchema = CartTokenSchema;
|
|
13
12
|
exports.EntityIdSchema = EntityIdSchema;
|
|
14
13
|
exports.NullableEntityIdSchema = NullableEntityIdSchema;
|
|
15
14
|
exports.OptionalEntityIdSchema = OptionalEntityIdSchema;
|
package/dist/models/ids.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/ids.ts"],"names":["z"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/models/ids.ts"],"names":["z"],"mappings":";;;;;AAGO,IAAM,iBAAiBA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,sBAAsB;AAG/D,IAAM,eAAA,GAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB;AAE3C,IAAM,sBAAA,GAAyB,eAAe,QAAA;AAC9C,IAAM,sBAAA,GAAyB,eAAe,QAAA","file":"ids.cjs","sourcesContent":["import { z } from 'zod'\n\n/** Opaque public resource identifier. Consumers must not infer its storage type. */\nexport const EntityIdSchema = z.string().min(1, 'Expected resource id')\n\n/** Opaque token used by storefront cart routes. */\nexport const CartTokenSchema = z\n .string()\n .min(1)\n .max(32)\n .regex(/^[A-Za-z0-9_-]+$/, 'Expected cart token')\n\nexport const NullableEntityIdSchema = EntityIdSchema.nullable()\nexport const OptionalEntityIdSchema = EntityIdSchema.optional()\n\nexport type EntityId = z.infer<typeof EntityIdSchema>\nexport type CartToken = z.infer<typeof CartTokenSchema>\n"]}
|
package/dist/models/ids.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
9
|
-
declare const OptionalEntityIdSchema: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
3
|
+
/** Opaque public resource identifier. Consumers must not infer its storage type. */
|
|
4
|
+
declare const EntityIdSchema: z.ZodString;
|
|
5
|
+
/** Opaque token used by storefront cart routes. */
|
|
6
|
+
declare const CartTokenSchema: z.ZodString;
|
|
7
|
+
declare const NullableEntityIdSchema: z.ZodNullable<z.ZodString>;
|
|
8
|
+
declare const OptionalEntityIdSchema: z.ZodOptional<z.ZodString>;
|
|
10
9
|
type EntityId = z.infer<typeof EntityIdSchema>;
|
|
10
|
+
type CartToken = z.infer<typeof CartTokenSchema>;
|
|
11
11
|
|
|
12
|
-
export { type EntityId, EntityIdSchema, NullableEntityIdSchema, OptionalEntityIdSchema };
|
|
12
|
+
export { type CartToken, CartTokenSchema, type EntityId, EntityIdSchema, NullableEntityIdSchema, OptionalEntityIdSchema };
|
package/dist/models/ids.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
9
|
-
declare const OptionalEntityIdSchema: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
3
|
+
/** Opaque public resource identifier. Consumers must not infer its storage type. */
|
|
4
|
+
declare const EntityIdSchema: z.ZodString;
|
|
5
|
+
/** Opaque token used by storefront cart routes. */
|
|
6
|
+
declare const CartTokenSchema: z.ZodString;
|
|
7
|
+
declare const NullableEntityIdSchema: z.ZodNullable<z.ZodString>;
|
|
8
|
+
declare const OptionalEntityIdSchema: z.ZodOptional<z.ZodString>;
|
|
10
9
|
type EntityId = z.infer<typeof EntityIdSchema>;
|
|
10
|
+
type CartToken = z.infer<typeof CartTokenSchema>;
|
|
11
11
|
|
|
12
|
-
export { type EntityId, EntityIdSchema, NullableEntityIdSchema, OptionalEntityIdSchema };
|
|
12
|
+
export { type CartToken, CartTokenSchema, type EntityId, EntityIdSchema, NullableEntityIdSchema, OptionalEntityIdSchema };
|
package/dist/models/ids.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
// src/models/ids.ts
|
|
4
|
-
var EntityIdSchema = z.
|
|
5
|
-
|
|
6
|
-
z.string().regex(/^\d+$/, "Expected numeric id")
|
|
7
|
-
]);
|
|
4
|
+
var EntityIdSchema = z.string().min(1, "Expected resource id");
|
|
5
|
+
var CartTokenSchema = z.string().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Expected cart token");
|
|
8
6
|
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
9
7
|
var OptionalEntityIdSchema = EntityIdSchema.optional();
|
|
10
8
|
|
|
11
|
-
export { EntityIdSchema, NullableEntityIdSchema, OptionalEntityIdSchema };
|
|
9
|
+
export { CartTokenSchema, EntityIdSchema, NullableEntityIdSchema, OptionalEntityIdSchema };
|
|
12
10
|
//# sourceMappingURL=ids.js.map
|
|
13
11
|
//# sourceMappingURL=ids.js.map
|
package/dist/models/ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/ids.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../src/models/ids.ts"],"names":[],"mappings":";;;AAGO,IAAM,iBAAiB,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,sBAAsB;AAG/D,IAAM,eAAA,GAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB;AAE3C,IAAM,sBAAA,GAAyB,eAAe,QAAA;AAC9C,IAAM,sBAAA,GAAyB,eAAe,QAAA","file":"ids.js","sourcesContent":["import { z } from 'zod'\n\n/** Opaque public resource identifier. Consumers must not infer its storage type. */\nexport const EntityIdSchema = z.string().min(1, 'Expected resource id')\n\n/** Opaque token used by storefront cart routes. */\nexport const CartTokenSchema = z\n .string()\n .min(1)\n .max(32)\n .regex(/^[A-Za-z0-9_-]+$/, 'Expected cart token')\n\nexport const NullableEntityIdSchema = EntityIdSchema.nullable()\nexport const OptionalEntityIdSchema = EntityIdSchema.optional()\n\nexport type EntityId = z.infer<typeof EntityIdSchema>\nexport type CartToken = z.infer<typeof CartTokenSchema>\n"]}
|