@nocobase/plugin-client 2.1.0-alpha.1 → 2.1.0-alpha.11

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,709 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var swagger_exports = {};
28
+ __export(swagger_exports, {
29
+ default: () => swagger_default
30
+ });
31
+ module.exports = __toCommonJS(swagger_exports);
32
+ var swagger_default = {
33
+ openapi: "3.0.2",
34
+ info: {
35
+ title: "NocoBase API - Client plugin",
36
+ version: "1.0.0"
37
+ },
38
+ paths: {
39
+ "/roles/{roleName}/desktopRoutes:add": {
40
+ post: {
41
+ tags: ["roles.desktopRoutes"],
42
+ summary: "Add desktop route permissions to a role",
43
+ parameters: [{ $ref: "#/components/parameters/RoleNamePath" }],
44
+ requestBody: {
45
+ required: true,
46
+ content: {
47
+ "application/json": {
48
+ schema: { $ref: "#/components/schemas/RouteIdList" }
49
+ }
50
+ }
51
+ },
52
+ responses: {
53
+ 200: { description: "OK" }
54
+ }
55
+ }
56
+ },
57
+ "/roles/{roleName}/desktopRoutes:remove": {
58
+ post: {
59
+ tags: ["roles.desktopRoutes"],
60
+ summary: "Remove desktop route permissions from a role",
61
+ parameters: [{ $ref: "#/components/parameters/RoleNamePath" }],
62
+ requestBody: {
63
+ required: true,
64
+ content: {
65
+ "application/json": {
66
+ schema: { $ref: "#/components/schemas/RouteIdList" }
67
+ }
68
+ }
69
+ },
70
+ responses: {
71
+ 200: { description: "OK" }
72
+ }
73
+ }
74
+ },
75
+ "/roles/{roleName}/desktopRoutes:set": {
76
+ post: {
77
+ tags: ["roles.desktopRoutes"],
78
+ summary: "Set desktop route permissions for a role",
79
+ parameters: [{ $ref: "#/components/parameters/RoleNamePath" }],
80
+ requestBody: {
81
+ required: true,
82
+ content: {
83
+ "application/json": {
84
+ schema: { $ref: "#/components/schemas/RouteIdList" }
85
+ }
86
+ }
87
+ },
88
+ responses: {
89
+ 200: { description: "OK" }
90
+ }
91
+ }
92
+ },
93
+ "/roles/{roleName}/desktopRoutes:list": {
94
+ get: {
95
+ tags: ["roles.desktopRoutes"],
96
+ summary: "List desktop routes granted to a role",
97
+ parameters: [
98
+ { $ref: "#/components/parameters/RoleNamePath" },
99
+ { $ref: "#/components/parameters/PaginateQuery" },
100
+ { $ref: "#/components/parameters/FilterQuery" }
101
+ ],
102
+ responses: {
103
+ 200: {
104
+ description: "OK",
105
+ content: {
106
+ "application/json": {
107
+ schema: {
108
+ type: "object",
109
+ properties: {
110
+ data: {
111
+ type: "array",
112
+ items: { $ref: "#/components/schemas/DesktopRoute" }
113
+ },
114
+ meta: {
115
+ type: "object",
116
+ additionalProperties: true
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "/desktopRoutes:listAccessible": {
127
+ get: {
128
+ tags: ["desktopRoutes"],
129
+ summary: "List desktop routes accessible to the current user",
130
+ description: "List desktop routes that the current user can access. Creating or destroying routes may also create or remove flowModels anchors through desktopRoutes hooks.",
131
+ parameters: [
132
+ { $ref: "#/components/parameters/TreeQuery" },
133
+ { $ref: "#/components/parameters/SortScalarQuery" },
134
+ { $ref: "#/components/parameters/FilterQuery" }
135
+ ],
136
+ responses: {
137
+ 200: {
138
+ description: "OK",
139
+ content: {
140
+ "application/json": {
141
+ schema: { $ref: "#/components/schemas/DataWrappedDesktopRouteListResponse" }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
147
+ },
148
+ "/desktopRoutes:getAccessible": {
149
+ get: {
150
+ tags: ["desktopRoutes"],
151
+ summary: "Get one accessible desktop route",
152
+ description: "Get one accessible desktop route by filter.",
153
+ parameters: [
154
+ { $ref: "#/components/parameters/FilterQuery" },
155
+ { $ref: "#/components/parameters/FilterByTkQuery" }
156
+ ],
157
+ responses: {
158
+ 200: {
159
+ description: "OK",
160
+ content: {
161
+ "application/json": {
162
+ schema: { $ref: "#/components/schemas/DataWrappedNullableDesktopRouteResponse" }
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
168
+ },
169
+ "/desktopRoutes:create": {
170
+ post: {
171
+ tags: ["desktopRoutes"],
172
+ summary: "Create a desktop route",
173
+ description: "Create a desktop route. Side effect: the desktopRoutes.afterCreate hook may create a flowModels anchor using schemaUid for the created route.",
174
+ requestBody: {
175
+ required: true,
176
+ content: {
177
+ "application/json": {
178
+ schema: { $ref: "#/components/schemas/DesktopRouteCreateValues" }
179
+ }
180
+ }
181
+ },
182
+ responses: {
183
+ 200: {
184
+ description: "OK",
185
+ content: {
186
+ "application/json": {
187
+ schema: { $ref: "#/components/schemas/DataWrappedDesktopRouteResponse" }
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
193
+ },
194
+ "/desktopRoutes:update": {
195
+ post: {
196
+ tags: ["desktopRoutes"],
197
+ summary: "Update a desktop route",
198
+ description: "Update a desktop route by filterByTk or filter.",
199
+ parameters: [
200
+ { $ref: "#/components/parameters/FilterByTkQuery" },
201
+ { $ref: "#/components/parameters/FilterQuery" }
202
+ ],
203
+ requestBody: {
204
+ required: true,
205
+ content: {
206
+ "application/json": {
207
+ schema: { $ref: "#/components/schemas/DesktopRouteUpdateValues" }
208
+ }
209
+ }
210
+ },
211
+ responses: {
212
+ 200: {
213
+ description: "OK",
214
+ content: {
215
+ "application/json": {
216
+ schema: { $ref: "#/components/schemas/DataWrappedDesktopRouteResponse" }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ }
222
+ },
223
+ "/desktopRoutes:updateOrCreate": {
224
+ post: {
225
+ tags: ["desktopRoutes"],
226
+ summary: "Update or create a desktop route",
227
+ description: "Update or create a desktop route by filterKeys.",
228
+ parameters: [{ $ref: "#/components/parameters/FilterKeysQuery" }],
229
+ requestBody: {
230
+ required: true,
231
+ content: {
232
+ "application/json": {
233
+ schema: { $ref: "#/components/schemas/DesktopRouteCreateValues" }
234
+ }
235
+ }
236
+ },
237
+ responses: {
238
+ 200: {
239
+ description: "OK",
240
+ content: {
241
+ "application/json": {
242
+ schema: { $ref: "#/components/schemas/DataWrappedDesktopRouteOrListResponse" }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ },
249
+ "/desktopRoutes:move": {
250
+ post: {
251
+ tags: ["desktopRoutes"],
252
+ summary: "Move a desktop route",
253
+ description: "Move a route in the menu tree.",
254
+ parameters: [
255
+ { $ref: "#/components/parameters/SourceIdQuery" },
256
+ { $ref: "#/components/parameters/TargetIdQuery" },
257
+ { $ref: "#/components/parameters/MethodQuery" },
258
+ { $ref: "#/components/parameters/SortFieldQuery" },
259
+ { $ref: "#/components/parameters/TargetScopeQuery" },
260
+ { $ref: "#/components/parameters/StickyQuery" }
261
+ ],
262
+ responses: {
263
+ 200: { description: "OK" }
264
+ }
265
+ }
266
+ },
267
+ "/desktopRoutes:destroy": {
268
+ post: {
269
+ tags: ["desktopRoutes"],
270
+ summary: "Destroy a desktop route",
271
+ description: "Destroy a desktop route. Side effect: the desktopRoutes.afterDestroy hook may remove flowModels anchors related to the destroyed route.",
272
+ parameters: [
273
+ { $ref: "#/components/parameters/FilterByTkQuery" },
274
+ { $ref: "#/components/parameters/FilterQuery" }
275
+ ],
276
+ responses: {
277
+ 200: { description: "OK" }
278
+ }
279
+ }
280
+ },
281
+ "/desktopRoutes:createV2": {
282
+ post: {
283
+ tags: ["desktopRoutes"],
284
+ summary: "Create a Modern page (v2)",
285
+ description: "Create a Modern page (v2) in one transaction: creates the page route and default hidden tab route, inserts the FlowRoute uiSchema shell, and precreates key flowModels subtrees. The operation is idempotent on schemaUid.",
286
+ requestBody: {
287
+ required: true,
288
+ content: {
289
+ "application/json": {
290
+ schema: { $ref: "#/components/schemas/DesktopRouteCreateV2Request" },
291
+ examples: {
292
+ createV2: {
293
+ summary: "Create v2 page",
294
+ value: {
295
+ schemaUid: "page-uid-001",
296
+ parentId: null,
297
+ title: "My Page",
298
+ icon: "Icon"
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ },
305
+ responses: {
306
+ 200: {
307
+ description: "OK",
308
+ content: {
309
+ "application/json": {
310
+ schema: { $ref: "#/components/schemas/DataWrappedDesktopRouteCreateV2Response" }
311
+ }
312
+ }
313
+ },
314
+ 400: {
315
+ description: "Bad Request",
316
+ content: {
317
+ "application/json": {
318
+ schema: { $ref: "#/components/schemas/ErrorResponse" }
319
+ }
320
+ }
321
+ },
322
+ 409: {
323
+ description: "Conflict",
324
+ content: {
325
+ "application/json": {
326
+ schema: { $ref: "#/components/schemas/ErrorResponse" }
327
+ }
328
+ }
329
+ }
330
+ }
331
+ }
332
+ },
333
+ "/desktopRoutes:destroyV2": {
334
+ post: {
335
+ tags: ["desktopRoutes"],
336
+ summary: "Destroy a Modern page (v2)",
337
+ description: "Destroy a Modern page (v2) by schemaUid in one transaction: removes the page route and its children, removes the FlowRoute uiSchema shell, and relies on desktopRoutes.afterDestroy to clean up flowModels anchors.",
338
+ requestBody: {
339
+ required: true,
340
+ content: {
341
+ "application/json": {
342
+ schema: { $ref: "#/components/schemas/DesktopRouteDestroyV2Request" },
343
+ examples: {
344
+ destroyV2: {
345
+ summary: "Destroy v2 page",
346
+ value: { schemaUid: "page-uid-001" }
347
+ }
348
+ }
349
+ }
350
+ }
351
+ },
352
+ responses: {
353
+ 200: {
354
+ description: "OK",
355
+ content: {
356
+ "application/json": {
357
+ schema: { $ref: "#/components/schemas/DataWrappedOkResponse" }
358
+ }
359
+ }
360
+ },
361
+ 400: {
362
+ description: "Bad Request",
363
+ content: {
364
+ "application/json": {
365
+ schema: { $ref: "#/components/schemas/ErrorResponse" }
366
+ }
367
+ }
368
+ }
369
+ }
370
+ }
371
+ }
372
+ },
373
+ components: {
374
+ parameters: {
375
+ RoleNamePath: {
376
+ name: "roleName",
377
+ in: "path",
378
+ description: "Role name.",
379
+ required: true,
380
+ schema: { type: "string" }
381
+ },
382
+ PaginateQuery: {
383
+ name: "paginate",
384
+ in: "query",
385
+ description: "Whether to return paginated result format.",
386
+ required: false,
387
+ schema: { type: "boolean" }
388
+ },
389
+ TreeQuery: {
390
+ name: "tree",
391
+ in: "query",
392
+ description: "Whether to return routes as a tree.",
393
+ required: false,
394
+ schema: { type: "boolean" }
395
+ },
396
+ SortScalarQuery: {
397
+ name: "sort",
398
+ in: "query",
399
+ description: "Sort field, for example `sort`.",
400
+ required: false,
401
+ schema: { type: "string" }
402
+ },
403
+ FilterQuery: {
404
+ name: "filter",
405
+ in: "query",
406
+ description: "JSON filter object.",
407
+ required: false,
408
+ content: {
409
+ "application/json": {
410
+ schema: {
411
+ type: "object",
412
+ additionalProperties: true
413
+ }
414
+ }
415
+ }
416
+ },
417
+ FilterByTkQuery: {
418
+ name: "filterByTk",
419
+ in: "query",
420
+ description: "Filter by target key, usually route id.",
421
+ required: false,
422
+ schema: { type: "string" }
423
+ },
424
+ FilterKeysQuery: {
425
+ name: "filterKeys",
426
+ in: "query",
427
+ description: "Field list used to find an existing route before updateOrCreate.",
428
+ required: true,
429
+ schema: {
430
+ type: "array",
431
+ items: { type: "string" }
432
+ }
433
+ },
434
+ SourceIdQuery: {
435
+ name: "sourceId",
436
+ in: "query",
437
+ description: "Source route id.",
438
+ required: true,
439
+ schema: { type: "string" }
440
+ },
441
+ TargetIdQuery: {
442
+ name: "targetId",
443
+ in: "query",
444
+ description: "Target route id.",
445
+ required: false,
446
+ schema: { type: "string" }
447
+ },
448
+ MethodQuery: {
449
+ name: "method",
450
+ in: "query",
451
+ description: "Move method, for example `insertAfter` or `prepend`.",
452
+ required: false,
453
+ schema: { type: "string" }
454
+ },
455
+ SortFieldQuery: {
456
+ name: "sortField",
457
+ in: "query",
458
+ description: "Sort field name, default is `sort`.",
459
+ required: false,
460
+ schema: { type: "string" }
461
+ },
462
+ TargetScopeQuery: {
463
+ name: "targetScope",
464
+ in: "query",
465
+ description: "JSON scope object used to constrain move target.",
466
+ required: false,
467
+ content: {
468
+ "application/json": {
469
+ schema: {
470
+ type: "object",
471
+ additionalProperties: true
472
+ }
473
+ }
474
+ }
475
+ },
476
+ StickyQuery: {
477
+ name: "sticky",
478
+ in: "query",
479
+ description: "Whether to move the route to the sticky position.",
480
+ required: false,
481
+ schema: { type: "boolean" }
482
+ }
483
+ },
484
+ schemas: {
485
+ RouteIdList: {
486
+ type: "array",
487
+ description: "Desktop route id list.",
488
+ items: { type: "integer" }
489
+ },
490
+ ErrorItem: {
491
+ type: "object",
492
+ required: ["message"],
493
+ properties: {
494
+ code: { type: "string" },
495
+ message: { type: "string" },
496
+ details: {
497
+ type: "object",
498
+ additionalProperties: true
499
+ },
500
+ opId: { type: "string" },
501
+ opIndex: { type: "number" }
502
+ },
503
+ additionalProperties: true
504
+ },
505
+ ErrorResponse: {
506
+ type: "object",
507
+ required: ["errors"],
508
+ properties: {
509
+ errors: {
510
+ type: "array",
511
+ items: { $ref: "#/components/schemas/ErrorItem" }
512
+ }
513
+ },
514
+ additionalProperties: true
515
+ },
516
+ DataWrappedDesktopRouteListResponse: {
517
+ type: "object",
518
+ properties: {
519
+ data: {
520
+ type: "array",
521
+ items: { $ref: "#/components/schemas/DesktopRoute" }
522
+ }
523
+ },
524
+ additionalProperties: true
525
+ },
526
+ DataWrappedNullableDesktopRouteResponse: {
527
+ type: "object",
528
+ properties: {
529
+ data: {
530
+ anyOf: [{ $ref: "#/components/schemas/DesktopRoute" }, { type: "null" }]
531
+ }
532
+ },
533
+ additionalProperties: true
534
+ },
535
+ DataWrappedDesktopRouteResponse: {
536
+ type: "object",
537
+ properties: {
538
+ data: { $ref: "#/components/schemas/DesktopRoute" }
539
+ },
540
+ additionalProperties: true
541
+ },
542
+ DataWrappedDesktopRouteOrListResponse: {
543
+ type: "object",
544
+ properties: {
545
+ data: {
546
+ anyOf: [
547
+ { $ref: "#/components/schemas/DesktopRoute" },
548
+ {
549
+ type: "array",
550
+ items: { $ref: "#/components/schemas/DesktopRoute" }
551
+ }
552
+ ]
553
+ }
554
+ },
555
+ additionalProperties: true
556
+ },
557
+ DataWrappedDesktopRouteCreateV2Response: {
558
+ type: "object",
559
+ properties: {
560
+ data: { $ref: "#/components/schemas/DesktopRouteCreateV2Response" }
561
+ },
562
+ additionalProperties: true
563
+ },
564
+ DataWrappedOkResponse: {
565
+ type: "object",
566
+ properties: {
567
+ data: { $ref: "#/components/schemas/OkResponse" }
568
+ },
569
+ additionalProperties: true
570
+ },
571
+ DesktopRoute: {
572
+ type: "object",
573
+ properties: {
574
+ id: {
575
+ oneOf: [{ type: "integer" }, { type: "string" }]
576
+ },
577
+ title: { type: "string" },
578
+ tooltip: { type: "string", nullable: true },
579
+ type: { type: "string" },
580
+ icon: { type: "string", nullable: true },
581
+ path: { type: "string", nullable: true },
582
+ parentId: {
583
+ anyOf: [{ type: "integer" }, { type: "string" }, { type: "null" }]
584
+ },
585
+ schemaUid: { type: "string", nullable: true },
586
+ menuSchemaUid: { type: "string", nullable: true },
587
+ tabSchemaName: { type: "string", nullable: true },
588
+ hideInMenu: { type: "boolean", nullable: true },
589
+ enableTabs: { type: "boolean", nullable: true },
590
+ enableHeader: { type: "boolean", nullable: true },
591
+ displayTitle: { type: "boolean", nullable: true },
592
+ hidden: { type: "boolean", nullable: true },
593
+ sort: { type: "integer", nullable: true },
594
+ options: {
595
+ type: "object",
596
+ additionalProperties: true,
597
+ nullable: true
598
+ },
599
+ children: {
600
+ type: "array",
601
+ items: { $ref: "#/components/schemas/DesktopRoute" }
602
+ }
603
+ },
604
+ additionalProperties: true
605
+ },
606
+ DesktopRouteCreateValues: {
607
+ type: "object",
608
+ properties: {
609
+ type: { type: "string" },
610
+ title: { type: "string" },
611
+ tooltip: { type: "string" },
612
+ icon: { type: "string" },
613
+ parentId: {
614
+ anyOf: [{ type: "integer" }, { type: "string" }, { type: "null" }]
615
+ },
616
+ schemaUid: { type: "string" },
617
+ menuSchemaUid: { type: "string" },
618
+ tabSchemaName: { type: "string" },
619
+ hideInMenu: { type: "boolean" },
620
+ enableTabs: { type: "boolean" },
621
+ enableHeader: { type: "boolean" },
622
+ displayTitle: { type: "boolean" },
623
+ hidden: { type: "boolean" },
624
+ sort: { type: "integer" },
625
+ options: {
626
+ type: "object",
627
+ additionalProperties: true
628
+ },
629
+ children: {
630
+ type: "array",
631
+ items: {
632
+ type: "object",
633
+ additionalProperties: true
634
+ }
635
+ }
636
+ },
637
+ additionalProperties: true
638
+ },
639
+ DesktopRouteUpdateValues: {
640
+ type: "object",
641
+ additionalProperties: true
642
+ },
643
+ DesktopRouteCreateV2Request: {
644
+ type: "object",
645
+ required: ["schemaUid", "title"],
646
+ properties: {
647
+ schemaUid: { type: "string" },
648
+ parentId: {
649
+ anyOf: [{ type: "integer" }, { type: "string" }, { type: "null" }]
650
+ },
651
+ title: { type: "string" },
652
+ icon: { type: "string" }
653
+ },
654
+ additionalProperties: false
655
+ },
656
+ DesktopRouteCreateV2Response: {
657
+ type: "object",
658
+ required: ["page", "defaultTab"],
659
+ properties: {
660
+ page: {
661
+ type: "object",
662
+ properties: {
663
+ id: {
664
+ oneOf: [{ type: "integer" }, { type: "string" }]
665
+ },
666
+ schemaUid: { type: "string" },
667
+ title: { type: "string" },
668
+ icon: { type: "string", nullable: true },
669
+ parentId: {
670
+ anyOf: [{ type: "integer" }, { type: "string" }, { type: "null" }]
671
+ },
672
+ menuSchemaUid: { type: "string", nullable: true }
673
+ },
674
+ additionalProperties: true
675
+ },
676
+ defaultTab: {
677
+ type: "object",
678
+ nullable: true,
679
+ properties: {
680
+ id: {
681
+ oneOf: [{ type: "integer" }, { type: "string" }]
682
+ },
683
+ schemaUid: { type: "string" },
684
+ tabSchemaName: { type: "string", nullable: true }
685
+ },
686
+ additionalProperties: true
687
+ }
688
+ },
689
+ additionalProperties: true
690
+ },
691
+ DesktopRouteDestroyV2Request: {
692
+ type: "object",
693
+ required: ["schemaUid"],
694
+ properties: {
695
+ schemaUid: { type: "string" }
696
+ },
697
+ additionalProperties: false
698
+ },
699
+ OkResponse: {
700
+ type: "object",
701
+ required: ["ok"],
702
+ properties: {
703
+ ok: { type: "boolean" }
704
+ },
705
+ additionalProperties: true
706
+ }
707
+ }
708
+ }
709
+ };