From ab55613f529f7767e8572c6a8d4438ec3074159f Mon Sep 17 00:00:00 2001 From: William Bain Date: Fri, 17 Apr 2020 17:21:42 -0400 Subject: [PATCH] [akamai-edgeworkers] Update README link (#43995) * Automated whitespace fixes * Update link to EdgeWorker API --- types/akamai-edgeworkers/README.md | 28 ++++++++++++++-------------- types/akamai-edgeworkers/index.d.ts | 8 ++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/types/akamai-edgeworkers/README.md b/types/akamai-edgeworkers/README.md index aad0b19c1f..49ab25301c 100644 --- a/types/akamai-edgeworkers/README.md +++ b/types/akamai-edgeworkers/README.md @@ -1,13 +1,13 @@ -Bindings for the Akamai [EdgeWorker API]. This allows you to write -your EdgeWorkers in TypeScript. +Bindings for the Akamai [EdgeWorker API]. This allows you to write +your EdgeWorkers in TypeScript. -Types are available for the `Request` and `Response` objects, as well as the -built-in modules. +Types are available for the `Request` and `Response` objects, as well as the +built-in modules. # User Guide -EdgeWorkers are written in ECMAScript6, so you need to set your -`tsconfig.json` to use `es6` as the compilation target and module +EdgeWorkers are written in ECMAScript6, so you need to set your +`tsconfig.json` to use `es6` as the compilation target and module code generator: ```json5 @@ -15,14 +15,14 @@ code generator: "compilerOptions": { "module": "es6", "target": "es6", -//... + //... } } -``` +``` ## Using the `Request` and `Response` Objects -The predefined EdgeWorker callbacks take Request and Response objects as +The predefined EdgeWorker callbacks take Request and Response objects as arguments. After you have installed this package, you can create a `main.ts` with the following stubs: @@ -35,12 +35,12 @@ export function onOriginResponse(request: EW.EgressOriginRequest, response: EW.E export function onClientResponse(request: EW.EgressClientRequest, response: EW.EgressClientResponse) {} ``` -The triple-slashed first line references this package and pulls `EW` into your -namespace. +The triple-slashed first line references this package and pulls `EW` into your +namespace. ## Using Built-In Modules -Bindings are available for the built-in `cookies` and `url-search-params` +Bindings are available for the built-in `cookies` and `url-search-params` modules. Once you've added the triple-slash reference to `akamai-edgeworkers` you can import them normally: @@ -51,8 +51,8 @@ import { Cookies } from 'cookies'; function onClientRequest(request: EW.MutableRequest & EW.HasRespondWith) { const cookie = new Cookies(request.getHeader('cookies') || undefined); -//... + //... } ``` -[EdgeWorker API]: https://developer.akamai.com/api/web_performance/edgeworkers/v1.html +[EdgeWorker API]: https://learn.akamai.com/en-us/webhelp/edgeworkers/edgeworkers-user-guide/GUID-14077BCA-0D9F-422C-8273-2F3E37339D5B.html diff --git a/types/akamai-edgeworkers/index.d.ts b/types/akamai-edgeworkers/index.d.ts index 479418899c..d34804775b 100644 --- a/types/akamai-edgeworkers/index.d.ts +++ b/types/akamai-edgeworkers/index.d.ts @@ -170,7 +170,7 @@ declare namespace EW { readonly query: string; /** - * The Relative URL of the incoming request. This includes the path as well + * The relative URL of the incoming request. This includes the path as well * as the query string. */ readonly url: string; @@ -183,19 +183,19 @@ declare namespace EW { readonly userLocation: UserLocation | undefined; /** - * Object containing properties specifying the device characteristics. This + * Object containing properties specifying the device characteristics. The * value of this property will be null if the contract associated with the * request does not have entitlements for EDC. */ readonly device: Device | undefined; /** - * The cpcode used for reporting. + * The CP code used for reporting. */ readonly cpCode: number; } - // Legacy interfaces for backwards compatability + // Legacy interfaces for backwards compatibility interface MutableRequest extends MutatesHeaders, ReadsHeaders, ReadsVariables, Request { } interface ImmutableRequest extends ReadsHeaders, ReadsVariables, Request {