Skip to content

Commit 09fc486

Browse files
authored
Merge pull request #85 from Contentstack-Solutions/feat/early-access-header-CS-42774
Feat/early access header cs 42774
2 parents 3967087 + 5395265 commit 09fc486

3 files changed

Lines changed: 54 additions & 34 deletions

File tree

package-lock.json

Lines changed: 42 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "contentstack-cli-tsgen",
33
"description": "Generate TypeScript typings from a Stack.",
4-
"version": "2.2.2",
4+
"version": "2.3.0",
55
"author": "Michael Davis",
66
"bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues",
77
"dependencies": {
8-
"@contentstack/cli-command": "^1.2.13",
9-
"@contentstack/cli-utilities": "^1.5.2",
8+
"@contentstack/cli-command": "^1.2.17",
9+
"@contentstack/cli-utilities": "^1.5.10",
1010
"lodash": "^4.17.20",
1111
"prettier": "^2.0.5",
1212
"tslib": "^1.13.0"

src/lib/stack/client.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as http from 'https'
22
import * as async from 'async'
3-
import {ContentTypeCollection} from 'contentstack'
3+
import { ContentTypeCollection } from 'contentstack'
4+
import { configHandler } from "@contentstack/cli-utilities"
45

56
type RegionUrlMap = {
67
[prop: string]: string;
@@ -37,6 +38,7 @@ export async function stackConnect(client: any, config: StackConnectionConfig, c
3738
environment: string,
3839
region: string,
3940
branch?: string
41+
early_access?: string[]
4042
} = {
4143
api_key: config.apiKey,
4244
delivery_token: config.token,
@@ -46,6 +48,12 @@ export async function stackConnect(client: any, config: StackConnectionConfig, c
4648
if (config.branch) {
4749
clientParams.branch = config.branch
4850
}
51+
52+
const earlyAccessHeaders = configHandler.get(`earlyAccessHeaders`);
53+
if (earlyAccessHeaders && Object.keys(earlyAccessHeaders).length > 0) {
54+
clientParams.early_access = Object.values(earlyAccessHeaders);
55+
}
56+
4957
// eslint-disable-next-line new-cap
5058
const stack = client(clientParams)
5159
// check and update host if doesn't exists in REGION_URL_MAPPING

0 commit comments

Comments
 (0)