Skip to content

Commit 4a452a5

Browse files
Merge pull request #1 from contentstack/fix/cs-44713-add-ts-updates-from-js
feat: Initial commit to typescript sdk
2 parents 19ffc66 + 92f0f65 commit 4a452a5

File tree

103 files changed

+20201
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+20201
-1
lines changed

.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

.github/workflows/check-branch.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Check Branch'
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
check_branch:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Comment PR
11+
if: github.base_ref == 'master' && github.head_ref != 'next'
12+
uses: thollander/actions-comment-pull-request@v2
13+
with:
14+
message: |
15+
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
16+
- name: Check branch
17+
if: github.base_ref == 'master' && github.head_ref != 'next'
18+
run: |
19+
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
20+
exit 1

.github/workflows/jira.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Create JIRA ISSUE
2+
on:
3+
pull_request:
4+
types: [opened]
5+
jobs:
6+
security-jira:
7+
if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'snyk-bot' || contains(github.event.pull_request.head.ref, 'snyk-fix-') || contains(github.event.pull_request.head.ref, 'snyk-upgrade-')}}
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Login into JIRA
12+
uses: atlassian/gajira-login@master
13+
env:
14+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
15+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
16+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
17+
- name: Create a JIRA Issue
18+
id: create
19+
uses: atlassian/gajira-create@master
20+
with:
21+
project: ${{ secrets.JIRA_PROJECT }}
22+
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
23+
summary: |
24+
${{ github.event.pull_request.title }}
25+
description: |
26+
PR: ${{ github.event.pull_request.html_url }}
27+
28+
fields: "${{ secrets.JIRA_FIELDS }}"
29+
- name: Transition issue
30+
uses: atlassian/gajira-transition@v3
31+
with:
32+
issue: ${{ steps.create.outputs.issue }}
33+
transition: ${{ secrets.JIRA_TRANSITION }}

.github/workflows/npm-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Publish package to NPM repository
5+
on:
6+
release:
7+
types: [created]
8+
9+
jobs:
10+
publish-npm:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: '18.x'
17+
registry-url: 'https://registry.npmjs.org'
18+
- run: npm ci
19+
- run: npm publish --tag latest --access public
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22+
publish-git:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: '18.x'
29+
registry-url: 'https://npm.pkg.github.com'
30+
scope: '@contentstack'
31+
- run: npm ci
32+
- run: npm publish --tag latest
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/sast-scan.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: SAST Scan
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
security-sast:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Semgrep Scan
11+
run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v "${PWD}:/src" returntocorp/semgrep semgrep scan --config auto

.github/workflows/sca-scan.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Source Composition Analysis Scan
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
security-sca:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@master
10+
- name: Run Snyk to check for vulnerabilities
11+
uses: snyk/actions/node@master
12+
env:
13+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
14+
with:
15+
args: --all-projects --fail-on=all

.github/workflows/secrets-scan.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Secrets Scan
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
security-secrets:
7+
runs-on: ubuntu-latest
8+
if: ${{ github.base_ref == 'main' || github.base_ref == 'master' }}
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Install Expect, jq and Python
15+
run: sudo apt-get update --fix-missing && sudo apt-get install -y expect jq python3 python3-pip wkhtmltopdf
16+
17+
- name: Install Python packages
18+
run: pip install pandas json2html tabulate
19+
20+
- name: Install Talisman
21+
run: |
22+
curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/v1.32.0/install.sh > install.bash
23+
chmod +x install.bash
24+
./install.bash
25+
26+
- name: Run Talisman
27+
id: run_talisman
28+
run: /usr/local/bin/talisman --scan
29+
continue-on-error: true
30+
31+
- name: Convert JSON to HTML
32+
run: |
33+
python3 -c "
34+
import json
35+
import os
36+
from json2html import *
37+
with open('talisman_report/talisman_reports/data/report.json') as f:
38+
data = json.load(f)
39+
html = json2html.convert(json = data)
40+
os.makedirs('talisman_html_report', exist_ok=True)
41+
with open('talisman_html_report/report.html', 'w') as f:
42+
f.write(html)
43+
" && wkhtmltopdf talisman_html_report/report.html talisman_report.pdf
44+
45+
- name: Upload Report
46+
id: upload_report
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: talisman-report-pdf
50+
path: talisman_report.pdf
51+
52+
- name: Check the status of talisman scan
53+
run: |
54+
# if [[ ${{ steps.run_talisman.outcome }} == "success" ]]; then exit 0; else echo "Download the Talisman scan report from Artifact: ${{ steps.upload_report.outputs.artifact-url }}" && exit 1; fi
55+
echo "Download the Talisman scan report from Artifact: ${{ steps.upload_report.outputs.artifact-url }}";

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.DS_Store
2+
**/node_modules/*
3+
.idea/*
4+
reports/*
5+
apidocs-templates/*
6+
test/smtpconfig.js/*
7+
test/config.js/*
8+
test/sync_config.js/*
9+
test/report.json/*
10+
tap-html.html
11+
*html-report
12+
coverage
13+
.env
14+
.dccache
15+
dist/*

.npmignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
docs-config.json
2+
.idea/
3+
.git/
4+
test.js
5+
test/
6+
reports/
7+
contentstack-templates/
8+
js-sdk-reference/
9+
examples/
10+
mocktest.json
11+
webpack
12+
typescript-html-report
13+
webpack
14+
jest.config.js
15+
coverage
16+
CODEOWNERS
17+
src
18+
.env
19+
*.tgz
20+
.talismanrc
21+
tap-html.html
22+
.github

.talismanrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
fileignoreconfig:
2+
- filename: test/unit/image-transform.spec.ts
3+
checksum: 7beabdd07bd35d620668fcd97e1a303b9cbc40170bf3008a376d75ce0895de2a
4+
- filename: test/utils/mocks.ts
5+
checksum: a1cb4b1890a584f1facd30f2a0974c97a66f91417022be79d00516338e244227
6+
- filename: package-lock.json
7+
checksum: 6c9beae17fc270641d855026896e49a1458a6b3a026df30265c51420d364d18a
8+
- filename: test/typescript/taxonomy.test.ts
9+
checksum: e4bdf633e147fd60d929d379f20c814eed5f68b11421d7b53ec8826e9142de37
10+
- filename: src/core/modules/taxonomy.js
11+
checksum: 84589be9805c1be5fd6c56021c41d18365126cf82059ad2cbef1d418c70d08e0
12+
- filename: src/core/lib/utils.js
13+
checksum: 6018f9f13fa32b724d09b9cdf5f78cf030a6332ca549651e1e35fe91e8c7e0e7
14+
- filename: src/core/modules/query.js
15+
checksum: c88b336f9a271397ffedcf8c5085941ceb0bd1cd7e25ed9ada3acd8ce4f8970c
16+
- filename: test/typescript/stack.test.ts
17+
checksum: bbb3c425f8e1a63d4793f69ee9eaba9559294ff53f163a28f70ae54b1792276a
18+
version: ""

0 commit comments

Comments
 (0)