cribl-control-plane 0.0.3 → 0.0.4

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 (98) hide show
  1. package/FUNCTIONS.md +6 -3
  2. package/README.md +22 -5
  3. package/bin/mcp-server.js +173 -34
  4. package/bin/mcp-server.js.map +12 -8
  5. package/dist/commonjs/__tests__/auth.test.d.ts +2 -0
  6. package/dist/commonjs/__tests__/auth.test.d.ts.map +1 -0
  7. package/dist/commonjs/__tests__/auth.test.js +24 -0
  8. package/dist/commonjs/__tests__/auth.test.js.map +1 -0
  9. package/dist/commonjs/funcs/authLogin.d.ts +17 -0
  10. package/dist/commonjs/funcs/authLogin.d.ts.map +1 -0
  11. package/dist/commonjs/funcs/authLogin.js +109 -0
  12. package/dist/commonjs/funcs/authLogin.js.map +1 -0
  13. package/dist/commonjs/lib/config.d.ts +3 -3
  14. package/dist/commonjs/lib/config.js +3 -3
  15. package/dist/commonjs/lib/config.js.map +1 -1
  16. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  17. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  18. package/dist/commonjs/mcp-server/server.js +3 -1
  19. package/dist/commonjs/mcp-server/server.js.map +1 -1
  20. package/dist/commonjs/mcp-server/tools/authLogin.d.ts +8 -0
  21. package/dist/commonjs/mcp-server/tools/authLogin.d.ts.map +1 -0
  22. package/dist/commonjs/mcp-server/tools/authLogin.js +64 -0
  23. package/dist/commonjs/mcp-server/tools/authLogin.js.map +1 -0
  24. package/dist/commonjs/models/authtoken.d.ts +29 -0
  25. package/dist/commonjs/models/authtoken.d.ts.map +1 -0
  26. package/dist/commonjs/models/authtoken.js +69 -0
  27. package/dist/commonjs/models/authtoken.js.map +1 -0
  28. package/dist/commonjs/models/index.d.ts +2 -0
  29. package/dist/commonjs/models/index.d.ts.map +1 -1
  30. package/dist/commonjs/models/index.js +2 -0
  31. package/dist/commonjs/models/index.js.map +1 -1
  32. package/dist/commonjs/models/logininfo.d.ts +31 -0
  33. package/dist/commonjs/models/logininfo.d.ts.map +1 -0
  34. package/dist/commonjs/models/logininfo.js +71 -0
  35. package/dist/commonjs/models/logininfo.js.map +1 -0
  36. package/dist/commonjs/sdk/auth.d.ts +12 -0
  37. package/dist/commonjs/sdk/auth.d.ts.map +1 -0
  38. package/dist/commonjs/sdk/auth.js +22 -0
  39. package/dist/commonjs/sdk/auth.js.map +1 -0
  40. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  41. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  42. package/dist/commonjs/sdk/sdk.js +4 -0
  43. package/dist/commonjs/sdk/sdk.js.map +1 -1
  44. package/dist/esm/__tests__/auth.test.d.ts +2 -0
  45. package/dist/esm/__tests__/auth.test.d.ts.map +1 -0
  46. package/dist/esm/__tests__/auth.test.js +22 -0
  47. package/dist/esm/__tests__/auth.test.js.map +1 -0
  48. package/dist/esm/funcs/authLogin.d.ts +17 -0
  49. package/dist/esm/funcs/authLogin.d.ts.map +1 -0
  50. package/dist/esm/funcs/authLogin.js +73 -0
  51. package/dist/esm/funcs/authLogin.js.map +1 -0
  52. package/dist/esm/lib/config.d.ts +3 -3
  53. package/dist/esm/lib/config.js +3 -3
  54. package/dist/esm/lib/config.js.map +1 -1
  55. package/dist/esm/mcp-server/mcp-server.js +1 -1
  56. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  57. package/dist/esm/mcp-server/server.js +3 -1
  58. package/dist/esm/mcp-server/server.js.map +1 -1
  59. package/dist/esm/mcp-server/tools/authLogin.d.ts +8 -0
  60. package/dist/esm/mcp-server/tools/authLogin.d.ts.map +1 -0
  61. package/dist/esm/mcp-server/tools/authLogin.js +28 -0
  62. package/dist/esm/mcp-server/tools/authLogin.js.map +1 -0
  63. package/dist/esm/models/authtoken.d.ts +29 -0
  64. package/dist/esm/models/authtoken.d.ts.map +1 -0
  65. package/dist/esm/models/authtoken.js +31 -0
  66. package/dist/esm/models/authtoken.js.map +1 -0
  67. package/dist/esm/models/index.d.ts +2 -0
  68. package/dist/esm/models/index.d.ts.map +1 -1
  69. package/dist/esm/models/index.js +2 -0
  70. package/dist/esm/models/index.js.map +1 -1
  71. package/dist/esm/models/logininfo.d.ts +31 -0
  72. package/dist/esm/models/logininfo.d.ts.map +1 -0
  73. package/dist/esm/models/logininfo.js +33 -0
  74. package/dist/esm/models/logininfo.js.map +1 -0
  75. package/dist/esm/sdk/auth.d.ts +12 -0
  76. package/dist/esm/sdk/auth.d.ts.map +1 -0
  77. package/dist/esm/sdk/auth.js +18 -0
  78. package/dist/esm/sdk/auth.js.map +1 -0
  79. package/dist/esm/sdk/sdk.d.ts +3 -0
  80. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  81. package/dist/esm/sdk/sdk.js +4 -0
  82. package/dist/esm/sdk/sdk.js.map +1 -1
  83. package/docs/sdks/auth/README.md +84 -0
  84. package/examples/{diagGetHealthInfo.example.ts → authLogin.example.ts} +5 -2
  85. package/examples/package-lock.json +1 -1
  86. package/jsr.json +1 -1
  87. package/package.json +1 -1
  88. package/src/__tests__/auth.test.ts +25 -0
  89. package/src/funcs/authLogin.ts +154 -0
  90. package/src/lib/config.ts +3 -3
  91. package/src/mcp-server/mcp-server.ts +1 -1
  92. package/src/mcp-server/server.ts +3 -1
  93. package/src/mcp-server/tools/authLogin.ts +37 -0
  94. package/src/models/authtoken.ts +62 -0
  95. package/src/models/index.ts +2 -0
  96. package/src/models/logininfo.ts +66 -0
  97. package/src/sdk/auth.ts +27 -0
  98. package/src/sdk/sdk.ts +6 -0
