@zuplo/runtime 6.51.59 → 6.51.61

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.
@@ -15,4 +15,3 @@
15
15
  * Copyright (c) 2016 Lerus Ludovic
16
16
  *
17
17
  */
18
- /*! For license information please see index.js.LEGAL.txt */
@@ -256,85 +256,6 @@ declare interface APITokenCredentialConfig {
256
256
  headerValuePrefix?: string;
257
257
  }
258
258
 
259
- /**
260
- * Authorize requests using Aserto.
261
- *
262
- * @title Aserto Authorization
263
- * @beta
264
- * @param request - The ZuploRequest
265
- * @param context - The ZuploContext
266
- * @param options - The policy options set in policies.json
267
- * @param policyName - The name of the policy as set in policies.json
268
- * @returns A Request or a Response
269
- */
270
- export declare class AsertoAuthZInboundPolicy extends InboundPolicy<AsertoAuthZInboundPolicyOptions> {
271
- private cache;
272
- private authorizationUrl;
273
- /**
274
- * Set the authorization context for the current request.
275
- *
276
- * @param context - The ZuploContext for the current request
277
- * @param asertoContext - The Aserto context to send to the Aserto service
278
- */
279
- static setAuthorizationContext(context: ZuploContext, asertoContext: Partial<AsertoContext>): void;
280
- constructor(options: AsertoAuthZInboundPolicyOptions, policyName: string);
281
- /**
282
- * The handler that is called each time this policy is invoked
283
- *
284
- * @param request - The incoming Request
285
- * @param context - The current context of the Request
286
- * @returns A Response or Request object
287
- */
288
- handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
289
- }
290
-
291
- /**
292
- * The options for this policy.
293
- */
294
- export declare interface AsertoAuthZInboundPolicyOptions {
295
- /**
296
- * Indicates whether the request should continue if authorization fails. Default is `false` which means unauthorized users will automatically receive a 403 response.
297
- */
298
- allowUnauthorizedRequests?: boolean;
299
- /**
300
- * The Aserto Tenant ID.
301
- */
302
- tenantId: string;
303
- /**
304
- * The Aserto API key.
305
- */
306
- authorizerApiKey: string;
307
- /**
308
- * The Aserto Authorizer API URL.
309
- */
310
- authorizerApiUrl?: string;
311
- /**
312
- * The policy instance name.
313
- */
314
- policyName?: string;
315
- /**
316
- * Canonicalized service name.
317
- */
318
- serviceName: string;
319
- /**
320
- * The path to the user's sub property in the request.
321
- */
322
- userSubPropertyPath?: string;
323
- }
324
-
325
- /**
326
- * The Aserto context that is passed to the Aserto service.
327
- */
328
- declare interface AsertoContext {
329
- identityContext: {
330
- identity: string;
331
- type: "IDENTITY_TYPE_SUB" | "IDENTITY_TYPE_NONE" | "IDENTITY_TYPE_JWT";
332
- };
333
- policyContext: PolicyContext;
334
- policyInstance: PolicyInstance;
335
- resourceContext: ResourceContext;
336
- }
337
-
338
259
  /**
339
260
  * A list of attributes that will be included in the authorization request.
340
261
  */
@@ -4349,26 +4270,6 @@ export declare interface PolicyConfiguration {
4349
4270
  options?: unknown;
4350
4271
  }
4351
4272
 
4352
- /**
4353
- * The policy context that is passed to the Aserto service.
4354
- */
4355
- declare interface PolicyContext {
4356
- decisions: string[];
4357
- path: string;
4358
- }
4359
-
4360
- declare interface PolicyInstance {
4361
- /**
4362
- * The policy instance name
4363
- */
4364
- name: string;
4365
- /**
4366
- * The policy instance label
4367
- * @deprecated - This field is no longer required by Aserto
4368
- */
4369
- instanceLabel?: string;
4370
- }
4371
-
4372
4273
  /**
4373
4274
  * @public
4374
4275
  */
@@ -5026,8 +4927,6 @@ declare type ResolveRequestQuery<TQuery extends RequestQueryDefault | undefined>
5026
4927
 
5027
4928
  declare type ResolveUserData<TUserData extends UserDataDefault | undefined> = TUserData extends UserDataDefault ? TUserData : UserDataDefault;
5028
4929
 
5029
- declare type ResourceContext = Record<string, string>;
5030
-
5031
4930
  /**
5032
4931
  * @beta
5033
4932
  */
@@ -5162,6 +5061,73 @@ export declare const SchemaBasedRequestValidation: InboundPolicyHandler<RequestV
5162
5061
 
5163
5062
  /* Excluded from this release type: SemanticAttributes */
5164
5063
 
5064
+ /**
5065
+ * Respond to matched incoming requests with semantically cached content
5066
+ *
5067
+ * The Semantic Cache Inbound policy caches responses based on semantic similarity
5068
+ * of cache keys rather than exact matches. This allows for more flexible caching
5069
+ * where similar requests can return cached responses even if the cache key is not
5070
+ * exactly the same.
5071
+ *
5072
+ * The policy uses Large Language Model (LLM) embeddings to determine semantic
5073
+ * similarity between cache keys based on a configurable similarity tolerance.
5074
+ *
5075
+ * Options:
5076
+ * - similarityTolerance: The minimum similarity threshold for semantic cache matches (0-1, default: 0.8). Values closer to 1 require higher similarity. Can be overridden by custom functions.
5077
+ * - expirationSecondsTtl: The timeout of the cache in seconds (default: 3600, 1 hour). Can be overridden by custom functions.
5078
+ * - cacheBy: Determines how cache keys are generated: 'function' for custom logic or 'propertyPath' to extract from JSON body.
5079
+ *
5080
+ * @title Semantic Cache
5081
+ * @beta
5082
+ * @param request - The ZuploRequest
5083
+ * @param context - The ZuploContext
5084
+ * @param options - The policy options set in policies.json
5085
+ * @param policyName - The name of the policy as set in policies.json
5086
+ * @returns A Request or a Response
5087
+ */
5088
+ export declare function SemanticCacheInboundPolicy(request: ZuploRequest, context: ZuploContext, options: SemanticCacheInboundPolicyOptions, policyName: string): Promise<Response | ZuploRequest<RequestGeneric_2>>;
5089
+
5090
+ /**
5091
+ * The options for this policy.
5092
+ */
5093
+ export declare type SemanticCacheInboundPolicyOptions = {
5094
+ [k: string]: unknown;
5095
+ } & {
5096
+ /**
5097
+ * The minimum similarity threshold for semantic cache matches. Values closer to 1 require higher similarity, while lower values allow more flexible matching. Default is 0.8.
5098
+ */
5099
+ similarityTolerance?: number;
5100
+ /**
5101
+ * The timeout of the cache in seconds. Defaults to 1 hour.
5102
+ */
5103
+ expirationSecondsTtl?: number;
5104
+ /**
5105
+ * Determines how the cache key is generated. Use 'function' for custom logic or 'propertyPath' to extract from JSON body.
5106
+ */
5107
+ cacheBy: "function" | "propertyPath";
5108
+ /**
5109
+ * The function that returns dynamic cache key data. Used only with `cacheBy=function`.
5110
+ */
5111
+ cacheByFunction?: {
5112
+ /**
5113
+ * Specifies the export to load your custom cache key function, e.g. `default`, `cacheKeyIdentifier`.
5114
+ */
5115
+ export: string;
5116
+ /**
5117
+ * Specifies the module to load your custom cache key function, in the format `$import(./modules/my-module)`.
5118
+ */
5119
+ module: string;
5120
+ };
5121
+ /**
5122
+ * The path to the property in the request body (JSON) to use as cache key. For example '.userId' would read the 'userId' property from the request body. Only works with cacheBy=propertyPath.
5123
+ */
5124
+ cacheByPropertyPath?: string;
5125
+ /**
5126
+ * Response status codes to be cached.
5127
+ */
5128
+ statusCodes?: number[];
5129
+ };
5130
+
5165
5131
  /* Excluded from this release type: serialize */
5166
5132
 
5167
5133
  /**
@@ -6037,6 +6003,41 @@ declare interface WaitUntilFunc {
6037
6003
  (promise: Promise<any>): void;
6038
6004
  }
6039
6005
 
6006
+ /**
6007
+ * Authenticate bots using web-bot-auth HTTP Message Signatures.
6008
+ *
6009
+ * @title Web Bot Auth
6010
+ * @public
6011
+ * @param request - The ZuploRequest
6012
+ * @param context - The ZuploContext
6013
+ * @param options - The policy options set in policies.json
6014
+ * @param policyName - The name of the policy as set in policies.json
6015
+ * @returns A Request or a Response
6016
+ */
6017
+ export declare const WebBotAuthInboundPolicy: InboundPolicyHandler<WebBotAuthInboundPolicyOptions>;
6018
+
6019
+ /**
6020
+ * Options for the Web Bot Auth Inbound Policy.
6021
+ */
6022
+ export declare interface WebBotAuthInboundPolicyOptions {
6023
+ /**
6024
+ * List of bot identifiers that are allowed to access the API.
6025
+ */
6026
+ allowedBots: string[];
6027
+ /**
6028
+ * Whether to block bots that aren't in the allowed list.
6029
+ */
6030
+ blockUnknownBots: boolean;
6031
+ /**
6032
+ * Allow requests without bot signatures to proceed. This is useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.
6033
+ */
6034
+ allowUnauthenticatedRequests?: boolean;
6035
+ /**
6036
+ * Optional URL to a directory of known bots (for verification).
6037
+ */
6038
+ directoryUrl?: string;
6039
+ }
6040
+
6040
6041
  /**
6041
6042
  * Handle websocket requests to a different url
6042
6043
  * @param request - The ZuploRequest
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.51.59",
4
+ "version": "6.51.61",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {