create-ones-app 0.0.7 → 0.0.8

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.
Files changed (136) hide show
  1. package/LICENSE +201 -0
  2. package/dist/index.cjs +7087 -22
  3. package/dist/index.js +7091 -26
  4. package/dist/types/actions/create/index.d.ts +3 -0
  5. package/dist/types/actions/create/index.d.ts.map +1 -0
  6. package/dist/types/actions/create/normalize.d.ts +6 -0
  7. package/dist/types/actions/create/normalize.d.ts.map +1 -0
  8. package/dist/types/actions/index.d.ts +5 -0
  9. package/dist/types/actions/index.d.ts.map +1 -0
  10. package/dist/types/cli/index.d.ts +2 -0
  11. package/dist/types/cli/index.d.ts.map +1 -0
  12. package/dist/types/command/create/index.d.ts +9 -0
  13. package/dist/types/command/create/index.d.ts.map +1 -0
  14. package/dist/types/command/index.d.ts +5 -0
  15. package/dist/types/command/index.d.ts.map +1 -0
  16. package/dist/types/common/command/index.d.ts +6 -0
  17. package/dist/types/common/command/index.d.ts.map +1 -0
  18. package/dist/types/common/command/types.d.ts +10 -0
  19. package/dist/types/common/command/types.d.ts.map +1 -0
  20. package/dist/types/common/command/utils.d.ts +8 -0
  21. package/dist/types/common/command/utils.d.ts.map +1 -0
  22. package/dist/types/common/context/index.d.ts +6 -0
  23. package/dist/types/common/context/index.d.ts.map +1 -0
  24. package/dist/types/common/context/types.d.ts +6 -0
  25. package/dist/types/common/context/types.d.ts.map +1 -0
  26. package/dist/types/common/context/utils.d.ts +4 -0
  27. package/dist/types/common/context/utils.d.ts.map +1 -0
  28. package/dist/types/common/error/enums.d.ts +7 -0
  29. package/dist/types/common/error/enums.d.ts.map +1 -0
  30. package/dist/types/common/error/index.d.ts +7 -0
  31. package/dist/types/common/error/index.d.ts.map +1 -0
  32. package/dist/types/common/error/types.d.ts +2 -0
  33. package/dist/types/common/error/types.d.ts.map +1 -0
  34. package/dist/types/common/error/utils.d.ts +2 -0
  35. package/dist/types/common/error/utils.d.ts.map +1 -0
  36. package/dist/types/common/locales/en/index.d.ts +10 -0
  37. package/dist/types/common/locales/en/index.d.ts.map +1 -0
  38. package/dist/types/common/locales/index.d.ts +6 -0
  39. package/dist/types/common/locales/index.d.ts.map +1 -0
  40. package/dist/types/common/locales/types.d.ts +4 -0
  41. package/dist/types/common/locales/types.d.ts.map +1 -0
  42. package/dist/types/common/locales/utils.d.ts +6 -0
  43. package/dist/types/common/locales/utils.d.ts.map +1 -0
  44. package/dist/types/common/package/consts.d.ts +6 -0
  45. package/dist/types/common/package/consts.d.ts.map +1 -0
  46. package/dist/types/common/package/index.d.ts +8 -0
  47. package/dist/types/common/package/index.d.ts.map +1 -0
  48. package/dist/types/common/package/schema.d.ts +345 -0
  49. package/dist/types/common/package/schema.d.ts.map +1 -0
  50. package/dist/types/common/package/types.d.ts.map +1 -0
  51. package/dist/types/common/package/utils.d.ts +5 -0
  52. package/dist/types/common/package/utils.d.ts.map +1 -0
  53. package/dist/types/common/public/consts.d.ts +5 -0
  54. package/dist/types/common/public/consts.d.ts.map +1 -0
  55. package/dist/types/common/public/index.d.ts +6 -0
  56. package/dist/types/common/public/index.d.ts.map +1 -0
  57. package/dist/types/common/public/utils.d.ts +2 -0
  58. package/dist/types/common/public/utils.d.ts.map +1 -0
  59. package/dist/types/common/template/index.d.ts +5 -0
  60. package/dist/types/common/template/index.d.ts.map +1 -0
  61. package/dist/types/common/template/utils.d.ts +4 -0
  62. package/dist/types/common/template/utils.d.ts.map +1 -0
  63. package/dist/types/index.d.ts +11 -1
  64. package/dist/types/index.d.ts.map +1 -1
  65. package/package.json +26 -5
  66. package/public/.onesrc.json +9 -0
  67. package/public/app_opkx_schema.json +566 -0
  68. package/public/logos/logo-bulb.svg +20 -0
  69. package/public/logos/logo-check.svg +18 -0
  70. package/public/logos/logo-claude.svg +19 -0
  71. package/public/logos/logo-claw.svg +23 -0
  72. package/public/logos/logo-gear.svg +18 -0
  73. package/public/logos/logo-gemini.svg +19 -0
  74. package/public/logos/logo-haiper.svg +19 -0
  75. package/public/logos/logo-lightning.svg +19 -0
  76. package/public/logos/logo-manus.svg +21 -0
  77. package/public/logos/logo-new-api.svg +21 -0
  78. package/public/logos/logo-puzzle.svg +19 -0
  79. package/public/logos/logo-trae.svg +19 -0
  80. package/public/logos/logo-user.svg +20 -0
  81. package/public/opkx.json +21 -0
  82. package/template/example/.template.json +1 -1
  83. package/template/example/AGENTS.md +92 -103
  84. package/template/example/LICENSE +201 -0
  85. package/template/example/README.md +1 -84
  86. package/template/example/_eslint.config.mjs_ +39 -0
  87. package/template/example/_gitignore +23 -0
  88. package/template/example/_husky_pre-commit +1 -0
  89. package/template/example/_prettierignore +11 -0
  90. package/template/example/_prettierrc +6 -0
  91. package/template/example/_tsconfig.json +8 -0
  92. package/template/example/backend/app.controller.ts +85 -0
  93. package/template/example/backend/app.module.ts +34 -0
  94. package/template/example/backend/app.service.ts +46 -0
  95. package/template/example/backend/dto/issue-created-event.dto.ts +29 -0
  96. package/template/example/backend/dto/recent-work-item.dto.ts +11 -0
  97. package/template/example/backend/main.ts +10 -0
  98. package/template/example/backend/proxy.ts +46 -0
  99. package/template/example/backend/services/recent-work-items.service.ts +84 -0
  100. package/template/example/backend/utils.ts +41 -0
  101. package/template/example/nest-cli.json +8 -0
  102. package/template/example/opkx.json +106 -0
  103. package/template/example/package-lock.json +12699 -0
  104. package/template/example/package.json +84 -0
  105. package/template/example/postcss.config.js +10 -0
  106. package/template/example/public/assets/loading.png +0 -0
  107. package/template/example/public/favicon.ico +0 -0
  108. package/template/example/public/i18n/en.json +17 -0
  109. package/template/example/public/i18n/zh.json +17 -0
  110. package/template/example/public/normalize.css@8.0.1/normalize.css +349 -0
  111. package/template/example/tsconfig.backend.json +34 -0
  112. package/template/example/tsconfig.build.json +3 -0
  113. package/template/example/tsconfig.vite.json +34 -0
  114. package/template/example/tsconfig.web.json +39 -0
  115. package/template/example/vite.config.ts +286 -0
  116. package/template/example/web/pages/recent-work-items/index.css +131 -0
  117. package/template/example/web/pages/recent-work-items/index.tsx +265 -0
  118. package/template/example/web/template/index.html +65 -0
  119. package/dist/types/action.d.ts +0 -2
  120. package/dist/types/action.d.ts.map +0 -1
  121. package/dist/types/types.d.ts.map +0 -1
  122. package/dist/types/utils.d.ts +0 -7
  123. package/dist/types/utils.d.ts.map +0 -1
  124. package/template/example/netlify/functions/app_manifest.js +0 -90
  125. package/template/example/netlify/functions/app_setting_pages.js +0 -48
  126. package/template/example/netlify/functions/events.js +0 -35
  127. package/template/example/netlify/functions/install.js +0 -35
  128. package/template/example/netlify/functions/metadata.js +0 -37
  129. package/template/example/netlify.toml +0 -44
  130. package/template/example/public/index.html +0 -20
  131. package/template/example/public/logo.svg +0 -4
  132. package/template/example/public/script.js +0 -56
  133. package/template/example/public/style.css +0 -66
  134. package/template/example/types/app_manifest.d.ts +0 -115
  135. package/template/example/types/app_setting_pages.d.ts +0 -14
  136. /package/dist/types/{types.d.ts → common/package/types.d.ts} +0 -0
