@open-dpp/dto 6.5.5 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,133 @@
1
+ import { z } from "zod";
2
+ export declare const GuestRoleDto: {
3
+ readonly REPAIRER: "Repairer";
4
+ readonly RECYCLER: "Recycler";
5
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
6
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
7
+ readonly SUPPLIER: "Supplier";
8
+ };
9
+ export declare const GuestRoleDtoEnum: z.ZodEnum<{
10
+ readonly REPAIRER: "Repairer";
11
+ readonly RECYCLER: "Recycler";
12
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
13
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
14
+ readonly SUPPLIER: "Supplier";
15
+ }>;
16
+ export type GuestRoleDtoType = z.infer<typeof GuestRoleDtoEnum>;
17
+ export declare const GuestAccessKindDto: {
18
+ readonly DIRECT: "Direct";
19
+ };
20
+ export declare const GuestAccessKindDtoEnum: z.ZodEnum<{
21
+ readonly DIRECT: "Direct";
22
+ }>;
23
+ export type GuestAccessKindDtoType = z.infer<typeof GuestAccessKindDtoEnum>;
24
+ export declare const GuestAccessStatusDto: {
25
+ readonly PENDING: "Pending";
26
+ readonly ACCEPTED: "Accepted";
27
+ readonly REVOKED: "Revoked";
28
+ };
29
+ export declare const GuestAccessStatusDtoEnum: z.ZodEnum<{
30
+ readonly PENDING: "Pending";
31
+ readonly ACCEPTED: "Accepted";
32
+ readonly REVOKED: "Revoked";
33
+ }>;
34
+ export type GuestAccessStatusDtoType = z.infer<typeof GuestAccessStatusDtoEnum>;
35
+ export declare const CreateDirectGuestAccessDtoSchema: z.ZodObject<{
36
+ kind: z.ZodLiteral<"Direct">;
37
+ email: z.ZodEmail;
38
+ guestRole: z.ZodEnum<{
39
+ readonly REPAIRER: "Repairer";
40
+ readonly RECYCLER: "Recycler";
41
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
42
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
43
+ readonly SUPPLIER: "Supplier";
44
+ }>;
45
+ }, z.core.$strip>;
46
+ export declare const CreateGuestAccessDtoSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
+ kind: z.ZodLiteral<"Direct">;
48
+ email: z.ZodEmail;
49
+ guestRole: z.ZodEnum<{
50
+ readonly REPAIRER: "Repairer";
51
+ readonly RECYCLER: "Recycler";
52
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
53
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
54
+ readonly SUPPLIER: "Supplier";
55
+ }>;
56
+ }, z.core.$strip>], "kind">;
57
+ export type CreateGuestAccessDto = z.infer<typeof CreateGuestAccessDtoSchema>;
58
+ export declare const UpdateGuestAccessRoleDtoSchema: z.ZodObject<{
59
+ guestRole: z.ZodEnum<{
60
+ readonly REPAIRER: "Repairer";
61
+ readonly RECYCLER: "Recycler";
62
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
63
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
64
+ readonly SUPPLIER: "Supplier";
65
+ }>;
66
+ }, z.core.$strip>;
67
+ export type UpdateGuestAccessRoleDto = z.infer<typeof UpdateGuestAccessRoleDtoSchema>;
68
+ export declare const DirectGuestAccessResponseDtoSchema: z.ZodObject<{
69
+ id: z.ZodString;
70
+ organizationId: z.ZodString;
71
+ guestRole: z.ZodEnum<{
72
+ readonly REPAIRER: "Repairer";
73
+ readonly RECYCLER: "Recycler";
74
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
75
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
76
+ readonly SUPPLIER: "Supplier";
77
+ }>;
78
+ grantedBy: z.ZodString;
79
+ status: z.ZodEnum<{
80
+ readonly PENDING: "Pending";
81
+ readonly ACCEPTED: "Accepted";
82
+ readonly REVOKED: "Revoked";
83
+ }>;
84
+ createdAt: z.ZodISODateTime;
85
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
86
+ kind: z.ZodLiteral<"Direct">;
87
+ email: z.ZodEmail;
88
+ acceptedAt: z.ZodOptional<z.ZodISODateTime>;
89
+ acceptedByUserId: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$strip>;
91
+ export declare const GuestAccessResponseDtoSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
92
+ id: z.ZodString;
93
+ organizationId: z.ZodString;
94
+ guestRole: z.ZodEnum<{
95
+ readonly REPAIRER: "Repairer";
96
+ readonly RECYCLER: "Recycler";
97
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
98
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
99
+ readonly SUPPLIER: "Supplier";
100
+ }>;
101
+ grantedBy: z.ZodString;
102
+ status: z.ZodEnum<{
103
+ readonly PENDING: "Pending";
104
+ readonly ACCEPTED: "Accepted";
105
+ readonly REVOKED: "Revoked";
106
+ }>;
107
+ createdAt: z.ZodISODateTime;
108
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
109
+ kind: z.ZodLiteral<"Direct">;
110
+ email: z.ZodEmail;
111
+ acceptedAt: z.ZodOptional<z.ZodISODateTime>;
112
+ acceptedByUserId: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$strip>], "kind">;
114
+ export type GuestAccessResponseDto = z.infer<typeof GuestAccessResponseDtoSchema>;
115
+ export declare const GuestAccessInvitationDtoSchema: z.ZodObject<{
116
+ id: z.ZodString;
117
+ organizationName: z.ZodString;
118
+ email: z.ZodEmail;
119
+ guestRole: z.ZodEnum<{
120
+ readonly REPAIRER: "Repairer";
121
+ readonly RECYCLER: "Recycler";
122
+ readonly MARKET_SURVEILLANCE: "MarketSurveillance";
123
+ readonly INDEPENDENT_OPERATOR: "IndependentOperator";
124
+ readonly SUPPLIER: "Supplier";
125
+ }>;
126
+ status: z.ZodEnum<{
127
+ readonly PENDING: "Pending";
128
+ readonly ACCEPTED: "Accepted";
129
+ readonly REVOKED: "Revoked";
130
+ }>;
131
+ }, z.core.$strip>;
132
+ export type GuestAccessInvitationDto = z.infer<typeof GuestAccessInvitationDtoSchema>;
133
+ //# sourceMappingURL=guest-access.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guest-access.dto.d.ts","sourceRoot":"","sources":["../../src/guest-access/guest-access.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,kBAAkB;;CAErB,CAAC;AAEX,eAAO,MAAM,sBAAsB;;EAA6B,CAAC;AACjE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;EAA+B,CAAC;AACrE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAOhF,eAAO,MAAM,gCAAgC;;;;;;;;;;iBAI3C,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;2BAErC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,8BAA8B;;;;;;;;iBAEzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAYtF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;iBAK7C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;2BAEvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAIlF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;iBAMzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuestAccessInvitationDtoSchema = exports.GuestAccessResponseDtoSchema = exports.DirectGuestAccessResponseDtoSchema = exports.UpdateGuestAccessRoleDtoSchema = exports.CreateGuestAccessDtoSchema = exports.CreateDirectGuestAccessDtoSchema = exports.GuestAccessStatusDtoEnum = exports.GuestAccessStatusDto = exports.GuestAccessKindDtoEnum = exports.GuestAccessKindDto = exports.GuestRoleDtoEnum = exports.GuestRoleDto = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.GuestRoleDto = {
6
+ REPAIRER: "Repairer",
7
+ RECYCLER: "Recycler",
8
+ MARKET_SURVEILLANCE: "MarketSurveillance",
9
+ INDEPENDENT_OPERATOR: "IndependentOperator",
10
+ SUPPLIER: "Supplier",
11
+ };
12
+ exports.GuestRoleDtoEnum = zod_1.z.enum(exports.GuestRoleDto).meta({
13
+ description: "What the guest is: the template defines which fields this role can read.",
14
+ example: exports.GuestRoleDto.REPAIRER,
15
+ });
16
+ exports.GuestAccessKindDto = {
17
+ DIRECT: "Direct",
18
+ };
19
+ exports.GuestAccessKindDtoEnum = zod_1.z.enum(exports.GuestAccessKindDto);
20
+ exports.GuestAccessStatusDto = {
21
+ PENDING: "Pending",
22
+ ACCEPTED: "Accepted",
23
+ REVOKED: "Revoked",
24
+ };
25
+ exports.GuestAccessStatusDtoEnum = zod_1.z.enum(exports.GuestAccessStatusDto);
26
+ const GuestEmailSchema = zod_1.z.email().meta({
27
+ description: "Email address of the invited person",
28
+ example: "guest@example.com",
29
+ });
30
+ exports.CreateDirectGuestAccessDtoSchema = zod_1.z.object({
31
+ kind: zod_1.z.literal(exports.GuestAccessKindDto.DIRECT),
32
+ email: GuestEmailSchema,
33
+ guestRole: exports.GuestRoleDtoEnum,
34
+ });
35
+ exports.CreateGuestAccessDtoSchema = zod_1.z.discriminatedUnion("kind", [
36
+ exports.CreateDirectGuestAccessDtoSchema,
37
+ ]);
38
+ exports.UpdateGuestAccessRoleDtoSchema = zod_1.z.object({
39
+ guestRole: exports.GuestRoleDtoEnum,
40
+ });
41
+ const GuestAccessBaseResponseSchema = zod_1.z.object({
42
+ id: zod_1.z.string(),
43
+ organizationId: zod_1.z.string(),
44
+ guestRole: exports.GuestRoleDtoEnum,
45
+ grantedBy: zod_1.z.string(),
46
+ status: exports.GuestAccessStatusDtoEnum,
47
+ createdAt: zod_1.z.iso.datetime(),
48
+ revokedAt: zod_1.z.iso.datetime().optional(),
49
+ });
50
+ exports.DirectGuestAccessResponseDtoSchema = GuestAccessBaseResponseSchema.extend({
51
+ kind: zod_1.z.literal(exports.GuestAccessKindDto.DIRECT),
52
+ email: GuestEmailSchema,
53
+ acceptedAt: zod_1.z.iso.datetime().optional(),
54
+ acceptedByUserId: zod_1.z.string().optional(),
55
+ });
56
+ exports.GuestAccessResponseDtoSchema = zod_1.z.discriminatedUnion("kind", [
57
+ exports.DirectGuestAccessResponseDtoSchema,
58
+ ]);
59
+ // What the invited person sees before accepting. Only the account with the invited verified email
60
+ // may read it.
61
+ exports.GuestAccessInvitationDtoSchema = zod_1.z.object({
62
+ id: zod_1.z.string(),
63
+ organizationName: zod_1.z.string(),
64
+ email: GuestEmailSchema,
65
+ guestRole: exports.GuestRoleDtoEnum,
66
+ status: exports.GuestAccessStatusDtoEnum,
67
+ });
package/dist/index.d.ts CHANGED
@@ -71,6 +71,7 @@ export * from "./bulk-import/bulk-import-run-item.dto";
71
71
  export * from "./bulk-import/bulk-import-parse-result.dto";
