From c41f197eee4087e23de528bf747d831238e0eeb8 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Tue, 11 Jul 2023 18:26:09 -0300 Subject: [PATCH 1/3] update README comment --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f940c6..a2e4fb2 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ The project overall architecture is ilustrated in the following diagram: wrapper: EdgeConfigWrapper({ // The Edge Config item where Split stores feature flag definitions, specified in the Split integration step edgeConfigItemKey: '', - // The Edge Config client. In this case, we are passing the default client - // that reads from the Edge Config stored in process.env.EDGE_CONFIG + // The Edge Config client. In this case, we are creating a client that uses the same configuration + // than the default client, which reads from the Edge Config stored in process.env.EDGE_CONFIG edgeConfig: createClient(process.env.EDGE_CONFIG) }) }), From 4d46eeb0303adb712ba487d75f5a233e72f1a3b3 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 12 Jul 2023 10:49:32 -0300 Subject: [PATCH 2/3] update example code snippet --- README.md | 2 +- example/pages/api/get-treatment.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a0f8fc8..26e2537 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Keeping feature flag definitions within an Edge Config instance enables the Spli The package includes the storage wrapper module (`src/EdgeConfigWrapper.ts`), as well as an `example` folder to quickly get started with the integration. -The project overall architecture is ilustrated in the following diagram: +The project overall architecture is illustrated in the following diagram:

Overview diff --git a/example/pages/api/get-treatment.js b/example/pages/api/get-treatment.js index f98f722..3c589f2 100644 --- a/example/pages/api/get-treatment.js +++ b/example/pages/api/get-treatment.js @@ -8,6 +8,10 @@ import { createClient } from '@vercel/edge-config'; // @REPLACE with the feature flag name you want to evaluate const FEATURE_FLAG_NAME = 'test_split'; +// Creates a client which knows how to read from Edge Config +// This client is defined outside of the handler so that it can be reused across requests +const edgeConfigClient = createClient(process.env.EDGE_CONFIG); + // Run API route as an Edge function rather than a Serverless one, because the SDK uses Fetch API to flush data, which is available in Edge runtime but not in Serverless. export const config = { runtime: "edge" }; @@ -27,9 +31,8 @@ export default async function handler(req, event) { wrapper: EdgeConfigWrapper({ // The Edge Config item key where Split stores feature flag definitions, specified in the Split integration step edgeConfigItemKey: process.env.SPLIT_EDGE_CONFIG_ITEM_KEY, - // The Edge Config client. In this case, we are passing the default client - // that reads from the Edge Config stored in process.env.EDGE_CONFIG - edgeConfig: createClient(process.env.EDGE_CONFIG) + // The Edge Config client + edgeConfig: edgeConfigClient, }) }), // Disable or keep only ERROR log level in production, to minimize performance impact From 3fba32d35aa50aa5dc04e9faf029e7e3a85b3549 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 12 Jul 2023 10:52:07 -0300 Subject: [PATCH 3/3] prepare for release --- CHANGES.txt | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 21a4bc8..da653c9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +1.0.1 (July 12, 2023) + - Updated README file. + 1.0.0 (June 29, 2023) - BREAKING CHANGE: the configuration parameter `edgeConfigKey` was renamed to `edgeConfigItemKey`. - Updated wrapper to support parsed feature flag definitions. diff --git a/package-lock.json b/package-lock.json index 5edd359..69df5ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@splitsoftware/vercel-integration-utils", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/vercel-integration-utils", - "version": "1.0.0", + "version": "1.0.1", "license": "Apache-2.0", "devDependencies": { "@types/jest": "^28.1.8", diff --git a/package.json b/package.json index 9b1c812..3e30f72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/vercel-integration-utils", - "version": "1.0.0", + "version": "1.0.1", "description": "Split SDK wrapper to integrate with Vercel Edge Config", "main": "dist/cjs/index.js", "module": "dist/esm/index.js",