@ones-open/cli 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 (210) hide show
  1. package/LICENSE +201 -0
  2. package/bin/ones.js +4 -0
  3. package/dist/index.cjs +1889 -0
  4. package/dist/index.js +1888 -0
  5. package/dist/types/actions/build/index.d.ts +4 -0
  6. package/dist/types/actions/build/index.d.ts.map +1 -0
  7. package/dist/types/actions/build/normalize.d.ts +6 -0
  8. package/dist/types/actions/build/normalize.d.ts.map +1 -0
  9. package/dist/types/actions/build/regexp.d.ts +2 -0
  10. package/dist/types/actions/build/regexp.d.ts.map +1 -0
  11. package/dist/types/actions/dev/enums.d.ts +11 -0
  12. package/dist/types/actions/dev/enums.d.ts.map +1 -0
  13. package/dist/types/actions/dev/index.d.ts +4 -0
  14. package/dist/types/actions/dev/index.d.ts.map +1 -0
  15. package/dist/types/actions/dev/normalize.d.ts +6 -0
  16. package/dist/types/actions/dev/normalize.d.ts.map +1 -0
  17. package/dist/types/actions/dev/types.d.ts +10 -0
  18. package/dist/types/actions/dev/types.d.ts.map +1 -0
  19. package/dist/types/actions/disable/index.d.ts +4 -0
  20. package/dist/types/actions/disable/index.d.ts.map +1 -0
  21. package/dist/types/actions/disable/normalize.d.ts +6 -0
  22. package/dist/types/actions/disable/normalize.d.ts.map +1 -0
  23. package/dist/types/actions/enable/index.d.ts +4 -0
  24. package/dist/types/actions/enable/index.d.ts.map +1 -0
  25. package/dist/types/actions/enable/normalize.d.ts +6 -0
  26. package/dist/types/actions/enable/normalize.d.ts.map +1 -0
  27. package/dist/types/actions/index.d.ts +15 -0
  28. package/dist/types/actions/index.d.ts.map +1 -0
  29. package/dist/types/actions/install/index.d.ts +5 -0
  30. package/dist/types/actions/install/index.d.ts.map +1 -0
  31. package/dist/types/actions/install/install.d.ts +3 -0
  32. package/dist/types/actions/install/install.d.ts.map +1 -0
  33. package/dist/types/actions/install/normalize.d.ts +6 -0
  34. package/dist/types/actions/install/normalize.d.ts.map +1 -0
  35. package/dist/types/actions/legacy/index.d.ts +4 -0
  36. package/dist/types/actions/legacy/index.d.ts.map +1 -0
  37. package/dist/types/actions/legacy/normalize.d.ts +6 -0
  38. package/dist/types/actions/legacy/normalize.d.ts.map +1 -0
  39. package/dist/types/actions/login/consts.d.ts +2 -0
  40. package/dist/types/actions/login/consts.d.ts.map +1 -0
  41. package/dist/types/actions/login/index.d.ts +4 -0
  42. package/dist/types/actions/login/index.d.ts.map +1 -0
  43. package/dist/types/actions/login/normalize.d.ts +6 -0
  44. package/dist/types/actions/login/normalize.d.ts.map +1 -0
  45. package/dist/types/actions/login/regexp.d.ts +2 -0
  46. package/dist/types/actions/login/regexp.d.ts.map +1 -0
  47. package/dist/types/actions/logout/index.d.ts +4 -0
  48. package/dist/types/actions/logout/index.d.ts.map +1 -0
  49. package/dist/types/actions/logout/normalize.d.ts +6 -0
  50. package/dist/types/actions/logout/normalize.d.ts.map +1 -0
  51. package/dist/types/actions/tunnel/consts.d.ts +4 -0
  52. package/dist/types/actions/tunnel/consts.d.ts.map +1 -0
  53. package/dist/types/actions/tunnel/index.d.ts +7 -0
  54. package/dist/types/actions/tunnel/index.d.ts.map +1 -0
  55. package/dist/types/actions/tunnel/normalize.d.ts +6 -0
  56. package/dist/types/actions/tunnel/normalize.d.ts.map +1 -0
  57. package/dist/types/actions/tunnel/regexp.d.ts +2 -0
  58. package/dist/types/actions/tunnel/regexp.d.ts.map +1 -0
  59. package/dist/types/actions/tunnel/tunnel-client.d.ts +25 -0
  60. package/dist/types/actions/tunnel/tunnel-client.d.ts.map +1 -0
  61. package/dist/types/actions/tunnel/tunnel.d.ts +3 -0
  62. package/dist/types/actions/tunnel/tunnel.d.ts.map +1 -0
  63. package/dist/types/actions/tunnel/types.d.ts +31 -0
  64. package/dist/types/actions/tunnel/types.d.ts.map +1 -0
  65. package/dist/types/actions/tunnel/utils.d.ts +7 -0
  66. package/dist/types/actions/tunnel/utils.d.ts.map +1 -0
  67. package/dist/types/actions/uninstall/index.d.ts +4 -0
  68. package/dist/types/actions/uninstall/index.d.ts.map +1 -0
  69. package/dist/types/actions/uninstall/normalize.d.ts +6 -0
  70. package/dist/types/actions/uninstall/normalize.d.ts.map +1 -0
  71. package/dist/types/actions/whoami/index.d.ts +4 -0
  72. package/dist/types/actions/whoami/index.d.ts.map +1 -0
  73. package/dist/types/actions/whoami/normalize.d.ts +6 -0
  74. package/dist/types/actions/whoami/normalize.d.ts.map +1 -0
  75. package/dist/types/cli/index.d.ts +2 -0
  76. package/dist/types/cli/index.d.ts.map +1 -0
  77. package/dist/types/command/app/index.d.ts +4 -0
  78. package/dist/types/command/app/index.d.ts.map +1 -0
  79. package/dist/types/command/build/index.d.ts +10 -0
  80. package/dist/types/command/build/index.d.ts.map +1 -0
  81. package/dist/types/command/dev/index.d.ts +11 -0
  82. package/dist/types/command/dev/index.d.ts.map +1 -0
  83. package/dist/types/command/disable/index.d.ts +8 -0
  84. package/dist/types/command/disable/index.d.ts.map +1 -0
  85. package/dist/types/command/enable/index.d.ts +8 -0
  86. package/dist/types/command/enable/index.d.ts.map +1 -0
  87. package/dist/types/command/index.d.ts +16 -0
  88. package/dist/types/command/index.d.ts.map +1 -0
  89. package/dist/types/command/install/index.d.ts +8 -0
  90. package/dist/types/command/install/index.d.ts.map +1 -0
  91. package/dist/types/command/legacy/index.d.ts +8 -0
  92. package/dist/types/command/legacy/index.d.ts.map +1 -0
  93. package/dist/types/command/login/index.d.ts +8 -0
  94. package/dist/types/command/login/index.d.ts.map +1 -0
  95. package/dist/types/command/logout/index.d.ts +8 -0
  96. package/dist/types/command/logout/index.d.ts.map +1 -0
  97. package/dist/types/command/tunnel/index.d.ts +9 -0
  98. package/dist/types/command/tunnel/index.d.ts.map +1 -0
  99. package/dist/types/command/uninstall/index.d.ts +8 -0
  100. package/dist/types/command/uninstall/index.d.ts.map +1 -0
  101. package/dist/types/command/whoami/index.d.ts +8 -0
  102. package/dist/types/command/whoami/index.d.ts.map +1 -0
  103. package/dist/types/common/base/index.d.ts +5 -0
  104. package/dist/types/common/base/index.d.ts.map +1 -0
  105. package/dist/types/common/base/utils.d.ts +7 -0
  106. package/dist/types/common/base/utils.d.ts.map +1 -0
  107. package/dist/types/common/command/index.d.ts +6 -0
  108. package/dist/types/common/command/index.d.ts.map +1 -0
  109. package/dist/types/common/command/types.d.ts +2 -0
  110. package/dist/types/common/command/types.d.ts.map +1 -0
  111. package/dist/types/common/command/utils.d.ts +2 -0
  112. package/dist/types/common/command/utils.d.ts.map +1 -0
  113. package/dist/types/common/config/consts.d.ts +5 -0
  114. package/dist/types/common/config/consts.d.ts.map +1 -0
  115. package/dist/types/common/config/index.d.ts +7 -0
  116. package/dist/types/common/config/index.d.ts.map +1 -0
  117. package/dist/types/common/config/types.d.ts +8 -0
  118. package/dist/types/common/config/types.d.ts.map +1 -0
  119. package/dist/types/common/config/utils.d.ts +3 -0
  120. package/dist/types/common/config/utils.d.ts.map +1 -0
  121. package/dist/types/common/context/index.d.ts +6 -0
  122. package/dist/types/common/context/index.d.ts.map +1 -0
  123. package/dist/types/common/context/types.d.ts +2 -0
  124. package/dist/types/common/context/types.d.ts.map +1 -0
  125. package/dist/types/common/context/utils.d.ts +2 -0
  126. package/dist/types/common/context/utils.d.ts.map +1 -0
  127. package/dist/types/common/error/enums.d.ts +20 -0
  128. package/dist/types/common/error/enums.d.ts.map +1 -0
  129. package/dist/types/common/error/index.d.ts +7 -0
  130. package/dist/types/common/error/index.d.ts.map +1 -0
  131. package/dist/types/common/error/types.d.ts +2 -0
  132. package/dist/types/common/error/types.d.ts.map +1 -0
  133. package/dist/types/common/error/utils.d.ts +2 -0
  134. package/dist/types/common/error/utils.d.ts.map +1 -0
  135. package/dist/types/common/locales/en/index.d.ts +41 -0
  136. package/dist/types/common/locales/en/index.d.ts.map +1 -0
  137. package/dist/types/common/locales/index.d.ts +6 -0
  138. package/dist/types/common/locales/index.d.ts.map +1 -0
  139. package/dist/types/common/locales/types.d.ts +4 -0
  140. package/dist/types/common/locales/types.d.ts.map +1 -0
  141. package/dist/types/common/locales/utils.d.ts +6 -0
  142. package/dist/types/common/locales/utils.d.ts.map +1 -0
  143. package/dist/types/common/package/index.d.ts +7 -0
  144. package/dist/types/common/package/index.d.ts.map +1 -0
  145. package/dist/types/common/package/schema.d.ts +3 -0
  146. package/dist/types/common/package/schema.d.ts.map +1 -0
  147. package/dist/types/common/package/types.d.ts +2 -0
  148. package/dist/types/common/package/types.d.ts.map +1 -0
  149. package/dist/types/common/package/utils.d.ts +16 -0
  150. package/dist/types/common/package/utils.d.ts.map +1 -0
  151. package/dist/types/common/public/consts.d.ts +2 -0
  152. package/dist/types/common/public/consts.d.ts.map +1 -0
  153. package/dist/types/common/public/index.d.ts +6 -0
  154. package/dist/types/common/public/index.d.ts.map +1 -0
  155. package/dist/types/common/public/utils.d.ts +2 -0
  156. package/dist/types/common/public/utils.d.ts.map +1 -0
  157. package/dist/types/common/request/consts.d.ts +16 -0
  158. package/dist/types/common/request/consts.d.ts.map +1 -0
  159. package/dist/types/common/request/fetch.d.ts +13 -0
  160. package/dist/types/common/request/fetch.d.ts.map +1 -0
  161. package/dist/types/common/request/index.d.ts +8 -0
  162. package/dist/types/common/request/index.d.ts.map +1 -0
  163. package/dist/types/common/request/types.d.ts +98 -0
  164. package/dist/types/common/request/types.d.ts.map +1 -0
  165. package/dist/types/common/request/utils.d.ts +11 -0
  166. package/dist/types/common/request/utils.d.ts.map +1 -0
  167. package/dist/types/common/store/index.d.ts +6 -0
  168. package/dist/types/common/store/index.d.ts.map +1 -0
  169. package/dist/types/common/store/schema.d.ts +75 -0
  170. package/dist/types/common/store/schema.d.ts.map +1 -0
  171. package/dist/types/common/store/utils.d.ts +13 -0
  172. package/dist/types/common/store/utils.d.ts.map +1 -0
  173. package/dist/types/common/template/index.d.ts +5 -0
  174. package/dist/types/common/template/index.d.ts.map +1 -0
  175. package/dist/types/common/template/utils.d.ts +3 -0
  176. package/dist/types/common/template/utils.d.ts.map +1 -0
  177. package/dist/types/index.d.ts +2 -0
  178. package/dist/types/index.d.ts.map +1 -0
  179. package/index.d.ts +2 -0
  180. package/index.js +2 -0
  181. package/package.json +83 -0
  182. package/public/callback.html +65 -0
  183. package/public/logo.svg +4 -0
  184. package/template/legacy/README.md +13 -0
  185. package/template/legacy/_backend_npmrc +5 -0
  186. package/template/legacy/_backend_tsconfig.json +23 -0
  187. package/template/legacy/_eslintignore +2 -0
  188. package/template/legacy/_eslintrc.js +97 -0
  189. package/template/legacy/_gitignore +21 -0
  190. package/template/legacy/_gitlab-ci.yml +3 -0
  191. package/template/legacy/_husky_pre-commit +1 -0
  192. package/template/legacy/_npmrc +5 -0
  193. package/template/legacy/_prettierignore +15 -0
  194. package/template/legacy/_prettierrc +6 -0
  195. package/template/legacy/_web_npmrc +5 -0
  196. package/template/legacy/_web_tsconfig.json +20 -0
  197. package/template/legacy/backend/package.json +10 -0
  198. package/template/legacy/backend/src/index.ts +139 -0
  199. package/template/legacy/backend/src/ones.d.ts +6 -0
  200. package/template/legacy/config/ci-deploy.yaml +11 -0
  201. package/template/legacy/config/local.yaml +30 -0
  202. package/template/legacy/config/plugin.yaml +25 -0
  203. package/template/legacy/config/upgrade.yaml +8 -0
  204. package/template/legacy/op.config.mjs +4 -0
  205. package/template/legacy/package-lock.json +17446 -0
  206. package/template/legacy/package.json +73 -0
  207. package/template/legacy/web/browserslist +4 -0
  208. package/template/legacy/web/package.json +29 -0
  209. package/template/legacy/web/public/logo.svg +5 -0
  210. package/template/legacy/workspace/plugin.sql +2 -0
