@softeria/ms-365-mcp-server 0.11.4 → 0.12.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.
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +1,42 @@
1
- import { z } from 'zod';
2
- export function makeApi(endpoints) {
3
- return endpoints;
1
+ import { z } from "zod";
2
+ function makeApi(endpoints) {
3
+ return endpoints;
4
4
  }
5
- export class Zodios {
6
- constructor(baseUrlOrEndpoints, endpoints, options) {
7
- if (typeof baseUrlOrEndpoints === 'string') {
8
- throw new Error('No such hack');
9
- }
10
- this.endpoints = baseUrlOrEndpoints.map((endpoint) => {
11
- endpoint.parameters = endpoint.parameters || [];
12
- for (const parameter of endpoint.parameters) {
13
- parameter.name = parameter.name.replace(/[$_]+/g, '');
14
- }
15
- const pathParamRegex = /:([a-zA-Z0-9]+)/g;
16
- const pathParams = [];
17
- let match;
18
- while ((match = pathParamRegex.exec(endpoint.path)) !== null) {
19
- pathParams.push(match[1]);
20
- }
21
- for (const pathParam of pathParams) {
22
- const paramExists = endpoint.parameters.some((param) => param.name === pathParam || param.name === pathParam.replace(/[$_]+/g, ''));
23
- if (!paramExists) {
24
- const newParam = {
25
- name: pathParam,
26
- type: 'Path',
27
- schema: z.string().describe(`Path parameter: ${pathParam}`),
28
- description: `Path parameter: ${pathParam}`,
29
- };
30
- endpoint.parameters.push(newParam);
31
- }
32
- }
33
- return endpoint;
34
- });
5
+ class Zodios {
6
+ constructor(baseUrlOrEndpoints, endpoints, options) {
7
+ if (typeof baseUrlOrEndpoints === "string") {
8
+ throw new Error("No such hack");
35
9
  }
10
+ this.endpoints = baseUrlOrEndpoints.map((endpoint) => {
11
+ endpoint.parameters = endpoint.parameters || [];
12
+ for (const parameter of endpoint.parameters) {
13
+ parameter.name = parameter.name.replace(/[$_]+/g, "");
14
+ }
15
+ const pathParamRegex = /:([a-zA-Z0-9]+)/g;
16
+ const pathParams = [];
17
+ let match;
18
+ while ((match = pathParamRegex.exec(endpoint.path)) !== null) {
19
+ pathParams.push(match[1]);
20
+ }
21
+ for (const pathParam of pathParams) {
22
+ const paramExists = endpoint.parameters.some(
23
+ (param) => param.name === pathParam || param.name === pathParam.replace(/[$_]+/g, "")
24
+ );
25
+ if (!paramExists) {
26
+ const newParam = {
27
+ name: pathParam,
28
+ type: "Path",
29
+ schema: z.string().describe(`Path parameter: ${pathParam}`),
30
+ description: `Path parameter: ${pathParam}`
31
+ };
32
+ endpoint.parameters.push(newParam);
33
+ }
34
+ }
35
+ return endpoint;
36
+ });
37
+ }
36
38
  }
39
+ export {
40
+ Zodios,
41
+ makeApi
42
+ };