72
72
  export * from "./organizations/member.dto";
73
73
  export * from "./organizations/organization.dto";
74
+ export * from "./guest-access/guest-access.dto";
74
75
  export * from "./passports/passport.dto";
75
76
  export * from "./permalinks/carrier-export.dto";
76
77
  export * from "./permalinks/permalink.dto";
@@ -89,6 +90,7 @@ export * from "./users/create-user.dto";
89
90
  export * from "./users/me.dto";
90
91
  export * from "./users/pending-email-change.dto";
91
92
  export * from "./users/request-email-change.dto";
93
+ export * from "./users/resend-verification-email.dto";
92
94
  export * from "./users/set-user-role.dto";
93
95
  export * from "./users/update-profile.dto";
94
96
  export * from "./users/display-language.dto";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oCAAoC,CAAC;AACnD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AAEvD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yDAAyD,CAAC;AACxE,cAAc,sDAAsD,CAAC;AAErE,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAE/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC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k-import-run-item.dto"), exports);
87
87
  __exportStar(require("./bulk-import/bulk-import-parse-result.dto"), exports);
88
88
  __exportStar(require("./organizations/member.dto"), exports);
89
89
  __exportStar(require("./organizations/organization.dto"), exports);
90
+ __exportStar(require("./guest-access/guest-access.dto"), exports);
90
91
  __exportStar(require("./passports/passport.dto"), exports);
91
92
  __exportStar(require("./permalinks/carrier-export.dto"), exports);
92
93
  __exportStar(require("./permalinks/permalink.dto"), exports);
@@ -105,6 +106,7 @@ __exportStar(require("./users/create-user.dto"), exports);
105
106
  __exportStar(require("./users/me.dto"), exports);
106
107
  __exportStar(require("./users/pending-email-change.dto"), exports);
107
108
  __exportStar(require("./users/request-email-change.dto"), exports);
109
+ __exportStar(require("./users/resend-verification-email.dto"), exports);
108
110
  __exportStar(require("./users/set-user-role.dto"), exports);
109
111
  __exportStar(require("./users/update-profile.dto"), exports);
110
112
  __exportStar(require("./users/display-language.dto"), exports);
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const ResendVerificationEmailDtoSchema: z.ZodObject<{
3
+ callbackPath: z.ZodOptional<z.ZodString>;
4
+ }, z.core.$strip>;
5
+ export type ResendVerificationEmailDto = z.infer<typeof ResendVerificationEmailDtoSchema>;
6
+ //# sourceMappingURL=resend-verification-email.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resend-verification-email.dto.d.ts","sourceRoot":"","sources":["../../src/users/resend-verification-email.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gCAAgC;;iBAe3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResendVerificationEmailDtoSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ResendVerificationEmailDtoSchema = zod_1.z.object({
6
+ // Where the link of the verification mail leads to once the address is verified: a path of this
7
+ // application, e.g. the page the user came from. Anything else, like another site or a
8
+ // protocol-relative URL, is rejected.
9
+ callbackPath: zod_1.z
10
+ .string()
11
+ .max(2048)
12
+ .regex(/^\/(?![/\\])/)
13
+ // eslint-disable-next-line no-control-regex
14
+ .refine((path) => !/[\u0000-\u001F\u007F]/.test(path))
15
+ .meta({
16
+ description: "Path of this application the verification link leads to once verified",
17
+ example: "/accept-guest-access/958b741c-c2ef-4366-a134-fafd30210ed4",
18
+ })
19
+ .optional(),
20
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-dpp/dto",
3
- "version": "6.5.5",
3
+ "version": "6.6.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/open-dpp/open-dpp#readme",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tsconfig/node-lts": "^24.0.1",
40
- "@tsconfig/node-ts": "^23.6.4",
40
+ "@tsconfig/node-ts": "^23.6.5",
41
41
  "@types/node": "^26.6.6",
42
42
  "typescript": "~6.0.3"
43
43
  },
@@ -0,0 +1,124 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import {
3
+ CreateGuestAccessDtoSchema,
4
+ GuestAccessInvitationDtoSchema,
5
+ GuestAccessResponseDtoSchema,
6
+ GuestRoleDtoEnum,
7
+ UpdateGuestAccessRoleDtoSchema,
8
+ } from "./guest-access.dto";
9
+
10
+ describe("GuestRoleDtoEnum", () => {
11
+ it("contains the five guest roles", () => {
12
+ expect(GuestRoleDtoEnum.options).toEqual([
13
+ "Repairer",
14
+ "Recycler",
15
+ "MarketSurveillance",
16
+ "IndependentOperator",
17
+ "Supplier",
18
+ ]);
19
+ });
20
+
21
+ it("rejects member and user roles", () => {
22
+ expect(() => GuestRoleDtoEnum.parse("member")).toThrow();
23
+ expect(() => GuestRoleDtoEnum.parse("owner")).toThrow();
24
+ });
25
+ });
26
+
27
+ describe("CreateGuestAccessDtoSchema", () => {
28
+ const valid = { kind: "Direct", email: "repairer@example.com", guestRole: "Repairer" };
29
+
30
+ it("parses a direct guest access", () => {
31
+ expect(CreateGuestAccessDtoSchema.parse(valid)).toEqual(valid);
32
+ });
33
+
34
+ it("rejects an invalid email", () => {
35
+ expect(() => CreateGuestAccessDtoSchema.parse({ ...valid, email: "nope" })).toThrow();
36
+ });
37
+
38
+ it("rejects a missing, unknown or multiple roles", () => {
39
+ const { guestRole: _guestRole, ...withoutRole } = valid;
40
+ expect(() => CreateGuestAccessDtoSchema.parse(withoutRole)).toThrow();
41
+ expect(() => CreateGuestAccessDtoSchema.parse({ ...valid, guestRole: "Member" })).toThrow();
42
+ expect(() =>
43
+ CreateGuestAccessDtoSchema.parse({ ...valid, guestRole: ["Repairer", "Recycler"] }),
44
+ ).toThrow();
45
+ });
46
+
47
+ it("rejects an unknown kind", () => {
48
+ expect(() => CreateGuestAccessDtoSchema.parse({ ...valid, kind: "Organization" })).toThrow();
49
+ });
50
+ });
51
+
52
+ describe("UpdateGuestAccessRoleDtoSchema", () => {
53
+ it("requires exactly one role", () => {
54
+ expect(UpdateGuestAccessRoleDtoSchema.parse({ guestRole: "Supplier" })).toEqual({
55
+ guestRole: "Supplier",
56
+ });
57
+ expect(() => UpdateGuestAccessRoleDtoSchema.parse({})).toThrow();
58
+ expect(() => UpdateGuestAccessRoleDtoSchema.parse({ guestRole: ["Supplier"] })).toThrow();
59
+ });
60
+ });
61
+
62
+ describe("GuestAccessResponseDtoSchema", () => {
63
+ const pending = {
64
+ id: "0a6e9a7e-2b0c-4a9b-9a53-8c2a3bd0a111",
65
+ organizationId: "acme",
66
+ kind: "Direct",
67
+ email: "repairer@example.com",
68
+ guestRole: "IndependentOperator",
69
+ grantedBy: "user-1",
70
+ status: "Pending",
71
+ createdAt: "2026-10-13T10:00:00.000Z",
72
+ };
73
+
74
+ it("parses a pending direct guest access without acceptance data", () => {
75
+ const parsed = GuestAccessResponseDtoSchema.parse(pending);
76
+ expect(parsed).toEqual(pending);
77
+ });
78
+
79
+ it("parses an accepted one including the accepting user id", () => {
80
+ const accepted = {
81
+ ...pending,
82
+ status: "Accepted",
83
+ acceptedAt: "2026-10-14T10:00:00.000Z",
84
+ acceptedByUserId: "user-2",
85
+ };
86
+ const parsed = GuestAccessResponseDtoSchema.parse(accepted);
87
+ expect(parsed).toEqual(accepted);
88
+ });
89
+
90
+ it("rejects an unknown status", () => {
91
+ expect(() => GuestAccessResponseDtoSchema.parse({ ...pending, status: "Active" })).toThrow();
92
+ });
93
+ });
94
+
95
+ describe("GuestAccessInvitationDtoSchema", () => {
96
+ const invitation = {
97
+ id: "0a6e9a7e-2b0c-4a9b-9a53-8c2a3bd0a111",
98
+ organizationName: "ACME GmbH",
99
+ email: "repairer@example.com",
100
+ guestRole: "Repairer",
101
+ status: "Pending",
102
+ };
103
+
104
+ it("parses an invitation", () => {
105
+ expect(GuestAccessInvitationDtoSchema.parse(invitation)).toEqual(invitation);
106
+ });
107
+
108
+ it("does not expose who invited or when", () => {
109
+ const parsed = GuestAccessInvitationDtoSchema.parse({
110
+ ...invitation,
111
+ grantedBy: "owner-1",
112
+ organizationId: "org-1",
113
+ createdAt: "2026-10-27T10:00:00.000Z",
114
+ });
115
+
116
+ expect(parsed).toEqual(invitation);
117
+ });
118
+
119
+ it("rejects an unknown role", () => {
120
+ expect(() =>
121
+ GuestAccessInvitationDtoSchema.parse({ ...invitation, guestRole: "Owner" }),
122
+ ).toThrow();
123
+ });
124
+ });
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+
3
+ export const GuestRoleDto = {
4
+ REPAIRER: "Repairer",
5
+ RECYCLER: "Recycler",
6
+ MARKET_SURVEILLANCE: "MarketSurveillance",
7
+ INDEPENDENT_OPERATOR: "IndependentOperator",
8
+ SUPPLIER: "Supplier",
9
+ } as const;
10
+
11
+ export const GuestRoleDtoEnum = z.enum(GuestRoleDto).meta({
12
+ description: "What the guest is: the template defines which fields this role can read.",
13
+ example: GuestRoleDto.REPAIRER,
14
+ });
15
+ export type GuestRoleDtoType = z.infer<typeof GuestRoleDtoEnum>;
16
+
17
+ export const GuestAccessKindDto = {
18
+ DIRECT: "Direct",
19
+ } as const;
20
+
21
+ export const GuestAccessKindDtoEnum = z.enum(GuestAccessKindDto);
22
+ export type GuestAccessKindDtoType = z.infer<typeof GuestAccessKindDtoEnum>;
23
+
24
+ export const GuestAccessStatusDto = {
25
+ PENDING: "Pending",
26
+ ACCEPTED: "Accepted",
27
+ REVOKED: "Revoked",
28
+ } as const;
29
+
30
+ export const GuestAccessStatusDtoEnum = z.enum(GuestAccessStatusDto);
31
+ export type GuestAccessStatusDtoType = z.infer<typeof GuestAccessStatusDtoEnum>;
32
+
33
+ const GuestEmailSchema = z.email().meta({
34
+ description: "Email address of the invited person",
35
+ example: "guest@example.com",
36
+ });
37
+
38
+ export const CreateDirectGuestAccessDtoSchema = z.object({
39
+ kind: z.literal(GuestAccessKindDto.DIRECT),
40
+ email: GuestEmailSchema,
41
+ guestRole: GuestRoleDtoEnum,
42
+ });
43
+
44
+ export const CreateGuestAccessDtoSchema = z.discriminatedUnion("kind", [
45
+ CreateDirectGuestAccessDtoSchema,
46
+ ]);
47
+
48
+ export type CreateGuestAccessDto = z.infer<typeof CreateGuestAccessDtoSchema>;
49
+
50
+ export const UpdateGuestAccessRoleDtoSchema = z.object({
51
+ guestRole: GuestRoleDtoEnum,
52
+ });
53
+
54
+ export type UpdateGuestAccessRoleDto = z.infer<typeof UpdateGuestAccessRoleDtoSchema>;
55
+
56
+ const GuestAccessBaseResponseSchema = z.object({
57
+ id: z.string(),
58
+ organizationId: z.string(),
59
+ guestRole: GuestRoleDtoEnum,
60
+ grantedBy: z.string(),
61
+ status: GuestAccessStatusDtoEnum,
62
+ createdAt: z.iso.datetime(),
63
+ revokedAt: z.iso.datetime().optional(),
64
+ });
65
+
66
+ export const DirectGuestAccessResponseDtoSchema = GuestAccessBaseResponseSchema.extend({
67
+ kind: z.literal(GuestAccessKindDto.DIRECT),
68
+ email: GuestEmailSchema,
69
+ acceptedAt: z.iso.datetime().optional(),
70
+ acceptedByUserId: z.string().optional(),
71
+ });
72
+
73
+ export const GuestAccessResponseDtoSchema = z.discriminatedUnion("kind", [
74
+ DirectGuestAccessResponseDtoSchema,
75
+ ]);
76
+
77
+ export type GuestAccessResponseDto = z.infer<typeof GuestAccessResponseDtoSchema>;
78
+
79
+ // What the invited person sees before accepting. Only the account with the invited verified email
80
+ // may read it.
81
+ export const GuestAccessInvitationDtoSchema = z.object({
82
+ id: z.string(),
83
+ organizationName: z.string(),
84
+ email: GuestEmailSchema,
85
+ guestRole: GuestRoleDtoEnum,
86
+ status: GuestAccessStatusDtoEnum,
87
+ });
88
+
89
+ export type GuestAccessInvitationDto = z.infer<typeof GuestAccessInvitationDtoSchema>;
package/src/index.ts CHANGED
@@ -77,6 +77,7 @@ export * from "./bulk-import/bulk-import-run-item.dto";
77
77
  export * from "./bulk-import/bulk-import-parse-result.dto";
