@workglow/util 0.0.117 → 0.0.119

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.
package/dist/bun.js CHANGED
@@ -2580,69 +2580,136 @@ var mcpAuthTypes = [
2580
2580
  "authorization_code"
2581
2581
  ];
2582
2582
  var mcpAuthConfigSchema = {
2583
- auth_type: {
2584
- type: "string",
2585
- enum: mcpAuthTypes,
2586
- title: "Auth Type",
2587
- description: "Authentication method for connecting to the MCP server",
2588
- default: "none"
2589
- },
2590
- auth_token: {
2591
- type: "string",
2592
- format: "credential",
2593
- title: "Bearer Token",
2594
- description: "Static bearer token or API key (for bearer auth)"
2595
- },
2596
- auth_client_id: {
2597
- type: "string",
2598
- title: "Client ID",
2599
- description: "OAuth client ID (for OAuth auth types)"
2600
- },
2601
- auth_client_secret: {
2602
- type: "string",
2603
- format: "credential",
2604
- title: "Client Secret",
2605
- description: "OAuth client secret (for client_credentials auth)"
2606
- },
2607
- auth_private_key: {
2608
- type: "string",
2609
- format: "credential",
2610
- title: "Private Key",
2611
- description: "PEM or JWK private key (for private_key_jwt auth)"
2612
- },
2613
- auth_algorithm: {
2614
- type: "string",
2615
- title: "Algorithm",
2616
- description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)"
2617
- },
2618
- auth_jwt_bearer_assertion: {
2619
- type: "string",
2620
- format: "credential",
2621
- title: "JWT Assertion",
2622
- description: "Pre-built JWT assertion (for static_private_key_jwt auth)"
2623
- },
2624
- auth_redirect_url: {
2625
- type: "string",
2626
- format: "uri",
2627
- title: "Redirect URL",
2628
- description: "OAuth redirect URL (for authorization_code auth)"
2629
- },
2630
- auth_scope: {
2631
- type: "string",
2632
- title: "Scope",
2633
- description: "OAuth scope (space-separated)"
2634
- },
2635
- auth_client_name: {
2636
- type: "string",
2637
- title: "Client Name",
2638
- description: "Optional OAuth client display name"
2583
+ properties: {
2584
+ auth_type: {
2585
+ type: "string",
2586
+ enum: mcpAuthTypes,
2587
+ title: "Auth Type",
2588
+ description: "Authentication method for connecting to the MCP server",
2589
+ default: "none"
2590
+ },
2591
+ auth_token: {
2592
+ type: "string",
2593
+ format: "credential",
2594
+ title: "Bearer Token",
2595
+ description: "Static bearer token or API key (for bearer auth)"
2596
+ },
2597
+ auth_client_id: {
2598
+ type: "string",
2599
+ title: "Client ID",
2600
+ description: "OAuth client ID (for OAuth auth types)"
2601
+ },
2602
+ auth_client_secret: {
2603
+ type: "string",
2604
+ format: "credential",
2605
+ title: "Client Secret",
2606
+ description: "OAuth client secret (for client_credentials auth)"
2607
+ },
2608
+ auth_private_key: {
2609
+ type: "string",
2610
+ format: "credential",
2611
+ title: "Private Key",
2612
+ description: "PEM or JWK private key (for private_key_jwt auth)"
2613
+ },
2614
+ auth_algorithm: {
2615
+ type: "string",
2616
+ title: "Algorithm",
2617
+ description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)"
2618
+ },
2619
+ auth_jwt_bearer_assertion: {
2620
+ type: "string",
2621
+ format: "credential",
2622
+ title: "JWT Assertion",
2623
+ description: "Pre-built JWT assertion (for static_private_key_jwt auth)"
2624
+ },
2625
+ auth_redirect_url: {
2626
+ type: "string",
2627
+ format: "uri",
2628
+ title: "Redirect URL",
2629
+ description: "OAuth redirect URL (for authorization_code auth)"
2630
+ },
2631
+ auth_scope: {
2632
+ type: "string",
2633
+ title: "Scope",
2634
+ description: "OAuth scope (space-separated)"
2635
+ },
2636
+ auth_client_name: {
2637
+ type: "string",
2638
+ title: "Client Name",
2639
+ description: "Optional OAuth client display name"
2640
+ },
2641
+ auth_jwt_lifetime_seconds: {
2642
+ type: "number",
2643
+ title: "JWT Lifetime",
2644
+ description: "JWT lifetime in seconds (default: 300)",
2645
+ minimum: 1
2646
+ }
2639
2647
  },
2640
- auth_jwt_lifetime_seconds: {
2641
- type: "number",
2642
- title: "JWT Lifetime",
2643
- description: "JWT lifetime in seconds (default: 300)",
2644
- minimum: 1
2645
- }
2648
+ allOf: [
2649
+ {
2650
+ if: { properties: { auth_type: { const: "bearer" } }, required: ["auth_type"] },
2651
+ then: {
2652
+ required: ["auth_token"],
2653
+ properties: { auth_token: true }
2654
+ }
2655
+ },
2656
+ {
2657
+ if: {
2658
+ properties: { auth_type: { const: "client_credentials" } },
2659
+ required: ["auth_type"]
2660
+ },
2661
+ then: {
2662
+ required: ["auth_client_id", "auth_client_secret"],
2663
+ properties: {
2664
+ auth_client_id: true,
2665
+ auth_client_secret: true,
2666
+ auth_client_name: true,
2667
+ auth_scope: true
2668
+ }
2669
+ }
2670
+ },
2671
+ {
2672
+ if: { properties: { auth_type: { const: "private_key_jwt" } }, required: ["auth_type"] },
2673
+ then: {
2674
+ required: ["auth_client_id", "auth_private_key", "auth_algorithm"],
2675
+ properties: {
2676
+ auth_client_id: true,
2677
+ auth_private_key: true,
2678
+ auth_algorithm: true,
2679
+ auth_client_name: true,
2680
+ auth_jwt_lifetime_seconds: true,
2681
+ auth_scope: true
2682
+ }
2683
+ }
2684
+ },
2685
+ {
2686
+ if: {
2687
+ properties: { auth_type: { const: "static_private_key_jwt" } },
2688
+ required: ["auth_type"]
2689
+ },
2690
+ then: {
2691
+ required: ["auth_client_id", "auth_jwt_bearer_assertion"],
2692
+ properties: {
2693
+ auth_client_id: true,
2694
+ auth_jwt_bearer_assertion: true,
2695
+ auth_client_name: true,
2696
+ auth_scope: true
2697
+ }
2698
+ }
2699
+ },
2700
+ {
2701
+ if: { properties: { auth_type: { const: "authorization_code" } }, required: ["auth_type"] },
2702
+ then: {
2703
+ required: ["auth_client_id", "auth_redirect_url"],
2704
+ properties: {
2705
+ auth_client_id: true,
2706
+ auth_client_secret: true,
2707
+ auth_redirect_url: true,
2708
+ auth_scope: true
2709
+ }
2710
+ }
2711
+ }
2712
+ ]
2646
2713
  };
2647
2714
  function isMcpAuthType(value) {
2648
2715
  return typeof value === "string" && mcpAuthTypes.includes(value);
@@ -2735,6 +2802,7 @@ import {
2735
2802
  StaticPrivateKeyJwtProvider,
2736
2803
  createPrivateKeyJwtAuth
2737
2804
  } from "@modelcontextprotocol/sdk/client/auth-extensions.js";
2805
+ import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
2738
2806
  function normalizeServerUrl(serverUrl) {
2739
2807
  try {
2740
2808
  const u = new URL(serverUrl);
@@ -3193,36 +3261,39 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
3193
3261
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3194
3262
  var mcpTransportTypes = ["stdio", "sse", "streamable-http"];
3195
3263
  var mcpServerConfigSchema = {
3196
- transport: {
3197
- type: "string",
3198
- enum: mcpTransportTypes,
3199
- title: "Transport",
3200
- description: "The transport type to use for connecting to the MCP server"
3201
- },
3202
- server_url: {
3203
- type: "string",
3204
- format: "string:uri",
3205
- title: "Server URL",
3206
- description: "The URL of the MCP server (for sse and streamable-http transports)"
3207
- },
3208
- command: {
3209
- type: "string",
3210
- title: "Command",
3211
- description: "The command to run (for stdio transport)"
3212
- },
3213
- args: {
3214
- type: "array",
3215
- items: { type: "string" },
3216
- title: "Arguments",
3217
- description: "Command arguments (for stdio transport)"
3218
- },
3219
- env: {
3220
- type: "object",
3221
- additionalProperties: { type: "string" },
3222
- title: "Environment",
3223
- description: "Environment variables (for stdio transport)"
3264
+ properties: {
3265
+ transport: {
3266
+ type: "string",
3267
+ enum: mcpTransportTypes,
3268
+ title: "Transport",
3269
+ description: "The transport type to use for connecting to the MCP server"
3270
+ },
3271
+ server_url: {
3272
+ type: "string",
3273
+ format: "string:uri",
3274
+ title: "Server URL",
3275
+ description: "The URL of the MCP server (for sse and streamable-http transports)"
3276
+ },
3277
+ command: {
3278
+ type: "string",
3279
+ title: "Command",
3280
+ description: "The command to run (for stdio transport)"
3281
+ },
3282
+ args: {
3283
+ type: "array",
3284
+ items: { type: "string" },
3285
+ title: "Arguments",
3286
+ description: "Command arguments (for stdio transport)"
3287
+ },
3288
+ env: {
3289
+ type: "object",
3290
+ additionalProperties: { type: "string" },
3291
+ title: "Environment",
3292
+ description: "Environment variables (for stdio transport)"
3293
+ },
3294
+ ...mcpAuthConfigSchema.properties
3224
3295
  },
3225
- ...mcpAuthConfigSchema
3296
+ allOf: mcpAuthConfigSchema.allOf
3226
3297
  };
3227
3298
  async function createMcpClient(config, signal) {
3228
3299
  let transport;
@@ -3230,7 +3301,7 @@ async function createMcpClient(config, signal) {
3230
3301
  if (auth && auth.type !== "none") {
3231
3302
  auth = await resolveAuthSecrets(auth, getGlobalCredentialStore());
3232
3303
  }
3233
- const authProvider = auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined;
3304
+ const authProvider = config.authProvider ?? (auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined);
3234
3305
  const headers = {
3235
3306
  ...auth?.type === "bearer" ? { Authorization: `Bearer ${auth.token}` } : {}
3236
3307
  };
@@ -3384,6 +3455,7 @@ export {
3384
3455
  Worker,
3385
3456
  WORKER_SERVER,
3386
3457
  WORKER_MANAGER,
3458
+ UnauthorizedError,
3387
3459
  TypedArraySchema,
3388
3460
  TensorType,
3389
3461
  TensorSchema,
@@ -3414,4 +3486,4 @@ export {
3414
3486
  BaseError
3415
3487
  };
3416
3488
 
3417
- //# debugId=8521DA6A86167CBD64756E2164756E21
3489
+ //# debugId=0CE726CD0D1049FD64756E2164756E21