@@ -0,0 +1,65 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Document</title>
7
+ <style type="text/css">
8
+ #root {
9
+ width: 100%;
10
+ height: 100%;
11
+ overflow: hidden;
12
+ position: relative;
13
+ }
14
+ .ones-app-loading-mask {
15
+ top: 0;
16
+ left: 0;
17
+ right: 0;
18
+ bottom: 0;
19
+ width: 100%;
20
+ height: 100%;
21
+ position: absolute;
22
+ background: #fff;
23
+ }
24
+ .ones-app-loading-block {
25
+ top: 0;
26
+ left: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ width: 32px;
30
+ height: 32px;
31
+ margin: auto;
32
+ position: absolute;
33
+ }
34
+ .ones-app-loading-item {
35
+ width: 100%;
36
+ height: 100%;
37
+ box-sizing: border-box;
38
+ border: solid 2px transparent;
39
+ border-top-color: #0064ff;
40
+ border-left-color: #0064ff;
41
+ border-radius: 50%;
42
+ animation: ones-app-loading-spin 400ms linear infinite;
43
+ }
44
+ @keyframes ones-app-loading-spin {
45
+ 0% {
46
+ transform: rotate(0deg);
47
+ }
48
+ 100% {
49
+ transform: rotate(360deg);
50
+ }
51
+ }
52
+ </style>
53
+ <link rel="stylesheet" href="../../public/normalize.css@8.0.1/normalize.css">
54
+ </head>
55
+ <body>
56
+ <div id="root"></div>
57
+ <div class="ones-app-loading">
58
+ <div class="ones-app-loading-mask"></div>
59
+ <div class="ones-app-loading-block">
60
+ <div class="ones-app-loading-item"></div>
61
+ </div>
62
+ </div>
63
+ <!-- SCRIPT -->
64
+ </body>
65
+ </html>
@@ -1,2 +0,0 @@
1
- export declare const action: (value: string) => Promise<void>;
2
- //# sourceMappingURL=action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM,UAAiB,MAAM,kBASzC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
@@ -1,7 +0,0 @@
1
- import type { PackageJSON } from './types';
2
- export declare const getPackageJSONPath: () => string;
3
- export declare const getTemplatePath: () => string;
4
- export declare const getPackageJSON: () => PackageJSON;
5
- export declare const getTemplateChoices: () => string[];
6
- export declare const getTemplateDefault: () => string;
7
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,eAAO,MAAM,kBAAkB,cAG9B,CAAA;AAED,eAAO,MAAM,eAAe,cAG3B,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,WAUjC,CAAA;AAED,eAAO,MAAM,kBAAkB,gBAG9B,CAAA;AAED,eAAO,MAAM,kBAAkB,cAE9B,CAAA"}
@@ -1,90 +0,0 @@
1
- /** @type { import("../../types/app_manifest.d.ts").AppManifest } */
2
- const example = {
3
- // Required fields
4
- id: 'app_0123456789abcdef',
5
- name: 'ONES App',
6
- version: 'v1.0.0',
7
- base_url: 'https://your-domain',
8
- auth: {
9
- type: 'jwt',
10
- },
11
- lifecycle_callback: {
12
- install: '/api/install',
13
- },
14
-
15
- // Optional fields
16
- desc: 'ONES App example with some features.',
17
- logo: 'https://your-domain/logo.png',
18
-
19
- // Event configuration
20
- events: {
21
- url: '/api/events',
22
- types: [{ eventType: 'ones:project:issue:created' }],
23
- },
24
-
25
- // Extension configuration
26
- extensions: {
27
- appSettingPages: [
28
- {
29
- key: 'myCustomEntries',
30
- funcs: {
31
- customEntries: '/api/app_setting_pages',
32
- },
33
- },
34
- ],
35
- },
36
-
37
- // OAuth configuration
38
- oauth: {
39
- scope: ['read:project:project'],
40
- type: ['app', 'user'],
41
- },
42
- }
43
-
44
- exports.handler = async (req) => {
45
- // Set CORS headers to allow cross-origin requests
46
- const headers = {
47
- 'Access-Control-Allow-Origin': '*',
48
- 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
49
- 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
50
- 'Content-Type': 'application/json',
51
- }
52
-
53
- // Handle preflight requests
54
- if (req.httpMethod === 'OPTIONS') {
55
- return {
56
- statusCode: 200,
57
- headers,
58
- body: '',
59
- }
60
- }
61
-
62
- try {
63
- // Get host from request headers
64
- const host = req.headers.host
65
-
66
- // Clone data from example
67
- const data = JSON.parse(JSON.stringify(example))
68
-
69
- // Update data's base_url field with host
70
- data.base_url = `https://${host}`
71
-
72
- // Update data's logo field with logo.svg
73
- data.logo = `https://${host}/logo.svg`
74
-
75
- return {
76
- statusCode: 200,
77
- headers,
78
- body: JSON.stringify(data),
79
- }
80
- } catch (error) {
81
- return {
82
- statusCode: 500,
83
- headers,
84
- body: JSON.stringify({
85
- error: 'Server Error',
86
- message: error.message,
87
- }),
88
- }
89
- }
90
- }
@@ -1,48 +0,0 @@
1
- /** @type { import("../../types/app_setting_pages.d.ts").AppSettingPages } */
2
- const example = {
3
- entries: [
4
- {
5
- page_url: '/',
6
- title: 'Example Page',
7
- },
8
- ],
9
- }
10
-
11
- exports.handler = async (req) => {
12
- // Set CORS headers to allow cross-origin requests
13
- const headers = {
14
- 'Access-Control-Allow-Origin': '*',
15
- 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
16
- 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
17
- 'Content-Type': 'application/json',
18
- }
19
-
20
- // Handle preflight requests
21
- if (req.httpMethod === 'OPTIONS') {
22
- return {
23
- statusCode: 200,
24
- headers,
25
- body: '',
26
- }
27
- }
28
-
29
- try {
30
- // Clone data from example
31
- const data = JSON.parse(JSON.stringify(example))
32
-
33
- return {
34
- statusCode: 200,
35
- headers,
36
- body: JSON.stringify(data),
37
- }
38
- } catch (error) {
39
- return {
40
- statusCode: 500,
41
- headers,
42
- body: JSON.stringify({
43
- error: 'Server Error',
44
- message: error.message,
45
- }),
46
- }
47
- }
48
- }
@@ -1,35 +0,0 @@
1
- exports.handler = async (req) => {
2
- // Set CORS headers to allow cross-origin requests
3
- const headers = {
4
- 'Access-Control-Allow-Origin': '*',
5
- 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
6
- 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
7
- 'Content-Type': 'application/json',
8
- }
9
-
10
- // Handle preflight requests
11
- if (req.httpMethod === 'OPTIONS') {
12
- return {
13
- statusCode: 200,
14
- headers,
15
- body: '',
16
- }
17
- }
18
-
19
- try {
20
- return {
21
- statusCode: 200,
22
- headers,
23
- body: JSON.stringify({}),
24
- }
25
- } catch (error) {
26
- return {
27
- statusCode: 500,
28
- headers,
29
- body: JSON.stringify({
30
- error: 'Server Error',
31
- message: error.message,
32
- }),
33
- }
34
- }
35
- }
@@ -1,35 +0,0 @@
1
- exports.handler = async (req) => {
2
- // Set CORS headers to allow cross-origin requests
3
- const headers = {
4
- 'Access-Control-Allow-Origin': '*',
5
- 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
6
- 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
7
- 'Content-Type': 'application/json',
8
- }
9
-
10
- // Handle preflight requests
11
- if (req.httpMethod === 'OPTIONS') {
12
- return {
13
- statusCode: 200,
14
- headers,
15
- body: '',
16
- }
17
- }
18
-
19
- try {
20
- return {
21
- statusCode: 200,
22
- headers,
23
- body: JSON.stringify({}),
24
- }
25
- } catch (error) {
26
- return {
27
- statusCode: 500,
28
- headers,
29
- body: JSON.stringify({
30
- error: 'Server Error',
31
- message: error.message,
32
- }),
33
- }
34
- }
35
- }
@@ -1,37 +0,0 @@
1
- exports.handler = async (req) => {
2
- // Set CORS headers to allow cross-origin requests
3
- const headers = {
4
- 'Access-Control-Allow-Origin': '*',
5
- 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
6
- 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
7
- 'Content-Type': 'application/json',
8
- }
9
-
10
- // Handle preflight requests
11
- if (req.httpMethod === 'OPTIONS') {
12
- return {
13
- statusCode: 200,
14
- headers,
15
- body: '',
16
- }
17
- }
18
-
19
- try {
20
- return {
21
- statusCode: 200,
22
- headers,
23
- body: JSON.stringify({
24
- metadata: 'example metadata',
25
- }),
26
- }
27
- } catch (error) {
28
- return {
29
- statusCode: 500,
30
- headers,
31
- body: JSON.stringify({
32
- error: 'Server Error',
33
- message: error.message,
34
- }),
35
- }
36
- }
37
- }
@@ -1,44 +0,0 @@
1
- [build]
2
- # Publish directory
3
- publish = "public"
4
-
5
- # Build command
6
- command = "echo 'Static site - no build required'"
7
-
8
- [build.environment]
9
- # Node.js version
10
- NODE_VERSION = "20"
11
-
12
- # Functions
13
- [functions]
14
- directory = "netlify/functions"
15
- node_bundler = "esbuild"
16
-
17
- # Redirect rules (optional)
18
- [[redirects]]
19
- from = "/api/*"
20
- to = "/.netlify/functions/:splat"
21
- status = 200
22
-
23
- # CORS headers for all static assets
24
- [[headers]]
25
- for = "/*"
26
- [headers.values]
27
- Access-Control-Allow-Origin = "*"
28
- Access-Control-Allow-Methods = "GET, POST, PUT, DELETE, OPTIONS"
29
- Access-Control-Allow-Headers = "Content-Type, Authorization, X-Requested-With"
30
-
31
- # Security headers for all files
32
- [[headers]]
33
- for = "/*"
34
- [headers.values]
35
- X-Frame-Options = "DENY"
36
- X-XSS-Protection = "1; mode=block"
37
- X-Content-Type-Options = "nosniff"
38
- Referrer-Policy = "strict-origin-when-cross-origin"
39
-
40
- # Cache settings for static assets
41
- [[headers]]
42
- for = "/static/*"
43
- [headers.values]
44
- Cache-Control = "public, max-age=31536000"
@@ -1,20 +0,0 @@
1
- <!doctype html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Hello World - Netlify</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="container">
11
- <h1>Hello World!</h1>
12
- <p>欢迎来到 Netlify 部署的 ONES 应用</p>
13
- <button id="app-api-button" class="api-button">调用 App API 接口</button>
14
- <button id="open-api-button" class="api-button">使用 Open API 接口</button>
15
- <div id="result" class="result" style="display: none"></div>
16
- </div>
17
- <script src="https://unpkg.com/@ones-open/sdk/dist/index.iife.js"></script>
18
- <script src="script.js"></script>
19
- </body>
20
- </html>
@@ -1,4 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="16" height="16" rx="2" fill="#0064FF"/>
3
- <path fill-rule="evenodd" clip-rule="evenodd" d="M7.43816 2.66672C6.82458 2.66672 6.31279 3.17606 6.31279 3.82228V4.4445C6.31279 4.68996 6.11381 4.88894 5.86835 4.88894H3.55556V6.70091H4.56017C5.68056 6.70091 6.57443 7.62426 6.57443 8.74535C6.57443 9.83706 5.70842 10.8718 4.56017 10.8718H3.55556V12.4445H10.6667V10.4274C10.6667 10.1819 10.8657 9.98296 11.1111 9.98296H12.208C12.7937 9.98296 13.3333 9.42095 13.3333 8.74535C13.3333 8.09914 12.8215 7.5898 12.208 7.5898H11.1111C10.8657 7.5898 10.6667 7.39081 10.6667 7.14535V4.88894H9.00797C8.76251 4.88894 8.56353 4.68996 8.56353 4.4445V3.82228C8.56353 3.17606 8.05174 2.66672 7.43816 2.66672ZM5.4239 3.82228C5.4239 2.70118 6.31778 1.77783 7.43816 1.77783C8.55854 1.77783 9.45242 2.70118 9.45242 3.82228V4.00005H11.1111C11.3566 4.00005 11.5556 4.19904 11.5556 4.4445V6.70091H12.208C13.3284 6.70091 14.2222 7.62426 14.2222 8.74535C14.2222 9.83706 13.3562 10.8718 12.208 10.8718H11.5556V12.8889C11.5556 13.1344 11.3566 13.3334 11.1111 13.3334H3.11112C2.86566 13.3334 2.66667 13.1344 2.66667 12.8889V10.4274C2.66667 10.1819 2.86566 9.98296 3.11112 9.98296H4.56017C5.14589 9.98296 5.68554 9.42095 5.68554 8.74535C5.68554 8.09914 5.17375 7.5898 4.56017 7.5898H3.11112C2.86566 7.5898 2.66667 7.39081 2.66667 7.14535V4.4445C2.66667 4.32662 2.7135 4.21358 2.79685 4.13023C2.8802 4.04688 2.99324 4.00005 3.11112 4.00005H5.4239V3.82228Z" fill="white"/>
4
- </svg>
@@ -1,56 +0,0 @@
1
- ;(function () {
2
- 'use strict'
3
-
4
- if (!window.SDK) {
5
- console.error('Web SDK not initialized')
6
- // see: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/web-sdk/#21-use-via-external-script
7
- return
8
- }
9
-
10
- if (!window.SDK.ONES) {
11
- console.error('Web SDK is only supported on ONES extension context')
12
- // see: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/guide/getting-started/app-capabilities/app-extensions
13
- return
14
- }
15
-
16
- console.log('Web SDK initialized successfully')
17
-
18
- // Get DOM elements
19
- const appApiButton = document.getElementById('app-api-button')
20
- const openApiButton = document.getElementById('open-api-button')
21
-
22
- // App API button click handler
23
- appApiButton.addEventListener('click', async function () {
24
- const resultDiv = document.getElementById('result')
25
- resultDiv.style.display = 'block'
26
- resultDiv.innerHTML = '<div class="loading">正在调用 App API...</div>'
27
-
28
- try {
29
- // see: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/web-sdk/fetch-app
30
- const response = await window.SDK.ONES.fetchApp('/api/metadata')
31
- const data = await response.json()
32
- resultDiv.innerHTML = `App API 响应:\n${JSON.stringify(data, null, 2)}`
33
- } catch (error) {
34
- resultDiv.innerHTML = `App API 错误: ${error.message}`
35
- }
36
- })
37
-
38
- // Open API button click handler
39
- openApiButton.addEventListener('click', async function () {
40
- const resultDiv = document.getElementById('result')
41
- resultDiv.style.display = 'block'
42
- resultDiv.innerHTML = '<div class="loading">正在调用 Open API...</div>'
43
-
44
- try {
45
- // see: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/web-sdk/get-team-info
46
- const teamInfo = await window.SDK.ONES.getTeamInfo()
47
- const teamUUID = teamInfo.teamUUID
48
- // see: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/web-sdk/fetch-openapi
49
- const response = await window.SDK.ONES.fetchOpenAPI(`/v2/project/projects?teamID=${teamUUID}`)
50
- const data = await response.json()
51
- resultDiv.innerHTML = `Open API 响应:\n${JSON.stringify(data, null, 2)}`
52
- } catch (error) {
53
- resultDiv.innerHTML = `Open API 错误: ${error.message}`
54
- }
55
- })
56
- })()
@@ -1,66 +0,0 @@
1
- body {
2
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
3
- margin: 0;
4
- padding: 0;
5
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
6
- min-height: 100vh;
7
- display: flex;
8
- align-items: center;
9
- justify-content: center;
10
- }
11
-
12
- .container {
13
- text-align: center;
14
- background: white;
15
- padding: 3rem;
16
- border-radius: 20px;
17
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
18
- max-width: 600px;
19
- margin: 2rem;
20
- }
21
-
22
- h1 {
23
- color: #333;
24
- font-size: 3rem;
25
- margin-bottom: 1rem;
26
- background: linear-gradient(45deg, #667eea, #764ba2);
27
- -webkit-background-clip: text;
28
- -webkit-text-fill-color: transparent;
29
- background-clip: text;
30
- }
31
-
32
- p {
33
- color: #666;
34
- font-size: 1.2rem;
35
- margin-bottom: 2rem;
36
- }
37
-
38
- .api-button {
39
- background: linear-gradient(45deg, #667eea, #764ba2);
40
- color: white;
41
- border: none;
42
- padding: 1rem 2rem;
43
- border-radius: 50px;
44
- font-size: 1.1rem;
45
- cursor: pointer;
46
- transition: transform 0.2s;
47
- margin: 0.5rem;
48
- }
49
-
50
- .api-button:hover {
51
- transform: translateY(-2px);
52
- }
53
-
54
- .result {
55
- margin-top: 2rem;
56
- padding: 1rem;
57
- background: #f8f9fa;
58
- border-radius: 10px;
59
- text-align: left;
60
- font-family: monospace;
61
- white-space: pre-wrap;
62
- }
63
-
64
- .loading {
65
- color: #667eea;
66
- }
@@ -1,115 +0,0 @@
1
- /**
2
- * ONES Application Manifest Schema Interface
3
- * Defines the structure for application manifest
4
- * Documentation: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/guide/getting-started/quick-start-guide#build-your-app-manifest
5
- */
6
- export interface AppManifest {
7
- /** Application ID, format: app_ + 16 lowercase alphanumeric characters */
8
- id: string
9
-
10
- /** Application name, 1-64 characters */
11
- name: string
12
-
13
- /** Semantic version number (e.g., v1.0.0) */
14
- version: string
15
-
16
- /** Application base URL, must start with http(s):// and not contain ? or # */
17
- base_url: string
18
-
19
- /** Authentication configuration */
20
- auth: {
21
- /** Authentication type (currently only supports 'jwt') */
22
- type: 'jwt'
23
- }
24
-
25
- /** Lifecycle callback configuration */
26
- lifecycle_callback: {
27
- /** Install callback endpoint (required) */
28
- install: string
29
- /** Enable callback endpoint (optional) */
30
- enabled?: string
31
- /** Disable callback endpoint (optional) */
32
- disabled?: string
33
- /** Uninstall callback endpoint (optional) */
34
- uninstalled?: string
35
- }
36
-
37
- /** Application description, maximum 1024 characters (optional) */
38
- desc?: string | null
39
-
40
- /** Application Logo URL (optional) */
41
- logo?: string | null
42
-
43
- /** Event configuration (optional) */
44
- events?: {
45
- /** Event callback URL, must start with / and not contain # */
46
- url: string
47
- /** Event type list */
48
- types: Array<{
49
- /** ONES defined event type, the application will listen to this event.
50
- * Available event types include: ones:project:issue:created, ones:project:issue:updated,
51
- * ones:project:project:created, ones:project:project:updated,
52
- * ones:project:project-member:added, ones:project:project-member:deleted,
53
- * ones:project:project-role:added, ones:project:project-role:deleted
54
- * For complete list, see: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/events/ */
55
- eventType: string
56
- }>
57
- } | null
58
-
59
- /** Extension configuration (optional) */
60
- extensions?: {
61
- /** Application setting page extensions */
62
- appSettingPages?: Array<{
63
- /** Unique identifier for the extension */
64
- key: string
65
- /** Extension functionality configuration */
66
- funcs: {
67
- /** Custom entries endpoint */
68
- customEntries: string
69
- }
70
- }>
71
-
72
- /** Manhour validator extensions */
73
- manhourValidator?: Array<{
74
- /** Unique identifier for the extension */
75
- key: string
76
- /** Extension functionality configuration */
77
- funcs: {
78
- /** Validation endpoint */
79
- validate: string
80
- }
81
- }>
82
- } | null
83
-
84
- /** OAuth configuration (optional) */
85
- oauth?: {
86
- /** OAuth scope permissions list. Available scopes include: read:project:issue,
87
- * write:project:issue, read:project:project, write:project:project,
88
- * read:project:issueType, read:project:issueStatus, read:project:issueField,
89
- * read:project:issueFieldGroup, read:project:issue-attachment,
90
- * write:project:issue-attachment, write:project:issue-timeEstimated,
91
- * write:project:issue-timeRemaining, read:project:issue-timeSpent,
92
- * write:project:issue-timeSpent, write:project:issue-comment,
93
- * read:project:issue-comment, write:project:issue-watcher,
94
- * read:product:fields, read:project:workLog-timeEstimated,
95
- * read:testcase:library, write:testcase:library, read:account:department,
96
- * read:account:department-member, read:account:user, write:account:user,
97
- * read:appcenter:app, write:appcenter:user, read:wiki:space,
98
- * read:wiki:page, read:wiki:resource, write:wiki:page,
99
- * read:wiki:template, read:system:info
100
- * For complete list, see: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/openapi/scope */
101
- scope: string[]
102
- /** OAuth type, supports 'app' and 'user' */
103
- type?: ('app' | 'user')[] | null
104
- /** OAuth redirect URL, must start with / and not contain # (optional) */
105
- redirect_url?: string | null
106
- } | null
107
-
108
- /** ONES version compatibility (optional) */
109
- ones_version?: {
110
- /** Minimum compatible ONES version (e.g., v6.42.0) */
111
- min?: string
112
- /** Maximum compatible ONES version (e.g., v6.88.0) */
113
- max?: string
114
- } | null
115
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * ONES Application Setting Pages Configuration Interface
3
- * Defines the structure for application setting page entries
4
- * Documentation: https://p8205-k3s-9-submodule-opendocs2.k3s-dev.myones.net/docs/abilities/extensions/app-setting-pages
5
- */
6
- export interface AppSettingPages {
7
- /** Array of setting page entries */
8
- entries: Array<{
9
- /** URL of the setting page, must start with / and not contain # */
10
- page_url: string
11
- /** Display title for the setting page entry */
12
- title: string
13
- }>
14
- }