@kispace-io/extension-github-service 0.8.1 → 0.8.2

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.
@@ -0,0 +1,6 @@
1
+ const githubServiceExtension = ({}) => {
2
+ };
3
+ export {
4
+ githubServiceExtension as default
5
+ };
6
+ //# sourceMappingURL=github-service-extension-Bwyvo7DZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-service-extension-Bwyvo7DZ.js","sources":["../src/github-service-extension.ts"],"sourcesContent":["export default ({ }: any) => {\n // GitHub service extension - exports are available via re-exports in api/services.ts\n}\n\n"],"names":[],"mappings":"AAAA,MAAA,yBAAe,CAAC,OAAa;AAE7B;"}
@@ -0,0 +1,3 @@
1
+ declare const _default: ({}: any) => void;
2
+ export default _default;
3
+ //# sourceMappingURL=github-service-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-service-extension.d.ts","sourceRoot":"","sources":["../src/github-service-extension.ts"],"names":[],"mappings":"yBAAgB,IAAK,GAAG;AAAxB,wBAEC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * GitHub API service for fetching release information
3
+ */
4
+ export interface GitHubRelease {
5
+ tag_name: string;
6
+ name: string;
7
+ body: string;
8
+ published_at: string;
9
+ html_url: string;
10
+ prerelease: boolean;
11
+ draft: boolean;
12
+ }
13
+ /**
14
+ * Get current GitHub repository configuration from the app definition.
15
+ * The github-service reads from the current app definition via appLoaderService.
16
+ * Looks for github info in app.metadata.github.
17
+ *
18
+ * @throws Error if GitHub repository is not configured in app metadata
19
+ */
20
+ export declare function getGitHubConfig(): {
21
+ owner: string;
22
+ repo: string;
23
+ };
24
+ /**
25
+ * Fetches all releases from GitHub (up to 100 most recent)
26
+ */
27
+ export declare function fetchReleases(perPage?: number): Promise<GitHubRelease[]>;
28
+ /**
29
+ * Fetches the latest release from GitHub
30
+ */
31
+ export declare function fetchLatestRelease(): Promise<GitHubRelease | null>;
32
+ /**
33
+ * Fetches a specific release by tag name
34
+ */
35
+ export declare function fetchReleaseByTag(tag: string): Promise<GitHubRelease | null>;
36
+ /**
37
+ * Compares two semantic versions
38
+ * Returns true if newVersion is greater than currentVersion
39
+ */
40
+ export declare function isNewerVersion(currentVersion: string, newVersion: string): boolean;
41
+ //# sourceMappingURL=github-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-service.d.ts","sourceRoot":"","sources":["../src/github-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,aAAa;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;CAClB;AAID;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CASjE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,MAAY,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAgBnF;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAgBxE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAgBlF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAgBlF"}
@@ -1,4 +1,4 @@
1
- {
1
+ declare const _default: {
2
2
  "namespace": "extensions",
3
3
  "en": {
4
4
  "EXT_GITHUB_SERVICE_NAME": "GitHub Service",
@@ -8,4 +8,6 @@
8
8
  "EXT_GITHUB_SERVICE_NAME": "GitHub-Service",
9
9
  "EXT_GITHUB_SERVICE_DESC": "GitHub-API-Service zum Abrufen von Release-Informationen"
10
10
  }
11
- }
11
+ };
12
+
13
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import { contributionRegistry, SYSTEM_LANGUAGE_BUNDLES, i18nLazy, extensionRegistry } from "@kispace-io/core";
2
+ const namespace = "extensions";
3
+ const en = { "EXT_GITHUB_SERVICE_NAME": "GitHub Service", "EXT_GITHUB_SERVICE_DESC": "GitHub API service for fetching release information" };
4
+ const de = { "EXT_GITHUB_SERVICE_NAME": "GitHub-Service", "EXT_GITHUB_SERVICE_DESC": "GitHub-API-Service zum Abrufen von Release-Informationen" };
5
+ const bundle = {
6
+ namespace,
7
+ en,
8
+ de
9
+ };
10
+ contributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle);
11
+ const t = i18nLazy("extensions");
12
+ extensionRegistry.registerExtension({
13
+ id: "system.github-service",
14
+ name: t("EXT_GITHUB_SERVICE_NAME"),
15
+ description: t("EXT_GITHUB_SERVICE_DESC"),
16
+ loader: () => import("./github-service-extension-Bwyvo7DZ.js"),
17
+ icon: "code-branch"
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry, i18nLazy, contributionRegistry, SYSTEM_LANGUAGE_BUNDLES } from '@kispace-io/core';\nimport bundle from './i18n.json';\n\ncontributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle as any);\n\nconst t = i18nLazy('extensions');\n\nextensionRegistry.registerExtension({\n id: \"system.github-service\",\n name: t('EXT_GITHUB_SERVICE_NAME'),\n description: t('EXT_GITHUB_SERVICE_DESC'),\n loader: () => import(\"./github-service-extension\"),\n icon: \"code-branch\",\n \n \n});\n"],"names":[],"mappings":";;;;;;;;;AAGA,qBAAqB,qBAAqB,yBAAyB,MAAa;AAEhF,MAAM,IAAI,SAAS,YAAY;AAE/B,kBAAkB,kBAAkB;AAAA,EAClC,IAAI;AAAA,EACJ,MAAM,EAAE,yBAAyB;AAAA,EACjC,aAAa,EAAE,yBAAyB;AAAA,EACxC,QAAQ,MAAM,OAAO,wCAA4B;AAAA,EACjD,MAAM;AAGR,CAAC;"}
package/package.json CHANGED
@@ -1,18 +1,28 @@
1
1
  {
2
2
  "name": "@kispace-io/extension-github-service",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
- "main": "./src/index.ts",
5
+ "main": "./dist/index.js",
6
6
  "exports": {
7
7
  ".": {
8
- "import": "./src/index.ts",
9
- "types": "./src/index.ts"
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
13
  "@kispace-io/core": "*"
14
14
  },
15
15
  "devDependencies": {
16
- "typescript": "^5.9.3"
16
+ "typescript": "^5.9.3",
17
+ "vite": "^7.1.12",
18
+ "vite-plugin-dts": "^4.5.4"
19
+ },
20
+ "module": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "build": "vite build"
17
27
  }
18
28
  }
