@open-dpp/dto 2.10.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/index.d.ts +4 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -0
  4. package/dist/permalinks/permalink.dto.d.ts +3690 -9
  5. package/dist/permalinks/permalink.dto.d.ts.map +1 -1
  6. package/dist/permalinks/permalink.dto.js +89 -6
  7. package/dist/shared/permalink-base-url.schema.d.ts +1 -0
  8. package/dist/shared/permalink-base-url.schema.d.ts.map +1 -1
  9. package/dist/shared/permalink-base-url.schema.js +9 -0
  10. package/dist/unique-product-identifiers/create-internal-unique-product-identifier.dto.d.ts +6 -0
  11. package/dist/unique-product-identifiers/create-internal-unique-product-identifier.dto.d.ts.map +1 -0
  12. package/dist/unique-product-identifiers/create-internal-unique-product-identifier.dto.js +9 -0
  13. package/dist/unique-product-identifiers/create-unique-product-identifier.dto.d.ts +9 -0
  14. package/dist/unique-product-identifiers/create-unique-product-identifier.dto.d.ts.map +1 -0
  15. package/dist/unique-product-identifiers/create-unique-product-identifier.dto.js +13 -0
  16. package/dist/unique-product-identifiers/gs1/gs1-ai-description.d.ts +6 -4
  17. package/dist/unique-product-identifiers/gs1/gs1-ai-description.d.ts.map +1 -1
  18. package/dist/unique-product-identifiers/gs1/gs1-ai-description.js +13 -3
  19. package/dist/unique-product-identifiers/gs1/gs1-digital-link.d.ts +10 -0
  20. package/dist/unique-product-identifiers/gs1/gs1-digital-link.d.ts.map +1 -1
  21. package/dist/unique-product-identifiers/gs1/gs1-digital-link.js +20 -6
  22. package/dist/unique-product-identifiers/unique-product-identifier-list-item.dto.d.ts +104 -0
  23. package/dist/unique-product-identifiers/unique-product-identifier-list-item.dto.d.ts.map +1 -0
  24. package/dist/unique-product-identifiers/unique-product-identifier-list-item.dto.js +42 -0
  25. package/dist/unique-product-identifiers/unique-product-identifier-type.d.ts +1 -1
  26. package/dist/unique-product-identifiers/update-unique-product-identifier.dto.d.ts +8 -0
  27. package/dist/unique-product-identifiers/update-unique-product-identifier.dto.d.ts.map +1 -0
  28. package/dist/unique-product-identifiers/update-unique-product-identifier.dto.js +12 -0
  29. package/package.json +1 -1
  30. package/src/index.ts +4 -0
  31. package/src/permalinks/permalink.dto.spec.ts +469 -0
  32. package/src/permalinks/permalink.dto.ts +103 -5
  33. package/src/shared/permalink-base-url.schema.spec.ts +17 -1
  34. package/src/shared/permalink-base-url.schema.ts +8 -0
  35. package/src/unique-product-identifiers/create-internal-unique-product-identifier.dto.ts +11 -0
  36. package/src/unique-product-identifiers/create-unique-product-identifier.dto.ts +15 -0
  37. package/src/unique-product-identifiers/gs1/gs1-ai-description.spec.ts +14 -0
  38. package/src/unique-product-identifiers/gs1/gs1-ai-description.ts +16 -5
  39. package/src/unique-product-identifiers/gs1/gs1-digital-link.spec.ts +16 -0
  40. package/src/unique-product-identifiers/gs1/gs1-digital-link.ts +22 -6
  41. package/src/unique-product-identifiers/unique-product-identifier-list-item.dto.ts +64 -0
  42. package/src/unique-product-identifiers/update-unique-product-identifier.dto.ts +14 -0