package/FUNCTIONS.md CHANGED
@@ -20,7 +20,7 @@ specific category of applications.
20
20
 
21
21
  ```typescript
22
22
  import { CriblControlPlaneCore } from "cribl-control-plane/core.js";
23
- import { diagGetHealthInfo } from "cribl-control-plane/funcs/diagGetHealthInfo.js";
23
+ import { authLogin } from "cribl-control-plane/funcs/authLogin.js";
24
24
 
25
25
  // Use `CriblControlPlaneCore` for best tree-shaking performance.
26
26
  // You can create one instance of it to use across an application.
@@ -29,12 +29,15 @@ const criblControlPlane = new CriblControlPlaneCore({
29
29
  });
30
30
 
31
31
  async function run() {
32
- const res = await diagGetHealthInfo(criblControlPlane);
32
+ const res = await authLogin(criblControlPlane, {
33
+ username: "Nikko.Connelly",
34
+ password: "Ljp4BunfMR9hNyM",
35
+ });
33
36
  if (res.ok) {
34
37
  const { value: result } = res;
35
38
  console.log(result);
36
39
  } else {
37
- console.log("diagGetHealthInfo failed:", res.error);
40
+ console.log("authLogin failed:", res.error);
38
41
  }
39
42
  }
40
43
 
package/README.md CHANGED
@@ -169,7 +169,10 @@ const criblControlPlane = new CriblControlPlane({
169
169
  });
170
170
 
171
171
  async function run() {
172
- const result = await criblControlPlane.diag.getHealthInfo();
172
+ const result = await criblControlPlane.auth.login({
173
+ username: "Nikko.Connelly",
174
+ password: "Ljp4BunfMR9hNyM",
175
+ });
173
176
 
174
177
  console.log(result);
175
178
  }
@@ -203,7 +206,10 @@ const criblControlPlane = new CriblControlPlane({
203
206
  });
204
207
 
205
208
  async function run() {
206
- const result = await criblControlPlane.diag.getHealthInfo();
209
+ const result = await criblControlPlane.auth.login({
210
+ username: "Nikko.Connelly",
211
+ password: "Ljp4BunfMR9hNyM",
212
+ });
207
213
 
208
214
  console.log(result);
209
215
  }
@@ -219,6 +225,10 @@ run();
219
225
  <details open>
220
226
  <summary>Available methods</summary>
221
227
 
228
+ ### [auth](docs/sdks/auth/README.md)
229
+
230
+ * [login](docs/sdks/auth/README.md#login) - Log in and obtain Auth token
231
+
222
232
 
223
233
  ### [diag](docs/sdks/diag/README.md)
224
234
 
@@ -246,6 +256,7 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
246
256
 
247
257
  <summary>Available standalone functions</summary>
248
258
 
259
+ - [`authLogin`](docs/sdks/auth/README.md#login) - Log in and obtain Auth token
249
260
  - [`diagGetHealthInfo`](docs/sdks/diag/README.md#gethealthinfo) - Provides health info for REST server
250
261
  - [`diagGetHealthInfo`](docs/sdks/health/README.md#gethealthinfo) - Provides health info for REST server
251
262
 
@@ -266,7 +277,10 @@ const criblControlPlane = new CriblControlPlane({
266
277
  });
267
278
 
268
279
  async function run() {
269
- const result = await criblControlPlane.diag.getHealthInfo({
280
+ const result = await criblControlPlane.auth.login({
281
+ username: "Nikko.Connelly",
282
+ password: "Ljp4BunfMR9hNyM",
283
+ }, {
270
284
  retries: {
271
285
  strategy: "backoff",
272
286
  backoff: {
@@ -305,7 +319,10 @@ const criblControlPlane = new CriblControlPlane({
305
319
  });
306
320
 
307
321
  async function run() {
308
- const result = await criblControlPlane.diag.getHealthInfo();
322
+ const result = await criblControlPlane.auth.login({
323
+ username: "Nikko.Connelly",
324
+ password: "Ljp4BunfMR9hNyM",
325
+ });
309
326
 
310
327
  console.log(result);
311
328
  }
@@ -382,7 +399,7 @@ run();
382
399
 
383
400
 
384
401
  **Inherit from [`CriblControlPlaneError`](./src/models/errors/criblcontrolplaneerror.ts)**:
385
- * [`HealthStatusError`](./src/models/errors/healthstatuserror.ts): Healthy status. Status code `420`. Applicable to 1 of 2 methods.*
402
+ * [`HealthStatusError`](./src/models/errors/healthstatuserror.ts): Healthy status. Status code `420`. Applicable to 1 of 3 methods.*
386
403
  * [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
387
404
 
388
405
  </details>
package/bin/mcp-server.js CHANGED
@@ -34406,11 +34406,34 @@ function parse(rawValue, fn, errorMessage) {
34406
34406
  throw err;
34407
34407
  }
34408
34408
  }
34409
+ function safeParse(rawValue, fn, errorMessage) {
34410
+ try {
34411
+ return OK2(fn(rawValue));
34412
+ } catch (err) {
34413
+ return ERR(new SDKValidationError(errorMessage, err, rawValue));
34414
+ }
34415
+ }
34409
34416
  var init_schemas = __esm(() => {
34410
34417
  init_esm();
34411
34418
  init_sdkvalidationerror();
34412
34419
  });
34413
34420
 
34421
+ // src/models/authtoken.ts
34422
+ var AuthToken$inboundSchema, AuthToken$outboundSchema, AuthToken$;
34423
+ var init_authtoken = __esm(() => {
34424
+ init_esm();
34425
+ AuthToken$inboundSchema = objectType({
34426
+ token: stringType()
34427
+ });
34428
+ AuthToken$outboundSchema = objectType({
34429
+ token: stringType()
34430
+ });
34431
+ ((AuthToken$) => {
34432
+ AuthToken$.inboundSchema = AuthToken$inboundSchema;
34433
+ AuthToken$.outboundSchema = AuthToken$outboundSchema;
34434
+ })(AuthToken$ ||= {});
34435
+ });
34436
+
34414
34437
  // src/types/enums.ts
34415
34438
  function catchUnrecognizedEnum(value) {
34416
34439
  return value;
@@ -34469,6 +34492,24 @@ var init_healthstatus = __esm(() => {
34469
34492
  })(HealthStatus$ ||= {});
34470
34493
  });
34471
34494
 
34495
+ // src/models/logininfo.ts
34496
+ var LoginInfo$inboundSchema, LoginInfo$outboundSchema, LoginInfo$;
34497
+ var init_logininfo = __esm(() => {
34498
+ init_esm();
34499
+ LoginInfo$inboundSchema = objectType({
34500
+ username: stringType(),
34501
+ password: stringType()
34502
+ });
34503
+ LoginInfo$outboundSchema = objectType({
34504
+ username: stringType(),
34505
+ password: stringType()
34506
+ });
34507
+ ((LoginInfo$) => {
34508
+ LoginInfo$.inboundSchema = LoginInfo$inboundSchema;
34509
+ LoginInfo$.outboundSchema = LoginInfo$outboundSchema;
34510
+ })(LoginInfo$ ||= {});
34511
+ });
34512
+
34472
34513
  // src/models/schemeclientoauth.ts
34473
34514
  var SchemeClientOauth$inboundSchema, SchemeClientOauth$outboundSchema, SchemeClientOauth$;
34474
34515
  var init_schemeclientoauth = __esm(() => {
@@ -34510,7 +34551,9 @@ var init_security = __esm(() => {
34510
34551
 
34511
34552
  // src/models/index.ts
34512
34553
  var init_models = __esm(() => {
34554
+ init_authtoken();
34513
34555
  init_healthstatus();
34556
+ init_logininfo();
34514
34557
  init_schemeclientoauth();
34515
34558
  init_security();
34516
34559
  });
@@ -34810,10 +34853,10 @@ var init_config = __esm(() => {
34810
34853
  ];
34811
34854
  SDK_METADATA = {
34812
34855
  language: "typescript",
34813
- openapiDocVersion: "4.12.2-4b17c8d4",
34814
- sdkVersion: "0.0.3",
34856
+ openapiDocVersion: "4.14.0-alpha.1752602215751-e622ff04",
34857
+ sdkVersion: "0.0.4",
34815
34858
  genVersion: "2.656.5",
34816
- userAgent: "speakeasy-sdk/typescript 0.0.3 2.656.5 4.12.2-4b17c8d4 cribl-control-plane"
34859
+ userAgent: "speakeasy-sdk/typescript 0.0.4 2.656.5 4.14.0-alpha.1752602215751-e622ff04 cribl-control-plane"
34817
34860
  };
34818
34861
  });
34819
34862
 
@@ -35812,6 +35855,126 @@ function compactMap(values) {
35812
35855
  }
35813
35856
  var init_primitives = () => {};
35814
35857
 
35858
+ // src/types/async.ts
35859
+ var APIPromise;
35860
+ var init_async = __esm(() => {
35861
+ APIPromise = class APIPromise {
35862
+ #promise;
35863
+ #unwrapped;
35864
+ [Symbol.toStringTag] = "APIPromise";
35865
+ constructor(p) {
35866
+ this.#promise = p instanceof Promise ? p : Promise.resolve(p);
35867
+ this.#unwrapped = p instanceof Promise ? this.#promise.then(([value]) => value) : Promise.resolve(p[0]);
35868
+ }
35869
+ then(onfulfilled, onrejected) {
35870
+ return this.#promise.then(onfulfilled ? ([value]) => onfulfilled(value) : undefined, onrejected);
35871
+ }
35872
+ catch(onrejected) {
35873
+ return this.#unwrapped.catch(onrejected);
35874
+ }
35875
+ finally(onfinally) {
35876
+ return this.#unwrapped.finally(onfinally);
35877
+ }
35878
+ $inspect() {
35879
+ return this.#promise;
35880
+ }
35881
+ };
35882
+ });
35883
+
35884
+ // src/funcs/authLogin.ts
35885
+ function authLogin(client, request, options) {
35886
+ return new APIPromise($do(client, request, options));
35887
+ }
35888
+ async function $do(client, request, options) {
35889
+ const parsed = safeParse(request, (value) => LoginInfo$outboundSchema.parse(value), "Input validation failed");
35890
+ if (!parsed.ok) {
35891
+ return [parsed, { status: "invalid" }];
35892
+ }
35893
+ const payload = parsed.value;
35894
+ const body = encodeJSON("body", payload, { explode: true });
35895
+ const path = pathToFunc("/auth/login")();
35896
+ const headers = new Headers(compactMap({
35897
+ "Content-Type": "application/json",
35898
+ Accept: "application/json"
35899
+ }));
35900
+ const context = {
35901
+ options: client._options,
35902
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
35903
+ operationID: "login",
35904
+ oAuth2Scopes: [],
35905
+ resolvedSecurity: null,
35906
+ securitySource: null,
35907
+ retryConfig: options?.retries || client._options.retryConfig || { strategy: "none" },
35908
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"]
35909
+ };
35910
+ const requestRes = client._createRequest(context, {
35911
+ method: "POST",
35912
+ baseURL: options?.serverURL,
35913
+ path,
35914
+ headers,
35915
+ body,
35916
+ userAgent: client._options.userAgent,
35917
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1
35918
+ }, options);
35919
+ if (!requestRes.ok) {
35920
+ return [requestRes, { status: "invalid" }];
35921
+ }
35922
+ const req = requestRes.value;
35923
+ const doResult = await client._do(req, {
35924
+ context,
35925
+ errorCodes: ["401", "403", "429", "4XX", "5XX"],
35926
+ retryConfig: context.retryConfig,
35927
+ retryCodes: context.retryCodes
35928
+ });
35929
+ if (!doResult.ok) {
35930
+ return [doResult, { status: "request-error", request: req }];
35931
+ }
35932
+ const response = doResult.value;
35933
+ const [result] = await match(json(200, AuthToken$inboundSchema), fail([401, 403, 429, "4XX"]), fail("5XX"))(response, req);
35934
+ if (!result.ok) {
35935
+ return [result, { status: "complete", request: req, response }];
35936
+ }
35937
+ return [result, { status: "complete", request: req, response }];
35938
+ }
35939
+ var init_authLogin = __esm(() => {
35940
+ init_encodings();
35941
+ init_matchers();
35942
+ init_primitives();
35943
+ init_schemas();
35944
+ init_url();
35945
+ init_models();
35946
+ init_async();
35947
+ });
35948
+
35949
+ // src/mcp-server/tools/authLogin.ts
35950
+ var args, tool$authLogin;
35951
+ var init_authLogin2 = __esm(() => {
35952
+ init_authLogin();
35953
+ init_models();
35954
+ init_tools();
35955
+ args = {
35956
+ request: LoginInfo$inboundSchema
35957
+ };
35958
+ tool$authLogin = {
35959
+ name: "auth-login",
35960
+ description: `Log in and obtain Auth token
35961
+
35962
+ This endpoint is unavailable on Cribl.Cloud. Instead, follow the instructions at https://docs.cribl.io/stream/api-tutorials/#criblcloud to get an Auth token for Cribl.Cloud.`,
35963
+ args,
35964
+ tool: async (client, args2, ctx) => {
35965
+ const [result, apiCall] = await authLogin(client, args2.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
35966
+ if (!result.ok) {
35967
+ return {
35968
+ content: [{ type: "text", text: result.error.message }],
35969
+ isError: true
35970
+ };
35971
+ }
35972
+ const value = result.value;
35973
+ return formatResult(value, apiCall);
35974
+ }
35975
+ };
35976
+ });
35977
+
35815
35978
  // src/models/errors/healthstatuserror.ts
