@antcde/connect-ts 0.0.49 → 0.0.50

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 (228) hide show
  1. package/build/AntHttpClient.d.ts +3 -3
  2. package/build/AntHttpClient.d.ts.map +1 -1
  3. package/build/cjs/AntConnect.d.ts +69 -0
  4. package/build/cjs/AntConnect.d.ts.map +1 -0
  5. package/build/cjs/AntConnect.js +68 -0
  6. package/build/cjs/AntHttpClient.d.ts +34 -0
  7. package/build/cjs/AntHttpClient.d.ts.map +1 -0
  8. package/build/cjs/AntHttpClient.js +106 -0
  9. package/build/cjs/ResponseStatusCodes.d.ts +64 -0
  10. package/build/cjs/ResponseStatusCodes.d.ts.map +1 -0
  11. package/build/cjs/ResponseStatusCodes.js +67 -0
  12. package/build/cjs/comms/client.d.ts +33 -0
  13. package/build/cjs/comms/client.d.ts.map +1 -0
  14. package/build/cjs/comms/client.js +122 -0
  15. package/build/cjs/comms/host.d.ts +29 -0
  16. package/build/cjs/comms/host.d.ts.map +1 -0
  17. package/build/cjs/comms/host.js +132 -0
  18. package/build/cjs/comms/models.d.ts +58 -0
  19. package/build/cjs/comms/models.d.ts.map +1 -0
  20. package/build/cjs/comms/models.js +4 -0
  21. package/build/cjs/comms/utils.d.ts +45 -0
  22. package/build/cjs/comms/utils.d.ts.map +1 -0
  23. package/build/cjs/comms/utils.js +82 -0
  24. package/build/cjs/index.d.ts +19 -0
  25. package/build/cjs/index.d.ts.map +1 -0
  26. package/build/cjs/index.js +34 -0
  27. package/build/cjs/services/AppService.d.ts +97 -0
  28. package/build/cjs/services/AppService.d.ts.map +1 -0
  29. package/build/cjs/services/AppService.js +27 -0
  30. package/build/cjs/services/ClientService.d.ts +19 -0
  31. package/build/cjs/services/ClientService.d.ts.map +1 -0
  32. package/build/cjs/services/ClientService.js +10 -0
  33. package/build/cjs/services/ColumnService.d.ts +38 -0
  34. package/build/cjs/services/ColumnService.d.ts.map +1 -0
  35. package/build/cjs/services/ColumnService.js +12 -0
  36. package/build/cjs/services/DmsService.d.ts +58 -0
  37. package/build/cjs/services/DmsService.d.ts.map +1 -0
  38. package/build/cjs/services/DmsService.js +27 -0
  39. package/build/cjs/services/DownloadService.d.ts +16 -0
  40. package/build/cjs/services/DownloadService.d.ts.map +1 -0
  41. package/build/cjs/services/DownloadService.js +9 -0
  42. package/build/cjs/services/LabelService.d.ts +35 -0
  43. package/build/cjs/services/LabelService.d.ts.map +1 -0
  44. package/build/cjs/services/LabelService.js +13 -0
  45. package/build/cjs/services/LaravelQueueService.d.ts +8 -0
  46. package/build/cjs/services/LaravelQueueService.d.ts.map +1 -0
  47. package/build/cjs/services/LaravelQueueService.js +9 -0
  48. package/build/cjs/services/LicenseService.d.ts +27 -0
  49. package/build/cjs/services/LicenseService.d.ts.map +1 -0
  50. package/build/cjs/services/LicenseService.js +13 -0
  51. package/build/cjs/services/LinkService.d.ts +17 -0
  52. package/build/cjs/services/LinkService.d.ts.map +1 -0
  53. package/build/cjs/services/LinkService.js +11 -0
  54. package/build/cjs/services/ModuleService.d.ts +45 -0
  55. package/build/cjs/services/ModuleService.d.ts.map +1 -0
  56. package/build/cjs/services/ModuleService.js +19 -0
  57. package/build/cjs/services/NewsService.d.ts +19 -0
  58. package/build/cjs/services/NewsService.d.ts.map +1 -0
  59. package/build/cjs/services/NewsService.js +9 -0
  60. package/build/cjs/services/PermissionService.d.ts +28 -0
  61. package/build/cjs/services/PermissionService.d.ts.map +1 -0
  62. package/build/cjs/services/PermissionService.js +12 -0
  63. package/build/cjs/services/Project/ProjectUserService.d.ts +17 -0
  64. package/build/cjs/services/Project/ProjectUserService.d.ts.map +1 -0
  65. package/build/cjs/services/Project/ProjectUserService.js +10 -0
  66. package/build/cjs/services/ProjectMemberService.d.ts +24 -0
  67. package/build/cjs/services/ProjectMemberService.d.ts.map +1 -0
  68. package/build/cjs/services/ProjectMemberService.js +10 -0
  69. package/build/cjs/services/ProjectRoleService.d.ts +77 -0
  70. package/build/cjs/services/ProjectRoleService.d.ts.map +1 -0
  71. package/build/cjs/services/ProjectRoleService.js +16 -0
  72. package/build/cjs/services/ProjectService.d.ts +73 -0
  73. package/build/cjs/services/ProjectService.d.ts.map +1 -0
  74. package/build/cjs/services/ProjectService.js +15 -0
  75. package/build/cjs/services/RBAC/PermissionService.d.ts +55 -0
  76. package/build/cjs/services/RBAC/PermissionService.d.ts.map +1 -0
  77. package/build/cjs/services/RBAC/PermissionService.js +12 -0
  78. package/build/cjs/services/RBAC/RoleService.d.ts +36 -0
  79. package/build/cjs/services/RBAC/RoleService.d.ts.map +1 -0
  80. package/build/cjs/services/RBAC/RoleService.js +18 -0
  81. package/build/cjs/services/RecordService.d.ts +50 -0
  82. package/build/cjs/services/RecordService.d.ts.map +1 -0
  83. package/build/cjs/services/RecordService.js +37 -0
  84. package/build/cjs/services/RevisionService.d.ts +29 -0
  85. package/build/cjs/services/RevisionService.d.ts.map +1 -0
  86. package/build/cjs/services/RevisionService.js +12 -0
  87. package/build/cjs/services/SbsService.d.ts +34 -0
  88. package/build/cjs/services/SbsService.d.ts.map +1 -0
  89. package/build/cjs/services/SbsService.js +13 -0
  90. package/build/cjs/services/ScriptsService.d.ts +45 -0
  91. package/build/cjs/services/ScriptsService.d.ts.map +1 -0
  92. package/build/cjs/services/ScriptsService.js +23 -0
  93. package/build/cjs/services/SignService.d.ts +9 -0
  94. package/build/cjs/services/SignService.d.ts.map +1 -0
  95. package/build/cjs/services/SignService.js +8 -0
  96. package/build/cjs/services/TableQueryService.d.ts +46 -0
  97. package/build/cjs/services/TableQueryService.d.ts.map +1 -0
  98. package/build/cjs/services/TableQueryService.js +14 -0
  99. package/build/cjs/services/TableService.d.ts +87 -0
  100. package/build/cjs/services/TableService.d.ts.map +1 -0
  101. package/build/cjs/services/TableService.js +19 -0
  102. package/build/cjs/services/TaskQueryService.d.ts +12 -0
  103. package/build/cjs/services/TaskQueryService.d.ts.map +1 -0
  104. package/build/cjs/services/TaskQueryService.js +11 -0
  105. package/build/cjs/services/TaskService.d.ts +249 -0
  106. package/build/cjs/services/TaskService.d.ts.map +1 -0
  107. package/build/cjs/services/TaskService.js +143 -0
  108. package/build/cjs/services/TokenService.d.ts +32 -0
  109. package/build/cjs/services/TokenService.d.ts.map +1 -0
  110. package/build/cjs/services/TokenService.js +12 -0
  111. package/build/cjs/services/UserService.d.ts +99 -0
  112. package/build/cjs/services/UserService.d.ts.map +1 -0
  113. package/build/cjs/services/UserService.js +46 -0
  114. package/build/cjs/services/WorkflowService.d.ts +112 -0
  115. package/build/cjs/services/WorkflowService.d.ts.map +1 -0
  116. package/build/cjs/services/WorkflowService.js +185 -0
  117. package/build/cjs/types.d.ts +21 -0
  118. package/build/cjs/types.d.ts.map +1 -0
  119. package/build/cjs/types.js +2 -0
  120. package/build/comms/models.d.ts +1 -0
  121. package/build/comms/models.d.ts.map +1 -1
  122. package/build/index.d.ts +1 -0
  123. package/build/index.d.ts.map +1 -1
  124. package/build/services/DmsService.d.ts +14 -2
  125. package/build/services/DmsService.d.ts.map +1 -1
  126. package/build/services/DmsService.js +7 -4
  127. package/build/services/Project/ProjectUserService.d.ts +1 -1
  128. package/build/services/Project/ProjectUserService.d.ts.map +1 -1
  129. package/build/services/ProjectService.d.ts +12 -8
  130. package/build/services/ProjectService.d.ts.map +1 -1
  131. package/build/services/ProjectService.js +1 -1
  132. package/build/services/RBAC/PermissionService.d.ts +1 -1
  133. package/build/services/RBAC/PermissionService.d.ts.map +1 -1
  134. package/build/services/RBAC/RoleService.d.ts +1 -1
  135. package/build/services/RBAC/RoleService.d.ts.map +1 -1
  136. package/build/services/SignService.d.ts +3 -2
  137. package/build/services/SignService.d.ts.map +1 -1
  138. package/build/services/SignService.js +1 -1
  139. package/build/services/TableService.d.ts +8 -0
  140. package/build/services/TableService.d.ts.map +1 -1
  141. package/build/services/TaskService.d.ts +1 -1
  142. package/build/services/TaskService.d.ts.map +1 -1
  143. package/build/services/TaskService.js +1 -1
  144. package/build/services/TokenService.d.ts +1 -1
  145. package/build/services/TokenService.d.ts.map +1 -1
  146. package/build/services/TokenService.js +6 -6
  147. package/build/services/UserService.d.ts +2 -1
  148. package/build/services/UserService.d.ts.map +1 -1
  149. package/build/services/WorkflowService.js +1 -1
  150. package/build/types/AntConnect.d.ts +69 -0
  151. package/build/types/AntConnect.d.ts.map +1 -0
  152. package/build/types/AntHttpClient.d.ts +34 -0
  153. package/build/types/AntHttpClient.d.ts.map +1 -0
  154. package/build/types/ResponseStatusCodes.d.ts +64 -0
  155. package/build/types/ResponseStatusCodes.d.ts.map +1 -0
  156. package/build/types/comms/client.d.ts +33 -0
  157. package/build/types/comms/client.d.ts.map +1 -0
  158. package/build/types/comms/host.d.ts +29 -0
  159. package/build/types/comms/host.d.ts.map +1 -0
  160. package/build/types/comms/models.d.ts +58 -0
  161. package/build/types/comms/models.d.ts.map +1 -0
  162. package/build/types/comms/utils.d.ts +45 -0
  163. package/build/types/comms/utils.d.ts.map +1 -0
  164. package/build/types/index.d.ts +19 -0
  165. package/build/types/index.d.ts.map +1 -0
  166. package/build/types/services/AppService.d.ts +97 -0
  167. package/build/types/services/AppService.d.ts.map +1 -0
  168. package/build/types/services/ClientService.d.ts +19 -0
  169. package/build/types/services/ClientService.d.ts.map +1 -0
  170. package/build/types/services/ColumnService.d.ts +38 -0
  171. package/build/types/services/ColumnService.d.ts.map +1 -0
  172. package/build/types/services/DmsService.d.ts +58 -0
  173. package/build/types/services/DmsService.d.ts.map +1 -0
  174. package/build/types/services/DownloadService.d.ts +16 -0
  175. package/build/types/services/DownloadService.d.ts.map +1 -0
  176. package/build/types/services/LabelService.d.ts +35 -0
  177. package/build/types/services/LabelService.d.ts.map +1 -0
  178. package/build/types/services/LaravelQueueService.d.ts +8 -0
  179. package/build/types/services/LaravelQueueService.d.ts.map +1 -0
  180. package/build/types/services/LicenseService.d.ts +27 -0
  181. package/build/types/services/LicenseService.d.ts.map +1 -0
  182. package/build/types/services/LinkService.d.ts +17 -0
  183. package/build/types/services/LinkService.d.ts.map +1 -0
  184. package/build/types/services/ModuleService.d.ts +45 -0
  185. package/build/types/services/ModuleService.d.ts.map +1 -0
  186. package/build/types/services/NewsService.d.ts +19 -0
  187. package/build/types/services/NewsService.d.ts.map +1 -0
  188. package/build/types/services/PermissionService.d.ts +28 -0
  189. package/build/types/services/PermissionService.d.ts.map +1 -0
  190. package/build/types/services/Project/ProjectUserService.d.ts +17 -0
  191. package/build/types/services/Project/ProjectUserService.d.ts.map +1 -0
  192. package/build/types/services/ProjectMemberService.d.ts +24 -0
  193. package/build/types/services/ProjectMemberService.d.ts.map +1 -0
  194. package/build/types/services/ProjectRoleService.d.ts +77 -0
  195. package/build/types/services/ProjectRoleService.d.ts.map +1 -0
  196. package/build/types/services/ProjectService.d.ts +73 -0
  197. package/build/types/services/ProjectService.d.ts.map +1 -0
  198. package/build/types/services/RBAC/PermissionService.d.ts +55 -0
  199. package/build/types/services/RBAC/PermissionService.d.ts.map +1 -0
  200. package/build/types/services/RBAC/RoleService.d.ts +36 -0
  201. package/build/types/services/RBAC/RoleService.d.ts.map +1 -0
  202. package/build/types/services/RecordService.d.ts +50 -0
  203. package/build/types/services/RecordService.d.ts.map +1 -0
  204. package/build/types/services/RevisionService.d.ts +29 -0
  205. package/build/types/services/RevisionService.d.ts.map +1 -0
  206. package/build/types/services/SbsService.d.ts +34 -0
  207. package/build/types/services/SbsService.d.ts.map +1 -0
  208. package/build/types/services/ScriptsService.d.ts +45 -0
  209. package/build/types/services/ScriptsService.d.ts.map +1 -0
  210. package/build/types/services/SignService.d.ts +9 -0
  211. package/build/types/services/SignService.d.ts.map +1 -0
  212. package/build/types/services/TableQueryService.d.ts +46 -0
  213. package/build/types/services/TableQueryService.d.ts.map +1 -0
  214. package/build/types/services/TableService.d.ts +87 -0
  215. package/build/types/services/TableService.d.ts.map +1 -0
  216. package/build/types/services/TaskQueryService.d.ts +12 -0
  217. package/build/types/services/TaskQueryService.d.ts.map +1 -0
  218. package/build/types/services/TaskService.d.ts +249 -0
  219. package/build/types/services/TaskService.d.ts.map +1 -0
  220. package/build/types/services/TokenService.d.ts +32 -0
  221. package/build/types/services/TokenService.d.ts.map +1 -0
  222. package/build/types/services/UserService.d.ts +99 -0
  223. package/build/types/services/UserService.d.ts.map +1 -0
  224. package/build/types/services/WorkflowService.d.ts +112 -0
  225. package/build/types/services/WorkflowService.d.ts.map +1 -0
  226. package/build/types/types.d.ts +21 -0
  227. package/build/types/types.d.ts.map +1 -0
  228. package/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ import type { AntConnect } from "../AntConnect";