78
78
  export * from "./organizations/member.dto";
79
79
  export * from "./organizations/organization.dto";
80
+ export * from "./guest-access/guest-access.dto";
80
81
  export * from "./passports/passport.dto";
81
82
  export * from "./permalinks/carrier-export.dto";
82
83
  export * from "./permalinks/permalink.dto";
@@ -95,6 +96,7 @@ export * from "./users/create-user.dto";
95
96
  export * from "./users/me.dto";
96
97
  export * from "./users/pending-email-change.dto";
97
98
  export * from "./users/request-email-change.dto";
99
+ export * from "./users/resend-verification-email.dto";
98
100
  export * from "./users/set-user-role.dto";
99
101
  export * from "./users/update-profile.dto";
100
102
  export * from "./users/display-language.dto";
@@ -0,0 +1,29 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { ResendVerificationEmailDtoSchema } from "./resend-verification-email.dto";
3
+
4
+ describe("ResendVerificationEmailDtoSchema", () => {
5
+ it("allows no callback path at all", () => {
6
+ expect(ResendVerificationEmailDtoSchema.parse({})).toEqual({});
7
+ });
8
+
9
+ it("accepts a path of the application with a query", () => {
10
+ const callbackPath = "/accept-guest-access/access-1?x=1";
11
+
12
+ expect(ResendVerificationEmailDtoSchema.parse({ callbackPath })).toEqual({ callbackPath });
13
+ });
14
+
15
+ it("rejects everything which leads away from the application", () => {
16
+ for (const callbackPath of [
17
+ "https://evil.example.com/x",
18
+ "//evil.example.com/x",
19
+ "/\\evil.example.com",
20
+ "accept-guest-access/access-1",
21
+ "javascript:alert(1)",
22
+ "",
23
+ "/path\nwith-newline",
24
+ `/${"a".repeat(3000)}`,
25
+ ]) {
26
+ expect(ResendVerificationEmailDtoSchema.safeParse({ callbackPath }).success).toBe(false);
27
+ }
28
+ });
29
+ });
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+
3
+ export const ResendVerificationEmailDtoSchema = z.object({
4
+ // Where the link of the verification mail leads to once the address is verified: a path of this
5
+ // application, e.g. the page the user came from. Anything else, like another site or a
6
+ // protocol-relative URL, is rejected.
7
+ callbackPath: z
8
+ .string()
9
+ .max(2048)
10
+ .regex(/^\/(?![/\\])/)
11
+ // eslint-disable-next-line no-control-regex
12
+ .refine((path) => !/[\u0000-\u001F\u007F]/.test(path))
13
+ .meta({
14
+ description: "Path of this application the verification link leads to once verified",
15
+ example: "/accept-guest-access/958b741c-c2ef-4366-a134-fafd30210ed4",
16
+ })
17
+ .optional(),
18
+ });
19
+
20
+ export type ResendVerificationEmailDto = z.infer<typeof ResendVerificationEmailDtoSchema>;