@rytass/bpm-core-client 0.1.3 → 0.1.4

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/LICENSE +21 -0
  2. package/package.json +5 -4
  3. package/src/index.js +7 -0
  4. package/src/index.js.map +1 -0
  5. package/src/lib/api-auth-client.d.ts +73 -0
  6. package/src/lib/api-auth-client.js +121 -0
  7. package/src/lib/api-auth-client.js.map +1 -0
  8. package/src/lib/form/form-api.d.ts +48 -0
  9. package/src/lib/form/form-api.js +228 -0
  10. package/src/lib/form/form-api.js.map +1 -0
  11. package/src/lib/form/form-rendering.d.ts +52 -0
  12. package/src/lib/form/form-rendering.js +341 -0
  13. package/src/lib/form/form-rendering.js.map +1 -0
  14. package/src/lib/form/index.js +6 -0
  15. package/src/lib/form/index.js.map +1 -0
  16. package/src/lib/graphql-client.d.ts +45 -0
  17. package/src/lib/graphql-client.js +92 -0
  18. package/src/lib/graphql-client.js.map +1 -0
  19. package/src/lib/member-api.d.ts +49 -0
  20. package/src/lib/member-api.js +72 -0
  21. package/src/lib/member-api.js.map +1 -0
  22. package/src/lib/organization/index.js +5 -0
  23. package/src/lib/organization/index.js.map +1 -0
  24. package/src/lib/organization/organization-api.d.ts +168 -0
  25. package/src/lib/organization/organization-api.js +394 -0
  26. package/src/lib/organization/organization-api.js.map +1 -0
  27. package/src/lib/template/index.js +5 -0
  28. package/src/lib/template/index.js.map +1 -0
  29. package/src/lib/template/template-api.d.ts +150 -0
  30. package/src/lib/template/template-api.js +407 -0
  31. package/src/lib/template/template-api.js.map +1 -0
  32. package/src/lib/workflow/index.js +5 -0
  33. package/src/lib/workflow/index.js.map +1 -0
  34. package/src/lib/workflow/workflow-api.d.ts +376 -0
  35. package/src/lib/workflow/workflow-api.js +867 -0
  36. package/src/lib/workflow/workflow-api.js.map +1 -0
  37. package/eslint.config.mjs +0 -19
  38. package/jest.config.cts +0 -10
  39. package/project.json +0 -66
  40. package/src/lib/api-auth-client.ts +0 -169
  41. package/src/lib/form/form-api.spec.ts +0 -81
  42. package/src/lib/form/form-api.ts +0 -388
  43. package/src/lib/form/form-rendering.ts +0 -580
  44. package/src/lib/graphql-client.spec.ts +0 -65
  45. package/src/lib/graphql-client.ts +0 -114
  46. package/src/lib/member-api.ts +0 -129
  47. package/src/lib/organization/organization-api.spec.ts +0 -90
  48. package/src/lib/organization/organization-api.ts +0 -710
  49. package/src/lib/template/template-api.spec.ts +0 -88
  50. package/src/lib/template/template-api.ts +0 -772
  51. package/src/lib/workflow/workflow-api.spec.ts +0 -132
  52. package/src/lib/workflow/workflow-api.ts +0 -1749
  53. package/tsconfig.json +0 -27
  54. package/tsconfig.lib.json +0 -16
  55. package/tsconfig.spec.json +0 -16
  56. /package/src/{index.ts → index.d.ts} +0 -0
  57. /package/src/lib/form/{index.ts → index.d.ts} +0 -0
  58. /package/src/lib/organization/{index.ts → index.d.ts} +0 -0
  59. /package/src/lib/template/{index.ts → index.d.ts} +0 -0
  60. /package/src/lib/workflow/{index.ts → index.d.ts} +0 -0
@@ -1,88 +0,0 @@
1
- import {
2
- createApprovalTemplate,
3
- listApprovalTemplates,
4
- } from './template-api';
5
-
6
- interface CapturedRequest {
7
- readonly query: string;
8
- readonly variables?: Readonly<Record<string, unknown>>;
9
- }
10
-
11
- function installFetchMock<TData>(payload: TData): {
12
- readonly capture: () => CapturedRequest;
13
- readonly restore: () => void;
14
- } {
15
- const originalFetch = global.fetch;
16
- const fetchMock = jest.fn<
17
- Promise<Response>,
18
- [RequestInfo | URL, RequestInit?]
19
- >();
20
- fetchMock.mockImplementation(
21
- async () =>
22
- new Response(JSON.stringify({ data: payload }), {
23
- headers: { 'Content-Type': 'application/json' },
24
- status: 200,
25
- }),
26
- );
27
- (global as { fetch: typeof fetch }).fetch =
28
- fetchMock as unknown as typeof fetch;
29
-
30
- return {
31
- capture: (): CapturedRequest => {
32
- expect(fetchMock).toHaveBeenCalledTimes(1);
33
- const init = fetchMock.mock.calls[0]?.[1];
34
- return JSON.parse(String(init?.body ?? '{}')) as CapturedRequest;
35
- },
36
- restore: (): void => {
37
- (global as { fetch: typeof fetch }).fetch = originalFetch;
38
- },
39
- };
40
- }
41
-
42
- describe('@rytass/bpm-core-client/template', () => {
43
- describe('listApprovalTemplates', () => {
44
- it('issues the ApprovalTemplates query and returns the records', async (): Promise<void> => {
45
- const harness = installFetchMock({ approvalTemplates: [] });
46
- try {
47
- const records = await listApprovalTemplates();
48
- const request = harness.capture();
49
-
50
- expect(request.query).toContain('query ApprovalTemplates');
51
- expect(request.variables).toBeUndefined();
52
- expect(records).toEqual([]);
53
- } finally {
54
- harness.restore();
55
- }
56
- });
57
- });
58
-
59
- describe('createApprovalTemplate', () => {
60
- it('wraps the name and category into CreateApprovalTemplateInput', async (): Promise<void> => {
61
- const harness = installFetchMock({
62
- createApprovalTemplate: { id: 'template-1' },
63
- });
64
- try {
65
- const id = await createApprovalTemplate({
66
- categoryId: 'cat-1',
67
- name: 'Expense reimbursement',
68
- });
69
- const request = harness.capture();
70
-
71
- expect(request.query).toContain('mutation CreateApprovalTemplate');
72
- expect(request.variables).toEqual({
73
- input: {
74
- category: null,
75
- categoryId: 'cat-1',
76
- createdByMemberId: null,
77
- description: null,
78
- formDefinitionVersionId: null,
79
- name: 'Expense reimbursement',
80
- },
81
- });
82
- expect(id).toBe('template-1');
83
- } finally {
84
- harness.restore();
85
- }
86
- });
87
- });
88
- });