mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 03:34:35 +00:00
feat: generate executables for sasjs/server with web component
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,4 +7,5 @@ sas/
|
|||||||
tmp/
|
tmp/
|
||||||
build/
|
build/
|
||||||
certificates/
|
certificates/
|
||||||
|
executables/
|
||||||
.env
|
.env
|
||||||
|
|||||||
1099
api/package-lock.json
generated
1099
api/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,24 @@
|
|||||||
"test": "mkdir -p tmp && mkdir -p ../web/build && jest --coverage",
|
"test": "mkdir -p tmp && mkdir -p ../web/build && jest --coverage",
|
||||||
"lint:fix": "npx prettier --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
"lint:fix": "npx prettier --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
||||||
"lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
"lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,yml,md,graphql}\"",
|
||||||
"package:lib": "npm run build && cp ./package.json build && cp README.md build && cd build && npm version \"5.0.0\" && npm pack"
|
"package:lib": "npm run build && cp ./package.json build && cp README.md build && cd build && npm version \"5.0.0\" && npm pack",
|
||||||
|
"exe:prepare": "npm run build && cd build && npm run api && npm run public:copy && npm run web && pkg .",
|
||||||
|
"api": "npm run api:mkdir && npm run api:copy",
|
||||||
|
"api:mkdir": "mkdir tmp && mkdir tmp/files && mkdir tmp/logs && mkdir tmp/webouts && mkdir tmp/sessions",
|
||||||
|
"api:copy": "cp -r ../tmp/ ./tmp/",
|
||||||
|
"public:copy": "cp -r ../public/ ./public/",
|
||||||
|
"web": "cd .. && npm run web:mkdir && npm run web:copy && cd build",
|
||||||
|
"web:mkdir": "rimraf web && mkdir web && mkdir web/build",
|
||||||
|
"web:copy": "cp -r ../web/build/ ./web/build/"
|
||||||
|
},
|
||||||
|
"bin": "src/server.js",
|
||||||
|
"pkg": {
|
||||||
|
"assets": [
|
||||||
|
"tmp/files/**/*",
|
||||||
|
"public/**/*",
|
||||||
|
"../web/build/**/*"
|
||||||
|
],
|
||||||
|
"outputPath": "../../executables"
|
||||||
},
|
},
|
||||||
"release": {
|
"release": {
|
||||||
"branches": [
|
"branches": [
|
||||||
@@ -50,6 +67,7 @@
|
|||||||
"jest": "^27.0.6",
|
"jest": "^27.0.6",
|
||||||
"mongodb-memory-server": "^8.0.0",
|
"mongodb-memory-server": "^8.0.0",
|
||||||
"nodemon": "^2.0.7",
|
"nodemon": "^2.0.7",
|
||||||
|
"pkg": "^5.4.1",
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^2.3.1",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"semantic-release": "^17.4.3",
|
"semantic-release": "^17.4.3",
|
||||||
|
|||||||
8933
api/public/SASjsApi/swagger-ui.css
Normal file
8933
api/public/SASjsApi/swagger-ui.css
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,93 @@ components:
|
|||||||
requestBodies: {}
|
requestBodies: {}
|
||||||
responses: {}
|
responses: {}
|
||||||
schemas:
|
schemas:
|
||||||
|
AuthorizeResponse:
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: string
|
||||||
|
description: 'Authorization code'
|
||||||
|
example: someRandomCryptoString
|
||||||
|
required:
|
||||||
|
- code
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
AuthorizePayload:
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
description: 'Username for user'
|
||||||
|
example: secretuser
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
description: 'Password for user'
|
||||||
|
example: secretpassword
|
||||||
|
clientId:
|
||||||
|
type: string
|
||||||
|
description: 'Client ID'
|
||||||
|
example: clientID1
|
||||||
|
required:
|
||||||
|
- username
|
||||||
|
- password
|
||||||
|
- clientId
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
TokenResponse:
|
||||||
|
properties:
|
||||||
|
accessToken:
|
||||||
|
type: string
|
||||||
|
description: 'Access Token'
|
||||||
|
example: someRandomCryptoString
|
||||||
|
refreshToken:
|
||||||
|
type: string
|
||||||
|
description: 'Refresh Token'
|
||||||
|
example: someRandomCryptoString
|
||||||
|
required:
|
||||||
|
- accessToken
|
||||||
|
- refreshToken
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
TokenPayload:
|
||||||
|
properties:
|
||||||
|
clientId:
|
||||||
|
type: string
|
||||||
|
description: 'Client ID'
|
||||||
|
example: clientID1
|
||||||
|
code:
|
||||||
|
type: string
|
||||||
|
description: 'Authorization code'
|
||||||
|
example: someRandomCryptoString
|
||||||
|
required:
|
||||||
|
- clientId
|
||||||
|
- code
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
InfoJWT:
|
||||||
|
properties:
|
||||||
|
clientId:
|
||||||
|
type: string
|
||||||
|
userId:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
required:
|
||||||
|
- clientId
|
||||||
|
- userId
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
|
ClientPayload:
|
||||||
|
properties:
|
||||||
|
clientId:
|
||||||
|
type: string
|
||||||
|
description: 'Client ID'
|
||||||
|
example: someFormattedClientID1234
|
||||||
|
clientSecret:
|
||||||
|
type: string
|
||||||
|
description: 'Client Secret'
|
||||||
|
example: someRandomCryptoString
|
||||||
|
required:
|
||||||
|
- clientId
|
||||||
|
- clientSecret
|
||||||
|
type: object
|
||||||
|
additionalProperties: false
|
||||||
MemberType.folder:
|
MemberType.folder:
|
||||||
enum:
|
enum:
|
||||||
- folder
|
- folder
|
||||||
@@ -151,28 +238,6 @@ components:
|
|||||||
- tree
|
- tree
|
||||||
type: object
|
type: object
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
ExecuteReturnJsonResponse:
|
|
||||||
properties:
|
|
||||||
status:
|
|
||||||
type: string
|
|
||||||
log:
|
|
||||||
type: string
|
|
||||||
result:
|
|
||||||
type: string
|
|
||||||
message:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- status
|
|
||||||
type: object
|
|
||||||
additionalProperties: false
|
|
||||||
ExecuteReturnJsonPayload:
|
|
||||||
properties:
|
|
||||||
_program:
|
|
||||||
type: string
|
|
||||||
description: 'Location of SAS program'
|
|
||||||
example: /Public/somefolder/some.file
|
|
||||||
type: object
|
|
||||||
additionalProperties: false
|
|
||||||
UserResponse:
|
UserResponse:
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
@@ -293,91 +358,26 @@ components:
|
|||||||
- description
|
- description
|
||||||
type: object
|
type: object
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
ClientPayload:
|
ExecuteReturnJsonResponse:
|
||||||
properties:
|
properties:
|
||||||
clientId:
|
status:
|
||||||
type: string
|
type: string
|
||||||
description: 'Client ID'
|
log:
|
||||||
example: someFormattedClientID1234
|
type: string
|
||||||
clientSecret:
|
result:
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
type: string
|
type: string
|
||||||
description: 'Client Secret'
|
|
||||||
example: someRandomCryptoString
|
|
||||||
required:
|
required:
|
||||||
- clientId
|
- status
|
||||||
- clientSecret
|
|
||||||
type: object
|
type: object
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
AuthorizeResponse:
|
ExecuteReturnJsonPayload:
|
||||||
properties:
|
properties:
|
||||||
code:
|
_program:
|
||||||
type: string
|
type: string
|
||||||
description: 'Authorization code'
|
description: 'Location of SAS program'
|
||||||
example: someRandomCryptoString
|
example: /Public/somefolder/some.file
|
||||||
required:
|
|
||||||
- code
|
|
||||||
type: object
|
|
||||||
additionalProperties: false
|
|
||||||
AuthorizePayload:
|
|
||||||
properties:
|
|
||||||
username:
|
|
||||||
type: string
|
|
||||||
description: 'Username for user'
|
|
||||||
example: secretuser
|
|
||||||
password:
|
|
||||||
type: string
|
|
||||||
description: 'Password for user'
|
|
||||||
example: secretpassword
|
|
||||||
clientId:
|
|
||||||
type: string
|
|
||||||
description: 'Client ID'
|
|
||||||
example: clientID1
|
|
||||||
required:
|
|
||||||
- username
|
|
||||||
- password
|
|
||||||
- clientId
|
|
||||||
type: object
|
|
||||||
additionalProperties: false
|
|
||||||
TokenResponse:
|
|
||||||
properties:
|
|
||||||
accessToken:
|
|
||||||
type: string
|
|
||||||
description: 'Access Token'
|
|
||||||
example: someRandomCryptoString
|
|
||||||
refreshToken:
|
|
||||||
type: string
|
|
||||||
description: 'Refresh Token'
|
|
||||||
example: someRandomCryptoString
|
|
||||||
required:
|
|
||||||
- accessToken
|
|
||||||
- refreshToken
|
|
||||||
type: object
|
|
||||||
additionalProperties: false
|
|
||||||
TokenPayload:
|
|
||||||
properties:
|
|
||||||
clientId:
|
|
||||||
type: string
|
|
||||||
description: 'Client ID'
|
|
||||||
example: clientID1
|
|
||||||
code:
|
|
||||||
type: string
|
|
||||||
description: 'Authorization code'
|
|
||||||
example: someRandomCryptoString
|
|
||||||
required:
|
|
||||||
- clientId
|
|
||||||
- code
|
|
||||||
type: object
|
|
||||||
additionalProperties: false
|
|
||||||
InfoJWT:
|
|
||||||
properties:
|
|
||||||
clientId:
|
|
||||||
type: string
|
|
||||||
userId:
|
|
||||||
type: number
|
|
||||||
format: double
|
|
||||||
required:
|
|
||||||
- clientId
|
|
||||||
- userId
|
|
||||||
type: object
|
type: object
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
@@ -393,6 +393,113 @@ info:
|
|||||||
name: 'Analytium Ltd'
|
name: 'Analytium Ltd'
|
||||||
openapi: 3.0.0
|
openapi: 3.0.0
|
||||||
paths:
|
paths:
|
||||||
|
/SASjsApi/auth/authorize:
|
||||||
|
post:
|
||||||
|
operationId: Authorize
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Ok
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AuthorizeResponse'
|
||||||
|
examples:
|
||||||
|
'Example 1':
|
||||||
|
value: {code: someRandomCryptoString}
|
||||||
|
summary: 'Accept a valid username/password, plus a CLIENT_ID, and return an AUTH_CODE'
|
||||||
|
tags:
|
||||||
|
- Auth
|
||||||
|
security: []
|
||||||
|
parameters: []
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AuthorizePayload'
|
||||||
|
/SASjsApi/auth/token:
|
||||||
|
post:
|
||||||
|
operationId: Token
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Ok
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TokenResponse'
|
||||||
|
examples:
|
||||||
|
'Example 1':
|
||||||
|
value: {accessToken: someRandomCryptoString, refreshToken: someRandomCryptoString}
|
||||||
|
summary: 'Accepts client/auth code and returns access/refresh tokens'
|
||||||
|
tags:
|
||||||
|
- Auth
|
||||||
|
security: []
|
||||||
|
parameters: []
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TokenPayload'
|
||||||
|
/SASjsApi/auth/refresh:
|
||||||
|
post:
|
||||||
|
operationId: Refresh
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Ok
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/TokenResponse'
|
||||||
|
examples:
|
||||||
|
'Example 1':
|
||||||
|
value: {accessToken: someRandomCryptoString, refreshToken: someRandomCryptoString}
|
||||||
|
summary: 'Returns new access/refresh tokens'
|
||||||
|
tags:
|
||||||
|
- Auth
|
||||||
|
security:
|
||||||
|
-
|
||||||
|
bearerAuth: []
|
||||||
|
parameters: []
|
||||||
|
/SASjsApi/auth/logout:
|
||||||
|
post:
|
||||||
|
operationId: Logout
|
||||||
|
responses:
|
||||||
|
'204':
|
||||||
|
description: 'No content'
|
||||||
|
summary: 'Logout terminate access/refresh tokens and returns nothing'
|
||||||
|
tags:
|
||||||
|
- Auth
|
||||||
|
security:
|
||||||
|
-
|
||||||
|
bearerAuth: []
|
||||||
|
parameters: []
|
||||||
|
/SASjsApi/client:
|
||||||
|
post:
|
||||||
|
operationId: CreateClient
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Ok
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ClientPayload'
|
||||||
|
examples:
|
||||||
|
'Example 1':
|
||||||
|
value: {clientId: someFormattedClientID1234, clientSecret: someRandomCryptoString}
|
||||||
|
summary: 'Create client with the following attributes: ClientId, ClientSecret. Admin only task.'
|
||||||
|
tags:
|
||||||
|
- Client
|
||||||
|
security:
|
||||||
|
-
|
||||||
|
bearerAuth: []
|
||||||
|
parameters: []
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ClientPayload'
|
||||||
/SASjsApi/drive/deploy:
|
/SASjsApi/drive/deploy:
|
||||||
post:
|
post:
|
||||||
operationId: Deploy
|
operationId: Deploy
|
||||||
@@ -524,61 +631,6 @@ paths:
|
|||||||
-
|
-
|
||||||
bearerAuth: []
|
bearerAuth: []
|
||||||
parameters: []
|
parameters: []
|
||||||
/SASjsApi/client/execute:
|
|
||||||
get:
|
|
||||||
operationId: ExecuteReturnRaw
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Ok
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
description: "Trigger a SAS program using it's location in the _program parameter.\nEnable debugging using the _debug parameter.\nAdditional URL parameters are turned into SAS macro variables.\nAny files provided are placed into the session and\ncorresponding _WEBIN_XXX variables are created."
|
|
||||||
summary: 'Execute Stored Program, return raw content'
|
|
||||||
tags:
|
|
||||||
- STP
|
|
||||||
security:
|
|
||||||
-
|
|
||||||
bearerAuth: []
|
|
||||||
parameters:
|
|
||||||
-
|
|
||||||
in: query
|
|
||||||
name: _program
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
example: /Public/somefolder/some.file
|
|
||||||
post:
|
|
||||||
operationId: ExecuteReturnJson
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Ok
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/ExecuteReturnJsonResponse'
|
|
||||||
description: "Trigger a SAS program using it's location in the _program parameter.\nEnable debugging using the _debug parameter.\nAdditional URL parameters are turned into SAS macro variables.\nAny files provided are placed into the session and\ncorresponding _WEBIN_XXX variables are created."
|
|
||||||
summary: 'Execute Stored Program, return JSON'
|
|
||||||
tags:
|
|
||||||
- STP
|
|
||||||
security:
|
|
||||||
-
|
|
||||||
bearerAuth: []
|
|
||||||
parameters:
|
|
||||||
-
|
|
||||||
in: query
|
|
||||||
name: _program
|
|
||||||
required: false
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
example: /Public/somefolder/some.file
|
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/ExecuteReturnJsonPayload'
|
|
||||||
/SASjsApi/user:
|
/SASjsApi/user:
|
||||||
get:
|
get:
|
||||||
operationId: GetAllUsers
|
operationId: GetAllUsers
|
||||||
@@ -885,113 +937,61 @@ paths:
|
|||||||
format: double
|
format: double
|
||||||
type: number
|
type: number
|
||||||
example: '6789'
|
example: '6789'
|
||||||
/SASjsApi/client:
|
/SASjsApi/client/execute:
|
||||||
post:
|
get:
|
||||||
operationId: CreateClient
|
operationId: ExecuteReturnRaw
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Ok
|
description: Ok
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ClientPayload'
|
type: string
|
||||||
examples:
|
description: "Trigger a SAS program using it's location in the _program parameter.\nEnable debugging using the _debug parameter.\nAdditional URL parameters are turned into SAS macro variables.\nAny files provided are placed into the session and\ncorresponding _WEBIN_XXX variables are created."
|
||||||
'Example 1':
|
summary: 'Execute Stored Program, return raw content'
|
||||||
value: {clientId: someFormattedClientID1234, clientSecret: someRandomCryptoString}
|
|
||||||
summary: 'Create client with the following attributes: ClientId, ClientSecret. Admin only task.'
|
|
||||||
tags:
|
tags:
|
||||||
- Client
|
- STP
|
||||||
security:
|
security:
|
||||||
-
|
-
|
||||||
bearerAuth: []
|
bearerAuth: []
|
||||||
parameters: []
|
parameters:
|
||||||
|
-
|
||||||
|
in: query
|
||||||
|
name: _program
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: /Public/somefolder/some.file
|
||||||
|
post:
|
||||||
|
operationId: ExecuteReturnJson
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Ok
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ExecuteReturnJsonResponse'
|
||||||
|
description: "Trigger a SAS program using it's location in the _program parameter.\nEnable debugging using the _debug parameter.\nAdditional URL parameters are turned into SAS macro variables.\nAny files provided are placed into the session and\ncorresponding _WEBIN_XXX variables are created."
|
||||||
|
summary: 'Execute Stored Program, return JSON'
|
||||||
|
tags:
|
||||||
|
- STP
|
||||||
|
security:
|
||||||
|
-
|
||||||
|
bearerAuth: []
|
||||||
|
parameters:
|
||||||
|
-
|
||||||
|
in: query
|
||||||
|
name: _program
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: /Public/somefolder/some.file
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/ClientPayload'
|
$ref: '#/components/schemas/ExecuteReturnJsonPayload'
|
||||||
/SASjsApi/auth/authorize:
|
|
||||||
post:
|
|
||||||
operationId: Authorize
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Ok
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/AuthorizeResponse'
|
|
||||||
examples:
|
|
||||||
'Example 1':
|
|
||||||
value: {code: someRandomCryptoString}
|
|
||||||
summary: 'Accept a valid username/password, plus a CLIENT_ID, and return an AUTH_CODE'
|
|
||||||
tags:
|
|
||||||
- Auth
|
|
||||||
security: []
|
|
||||||
parameters: []
|
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/AuthorizePayload'
|
|
||||||
/SASjsApi/auth/token:
|
|
||||||
post:
|
|
||||||
operationId: Token
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Ok
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/TokenResponse'
|
|
||||||
examples:
|
|
||||||
'Example 1':
|
|
||||||
value: {accessToken: someRandomCryptoString, refreshToken: someRandomCryptoString}
|
|
||||||
summary: 'Accepts client/auth code and returns access/refresh tokens'
|
|
||||||
tags:
|
|
||||||
- Auth
|
|
||||||
security: []
|
|
||||||
parameters: []
|
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/TokenPayload'
|
|
||||||
/SASjsApi/auth/refresh:
|
|
||||||
post:
|
|
||||||
operationId: Refresh
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Ok
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: '#/components/schemas/TokenResponse'
|
|
||||||
examples:
|
|
||||||
'Example 1':
|
|
||||||
value: {accessToken: someRandomCryptoString, refreshToken: someRandomCryptoString}
|
|
||||||
summary: 'Returns new access/refresh tokens'
|
|
||||||
tags:
|
|
||||||
- Auth
|
|
||||||
security:
|
|
||||||
-
|
|
||||||
bearerAuth: []
|
|
||||||
parameters: []
|
|
||||||
/SASjsApi/auth/logout:
|
|
||||||
post:
|
|
||||||
operationId: Logout
|
|
||||||
responses:
|
|
||||||
'204':
|
|
||||||
description: 'No content'
|
|
||||||
summary: 'Logout terminate access/refresh tokens and returns nothing'
|
|
||||||
tags:
|
|
||||||
- Auth
|
|
||||||
security:
|
|
||||||
-
|
|
||||||
bearerAuth: []
|
|
||||||
parameters: []
|
|
||||||
servers:
|
servers:
|
||||||
-
|
-
|
||||||
url: /
|
url: /
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import path from 'path'
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
|
|
||||||
import morgan from 'morgan'
|
import morgan from 'morgan'
|
||||||
import webRouter from './routes/web'
|
import webRouter from './routes/web'
|
||||||
import apiRouter from './routes/api'
|
import apiRouter from './routes/api'
|
||||||
@@ -8,7 +10,7 @@ const app = express()
|
|||||||
|
|
||||||
app.use(express.json({ limit: '50mb' }))
|
app.use(express.json({ limit: '50mb' }))
|
||||||
app.use(morgan('tiny'))
|
app.use(morgan('tiny'))
|
||||||
app.use(express.static('public'))
|
app.use(express.static(path.join(__dirname, '../public')))
|
||||||
|
|
||||||
app.use('/', webRouter)
|
app.use('/', webRouter)
|
||||||
app.use('/SASjsApi', apiRouter)
|
app.use('/SASjsApi', apiRouter)
|
||||||
|
|||||||
@@ -3,21 +3,22 @@ import PropTypes from 'prop-types'
|
|||||||
|
|
||||||
import { CssBaseline, Box, TextField, Button } from '@mui/material'
|
import { CssBaseline, Box, TextField, Button } from '@mui/material'
|
||||||
|
|
||||||
|
const headers = {
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
|
||||||
const getAuthCode = async (credentials: any) => {
|
const getAuthCode = async (credentials: any) => {
|
||||||
return fetch('/SASjsApi/auth/authorize', {
|
return fetch('/SASjsApi/auth/authorize', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers,
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify(credentials)
|
body: JSON.stringify(credentials)
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
const getTokens = async (payload: any) => {
|
const getTokens = async (payload: any) => {
|
||||||
return fetch('/SASjsApi/auth/token', {
|
return fetch('/SASjsApi/auth/token', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers,
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify(payload)
|
body: JSON.stringify(payload)
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
@@ -20,7 +16,5 @@
|
|||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src"]
|
||||||
"src"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user