@drxsuperapp/sdk 1.1.342 → 1.1.343
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/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/deploy.log +0 -1006
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"
|