@carthooks/arcubase-cli 0.1.20 → 0.1.22

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 (60) hide show
  1. package/bundle/arcubase-admin.mjs +1669 -163
  2. package/bundle/arcubase.mjs +1669 -163
  3. package/dist/generated/command_registry.generated.d.ts +300 -0
  4. package/dist/generated/command_registry.generated.d.ts.map +1 -1
  5. package/dist/generated/command_registry.generated.js +416 -0
  6. package/dist/generated/help_examples.generated.d.ts +191 -0
  7. package/dist/generated/help_examples.generated.d.ts.map +1 -1
  8. package/dist/generated/help_examples.generated.js +277 -0
  9. package/dist/generated/type_index.generated.d.ts +44 -1
  10. package/dist/generated/type_index.generated.d.ts.map +1 -1
  11. package/dist/generated/type_index.generated.js +46 -1
  12. package/dist/generated/zod_registry.generated.d.ts +32 -1
  13. package/dist/generated/zod_registry.generated.d.ts.map +1 -1
  14. package/dist/generated/zod_registry.generated.js +41 -0
  15. package/dist/runtime/dev_sdk_gen.d.ts +9 -0
  16. package/dist/runtime/dev_sdk_gen.d.ts.map +1 -0
  17. package/dist/runtime/dev_sdk_gen.js +319 -0
  18. package/dist/runtime/execute.d.ts.map +1 -1
  19. package/dist/runtime/execute.js +384 -32
  20. package/dist/runtime/zod_registry.d.ts.map +1 -1
  21. package/dist/runtime/zod_registry.js +66 -0
  22. package/package.json +1 -1
  23. package/sdk-dist/api/admin/index.ts +1 -0
  24. package/sdk-dist/api/admin/ingress.ts +11 -0
  25. package/sdk-dist/api/admin/public-link.ts +48 -0
  26. package/sdk-dist/api/shared-link/form.ts +42 -1
  27. package/sdk-dist/api/user/index.ts +0 -1
  28. package/sdk-dist/docs/runtime-reference/access-rule.md +19 -0
  29. package/sdk-dist/docs/runtime-reference/dashboard.md +15 -0
  30. package/sdk-dist/docs/runtime-reference/dev-sdk-gen.md +41 -0
  31. package/sdk-dist/docs/runtime-reference/help-examples/admin/access-rule/bulk-apply.json +105 -0
  32. package/sdk-dist/docs/runtime-reference/help-examples/admin/dashboard/update-layout.json +16 -0
  33. package/sdk-dist/docs/runtime-reference/help-examples/admin/widget/create.json +33 -0
  34. package/sdk-dist/docs/runtime-reference/help-examples/admin/widget/preview-data.json +42 -0
  35. package/sdk-dist/docs/runtime-reference/widgets.md +40 -0
  36. package/sdk-dist/generated/command_registry.generated.ts +416 -0
  37. package/sdk-dist/generated/help_examples.generated.ts +277 -0
  38. package/sdk-dist/generated/type_index.generated.ts +46 -1
  39. package/sdk-dist/generated/zod_registry.generated.ts +62 -0
  40. package/sdk-dist/types/app.ts +37 -1
  41. package/sdk-dist/types/common.ts +77 -35
  42. package/sdk-dist/types/index.ts +1 -1
  43. package/sdk-dist/types/ingress.ts +31 -0
  44. package/sdk-dist/types/public-link.ts +10 -0
  45. package/sdk-dist/types/shared-link.ts +16 -1
  46. package/sdk-dist/types/user-action.ts +1 -43
  47. package/src/generated/command_registry.generated.ts +416 -0
  48. package/src/generated/help_examples.generated.ts +277 -0
  49. package/src/generated/type_index.generated.ts +46 -1
  50. package/src/generated/zod_registry.generated.ts +62 -0
  51. package/src/runtime/dev_sdk_gen.ts +360 -0
  52. package/src/runtime/execute.ts +484 -52
  53. package/src/runtime/zod_registry.ts +66 -0
  54. package/src/tests/command_registry.test.ts +21 -2
  55. package/src/tests/dev_sdk_gen.test.ts +226 -0
  56. package/src/tests/docs_readability.test.ts +15 -0
  57. package/src/tests/execute_validation.test.ts +215 -0
  58. package/src/tests/help.test.ts +83 -0
  59. package/sdk-dist/api/user/copilot.ts +0 -20
  60. package/sdk-dist/types/copilot.ts +0 -34
