Skip to content

Commit f7bfa3b

Browse files
Merge pull request #822 from sparrowapp-dev/development
Merge development in to release-v2
2 parents a9a62e6 + fe54597 commit f7bfa3b

File tree

21 files changed

+827
-117
lines changed

21 files changed

+827
-117
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,6 @@ STAKEHOLDERS_EMAIL_LIST= # Comma-separated list of sparrow admin emails
128128
# [Self Host]
129129
SELF_HOST_ADMIN_EMAIL=
130130
SELF_HOST_ADMIN_PASSWORD=
131+
132+
# [Hub Domain]
133+
HUB_BASE_DOMAIN=yourdomain.com # Base domain for the hub (e.g., yourdomain.com)

deploymentManifests/deployment.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,11 @@ spec:
401401
secretKeyRef:
402402
name: sparrow-api-secret
403403
key: SELF_HOST_ADMIN_PASSWORD
404+
- name: HUB_BASE_DOMAIN
405+
valueFrom:
406+
secretKeyRef:
407+
name: sparrow-api-secret
408+
key: HUB_BASE_DOMAIN
404409

405410
---
406411
apiVersion: v1

deploymentManifests/release-v2.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,11 @@ spec:
370370
secretKeyRef:
371371
name: release-api-v2-secret
372372
key: SELF_HOST_ADMIN_PASSWORD
373+
- name: HUB_BASE_DOMAIN
374+
valueFrom:
375+
secretKeyRef:
376+
name: release-api-v2-secret
377+
key: HUB_BASE_DOMAIN
373378

374379
---
375380
apiVersion: v1

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "project-sparrow-api",
3-
"version": "2.31.0",
3+
"version": "2.32.0",
44
"description": "Backend APIs for Project Sparrow.",
55
"author": "techdome",
66
"license": "",

src/modules/common/config/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default () => ({
3232
userName: process.env.SMTP_USER_NAME,
3333
appEdition: process.env.APP_EDITION,
3434
selfHostHubPlan: "SelfHost(Community)",
35+
hubBaseDomain: process.env.HUB_BASE_DOMAIN || "sparrowhub.net",
3536
},
3637
db: {
3738
url: process.env.DB_URL,

src/modules/common/enum/topic.enum.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ export enum TOPIC {
88
AI_RESPONSE_GENERATED_TOPIC = "ai_response_generated_topic",
99
TEAM_DETAILS_UPDATED_TOPIC = "team_details_updated_topic",
1010
AI_ACTIVITY_LOG_TOPIC = "ai_activity_log_topic",
11-
AI_RESPONSE_GENERATED_MOCK_DATA="ai_response_generated_mock_data"
1211
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
export const fixTestScriptInstructions = `
2+
const expect = (actual: any) => ({
3+
to: {
4+
equal: (expected: any) => {
5+
6+
},
7+
notEqual: (expected: any) => {
8+
},
9+
exist: () => {
10+
11+
},
12+
notExist: () => {
13+
14+
},
15+
be: {
16+
a: (type: string) => {
17+
},
18+
true: () => {
19+
},
20+
false: () => {
21+
22+
23+
},
24+
within: (min: number, max: number) => {
25+
26+
},
27+
lessThan: (expected: number) => {
28+
},
29+
greaterThan: (expected: number) => {
30+
31+
},
32+
empty: () => {
33+
34+
},
35+
notEmpty: () => {
36+
37+
},
38+
},
39+
contain: (expected: any) => {
40+
41+
},
42+
notContain: (expected: any) => {
43+
44+
},
45+
beInList: (list: any[]) => {
46+
47+
},
48+
notBeInList: (list: any[]) => {
49+
50+
},
51+
have: {
52+
all: {
53+
keys: (...keys: string[]) => {
54+
55+
},
56+
},
57+
},
58+
},
59+
});
60+
61+
const sp = {
62+
response: {
63+
statusCode: number ,
64+
body: {
65+
text: () => {
66+
try {
67+
return string;
68+
} catch {
69+
return {};
70+
}
71+
},
72+
json: () => {
73+
try {
74+
return JSON.parse(string);
75+
} catch {
76+
return {};
77+
}
78+
},
79+
},
80+
headers: object,
81+
size: number,
82+
time: number,
83+
},
84+
test: (name: string, fn: Function) => {
85+
try {
86+
fn();
87+
} catch (err: any) {
88+
}
89+
},
90+
xmlToJSON: (xml: string) => {
91+
const json = {};
92+
// Convert XML to JSON logic here
93+
return json;
94+
},
95+
expect,
96+
};
97+
98+
- Fix testcases using above syntax,
99+
- Ensure all test cases are valid syntactically,
100+
- Dont use any other syntax or return any other text outside of the test cases.
101+
- Dont use any markdown or code snippet
102+
- Do not wrap the output in markdown, code fences, or labels (e.g., "javascript", "Here are...", etc.).
103+
- The model should return only raw JavaScript test cases in the correct syntax.
104+
- Unnecessary text like "Here are the corrected test cases:" are not required, its breaking the js syntax.
105+
- Dont give any introduction or ending phrase just give only the testcase.
106+
- Example format: '
107+
sp.test("userId is a number", function () {
108+
sp.expect(jsonBody.userId).to.be.a("number");
109+
});
110+
'
111+
`;
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
export const generateTestCasesInstructions = `
2+
const expect = (actual: any) => ({
3+
to: {
4+
equal: (expected: any) => {
5+
6+
},
7+
notEqual: (expected: any) => {
8+
},
9+
exist: () => {
10+
11+
},
12+
notExist: () => {
13+
14+
},
15+
be: {
16+
a: (type: string) => {
17+
},
18+
true: () => {
19+
},
20+
false: () => {
21+
22+
23+
},
24+
within: (min: number, max: number) => {
25+
26+
},
27+
lessThan: (expected: number) => {
28+
},
29+
greaterThan: (expected: number) => {
30+
31+
},
32+
empty: () => {
33+
34+
},
35+
notEmpty: () => {
36+
37+
},
38+
},
39+
contain: (expected: any) => {
40+
41+
},
42+
notContain: (expected: any) => {
43+
44+
},
45+
beInList: (list: any[]) => {
46+
47+
},
48+
notBeInList: (list: any[]) => {
49+
50+
},
51+
have: {
52+
all: {
53+
keys: (...keys: string[]) => {
54+
55+
},
56+
},
57+
},
58+
},
59+
});
60+
61+
const sp = {
62+
response: {
63+
statusCode: number ,
64+
body: {
65+
text: () => {
66+
try {
67+
return string;
68+
} catch {
69+
return {};
70+
}
71+
},
72+
json: () => {
73+
try {
74+
return JSON.parse(string);
75+
} catch {
76+
return {};
77+
}
78+
},
79+
},
80+
headers: object,
81+
size: number,
82+
time: number,
83+
},
84+
test: (name: string, fn: Function) => {
85+
try {
86+
fn();
87+
} catch (err: any) {
88+
}
89+
},
90+
xmlToJSON: (xml: string) => {
91+
const json = {};
92+
// Convert XML to JSON logic here
93+
return json;
94+
},
95+
expect,
96+
};
97+
98+
- create testcases using above syntax,
99+
- ensure all test cases are valid syntactically,
100+
- dont use any other syntax or return any other text outside of the test cases.
101+
- dont use any markdown or code snippet
102+
- dont wrap output in triple backticks or labels like "javascript", "js", etc.
103+
- Output must be ONLY the raw test cases in javascript format.
104+
- if user prompt is not valid then return
105+
- Example format: '
106+
sp.test("userId is a number", function () {
107+
sp.expect(jsonBody.userId).to.be.a("number");
108+
});
109+
'
110+
`;

src/modules/common/models/collection.model.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,10 @@ export class CollectionWithRequestTestsOption extends CollectionGenerateVariable
12421242
@IsOptional()
12431243
@IsBoolean()
12441244
isRequestTestsNoCodeDemoCompleted?: boolean;
1245+
1246+
@IsBoolean()
1247+
@IsOptional()
1248+
isRequestTestsScriptDemoCompleted?: boolean;
12451249
}
12461250

12471251
export class CollectionDto {

src/modules/common/models/user.model.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export class TourGuideDto {
4141
@IsBoolean()
4242
@IsOptional()
4343
isGenerateVariableDemoCompleted?: boolean;
44+
45+
@IsBoolean()
46+
@IsOptional()
47+
isRequestTestsScriptDemoCompleted?: boolean;
4448
}
4549

4650

@@ -150,7 +154,7 @@ export class User {
150154
@IsString({ each: true })
151155
@Type(() => String)
152156
isGenerateVariableTrial?: string[];
153-
157+
154158
@IsBoolean()
155159
@IsOptional()
156160
isSelfHostedVersionAdmin?: boolean;

0 commit comments

Comments
 (0)