@@ -0,0 +1,139 @@
1
+ import { Logger } from '@ones-op/node-logger'
2
+ import { env } from '@ones-op/sdk/backend'
3
+ import type { PluginRequest, PluginResponse } from '@ones-op/node-types'
4
+
5
+ // Method called when the team level plugin is being installed.
6
+ export async function Install() {
7
+ Logger.info('[Plugin] Install')
8
+ }
9
+
10
+ // Method called when the team level plugin is being launched.
11
+ export async function Enable() {
12
+ Logger.info('[Plugin] Enable')
13
+ }
14
+
15
+ // Method called when the team level plugin is being suspended.
16
+ export function Disable() {
17
+ Logger.info('[Plugin] Disable')
18
+ }
19
+
20
+ // Method called when the team level plugin is being uninstalled.
21
+ export function UnInstall() {
22
+ Logger.info('[Plugin] UnInstall')
23
+ }
24
+
25
+ // Method called when the team level plugin is being upgraded.
26
+ export function Upgrade(oldPluginInfo: any) {
27
+ const oldVersion = oldPluginInfo.version
28
+ Logger.info('[Plugin] Upgrade', 'old version:', oldVersion)
29
+ }
30
+
31
+ /*
32
+ Method called when the organization level plugin is being installed.
33
+
34
+ Request parameter description:
35
+ request:
36
+ request.parsedHeaders state multi-language, for example,when the request user context is chinese,
37
+ the parameter will be {"Accept-Language":["zh"]}, there are other cases like {"Accept-Language":["en"]},
38
+ {"Accept-Language":["ja"]}.
39
+ teamUUIDList:
40
+ The uuid list with the team which installed by this time.
41
+ firstInstall:
42
+ True if plugin has never been installed.
43
+ */
44
+ export async function OrgInstall(
45
+ request: PluginRequest,
46
+ teamUUIDList: string[],
47
+ firstInstall: boolean,
48
+ ) {
49
+ Logger.info('[Plugin] OrgInstall')
50
+ }
51
+
52
+ /*
53
+ Method called when the organization level plugin is being launched.
54
+
55
+ Request parameters description:
56
+ request:
57
+ request.parsedHeaders state multi-language, for example,when the request user context is chinese,
58
+ the parameter will be {"Accept-Language":["zh"]}, there are other cases like {"Accept-Language":["en"]},
59
+ {"Accept-Language":["ja"]}.
60
+ teamUUIDList:
61
+ The uuid list with the team which launched by this time.
62
+
63
+ Response parameters description:
64
+ Return the failed team uuid list.
65
+ */
66
+ export function OrgEnable(
67
+ request: PluginRequest,
68
+ teamUUIDList: string[],
69
+ ): void | string[] | Promise<string[]> {
70
+ Logger.info('[Plugin] OrgEnable')
71
+ return []
72
+ }
73
+
74
+ /*
75
+ Method called when the organization level plugin is being suspended.
76
+
77
+ Request parameters description:
78
+ request:
79
+ request.parsedHeaders state multi-language, for example,when the request user context is chinese,
80
+ the parameter will be {"Accept-Language":["zh"]}, there are other cases like {"Accept-Language":["en"]},
81
+ {"Accept-Language":["ja"]}.
82
+ teamUUIDList:
83
+ The uuid list with the team which suspended by this time.
84
+
85
+ Response parameters description:
86
+ Return the failed team uuid list.
87
+ */
88
+ export function OrgDisable(
89
+ request: PluginRequest,
90
+ teamUUIDList: string[],
91
+ ): void | string[] | Promise<string[]> {
92
+ Logger.info('[Plugin] OrgDisable')
93
+ return []
94
+ }
95
+
96
+ /*
97
+ Method called when the organization level plugin is being uninstalled.
98
+
99
+ Request parameters description:
100
+ request:
101
+ request.parsedHeaders state multi-language, for example,when the request user context is chinese,
102
+ the parameter will be {"Accept-Language":["zh"]}, there are other cases like {"Accept-Language":["en"]},
103
+ {"Accept-Language":["ja"]}.
104
+ teamUUIDList:
105
+ The uuid list with the team which uninstalled by this time.
106
+ */
107
+ export function OrgUnInstall(request: PluginRequest, teamUUIDList: string[]) {
108
+ Logger.info('[Plugin] OrgUnInstall')
109
+ }
110
+
111
+ /*
112
+ Method called when the organization level plugin is being upgraded.
113
+
114
+ Request parameters description:
115
+ request:
116
+ request.parsedHeaders state multi-language, for example,when the request user context is chinese,
117
+ the parameter will be {"Accept-Language":["zh"]}, there are other cases like {"Accept-Language":["en"]},
118
+ {"Accept-Language":["ja"]}.
119
+ teamUUIDList:
120
+ The uuid list with the team which upgraded by this time.
121
+ */
122
+ export function OrgUpgrade(oldPluginInfo: any, request: PluginRequest, teamUUIDList: string[]) {
123
+ const oldVersion = oldPluginInfo.version
124
+ Logger.info('[Plugin] OrgUpgrade', 'old version:', oldVersion)
125
+ }
126
+
127
+ // example function
128
+ export async function hello(request: PluginRequest): Promise<PluginResponse> {
129
+ const body = request.body || {}
130
+ Logger.info('[Plugin] hello ======= 请求成功')
131
+ return {
132
+ body: {
133
+ res: 'hello world',
134
+ orgId: await env.getOrgId(),
135
+ teamID: await env.getTeamID(),
136
+ requestBody: body,
137
+ },
138
+ }
139
+ }
@@ -0,0 +1,6 @@
1
+ /* eslint-disable no-var */
2
+ /**
3
+ * @see https://developer.ones.cn/docs/guide/advanced/storage
4
+ * @summary ones.d.ts is generated by `op format` cli commands.
5
+ * DO NOT MODIFY MANUALLY
6
+ */
@@ -0,0 +1,11 @@
1
+ # Configuration example:
2
+
3
+ # default:
4
+ # host: ''
5
+ # username: ''
6
+ # password: ''
7
+ # ones-check-id: ''
8
+ # ones-check-point: ''
9
+ # ones-plugin-id: ''
10
+ # organization_uuid: ''
11
+ # team_uuid: ''
@@ -0,0 +1,30 @@
1
+ platform:
2
+ address: ''
3
+ baseURL: ''
4
+ username: ''
5
+ plugin:
6
+ app_id: ''
7
+ scope: 0
8
+ local:
9
+ id: '4085451291'
10
+ language: nodejs
11
+ debug_mode: false
12
+ timeout_sec: 30
13
+ organization_uuid: ''
14
+ team_uuid: ''
15
+ web_service_port: '3000'
16
+ web_service_ip: 127.0.0.1
17
+ server_port: 3001
18
+ user_uuid: ''
19
+ log_in_local: false
20
+ log_level: info
21
+ file_in_local: false
22
+ mysql_in_local: false
23
+ mysql_user_name: ''
24
+ mysql_user_password: ''
25
+ mysql_database_name: ''
26
+ mysql_host: ''
27
+ mysql_port: ''
28
+ instance_uuid: ''
29
+ dangerously_accept_unauthorized_https: false
30
+ host_dist_tag: ''
@@ -0,0 +1,25 @@
1
+ service:
2
+ app_id: plugin
3
+ name: plugin
4
+ version: 1.0.0
5
+ description: plugin
6
+ mode: org
7
+ logo: null
8
+ language: nodejs
9
+ language_version: 16.13.0
10
+ host_version: 1.0.4
11
+ host_sub_version: 1.0.0
12
+ min_system_version: 3.5.0
13
+ auth: null
14
+ config: null
15
+ scope: 1
16
+ policy:
17
+ policy: simple
18
+ target: ''
19
+ apis:
20
+ - type: addition
21
+ methods:
22
+ - POST
23
+ url: /hello
24
+ function: hello
25
+ modules: []
@@ -0,0 +1,8 @@
1
+ #Indicates the processing rules for plugin workspace file conflicts. Enumeration value [save_new, save_old]:
2
+ # save_old, save the old file when the old file conflicts with the new file;
3
+ # save_new,which contrary to the save_old.
4
+ workspace:
5
+ rule: save_new
6
+ #Array of regular expressions, expressing files that are not in default rules.
7
+ exclude:
8
+ # - example.txt
@@ -0,0 +1,4 @@
1
+ /** @type { import("@ones-op/rc-cli").OpConfigSchema } */
2
+ export default {
3
+ scan: {},
4
+ };