@@ -1 +1 @@
1
- {"version":3,"file":"permalink.dto.d.ts","sourceRoot":"","sources":["../../src/permalinks/permalink.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAAoB,CAAC;AAI3E,eAAO,MAAM,mBAAmB,aAM8C,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,eAAe,+CAA2C,CAAC;AAExE,eAAO,MAAM,2BAA2B,aAA6B,CAAC;AACtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,yBAAyB;;;;i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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOH,CAAC;AAE3C,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PassportPermalinkBundleDtoSchema = exports.PermalinkUpdateRequestSchema = exports.PermalinkMetadataDtoSchema = exports.PermalinkListDtoSchema = exports.PermalinkPublicDtoSchema = exports.PermalinkFallbackBaseUrlSourceSchema = exports.PermalinkDtoSchema = exports.PermalinkInvariantsSchema = exports.PermalinkPublishedUrlSchema = exports.PermalinkSchema = exports.PermalinkSlugSchema = exports.PERMALINK_RESERVED_SLUGS = void 0;
3
+ exports.PassportPermalinkBundleDtoSchema = exports.PermalinkUpdateRequestSchema = exports.PermalinkCreateRequestSchema = exports.PermalinkMetadataDtoSchema = exports.PermalinkPaginationDtoSchema = exports.PermalinkListDtoSchema = exports.PermalinkPublicDtoSchema = exports.PermalinkFallbackBaseUrlSourceSchema = exports.PermalinkDtoSchema = exports.PermalinkInvariantsSchema = exports.PermalinkKindSchema = exports.LEGACY_PERMALINK_KIND = exports.PermalinkKind = exports.PermalinkPublishedUrlSchema = exports.PermalinkSchema = exports.PermalinkSlugSchema = exports.PERMALINK_RESERVED_SLUGS = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const branding_dto_1 = require("../branding/branding.dto");
6
+ const gs1_data_attributes_dto_1 = require("../unique-product-identifiers/gs1/gs1-data-attributes.dto");
6
7
  const passport_dto_1 = require("../passports/passport.dto");
7
8
  const presentation_configuration_dto_1 = require("../presentation-configurations/presentation-configuration.dto");
8
9
  const digital_product_document_schemas_1 = require("../digital-product-document/digital-product-document.schemas");
10
+ const pagination_dto_1 = require("../shared/pagination.dto");
9
11
  const permalink_base_url_schema_1 = require("../shared/permalink-base-url.schema");
10
12
  exports.PERMALINK_RESERVED_SLUGS = ["new", "edit"];
11
13
  const reservedSlugSet = new Set(exports.PERMALINK_RESERVED_SLUGS);
@@ -18,20 +20,71 @@ exports.PermalinkSlugSchema = zod_1.z
18
20
  .refine((slug) => !reservedSlugSet.has(slug), { error: "Slug is reserved" });
19
21
  exports.PermalinkSchema = zod_1.z.union([zod_1.z.uuid(), exports.PermalinkSlugSchema]);
20
22
  exports.PermalinkPublishedUrlSchema = zod_1.z.string().url().max(2048);
21
- exports.PermalinkInvariantsSchema = zod_1.z.object({
22
- presentationConfigurationId: zod_1.z.uuid(),
23
- slug: exports.PermalinkSlugSchema.nullable(),
23
+ exports.PermalinkKind = {
24
+ OPEN_DPP: "open-dpp",
25
+ GS1_LINK: "gs1-link",
26
+ };
27
+ exports.LEGACY_PERMALINK_KIND = "presentation";
28
+ exports.PermalinkKindSchema = zod_1.z.enum([exports.PermalinkKind.OPEN_DPP, exports.PermalinkKind.GS1_LINK]);
29
+ const PermalinkInvariantsOpenDppSchema = zod_1.z
30
+ .object({
31
+ kind: zod_1.z.literal(exports.PermalinkKind.OPEN_DPP),
32
+ passportId: zod_1.z.uuid(),
33
+ presentationConfigurationId: zod_1.z.uuid().nullish(),
34
+ uniqueProductIdentifierId: zod_1.z.uuid().nullish(),
35
+ slug: exports.PermalinkSlugSchema.nullish(),
36
+ baseUrl: permalink_base_url_schema_1.PermalinkBaseUrlSchema.nullable().optional(),
37
+ })
38
+ .strict();
39
+ const PermalinkInvariantsGs1LinkSchema = zod_1.z.object({
40
+ kind: zod_1.z.literal(exports.PermalinkKind.GS1_LINK),
41
+ passportId: zod_1.z.uuid(),
42
+ uniqueProductIdentifierId: zod_1.z.uuid(),
43
+ presentationConfigurationId: zod_1.z.uuid().nullable(),
44
+ gs1DataAttributes: gs1_data_attributes_dto_1.Gs1DataAttributesSchema.nullable().optional(),
45
+ slug: exports.PermalinkSlugSchema.nullish(),
24
46
  baseUrl: permalink_base_url_schema_1.PermalinkBaseUrlSchema.nullable().optional(),
25
47
  });
48
+ exports.PermalinkInvariantsSchema = zod_1.z.discriminatedUnion("kind", [
49
+ PermalinkInvariantsOpenDppSchema,
50
+ PermalinkInvariantsGs1LinkSchema,
51
+ ]);
26
52
  exports.PermalinkDtoSchema = zod_1.z
27
53
  .object({
28
54
  id: zod_1.z.uuid(),
55
+ kind: exports.PermalinkKindSchema.default(exports.PermalinkKind.OPEN_DPP),
56
+ passportId: zod_1.z.uuid(),
29
57
  slug: exports.PermalinkSlugSchema.nullable(),
30
58
  baseUrl: permalink_base_url_schema_1.PermalinkBaseUrlSchema.nullish(),
31
59
  publishedUrl: exports.PermalinkPublishedUrlSchema.nullish(),
32
- presentationConfigurationId: zod_1.z.uuid(),
60
+ presentationConfigurationId: zod_1.z.uuid().nullable(),
61
+ uniqueProductIdentifierId: zod_1.z.uuid().nullable().default(null),
62
+ gs1DataAttributes: gs1_data_attributes_dto_1.Gs1DataAttributesSchema.nullable().default(null),
33
63
  createdAt: digital_product_document_schemas_1.DateTimeSchema,
34
64
  updatedAt: digital_product_document_schemas_1.DateTimeSchema,
65
+ })
66
+ .check((ctx) => {
67
+ const { kind, uniqueProductIdentifierId, gs1DataAttributes } = ctx.value;
68
+ if (kind === exports.PermalinkKind.GS1_LINK) {
69
+ if (uniqueProductIdentifierId == null) {
70
+ ctx.issues.push({
71
+ code: "custom",
72
+ input: ctx.value,
73
+ message: 'A gs1-link permalink requires a non-null "uniqueProductIdentifierId"',
74
+ path: ["uniqueProductIdentifierId"],
75
+ });
76
+ }
77
+ }
78
+ else if (kind === exports.PermalinkKind.OPEN_DPP) {
79
+ if (gs1DataAttributes != null) {
80
+ ctx.issues.push({
81
+ code: "custom",
82
+ input: ctx.value,
83
+ message: 'An open-dpp permalink must have "gs1DataAttributes" = null',
84
+ path: ["gs1DataAttributes"],
85
+ });
86
+ }
87
+ }
35
88
  })
36
89
  .meta({ id: "Permalink" });
37
90
  exports.PermalinkFallbackBaseUrlSourceSchema = zod_1.z.enum(["branding", "instance"]);
@@ -41,22 +94,52 @@ exports.PermalinkPublicDtoSchema = exports.PermalinkDtoSchema.extend({
41
94
  fallbackBaseUrlSource: exports.PermalinkFallbackBaseUrlSourceSchema,
42
95
  }).meta({ id: "PermalinkPublic" });
43
96
  exports.PermalinkListDtoSchema = zod_1.z.array(exports.PermalinkPublicDtoSchema);
97
+ exports.PermalinkPaginationDtoSchema = zod_1.z
98
+ .object({
99
+ ...pagination_dto_1.PagingMetadataDtoSchema.shape,
100
+ result: exports.PermalinkPublicDtoSchema.array(),
101
+ })
102
+ .meta({ id: "Permalinks" });
44
103
  exports.PermalinkMetadataDtoSchema = zod_1.z.object({
45
104
  passportId: zod_1.z.uuid(),
46
105
  organizationId: zod_1.z.string().min(1),
47
106
  templateId: zod_1.z.uuid().nullish(),
48
107
  });
108
+ const PermalinkCreateOpenDppSchema = zod_1.z
109
+ .object({
110
+ kind: zod_1.z.literal(exports.PermalinkKind.OPEN_DPP),
111
+ passportId: zod_1.z.uuid(),
112
+ presentationConfigurationId: zod_1.z.uuid().nullish(),
113
+ uniqueProductIdentifierId: zod_1.z.uuid().nullish(),
114
+ slug: exports.PermalinkSlugSchema.nullish(),
115
+ baseUrl: permalink_base_url_schema_1.PermalinkBaseUrlSchema.nullable().optional(),
116
+ })
117
+ .strict();
118
+ const PermalinkCreateGs1LinkSchema = zod_1.z.object({
119
+ kind: zod_1.z.literal(exports.PermalinkKind.GS1_LINK),
120
+ passportId: zod_1.z.uuid(),
121
+ uniqueProductIdentifierId: zod_1.z.uuid(),
122
+ presentationConfigurationId: zod_1.z.uuid().nullable().optional(),
123
+ gs1DataAttributes: gs1_data_attributes_dto_1.Gs1DataAttributesSchema.nullable().optional(),
124
+ slug: exports.PermalinkSlugSchema.nullish(),
125
+ baseUrl: permalink_base_url_schema_1.PermalinkBaseUrlSchema.nullable().optional(),
126
+ });
127
+ exports.PermalinkCreateRequestSchema = zod_1.z
128
+ .discriminatedUnion("kind", [PermalinkCreateOpenDppSchema, PermalinkCreateGs1LinkSchema])
129
+ .meta({ id: "PermalinkCreateRequest" });
49
130
  exports.PermalinkUpdateRequestSchema = zod_1.z
50
131
  .object({
51
132
  slug: exports.PermalinkSlugSchema.nullish(),
52
133
  baseUrl: permalink_base_url_schema_1.PermalinkBaseUrlSchema.nullish(),
134
+ gs1DataAttributes: gs1_data_attributes_dto_1.Gs1DataAttributesSchema.nullish(),
135
+ presentationConfigurationId: zod_1.z.uuid().nullish(),
53
136
  })
54
137
  .meta({ id: "PermalinkUpdateRequest" });
55
138
  exports.PassportPermalinkBundleDtoSchema = zod_1.z
56
139
  .object({
57
140
  passport: passport_dto_1.PassportDtoSchema,
58
141
  branding: branding_dto_1.BrandingDtoSchema,
59
- presentationConfiguration: presentation_configuration_dto_1.PresentationConfigurationDtoSchema,
142
+ presentationConfiguration: presentation_configuration_dto_1.PresentationConfigurationDtoSchema.nullable(),
60
143
  publicUrl: zod_1.z.string().url(),
61
144
  })
62
145
  .meta({ id: "PassportPermalinkBundle" });
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export declare function canonicaliseBaseUrl(s: string): string;
3
+ export declare function baseUrlOrigin(s: string): string;
3
4
  export declare const PermalinkBaseUrlSchema: z.ZodString;
4
5
  export type PermalinkBaseUrl = z.infer<typeof PermalinkBaseUrlSchema>;
5
6
  //# sourceMappingURL=permalink-base-url.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permalink-base-url.schema.d.ts","sourceRoot":"","sources":["../../src/shared/permalink-base-url.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CASrD;AAED,eAAO,MAAM,sBAAsB,aAoCF,CAAC;AAElC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"permalink-base-url.schema.d.ts","sourceRoot":"","sources":["../../src/shared/permalink-base-url.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CASrD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,eAAO,MAAM,sBAAsB,aAoCF,CAAC;AAElC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermalinkBaseUrlSchema = void 0;
4
4
  exports.canonicaliseBaseUrl = canonicaliseBaseUrl;
5
+ exports.baseUrlOrigin = baseUrlOrigin;
5
6
  /// <reference lib="dom" />
6
7
  const zod_1 = require("zod");
7
8
  function canonicaliseBaseUrl(s) {
@@ -15,6 +16,14 @@ function canonicaliseBaseUrl(s) {
15
16
  return s;
16
17
  }
17
18
  }
19
+ function baseUrlOrigin(s) {
20
+ try {
21
+ return new URL(s).origin;
22
+ }
23
+ catch {
24
+ return s;
25
+ }
26
+ }
18
27
  exports.PermalinkBaseUrlSchema = zod_1.z
19
28
  .string()
20
29
  .min(8)
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const CreateInternalUniqueProductIdentifierRequestSchema: z.ZodObject<{
3
+ referenceId: z.ZodUUID;
4
+ }, z.core.$strip>;
5
+ export type CreateInternalUniqueProductIdentifierRequest = z.infer<typeof CreateInternalUniqueProductIdentifierRequestSchema>;
6
+ //# sourceMappingURL=create-internal-unique-product-identifier.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-internal-unique-product-identifier.dto.d.ts","sourceRoot":"","sources":["../../src/unique-product-identifiers/create-internal-unique-product-identifier.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kDAAkD;;iBAIA,CAAC;AAEhE,MAAM,MAAM,4CAA4C,GAAG,CAAC,CAAC,KAAK,CAChE,OAAO,kDAAkD,CAC1D,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateInternalUniqueProductIdentifierRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.CreateInternalUniqueProductIdentifierRequestSchema = zod_1.z
6
+ .object({
7
+ referenceId: zod_1.z.uuid(),
8
+ })
9
+ .meta({ id: "CreateInternalUniqueProductIdentifierRequest" });
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ export declare const CreateGs1UniqueProductIdentifierRequestSchema: z.ZodObject<{
3
+ referenceId: z.ZodUUID;
4
+ gtin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
5
+ batch: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodString>>>;
6
+ serial: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodString>>>;
7
+ }, z.core.$strip>;
8
+ export type CreateGs1UniqueProductIdentifierRequest = z.infer<typeof CreateGs1UniqueProductIdentifierRequestSchema>;
9
+ //# sourceMappingURL=create-unique-product-identifier.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-unique-product-identifier.dto.d.ts","sourceRoot":"","sources":["../../src/unique-product-identifiers/create-unique-product-identifier.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,6CAA6C;;;;;iBAOA,CAAC;AAE3D,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,6CAA6C,CACrD,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateGs1UniqueProductIdentifierRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const gs1_digital_link_1 = require("./gs1/gs1-digital-link");
6
+ exports.CreateGs1UniqueProductIdentifierRequestSchema = zod_1.z
7
+ .object({
8
+ referenceId: zod_1.z.uuid(),
9
+ gtin: gs1_digital_link_1.GtinInputSchema,
10
+ batch: gs1_digital_link_1.Cset82ComponentInputSchema.optional(),
11
+ serial: gs1_digital_link_1.Cset82ComponentInputSchema.optional(),
12
+ })
13
+ .meta({ id: "CreateGs1UniqueProductIdentifierRequest" });
@@ -1,15 +1,17 @@
1
- import { type Gs1AiI18nLang } from "./gs1-ai-i18n";
2
1
  /**
3
2
  * Resolve the translated description for a GS1 Application Identifier.
4
3
  *
5
4
  * Lookup chain: exact AI key -> family key ("n"/"s" collapse) -> "91-99"
6
- * range key; within the found row, the requested language falls back to
7
- * English (every vendored row carries English text).
5
+ * range key. `lang` accepts any BCP 47-ish tag ("de", "de-DE", "DE"); its
6
+ * primary subtag selects the vendored translation, and languages GS1 data
7
+ * doesn't carry fall back to English (every vendored row has English text).
8
+ * Which languages are vendored is an internal detail of this module — app
9
+ * display languages grow independently.
8
10
  *
9
11
  * Returns `undefined` for unknown AIs and non-AI input — callers fall back to
10
12
  * the English `title` from GS1_AI_TABLE as the last resort.
11
13
  *
12
14
  * Pure function, no I/O, no mutation.
13
15
  */
14
- export declare function getGs1AiDescription(ai: string, lang: Gs1AiI18nLang): string | undefined;
16
+ export declare function getGs1AiDescription(ai: string, lang: string): string | undefined;
15
17
  //# sourceMappingURL=gs1-ai-description.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gs1-ai-description.d.ts","sourceRoot":"","sources":["../../../src/unique-product-identifiers/gs1/gs1-ai-description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAuBhE;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAWvF"}
1
+ {"version":3,"file":"gs1-ai-description.d.ts","sourceRoot":"","sources":["../../../src/unique-product-identifiers/gs1/gs1-ai-description.ts"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWhF"}
@@ -21,12 +21,22 @@ function candidateKeys(ai) {
21
21
  }
22
22
  return keys;
23
23
  }
24
+ /** Resolve a language cell by BCP 47 primary subtag, falling back to English. */
25
+ function pickLanguageCell(entry, lang) {
26
+ const primary = lang.split("-")[0]?.toLowerCase() ?? "";
27
+ // Own enumerable entries only — a tag like "constructor" must not reach the prototype.
28
+ const cell = Object.entries(entry).find(([key]) => key === primary)?.[1];
29
+ return cell ?? entry.en;
30
+ }
24
31
  /**
25
32
  * Resolve the translated description for a GS1 Application Identifier.
26
33
  *
27
34
  * Lookup chain: exact AI key -> family key ("n"/"s" collapse) -> "91-99"
28
- * range key; within the found row, the requested language falls back to
29
- * English (every vendored row carries English text).
35
+ * range key. `lang` accepts any BCP 47-ish tag ("de", "de-DE", "DE"); its
36
+ * primary subtag selects the vendored translation, and languages GS1 data
37
+ * doesn't carry fall back to English (every vendored row has English text).
38
+ * Which languages are vendored is an internal detail of this module — app
39
+ * display languages grow independently.
30
40
  *
31
41
  * Returns `undefined` for unknown AIs and non-AI input — callers fall back to
32
42
  * the English `title` from GS1_AI_TABLE as the last resort.
@@ -40,7 +50,7 @@ function getGs1AiDescription(ai, lang) {
40
50
  for (const key of candidateKeys(ai)) {
41
51
  const entry = gs1_ai_i18n_1.GS1_AI_I18N[key];
42
52
  if (entry !== undefined) {
43
- return entry[lang] ?? entry.en;
53
+ return pickLanguageCell(entry, lang);
44
54
  }
45
55
  }
46
56
  return undefined;
@@ -142,6 +142,16 @@ export interface Gs1DigitalLinkParts {
142
142
  * length / the dot-segment rule.
143
143
  */
144
144
  export declare function buildGs1DigitalLink(resolverBase: string, parts: Gs1DigitalLinkParts): string;
145
+ /**
146
+ * Build the base-less canonical GS1 Digital Link path
147
+ * `01/{gtin14}[/10/{batch}][/21/{serial}]` (no leading slash, no query string).
148
+ * Same normalization, validation, and percent-encoding as `buildGs1DigitalLink`;
149
+ * usable as an exact-match canonical value for a GS1 identity.
150
+ *
151
+ * @throws Error when the GTIN is invalid or a batch/serial violates CSET-82 /
152
+ * length / the dot-segment rule.
153
+ */
154
+ export declare function buildGs1DigitalLinkPath(parts: Omit<Gs1DigitalLinkParts, "dataAttributes">): string;
145
155
  /**
146
156
  * Format a GS1 identity as its human-readable GS1 element string, e.g.
147
157
  * `(01) 04006381333931 (10) LOT-42 (21) SN-001`.
@@ -1 +1 @@
1
- {"version":3,"file":"gs1-digital-link.d.ts","sourceRoot":"","sources":["../../../src/unique-product-identifiers/gs1/gs1-digital-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAA4B,MAAM,oBAAoB,CAAC;AAelF,mCAAmC;AACnC,eAAO,MAAM,aAAa,KAAK,CAAC;AAIhC;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAe3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAczD;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,wDAU1B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,aAI0D,CAAC;AAEpF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,eAAO,M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;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAazE"}
1
+ {"version":3,"file":"gs1-digital-link.d.ts","sourceRoot":"","sources":["../../../src/unique-product-identifiers/gs1/gs1-digital-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAA4B,MAAM,oBAAoB,CAAC;AAelF,mCAAmC;AACnC,eAAO,MAAM,aAAa,KAAK,CAAC;AAIhC;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAe3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAczD;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,wDAU1B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,aAI0D,CAAC;AAEpF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAmBhD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO7D;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,aAKoD,CAAC;AAEvF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,sJAIE,CAAC;AAE1C,6GAA6G;AAC7G,eAAO,MAAM,WAAW,MAAoC,CAAC;AAC7D,4HAA4H;AAC5H,eAAO,MAAM,YAAY,MAAqC,CAAC;AAC/D,iHAAiH;AACjH,eAAO,MAAM,aAAa,MAA+B,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,EAAE,IAAI,kBAAkB,CAGzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAgB/E;AAcD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GACpD,MAAM,CAgBR;AAED,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAChD;AAyBD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAK5F;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,GACjD,MAAM,CAaR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAazE"}
@@ -8,6 +8,7 @@ exports.isGs1DataAttributeAi = isGs1DataAttributeAi;
8
8
  exports.isValidGs1DataAttributeValue = isValidGs1DataAttributeValue;
9
9
  exports.buildGs1DataAttributeQuery = buildGs1DataAttributeQuery;
10
10
  exports.buildGs1DigitalLink = buildGs1DigitalLink;
11
+ exports.buildGs1DigitalLinkPath = buildGs1DigitalLinkPath;
11
12
  exports.formatGs1ElementString = formatGs1ElementString;
12
13
  const zod_1 = require("zod");
13
14
  const permalink_base_url_schema_1 = require("../../shared/permalink-base-url.schema");
@@ -280,19 +281,32 @@ function normalizeOptionalComponent(value, label) {
280
281
  * length / the dot-segment rule.
281
282
  */
282
283
  function buildGs1DigitalLink(resolverBase, parts) {
284
+ const base = (0, permalink_base_url_schema_1.canonicaliseBaseUrl)(resolverBase);
285
+ let url = `${base}/${buildGs1DigitalLinkPath(parts)}`;
286
+ url += buildGs1DataAttributeQuery(parts.dataAttributes);
287
+ return url;
288
+ }
289
+ /**
290
+ * Build the base-less canonical GS1 Digital Link path
291
+ * `01/{gtin14}[/10/{batch}][/21/{serial}]` (no leading slash, no query string).
292
+ * Same normalization, validation, and percent-encoding as `buildGs1DigitalLink`;
293
+ * usable as an exact-match canonical value for a GS1 identity.
294
+ *
295
+ * @throws Error when the GTIN is invalid or a batch/serial violates CSET-82 /
296
+ * length / the dot-segment rule.
297
+ */
298
+ function buildGs1DigitalLinkPath(parts) {
283
299
  const gtin14 = normalizeToGtin14(parts.gtin);
284
300
  const batch = normalizeOptionalComponent(parts.batch, "Batch");
285
301
  const serial = normalizeOptionalComponent(parts.serial, "Serial");
286
- const base = (0, permalink_base_url_schema_1.canonicaliseBaseUrl)(resolverBase);
287
- let url = `${base}/${exports.GS1_AI_GTIN}/${gtin14}`;
302
+ let path = `${exports.GS1_AI_GTIN}/${gtin14}`;
288
303
  if (batch !== undefined) {
289
- url += `/${exports.GS1_AI_BATCH}/${encodeRfc3986(batch)}`;
304
+ path += `/${exports.GS1_AI_BATCH}/${encodeRfc3986(batch)}`;
290
305
  }
291
306
  if (serial !== undefined) {
292
- url += `/${exports.GS1_AI_SERIAL}/${encodeRfc3986(serial)}`;
307
+ path += `/${exports.GS1_AI_SERIAL}/${encodeRfc3986(serial)}`;
293
308
  }
294
- url += buildGs1DataAttributeQuery(parts.dataAttributes);
295
- return url;
309
+ return path;
296
310
  }
297
311
  /**
298
312
  * Format a GS1 identity as its human-readable GS1 element string, e.g.
@@ -0,0 +1,104 @@
1
+ import { z } from "zod";
2
+ export declare const UniqueProductIdentifierPermalinkSummaryDtoSchema: z.ZodObject<{
3
+ id: z.ZodUUID;
4
+ kind: z.ZodEnum<{
5
+ "open-dpp": "open-dpp";
6
+ "gs1-link": "gs1-link";
7
+ }>;
8
+ publicUrl: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export type UniqueProductIdentifierPermalinkSummaryDto = z.infer<typeof UniqueProductIdentifierPermalinkSummaryDtoSchema>;
11
+ export declare const UniqueProductIdentifierListItemDtoSchema: z.ZodObject<{
12
+ uuid: z.ZodUUID;
13
+ referenceId: z.ZodUUID;
14
+ type: z.ZodEnum<{
15
+ readonly OPEN_DPP_UUID: "OPEN_DPP_UUID";
16
+ readonly GS1: "GS1";
17
+ readonly GTIN: "GTIN";
18
+ readonly EAN: "EAN";
19
+ }>;
20
+ gtin: z.ZodNullable<z.ZodString>;
21
+ batch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ serial: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodString>>>;
23
+ granularity: z.ZodNullable<z.ZodEnum<{
24
+ batch: "batch";
25
+ model: "model";
26
+ item: "item";
27
+ }>>;
28
+ digitalLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ passportPublished: z.ZodBoolean;
30
+ permalink: z.ZodOptional<z.ZodNullable<z.ZodObject<{
31
+ id: z.ZodUUID;
32
+ kind: z.ZodEnum<{
33
+ "open-dpp": "open-dpp";
34
+ "gs1-link": "gs1-link";
35
+ }>;
36
+ publicUrl: z.ZodString;
37
+ }, z.core.$strip>>>;
38
+ }, z.core.$strip>;
39
+ export type UniqueProductIdentifierListItemDto = z.infer<typeof UniqueProductIdentifierListItemDtoSchema>;
40
+ export declare const UniqueProductIdentifierListDtoSchema: z.ZodArray<z.ZodObject<{
41
+ uuid: z.ZodUUID;
42
+ referenceId: z.ZodUUID;
43
+ type: z.ZodEnum<{
44
+ readonly OPEN_DPP_UUID: "OPEN_DPP_UUID";
45
+ readonly GS1: "GS1";
46
+ readonly GTIN: "GTIN";
47
+ readonly EAN: "EAN";
48
+ }>;
49
+ gtin: z.ZodNullable<z.ZodString>;
50
+ batch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ serial: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodString>>>;
52
+ granularity: z.ZodNullable<z.ZodEnum<{
53
+ batch: "batch";
54
+ model: "model";
55
+ item: "item";
56
+ }>>;
57
+ digitalLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ passportPublished: z.ZodBoolean;
59
+ permalink: z.ZodOptional<z.ZodNullable<z.ZodObject<{
60
+ id: z.ZodUUID;
61
+ kind: z.ZodEnum<{
62
+ "open-dpp": "open-dpp";
63
+ "gs1-link": "gs1-link";
64
+ }>;
65
+ publicUrl: z.ZodString;
66
+ }, z.core.$strip>>>;
67
+ }, z.core.$strip>>;
68
+ export type UniqueProductIdentifierListDto = z.infer<typeof UniqueProductIdentifierListDtoSchema>;
69
+ export declare const UniqueProductIdentifierPaginationDtoSchema: z.ZodObject<{
70
+ result: z.ZodArray<z.ZodObject<{
71
+ uuid: z.ZodUUID;
72
+ referenceId: z.ZodUUID;
73
+ type: z.ZodEnum<{
74
+ readonly OPEN_DPP_UUID: "OPEN_DPP_UUID";
75
+ readonly GS1: "GS1";
76
+ readonly GTIN: "GTIN";
77
+ readonly EAN: "EAN";
78
+ }>;
79
+ gtin: z.ZodNullable<z.ZodString>;
80
+ batch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ serial: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodString>>>;
82
+ granularity: z.ZodNullable<z.ZodEnum<{
83
+ batch: "batch";
84
+ model: "model";
85
+ item: "item";
86
+ }>>;
87
+ digitalLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
+ passportPublished: z.ZodBoolean;
89
+ permalink: z.ZodOptional<z.ZodNullable<z.ZodObject<{
90
+ id: z.ZodUUID;
91
+ kind: z.ZodEnum<{
92
+ "open-dpp": "open-dpp";
93
+ "gs1-link": "gs1-link";
94
+ }>;
95
+ publicUrl: z.ZodString;
96
+ }, z.core.$strip>>>;
97
+ }, z.core.$strip>>;
98
+ paging_metadata: z.ZodObject<{
99
+ cursor: z.ZodNullable<z.ZodString>;
100
+ total_count: z.ZodOptional<z.ZodNumber>;
101
+ }, z.core.$strip>;
102
+ }, z.core.$strip>;
103
+ export type UniqueProductIdentifierPaginationDto = z.infer<typeof UniqueProductIdentifierPaginationDtoSchema>;
104
+ //# sourceMappingURL=unique-product-identifier-list-item.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unique-product-identifier-list-item.dto.d.ts","sourceRoot":"","sources":["../../src/unique-product-identifiers/unique-product-identifier-list-item.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,gDAAgD;;;;;;;iBAMH,CAAC;AAE3D,MAAM,MAAM,0CAA0C,GAAG,CAAC,CAAC,KAAK,CAC9D,OAAO,gDAAgD,CACxD,CAAC;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqBH,CAAC;AAEnD,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,wCAAwC,CAChD,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAEhD,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKZ,CAAC;AAE5C,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,0CAA0C,CAClD,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UniqueProductIdentifierPaginationDtoSchema = exports.UniqueProductIdentifierListDtoSchema = exports.UniqueProductIdentifierListItemDtoSchema = exports.UniqueProductIdentifierPermalinkSummaryDtoSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const unique_product_identifier_type_1 = require("./unique-product-identifier-type");
6
+ const gs1_digital_link_1 = require("./gs1/gs1-digital-link");
7
+ const permalink_dto_1 = require("../permalinks/permalink.dto");
8
+ const pagination_dto_1 = require("../shared/pagination.dto");
9
+ exports.UniqueProductIdentifierPermalinkSummaryDtoSchema = zod_1.z
10
+ .object({
11
+ id: zod_1.z.uuid(),
12
+ kind: permalink_dto_1.PermalinkKindSchema,
13
+ publicUrl: zod_1.z.string().url(),
14
+ })
15
+ .meta({ id: "UniqueProductIdentifierPermalinkSummary" });
16
+ exports.UniqueProductIdentifierListItemDtoSchema = zod_1.z
17
+ .object({
18
+ uuid: zod_1.z.uuid(),
19
+ referenceId: zod_1.z.uuid(),
20
+ type: unique_product_identifier_type_1.UniqueProductIdentifierTypeSchema,
21
+ gtin: gs1_digital_link_1.Gtin14Schema.nullable(),
22
+ batch: gs1_digital_link_1.Cset82ComponentSchema.nullish().overwrite((v) => v ?? null),
23
+ serial: gs1_digital_link_1.Cset82ComponentSchema.nullable()
24
+ .nullish()
25
+ .overwrite((v) => v ?? null),
26
+ granularity: unique_product_identifier_type_1.Gs1GranularitySchema.nullable(),
27
+ digitalLink: zod_1.z
28
+ .string()
29
+ .url()
30
+ .nullish()
31
+ .overwrite((v) => v ?? null),
32
+ passportPublished: zod_1.z.boolean(),
33
+ permalink: exports.UniqueProductIdentifierPermalinkSummaryDtoSchema.nullish().overwrite((v) => v ?? null),
34
+ })
35
+ .meta({ id: "UniqueProductIdentifierListItem" });
36
+ exports.UniqueProductIdentifierListDtoSchema = zod_1.z.array(exports.UniqueProductIdentifierListItemDtoSchema);
37
+ exports.UniqueProductIdentifierPaginationDtoSchema = zod_1.z
38
+ .object({
39
+ ...pagination_dto_1.PagingMetadataDtoSchema.shape,
40
+ result: exports.UniqueProductIdentifierListItemDtoSchema.array(),
41
+ })
42
+ .meta({ id: "UniqueProductIdentifiers" });
@@ -28,8 +28,8 @@ export type UniqueProductIdentifierTypeValue = z.infer<typeof UniqueProductIdent
28
28
  * - `item` — GTIN + serial (AI `21`), optionally also batch
29
29
  */
30
30
  export declare const Gs1GranularitySchema: z.ZodEnum<{
31
- model: "model";
32
31
  batch: "batch";
32
+ model: "model";
33
33
  item: "item";
34
34
  }>;
35
35
  export type Gs1Granularity = z.infer<typeof Gs1GranularitySchema>;
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ export declare const UpdateGs1UniqueProductIdentifierRequestSchema: z.ZodObject<{
3
+ gtin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
4
+ batch: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodString>>>;
5
+ serial: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodString>>>;
6
+ }, z.core.$strip>;
7
+ export type UpdateGs1UniqueProductIdentifierRequest = z.infer<typeof UpdateGs1UniqueProductIdentifierRequestSchema>;
8
+ //# sourceMappingURL=update-unique-product-identifier.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-unique-product-identifier.dto.d.ts","sourceRoot":"","sources":["../../src/unique-product-identifiers/update-unique-product-identifier.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,6CAA6C;;;;iBAMA,CAAC;AAE3D,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,6CAA6C,CACrD,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateGs1UniqueProductIdentifierRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const gs1_digital_link_1 = require("./gs1/gs1-digital-link");
6
+ exports.UpdateGs1UniqueProductIdentifierRequestSchema = zod_1.z
7
+ .object({
8
+ gtin: gs1_digital_link_1.GtinInputSchema,
9
+ batch: gs1_digital_link_1.Cset82ComponentInputSchema.optional(),
10
+ serial: gs1_digital_link_1.Cset82ComponentInputSchema.optional(),
11
+ })
12
+ .meta({ id: "UpdateGs1UniqueProductIdentifierRequest" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-dpp/dto",
3
- "version": "2.10.0",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/open-dpp/open-dpp#readme",
package/src/index.ts CHANGED
@@ -90,3 +90,7 @@ export * from "./users/user.dto";
90
90
  export * from "./activity-history/activity-history.dto";
91
91
  export * from "./activity-history/change-event-types.dto";
92
92
  export * from "./activity-history/activity-types.dto";
93
+ export * from "./unique-product-identifiers/unique-product-identifier-list-item.dto";
94
+ export * from "./unique-product-identifiers/create-unique-product-identifier.dto";
95
+ export * from "./unique-product-identifiers/create-internal-unique-product-identifier.dto";
96
+ export * from "./unique-product-identifiers/update-unique-product-identifier.dto";