35816
35979
  var HealthStatusError, HealthStatusError$inboundSchema, HealthStatusError$outboundSchema, HealthStatusError$;
35817
35980
  var init_healthstatuserror = __esm(() => {
@@ -35868,37 +36031,11 @@ var init_errors2 = __esm(() => {
35868
36031
  init_sdkvalidationerror();
35869
36032
  });
35870
36033
 
35871
- // src/types/async.ts
35872
- var APIPromise;
35873
- var init_async = __esm(() => {
35874
- APIPromise = class APIPromise {
35875
- #promise;
35876
- #unwrapped;
35877
- [Symbol.toStringTag] = "APIPromise";
35878
- constructor(p) {
35879
- this.#promise = p instanceof Promise ? p : Promise.resolve(p);
35880
- this.#unwrapped = p instanceof Promise ? this.#promise.then(([value]) => value) : Promise.resolve(p[0]);
35881
- }
35882
- then(onfulfilled, onrejected) {
35883
- return this.#promise.then(onfulfilled ? ([value]) => onfulfilled(value) : undefined, onrejected);
35884
- }
35885
- catch(onrejected) {
35886
- return this.#unwrapped.catch(onrejected);
35887
- }
35888
- finally(onfinally) {
35889
- return this.#unwrapped.finally(onfinally);
35890
- }
35891
- $inspect() {
35892
- return this.#promise;
35893
- }
35894
- };
35895
- });
35896
-
35897
36034
  // src/funcs/diagGetHealthInfo.ts
35898
36035
  function diagGetHealthInfo(client, options) {
35899
- return new APIPromise($do(client, options));
36036
+ return new APIPromise($do2(client, options));
35900
36037
  }
35901
- async function $do(client, options) {
36038
+ async function $do2(client, options) {
35902
36039
  const path = pathToFunc("/health")();
35903
36040
  const headers = new Headers(compactMap({
35904
36041
  Accept: "application/json"
@@ -35979,7 +36116,7 @@ var init_diagGetHealthInfo2 = __esm(() => {
35979
36116
  function createMCPServer(deps) {
35980
36117
  const server = new McpServer({
35981
36118
  name: "CriblControlPlane",
35982
- version: "0.0.3"
36119
+ version: "0.0.4"
35983
36120
  });
35984
36121
  const client = new CriblControlPlaneCore({
35985
36122
  security: deps.security,
@@ -35993,6 +36130,7 @@ function createMCPServer(deps) {
35993
36130
  const resourceTemplate = createRegisterResourceTemplate(deps.logger, server, client, scopes);
35994
36131
  const prompt = createRegisterPrompt(deps.logger, server, client, scopes);
35995
36132
  const register = { tool, resource, resourceTemplate, prompt };
36133
+ tool(tool$authLogin);
35996
36134
  tool(tool$diagGetHealthInfo);
35997
36135
  return server;
35998
36136
  }
@@ -36001,6 +36139,7 @@ var init_server2 = __esm(() => {
36001
36139
  init_core();
36002
36140
  init_resources();
36003
36141
  init_tools();
36142
+ init_authLogin2();
36004
36143
  init_diagGetHealthInfo2();
36005
36144
  });
36006
36145
 
@@ -37215,7 +37354,7 @@ var routes = an({
37215
37354
  var app = He(routes, {
37216
37355
  name: "mcp",
37217
37356
  versionInfo: {
37218
- currentVersion: "0.0.3"
37357
+ currentVersion: "0.0.4"
37219
37358
  }
37220
37359
  });
37221
37360
  zt(app, process3.argv.slice(2), buildContext(process3));
@@ -37223,5 +37362,5 @@ export {
37223
37362
  app
37224
37363
  };
37225
37364
 
37226
- //# debugId=07E1357080905A5264756E2164756E21
37365
+ //# debugId=92C249F9C811A57B64756E2164756E21
37227
37366
  //# sourceMappingURL=mcp-server.js.map