@@ -1,4 +0,0 @@
1
- export default ({ }: any) => {
2
- // GitHub service extension - exports are available via re-exports in api/services.ts
3
- }
4
-
@@ -1,121 +0,0 @@
1
- /**
2
- * GitHub API service for fetching release information
3
- */
4
-
5
- import { appLoaderService } from '@kispace-io/core';
6
-
7
- export interface GitHubRelease {
8
- tag_name: string;
9
- name: string;
10
- body: string;
11
- published_at: string;
12
- html_url: string;
13
- prerelease: boolean;
14
- draft: boolean;
15
- }
16
-
17
- const GITHUB_API_BASE = 'https://api.github.com';
18
-
19
- /**
20
- * Get current GitHub repository configuration from the app definition.
21
- * The github-service reads from the current app definition via appLoaderService.
22
- * Looks for github info in app.metadata.github.
23
- *
24
- * @throws Error if GitHub repository is not configured in app metadata
25
- */
26
- export function getGitHubConfig(): { owner: string; repo: string } {
27
- const currentApp = appLoaderService.getCurrentApp();
28
- if (currentApp?.metadata?.github) {
29
- const github = currentApp.metadata.github;
30
- if (github.owner && github.repo) {
31
- return { owner: github.owner, repo: github.repo };
32
- }
33
- }
34
- throw new Error('GitHub repository not configured. Specify metadata.github in AppDefinition.');
35
- }
36
-
37
- /**
38
- * Fetches all releases from GitHub (up to 100 most recent)
39
- */
40
- export async function fetchReleases(perPage: number = 100): Promise<GitHubRelease[]> {
41
- try {
42
- const config = getGitHubConfig();
43
- const response = await fetch(
44
- `${GITHUB_API_BASE}/repos/${config.owner}/${config.repo}/releases?per_page=${perPage}`
45
- );
46
-
47
- if (!response.ok) {
48
- return [];
49
- }
50
-
51
- return await response.json();
52
- } catch (error) {
53
- console.error('Failed to fetch releases:', error);
54
- return [];
55
- }
56
- }
57
-
58
- /**
59
- * Fetches the latest release from GitHub
60
- */
61
- export async function fetchLatestRelease(): Promise<GitHubRelease | null> {
62
- try {
63
- const config = getGitHubConfig();
64
- const response = await fetch(
65
- `${GITHUB_API_BASE}/repos/${config.owner}/${config.repo}/releases/latest`
66
- );
67
-
68
- if (!response.ok) {
69
- return null;
70
- }
71
-
72
- return await response.json();
73
- } catch (error) {
74
- console.error('Failed to fetch latest release:', error);
75
- return null;
76
- }
77
- }
78
-
79
- /**
80
- * Fetches a specific release by tag name
81
- */
82
- export async function fetchReleaseByTag(tag: string): Promise<GitHubRelease | null> {
83
- try {
84
- const config = getGitHubConfig();
85
- const response = await fetch(
86
- `${GITHUB_API_BASE}/repos/${config.owner}/${config.repo}/releases/tags/${tag}`
87
- );
88
-
89
- if (!response.ok) {
90
- return null;
91
- }
92
-
93
- return await response.json();
94
- } catch (error) {
95
- console.error(`Failed to fetch release ${tag}:`, error);
96
- return null;
97
- }
98
- }
99
-
100
- /**
101
- * Compares two semantic versions
102
- * Returns true if newVersion is greater than currentVersion
103
- */
104
- export function isNewerVersion(currentVersion: string, newVersion: string): boolean {
105
- const cleanCurrent = currentVersion.replace(/^v/, '');
106
- const cleanNew = newVersion.replace(/^v/, '');
107
-
108
- const currentParts = cleanCurrent.split('.').map(Number);
109
- const newParts = cleanNew.split('.').map(Number);
110
-
111
- for (let i = 0; i < Math.max(currentParts.length, newParts.length); i++) {
112
- const current = currentParts[i] || 0;
113
- const newer = newParts[i] || 0;
114
-
115
- if (newer > current) return true;
116
- if (newer < current) return false;
117
- }
118
-
119
- return false;
120
- }
121
-
package/src/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { extensionRegistry, i18nLazy, contributionRegistry, SYSTEM_LANGUAGE_BUNDLES } from '@kispace-io/core';
2
- import bundle from './i18n.json';
3
-
4
- contributionRegistry.registerContribution(SYSTEM_LANGUAGE_BUNDLES, bundle as any);
5
-
6
- const t = i18nLazy('extensions');
7
-
8
- extensionRegistry.registerExtension({
9
- id: "system.github-service",
10
- name: t('EXT_GITHUB_SERVICE_NAME'),
11
- description: t('EXT_GITHUB_SERVICE_DESC'),
12
- loader: () => import("./github-service-extension"),
13
- icon: "code-branch",
14
-
15
-
16
- });
package/tsconfig.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "skipLibCheck": true
8
- },
9
- "include": [
10
- "src/**/*"
11
- ]
12
- }