这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ function handler2(event: AWSCloudFrontFunction.Event): AWSCloudFrontFunction.Req

import cf from "cloudfront";

// $ExpectType KVStore
cf.kvs();

// $ExpectType KVStore
const kvsHandle = cf.kvs("example-kvs-id");

async function handler3(
Expand Down
18 changes: 15 additions & 3 deletions types/aws-cloudfront-function/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,21 @@ declare namespace AWSCloudFrontFunction {

declare module "cloudfront" {
/**
* Retrieves a reference to a CloudFront Key-Value Store (KVS) by its ID.
* @param kvsId The identifier of the KVS to use.
* @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-custom-methods.html
* Retrieves the current Function's associated KeyValueStore. See the
* {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-custom-methods.html | CloudFront Developer Guide}.
* @returns An instance of the associated KeyValueStore.
* @throws If no KeyValueStore is associated with the Function.
*/
function kvs(): KVStore;

/**
* Retrieves a reference to the current Function's associated KeyValueStore by its ID. Though not documented
* in the {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-custom-methods.html | CloudFront Developer Guide},
* this overload has been proven to work in practice and is shown in the
* {@link https://aws.amazon.com/blogs/aws/introducing-amazon-cloudfront-keyvaluestore-a-low-latency-datastore-for-cloudfront-functions/ | AWS News Blog announcement}.
* @param kvsId The identifier of an associated KeyValueStore.
* @returns An instance of the KeyValueStore.
* @throws If KeyValueStore does not exist or is not associated with the Function.
*/
function kvs(kvsId: string): KVStore;

Expand Down