@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/browser.js CHANGED
@@ -2579,69 +2579,136 @@ var mcpAuthTypes = [
2579
2579
  "authorization_code"
2580
2580
  ];
2581
2581
  var mcpAuthConfigSchema = {
2582
- auth_type: {
2583
- type: "string",
2584
- enum: mcpAuthTypes,
2585
- title: "Auth Type",
2586
- description: "Authentication method for connecting to the MCP server",
2587
- default: "none"
2588
- },
2589
- auth_token: {
2590
- type: "string",
2591
- format: "credential",
2592
- title: "Bearer Token",
2593
- description: "Static bearer token or API key (for bearer auth)"
2594
- },
2595
- auth_client_id: {
2596
- type: "string",
2597
- title: "Client ID",
2598
- description: "OAuth client ID (for OAuth auth types)"
2599
- },
2600
- auth_client_secret: {
2601
- type: "string",
2602
- format: "credential",
2603
- title: "Client Secret",
2604
- description: "OAuth client secret (for client_credentials auth)"
2605
- },
2606
- auth_private_key: {
2607
- type: "string",
2608
- format: "credential",
2609
- title: "Private Key",
2610
- description: "PEM or JWK private key (for private_key_jwt auth)"
2611
- },
2612
- auth_algorithm: {
2613
- type: "string",
2614
- title: "Algorithm",
2615
- description: "JWT signing algorithm, e.g. RS256, ES256 (for private_key_jwt auth)"
2616
- },
2617
- auth_jwt_bearer_assertion: {
2618
- type: "string",
2619
- format: "credential",
2620
- title: "JWT Assertion",
2621
- description: "Pre-built JWT assertion (for static_private_key_jwt auth)"
2622
- },
2623
- auth_redirect_url: {
2624
- type: "string",
2625
- format: "uri",
2626
- title: "Redirect URL",
2627
- description: "OAuth redirect URL (for authorization_code auth)"
2628
- },
2629
- auth_scope: {
2630
- type: "string",
2631
- title: "Scope",
2632
- description: "OAuth scope (space-separated)"
2633
- },
2634
- auth_client_name: {
2635
- type: "string",
2636
- title: "Client Name",
2637
- description: "Optional OAuth client display name"
2582
+ properties: {
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"
2639
+ },
2640
+ auth_jwt_lifetime_seconds: {
2641
+ type: "number",
2642
+ title: "JWT Lifetime",
2643
+ description: "JWT lifetime in seconds (default: 300)",
2644
+ minimum: 1
2645
+ }
2638
2646
  },
2639
- auth_jwt_lifetime_seconds: {
2640
- type: "number",
2641
- title: "JWT Lifetime",
2642
- description: "JWT lifetime in seconds (default: 300)",
2643
- minimum: 1
2644
- }
2647
+ allOf: [
2648
+ {
2649
+ if: { properties: { auth_type: { const: "bearer" } }, required: ["auth_type"] },
2650
+ then: {
2651
+ required: ["auth_token"],
2652
+ properties: { auth_token: true }
2653
+ }
2654
+ },
2655
+ {
2656
+ if: {
2657
+ properties: { auth_type: { const: "client_credentials" } },
2658
+ required: ["auth_type"]
2659
+ },
2660
+ then: {
2661
+ required: ["auth_client_id", "auth_client_secret"],
2662
+ properties: {
2663
+ auth_client_id: true,
2664
+ auth_client_secret: true,
2665
+ auth_client_name: true,
2666
+ auth_scope: true
2667
+ }
2668
+ }
2669
+ },
2670
+ {
2671
+ if: { properties: { auth_type: { const: "private_key_jwt" } }, required: ["auth_type"] },
2672
+ then: {
2673
+ required: ["auth_client_id", "auth_private_key", "auth_algorithm"],
2674
+ properties: {
2675
+ auth_client_id: true,
2676
+ auth_private_key: true,
2677
+ auth_algorithm: true,
2678
+ auth_client_name: true,
2679
+ auth_jwt_lifetime_seconds: true,
2680
+ auth_scope: true
2681
+ }
2682
+ }
2683
+ },
2684
+ {
2685
+ if: {
2686
+ properties: { auth_type: { const: "static_private_key_jwt" } },
2687
+ required: ["auth_type"]
2688
+ },
2689
+ then: {
2690
+ required: ["auth_client_id", "auth_jwt_bearer_assertion"],
2691
+ properties: {
2692
+ auth_client_id: true,
2693
+ auth_jwt_bearer_assertion: true,
2694
+ auth_client_name: true,
2695
+ auth_scope: true
2696
+ }
2697
+ }
2698
+ },
2699
+ {
2700
+ if: { properties: { auth_type: { const: "authorization_code" } }, required: ["auth_type"] },
2701
+ then: {
2702
+ required: ["auth_client_id", "auth_redirect_url"],
2703
+ properties: {
2704
+ auth_client_id: true,
2705
+ auth_client_secret: true,
2706
+ auth_redirect_url: true,
2707
+ auth_scope: true
2708
+ }
2709
+ }
2710
+ }
2711
+ ]
2645
2712
  };
