Skip to content

Commit 7ec1c24

Browse files
committed
Added a second sdk version for Akamai that supports customers using their own custom feature store and updated semantic versioning for alpha release
1 parent 3e3f87d commit 7ec1c24

32 files changed

+727
-106
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"packages/sdk/cloudflare/example",
1111
"packages/sdk/vercel",
1212
"packages/sdk/vercel/example-vercel",
13+
"packages/sdk/akamai",
14+
"packages/sdk/akamai/example",
1315
"packages/sdk/akamai-edgekv",
1416
"packages/sdk/akamai-edgekv/example"
1517
],

packages/sdk/akamai-edgekv/example/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export async function onClientRequest(request: EW.IngressClientRequest) {
1616
try {
1717
const showAds = await evaluateFlagWithEdgeKV('enable-ads', createLDContext(request), false);
1818

19-
let response = createResponse('Ads are hidden');
19+
let response = createResponse('Ads are hidden with flag');
2020
if (showAds) {
21-
response = createResponse('Showing random advertisements');
21+
response = createResponse('Showing random advertisements with flag');
2222
}
2323

2424
request.respondWith(200, {}, response);

packages/sdk/akamai-edgekv/example/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "akamai-playground",
3-
"version": "1.0.2",
2+
"name": "akamai-edgekv-playground",
3+
"version": "1.0.4",
44
"description": "",
55
"main": "main.js",
66
"config": {
@@ -31,6 +31,6 @@
3131
"typescript": "^5.0.4"
3232
},
3333
"dependencies": {
34-
"@launchdarkly/akamai-server-edgekv-sdk": "^0.1.0-alpha"
34+
"@launchdarkly/akamai-server-edgekv-sdk": "^0.1.0"
3535
}
3636
}

packages/sdk/akamai-edgekv/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@launchdarkly/akamai-server-edgekv-sdk",
3-
"version": "0.1.0-alpha",
3+
"version": "0.1.0",
44
"description": "Akamai LaunchDarkly EdgeWorker SDK for EdgeKV feature store",
5-
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/akamai",
5+
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/akamai-edgekv",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/launchdarkly/js-core.git"

packages/sdk/akamai-edgekv/src/edgekv/edgeKVProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EdgeProvider } from './edgeFeatureStore';
1+
import { EdgeProvider } from '@launchdarkly/akamai-edgeworker-sdk-common';
22
import { EdgeKV } from './edgekv';
33

44
type EdgeKVProviderParams = {

packages/sdk/akamai-edgekv/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import {
1616
LDMultiKindContext,
1717
LDSingleKindContext,
1818
LDOptions,
19+
EdgeFeatureStore,
1920
} from '@launchdarkly/akamai-edgeworker-sdk-common';
2021
import { BasicLogger } from '@launchdarkly/js-server-sdk-common';
21-
import { EdgeFeatureStore } from './edgekv/edgeFeatureStore';
2222
import EdgeKVProvider from './edgekv/edgeKVProvider';
2323

2424
type AkamaiLDClientParams = {
@@ -51,6 +51,6 @@ export const init = ({
5151
edgeFeatureStore: featureStore,
5252
platformName: 'Akamai EdgeWorker',
5353
sdkName: '@launchdarkly/akamai-server-edgekv-sdk',
54-
sdkVersion: '0.1.0-alpha', // {x-release-please-version}
54+
sdkVersion: '0.1.0', // {x-release-please-version}
5555
});
5656
};

packages/sdk/akamai/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changelog
2+
3+
All notable changes to the LaunchDarkly SDK for Akamai Workers will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org).

packages/sdk/akamai/LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2023 Catamorphic, Co.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

packages/sdk/akamai/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# LaunchDarkly Akamai SDK for EdgeKV
2+
3+
[![NPM][sdk-akamai-npm-badge]][sdk-akamai-npm-link]
4+
[![Actions Status][sdk-akamai-ci-badge]][sdk-akamai-ci]
5+
[![Documentation][sdk-akamai-ghp-badge]][sdk-akamai-ghp-link]
6+
[![NPM][sdk-akamai-dm-badge]][sdk-akamai-npm-link]
7+
[![NPM][sdk-akamai-dt-badge]][sdk-akamai-npm-link]
8+
9+
The LaunchDarkly Akamai SDK is designed primarily for use in Akamai Edgeworkers. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.
10+
11+
For more information, see the [complete reference guide for this SDK](https://docs.launchdarkly.com/sdk/server-side/akamai).
12+
13+
## Install
14+
15+
```shell
16+
npm i @launchdarkly/akamai-server-edgekv-sdk
17+
```
18+
19+
## Quickstart
20+
21+
22+
See the full [example app](https://github.com/launchdarkly/js-core/tree/main/packages/sdk/akamai-edgekv/example).
23+
24+
## Developing this SDK
25+
26+
```shell
27+
# at js-core repo root
28+
yarn && yarn build && cd packages/sdk/akamai-edgekv
29+
30+
# run tests
31+
yarn test
32+
```
33+
34+
## About LaunchDarkly
35+
36+
- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
37+
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
38+
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
39+
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
40+
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
41+
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
42+
- Explore LaunchDarkly
43+
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
44+
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
45+
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
46+
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
### Akamai Edge POC
2+
3+
This is an internal POC to see how compatible our js-core package is with Akamai's EW runtime.
4+
5+
## Getting started
6+
7+
1. Run the following command to install dependencies
8+
9+
```shell
10+
npm install
11+
```
12+
13+
2. Install the [Akamai CLI](https://github.com/akamai/cli)
14+
15+
```shell
16+
brew install akamai
17+
```
18+
19+
3. Follow [these instructions](https://techdocs.akamai.com/developer/docs/set-up-authentication-credentials) to add your credentials to the CLI.
20+
21+
4. Install the edgeworkers CLI package
22+
23+
```shell
24+
akamai install edgeworkers
25+
```
26+
27+
5. Install the sandbox CLI package
28+
29+
```shell
30+
akamai install sandbox
31+
```
32+
33+
6. Create a local sandbox
34+
35+
```shell
36+
akamai sandbox create --property hello-akamai.dev.launchdarkly.com:15 --name <YOUR_NAME>CODING_SANDBOX
37+
```
38+
39+
7. Transpile the code, create the bundle, and update the Sandbox client
40+
41+
```shell
42+
npm run dev
43+
```
44+
45+
8. Run the following command to test the EdgeWorker
46+
47+
```shell
48+
curl -v -H 'Host: hello-akamai.dev.launchdarkly.com' -H 'Pragma: akamai-x-ew-debug' http://127.0.0.1:9550/hello
49+
```

0 commit comments

Comments
 (0)