@carthooks/arcubase-cli 0.1.0

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 (157) hide show
  1. package/bundle/arcubase-admin.mjs +9875 -0
  2. package/bundle/arcubase.mjs +9875 -0
  3. package/dist/bin/arcubase-admin.d.ts +2 -0
  4. package/dist/bin/arcubase-admin.d.ts.map +1 -0
  5. package/dist/bin/arcubase-admin.js +22 -0
  6. package/dist/bin/arcubase.d.ts +2 -0
  7. package/dist/bin/arcubase.d.ts.map +1 -0
  8. package/dist/bin/arcubase.js +22 -0
  9. package/dist/generated/command_registry.generated.d.ts +3072 -0
  10. package/dist/generated/command_registry.generated.d.ts.map +1 -0
  11. package/dist/generated/command_registry.generated.js +4587 -0
  12. package/dist/generated/type_index.generated.d.ts +496 -0
  13. package/dist/generated/type_index.generated.d.ts.map +1 -0
  14. package/dist/generated/type_index.generated.js +502 -0
  15. package/dist/generated/zod_registry.generated.d.ts +356 -0
  16. package/dist/generated/zod_registry.generated.d.ts.map +1 -0
  17. package/dist/generated/zod_registry.generated.js +483 -0
  18. package/dist/index.d.ts +5 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +4 -0
  21. package/dist/runtime/argv.d.ts +8 -0
  22. package/dist/runtime/argv.d.ts.map +1 -0
  23. package/dist/runtime/argv.js +31 -0
  24. package/dist/runtime/body_loader.d.ts +3 -0
  25. package/dist/runtime/body_loader.d.ts.map +1 -0
  26. package/dist/runtime/body_loader.js +26 -0
  27. package/dist/runtime/command_registry.d.ts +9 -0
  28. package/dist/runtime/command_registry.d.ts.map +1 -0
  29. package/dist/runtime/command_registry.js +14 -0
  30. package/dist/runtime/env.d.ts +14 -0
  31. package/dist/runtime/env.d.ts.map +1 -0
  32. package/dist/runtime/env.js +42 -0
  33. package/dist/runtime/errors.d.ts +23 -0
  34. package/dist/runtime/errors.d.ts.map +1 -0
  35. package/dist/runtime/errors.js +18 -0
  36. package/dist/runtime/execute.d.ts +17 -0
  37. package/dist/runtime/execute.d.ts.map +1 -0
  38. package/dist/runtime/execute.js +183 -0
  39. package/dist/runtime/http.d.ts +4 -0
  40. package/dist/runtime/http.d.ts.map +1 -0
  41. package/dist/runtime/http.js +21 -0
  42. package/dist/runtime/output.d.ts +2 -0
  43. package/dist/runtime/output.d.ts.map +1 -0
  44. package/dist/runtime/output.js +3 -0
  45. package/dist/runtime/paths.d.ts +4 -0
  46. package/dist/runtime/paths.d.ts.map +1 -0
  47. package/dist/runtime/paths.js +8 -0
  48. package/dist/runtime/zod_registry.d.ts +10 -0
  49. package/dist/runtime/zod_registry.d.ts.map +1 -0
  50. package/dist/runtime/zod_registry.js +50 -0
  51. package/dist/tests/bootstrap.test.d.ts +2 -0
  52. package/dist/tests/bootstrap.test.d.ts.map +1 -0
  53. package/dist/tests/bootstrap.test.js +59 -0
  54. package/dist/tests/command_registry.test.d.ts +2 -0
  55. package/dist/tests/command_registry.test.d.ts.map +1 -0
  56. package/dist/tests/command_registry.test.js +22 -0
  57. package/dist/tests/execute_validation.test.d.ts +2 -0
  58. package/dist/tests/execute_validation.test.d.ts.map +1 -0
  59. package/dist/tests/execute_validation.test.js +41 -0
  60. package/dist/tests/help.test.d.ts +2 -0
  61. package/dist/tests/help.test.d.ts.map +1 -0
  62. package/dist/tests/help.test.js +22 -0
  63. package/dist/tests/zod_registry.test.d.ts +2 -0
  64. package/dist/tests/zod_registry.test.d.ts.map +1 -0
  65. package/dist/tests/zod_registry.test.js +26 -0
  66. package/package.json +46 -0
  67. package/sdk-dist/api/admin/app-entity-share.ts +52 -0
  68. package/sdk-dist/api/admin/app.ts +187 -0
  69. package/sdk-dist/api/admin/automate-rule.ts +59 -0
  70. package/sdk-dist/api/admin/business-hooks.ts +17 -0
  71. package/sdk-dist/api/admin/config.ts +12 -0
  72. package/sdk-dist/api/admin/dashboard.ts +88 -0
  73. package/sdk-dist/api/admin/dataset.ts +133 -0
  74. package/sdk-dist/api/admin/departments.ts +223 -0
  75. package/sdk-dist/api/admin/developer.ts +126 -0
  76. package/sdk-dist/api/admin/entity-tags.ts +71 -0
  77. package/sdk-dist/api/admin/entity.ts +188 -0
  78. package/sdk-dist/api/admin/extension.ts +19 -0
  79. package/sdk-dist/api/admin/index.ts +21 -0
  80. package/sdk-dist/api/admin/ingress.ts +117 -0
  81. package/sdk-dist/api/admin/integration.ts +64 -0
  82. package/sdk-dist/api/admin/kiosk-flow.ts +67 -0
  83. package/sdk-dist/api/admin/print-template-background.ts +43 -0
  84. package/sdk-dist/api/admin/print-templates.ts +60 -0
  85. package/sdk-dist/api/admin/tenant.ts +231 -0
  86. package/sdk-dist/api/admin/workflow.ts +51 -0
  87. package/sdk-dist/api/kiosk/index.ts +4 -0
  88. package/sdk-dist/api/kiosk/starter.ts +34 -0
  89. package/sdk-dist/api/kiosk/ui.ts +79 -0
  90. package/sdk-dist/api/open/api.ts +11 -0
  91. package/sdk-dist/api/open/index.ts +3 -0
  92. package/sdk-dist/api/shared-link/form.ts +103 -0
  93. package/sdk-dist/api/shared-link/index.ts +3 -0
  94. package/sdk-dist/api/user/common.ts +159 -0
  95. package/sdk-dist/api/user/context.ts +10 -0
  96. package/sdk-dist/api/user/copilot.ts +20 -0
  97. package/sdk-dist/api/user/dashboard.ts +43 -0
  98. package/sdk-dist/api/user/entity.ts +213 -0
  99. package/sdk-dist/api/user/flow.ts +20 -0
  100. package/sdk-dist/api/user/global-action.ts +128 -0
  101. package/sdk-dist/api/user/index.ts +12 -0
  102. package/sdk-dist/api/user/kiosk.ts +12 -0
  103. package/sdk-dist/api/user/profile.ts +57 -0
  104. package/sdk-dist/api/user/workflow.ts +186 -0
  105. package/sdk-dist/generated/command_registry.generated.ts +4603 -0
  106. package/sdk-dist/generated/type_index.generated.ts +503 -0
  107. package/sdk-dist/generated/zod_registry.generated.ts +713 -0
  108. package/sdk-dist/types/app-user.ts +0 -0
  109. package/sdk-dist/types/app.ts +182 -0
  110. package/sdk-dist/types/auth.ts +174 -0
  111. package/sdk-dist/types/automate-rule.ts +100 -0
  112. package/sdk-dist/types/business-hooks.ts +37 -0
  113. package/sdk-dist/types/common.ts +676 -0
  114. package/sdk-dist/types/copilot.ts +34 -0
  115. package/sdk-dist/types/dashboard.ts +122 -0
  116. package/sdk-dist/types/dataset.ts +168 -0
  117. package/sdk-dist/types/departments.ts +351 -0
  118. package/sdk-dist/types/developer.ts +190 -0
  119. package/sdk-dist/types/entity.ts +400 -0
  120. package/sdk-dist/types/extension.ts +15 -0
  121. package/sdk-dist/types/global-action.ts +206 -0
  122. package/sdk-dist/types/index.ts +26 -0
  123. package/sdk-dist/types/ingress.ts +173 -0
  124. package/sdk-dist/types/kiosk-starter.ts +46 -0
  125. package/sdk-dist/types/kiosk-ui.ts +94 -0
  126. package/sdk-dist/types/oauth-authorize.ts +52 -0
  127. package/sdk-dist/types/oauth.ts +33 -0
  128. package/sdk-dist/types/openapi.ts +24 -0
  129. package/sdk-dist/types/platform-setup.ts +26 -0
  130. package/sdk-dist/types/shared-link.ts +41 -0
  131. package/sdk-dist/types/tenant.ts +340 -0
  132. package/sdk-dist/types/upload.ts +0 -0
  133. package/sdk-dist/types/user-action.ts +871 -0
  134. package/sdk-dist/types/user-flow.ts +90 -0
  135. package/sdk-dist/types/widgets.ts +115 -0
  136. package/sdk-dist/types/workflow.ts +162 -0
  137. package/src/bin/arcubase-admin.ts +23 -0
  138. package/src/bin/arcubase.ts +23 -0
  139. package/src/generated/command_registry.generated.ts +4603 -0
  140. package/src/generated/type_index.generated.ts +503 -0
  141. package/src/generated/zod_registry.generated.ts +713 -0
  142. package/src/index.ts +4 -0
  143. package/src/runtime/argv.ts +39 -0
  144. package/src/runtime/body_loader.ts +26 -0
  145. package/src/runtime/command_registry.ts +22 -0
  146. package/src/runtime/env.ts +60 -0
  147. package/src/runtime/errors.ts +41 -0
  148. package/src/runtime/execute.ts +206 -0
  149. package/src/runtime/http.ts +23 -0
  150. package/src/runtime/output.ts +3 -0
  151. package/src/runtime/paths.ts +8 -0
  152. package/src/runtime/zod_registry.ts +53 -0
  153. package/src/tests/bootstrap.test.ts +67 -0
  154. package/src/tests/command_registry.test.ts +27 -0
  155. package/src/tests/execute_validation.test.ts +50 -0
  156. package/src/tests/help.test.ts +25 -0
  157. package/src/tests/zod_registry.test.ts +33 -0
