UNPKG

5.57 kBTypeScriptView Raw
1/*
2 * Copyright 2018 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12
13/**
14 * The Request Object used for Invoking OpenWhisk
15 */
16export type RawRequest = {
17 /**
18 * The headers of the request made to OpenWhisk (or Simulator)
19 */
20 headers?: {
21 /**
22 * OpenWhisk Activation ID
23 */
24 "x-openwhisk-activation-id"?: string;
25 /**
26 * Request ID generated by OpenWhisk
27 */
28 "x-request-id"?: string;
29 /**
30 * Request ID generated by the CDN
31 */
32 "x-cdn-request-id"?: string;
33 /**
34 * Name of the Backend handling the request.
35 */
36 "x-backend-name"?: string;
37 [k: string]: string;
38 };
39 /**
40 * The HTTP method of the request made to OpenWhisk (or Simulator). Note: OpenWhisk converts all methods to lowercase.
41 */
42 method?: string;
43 /**
44 * Parameters used to invoke the OpenWhisk action. These are either URL parameters added when invoking the action from the CDN or default parameters set during creation of the action.
45 */
46 params?: {
47 /**
48 * Owner of the GitHub repository. This is the name of a user or organization.
49 */
50 owner?: string;
51 /**
52 * Repository where content originates
53 */
54 repo?: string;
55 /**
56 * Name of the branch or tag or the SHA of the commit
57 */
58 ref?: string;
59 /**
60 * Name of the branch or tag. defaults back to the value of 'ref' if missing.
61 */
62 branch?: string;
63 /**
64 * Path to the requested (Markdown) file
65 */
66 path?: string;
67 /**
68 * The request root path of the current strain.
69 */
70 rootPath?: string;
71 /**
72 * The resolved strain (variant)
73 */
74 strain?: string;
75 /**
76 * Deprecated: The original OpenWhisk request headers
77 */
78 __ow_headers?: {
79 [k: string]: any;
80 };
81 /**
82 * All other parameters are interpreted as string.
83 */
84 [k: string]: string;
85 };
86};
87
88/**
89 * Tracks the OpenWhisk action invocation
90 */
91export interface Action {
92 request?: RawRequest;
93 /**
94 * A helix-log [SimpleInterface](https://github.com/adobe/helix-log) logger instance.
95 */
96 logger?: {
97 [k: string]: any;
98 };
99 /**
100 * Internal information related to debugging.
101 */
102 debug?: {
103 [k: string]: any;
104 };
105 secrets?: Secrets;
106 /**
107 * A VDOMTransformer instance
108 */
109 transformer?: {
110 [k: string]: any;
111 };
112 /**
113 * A Downloader instance
114 */
115 downloader?: {
116 [k: string]: any;
117 };
118 /**
119 * A [markup configuration](https://github.com/adobe/helix-shared/blob/master/docs/markup.md)
120 */
121 markupconfig?: {
122 [k: string]: any;
123 };
124}
125/**
126 * Secrets passed into the pipeline such as API Keys or configuration settings.
127 */
128export interface Secrets {
129 /**
130 * The Base URL for retrieving raw text files from GitHub
131 */
132 REPO_RAW_ROOT?: string;
133 /**
134 * The base URL for all GitHub API operations
135 */
136 REPO_API_ROOT?: string;
137 /**
138 * Comma-separated list of allowed hostnames for embeds. Supports `*.example.com` as a subdomain wildcard. Use `*` to allow all embeds (potentially insecure and conflicting with `DATA_EMBED_WHITELIST`)
139 */
140 EMBED_WHITELIST?: string;
141 /**
142 * Comma-separated list of allowed hostnames for data embeds. Supports `*.example.com` as a subdomain wildcard. Use `*` to allow all embeds (potentially insecure and conflicting with `EMBED_WHITELIST`)
143 */
144 DATA_EMBED_WHITELIST?: string;
145 /**
146 * URL of an Embed Service that takes the appended URL and returns an embeddable HTML representation.
147 */
148 EMBED_SERVICE?: string;
149 /**
150 * URL of a DataEmbed Service that takes the appended URL and returns an iterable JSON representation.
151 */
152 DATA_EMBED_SERVICE?: string;
153 /**
154 * Selector to be used when resolving internal embeds.
155 */
156 EMBED_SELECTOR?: string;
157 /**
158 * Minimum physical width of responsive images to generate
159 */
160 IMAGES_MIN_SIZE?: number;
161 /**
162 * Timeout for outgoing HTTP requests in milliseconds
163 */
164 HTTP_TIMEOUT?: number;
165 /**
166 * Timeout for outgoing HTTP requests to external services in milliseconds
167 */
168 HTTP_TIMEOUT_EXTERNAL?: number;
169 TEST_BOOLEAN?: boolean;
170 /**
171 * Print XML with line breaks and indentation
172 */
173 XML_PRETTY?: boolean;
174 /**
175 * Sanitize the HTML output to guard against XSS attacks.
176 *
177 * **Note:** this flag applies a pretty aggressive DOM filtering that will strip out a lot of HTML that your authors might find useful. The setting is meant for processing truly untrusted inputs, such as comments in a social media site.
178 */
179 SANITIZE_DOM?: boolean;
180 /**
181 * API endpoint or action name to the service that resolves github refs to commit SHAs.
182 */
183 RESOLVE_GITREF_SERVICE?: string;
184 /**
185 * GitHub access token to use while fetching markdown. See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line.
186 */
187 GITHUB_TOKEN?: string;
188 /**
189 * This interface was referenced by `Secrets`'s JSON-Schema definition
190 * via the `patternProperty` "[A-Z0-9_]+".
191 */
192 [k: string]: boolean | number | string;
193}