@drxsuperapp/sdk 1.1.343 → 1.1.344
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +292 -292
- package/.openapi-generator-ignore +23 -23
- package/api.ts +1491 -1491
- package/base.ts +86 -86
- package/common.ts +150 -150
- package/configuration.ts +115 -115
- package/deploy.log +717 -0
- package/ecosystem.config.js +13 -13
- package/git_push.sh +57 -57
- package/hooks.json +30 -30
- package/openapitools.json +7 -7
- package/package.json +30 -30
- package/tsconfig.json +17 -17
- package/workflow.sh +88 -88
package/ecosystem.config.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports = {
|
|
3
|
-
apps: [
|
|
4
|
-
{
|
|
5
|
-
name: 'drx-sdk-webhook',
|
|
6
|
-
script: '/usr/local/bin/webhook', // path to `webhook` binary
|
|
7
|
-
args: '-hooks /root/drx-sdk/hooks.json -port 9000 -verbose',
|
|
8
|
-
cwd: '/root/drx-sdk',
|
|
9
|
-
watch: false,
|
|
10
|
-
autorestart: true
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
};
|
|
1
|
+
|
|
2
|
+
module.exports = {
|
|
3
|
+
apps: [
|
|
4
|
+
{
|
|
5
|
+
name: 'drx-sdk-webhook',
|
|
6
|
+
script: '/usr/local/bin/webhook', // path to `webhook` binary
|
|
7
|
+
args: '-hooks /root/drx-sdk/hooks.json -port 9000 -verbose',
|
|
8
|
+
cwd: '/root/drx-sdk',
|
|
9
|
+
watch: false,
|
|
10
|
+
autorestart: true
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
};
|
package/git_push.sh
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
3
|
-
#
|
|
4
|
-
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
|
5
|
-
|
|
6
|
-
git_user_id=$1
|
|
7
|
-
git_repo_id=$2
|
|
8
|
-
release_note=$3
|
|
9
|
-
git_host=$4
|
|
10
|
-
|
|
11
|
-
if [ "$git_host" = "" ]; then
|
|
12
|
-
git_host="github.com"
|
|
13
|
-
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
14
|
-
fi
|
|
15
|
-
|
|
16
|
-
if [ "$git_user_id" = "" ]; then
|
|
17
|
-
git_user_id="GIT_USER_ID"
|
|
18
|
-
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
if [ "$git_repo_id" = "" ]; then
|
|
22
|
-
git_repo_id="GIT_REPO_ID"
|
|
23
|
-
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
if [ "$release_note" = "" ]; then
|
|
27
|
-
release_note="Minor update"
|
|
28
|
-
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
# Initialize the local directory as a Git repository
|
|
32
|
-
git init
|
|
33
|
-
|
|
34
|
-
# Adds the files in the local repository and stages them for commit.
|
|
35
|
-
git add .
|
|
36
|
-
|
|
37
|
-
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
38
|
-
git commit -m "$release_note"
|
|
39
|
-
|
|
40
|
-
# Sets the new remote
|
|
41
|
-
git_remote=$(git remote)
|
|
42
|
-
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
43
|
-
|
|
44
|
-
if [ "$GIT_TOKEN" = "" ]; then
|
|
45
|
-
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
46
|
-
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
47
|
-
else
|
|
48
|
-
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
git pull origin master
|
|
54
|
-
|
|
55
|
-
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
56
|
-
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
57
|
-
git push origin master 2>&1 | grep -v 'To https'
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
3
|
+
#
|
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
|
5
|
+
|
|
6
|
+
git_user_id=$1
|
|
7
|
+
git_repo_id=$2
|
|
8
|
+
release_note=$3
|
|
9
|
+
git_host=$4
|
|
10
|
+
|
|
11
|
+
if [ "$git_host" = "" ]; then
|
|
12
|
+
git_host="github.com"
|
|
13
|
+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ "$git_user_id" = "" ]; then
|
|
17
|
+
git_user_id="GIT_USER_ID"
|
|
18
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if [ "$git_repo_id" = "" ]; then
|
|
22
|
+
git_repo_id="GIT_REPO_ID"
|
|
23
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if [ "$release_note" = "" ]; then
|
|
27
|
+
release_note="Minor update"
|
|
28
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Initialize the local directory as a Git repository
|
|
32
|
+
git init
|
|
33
|
+
|
|
34
|
+
# Adds the files in the local repository and stages them for commit.
|
|
35
|
+
git add .
|
|
36
|
+
|
|
37
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
38
|
+
git commit -m "$release_note"
|
|
39
|
+
|
|
40
|
+
# Sets the new remote
|
|
41
|
+
git_remote=$(git remote)
|
|
42
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
43
|
+
|
|
44
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
|
45
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
46
|
+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
47
|
+
else
|
|
48
|
+
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
git pull origin master
|
|
54
|
+
|
|
55
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
56
|
+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
57
|
+
git push origin master 2>&1 | grep -v 'To https'
|
package/hooks.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "sdk-deploy",
|
|
4
|
-
"execute-command": "/root/drx-sdk/workflow.sh",
|
|
5
|
-
"command-working-directory": "/root/drx-sdk",
|
|
6
|
-
"response-message": "Triggered SDK deployment.",
|
|
7
|
-
"trigger-rule": {
|
|
8
|
-
"match": {
|
|
9
|
-
"type": "value",
|
|
10
|
-
"value": "supersecret",
|
|
11
|
-
"parameter": {
|
|
12
|
-
"source": "header",
|
|
13
|
-
"name": "X-Hook-Secret"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"include-command-output-in-response": true,
|
|
18
|
-
"pass-environment-to-command": [
|
|
19
|
-
{
|
|
20
|
-
"source": "header",
|
|
21
|
-
"name": "X-Hook-Secret",
|
|
22
|
-
"envname": "HTTP_X_HOOK_SECRET"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"source": "header",
|
|
26
|
-
"name": "Authorization",
|
|
27
|
-
"envname": "HTTP_AUTHORIZATION"
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "sdk-deploy",
|
|
4
|
+
"execute-command": "/root/drx-sdk/workflow.sh",
|
|
5
|
+
"command-working-directory": "/root/drx-sdk",
|
|
6
|
+
"response-message": "Triggered SDK deployment.",
|
|
7
|
+
"trigger-rule": {
|
|
8
|
+
"match": {
|
|
9
|
+
"type": "value",
|
|
10
|
+
"value": "supersecret",
|
|
11
|
+
"parameter": {
|
|
12
|
+
"source": "header",
|
|
13
|
+
"name": "X-Hook-Secret"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"include-command-output-in-response": true,
|
|
18
|
+
"pass-environment-to-command": [
|
|
19
|
+
{
|
|
20
|
+
"source": "header",
|
|
21
|
+
"name": "X-Hook-Secret",
|
|
22
|
+
"envname": "HTTP_X_HOOK_SECRET"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"source": "header",
|
|
26
|
+
"name": "Authorization",
|
|
27
|
+
"envname": "HTTP_AUTHORIZATION"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
31
|
]
|
package/openapitools.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
|
3
|
-
"spaces": 2,
|
|
4
|
-
"generator-cli": {
|
|
5
|
-
"version": "7.13.0"
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
|
3
|
+
"spaces": 2,
|
|
4
|
+
"generator-cli": {
|
|
5
|
+
"version": "7.13.0"
|
|
6
|
+
}
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@drxsuperapp/sdk",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"main": "index.ts",
|
|
5
|
-
"types": "index.ts",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "tsc",
|
|
8
|
-
"prepublishOnly": "npm run build"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://gitlab.com/drx-super/drx-sdk.git"
|
|
13
|
-
},
|
|
14
|
-
"author": "DRX Team",
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://gitlab.com/drx-super/drx-sdk/issues"
|
|
18
|
-
},
|
|
19
|
-
"homepage": "https://gitlab.com/drx-super/drx-sdk#readme",
|
|
20
|
-
"description": "Auto-generated DRX API SDK (axios-based)",
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"access": "public"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"axios": "^1.8.3"
|
|
26
|
-
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"typescript": "^5.
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@drxsuperapp/sdk",
|
|
3
|
+
"version": "1.1.344",
|
|
4
|
+
"main": "index.ts",
|
|
5
|
+
"types": "index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"prepublishOnly": "npm run build"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://gitlab.com/drx-super/drx-sdk.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "DRX Team",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://gitlab.com/drx-super/drx-sdk/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://gitlab.com/drx-super/drx-sdk#readme",
|
|
20
|
+
"description": "Auto-generated DRX API SDK (axios-based)",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"axios": "^1.8.3"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"typescript": "^5.8.3"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "./dist",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"target": "esnext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": false,
|
|
9
|
-
"sourceMap": false,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"strict": true,
|
|
13
|
-
"resolveJsonModule": true
|
|
14
|
-
},
|
|
15
|
-
"include": ["./**/*.ts"],
|
|
16
|
-
"exclude": ["node_modules", "dist"]
|
|
17
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./dist",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": false,
|
|
9
|
+
"sourceMap": false,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"resolveJsonModule": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["./**/*.ts"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|
package/workflow.sh
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
LOCKFILE="/tmp/drx-sdk-deploy.lock"
|
|
4
|
-
LOGFILE="/root/drx-sdk/deploy.log"
|
|
5
|
-
SECRET_HEADER="supersecret"
|
|
6
|
-
|
|
7
|
-
# Optional: Read X-Hook-Secret from env or stdin (e.g. webhook piping)
|
|
8
|
-
if [[ -n "$HTTP_X_HOOK_SECRET" && "$HTTP_X_HOOK_SECRET" != "$SECRET_HEADER" ]]; then
|
|
9
|
-
echo "❌ Invalid hook secret at $(date)" >> "$LOGFILE"
|
|
10
|
-
exit 1
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
# Check if Authorization header is provided
|
|
14
|
-
if [[ -z "$HTTP_AUTHORIZATION" ]]; then
|
|
15
|
-
echo "❌ No Authorization header provided at $(date)" >> "$LOGFILE"
|
|
16
|
-
exit 1
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
(
|
|
20
|
-
flock -n 9 || {
|
|
21
|
-
echo "⚠️ Deploy already running at $(date)" >> "$LOGFILE"
|
|
22
|
-
exit 1
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
echo "🚀 START: $(date)" >> "$LOGFILE"
|
|
26
|
-
cd /root/drx-sdk || exit 1
|
|
27
|
-
|
|
28
|
-
# Fix file permissions so git can overwrite
|
|
29
|
-
chown -R "$(whoami)" . >>"$LOGFILE" 2>&1
|
|
30
|
-
chmod -R a+rwx . >>"$LOGFILE" 2>&1
|
|
31
|
-
|
|
32
|
-
# Step 1: Reset and pull latest code
|
|
33
|
-
git pull
|
|
34
|
-
git push
|
|
35
|
-
git fetch
|
|
36
|
-
git checkout master >> "$LOGFILE" 2>&1
|
|
37
|
-
git reset --hard HEAD >> "$LOGFILE" 2>&1
|
|
38
|
-
git pull origin master >> "$LOGFILE" 2>&1
|
|
39
|
-
|
|
40
|
-
rm -rf apis models dist docs >> "$LOGFILE" 2>&1
|
|
41
|
-
rm deploy.log
|
|
42
|
-
# Step 2: Generate SDK
|
|
43
|
-
[ -f .gitignore ] && cp .gitignore .gitignore.backup
|
|
44
|
-
|
|
45
|
-
# Use the Authorization header from the request
|
|
46
|
-
openapi-generator-cli generate \
|
|
47
|
-
-i https://api-dev.drxapps.com/swagger.json \
|
|
48
|
-
-g typescript-fetch \
|
|
49
|
-
-o ./ \
|
|
50
|
-
--additional-properties=modelPropertyNaming=original \
|
|
51
|
-
--auth "Authorization:Basic%20ZHJ4OkRyeEAyMDI1" >> "$LOGFILE" 2>&1
|
|
52
|
-
|
|
53
|
-
# Restore .gitignore
|
|
54
|
-
[ -f .gitignore.backup ] && mv .gitignore.backup .gitignore
|
|
55
|
-
|
|
56
|
-
if [ $? -ne 0 ]; then
|
|
57
|
-
echo "❌ SDK generation failed at $(date)" >> "$LOGFILE"
|
|
58
|
-
exit 1
|
|
59
|
-
fi
|
|
60
|
-
echo "✅ SDK generated" >> "$LOGFILE"
|
|
61
|
-
|
|
62
|
-
# Step 3: Commit and push
|
|
63
|
-
git add . >> "$LOGFILE" 2>&1
|
|
64
|
-
git commit -m "VPS: Generated API SDK" >> "$LOGFILE" 2>&1
|
|
65
|
-
git push >> "$LOGFILE" 2>&1 || {
|
|
66
|
-
echo "❌ Git push failed at $(date)" >> "$LOGFILE"
|
|
67
|
-
exit 1
|
|
68
|
-
}
|
|
69
|
-
echo "✅ Changes committed and pushed" >> "$LOGFILE"
|
|
70
|
-
|
|
71
|
-
# Step 4: Version bump
|
|
72
|
-
npm version patch >> "$LOGFILE" 2>&1
|
|
73
|
-
git push >> "$LOGFILE" 2>&1 || {
|
|
74
|
-
echo "❌ Version push failed" >> "$LOGFILE"
|
|
75
|
-
exit 1
|
|
76
|
-
}
|
|
77
|
-
echo "✅ Version bumped" >> "$LOGFILE"
|
|
78
|
-
|
|
79
|
-
# Step 5: Publish to NPM
|
|
80
|
-
npm publish >> "$LOGFILE" 2>&1 || {
|
|
81
|
-
echo "❌ NPM publish failed" >> "$LOGFILE"
|
|
82
|
-
exit 1
|
|
83
|
-
}
|
|
84
|
-
echo "✅ Package published to NPM" >> "$LOGFILE"
|
|
85
|
-
|
|
86
|
-
echo "🎉 DONE: $(date)" >> "$LOGFILE"
|
|
87
|
-
|
|
88
|
-
) 9> "$LOCKFILE"
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
LOCKFILE="/tmp/drx-sdk-deploy.lock"
|
|
4
|
+
LOGFILE="/root/drx-sdk/deploy.log"
|
|
5
|
+
SECRET_HEADER="supersecret"
|
|
6
|
+
|
|
7
|
+
# Optional: Read X-Hook-Secret from env or stdin (e.g. webhook piping)
|
|
8
|
+
if [[ -n "$HTTP_X_HOOK_SECRET" && "$HTTP_X_HOOK_SECRET" != "$SECRET_HEADER" ]]; then
|
|
9
|
+
echo "❌ Invalid hook secret at $(date)" >> "$LOGFILE"
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Check if Authorization header is provided
|
|
14
|
+
if [[ -z "$HTTP_AUTHORIZATION" ]]; then
|
|
15
|
+
echo "❌ No Authorization header provided at $(date)" >> "$LOGFILE"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
(
|
|
20
|
+
flock -n 9 || {
|
|
21
|
+
echo "⚠️ Deploy already running at $(date)" >> "$LOGFILE"
|
|
22
|
+
exit 1
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
echo "🚀 START: $(date)" >> "$LOGFILE"
|
|
26
|
+
cd /root/drx-sdk || exit 1
|
|
27
|
+
|
|
28
|
+
# Fix file permissions so git can overwrite
|
|
29
|
+
chown -R "$(whoami)" . >>"$LOGFILE" 2>&1
|
|
30
|
+
chmod -R a+rwx . >>"$LOGFILE" 2>&1
|
|
31
|
+
|
|
32
|
+
# Step 1: Reset and pull latest code
|
|
33
|
+
git pull
|
|
34
|
+
git push
|
|
35
|
+
git fetch
|
|
36
|
+
git checkout master >> "$LOGFILE" 2>&1
|
|
37
|
+
git reset --hard HEAD >> "$LOGFILE" 2>&1
|
|
38
|
+
git pull origin master >> "$LOGFILE" 2>&1
|
|
39
|
+
|
|
40
|
+
rm -rf apis models dist docs >> "$LOGFILE" 2>&1
|
|
41
|
+
rm deploy.log
|
|
42
|
+
# Step 2: Generate SDK
|
|
43
|
+
[ -f .gitignore ] && cp .gitignore .gitignore.backup
|
|
44
|
+
|
|
45
|
+
# Use the Authorization header from the request
|
|
46
|
+
openapi-generator-cli generate \
|
|
47
|
+
-i https://api-dev.drxapps.com/swagger.json \
|
|
48
|
+
-g typescript-fetch \
|
|
49
|
+
-o ./ \
|
|
50
|
+
--additional-properties=modelPropertyNaming=original \
|
|
51
|
+
--auth "Authorization:Basic%20ZHJ4OkRyeEAyMDI1" >> "$LOGFILE" 2>&1
|
|
52
|
+
|
|
53
|
+
# Restore .gitignore
|
|
54
|
+
[ -f .gitignore.backup ] && mv .gitignore.backup .gitignore
|
|
55
|
+
|
|
56
|
+
if [ $? -ne 0 ]; then
|
|
57
|
+
echo "❌ SDK generation failed at $(date)" >> "$LOGFILE"
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
echo "✅ SDK generated" >> "$LOGFILE"
|
|
61
|
+
|
|
62
|
+
# Step 3: Commit and push
|
|
63
|
+
git add . >> "$LOGFILE" 2>&1
|
|
64
|
+
git commit -m "VPS: Generated API SDK" >> "$LOGFILE" 2>&1
|
|
65
|
+
git push >> "$LOGFILE" 2>&1 || {
|
|
66
|
+
echo "❌ Git push failed at $(date)" >> "$LOGFILE"
|
|
67
|
+
exit 1
|
|
68
|
+
}
|
|
69
|
+
echo "✅ Changes committed and pushed" >> "$LOGFILE"
|
|
70
|
+
|
|
71
|
+
# Step 4: Version bump
|
|
72
|
+
npm version patch >> "$LOGFILE" 2>&1
|
|
73
|
+
git push >> "$LOGFILE" 2>&1 || {
|
|
74
|
+
echo "❌ Version push failed" >> "$LOGFILE"
|
|
75
|
+
exit 1
|
|
76
|
+
}
|
|
77
|
+
echo "✅ Version bumped" >> "$LOGFILE"
|
|
78
|
+
|
|
79
|
+
# Step 5: Publish to NPM
|
|
80
|
+
npm publish >> "$LOGFILE" 2>&1 || {
|
|
81
|
+
echo "❌ NPM publish failed" >> "$LOGFILE"
|
|
82
|
+
exit 1
|
|
83
|
+
}
|
|
84
|
+
echo "✅ Package published to NPM" >> "$LOGFILE"
|
|
85
|
+
|
|
86
|
+
echo "🎉 DONE: $(date)" >> "$LOGFILE"
|
|
87
|
+
|
|
88
|
+
) 9> "$LOCKFILE"
|