@internetderdinge/api 1.229.39 → 1.229.41

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 (32) hide show
  1. package/dist/src/accounts/accounts.schemas.js +40 -10
  2. package/dist/src/accounts/accounts.validation.js +47 -10
  3. package/dist/src/admin/adminSearch.route.js +4 -0
  4. package/dist/src/devices/devices.route.js +6 -2
  5. package/dist/src/devices/devices.schemas.js +54 -14
  6. package/dist/src/devices/devices.validation.js +80 -13
  7. package/dist/src/index.js +1 -0
  8. package/dist/src/iotdevice/iotdevice.schemas.js +117 -33
  9. package/dist/src/iotdevice/iotdevice.validation.js +27 -5
  10. package/dist/src/organizations/organizations.schemas.js +28 -5
  11. package/dist/src/organizations/organizations.validation.js +22 -11
  12. package/dist/src/tokens/tokens.schemas.js +35 -12
  13. package/dist/src/tokens/tokens.validation.js +8 -2
  14. package/dist/src/users/users.schemas.js +40 -11
  15. package/dist/src/users/users.validation.js +70 -8
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/package.json +2 -2
  18. package/src/accounts/accounts.schemas.ts +40 -10
  19. package/src/accounts/accounts.validation.ts +64 -26
  20. package/src/admin/adminSearch.route.ts +4 -0
  21. package/src/devices/devices.route.ts +10 -2
  22. package/src/devices/devices.schemas.ts +55 -14
  23. package/src/devices/devices.validation.ts +97 -28
  24. package/src/index.ts +4 -0
  25. package/src/iotdevice/iotdevice.schemas.ts +117 -33
  26. package/src/iotdevice/iotdevice.validation.ts +38 -16
  27. package/src/organizations/organizations.schemas.ts +28 -5
  28. package/src/organizations/organizations.validation.ts +49 -37
  29. package/src/tokens/tokens.schemas.ts +35 -12
  30. package/src/tokens/tokens.validation.ts +9 -3
  31. package/src/users/users.schemas.ts +40 -11
  32. package/src/users/users.validation.ts +88 -21
@@ -1,7 +1,30 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
  export const organizationResponseSchema = z.object({
3
- id: z.string(),
4
- name: z.string(),
5
- email: z.string().email(),
6
- kind: z.string().optional(),
3
+ id: z
4
+ .string()
5
+ .openapi({ example: "682fd0d7d4a6325d9d45b86e" }),
6
+ name: z
7
+ .string()
8
+ .openapi({ example: "Acme Inc.", description: "Organization name" }),
9
+ email: z
10
+ .string()
11
+ .email()
12
+ .openapi({
13
+ example: "contact@acme.example",
14
+ description: "Primary contact email",
15
+ }),
16
+ kind: z
17
+ .string()
18
+ .optional()
19
+ .openapi({
20
+ example: "private",
21
+ description: "The type or category of the organization",
22
+ }),
23
+ }).openapi({
24
+ example: {
25
+ id: "682fd0d7d4a6325d9d45b86e",
26
+ name: "Acme Inc.",
27
+ email: "contact@acme.example",
28
+ kind: "private",
29
+ },
7
30
  });
@@ -3,26 +3,25 @@ import { z } from "zod";
3
3
  import { zPagination, zGet, zObjectId, zUpdate, zDelete, } from "../utils/zValidations.js";
4
4
  extendZodWithOpenApi(z);
