@zuplo/runtime 6.54.16 → 6.54.18

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.
@@ -4426,6 +4426,7 @@ export declare class JwtServicePlugin extends SystemRuntimePlugin {
4426
4426
  static signJwt({
4427
4427
  audience,
4428
4428
  subject,
4429
+ expiresIn,
4429
4430
  ...payload
4430
4431
  }: JWTSignPayload): Promise<string>;
4431
4432
  constructor(options?: JwtServicePluginOptions);
@@ -4439,11 +4440,16 @@ export declare class JwtServicePlugin extends SystemRuntimePlugin {
4439
4440
  }
4440
4441
 
4441
4442
  declare interface JwtServicePluginOptions {
4443
+ /**
4444
+ * The base path for the JWT issuer endpoint.
4445
+ * The default value is "/__zuplo/issuer".
4446
+ */
4442
4447
  basePath?: string;
4443
4448
  /**
4444
- * Sets time for the "exp" (Expiration Time) Claim in the JWT.
4449
+ * Sets the default time for the "exp" (Expiration Time) Claim in the JWT.
4450
+ * This value can be overridden when signing a JWT.
4445
4451
  *
4446
- * - If a `number` is passed as an argument it is used as the claim directly.
4452
+ * - If a `number` is passed as an argument it is treated as seconds and added to the current time.
4447
4453
  * - If a `string` is passed as an argument it is resolved to a time span, and then added to the
4448
4454
  * current unix timestamp and used as the claim.
4449
4455
  *
@@ -4459,7 +4465,7 @@ declare interface JwtServicePluginOptions {
4459
4465
  * subtracted from the current unix timestamp. A "from now" suffix can also be used for
4460
4466
  * readability when adding to the current unix timestamp.
4461
4467
  */
4462
- tokenExpiration?: number | string;
4468
+ expiresIn?: number | string;
4463
4469
  }
4464
4470
 
4465
4471
  declare interface JWTSignPayload {
@@ -4476,6 +4482,26 @@ declare interface JWTSignPayload {
4476
4482
  * If not provided, the JWT will not have an audience claim.
4477
4483
  */
4478
4484
  audience?: string;
4485
+ /**
4486
+ * Sets time for the "exp" (Expiration Time) Claim in the JWT.
4487
+ *
4488
+ * - If a `number` is passed as an argument it is treated as seconds and added to the current time.
4489
+ * - If a `string` is passed as an argument it is resolved to a time span, and then added to the
4490
+ * current unix timestamp and used as the claim.
4491
+ *
4492
+ * Format used for time span should be a number followed by a unit, such as "5 minutes" or "1
4493
+ * day".
4494
+ *
4495
+ * Valid units are: "sec", "secs", "second", "seconds", "s", "minute", "minutes", "min", "mins",
4496
+ * "m", "hour", "hours", "hr", "hrs", "h", "day", "days", "d", "week", "weeks", "w", "year",
4497
+ * "years", "yr", "yrs", and "y". It is not possible to specify months. 365.25 days is used as an
4498
+ * alias for a year.
4499
+ *
4500
+ * If the string is suffixed with "ago", or prefixed with a "-", the resulting time span gets
4501
+ * subtracted from the current unix timestamp. A "from now" suffix can also be used for
4502
+ * readability when adding to the current unix timestamp.
4503
+ */
4504
+ expiresIn?: number | string;
4479
4505
  [key: string]: any;
4480
4506
  }
4481
4507
 
@@ -8204,6 +8230,66 @@ export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
8204
8230
  version?: 1 | 2;
8205
8231
  }
8206
8232
 
8233
+ /**
8234
+ * Generates a Zuplo JWT token and attaches it to the outgoing request. This
8235
+ * policy creates a self-signed JWT using the Zuplo JWT plugin and adds it
8236
+ * to the specified header for upstream authentication.
8237
+ *
8238
+ * @title Upstream Zuplo JWT
8239
+ * @enterprise
8240
+ * @param request - The ZuploRequest
8241
+ * @param context - The ZuploContext
8242
+ * @param options - The policy options set in policies.json
8243
+ * @param policyName - The name of the policy as set in policies.json
8244
+ * @returns A ZuploRequest
8245
+ */
8246
+ export declare class UpstreamZuploJwtAuthInboundPolicy extends InboundPolicy<UpstreamZuploJwtAuthInboundPolicyOptions> {
8247
+ constructor(
8248
+ options: UpstreamZuploJwtAuthInboundPolicyOptions,
8249
+ policyName: string
8250
+ );
8251
+ /**
8252
+ * The handler that is called each time this policy is invoked
8253
+ *
8254
+ * @param request - The incoming Request
8255
+ * @param context - The current context of the Request
8256
+ * @returns A Response or Request object
8257
+ */
8258
+ handler(
8259
+ request: ZuploRequest,
8260
+ context: ZuploContext
8261
+ ): Promise<ZuploRequest | Response>;
8262
+ }
8263
+
8264
+ /**
8265
+ * The options for the Upstream Zuplo JWT Auth Inbound policy.
8266
+ * @public
8267
+ */
8268
+ export declare interface UpstreamZuploJwtAuthInboundPolicyOptions {
8269
+ /**
8270
+ * The audience claim for the JWT.
8271
+ */
8272
+ audience?: string;
8273
+ /**
8274
+ * The header name where the JWT will be attached. Defaults to 'Authorization'.
8275
+ */
8276
+ headerName?: string;
8277
+ /**
8278
+ * The prefix to use before the JWT token. Defaults to 'Bearer'. Set to an empty string to send the token without a prefix.
8279
+ */
8280
+ tokenPrefix?: string;
8281
+ /**
8282
+ * Additional claims to include in the JWT. These will be merged with the default claims.
8283
+ */
8284
+ additionalClaims?: {
8285
+ [k: string]: unknown;
8286
+ };
8287
+ /**
8288
+ * JWT expiration time. Can be a number (seconds) or a string with units (e.g., '5m' for 5 minutes, '1h' for 1 hour, '7d' for 7 days). Defaults to 300 seconds (5 minutes).
8289
+ */
8290
+ expiresIn?: number | string;
8291
+ }
8292
+
8207
8293
  declare interface UrlConfig {
8208
8294
  defaultUrl: string;
8209
8295
  urls: string[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.54.16",
4
+ "version": "6.54.18",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {