@internetderdinge/api 1.229.25 → 1.229.27

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.
@@ -34,7 +34,6 @@ const avatar = catchAsync(async (req, res) => {
34
34
  });
35
35
  const updateEntry = catchAsync(async (req, res) => {
36
36
  const account = await accountsService.getAccountById(req.auth.sub);
37
- console.log("account", account);
38
37
  const { isSocial } = account.identities[0];
39
38
  const { given_name, family_name, email, notification, ...updateBody } = req.body;
40
39
  const trimmedGivenName = typeof given_name === "string" ? given_name.trim() : undefined;
@@ -16,7 +16,6 @@ export const setDeviceToken = catchAsync(async (req, res) => {
16
16
  user: res.req.auth.sub,
17
17
  body: req.body,
18
18
  });
19
- console.log("Setting device tokenddddd for user:", res.req.auth.sub);
20
19
  res.status(httpStatus.CREATED).send(user);
21
20
  });
22
21
  export const removeDeviceToken = catchAsync(async (req, res) => {
package/dist/src/index.js CHANGED
@@ -23,7 +23,7 @@ export { default as devicesNotificationsRoute } from "./devicesNotifications/dev
23
23
  export { default as devicesNotificationsService } from "../src/devicesNotifications/devicesNotifications.service";
24
24
  export { default as iotDevicesService } from "../src/iotdevice/iotdevice.service";
25
25
  export { default as iotdeviceRoute } from "../src/iotdevice/iotdevice.route";
26
- export { SIMILARITY_THRESHOLD } from "../src/iotdevice/iotdevice.service";
26
+ export { SIMILARITY_THRESHOLD, alarmsDevice, getDeviceStatus, getDeviceStatusList, shadowAlarmGet, shadowAlarmUpdate, } from "../src/iotdevice/iotdevice.service";
27
27
  export { default as pdfRoute } from "../src/pdf/pdf.route";
28
28
  export { default as tokensRoute } from "../src/tokens/tokens.route";
29
29
  export * from "../src/tokens/tokens.service";
@@ -310,7 +310,7 @@ export const ledLightHint = async (deviceName, body) => {
310
310
  * @param {Object} userBody
311
311
  * @returns {Promise<Device>}
312
312
  */
313
- const shadowAlarmUpdate = async (deviceName, alarms, shadowName) => {
313
+ export const shadowAlarmUpdate = async (deviceName, alarms, shadowName) => {
314
314
  const data = alarms;
315
315
  if (!deviceName) {
316
316
  return { error: "no deviceId" };
@@ -82,7 +82,7 @@ const auth = function authFactory(...requiredRights) {
82
82
  if (tokenDoc) {
83
83
  const ownerId = tokenDoc.owner;
84
84
  const auth0Roles = await getAuth0RolesByOwner(ownerId);
85
- console.log(`Authenticated API token request for owner ${ownerId}`, auth0Roles);
85
+ console.log(`Authenticated API token request for owner ${ownerId}`, auth0Roles, ROLES_CLAIM, "aaa");
86
86
  req.auth = {
87
87
  id: ownerId,
88
88
  tokenId: tokenDoc._id,
@@ -4,6 +4,7 @@ import ApiError from "../utils/ApiError"; // keep .cjs import
4
4
  export const isAiRole = (user) => {
5
5
  if (!user)
6
6
  return false;
7
+ console.log("Checking AI role for user:", user);
7
8
  return user["https://memo.wirewire.de/roles"]?.includes("ai") ?? false;
8
9
  };
9
10
  export const validateAiRole = async (req, res, next) => {
@@ -21,7 +21,6 @@ export const createOrganization = catchAsync(async (req, res) => {
21
21
  export const getOrganizations = catchAsync(async (req, res) => {
22
22
  const filter = pick(req.query, ["name", "kind"]);
23
23
  const options = pick(req.query, ["sortBy", "limit", "page"]);
24
- console.log("getOrganizations", req.query, filter, options);
25
24
  const filteredOptions = filterOptions(req.query, filter, {
26
25
  objectIds: ["_id", "patient"],
27
26
  search: ["name", "kind"],
@@ -6,7 +6,8 @@ extendZodWithOpenApi(z);
6
6
  export const createUserSchema = {
7
7
  body: z.object({
8
8
  meta: z
9
- .record(z.any())
9
+ .object({})
10
+ .passthrough()
10
11
  .optional()
11
12
  .openapi({
12
13
  example: { key: "value" },
@@ -58,7 +59,7 @@ export const updateUserSchema = {
58
59
  timezone: z.string().optional().openapi({ description: "IANA timezone" }),
59
60
  avatar: z.string().optional().openapi({ description: "Avatar URL" }),
60
61
  meta: z
61
- .record(z.any())
62
+ .object({})
62
63
  .optional()
63
64
  .openapi({ description: "Additional metadata" }),
64
65
  category: z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetderdinge/api",
3
- "version": "1.229.25",
3
+ "version": "1.229.27",
4
4
  "description": "Shared OpenIoT API modules",
5
5
  "main": "dist/src/index.js",
6
6
  "type": "module",
@@ -38,7 +38,6 @@
38
38
  "axios": "^1.13.5",
39
39
  "body-parser": "~2.2.2",
40
40
  "body-parser-xml": "~2.0.5",
41
- "canvas": "^3.2.1",
42
41
  "compression": "^1.8.1",
43
42
  "config": "^4.3.0",
44
43
  "cors": "^2.8.6",
@@ -74,8 +74,6 @@ const updateEntry = catchAsync(
74
74
  async (req: AuthenticatedRequest, res: Response): Promise<void> => {
75
75
  const account = await accountsService.getAccountById(req.auth.sub);
76
76
 
77
- console.log("account", account);
78
-
79
77
  const { isSocial } = account.identities[0];
80
78
 
81
79
  const {
@@ -22,8 +22,6 @@ export const setDeviceToken = catchAsync(
22
22
  user: res.req.auth.sub,
23
23
  body: req.body,
24
24
  });
25
-
26
- console.log("Setting device tokenddddd for user:", res.req.auth.sub);
27
25
  res.status(httpStatus.CREATED).send(user);
28
26
  },
29
27
  );
package/src/index.ts CHANGED
@@ -28,7 +28,14 @@ export { default as devicesNotificationsRoute } from "./devicesNotifications/dev
28
28
  export { default as devicesNotificationsService } from "../src/devicesNotifications/devicesNotifications.service";
29
29
  export { default as iotDevicesService } from "../src/iotdevice/iotdevice.service";
30
30
  export { default as iotdeviceRoute } from "../src/iotdevice/iotdevice.route";
31
- export { SIMILARITY_THRESHOLD } from "../src/iotdevice/iotdevice.service";
31
+ export {
32
+ SIMILARITY_THRESHOLD,
33
+ alarmsDevice,
34
+ getDeviceStatus,
35
+ getDeviceStatusList,
36
+ shadowAlarmGet,
37
+ shadowAlarmUpdate,
38
+ } from "../src/iotdevice/iotdevice.service";
32
39
  export { default as pdfRoute } from "../src/pdf/pdf.route";
33
40
  export { default as tokensRoute } from "../src/tokens/tokens.route";
34
41
  export * from "../src/tokens/tokens.service";
@@ -378,7 +378,7 @@ export const ledLightHint = async (deviceName, body) => {
378
378
  * @param {Object} userBody
379
379
  * @returns {Promise<Device>}
380
380
  */
381
- const shadowAlarmUpdate = async (deviceName, alarms, shadowName) => {
381
+ export const shadowAlarmUpdate = async (deviceName, alarms, shadowName) => {
382
382
  const data = alarms;
383
383
 
384
384
  if (!deviceName) {
@@ -134,6 +134,8 @@ const auth = function authFactory(...requiredRights: string[]) {
134
134
  console.log(
135
135
  `Authenticated API token request for owner ${ownerId}`,
136
136
  auth0Roles,
137
+ ROLES_CLAIM,
138
+ "aaa",
137
139
  );
138
140
  req.auth = {
139
141
  id: ownerId,
@@ -9,6 +9,8 @@ interface User {
9
9
  // you can adjust the User source if your auth payload differs
10
10
  export const isAiRole = (user?: User): boolean => {
11
11
  if (!user) return false;
12
+
13
+ console.log("Checking AI role for user:", user);
12
14
  return user["https://memo.wirewire.de/roles"]?.includes("ai") ?? false;
13
15
  };
14
16
 
@@ -32,7 +32,6 @@ export const getOrganizations = catchAsync(
32
32
  async (req: Request, res: Response): Promise<void> => {
33
33
  const filter = pick(req.query, ["name", "kind"]);
34
34
  const options = pick(req.query, ["sortBy", "limit", "page"]);
35
- console.log("getOrganizations", req.query, filter, options);
36
35
 
37
36
  const filteredOptions = filterOptions(req.query, filter, {
38
37
  objectIds: ["_id", "patient"],
@@ -17,7 +17,8 @@ extendZodWithOpenApi(z);
17
17
  export const createUserSchema = {
18
18
  body: z.object({
19
19
  meta: z
20
- .record(z.any())
20
+ .object({})
21
+ .passthrough()
21
22
  .optional()
22
23
  .openapi({
23
24
  example: { key: "value" },
@@ -75,7 +76,7 @@ export const updateUserSchema = {
75
76
  timezone: z.string().optional().openapi({ description: "IANA timezone" }),
76
77
  avatar: z.string().optional().openapi({ description: "Avatar URL" }),
77
78
  meta: z
78
- .record(z.any())
79
+ .object({})
79
80
  .optional()
80
81
  .openapi({ description: "Additional metadata" }),
81
82
  category: z