5
5
  export const createOrganizationSchema = {
6
- body: z.object({
7
- /* name: z.string().openapi({
8
- example: 'Acme Inc.',
9
- description: 'The name of the organization',
10
- }),
11
- email: z.string().email().openapi({
12
- example: 'contact@acme.com',
13
- description: 'Contact email for the organization',
14
- }), */
6
+ body: z
7
+ .object({
15
8
  kind: z.string().openapi({
16
9
  example: "private",
17
10
  description: "The type or category of the organization",
18
11
  }),
12
+ })
13
+ .openapi({
14
+ example: {
15
+ kind: "private",
16
+ },
19
17
  }),
20
18
  };
21
19
  export const queryOrganizationsSchema = zPagination;
22
20
  export const getOrganizationByIdSchema = zGet("organizationId");
23
21
  export const updateOrganizationSchema = {
24
22
  ...zUpdate("organizationId"),
25
- body: z.object({
23
+ body: z
24
+ .object({
26
25
  name: z
27
26
  .string()
28
27
  .openapi({
@@ -41,10 +40,22 @@ export const updateOrganizationSchema = {
41
40
  meta: z
42
41
  .record(z.string(), z.any())
43
42
  .openapi({
44
- example: { key: "value" },
43
+ example: { billingId: "cus_123", region: "eu" },
45
44
  description: "Additional metadata for the entry",
46
45
  })
47
46
  .optional(),
47
+ })
48
+ .openapi({
49
+ example: {
50
+ name: "Acme Inc.",
51
+ organization: process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
52
+ "682fd0d7d4a6325d9d45b86d",
53
+ kind: "private",
54
+ meta: {
55
+ billingId: "cus_123",
56
+ region: "eu",
57
+ },
58
+ },
48
59
  }),
49
60
  //...zUpdate('organizationId'),
50
61
  /* body: z.object({
@@ -1,14 +1,37 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
  export const tokenResponseSchema = z.object({
3
- // unique identifier of the token
4
- tokenId: z.string().uuid(),
5
- // the owning user
6
- userId: z.string().uuid(),
7
- // optional name or description
8
- name: z.string().optional(),
9
- // the token value (never returned after creation in real-world apps)
10
- token: z.string(),
11
- // timestamps
12
- createdAt: z.string().datetime(),
13
- updatedAt: z.string().datetime(),
3
+ tokenId: z
4
+ .string()
5
+ .openapi({
6
+ example: "682fd0d7d4a6325d9d45b872",
7
+ description: "Token ObjectId",
8
+ }),
9
+ userId: z
10
+ .string()
11
+ .openapi({
12
+ example: "682fd0d7d4a6325d9d45b86d",
13
+ description: "Owning user ObjectId",
14
+ }),
15
+ name: z.string().optional().openapi({ example: "Admin integration token" }),
16
+ token: z.string().openapi({
17
+ example: "idt_live_1234567890abcdef",
18
+ description: "Token secret. Usually only returned immediately after creation.",
19
+ }),
20
+ createdAt: z
21
+ .string()
22
+ .datetime()
23
+ .openapi({ example: "2026-05-21T09:30:00.000Z" }),
24
+ updatedAt: z
25
+ .string()
26
+ .datetime()
27
+ .openapi({ example: "2026-05-21T10:15:00.000Z" }),
28
+ }).openapi({
29
+ example: {
30
+ tokenId: "682fd0d7d4a6325d9d45b872",
31
+ userId: "682fd0d7d4a6325d9d45b86d",
32
+ name: "Admin integration token",
33
+ token: "idt_live_1234567890abcdef",
34
+ createdAt: "2026-05-21T09:30:00.000Z",
35
+ updatedAt: "2026-05-21T10:15:00.000Z",
36
+ },
14
37
  });
@@ -1,8 +1,14 @@
1
1
  import { z } from "zod";
2
2
  import { zGet, zDelete } from "../utils/zValidations.js";
3
3
  export const createTokenSchema = {
4
- body: z.object({
5
- name: z.string().openapi({ example: "my sample token" }),
4
+ body: z
5
+ .object({
6
+ name: z.string().openapi({ example: "Admin integration token" }),
7
+ })
8
+ .openapi({
9
+ example: {
10
+ name: "Admin integration token",
11
+ },
6
12
  }),
7
13
  };
8
14
  export const getTokenSchema = zGet("tokenId");
@@ -2,24 +2,53 @@ import { z } from "zod";
2
2
  import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
3
3
  extendZodWithOpenApi(z);
4
4
  export const createUserResponseSchema = z.object({
5
- id: z.string(),
6
- name: z.string(),
7
- email: z.string(),
5
+ id: z.string().openapi({ example: "682fd0d7d4a6325d9d45b86d" }),
6
+ name: z.string().openapi({ example: "Jane Doe" }),
7
+ email: z.string().email().openapi({ example: "jane.doe@example.com" }),
8
+ }).openapi({
9
+ example: {
10
+ id: "682fd0d7d4a6325d9d45b86d",
11
+ name: "Jane Doe",
12
+ email: "jane.doe@example.com",
13
+ },
8
14
  });
9
15
  export const getUsersResponseSchema = z.array(z.object({
10
- id: z.string(),
11
- name: z.string(),
12
- email: z.string(),
13
- }));
16
+ id: z.string().openapi({ example: "682fd0d7d4a6325d9d45b86d" }),
17
+ name: z.string().openapi({ example: "Jane Doe" }),
18
+ email: z.string().email().openapi({ example: "jane.doe@example.com" }),
19
+ })).openapi({
20
+ example: [
21
+ {
22
+ id: "682fd0d7d4a6325d9d45b86d",
23
+ name: "Jane Doe",
24
+ email: "jane.doe@example.com",
25
+ },
26
+ {
27
+ id: "682fd0d7d4a6325d9d45b86f",
28
+ name: "John Smith",
29
+ email: "john.smith@example.com",
30
+ },
31
+ ],
32
+ });
14
33
  export const updateUserSchema = z.object({
15
34
  name: z.string().optional(),
16
35
  email: z.string().email().optional(),
17
36
  });
18
37
  export const updateUserResponseSchema = z.object({
19
- id: z.string(),
20
- name: z.string(),
21
- email: z.string(),
38
+ id: z.string().openapi({ example: "682fd0d7d4a6325d9d45b86d" }),
39
+ name: z.string().openapi({ example: "Jane Doe" }),
40
+ email: z.string().email().openapi({ example: "jane.doe@example.com" }),
41
+ }).openapi({
42
+ example: {
43
+ id: "682fd0d7d4a6325d9d45b86d",
44
+ name: "Jane Doe",
45
+ email: "jane.doe@example.com",
46
+ },
22
47
  });
23
48
  export const deleteUserResponseSchema = z.object({
24
- success: z.boolean(),
49
+ success: z.boolean().openapi({ example: true }),
50
+ }).openapi({
51
+ example: {
52
+ success: true,
53
+ },
25
54
  });
@@ -24,6 +24,10 @@ export const createUserBodyShape = {
24
24
  example: "user@example.com",
25
25
  description: "User email address",
26
26
  }),
27
+ category: z.string().optional().openapi({
28
+ example: "random",
29
+ description: "LEGACY: User category",
30
+ }),
27
31
  timezone: z.string().optional().openapi({
28
32
  example: "Europe/Berlin",
29
33
  description: "IANA timezone string",
@@ -33,7 +37,18 @@ export const createUserBodyShape = {
33
37
  }),
34
38
  };
35
39
  export const createUserSchema = {
36
- body: z.object(createUserBodyShape),
40
+ body: z.object(createUserBodyShape).openapi({
41
+ example: {
42
+ organization: process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
43
+ "682fd0d7d4a6325d9d45b86e",
44
+ email: "user@example.com",
45
+ timezone: "Europe/Berlin",
46
+ role: "user",
47
+ meta: {
48
+ externalId: "crm-123",
49
+ },
50
+ },
51
+ }),
37
52
  };
38
53
  export const createCurrentUserSchema = createUserSchema;
39
54
  export const queryUsersSchema = {
@@ -49,13 +64,20 @@ export const queryUsersSchema = {
49
64
  export const getUserSchema = zGet("userId");
50
65
  export const getCurrentUserSchema = {
51
66
  query: z.object({
52
- organization: zObjectId,
67
+ organization: zObjectId.openapi({
68
+ description: "Organization ObjectId",
69
+ param: { name: "organization", in: "query" },
70
+ }),
53
71
  }),
54
72
  };
55
73
  export const updateUserBodyShape = {
56
74
  name: z.string().optional().openapi({ description: "User full name" }),
57
75
  timezone: z.string().optional().openapi({ description: "IANA timezone" }),
58
76
  avatar: z.string().optional().openapi({ description: "Avatar URL" }),
77
+ category: z.string().optional().openapi({
78
+ example: "random",
79
+ description: "LEGACY: User category",
80
+ }),
59
81
  meta: z
60
82
  .object({})
61
83
  .passthrough()
@@ -83,18 +105,40 @@ export const updateUserBodyShape = {
83
105
  };
84
106
  export const updateUserSchema = {
85
107
  ...zUpdate("userId"),
86
- body: zPatchBody(updateUserBodyShape),
108
+ body: zPatchBody(updateUserBodyShape).openapi({
109
+ example: {
110
+ name: "Jane Doe",
111
+ timezone: "Europe/Berlin",
112
+ email: "jane.doe@example.com",
113
+ role: "patient",
114
+ meta: {
115
+ carePlan: "standard",
116
+ },
117
+ },
118
+ }),
87
119
  };
88
120
  export const deleteUserSchema = zDelete("userId");
89
121
  export const organizationInviteSchema = {
90
- body: z.object({
91
- organizationId: zObjectId.openapi({ description: "Organization ObjectId" }),
122
+ body: z
123
+ .object({
124
+ organizationId: zObjectId.openapi({
125
+ description: "Organization ObjectId",
126
+ }),
92
127
  action: z.string().optional().openapi({ description: "Invite action" }),
93
128
  role: z.string().optional().openapi({ description: "Role on invite" }),
129
+ })
130
+ .openapi({
131
+ example: {
132
+ organizationId: process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
133
+ "682fd0d7d4a6325d9d45b86e",
134
+ action: "accept",
135
+ role: "user",
136
+ },
94
137
  }),
95
138
  };
96
139
  export const updateInviteSchema = {
97
- body: z.object({
140
+ body: z
141
+ .object({
98
142
  organization: zObjectId.openapi({ description: "Organization ObjectId" }),
99
143
  status: z.enum(["accepted"]).openapi({ description: "Invite status" }),
100
144
  inviteCode: z
@@ -102,12 +146,30 @@ export const updateInviteSchema = {
102
146
  .nullable()
103
147
  .optional()
104
148
  .openapi({ description: "Invite code" }),
149
+ })
150
+ .openapi({
151
+ example: {
152
+ organization: process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
153
+ "682fd0d7d4a6325d9d45b86e",
154
+ status: "accepted",
155
+ inviteCode: "INVITE-123",
156
+ },
105
157
  }),
106
158
  };
107
159
  export const organizationRemoveSchema = {
108
- body: z.object({
160
+ body: z
161
+ .object({
109
162
  userId: zObjectId.openapi({ description: "User ObjectId" }),
110
- organizationId: zObjectId.openapi({ description: "Organization ObjectId" }),
163
+ organizationId: zObjectId.openapi({
164
+ description: "Organization ObjectId",
165
+ }),
166
+ })
167
+ .openapi({
168
+ example: {
169
+ userId: process.env.SCHEMA_EXAMPLE_USER_ID || "682fd0d7d4a6325d9d45b86d",
170
+ organizationId: process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
171
+ "682fd0d7d4a6325d9d45b86e",
172
+ },
111
173
  }),
112
174
  };
113
175
  export const updateTimesByIdSchema = {