@@ -0,0 +1,41 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'fs';
4
+ import os from 'os';
5
+ import path from 'path';
6
+ import { executeCLI } from '../runtime/execute.js';
7
+ import { CLIError } from '../runtime/errors.js';
8
+ const env = {
9
+ ARCUBASE_BASE_URL: 'https://arcubase.example.com/api/',
10
+ ARCUBASE_TENANT_ID: 'tenant_1',
11
+ ARCUBASE_ACCESS_TOKEN: 'tok',
12
+ ARCUBASE_TRACE_ID: '',
13
+ ARCUBASE_SUBJECT_TYPE: '',
14
+ ARCUBASE_SUBJECT_ID: '',
15
+ ARCUBASE_TOKEN_EXPIRES_AT: '',
16
+ };
17
+ function tempJSONFile(payload) {
18
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'arcubase-cli-'));
19
+ const filePath = path.join(dir, 'payload.json');
20
+ fs.writeFileSync(filePath, JSON.stringify(payload, null, 2));
21
+ return filePath;
22
+ }
23
+ test('admin save entity rejects invalid body file', async () => {
24
+ const invalidFile = tempJSONFile({ name: '订单', layout: 'bad-layout' });
25
+ await assert.rejects(async () => {
26
+ await executeCLI('admin', ['entity', 'admin-save-entity', '--app-id', 'app_1', '--entity-id', 'entity_1', '--body-file', invalidFile], env, async () => new Response('{}'));
27
+ }, (error) => {
28
+ assert.ok(error instanceof CLIError);
29
+ assert.equal(error.code, 'BODY_VALIDATION_FAILED');
30
+ assert.equal(error.details?.requestType, 'EntitySaveReqVO');
31
+ assert.ok((error.details?.issues ?? []).some((item) => item.path.startsWith('body.layout')));
32
+ assert.ok((error.details?.tsHints ?? []).some((item) => item.file.startsWith('/opt/arcubase-sdk/')));
33
+ return true;
34
+ });
35
+ });
36
+ test('admin create entity executes with valid body file', async () => {
37
+ const bodyFile = tempJSONFile({ name: '订单', parent: 0 });
38
+ const out = await executeCLI('admin', ['app', 'create-entity', '--id', 'app_1', '--body-file', bodyFile], env, async (url, init) => new Response(JSON.stringify({ ok: true, url, method: init?.method }), { status: 200 }));
39
+ assert.equal(out.kind, 'result');
40
+ assert.equal(out.status, 200);
41
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=help.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.test.d.ts","sourceRoot":"","sources":["../../src/tests/help.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { executeCLI } from '../runtime/execute.js';
4
+ const env = {
5
+ ARCUBASE_BASE_URL: 'https://arcubase.example.com/api/',
6
+ ARCUBASE_TENANT_ID: 'tenant_1',
7
+ ARCUBASE_ACCESS_TOKEN: 'tok',
8
+ ARCUBASE_TRACE_ID: '',
9
+ ARCUBASE_SUBJECT_TYPE: '',
10
+ ARCUBASE_SUBJECT_ID: '',
11
+ ARCUBASE_TOKEN_EXPIRES_AT: '',
12
+ };
13
+ test('root help prints modules', async () => {
14
+ const out = await executeCLI('admin', ['--help'], env, async () => new Response('{}'));
15
+ assert.equal(out.kind, 'help');
16
+ assert.match(out.text, /app/);
17
+ });
18
+ test('module help prints create-entity command', async () => {
19
+ const out = await executeCLI('admin', ['app', '--help'], env, async () => new Response('{}'));
20
+ assert.equal(out.kind, 'help');
21
+ assert.match(out.text, /create-entity/);
22
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=zod_registry.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod_registry.test.d.ts","sourceRoot":"","sources":["../../src/tests/zod_registry.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { getBodySchema, getUnsupportedBodySchemaReason } from '../runtime/zod_registry.js';
4
+ test('AppCreateEntityReqVO schema exists', () => {
5
+ assert.ok(getBodySchema('AppCreateEntityReqVO'));
6
+ });
7
+ test('EntitySaveReqVO schema exists', () => {
8
+ assert.ok(getBodySchema('EntitySaveReqVO'));
9
+ });
10
+ test('EntityQueryReqVO schema exists', () => {
11
+ assert.ok(getBodySchema('EntityQueryReqVO'));
12
+ });
13
+ test('inline request type schema exists', () => {
14
+ assert.ok(getBodySchema('{ name: string }'));
15
+ });
16
+ test('intersection request type schema exists', () => {
17
+ assert.ok(getBodySchema('EntityImportReqVO & EntityImportActionVO'));
18
+ });
19
+ test('manual notification override schema exists', () => {
20
+ assert.ok(getBodySchema('EntityUpdateNotificationsReqVO'));
21
+ assert.equal(getUnsupportedBodySchemaReason('EntityUpdateNotificationsReqVO'), null);
22
+ });
23
+ test('unknown request type has no schema and no unsupported reason', () => {
24
+ assert.equal(getBodySchema('DefinitelyMissingReqVO'), null);
25
+ assert.equal(getUnsupportedBodySchemaReason('DefinitelyMissingReqVO'), null);
26
+ });
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@carthooks/arcubase-cli",
3
+ "version": "0.1.0",
4
+ "description": "Arcubase runtime CLI for admin and user command execution",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js"
10
+ },
11
+ "bin": {
12
+ "arcubase-admin": "./dist/bin/arcubase-admin.js",
13
+ "arcubase": "./dist/bin/arcubase.js"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "bundle",
18
+ "sdk-dist",
19
+ "src"
20
+ ],
21
+ "scripts": {
22
+ "codegen:commands": "node scripts/generate-command-registry.mjs",
23
+ "codegen:zod": "node scripts/generate-zod-registry.mjs",
24
+ "codegen:type-index": "node scripts/generate-type-index.mjs",
25
+ "bundle": "npm run codegen:commands && npm run codegen:zod && npm run codegen:type-index && tsc && node scripts/bundle-cli.mjs",
26
+ "build": "npm run bundle && npm run docs:llms",
27
+ "test": "npm run codegen:commands && npm run codegen:zod && npm run codegen:type-index && tsx --test src/tests/*.test.ts",
28
+ "watch": "tsc --watch",
29
+ "type-check": "tsc --noEmit",
30
+ "docs:llms": "node -e \"\""
31
+ },
32
+ "dependencies": {
33
+ "@carthooks/client-ts": "0.8.0",
34
+ "zod": "^3.25.76"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^20.19.0",
38
+ "esbuild": "^0.25.11",
39
+ "ts-morph": "^25.0.1",
40
+ "tsx": "^4.20.6",
41
+ "typescript": "^5.3.3"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ }
46
+ }
@@ -0,0 +1,52 @@
1
+ import { getDefaultClient } from '../../factory'
2
+
3
+ export interface AppEntityShareItemVO {
4
+ id: number
5
+ source_app_id: number
6
+ source_entity_id: number
7
+ entity_name: string
8
+ target_app_id: number
9
+ target_app_name: string
10
+ created_at: number
11
+ }
12
+
13
+ export interface AppGetEntitySharesRespVO {
14
+ shares: AppEntityShareItemVO[]
15
+ }
16
+
17
+ export interface AppCreateEntityShareReqVO {
18
+ source_entity_id: number
19
+ target_app_ids: number[]
20
+ }
21
+
22
+ export interface AppDeleteEntityShareReqVO {
23
+ source_entity_id: number
24
+ target_app_id: number
25
+ }
26
+
27
+ // @endpoint GET /api/apps/:app_id/entity-shares
28
+ // @controller AppGetEntityShares
29
+ export async function getAppEntityShares(
30
+ appId: string
31
+ ): Promise<AppGetEntitySharesRespVO> {
32
+ return getDefaultClient().get(`/apps/${appId}/entity-shares`)
33
+ }
34
+
35
+ // @endpoint POST /api/apps/:app_id/entity-shares
36
+ // @controller AppCreateEntityShare
37
+ export async function createAppEntityShare(
38
+ appId: string,
39
+ data: AppCreateEntityShareReqVO
40
+ ): Promise<{ success: boolean }> {
41
+ return getDefaultClient().post(`/apps/${appId}/entity-shares`, data)
42
+ }
43
+
44
+ // @endpoint DELETE /api/apps/:app_id/entity-shares
45
+ // @controller AppDeleteEntityShare
46
+ export async function deleteAppEntityShare(
47
+ appId: string,
48
+ data: AppDeleteEntityShareReqVO
49
+ ): Promise<{ success: boolean }> {
50
+ return getDefaultClient().delete(`/apps/${appId}/entity-shares`, data)
51
+ }
52
+
@@ -0,0 +1,187 @@
1
+ import { getDefaultClient } from '../../factory'
2
+ import type {
3
+ AppRenameReqVO,
4
+ AppRenameRespVO,
5
+ AppCreateByTenantsReqVO,
6
+ AppCreateByTenantsRespVO,
7
+ AppCreateEntityReqVO,
8
+ AppCreateEntityRespVO,
9
+ AppGetAppSchemaRespVO,
10
+ AppGetSiteMapsRespVO,
11
+ AppSaveSiteMapsReqVO,
12
+ AppUpdateAppReqVO,
13
+ AppUpdateAppRespVO,
14
+ AppUpdateI18nReqVO,
15
+ AppUpdateI18nRespVO,
16
+ AppGetEntitiesRespVO
17
+ } from '../../types/app'
18
+ import type {
19
+ AppDeleteWidgetsRespVO,
20
+ AppGetWidgetsRespVO,
21
+ AppNewWidgetsReqVO,
22
+ AppNewWidgetsRespVO,
23
+ AppUpdateWidgetsReqVO,
24
+ AppUpdateWidgetsRespVO,
25
+ AppUpdateWidgetsIngressOptionsReqVO,
26
+ AppUpdateWidgetsIngressOptionsRespVO,
27
+ AppPreviewWidgetsDataReqVO,
28
+ AppPreviewWidgetsDataRespVO,
29
+ AppWidgetsListRespVO
30
+ } from '../../types/widgets'
31
+
32
+ // @endpoint PUT /apps/:id/name
33
+ // @controller App.AppRename
34
+ export async function renameApp(
35
+ id: string,
36
+ data: AppRenameReqVO
37
+ ): Promise<AppRenameRespVO> {
38
+ return getDefaultClient().put(`/apps/${id}/name`, data)
39
+ }
40
+
41
+ // @endpoint POST /apps
42
+ // @controller App.CreateAppByTenants
43
+ export async function createAppByTenants(
44
+ data: AppCreateByTenantsReqVO
45
+ ): Promise<AppCreateByTenantsRespVO> {
46
+ return getDefaultClient().post('/apps', data)
47
+ }
48
+
49
+ // @endpoint POST /apps/:id/entities
50
+ // @controller App.CreateEntity
51
+ export async function createEntity(
52
+ id: string,
53
+ data: AppCreateEntityReqVO
54
+ ): Promise<AppCreateEntityRespVO> {
55
+ return getDefaultClient().post(`/apps/${id}/entities`, data)
56
+ }
57
+
58
+ // @endpoint DELETE /apps/:id
59
+ // @controller App.DeleteApp
60
+ export async function deleteApp(
61
+ id: string
62
+ ): Promise<boolean> {
63
+ return getDefaultClient().delete(`/apps/${id}`)
64
+ }
65
+
66
+ // @endpoint DELETE /apps/:app_id/widgets/:widgets_id
67
+ // @controller App.DeleteWidgets
68
+ export async function deleteWidgets(
69
+ appId: string,
70
+ widgetsId: string
71
+ ): Promise<boolean> {
72
+ return getDefaultClient().delete(`/apps/${appId}/widgets/${widgetsId}`)
73
+ }
74
+
75
+ // @endpoint POST /apps/:id/schema
76
+ // @controller App.GetAppSchema
77
+ export async function getAppSchema(
78
+ id: string | number,
79
+ refresh: boolean = false
80
+ ): Promise<AppGetAppSchemaRespVO> {
81
+ // mock cached
82
+ return getDefaultClient().post(`/apps/${id}/schema`)
83
+ }
84
+
85
+ // @endpoint GET /apps/:id/entities
86
+ // @controller App.GetEntities
87
+ export async function getEntities(
88
+ id: string
89
+ ): Promise<AppGetEntitiesRespVO> {
90
+ return getDefaultClient().get(`/apps/${id}/entities`)
91
+ }
92
+
93
+ // @endpoint GET /permissions/predefined
94
+ // @controller App.GetPredefinedPermissions
95
+ export async function getPredefinedPermissions(): Promise<any[]> {
96
+ return getDefaultClient().get('/permissions/predefined')
97
+ }
98
+
99
+ // @endpoint GET /apps/:id/sitemap
100
+ // @controller App.GetSiteMaps
101
+ export async function getSiteMaps(
102
+ id: string
103
+ ): Promise<AppGetSiteMapsRespVO> {
104
+ return getDefaultClient().get(`/apps/${id}/sitemap`)
105
+ }
106
+
107
+ // @endpoint GET /apps/:app_id/widgets/:widgets_id
108
+ // @controller App.GetWidgets
109
+ export async function getWidgets(
110
+ appId: string,
111
+ widgetsId: string
112
+ ): Promise<AppGetWidgetsRespVO> {
113
+ return getDefaultClient().get(`/apps/${appId}/widgets/${widgetsId}`)
114
+ }
115
+
116
+ // @endpoint POST /apps/:app_id/widgets
117
+ // @controller App.NewWidgets
118
+ export async function newWidgets(
119
+ appId: string,
120
+ data: AppNewWidgetsReqVO
121
+ ): Promise<AppNewWidgetsRespVO> {
122
+ return getDefaultClient().post(`/apps/${appId}/widgets`, data)
123
+ }
124
+
125
+ // @endpoint POST /apps/:app_id/widgets-preview
126
+ // @controller App.PreviewWidgetsData
127
+ export async function previewWidgetsData(
128
+ appId: string,
129
+ data: AppPreviewWidgetsDataReqVO
130
+ ): Promise<AppPreviewWidgetsDataRespVO> {
131
+ return getDefaultClient().post(`/apps/${appId}/widgets-preview`, data)
132
+ }
133
+
134
+ // @endpoint PUT /apps/:id/sitemap
135
+ // @controller App.SaveSiteMaps
136
+ export async function saveSiteMaps(
137
+ id: string,
138
+ data: AppSaveSiteMapsReqVO
139
+ ): Promise<AppGetSiteMapsRespVO> {
140
+ return getDefaultClient().put(`/apps/${id}/sitemap`, data)
141
+ }
142
+
143
+ // @endpoint PUT /apps/:id
144
+ // @controller App.UpdateApp
145
+ export async function updateApp(
146
+ id: string,
147
+ data: AppUpdateAppReqVO
148
+ ): Promise<AppUpdateAppRespVO> {
149
+ return getDefaultClient().put(`/apps/${id}`, data)
150
+ }
151
+
152
+ // @endpoint PUT /apps/:app_id/i18n
153
+ // @controller App.UpdateI18n
154
+ export async function updateI18n(
155
+ appId: string,
156
+ data: AppUpdateI18nReqVO
157
+ ): Promise<AppUpdateI18nRespVO> {
158
+ return getDefaultClient().put(`/apps/${appId}/i18n`, data)
159
+ }
160
+
161
+ // @endpoint PUT /apps/:app_id/widgets/:widgets_id
162
+ // @controller App.UpdateWidgets
163
+ export async function updateWidgets(
164
+ appId: string,
165
+ widgetsId: string,
166
+ data: AppUpdateWidgetsReqVO
167
+ ): Promise<AppUpdateWidgetsRespVO> {
168
+ return getDefaultClient().put(`/apps/${appId}/widgets/${widgetsId}`, data)
169
+ }
170
+
171
+ // @endpoint PUT /apps/:app_id/widgets/:widgets_id/ingress-options
172
+ // @controller App.UpdateWidgetsIngressOptions
173
+ export async function updateWidgetsIngressOptions(
174
+ appId: string,
175
+ widgetsId: string,
176
+ data: AppUpdateWidgetsIngressOptionsReqVO
177
+ ): Promise<AppUpdateWidgetsIngressOptionsRespVO> {
178
+ return getDefaultClient().put(`/apps/${appId}/widgets/${widgetsId}/ingress-options`, data)
179
+ }
180
+
181
+ // @endpoint GET /apps/:app_id/widgets
182
+ // @controller App.WidgetsList
183
+ export async function widgetsList(
184
+ appId: string
185
+ ): Promise<AppWidgetsListRespVO> {
186
+ return getDefaultClient().get(`/apps/${appId}/widgets`)
187
+ }
@@ -0,0 +1,59 @@
1
+ import { getDefaultClient } from '../../factory'
2
+ import type {
3
+ AutomateRuleCreateReqVO,
4
+ AutomateRuleCreateRespVO,
5
+ AutomateRuleUpdateReqVO,
6
+ AutomateRuleUpdateRespVO,
7
+ AutomateRuleGetRespVO,
8
+ AutomateRuleListRespVO
9
+ } from '../../types/automate-rule'
10
+
11
+ // @endpoint POST /apps/:app_id/entity/:entity_id/automate-rules
12
+ // @controller AutomateRule.Create
13
+ export async function createAutomateRule(
14
+ appId: string,
15
+ entityId: string,
16
+ data: AutomateRuleCreateReqVO
17
+ ): Promise<AutomateRuleCreateRespVO> {
18
+ return getDefaultClient().post(`/apps/${appId}/entity/${entityId}/automate-rules`, data)
19
+ }
20
+
21
+ // @endpoint PUT /apps/:app_id/entity/:entity_id/automate-rules/:rule_id
22
+ // @controller AutomateRule.Update
23
+ export async function updateAutomateRule(
24
+ appId: string,
25
+ entityId: string,
26
+ ruleId: string,
27
+ data: AutomateRuleUpdateReqVO
28
+ ): Promise<AutomateRuleUpdateRespVO> {
29
+ return getDefaultClient().put(`/apps/${appId}/entity/${entityId}/automate-rules/${ruleId}`, data)
30
+ }
31
+
32
+ // @endpoint DELETE /apps/:app_id/entity/:entity_id/automate-rules/:rule_id
33
+ // @controller AutomateRule.Delete
34
+ export async function deleteAutomateRule(
35
+ appId: string,
36
+ entityId: string,
37
+ ruleId: string
38
+ ): Promise<{ success: boolean }> {
39
+ return getDefaultClient().delete(`/apps/${appId}/entity/${entityId}/automate-rules/${ruleId}`)
40
+ }
41
+
42
+ // @endpoint GET /apps/:app_id/entity/:entity_id/automate-rules
43
+ // @controller AutomateRule.List
44
+ export async function listAutomateRules(
45
+ appId: string,
46
+ entityId: string
47
+ ): Promise<AutomateRuleListRespVO> {
48
+ return getDefaultClient().get(`/apps/${appId}/entity/${entityId}/automate-rules`)
49
+ }
50
+
51
+ // @endpoint GET /apps/:app_id/entity/:entity_id/automate-rules/:rule_id
52
+ // @controller AutomateRule.Get
53
+ export async function getAutomateRule(
54
+ appId: string,
55
+ entityId: string,
56
+ ruleId: string
57
+ ): Promise<AutomateRuleGetRespVO> {
58
+ return getDefaultClient().get(`/apps/${appId}/entity/${entityId}/automate-rules/${ruleId}`)
59
+ }
@@ -0,0 +1,17 @@
1
+ import { getDefaultClient } from '../../factory'
2
+ import type {
3
+ BusinessHooksGetAvailableHookletsRespVO,
4
+ BusinessHooksGetAppConnectionsRespVO
5
+ } from '../../types/business-hooks'
6
+
7
+ // @endpoint GET /api/business-hooks/available-hooklets
8
+ // @controller BusinessHooks.GetAvailableHooklets
9
+ export async function getAvailableHooklets(): Promise<BusinessHooksGetAvailableHookletsRespVO> {
10
+ return getDefaultClient().get('/business-hooks/available-hooklets')
11
+ }
12
+
13
+ // @endpoint GET /api/apps/:app_id/business-hooks/connections
14
+ // @controller BusinessHooks.GetAppConnections
15
+ export async function getAppConnections(appId: string): Promise<BusinessHooksGetAppConnectionsRespVO> {
16
+ return getDefaultClient().get(`/apps/${appId}/business-hooks/connections`)
17
+ }
@@ -0,0 +1,12 @@
1
+ import { getDefaultClient } from '../../factory'
2
+
3
+ export interface AWSConfigVO {
4
+ account_id: string;
5
+ region: string;
6
+ }
7
+
8
+ // @endpoint GET /config/aws
9
+ // @controller App.GetAWSConfig
10
+ export async function getAWSConfig(): Promise<AWSConfigVO> {
11
+ return getDefaultClient().get('/config/aws')
12
+ }
@@ -0,0 +1,88 @@
1
+ import { getDefaultClient } from '../../factory'
2
+ import type {
3
+ DashboardCreateReqVO,
4
+ DashboardCreateRespVO,
5
+ DashboardFetchOptionsRespVO,
6
+ DashboardGetListRespVO,
7
+ DashboardUpdateLayoutReqVO,
8
+ DashboardUpdateLayoutRespVO,
9
+ DashboardUpdateOptionsReqVO,
10
+ DashboardUpdateOptionsRespVO,
11
+ DashboardUpdateTitleReqVO,
12
+ DashboardUpdateTitleRespVO
13
+ } from '../../types/dashboard'
14
+
15
+ // @endpoint POST /apps/:app_id/dashboard
16
+ // @controller Dashboard.Create
17
+ export async function createDashboard(
18
+ appId: string,
19
+ data: DashboardCreateReqVO
20
+ ): Promise<DashboardCreateRespVO> {
21
+ return getDefaultClient().post(`/apps/${appId}/dashboard`, data)
22
+ }
23
+
24
+ // @endpoint GET /apps/:app_id/dashboard/:dashboard_id/options
25
+ // @controller Dashboard.FetchOptions
26
+ export async function getDashboardOptions(
27
+ appId: string,
28
+ dashboardId: string
29
+ ): Promise<DashboardFetchOptionsRespVO> {
30
+ return getDefaultClient().get(`/apps/${appId}/dashboard/${dashboardId}/options`)
31
+ }
32
+
33
+ // @endpoint GET /apps/:app_id/dashboard
34
+ // @controller Dashboard.GetList
35
+ export async function getDashboardList(
36
+ appId: string
37
+ ): Promise<DashboardGetListRespVO> {
38
+ return getDefaultClient().get(`/apps/${appId}/dashboard`)
39
+ }
40
+
41
+ // @endpoint PUT /apps/:app_id/dashboard/:dashboard_id/layout
42
+ // @controller Dashboard.UpdateLayout
43
+ export async function updateDashboardLayout(
44
+ appId: string,
45
+ dashboardId: string,
46
+ data: DashboardUpdateLayoutReqVO
47
+ ): Promise<DashboardUpdateLayoutRespVO> {
48
+ return getDefaultClient().put(`/apps/${appId}/dashboard/${dashboardId}/layout`, data)
49
+ }
50
+
51
+ // @endpoint PUT /apps/:app_id/dashboard/:dashboard_id/options
52
+ // @controller Dashboard.UpdateOptions
53
+ export async function updateDashboardOptions(
54
+ appId: string,
55
+ dashboardId: string,
56
+ data: DashboardUpdateOptionsReqVO
57
+ ): Promise<DashboardUpdateOptionsRespVO> {
58
+ return getDefaultClient().put(`/apps/${appId}/dashboard/${dashboardId}/options`, data)
59
+ }
60
+
61
+ // @endpoint PUT /apps/:app_id/dashboard/:dashboard_id/label
62
+ // @controller Dashboard.UpdateTitle
63
+ export async function updateDashboardTitle(
64
+ appId: string,
65
+ dashboardId: string,
66
+ data: DashboardUpdateTitleReqVO
67
+ ): Promise<DashboardUpdateTitleRespVO> {
68
+ return getDefaultClient().put(`/apps/${appId}/dashboard/${dashboardId}/label`, data)
69
+ }
70
+
71
+ // @endpoint DELETE /apps/:app_id/dashboard/:dashboard_id
72
+ // @controller Dashboard.Delete
73
+ export async function deleteDashboard(
74
+ appId: string,
75
+ dashboardId: string
76
+ ): Promise<any> {
77
+ return getDefaultClient().delete(`/apps/${appId}/dashboard/${dashboardId}`)
78
+ }
79
+
80
+ // @endpoint POST /apps/:app_id/dashboard/:dashboard_id/clone
81
+ // @controller Dashboard.Clone
82
+ export async function cloneDashboard(
83
+ appId: string,
84
+ dashboardId: string,
85
+ data: { name: string }
86
+ ): Promise<any> {
87
+ return getDefaultClient().post(`/apps/${appId}/dashboard/${dashboardId}/clone`, data)
88
+ }