qcobjectsnewapp 2.5.21-ts → 2.5.23-ts
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/VERSION +1 -1
- package/package.json +1 -2
- package/public/js/init.js +20 -20
- package/public/js/init.js.map +3 -3
- package/public/js/packages/com.qcobjects.services.github.js +4 -4
- package/public/js/packages/com.qcobjects.services.github.js.map +3 -3
- package/public/js/packages/org.quickcorp.custom.js +20 -20
- package/public/js/packages/org.quickcorp.custom.js.map +3 -3
- package/src/js/packages/com.qcobjects.services.github.ts +173 -148
|
@@ -33,156 +33,181 @@ type ItemProject = {
|
|
|
33
33
|
};
|
|
34
34
|
type ItemsProject = Array<ItemProject>;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return super.done({ request, service });
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
class GitHubTagService extends JSONService {
|
|
121
|
-
name = "myservice";
|
|
122
|
-
external = true;
|
|
123
|
-
cached = false;
|
|
124
|
-
method = "GET";
|
|
125
|
-
headers = { "Content-Type": "application/json", "charset": "utf-8" };
|
|
126
|
-
url = "https://api.github.com/search/repositories?q=qcobjects";
|
|
127
|
-
withCredentials = false;
|
|
128
|
-
|
|
129
|
-
done({ request, service }: StandardResponse) {
|
|
130
|
-
logger.debug(String(request));
|
|
131
|
-
const result:ItemsProject = (JSON.parse(service.template as string) as GitHubTagServiceResponse)
|
|
132
|
-
.items.map(function (project: Project) {
|
|
133
|
-
return {
|
|
134
|
-
id: project.id,
|
|
135
|
-
description: project.description,
|
|
136
|
-
title: project.name,
|
|
137
|
-
url: project.html_url,
|
|
138
|
-
repo_stargazers_count: project.stargazers_count,
|
|
139
|
-
repo_watchers_count: project.watchers_count
|
|
140
|
-
};
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
service.template = JSON.stringify({
|
|
144
|
-
result
|
|
145
|
-
});
|
|
146
|
-
return super.done({ request, service });
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
class QCObjectsVersionService extends Service {
|
|
151
|
-
name = "qcobjects_version_service";
|
|
152
|
-
external = true;
|
|
153
|
-
cached = false;
|
|
154
|
-
method = "GET";
|
|
155
|
-
headers = { "Content-Type": "application/json", "charset": "utf-8" };
|
|
156
|
-
url = "https://api.github.com/repos/QuickCorp/QCObjects/tags";
|
|
157
|
-
withCredentials = false;
|
|
158
|
-
|
|
159
|
-
done({ service }: StandardResponse) {
|
|
160
|
-
const latest = JSON.parse(service.template as string)[0];
|
|
161
|
-
service.template = {
|
|
162
|
-
version: latest.name
|
|
36
|
+
export class GitHubService extends JSONService {
|
|
37
|
+
/**
|
|
38
|
+
* Name of the service
|
|
39
|
+
* @date 18/04/2023 - 22:30:07
|
|
40
|
+
*
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
name = "myservice";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* It specifies if the service has a external url. If true, you can pass absolute urls in url property
|
|
47
|
+
* @date 18/04/2023 - 22:30:37
|
|
48
|
+
*
|
|
49
|
+
* @type {boolean}
|
|
50
|
+
*/
|
|
51
|
+
external = true;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* If it is true, the service call will be cached
|
|
55
|
+
* @date 18/04/2023 - 22:31:41
|
|
56
|
+
*
|
|
57
|
+
* @type {boolean}
|
|
58
|
+
*/
|
|
59
|
+
cached = false;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* It can be GET, POST, PUT
|
|
63
|
+
* @date 18/04/2023 - 22:32:29
|
|
64
|
+
*
|
|
65
|
+
* @type {string}
|
|
66
|
+
*/
|
|
67
|
+
method = "GET";
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* You can add special headers using this property
|
|
71
|
+
* @date 18/04/2023 - 22:33:20
|
|
72
|
+
*
|
|
73
|
+
* @type {{ "Content-Type": string; }}
|
|
74
|
+
*/
|
|
75
|
+
headers = { "Content-Type": "application/json", "charset": "utf-8" };
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* URL for the service call
|
|
79
|
+
* @date 18/04/2023 - 22:34:09
|
|
80
|
+
*
|
|
81
|
+
* @type {string}
|
|
82
|
+
*/
|
|
83
|
+
url = "https://api.github.com/orgs/QuickCorp/repos";
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* This is used internally for XHR requests. Default value is false.
|
|
87
|
+
* @date 18/04/2023 - 22:34:29
|
|
88
|
+
*
|
|
89
|
+
* @type {boolean}
|
|
90
|
+
*/
|
|
91
|
+
withCredentials = false;
|
|
92
|
+
|
|
93
|
+
constructor() {
|
|
94
|
+
super();
|
|
95
|
+
// Remove charset header to avoid CORS preflight issues with external APIs
|
|
96
|
+
// (charset is not a CORS-safelisted request header)
|
|
97
|
+
delete this.headers.charset;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* It is called once the service call is done
|
|
102
|
+
* @param param0 this param has two properties, one is the native request call (XHR or Fetch object). The second property is the service object.
|
|
103
|
+
* @returns Promise
|
|
104
|
+
*/
|
|
105
|
+
done({ request, service }: StandardResponse) {
|
|
106
|
+
|
|
107
|
+
const result:ItemsProject = (JSON.parse(service.template as string) as Array<Project>)
|
|
108
|
+
.reverse().map(function (project: Project) {
|
|
109
|
+
return {
|
|
110
|
+
id: project.id,
|
|
111
|
+
description: project.description,
|
|
112
|
+
title: project.name,
|
|
113
|
+
url: project.html_url,
|
|
114
|
+
repo_stargazers_count: project.stargazers_count,
|
|
115
|
+
repo_watchers_count: project.watchers_count
|
|
163
116
|
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
service.template = JSON.stringify({
|
|
120
|
+
result
|
|
121
|
+
});
|
|
122
|
+
return super.done({ request, service });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export class GitHubTagService extends JSONService {
|
|
127
|
+
name = "myservice";
|
|
128
|
+
external = true;
|
|
129
|
+
cached = false;
|
|
130
|
+
method = "GET";
|
|
131
|
+
headers = { "Content-Type": "application/json", "charset": "utf-8" };
|
|
132
|
+
url = "https://api.github.com/search/repositories?q=qcobjects";
|
|
133
|
+
withCredentials = false;
|
|
134
|
+
|
|
135
|
+
constructor() {
|
|
136
|
+
super();
|
|
137
|
+
delete this.headers.charset;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
done({ request, service }: StandardResponse) {
|
|
141
|
+
logger.debug(String(request));
|
|
142
|
+
const result:ItemsProject = (JSON.parse(service.template as string) as GitHubTagServiceResponse)
|
|
143
|
+
.items.map(function (project: Project) {
|
|
144
|
+
return {
|
|
145
|
+
id: project.id,
|
|
146
|
+
description: project.description,
|
|
147
|
+
title: project.name,
|
|
148
|
+
url: project.html_url,
|
|
149
|
+
repo_stargazers_count: project.stargazers_count,
|
|
150
|
+
repo_watchers_count: project.watchers_count
|
|
184
151
|
};
|
|
185
|
-
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
service.template = JSON.stringify({
|
|
155
|
+
result
|
|
156
|
+
});
|
|
157
|
+
return super.done({ request, service });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export class QCObjectsVersionService extends Service {
|
|
162
|
+
name = "qcobjects_version_service";
|
|
163
|
+
external = true;
|
|
164
|
+
cached = false;
|
|
165
|
+
method = "GET";
|
|
166
|
+
headers = { "Content-Type": "application/json", "charset": "utf-8" };
|
|
167
|
+
url = "https://api.github.com/repos/QuickCorp/QCObjects/tags";
|
|
168
|
+
withCredentials = false;
|
|
169
|
+
|
|
170
|
+
constructor() {
|
|
171
|
+
super();
|
|
172
|
+
delete this.headers.charset;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
done({ service }: StandardResponse) {
|
|
176
|
+
const latest = JSON.parse(service.template as string)[0];
|
|
177
|
+
service.template = {
|
|
178
|
+
version: latest.name
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
186
182
|
|
|
183
|
+
export class QCObjectsStarsForksService extends Service {
|
|
184
|
+
name = "qcobjects_stars_forks_service";
|
|
185
|
+
external = true;
|
|
186
|
+
cached = false;
|
|
187
|
+
method = "GET";
|
|
188
|
+
headers = { "Content-Type": "application/json", "charset": "utf-8" };
|
|
189
|
+
url = "https://api.github.com/repos/QuickCorp/QCObjects";
|
|
190
|
+
withCredentials = false;
|
|
191
|
+
|
|
192
|
+
constructor() {
|
|
193
|
+
super();
|
|
194
|
+
delete this.headers.charset;
|
|
187
195
|
}
|
|
196
|
+
|
|
197
|
+
done({ service }: StandardResponse) {
|
|
198
|
+
const repo:Project = (JSON.parse(service.template as string) as Project);
|
|
199
|
+
service.template = {
|
|
200
|
+
forks: repo.forks_count,
|
|
201
|
+
stars: repo.stargazers_count,
|
|
202
|
+
watchers: repo.watchers_count,
|
|
203
|
+
size: Math.round(repo.size / 1000)
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
Package("com.qcobjects.services.github", [
|
|
209
|
+
GitHubService,
|
|
210
|
+
GitHubTagService,
|
|
211
|
+
QCObjectsVersionService,
|
|
212
|
+
QCObjectsStarsForksService
|
|
188
213
|
]);
|