Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Initial commit to typescript sdk #1

Merged
merged 8 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{

"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
20 changes: 20 additions & 0 deletions .github/workflows/check-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Check Branch'

on:
pull_request:

jobs:
check_branch:
runs-on: ubuntu-latest
steps:
- name: Comment PR
if: github.base_ref == 'master' && github.head_ref != 'next'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
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.
- name: Check branch
if: github.base_ref == 'master' && github.head_ref != 'next'
run: |
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."
exit 1
33 changes: 33 additions & 0 deletions .github/workflows/jira.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Create JIRA ISSUE
on:
pull_request:
types: [opened]
jobs:
security-jira:
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-')}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login into JIRA
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Create a JIRA Issue
id: create
uses: atlassian/gajira-create@master
with:
project: ${{ secrets.JIRA_PROJECT }}
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
summary: |
${{ github.event.pull_request.title }}
description: |
PR: ${{ github.event.pull_request.html_url }}

fields: "${{ secrets.JIRA_FIELDS }}"
- name: Transition issue
uses: atlassian/gajira-transition@v3
with:
issue: ${{ steps.create.outputs.issue }}
transition: ${{ secrets.JIRA_TRANSITION }}
34 changes: 34 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish package to NPM repository
on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish --tag latest --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-git:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@contentstack'
- run: npm ci
- run: npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/sast-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: SAST Scan
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-sast:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Semgrep Scan
run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v "${PWD}:/src" returntocorp/semgrep semgrep scan --config auto
15 changes: 15 additions & 0 deletions .github/workflows/sca-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Source Composition Analysis Scan
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-sca:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --all-projects --fail-on=all
55 changes: 55 additions & 0 deletions .github/workflows/secrets-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Secrets Scan
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-secrets:
runs-on: ubuntu-latest
if: ${{ github.base_ref == 'main' || github.base_ref == 'master' }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Expect, jq and Python
run: sudo apt-get update --fix-missing && sudo apt-get install -y expect jq python3 python3-pip wkhtmltopdf

- name: Install Python packages
run: pip install pandas json2html tabulate

- name: Install Talisman
run: |
curl --silent https://raw.githubusercontent.com/thoughtworks/talisman/v1.32.0/install.sh > install.bash
chmod +x install.bash
./install.bash

- name: Run Talisman
id: run_talisman
run: /usr/local/bin/talisman --scan
continue-on-error: true

- name: Convert JSON to HTML
run: |
python3 -c "
import json
import os
from json2html import *
with open('talisman_report/talisman_reports/data/report.json') as f:
data = json.load(f)
html = json2html.convert(json = data)
os.makedirs('talisman_html_report', exist_ok=True)
with open('talisman_html_report/report.html', 'w') as f:
f.write(html)
" && wkhtmltopdf talisman_html_report/report.html talisman_report.pdf

- name: Upload Report
id: upload_report
uses: actions/upload-artifact@v4
with:
name: talisman-report-pdf
path: talisman_report.pdf

- name: Check the status of talisman scan
run: |
# 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
echo "Download the Talisman scan report from Artifact: ${{ steps.upload_report.outputs.artifact-url }}";
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.DS_Store
**/node_modules/*
.idea/*
reports/*
apidocs-templates/*
test/smtpconfig.js/*
test/config.js/*
test/sync_config.js/*
test/report.json/*
tap-html.html
*html-report
coverage
.env
.dccache
dist/*
22 changes: 22 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
docs-config.json
.idea/
.git/
test.js
test/
reports/
contentstack-templates/
js-sdk-reference/
examples/
mocktest.json
webpack
typescript-html-report
webpack
jest.config.js
coverage
CODEOWNERS
src
.env
*.tgz
.talismanrc
tap-html.html
.github
18 changes: 18 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
fileignoreconfig:
- filename: test/unit/image-transform.spec.ts
checksum: 7beabdd07bd35d620668fcd97e1a303b9cbc40170bf3008a376d75ce0895de2a
- filename: test/utils/mocks.ts
checksum: a1cb4b1890a584f1facd30f2a0974c97a66f91417022be79d00516338e244227
- filename: package-lock.json
checksum: 6c9beae17fc270641d855026896e49a1458a6b3a026df30265c51420d364d18a
- filename: test/typescript/taxonomy.test.ts
checksum: e4bdf633e147fd60d929d379f20c814eed5f68b11421d7b53ec8826e9142de37
- filename: src/core/modules/taxonomy.js
checksum: 84589be9805c1be5fd6c56021c41d18365126cf82059ad2cbef1d418c70d08e0
- filename: src/core/lib/utils.js
checksum: 6018f9f13fa32b724d09b9cdf5f78cf030a6332ca549651e1e35fe91e8c7e0e7
- filename: src/core/modules/query.js
checksum: c88b336f9a271397ffedcf8c5085941ceb0bd1cd7e25ed9ada3acd8ce4f8970c
- filename: test/typescript/stack.test.ts
checksum: bbb3c425f8e1a63d4793f69ee9eaba9559294ff53f163a28f70ae54b1792276a
version: ""
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Change log


### Version: 4.0.0
#### Date: April-23-2024
Official release of Typescript SDK

### Version: 4.0.0-beta.6
#### Date: April-09-2024
##### New Features:
- Query operators implementation-3

### Version: 4.0.0-beta.5
#### Date: March-26-2024
##### New Features:
- Query operators implementation-2

### Version: 4.0.0-beta.4
#### Date: March-14-2024
##### New Features:
- Query operators implementation

### Version: 4.0.0-beta.3
#### Date: February-13-2024
- Live preview support 1.0 and 2.0

### Version: v4.0.0-beta.2
#### Date: February-02-2024
- Includes adding of prepare script to build package

### Version: 4.0.0-beta
#### Date: January-15-2024
- Beta release of Typescript SDK
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @contentstack/security-admin
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)


Copyright (c) 2016-2024 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading
Loading