@@ -21,10 +21,25 @@ test('admin root help exposes reset surface nouns only', async () => {
21
21
  assert.match(out.text, /\btable\b/)
22
22
  assert.match(out.text, /\baccess-rule\b/)
23
23
  assert.match(out.text, /\bworkflow\b/)
24
+ assert.match(out.text, /\bdev\b/)
24
25
  assert.doesNotMatch(out.text, /\bentity\b/)
25
26
  assert.doesNotMatch(out.text, /\bingress\b/)
26
27
  })
27
28
 
29
+ test('admin dev sdk-gen help documents typed project sdk generation', async () => {
30
+ const moduleHelp = await executeCLI('admin', ['dev', '--help'], env as any, async () => new Response('{}'))
31
+ assert.equal(moduleHelp.kind, 'help')
32
+ assert.match(moduleHelp.text, /sdk-gen/)
33
+
34
+ const commandHelp = await executeCLI('admin', ['dev', 'sdk-gen', '--help'], env as any, async () => new Response('{}'))
35
+ assert.equal(commandHelp.kind, 'help')
36
+ assert.match(commandHelp.text, /arcubase-admin dev sdk-gen/)
37
+ assert.match(commandHelp.text, /--app-id/)
38
+ assert.match(commandHelp.text, /--out/)
39
+ assert.match(commandHelp.text, /field\.key/)
40
+ assert.match(commandHelp.text, /createArcubaseSdk\(\{ baseURL, accessToken, refreshToken \}\)/)
41
+ })
42
+
28
43
  test('user root help exposes reset surface nouns only', async () => {
29
44
  const out = await executeCLI('user', ['--help'], env as any, async () => new Response('{}'))
30
45
  assert.equal(out.kind, 'help')
@@ -99,6 +114,30 @@ test('admin table create help gives one-call body-json example', async () => {
99
114
  assert.match(out.text, /"type":"textarea"/)
100
115
  })
101
116
 
117
+ test('dashboard and widget help exposes agent-readable body docs and flags', async () => {
118
+ const adminDashboardCreate = await executeCLI('admin', ['dashboard', 'create', '--help'], env as any, async () => new Response('{}'))
119
+ assert.equal(adminDashboardCreate.kind, 'help')
120
+ assert.match(adminDashboardCreate.text, /arcubase-admin dashboard create/)
121
+ assert.match(adminDashboardCreate.text, /endpoint: \/apps\/:app_id\/dashboard/)
122
+ assert.match(adminDashboardCreate.text, /body: DashboardCreateReqVO via --body-json/)
123
+ assert.match(adminDashboardCreate.text, /^types:$/m)
124
+ assert.match(adminDashboardCreate.text, /^docs:$/m)
125
+
126
+ const adminWidgetList = await executeCLI('admin', ['widget', 'list', '--help'], env as any, async () => new Response('{}'))
127
+ assert.equal(adminWidgetList.kind, 'help')
128
+ assert.match(adminWidgetList.text, /arcubase-admin widget list/)
129
+ assert.match(adminWidgetList.text, /endpoint: \/apps\/:app_id\/widgets/)
130
+ assert.match(adminWidgetList.text, /query flags: --type, --dashboard-id, --ingress-id, --query-file/)
131
+ assert.match(adminWidgetList.text, /^docs:$/m)
132
+
133
+ const userWidgetData = await executeCLI('user', ['widget', 'data', '--help'], env as any, async () => new Response('{}'))
134
+ assert.equal(userWidgetData.kind, 'help')
135
+ assert.match(userWidgetData.text, /arcubase widget data/)
136
+ assert.match(userWidgetData.text, /body: FetchWidgetsDataReqVO via --body-json/)
137
+ assert.match(userWidgetData.text, /^types:$/m)
138
+ assert.match(userWidgetData.text, /^docs:$/m)
139
+ })
140
+
102
141
  test('admin access-rule help gives update whitelist and assign-users body-json examples', async () => {
103
142
  const create = await executeCLI('admin', ['access-rule', 'create', '--help'], env as any, async () => new Response('{}'))
104
143
  assert.equal(create.kind, 'help')
@@ -153,6 +192,50 @@ test('admin access-rule create help-examples show canonical ingress scopes and c
153
192
  assert.doesNotMatch(out.text, /"type":"member"/)
154
193
  })
155
194
 
195
+ test('admin access-rule bulk-apply help-examples show transactional matrix body', async () => {
196
+ const out = await executeCLI('admin', ['access-rule', 'bulk-apply', '--help-examples'], env as any, async () => new Response('{}'))
197
+ assert.equal(out.kind, 'help')
198
+ assert.match(out.text, /arcubase-admin access-rule bulk-apply --help-examples/)
199
+ assert.match(out.text, /"mode":"upsert_by_name"/)
200
+ assert.match(out.text, /"table_id":2188893443/)
201
+ assert.match(out.text, /"type":"department"/)
202
+ assert.match(out.text, /"type":"actor"/)
203
+ assert.match(out.text, /"value":"\[\[current_user\]\]"/)
204
+ assert.doesNotMatch(out.text, forbiddenArcubaseUserTerms())
205
+ assert.doesNotMatch(out.text, /"type":"member"/)
206
+ })
207
+
208
+ test('admin dashboard update-layout help-examples show top-level layout array', async () => {
209
+ const out = await executeCLI('admin', ['dashboard', 'update-layout', '--help-examples'], env as any, async () => new Response('{}'))
210
+ assert.equal(out.kind, 'help')
211
+ assert.match(out.text, /arcubase-admin dashboard update-layout --help-examples/)
212
+ assert.match(out.text, /--body-json '\[\{"id":2188892001,"x":0,"y":0,"w":12,"h":6\}\]'/)
213
+ assert.match(out.text, /the request body is a top-level array/)
214
+ assert.match(out.text, /do not wrap the array/)
215
+ })
216
+
217
+ test('admin widget preview-data help-examples show chart query body without widget id', async () => {
218
+ const out = await executeCLI('admin', ['widget', 'preview-data', '--help-examples'], env as any, async () => new Response('{}'))
219
+ assert.equal(out.kind, 'help')
220
+ assert.match(out.text, /arcubase-admin widget preview-data --help-examples/)
221
+ assert.match(out.text, /"dataSource":2188891001/)
222
+ assert.match(out.text, /"dataSourceType":"entity"/)
223
+ assert.match(out.text, /"Aggregate":"sum"/)
224
+ assert.match(out.text, /preview-data does not accept --widget-id/)
225
+ assert.match(out.text, /do not send widget_id or id/)
226
+ assert.doesNotMatch(out.text, /--widget-id <widget_id>/)
227
+ })
228
+
229
+ test('admin widget create help-examples avoid manual options type', async () => {
230
+ const out = await executeCLI('admin', ['widget', 'create', '--help-examples'], env as any, async () => new Response('{}'))
231
+ assert.equal(out.kind, 'help')
232
+ assert.match(out.text, /arcubase-admin widget create --help-examples/)
233
+ assert.match(out.text, /"type":"chart","options":\{"dashboard_id":2188892001\}/)
234
+ assert.match(out.text, /do not set options.type by hand/)
235
+ assert.match(out.text, /dashboard_id selects a dashboard widget/)
236
+ assert.doesNotMatch(out.text, /"options":\{"dashboard_id":2188892001,"type":/)
237
+ })
238
+
156
239
  test('user row bulk-update help-examples show ids and condition selection bodies', async () => {
157
240
  const out = await executeCLI('user', ['row', 'bulk-update', '--help-examples'], env as any, async () => new Response('{}'))
158
241
  assert.equal(out.kind, 'help')
@@ -1,20 +0,0 @@
1
- import { getDefaultClient } from '../../factory'
2
- import type {
3
- CopilotInitConversationRespVO,
4
- CopilotSendMessageReqVO,
5
- CopilotSendMessageRespVO
6
- } from '../../types/copilot'
7
-
8
- // @endpoint POST /copilot/init
9
- // @controller CopilotController.InitConversation
10
- export async function initCopilotConversation(): Promise<CopilotInitConversationRespVO> {
11
- return getDefaultClient().post('/copilot/init')
12
- }
13
-
14
- // @endpoint POST /copilot/send-message
15
- // @controller CopilotController.SendMessage
16
- export async function sendCopilotMessage(
17
- data: CopilotSendMessageReqVO
18
- ): Promise<CopilotSendMessageRespVO> {
19
- return getDefaultClient().post('/copilot/send-message', data)
20
- }
@@ -1,34 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- // @ts-nocheck
4
- /*
5
- * ---------------------------------------------------------------
6
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
7
- * ## ##
8
- * ## AUTHOR: acacode ##
9
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
10
- * ---------------------------------------------------------------
11
- */
12
-
13
- import type { ErrorResponse } from './common'
14
-
15
- export interface CopilotMessage {
16
- Content?: string;
17
- Type?: string;
18
- }
19
-
20
- export interface CopilotInitConversationRespVO {
21
- ID?: string;
22
- }
23
-
24
- export interface CopilotSendMessageReqVO {
25
- conversation_id?: string;
26
- current_view?: string;
27
- messages?: CopilotMessage[];
28
- params?: Record<string, string>;
29
- }
30
-
31
- export interface CopilotSendMessageRespVO {
32
- ID?: string;
33
- Request?: string;
34
- }