2
+ import type { Observable, SubscriptionLike } from 'rxjs';
3
+ import type { Context, LocaleData, Notepad, Notification, Toolbar } from './models';
4
+ interface HostParams {
5
+ windowChanges: Observable<Window>;
6
+ contextChanges: Observable<Context>;
7
+ addNotification: (notification: Notification) => void;
8
+ connect: AntConnect;
9
+ notepad: Notepad;
10
+ locales: Observable<LocaleData>;
11
+ appState?: string;
12
+ }
13
+ export interface Host extends SubscriptionLike {
14
+ toolbar: Observable<Toolbar> & {
15
+ get: () => Toolbar;
16
+ set: {
17
+ search: (value: string) => Promise<unknown>;
18
+ };
19
+ };
20
+ isConnectionInitialized: Observable<boolean>;
21
+ appState: {
22
+ changes: Observable<string>;
23
+ get: () => string;
24
+ set: (state: string) => void;
25
+ };
26
+ }
27
+ export declare function newCommsHost(params: HostParams): Host;
28
+ export {};
29
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../src/comms/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAoB;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAW,gBAAgB,EAAE,MAAM,MAAM,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAuBnF,UAAU,UAAU;IAClB,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;IACjC,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IACnC,eAAe,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAA;IACrD,OAAO,EAAE,UAAU,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AASD,MAAM,WAAW,IAAK,SAAQ,gBAAgB;IAC5C,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG;QAAE,GAAG,EAAE,MAAM,OAAO,CAAC;QAAC,GAAG,EAAE;YAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;SAAE,CAAA;KAAE,CAAA;IAC3G,uBAAuB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC5C,QAAQ,EAAE;QACR,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;QAC3B,GAAG,EAAE,MAAM,MAAM,CAAA;QACjB,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;KAC7B,CAAA;CACF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CA+BrD"}
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.newCommsHost = newCommsHost;
13
+ const post_robot_1 = require("post-robot");
14
+ const rxjs_1 = require("rxjs");
15
+ const innerFrom_1 = require("rxjs/internal/observable/innerFrom");
16
+ const utils_1 = require("./utils");
17
+ function newCommsHost(params) {
18
+ const scope = (0, utils_1.newScope)();
19
+ const clientId = (0, utils_1.newId)();
20
+ const connectionInitialized = new rxjs_1.ReplaySubject(1);
21
+ const box = { scope, params, clientId, connectionInitialized };
22
+ const toolbar = handleToolbarChanges(box);
23
+ const appState = handleAppStateChanges(box);
24
+ handleInit(box);
25
+ handleContextChanges(box);
26
+ handleNotificationChanges(box);
27
+ handleConnectChanges(box);
28
+ handleNotepadChanges(box);
29
+ params.locales
30
+ .pipe((0, rxjs_1.switchMap)(locales => (0, rxjs_1.combineLatest)([(0, innerFrom_1.fromArrayLike)([locales]), params.windowChanges, connectionInitialized])), (0, rxjs_1.concatMap)(([locales, window]) => (0, post_robot_1.send)(window, `ant/${clientId}/locales`, { locales })), (0, utils_1.takeUntilClosed)(scope))
31
+ .subscribe();
32
+ scope.add(connectionInitialized);
33
+ return Object.assign(scope, {
34
+ toolbar,
35
+ appState,
36
+ isConnectionInitialized: connectionInitialized
37
+ .asObservable()
38
+ .pipe((0, rxjs_1.map)(() => true), (0, rxjs_1.startWith)(false), (0, utils_1.takeUntilClosed)(scope)),
39
+ });
40
+ }
41
+ function handleInit({ scope, params, clientId, connectionInitialized }) {
42
+ // tried all the forms I can think of to catch the error of `send` when timeout. None of them succeeded, so second best thing was to add loggers to know that is solved after retrying.
43
+ params.windowChanges
44
+ .pipe((0, rxjs_1.switchMap)(window => (0, post_robot_1.send)(window, 'ant/comms/init', { clientId }, { fireAndForget: false })), (0, rxjs_1.retry)({
45
+ delay: (error, attempt) => (0, rxjs_1.of)(error).pipe((0, rxjs_1.delay)(3000), (0, rxjs_1.tap)(error => console.info('retrying connection initialization', { attempt, error }))),
46
+ }), (0, rxjs_1.tap)(() => console.info('connection initialized')), (0, utils_1.takeUntilClosed)(scope))
47
+ .subscribe({ next: () => connectionInitialized.next(undefined) });
48
+ }
49
+ function handleNotificationChanges({ scope, params, clientId }) {
50
+ scope
51
+ .resolve((0, post_robot_1.on)(`ant/${clientId}/notifications`, (_a) => __awaiter(this, [_a], void 0, function* ({ data }) {
52
+ const notification = data;
53
+ params.addNotification(notification);
54
+ return notification;
55
+ })))
56
+ .catch(rxjs_1.identity); // consume the cancellation error
57
+ }
58
+ function handleConnectChanges({ scope, params, clientId }) {
59
+ scope
60
+ .resolve((0, post_robot_1.on)(`ant/${clientId}/connect`, ({ data }) => {
61
+ const { service, name, args } = data;
62
+ return params.connect[service][name](...args);
63
+ }))
64
+ .catch(rxjs_1.identity); // consume the cancellation error
65
+ }
66
+ function handleNotepadChanges({ scope, params, clientId }) {
67
+ scope
68
+ .resolve((0, post_robot_1.on)(`ant/${clientId}/notepad`, (e) => __awaiter(this, void 0, void 0, function* () {
69
+ const { name, data } = e.data;
70
+ switch (name) {
71
+ case 'hide':
72
+ return params.notepad.hide();
73
+ case 'show/tab':
74
+ return params.notepad.show(data.tab);
75
+ case 'show/task':
76
+ return params.notepad.showTask(data.task, data.select);
77
+ case 'sbs/select':
78
+ return params.notepad.selectSbs(data.item);
79
+ }
80
+ })))
81
+ .catch(rxjs_1.identity); // consume the cancellation error
82
+ }
83
+ function handleContextChanges({ params, clientId, scope, connectionInitialized }) {
84
+ const { contextChanges, windowChanges } = params;
85
+ (0, rxjs_1.combineLatest)([windowChanges, contextChanges, connectionInitialized])
86
+ .pipe((0, rxjs_1.filter)(([window]) => !window.closed), (0, rxjs_1.concatMap)(([window, context]) => (0, post_robot_1.send)(window, `ant/${clientId}/context`, { context }, { fireAndForget: true })), (0, utils_1.takeUntilClosed)(scope))
87
+ .subscribe();
88
+ }
89
+ function handleToolbarChanges({ scope, clientId, connectionInitialized, params }) {
90
+ const toolbar = new rxjs_1.BehaviorSubject({ menu: [], search: { enabled: false, input: '' } });
91
+ scope.on(`ant/${clientId}/toolbar`)
92
+ .pipe((0, rxjs_1.tap)(({ data, source }) => {
93
+ var _a;
94
+ const toolbar = data.toolbar;
95
+ const emit = (name, data) => connectionInitialized
96
+ .pipe((0, rxjs_1.take)(1), (0, rxjs_1.concatMap)(() => (0, post_robot_1.send)(source, name, data)))
97
+ .forEach(rxjs_1.identity);
98
+ [toolbar === null || toolbar === void 0 ? void 0 : toolbar.start, ...(_a = toolbar.menu) !== null && _a !== void 0 ? _a : []]
99
+ .flatMap((item, index) => item ? [{ item, index }] : [])
100
+ .forEach(({ item, index }) => item.onClick = () => emit(`ant/${clientId}/toolbar/click`, { index }));
101
+ }), (0, rxjs_1.map)(({ data }) => data.toolbar))
102
+ .subscribe(value => toolbar.next(value));
103
+ return Object.assign(toolbar.asObservable(), {
104
+ get: () => toolbar.value,
105
+ set: {
106
+ search: (value) => {
107
+ return (0, rxjs_1.combineLatest)([params.windowChanges, connectionInitialized])
108
+ .pipe((0, rxjs_1.take)(1), (0, rxjs_1.concatMap)(([source]) => (0, post_robot_1.send)(source, `ant/${clientId}/toolbar/search`, { value })))
109
+ .forEach(rxjs_1.identity);
110
+ },
111
+ },
112
+ });
113
+ }
114
+ function handleAppStateChanges({ scope, params, clientId, connectionInitialized }) {
115
+ var _a;
116
+ const appState = new rxjs_1.BehaviorSubject({ timestamp: 0, state: (_a = params.appState) !== null && _a !== void 0 ? _a : '' });
117
+ scope
118
+ .on(`ant/${clientId}/state`)
119
+ .subscribe(({ data }) => { var _a; return data.timestamp > ((_a = appState.value) === null || _a === void 0 ? void 0 : _a.timestamp) && appState.next(data); });
120
+ scope
121
+ .on(`ant/${clientId}/state/get`, () => appState.value)
122
+ .subscribe();
123
+ appState
124
+ .asObservable()
125
+ .pipe((0, rxjs_1.concatMap)(state => (0, rxjs_1.combineLatest)([(0, innerFrom_1.fromArrayLike)([state]), params.windowChanges, connectionInitialized])), (0, rxjs_1.concatMap)(([state, window]) => (0, post_robot_1.send)(window, `ant/${clientId}/state`, state, { fireAndForget: true })), (0, utils_1.takeUntilClosed)(scope))
126
+ .subscribe();
127
+ return {
128
+ changes: appState.asObservable().pipe((0, rxjs_1.map)(e => e.state), (0, rxjs_1.distinctUntilChanged)(), (0, utils_1.takeUntilClosed)(scope)),
129
+ get: () => appState.value.state,
130
+ set: (state) => appState.next({ timestamp: Date.now(), state }),
131
+ };
132
+ }
@@ -0,0 +1,58 @@
1
+ import type { License } from "../services/LicenseService";
2
+ import type { ProjectShort } from "../services/ProjectService";
3
+ import type { Task } from "../services/TaskService";
4
+ import type { User } from "../services/UserService";
5
+ import type { Subscription } from 'rxjs';
6
+ export interface Context {
7
+ user?: User | null;
8
+ license?: License | null;
9
+ task?: Task | null;
10
+ project?: ProjectShort | null;
11
+ sbs?: {
12
+ code: string;
13
+ } | null;
14
+ locale?: string | null;
15
+ darkMode?: boolean | null;
16
+ }
17
+ export interface ToolbarItem {
18
+ icon: string;
19
+ title: string;
20
+ disabled?: boolean;
21
+ onClick?: () => void;
22
+ }
23
+ export interface Toolbar {
24
+ start?: ToolbarItem;
25
+ title?: string;
26
+ search: {
27
+ enabled: boolean;
28
+ input: string;
29
+ };
30
+ menu: ToolbarItem[];
31
+ }
32
+ export type NotepadVisibility = boolean | 'task' | 'apps' | 'tasks' | 'sbs';
33
+ export interface Notepad {
34
+ show: (tab?: NotepadVisibility) => PromiseLike<unknown>;
35
+ /**
36
+ * Show a task in the notepad. Optionally it can be selected as the current Task.
37
+ * @param task
38
+ * @param select
39
+ */
40
+ showTask: (task: {
41
+ id: string;
42
+ }, select?: true) => PromiseLike<unknown>;
43
+ hide: () => PromiseLike<unknown>;
44
+ selectSbs: (item: {
45
+ code: string;
46
+ }) => PromiseLike<unknown>;
47
+ }
48
+ export declare const notificationTypes: readonly ["success", "error", "warning", "info"];
49
+ export type Notifications = Record<typeof notificationTypes[number], (message: string) => Promise<unknown> & Subscription>;
50
+ export interface Notification {
51
+ type: typeof notificationTypes[number];
52
+ message: string;
53
+ }
54
+ export interface LocaleData {
55
+ locale?: string;
56
+ availableLocales: string[];
57
+ }
58
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/comms/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,mCAAiC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,mCAAiC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,gCAA8B;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,gCAA8B;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC7B,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE;QACN,OAAO,EAAE,OAAO,CAAA;QAChB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,IAAI,EAAE,WAAW,EAAE,CAAA;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;AAE3E,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,iBAAiB,KAAK,WAAW,CAAC,OAAO,CAAC,CAAA;IACvD;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,IAAI,KAAK,WAAW,CAAC,OAAO,CAAC,CAAA;IACvE,IAAI,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAA;IAChC,SAAS,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,WAAW,CAAC,OAAO,CAAC,CAAA;CAC5D;AAED,eAAO,MAAM,iBAAiB,kDAAmD,CAAA;AACjF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,CAAA;AAE1H,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAA;IACtC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAC3B"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notificationTypes = void 0;
4
+ exports.notificationTypes = ['success', 'error', 'warning', 'info'];
@@ -0,0 +1,45 @@
1
+ import type { MonoTypeOperatorFunction } from 'rxjs';
2
+ import { Observable, Subscription } from 'rxjs';
3
+ /**
4
+ * Ensures a stream is closed whenever the parent subscription is closed.
5
+ *
6
+ * This will make sure the stream is not sending results after a UI component is destroyed.
7
+ * @param subscription
8
+ */
9
+ export declare function takeUntilClosed<T>(subscription: Subscription): MonoTypeOperatorFunction<T>;
10
+ export interface Message<T extends object = any, R = unknown> {
11
+ data: T;
12
+ origin: string;
13
+ source: Window;
14
+ response?: R;
15
+ }
16
+ type HandlerType<T, R> = (event: {
17
+ source: Window;
18
+ origin: string;
19
+ data: T;
20
+ }) => Promise<R> | R;
21
+ export declare function newScope(parent?: Subscription): Subscription & {
22
+ resolve: <T>(value: PromiseLike<T> | {
23
+ cancel: () => void;
24
+ }) => Promise<T> & Subscription;
25
+ newScope: () => Subscription & any;
26
+ on: <T extends object = any, R extends object = any>(name: string, handler?: HandlerType<T, R>) => Observable<Message<T, unknown>>;
27
+ once: <T extends object = any, R extends object = any>(name: string, handler?: (message: Message<T>) => Promise<R>) => Observable<Message<T, unknown>>;
28
+ send: <T extends object = any, R extends object = any>(window: Window, name: string, data: T, options?: {
29
+ fireAndForget?: boolean;
30
+ timeout?: number;
31
+ }) => Observable<Message<R, unknown>>;
32
+ };
33
+ export type Scope = ReturnType<typeof newScope>;
34
+ export declare const newId: () => string;
35
+ /**
36
+ * The toRaw and structuredClonew are failing under certain conditions, but this good old one not.
37
+ * @param value
38
+ */
39
+ export declare function clone<T>(value: T): T;
40
+ export interface AppStateData {
41
+ timestamp: number;
42
+ state: string;
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/comms/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,MAAM,CAAA;AAEpD,OAAO,EAAqC,UAAU,EAAW,YAAY,EAAwB,MAAM,MAAM,CAAA;AAIjH;;;;;GAKG;AAEH,wBAAgB,eAAe,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAW1F;AA0BD,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,OAAO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d"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.newId = void 0;
13
+ exports.takeUntilClosed = takeUntilClosed;
14
+ exports.newScope = newScope;
15
+ exports.clone = clone;
16
+ const post_robot_1 = require("post-robot");
17
+ const rxjs_1 = require("rxjs");
18
+ const innerFrom_1 = require("rxjs/internal/observable/innerFrom");
19
+ const isPromise_1 = require("rxjs/internal/util/isPromise");
20
+ /**
21
+ * Ensures a stream is closed whenever the parent subscription is closed.
22
+ *
23
+ * This will make sure the stream is not sending results after a UI component is destroyed.
24
+ * @param subscription
25
+ */
26
+ function takeUntilClosed(subscription) {
27
+ return (observable) => {
28
+ const subject = new rxjs_1.Subject();
29
+ subscription.add(() => {
30
+ subject.next();
31
+ subject.complete();
32
+ });
33
+ return observable.pipe((0, rxjs_1.takeUntil)(subject), (0, rxjs_1.takeWhile)(() => !subscription.closed));
34
+ };
35
+ }
36
+ /**
37
+ * Helper function that can process all the `post-robot` functions. It will wrap the `post-robot` function in a Observable to make it cancellable.
38
+ *
39
+ * Cancelling the scope will result in all the ongoing `post-robot` functions to be cancelled.
40
+ */
41
+ function newResolve(parent) {
42
+ return (value) => {
43
+ const subscription = new rxjs_1.Subscription();
44
+ const promise = (0, isPromise_1.isPromise)(value)
45
+ ? (0, rxjs_1.firstValueFrom)((0, innerFrom_1.fromPromise)(value).pipe(takeUntilClosed(subscription)))
46
+ : new Promise((_, error) => {
47
+ subscription.add(() => {
48
+ value.cancel();
49
+ rxjs_1.EMPTY.pipe((0, rxjs_1.first)()).subscribe({ error }); // send error, because it is default behavior to either a success or an error
50
+ });
51
+ });
52
+ parent.add(subscription);
53
+ return Object.assign(promise, subscription);
54
+ };
55
+ }
56
+ function newScope(parent) {
57
+ const subscription = new rxjs_1.Subscription();
58
+ parent === null || parent === void 0 ? void 0 : parent.add(subscription);
59
+ return Object.assign(subscription, {
60
+ resolve: newResolve(subscription),
61
+ newScope: () => newScope(subscription),
62
+ on: (name, handler) => new rxjs_1.Observable((subscriber) => {
63
+ const cancellable = (0, post_robot_1.on)(name, (params) => __awaiter(this, void 0, void 0, function* () {
64
+ const response = yield Promise.resolve().then(() => handler === null || handler === void 0 ? void 0 : handler(params));
65
+ subscriber.next(Object.assign(Object.assign({}, params), { response }));
66
+ return response;
67
+ }));
68
+ subscriber.add(() => cancellable.cancel());
69
+ }).pipe(takeUntilClosed(subscription)),
70
+ once: (name, handler) => (0, innerFrom_1.fromPromise)((0, post_robot_1.once)(name, handler)).pipe(takeUntilClosed(subscription), (0, rxjs_1.map)(e => e)),
71
+ send: (window, name, data, options) => (0, innerFrom_1.fromPromise)((0, post_robot_1.send)(window, name, data, options)).pipe(takeUntilClosed(subscription), (0, rxjs_1.map)(e => e)),
72
+ });
73
+ }
74
+ const newId = () => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString();
75
+ exports.newId = newId;
76
+ /**
77
+ * The toRaw and structuredClonew are failing under certain conditions, but this good old one not.
78
+ * @param value
79
+ */
80
+ function clone(value) {
81
+ return JSON.parse(JSON.stringify(value));
82
+ }
@@ -0,0 +1,19 @@
1
+ export * from './AntConnect';
2
+ export { type AntConnect } from './AntConnect';
3
+ export { AntHttpClient, newAntHttpClient, type NewAntHttpClientArgs } from './AntHttpClient';
4
+ export { type Client, newCommsClient } from './comms/client';
5
+ export { newNotepad } from './comms/client';
6
+ export { type Host, newCommsHost } from './comms/host';
7
+ export type { Context, LocaleData, Notepad, NotepadVisibility, Notification, Notifications, Toolbar, ToolbarItem } from './comms/models';
8
+ export { clone, newScope, type Scope } from './comms/utils';
9
+ export type { App } from './services/AppService';
10
+ export { type License } from './services/LicenseService';
11
+ export { type Project, type ProjectRequestBody, type ProjectShort } from './services/ProjectService';
12
+ export type { SbsRecord } from './services/SbsService';
13
+ export type { TableQueryService, TableQueryShort } from './services/TableQueryService';
14
+ export { type Task } from './services/TaskService';
15
+ export { defaultGetTaskQuery, defaultGetTasksQuery } from './services/TaskService';
16
+ export type { Token, TokenData, TokenRequestBody } from './services/TokenService';
17
+ export type { FileInRequest, User, UserShort } from './services/UserService';
18
+ export * from './types';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EAAE,KAAK,MAAM,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,KAAK,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACtD,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAExI,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAA;AAC3D,YAAY,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACpG,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACtF,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClF,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACjF,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAE5E,cAAc,SAAS,CAAA"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.defaultGetTasksQuery = exports.defaultGetTaskQuery = exports.newScope = exports.clone = exports.newCommsHost = exports.newNotepad = exports.newCommsClient = exports.newAntHttpClient = exports.AntHttpClient = void 0;
18
+ __exportStar(require("./AntConnect"), exports);
19
+ var AntHttpClient_1 = require("./AntHttpClient");
20
+ Object.defineProperty(exports, "AntHttpClient", { enumerable: true, get: function () { return AntHttpClient_1.AntHttpClient; } });
21
+ Object.defineProperty(exports, "newAntHttpClient", { enumerable: true, get: function () { return AntHttpClient_1.newAntHttpClient; } });
22
+ var client_1 = require("./comms/client");
23
+ Object.defineProperty(exports, "newCommsClient", { enumerable: true, get: function () { return client_1.newCommsClient; } });
24
+ var client_2 = require("./comms/client");
25
+ Object.defineProperty(exports, "newNotepad", { enumerable: true, get: function () { return client_2.newNotepad; } });
26
+ var host_1 = require("./comms/host");
27
+ Object.defineProperty(exports, "newCommsHost", { enumerable: true, get: function () { return host_1.newCommsHost; } });
28
+ var utils_1 = require("./comms/utils");
29
+ Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return utils_1.clone; } });
30
+ Object.defineProperty(exports, "newScope", { enumerable: true, get: function () { return utils_1.newScope; } });
31
+ var TaskService_1 = require("./services/TaskService");
32
+ Object.defineProperty(exports, "defaultGetTaskQuery", { enumerable: true, get: function () { return TaskService_1.defaultGetTaskQuery; } });
33
+ Object.defineProperty(exports, "defaultGetTasksQuery", { enumerable: true, get: function () { return TaskService_1.defaultGetTasksQuery; } });
34
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,97 @@
1
+ import type { MessageResponse } from "../AntConnect";
2
+ import type { AntHttpClient } from "../AntHttpClient";
3
+ import type { DataWrapper } from '../types';
4
+ import type { Project } from './ProjectService';
5
+ type AppAvailability = 'always' | 'on_demand';
6
+ export interface ResourceApp {
7
+ id: number;
8
+ app_id: number;
9
+ app_version_id: number;
10
+ resource_id: string;
11
+ resource_type: string;
12
+ project_id: string;
13
+ created_at: string;
14
+ updated_at: string;
15
+ deleted_at: string | null;
16
+ }
17
+ export interface App {
18
+ id: number;
19
+ title: string;
20
+ description: string | null;
21
+ color: string;
22
+ is_published: boolean;
23
+ is_system: boolean;
24
+ is_private: boolean;
25
+ project_required: boolean;
26
+ icon: string;
27
+ image: string | null;
28
+ versions: AppVersion[];
29
+ created_at: string;
30
+ updated_at: string;
31
+ loading?: boolean;
32
+ enabled?: boolean;
33
+ enabled_in_license: boolean;
34
+ latest_version: boolean;
35
+ availability: AppAvailability;
36
+ user_id: string;
37
+ }
38
+ export interface AppVersion {
39
+ id: number;
40
+ app_id: number;
41
+ version: string;
42
+ release_type: string;
43
+ release_notes: string | null;
44
+ resources: ResourceApp[];
45
+ url: string;
46
+ created_at: string;
47
+ updated_at: string;
48
+ loading?: boolean;
49
+ enabled?: boolean;
50
+ enabled_in_license?: boolean;
51
+ }
52
+ export interface AppVersionFormData {
53
+ app_id: number;
54
+ app_version_id: number;
55
+ }
56
+ export interface AppFormData {
57
+ title?: string;
58
+ description?: string;
59
+ color?: string;
60
+ icon?: string;
61
+ image?: File | null;
62
+ build?: File | null;
63
+ image64?: string;
64
+ build64?: string;
65
+ release_type?: string;
66
+ release_notes?: string;
67
+ is_system: boolean;
68
+ is_private: boolean;
69
+ project_required: boolean;
70
+ license_id: string | null;
71
+ }
72
+ export interface AllLicenseAppsParams {
73
+ licenseId: string;
74
+ type: 'all' | 'installed' | 'available';
75
+ search: string;
76
+ }
77
+ export interface AppService {
78
+ fetchApps: () => Promise<DataWrapper<App[]>>;
79
+ fetchSystemApps: (licenseId: string) => Promise<DataWrapper<App[]>>;
80
+ fetchApp: (resource: string, resourceId: string, appId: number) => Promise<DataWrapper<App>>;
81
+ createApp: (appData: AppFormData) => Promise<App>;
82
+ updateApp: (appId: number, appData: Partial<AppFormData>) => Promise<App>;
83
+ deleteApp: (appId: number) => Promise<MessageResponse>;
84
+ fetchAppProjects: (licenseId: string, appId: number) => Promise<Project[]>;
85
+ fetchAppDetails: (appId: number) => Promise<Partial<App>>;
86
+ fetchLicenseApps: (licenseId: string) => Promise<DataWrapper<App[]>>;
87
+ fetchAllLicenseApps: (licenseId: AllLicenseAppsParams['licenseId'], type: AllLicenseAppsParams['type'], search?: AllLicenseAppsParams['search']) => Promise<DataWrapper<App[]>>;
88
+ addAppToLicense: (licenseId: string, appId: number, appVersionId: number) => Promise<any>;
89
+ removeAppFromLicense: (licenseId: string, appId: number, appVersionId: number | null) => Promise<any>;
90
+ fetchProjectApps: (projectId: string) => Promise<DataWrapper<App[]>>;
91
+ addAppToProject: (projectId: string, appId: number, appVersionId: number) => Promise<any>;
92
+ removeAppFromProject: (projectId: string, appId: number, appVersionId: number | null) => Promise<any>;
93
+ fetchUserApps: (resource: string, resourceId: string) => Promise<DataWrapper<App[]>>;
94
+ }
95
+ export declare function newAppService(client: AntHttpClient): AppService;
96
+ export default AppService;
97
+ //# sourceMappingURL=AppService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppService.d.ts","sourceRoot":"","sources":["../../../src/services/AppService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAuB;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C,KAAK,eAAe,GAAG,QAAQ,GAAG,WAAW,CAAA;AAE7C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,gBAAgB,EAAE,O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ppService = newAppService;
4
+ function newAppService(client) {
5
+ return {
6
+ fetchApps: () => client.get('/apps'),
7
+ fetchApp: (resource, resourceId, appId) => client.get(`/${resource}/${resourceId}/apps/${appId}`),
8
+ fetchAppDetails: appId => client.get(`/apps/${appId}`),
9
+ createApp: appData => client.post(`/apps`, appData),
10
+ updateApp: (appId, appData) => client.put(`/apps/${appId}`, appData), // Workaround to make Laravel FormData PATCH/PUT requests work
11
+ deleteApp: appId => client.delete(`/apps/${appId}`),
12
+ fetchAppProjects: (licenseId, appId) => client.get(`/licenses/${licenseId}/apps/${appId}/projects`),
13
+ fetchSystemApps: licenseId => client.get(`/licenses/${licenseId}/systemApps`),
14
+ fetchLicenseApps: licenseId => client.get(`/licenses/${licenseId}/apps`),
15
+ fetchAllLicenseApps: (licenseId, type, search = '') => client.get(`/licenses/${licenseId}/all-apps`, { params: { type, search } }),
16
+ addAppToLicense: (licenseId, appId, appVersionId) => client.post(`/licenses/${licenseId}/apps`, { app_id: appId, app_version_id: appVersionId }),
17
+ removeAppFromLicense: (licenseId, appId, appVersionId) => client.delete(`/licenses/${licenseId}/apps`, {
18
+ data: { app_id: appId, app_version_id: appVersionId !== null && appVersionId !== void 0 ? appVersionId : null },
19
+ }),
20
+ fetchProjectApps: projectId => client.get(`/projects/${projectId}/apps`),
21
+ addAppToProject: (projectId, appId, appVersionId) => client.post(`/projects/${projectId}/apps`, { app_id: appId, app_version_id: appVersionId }),
22
+ removeAppFromProject: (projectId, appId, appVersionId) => client.delete(`/projects/${projectId}/apps`, {
23
+ data: { app_id: appId, app_version_id: appVersionId },
24
+ }),
25
+ fetchUserApps: (resource, resourceId) => client.get(`/${resource}/${resourceId}/user-apps`),
26
+ };
27
+ }
@@ -0,0 +1,19 @@
1
+ import type { MessageResponse } from "../AntConnect";
2
+ import type { AntHttpClient } from "../AntHttpClient";
3
+ export interface Client {
4
+ app_name: string;
5
+ client_id: number;
6
+ client_secret: string;
7
+ token_uuid: string;
8
+ }
9
+ export interface CreateClientRequest {
10
+ name: string;
11
+ }
12
+ export interface ClientService {
13
+ getClients: () => Promise<Client[]>;
14
+ createClient: (data: CreateClientRequest) => Promise<Client>;
15
+ deleteClient: (clientId: string) => Promise<MessageResponse>;
16
+ }
17
+ export declare function newClientService(httpClient: AntHttpClient): ClientService;
18
+ export default ClientService;
19
+ //# sourceMappingURL=ClientService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientService.d.ts","sourceRoot":"","sources":["../../../src/services/ClientService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAuB;AAEpD,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACnC,YAAY,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5D,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;CAC7D;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,aAAa,CAMzE;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newClientService = newClientService;
4
+ function newClientService(httpClient) {
5
+ return {
6
+ getClients: () => httpClient.get('/clients'),
7
+ createClient: data => httpClient.post('/clients', data),
8
+ deleteClient: clientId => httpClient.delete(`/clients/${clientId}`),
9
+ };
10
+ }
@@ -0,0 +1,38 @@
1
+ import type { MessageResponse } from "../AntConnect";
2
+ import type { AntHttpClient } from "../AntHttpClient";
3
+ import type { TableRelation } from './TableService';
4
+ export interface Column {
5
+ id: string;
6
+ name: string;
7
+ type: string;
8
+ default_value: string | boolean | null;
9
+ options_value: string[];
10
+ order: number;
11
+ required: boolean;
12
+ is_unique: boolean;
13
+ table: string;
14
+ relation: TableRelation;
15
+ field_name: string;
16
+ has_relation?: boolean;
17
+ }
18
+ export type ColumnKey = 'order' | 'name' | 'type' | 'is_unique' | 'has_relation' | 'default_value' | 'field_name' | 'options_value' | 'required';
19
+ export interface ColumnRequestBody {
20
+ table?: string;
21
+ name: string;
22
+ type?: string;
23
+ default_value: string;
24
+ options_value?: string;
25
+ order: number;
26
+ required: boolean;
27
+ is_unique?: boolean;
28
+ }
29
+ export interface ColumnService {
30
+ getColumns: (tableId: string) => Promise<Column[]>;
31
+ getColumn: (columnId: string) => Promise<Column>;
32
+ createColumn: (data: ColumnRequestBody) => Promise<Column>;
33
+ updateColumn: (columnId: string, data: ColumnRequestBody) => Promise<Column>;
34
+ deleteColumn: (columnId: string) => Promise<MessageResponse>;
35
+ }
36
+ export declare function newColumnService(httpClient: AntHttpClient): ColumnService;
37
+ export default ColumnService;
38
+ //# sourceMappingURL=ColumnService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColumnService.d.ts","sourceRoot":"","sources":["../../../src/services/ColumnService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAoB;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAuB;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IACtC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,K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