Format using prettier and add check-format step to GH actions (#1759)

* prettier format

* added check-format step to github actions
This commit is contained in:
Deepak Prabhakara 2023-10-11 09:18:03 +01:00 committed by GitHub
parent 94c9d8399f
commit 1177ce1011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 136 additions and 258 deletions

3
.eslintignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
dist
npm/dist

View File

@ -1,9 +1,9 @@
---
name: Bug report
about: Report any issues with the platform
title: ""
title: ''
labels: bug
assignees: ""
assignees: ''
---
Found a bug? Please fill out the sections below. 👍

View File

@ -1,9 +1,9 @@
---
name: Feature request
about: Suggest a feature or idea
title: ""
title: ''
labels: enhancement
assignees: ""
assignees: ''
---
> Please check if your Feature Request has not been already raised in the [Discussions Tab](https://github.com/boxyhq/jackson/discussions), as we would like to reduce duplicates. If it has been already raised, simply upvote it 🔼.
@ -40,4 +40,4 @@ assignees: ""
You might want to link to related issues here, if you haven't already.
-->
(Write your answer here.)
(Write your answer here.)

View File

@ -139,7 +139,8 @@ jobs:
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- run: npm run custom-install
- run: npm run lint
- run: npm run check-lint
- run: npm run check-format
- run: npm run build
- run: npm run test
working-directory: ./npm

View File

@ -5,6 +5,11 @@ public
**/**/.next
**/**/public
npm/migration/**
npm/dist/**
npm/.nyc_output/**
.vscode/**
npm/package-lock.json
*.lock
*.log

View File

@ -3,9 +3,9 @@ module.exports = {
bracketSameLine: true,
singleQuote: true,
jsxSingleQuote: true,
trailingComma: "es5",
trailingComma: 'es5',
semi: true,
printWidth: 110,
arrowParens: "always",
importOrderSeparation: true,
arrowParens: 'always',
// importOrderSeparation: true,
};

View File

@ -20,9 +20,7 @@
"tagAnnotation": "Release ${version}",
"tagArgs": [],
"push": true,
"pushArgs": [
"--follow-tags"
],
"pushArgs": ["--follow-tags"],
"pushRepo": ""
},
"npm": {
@ -48,4 +46,4 @@
"pr": ":rocket: _This pull request is included in v${version}. See [${releaseName}](${releaseUrl}) for release notes._"
}
}
}
}

View File

@ -17,9 +17,10 @@
<h3 align="center">
[⬆️ Take a look at our Issues ⬆️](https://github.com/boxyhq/jackson/issues)
</h3>
___
---
<h3 align="center" >
<a href="https://boxyhq.com/docs/jackson/overview" rel="dofollow"><strong>· Explore the docs »</strong></a>
@ -27,8 +28,6 @@ ___
<a href="https://boxyhq.com/saas-registration" rel="dofollow"><strong>· SaaS Early Access »</strong></a>
</h3>
# ⭐️ SAML Jackson: Enterprise SSO made simple
<p>

View File

@ -26,22 +26,10 @@ const CreateSSOConnection = ({ setupLinkToken, idpType }: CreateSSOConnectionPro
save: `/api/setup/${setupLinkToken}/sso-connection`,
};
return idpType === 'saml' ? (
<CreateSAML
variant='basic'
urls={urls}
successCallback={onSuccess}
errorCallback={onError}
/>
<CreateSAML variant='basic' urls={urls} successCallback={onSuccess} errorCallback={onError} />
) : (
<CreateOIDC
variant='basic'
urls={urls}
successCallback={onSuccess}
errorCallback={onError}
/>
<CreateOIDC variant='basic' urls={urls} successCallback={onSuccess} errorCallback={onError} />
);
};

View File

@ -61,14 +61,13 @@ export const strategyChecker = (req: NextApiRequest): { isSAML: boolean; isOIDC:
// The oidcMetadata JSON will be parsed here
export const oidcMetadataParse = (
body:
| (
| OIDCSSOConnectionWithDiscoveryUrl
| (Omit<OIDCSSOConnectionWithMetadata, 'oidcMetadata'> & { oidcMetadata: string })
) & {
clientID: string;
clientSecret: string;
}
body: (
| OIDCSSOConnectionWithDiscoveryUrl
| (Omit<OIDCSSOConnectionWithMetadata, 'oidcMetadata'> & { oidcMetadata: string })
) & {
clientID: string;
clientSecret: string;
}
) => {
if (!body.oidcDiscoveryUrl && typeof body.oidcMetadata === 'string') {
try {

View File

@ -1,2 +1,3 @@
node_modules
dist
dist
npm/dist

View File

@ -31,9 +31,12 @@ export class AnalyticsController {
await this.send();
}
setInterval(async () => {
await this.send();
}, 60 * 60 * 24 * 1000);
setInterval(
async () => {
await this.send();
},
60 * 60 * 24 * 1000
);
}
async send() {
@ -45,9 +48,12 @@ export class AnalyticsController {
},
(err: Error | undefined) => {
if (err) {
setTimeout(() => {
this.send();
}, 1000 * 60 * 60);
setTimeout(
() => {
this.send();
},
1000 * 60 * 60
);
return;
}

View File

@ -1,7 +1,4 @@
export const redirect = (
redirectUrl: string,
redirectUrls: string[]
): boolean => {
export const redirect = (redirectUrl: string, redirectUrls: string[]): boolean => {
const url: URL = new URL(redirectUrl);
for (const idx in redirectUrls) {
@ -9,11 +6,7 @@ export const redirect = (
// TODO: Check pathname, for now pathname is ignored
if (
rUrl.protocol === url.protocol &&
rUrl.hostname === url.hostname &&
rUrl.port === url.port
) {
if (rUrl.protocol === url.protocol && rUrl.hostname === url.hostname && rUrl.port === url.port) {
return true;
}
}

View File

@ -5,7 +5,5 @@ export const transformBase64 = (input: string): string => {
};
export const encode = (code_challenge: string): string => {
return transformBase64(
crypto.createHash('sha256').update(code_challenge).digest('base64')
);
return transformBase64(crypto.createHash('sha256').update(code_challenge).digest('base64'));
};

View File

@ -7,7 +7,10 @@ import type {
} from '../typings';
export class RequestHandler {
constructor(private directoryUsers: IDirectoryUsers, private directoryGroups: IDirectoryGroups) {}
constructor(
private directoryUsers: IDirectoryUsers,
private directoryGroups: IDirectoryGroups
) {}
async handle(request: DirectorySyncRequest, callback?: EventCallback): Promise<DirectorySyncResponse> {
const resourceType = request.resourceType.toLowerCase();

View File

@ -157,11 +157,10 @@ export type UserPatchOperation = {
export type GroupPatchOperation = {
op: 'add' | 'remove' | 'replace';
path?: 'members' | 'displayName';
value:
| {
value: string;
display?: string;
}[];
value: {
value: string;
display?: string;
}[];
};
export type GroupMembership = {

View File

@ -35,8 +35,8 @@ const mapping = [
...arrayMapping,
];
type attributes = typeof mapping[number]['attribute'];
type schemas = typeof mapping[number]['schema'];
type attributes = (typeof mapping)[number]['attribute'];
type schemas = (typeof mapping)[number]['schema'];
const map = (claims: Record<attributes | schemas, unknown>) => {
arrayMapping.forEach((m) => {

View File

@ -15,7 +15,6 @@
"dev": "cross-env JACKSON_API_KEYS=secret IDP_ENABLED=true next dev -p 5225",
"dev-dbs": "docker-compose -f ./_dev/docker-compose.yml up -d",
"dev-dbs-destroy": "docker-compose -f ./_dev/docker-compose.yml down --volumes --remove-orphans",
"lint": "next lint && eslint -c .eslintrc.js --ext .ts ./",
"mongo": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mongo DB_URL=mongodb://localhost:27017/jackson npm run dev",
"pre-loaded": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mem PRE_LOADED_CONNECTION='./_dev/saml_config' npm run dev",
"pre-loaded-db": "cross-env JACKSON_API_KEYS=secret PRE_LOADED_CONNECTION='./_dev/saml_config' npm run dev",
@ -50,7 +49,11 @@
"prebuild": "ts-node --logError prebuild.ts",
"build": "next build",
"postbuild": "ts-node --logError postbuild.ts",
"release": "git checkout release && git merge origin/main && release-it"
"release": "git checkout release && git merge origin/main && release-it",
"check-types": "tsc --pretty --noEmit",
"check-format": "prettier --check .",
"check-lint": "next lint && eslint -c .eslintrc.js --ext ts --ext tsx --ext js ./",
"format": "prettier --write ."
},
"dependencies": {
"@boxyhq/metrics": "0.2.5",

View File

@ -10,8 +10,18 @@ html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
Droid Sans, Helvetica Neue, sans-serif;
font-family:
-apple-system,
BlinkMacSystemFont,
Segoe UI,
Roboto,
Oxygen,
Ubuntu,
Cantarell,
Fira Sans,
Droid Sans,
Helvetica Neue,
sans-serif;
}
a {

View File

@ -16,10 +16,7 @@
},
"host": "localhost:5225",
"basePath": "/",
"schemes": [
"http",
"https"
],
"schemes": ["http", "https"],
"securityDefinitions": {
"apiKey": {
"type": "apiKey",
@ -38,16 +35,9 @@
"post": {
"summary": "Create SSO connection",
"operationId": "create-sso-connection",
"tags": [
"Single Sign On"
],
"produces": [
"application/json"
],
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"tags": ["Single Sign On"],
"produces": ["application/json"],
"consumes": ["application/x-www-form-urlencoded", "application/json"],
"parameters": [
{
"$ref": "#/parameters/nameParamPost"
@ -107,13 +97,8 @@
"patch": {
"summary": "Update SSO Connection",
"operationId": "update-sso-connection",
"tags": [
"Single Sign On"
],
"consumes": [
"application/json",
"application/x-www-form-urlencoded"
],
"tags": ["Single Sign On"],
"consumes": ["application/json", "application/x-www-form-urlencoded"],
"parameters": [
{
"$ref": "#/parameters/clientIDParamPatch"
@ -196,9 +181,7 @@
}
],
"operationId": "get-connections",
"tags": [
"Single Sign On"
],
"tags": ["Single Sign On"],
"responses": {
"200": {
"$ref": "#/responses/200Get"
@ -231,9 +214,7 @@
],
"summary": "Delete SSO Connections",
"operationId": "delete-sso-connection",
"tags": [
"Single Sign On"
],
"tags": ["Single Sign On"],
"responses": {
"200": {
"description": "Success"
@ -256,9 +237,7 @@
}
],
"operationId": "get-connections-by-product",
"tags": [
"Single Sign On"
],
"tags": ["Single Sign On"],
"responses": {
"200": {
"$ref": "#/responses/200Get"
@ -276,12 +255,8 @@
"post": {
"summary": "Code exchange",
"operationId": "oauth-code-exchange",
"tags": [
"OAuth"
],
"consumes": [
"application/x-www-form-urlencoded"
],
"tags": ["OAuth"],
"consumes": ["application/x-www-form-urlencoded"],
"parameters": [
{
"name": "grant_type",
@ -356,9 +331,7 @@
"get": {
"summary": "Get profile",
"operationId": "oauth-get-profile",
"tags": [
"OAuth"
],
"tags": ["OAuth"],
"responses": {
"200": {
"description": "Success",
@ -413,16 +386,9 @@
"post": {
"summary": "Create a Setup Link",
"operationId": "create-sso-setup-link",
"tags": [
"Setup Links | Single Sign On"
],
"produces": [
"application/json"
],
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"tags": ["Setup Links | Single Sign On"],
"produces": ["application/json"],
"consumes": ["application/x-www-form-urlencoded", "application/json"],
"parameters": [
{
"$ref": "#/parameters/tenantParamPost"
@ -460,9 +426,7 @@
}
],
"operationId": "delete-sso-setup-link",
"tags": [
"Setup Links | Single Sign On"
],
"tags": ["Setup Links | Single Sign On"],
"responses": {
"200": {
"description": "Success",
@ -489,9 +453,7 @@
}
],
"operationId": "get-sso-setup-link",
"tags": [
"Setup Links | Single Sign On"
],
"tags": ["Setup Links | Single Sign On"],
"responses": {
"200": {
"description": "Success",
@ -506,16 +468,9 @@
"post": {
"summary": "Create a Setup Link",
"operationId": "create-dsync-setup-link",
"tags": [
"Setup Links | Directory Sync"
],
"produces": [
"application/json"
],
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"tags": ["Setup Links | Directory Sync"],
"produces": ["application/json"],
"consumes": ["application/x-www-form-urlencoded", "application/json"],
"parameters": [
{
"$ref": "#/parameters/tenantParamPost"
@ -547,9 +502,7 @@
}
],
"operationId": "delete-dsync-setup-link",
"tags": [
"Setup Links | Directory Sync"
],
"tags": ["Setup Links | Directory Sync"],
"responses": {
"200": {
"description": "Success",
@ -576,9 +529,7 @@
}
],
"operationId": "get-dsync-setup-link",
"tags": [
"Setup Links | Directory Sync"
],
"tags": ["Setup Links | Directory Sync"],
"responses": {
"200": {
"description": "Success",
@ -598,9 +549,7 @@
}
],
"operationId": "get-sso-setup-link-by-product",
"tags": [
"Setup Links | Single Sign On"
],
"tags": ["Setup Links | Single Sign On"],
"responses": {
"200": {
"description": "Success",
@ -623,9 +572,7 @@
}
],
"operationId": "get-dsync-setup-link-by-product",
"tags": [
"Setup Links | Directory Sync"
],
"tags": ["Setup Links | Directory Sync"],
"responses": {
"200": {
"description": "Success",
@ -651,12 +598,8 @@
"type": "string"
}
],
"tags": [
"SAML Traces"
],
"produces": [
"application/json"
],
"tags": ["SAML Traces"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -675,12 +618,8 @@
"$ref": "#/parameters/product"
}
],
"tags": [
"SAML Traces"
],
"produces": [
"application/json"
],
"tags": ["SAML Traces"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -741,16 +680,9 @@
"type": "string"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"consumes": ["application/x-www-form-urlencoded", "application/json"],
"responses": {
"200": {
"description": "Success",
@ -773,16 +705,9 @@
"$ref": "#/parameters/product"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"consumes": ["application/x-www-form-urlencoded", "application/json"],
"responses": {
"200": {
"description": "Success",
@ -808,12 +733,8 @@
"type": "string"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -834,12 +755,8 @@
"type": "string"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success"
@ -855,12 +772,8 @@
"$ref": "#/parameters/product"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -892,12 +805,8 @@
"type": "string"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -922,12 +831,8 @@
"$ref": "#/parameters/directoryId"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -959,12 +864,8 @@
"type": "string"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -989,12 +890,8 @@
"$ref": "#/parameters/directoryId"
}
],
"tags": [
"Directory Sync"
],
"produces": [
"application/json"
],
"tags": ["Directory Sync"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -1069,16 +966,9 @@
"type": "string"
}
],
"tags": [
"SAML Federation"
],
"produces": [
"application/json"
],
"consumes": [
"application/x-www-form-urlencoded",
"application/json"
],
"tags": ["SAML Federation"],
"produces": ["application/json"],
"consumes": ["application/x-www-form-urlencoded", "application/json"],
"responses": {
"200": {
"description": "Success",
@ -1116,12 +1006,8 @@
"type": "string"
}
],
"tags": [
"SAML Federation"
],
"produces": [
"application/json"
],
"tags": ["SAML Federation"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -1198,12 +1084,8 @@
"type": "string"
}
],
"tags": [
"SAML Federation"
],
"produces": [
"application/json"
],
"tags": ["SAML Federation"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -1238,12 +1120,8 @@
"type": "string"
}
],
"tags": [
"SAML Federation"
],
"produces": [
"application/json"
],
"tags": ["SAML Federation"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -1266,12 +1144,8 @@
"type": "string"
}
],
"tags": [
"SAML Federation"
],
"produces": [
"application/json"
],
"tags": ["SAML Federation"],
"produces": ["application/json"],
"responses": {
"200": {
"description": "Success",
@ -1301,9 +1175,7 @@
"provider": "okta.com"
},
"defaultRedirectUrl": "https://hoppscotch.io/",
"redirectUrl": [
"https://hoppscotch.io/"
],
"redirectUrl": ["https://hoppscotch.io/"],
"tenant": "hoppscotch.io",
"product": "API Engine",
"name": "Hoppscotch-SP",
@ -1899,4 +1771,4 @@
}
},
"tags": []
}
}