2646
2713
  function isMcpAuthType(value) {
2647
2714
  return typeof value === "string" && mcpAuthTypes.includes(value);
@@ -2734,6 +2801,7 @@ import {
2734
2801
  StaticPrivateKeyJwtProvider,
2735
2802
  createPrivateKeyJwtAuth
2736
2803
  } from "@modelcontextprotocol/sdk/client/auth-extensions.js";
2804
+ import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
2737
2805
  function normalizeServerUrl(serverUrl) {
2738
2806
  try {
2739
2807
  const u = new URL(serverUrl);
@@ -3184,19 +3252,22 @@ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
3184
3252
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3185
3253
  var mcpTransportTypes = ["streamable-http", "sse"];
3186
3254
  var mcpServerConfigSchema = {
3187
- transport: {
3188
- type: "string",
3189
- enum: mcpTransportTypes,
3190
- title: "Transport",
3191
- description: "The transport type to use for connecting to the MCP server"
3192
- },
3193
- server_url: {
3194
- type: "string",
3195
- format: "uri",
3196
- title: "Server URL",
3197
- description: "The URL of the MCP server (for streamable-http transport)"
3255
+ properties: {
3256
+ transport: {
3257
+ type: "string",
3258
+ enum: mcpTransportTypes,
3259
+ title: "Transport",
3260
+ description: "The transport type to use for connecting to the MCP server"
3261
+ },
3262
+ server_url: {
3263
+ type: "string",
3264
+ format: "uri",
3265
+ title: "Server URL",
3266
+ description: "The URL of the MCP server (for streamable-http transport)"
3267
+ },
3268
+ ...mcpAuthConfigSchema.properties
3198
3269
  },
3199
- ...mcpAuthConfigSchema
3270
+ allOf: mcpAuthConfigSchema.allOf
3200
3271
  };
3201
3272
  async function createMcpClient(config, signal) {
3202
3273
  let transport;
@@ -3204,7 +3275,7 @@ async function createMcpClient(config, signal) {
3204
3275
  if (auth && auth.type !== "none") {
3205
3276
  auth = await resolveAuthSecrets(auth, getGlobalCredentialStore());
3206
3277
  }
3207
- const authProvider = auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined;
3278
+ const authProvider = config.authProvider ?? (auth && auth.type !== "none" && auth.type !== "bearer" ? createAuthProvider(auth, config.server_url ?? "", getGlobalCredentialStore()) : undefined);
3208
3279
  const headers = {
3209
3280
  ...auth?.type === "bearer" ? { Authorization: `Bearer ${auth.token}` } : {}
3210
3281
  };
@@ -3386,6 +3457,7 @@ export {
3386
3457
  Worker,
3387
3458
  WORKER_SERVER,
3388
3459
  WORKER_MANAGER,
3460
+ UnauthorizedError,
3389
3461
  TypedArraySchema,
3390
3462
  TensorType,
3391
3463
  TensorSchema,
@@ -3416,4 +3488,4 @@ export {
3416
3488
  BaseError
3417
3489
  };
3418
3490
 
3419
- //# debugId=DB18C3070A0525DD64756E2164756E21
3491
+ //# debugId=F92FC9473BBE2EE764756E2164756E21