@abgov/adsp-sdk-mcp-server 0.0.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 (124) hide show
  1. package/README.md +51 -0
  2. package/assets/docs/architecture.md +79 -0
  3. package/assets/docs/getting-started.md +118 -0
  4. package/assets/docs/important-notes.md +47 -0
  5. package/assets/docs/index.md +9 -0
  6. package/assets/docs/platform/deployment.md +80 -0
  7. package/assets/docs/platform/getting-started.md +66 -0
  8. package/assets/docs/platform/operations.md +8 -0
  9. package/assets/docs/platform/platform-django-sdk.md +330 -0
  10. package/assets/docs/platform/platform-dotnet-sdk.md +457 -0
  11. package/assets/docs/platform/platform-flask-sdk.md +355 -0
  12. package/assets/docs/platform/platform-node-sdk.md +433 -0
  13. package/assets/docs/platform/platform-spring-sdk.md +344 -0
  14. package/assets/docs/platform/platform.md +8 -0
  15. package/assets/docs/services/access-service.md +75 -0
  16. package/assets/docs/services/agent-service.md +316 -0
  17. package/assets/docs/services/cache-service.md +61 -0
  18. package/assets/docs/services/calendar-service.md +86 -0
  19. package/assets/docs/services/comment-service.md +87 -0
  20. package/assets/docs/services/configuration-service.md +92 -0
  21. package/assets/docs/services/directory-service.md +57 -0
  22. package/assets/docs/services/event-service.md +122 -0
  23. package/assets/docs/services/feedback-service.md +152 -0
  24. package/assets/docs/services/file-service.md +164 -0
  25. package/assets/docs/services/form-service.md +149 -0
  26. package/assets/docs/services/notification-service.md +151 -0
  27. package/assets/docs/services/pdf-service.md +116 -0
  28. package/assets/docs/services/pii-service.md +45 -0
  29. package/assets/docs/services/push-service.md +106 -0
  30. package/assets/docs/services/services.md +6 -0
  31. package/assets/docs/services/status-service.md +29 -0
  32. package/assets/docs/services/task-service.md +139 -0
  33. package/assets/docs/services/tenant-service.md +18 -0
  34. package/assets/docs/services/token-handler.md +135 -0
  35. package/assets/docs/services/value-service.md +80 -0
  36. package/assets/docs/services/verify-service.md +61 -0
  37. package/assets/docs/tutorials/access-service/access-service.md +9 -0
  38. package/assets/docs/tutorials/access-service/adsp-clients.md +29 -0
  39. package/assets/docs/tutorials/access-service/application-clients.md +61 -0
  40. package/assets/docs/tutorials/access-service/front-end-access.md +53 -0
  41. package/assets/docs/tutorials/access-service/introduction.md +33 -0
  42. package/assets/docs/tutorials/access-service/tenants.md +68 -0
  43. package/assets/docs/tutorials/access-service/themes.md +43 -0
  44. package/assets/docs/tutorials/feedback-service/accessing-data.md +41 -0
  45. package/assets/docs/tutorials/feedback-service/feedback-service.md +9 -0
  46. package/assets/docs/tutorials/feedback-service/installation.md +142 -0
  47. package/assets/docs/tutorials/feedback-service/introduction.md +28 -0
  48. package/assets/docs/tutorials/feedback-service/security.md +40 -0
  49. package/assets/docs/tutorials/feedback-service/triggering.md +21 -0
  50. package/assets/docs/tutorials/file-service/file-service.md +9 -0
  51. package/assets/docs/tutorials/file-service/file-types.md +35 -0
  52. package/assets/docs/tutorials/file-service/introduction.md +34 -0
  53. package/assets/docs/tutorials/file-service/security.md +31 -0
  54. package/assets/docs/tutorials/file-service/working-with.md +65 -0
  55. package/assets/docs/tutorials/form-service/Integration.md +31 -0
  56. package/assets/docs/tutorials/form-service/ai-agent.md +450 -0
  57. package/assets/docs/tutorials/form-service/building-forms.md +264 -0
  58. package/assets/docs/tutorials/form-service/cheat-sheet.md +1461 -0
  59. package/assets/docs/tutorials/form-service/custom-error-messages.md +87 -0
  60. package/assets/docs/tutorials/form-service/data-registers.md +204 -0
  61. package/assets/docs/tutorials/form-service/file-uploader.md +81 -0
  62. package/assets/docs/tutorials/form-service/form-app.md +72 -0
  63. package/assets/docs/tutorials/form-service/form-editor.md +62 -0
  64. package/assets/docs/tutorials/form-service/form-service.md +9 -0
  65. package/assets/docs/tutorials/form-service/form-submissions.md +77 -0
  66. package/assets/docs/tutorials/form-service/instructions.md +173 -0
  67. package/assets/docs/tutorials/form-service/introduction.md +66 -0
  68. package/assets/docs/tutorials/form-service/repeated-items.md +87 -0
  69. package/assets/docs/tutorials/form-service/security.md +36 -0
  70. package/assets/docs/tutorials/form-service/steppers.md +237 -0
  71. package/assets/docs/tutorials/notification-service/emailAttachment.md +75 -0
  72. package/assets/docs/tutorials/notification-service/events.md +20 -0
  73. package/assets/docs/tutorials/notification-service/introduction.md +37 -0
  74. package/assets/docs/tutorials/notification-service/notification-service.md +9 -0
  75. package/assets/docs/tutorials/notification-service/notification-types.md +86 -0
  76. package/assets/docs/tutorials/notification-service/subscribers.md +33 -0
  77. package/assets/docs/tutorials/pdf-service/building-a-template.md +339 -0
  78. package/assets/docs/tutorials/pdf-service/generate-a-pdf.md +150 -0
  79. package/assets/docs/tutorials/pdf-service/handlebars.md +51 -0
  80. package/assets/docs/tutorials/pdf-service/introduction.md +26 -0
  81. package/assets/docs/tutorials/pdf-service/pdf-service.md +9 -0
  82. package/assets/docs/tutorials/pdf-service/puppeteer.md +25 -0
  83. package/assets/docs/tutorials/pdf-service/video.md +18 -0
  84. package/assets/docs/tutorials/status-service/Introduction.md +46 -0
  85. package/assets/docs/tutorials/status-service/health.md +51 -0
  86. package/assets/docs/tutorials/status-service/notices.md +34 -0
  87. package/assets/docs/tutorials/status-service/notifications.md +107 -0
  88. package/assets/docs/tutorials/status-service/status-service.md +9 -0
  89. package/assets/docs/tutorials/status-service/status.md +35 -0
  90. package/assets/docs/tutorials/status-service/webhooks.md +24 -0
  91. package/assets/docs/tutorials/task-service/introduction.md +23 -0
  92. package/assets/docs/tutorials/task-service/task-app.md +43 -0
  93. package/assets/docs/tutorials/task-service/task-definitions.md +49 -0
  94. package/assets/docs/tutorials/task-service/task-queues.md +67 -0
  95. package/assets/docs/tutorials/task-service/task-service.md +9 -0
  96. package/assets/docs/tutorials/tutorials.md +8 -0
  97. package/package.json +18 -0
  98. package/src/docs/docsRepository.d.ts +22 -0
  99. package/src/docs/docsRepository.js +110 -0
  100. package/src/docs/docsRepository.js.map +1 -0
  101. package/src/main.d.ts +2 -0
  102. package/src/main.js +16 -0
  103. package/src/main.js.map +1 -0
  104. package/src/sdk-reference/reference.d.ts +17 -0
  105. package/src/sdk-reference/reference.js +547 -0
  106. package/src/sdk-reference/reference.js.map +1 -0
  107. package/src/sdk-reference/search.d.ts +6 -0
  108. package/src/sdk-reference/search.js +41 -0
  109. package/src/sdk-reference/search.js.map +1 -0
  110. package/src/server.d.ts +6 -0
  111. package/src/server.js +30 -0
  112. package/src/server.js.map +1 -0
  113. package/src/tools/registerDocsTools.d.ts +3 -0
  114. package/src/tools/registerDocsTools.js +66 -0
  115. package/src/tools/registerDocsTools.js.map +1 -0
  116. package/src/tools/registerQuickstartTool.d.ts +2 -0
  117. package/src/tools/registerQuickstartTool.js +82 -0
  118. package/src/tools/registerQuickstartTool.js.map +1 -0
  119. package/src/tools/registerSdkTools.d.ts +2 -0
  120. package/src/tools/registerSdkTools.js +43 -0
  121. package/src/tools/registerSdkTools.js.map +1 -0
  122. package/src/tools/types.d.ts +12 -0
  123. package/src/tools/types.js +3 -0
  124. package/src/tools/types.js.map +1 -0
@@ -0,0 +1,173 @@
1
+ ---
2
+ layout: page
3
+ title: Instructions
4
+ parent: Form Service
5
+ grand_parent: Tutorials
6
+ nav_exclude: false
7
+ ---
8
+
9
+ ## Adding Instructions
10
+
11
+ One of the differences between a professional and an amateur looking form is the quality of instruction that it contains for end-users. The _Form Service_ includes component renderers that are specifically geared toward rendering instructions and may include text, images, or links. For example, the following fragment from the UI-schema will render a paragraph:
12
+
13
+ ```json
14
+ {
15
+ "type": "HelpContent",
16
+ "label": "Program Overview",
17
+ "options": {
18
+ "help": "The Alberta Approved Farmers’ Market Program was started in 1973 as a way to provide an opportunity for local Alberta businesses to sell their products. Farmers’ markets are a critical channel for business incubation – entrepreneurs start in markets, test market their products and develop business skills. The Program creates an operational framework, providing direction and guidance to approved farmers’ markets in Alberta through provincial guidelines that outline minimum requirements and best practices."
19
+ }
20
+ }
21
+ ```
22
+
23
+ ### Markdown
24
+
25
+ [Markdown](http://markdownguide.org/cheat-sheet/) is an industry standard way to add text formatting directives to a document. In this case the document is your form. Its similar to the other help elements, but allows markdown syntax to be added to the text, allowing you to **bold** or _italicize_ text, and add headings, links, images, bullets, etc. You tell the system to interpret the text as markdown when you add a _HelpContent_ element with the markdown option, like so:
26
+
27
+ ```Json
28
+ {
29
+ "type": "HelpContent",
30
+ "label": "Program Overview",
31
+ "options": {
32
+ "markdown": true,
33
+ "help": [
34
+ "#### Farmers Market Program",
35
+ "The **Alberta Approved Farmers’ Market Program** was started in 1973 as a way to provide an opportunity for local Alberta businesses to sell their products. [Farmers’ markets](http://google.com) are a critical channel for business incubation – entrepreneurs start in markets, test market their products and develop business skills. The Program creates an operational framework, providing direction and guidance to approved farmers’ markets in Alberta through provincial guidelines that _outline minimum requirements and best practices_.",
36
+ "The end."
37
+ ]
38
+ }
39
+ }
40
+ ```
41
+
42
+ The "help" array consists of a set of paragraphs, one per entry, and you add the markdown syntax to each as needed. The above will render as:
43
+
44
+ #### Farmers Market Program
45
+
46
+ The **Alberta Approved Farmers’ Market Program** was started in 1973 as a way to provide an opportunity for local Alberta businesses to sell their products. [Farmers’ markets](http://google.com) are a critical channel for business incubation – entrepreneurs start in markets, test market their products and develop business skills. The Program creates an operational framework, providing direction and guidance to approved farmers’ markets in Alberta through provincial guidelines that _outline minimum requirements and best practices_.
47
+ The end.
48
+
49
+ **Note**: We currently do not support Markdown's extended syntax.
50
+
51
+ ### Deprecated Help Constructs
52
+
53
+ The following constructs are still available for use, but are not really needed since the introduction of markdown.
54
+
55
+ #### Combining elements
56
+
57
+ By combining several HelpContent types into a list you can create a full page of instructions to help your end-users navigate the form, e.g.
58
+
59
+ ```json
60
+ {
61
+ "type": "VerticalLayout",
62
+ "elements": [
63
+ {
64
+ "type": "HelpContent",
65
+ "label": "",
66
+ "options": {
67
+ "help": "1. Must operate on a non-profit basis. This can be achieved in a number of ways:"
68
+ }
69
+ },
70
+ {
71
+ "type": "HelpContent",
72
+ "elements": [
73
+ {
74
+ "type": "HelpContent",
75
+ "label": "Sponsored by:",
76
+ "options": {
77
+ "help": [
78
+ "Registered not-for-profit community group or organization;",
79
+ "Registered Chamber of Commerce;",
80
+ "Municipality; or",
81
+ "Agricultural society formed under the Agricultural Societies Act (Alberta)"
82
+ ]
83
+ }
84
+ }
85
+ ]
86
+ }
87
+ ]
88
+ }
89
+ ```
90
+
91
+ will render
92
+
93
+ ![](/adsp-monorepo/assets/form-service/HelpExample.png)
94
+
95
+ Notice that providing an array of text fragments in options/help will render as a bulleted list of points.
96
+
97
+ #### Detail Variant
98
+
99
+ Often a form will look cleaner if the end-user doesn't have to browse through instructions they are already familiar with, or those that are not directly relevant to the task at hand. One of the _Help Content variants_ will render instructions as a title that, when clicked on, will open up the details of the instruction. The variant looks like this:
100
+
101
+ ```json
102
+ {
103
+ "type": "HelpContent",
104
+ "label": "Affordability project: How to calculate household income",
105
+ "elements": [
106
+ {
107
+ "type": "HelpContent",
108
+ "options": {
109
+ "help": "Household income is based on line 15000 (gross income) minus applicable amounts reported on:"
110
+ }
111
+ },
112
+ {
113
+ "type": "HelpContent",
114
+ "options": {
115
+ "help": [
116
+ "Line 21000 (deduction for split-pension amount)",
117
+ "Line 32000 (tuition expenses)",
118
+ "Line 33099 (medical expenses for self, spouse or common-law partner and dependant children under 18)",
119
+ "Line 33199 (medical expenses for other defendants)"
120
+ ]
121
+ }
122
+ }
123
+ ],
124
+ "options": {
125
+ "variant": "details"
126
+ }
127
+ }
128
+ ```
129
+
130
+ Which will render as
131
+ ![](/adsp-monorepo/assets/form-service/InstructionDetails.png)
132
+
133
+ In this variant the Help Content contains
134
+
135
+ - The text displayed in the title (label),
136
+ - The details of the instruction (elements) that get exposed when the section is opened,
137
+ - the name of the variant (details), in the options section
138
+
139
+ #### Image Variant
140
+
141
+ You can add images to further clarify what is needed, with the img variant
142
+
143
+ ```json
144
+ {
145
+ "type": "HelpContent",
146
+ "options": {
147
+ "variant": "img",
148
+ "src": "https://picsum.photos/200/300",
149
+ "width": "300",
150
+ "height": "300",
151
+ "alt": "Workflow diagram"
152
+ }
153
+ }
154
+ ```
155
+
156
+ The width, height, and alt properties are optional.
157
+
158
+ ### Hyperlink Variant
159
+
160
+ You can add hypertext links in the instructions to further clarify what is needed, with the link variant
161
+
162
+ ```json
163
+ {
164
+ "type": "HelpContent",
165
+ "options": {
166
+ "variant": "hyperlink",
167
+ "link": "https://www.thelink.com",
168
+ "help": "Text to wrap the link in"
169
+ }
170
+ }
171
+ ```
172
+
173
+ The help text is optional and will be used as the text of the anchor when present, otherwise the src URL will be rendered directly.
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: Introduction
3
+ layout: page
4
+ nav_order: 1
5
+ parent: Form Service
6
+ grand_parent: Tutorials
7
+ ---
8
+
9
+ ## Introduction
10
+
11
+ The _Form Service_ provides a means to build, deploy, and secure forms for data collection. It uses [jsonforms](https://jsonforms.io/) as the underlying technology, which in itself was integrated with GoA's design systems' React library. The result is the capability to quickly build, review, and deploy forms for public consumption.
12
+
13
+ On its own, the _Form Service_ can be a huge time saver when it comes to developing GoA applications, but used in conjunction with ADSP's _Form App_ and _Task App_ it takes on a life of its own. A form can be immediately available to your end-users through the ADSP [Form App](/adsp-monorepo/tutorials/form-service/form-app.html), and can be reviewed and dispositioned through the ADSP [Task App](/adsp-monorepo/tutorials/task-service/task-app.html). All of that without any coding!
14
+
15
+ ### Building
16
+
17
+ Jsonforms provides a declarative means for creating new form definitions. Developers provide a JSON-schema to describe the data to be collected, and a UI-schema to describe what the form will look like. This can be done most easily using ADSP's [Form Editor](/adsp-monorepo/tutorials/form-service/building-forms.html). The form definitions are stored in the ADSP database and can be accessed through [its APIs](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=Form%20service#).
18
+
19
+ ### Rendering
20
+
21
+ Currently the Form Service only supports rendering forms in React applications through a Jsonforms React component. [Adding it to your application](/adsp-monorepo/tutorials/form-service/integration.html) enables it to:
22
+
23
+ - render the form,
24
+ - secure access to it,
25
+ - collect end-user data
26
+
27
+ ### The Form App
28
+
29
+ Forms built through the ADSP form editor are automatically available to users through the _Form App_. Once the forms are built and tested in the UAT environment, they can be deployed to production by exporting the UAT schema's through the _Configuration Service_, and then importing them to PROD.
30
+
31
+ The form app runs on the ADSP servers (ARO) and can be accessed at:
32
+
33
+ - https://form.adsp-uat.alberta.ca/\<your tenant\>/\<form definition ID\> for testing and development, or
34
+ - https://form.adsp.alberta.ca/\<your tenant\>/\<form definition ID\> for production.
35
+
36
+ Users are able to login to the App and access their personal copy of the form, and
37
+
38
+ - they can take as long as is needed to fill it out,
39
+ - their input is saved automatically,
40
+ - reviewers are notified whenever the form is submitted for review,
41
+ - once submitted the form is locked form changes,
42
+ - assessors can determine and disposition the form as required.
43
+
44
+ ### Security
45
+
46
+ Security is based on Keycloak roles. Usage of the APIs is restricted to authorized users or clients, and is further described [in the section on security](/adsp-monorepo/tutorials/form-service/security.html). Users logging in to your application can be restricted to:
47
+
48
+ - filling out the form (applicants),
49
+ - reading and updating the form (clerks), and
50
+ - managing [form submissions](/adsp-monorepo/tutorials/form-service/form-submissions.html) (assessors).
51
+
52
+ ## Learn More
53
+
54
+ - Learn how to [use jsonforms](https://jsonforms.io/) to declaratively build and render sophisticated forms.
55
+
56
+ - Use the [cheat sheet](/adsp-monorepo/tutorials/form-service/cheat-sheet.html) to quickly lookup how to render form elements.
57
+
58
+ - Learn more about [ADSP's extensions](/adsp-monorepo/tutorials/form-service/building-forms.html) to jsonforms, for creating steppers, end-user instructions, and other UI tidbits.
59
+
60
+ - Learn about [form submissions](/adsp-monorepo/tutorials/form-service/form-submissions.html).
61
+
62
+ - Learn more about [securing your form](/adsp-monorepo/tutorials/form-service/security.html).
63
+
64
+ - Learn more about [deploying your form](/adsp-monorepo/tutorials/form-service/form-app.html).
65
+
66
+ - Learn how to [use the Task App](/adsp-monorepo/tutorials/task-service/task-app.html) to review data collected from end-users.
@@ -0,0 +1,87 @@
1
+ ---
2
+ title: Form Lists
3
+ layout: page
4
+ parent: Form Service
5
+ grand_parent: Tutorials
6
+ nav_exclude: false
7
+ ---
8
+
9
+ # Form lists
10
+
11
+ There are two types of _repeating items_ in Jsonforms; the _list with details_, and the _object array_. The latter is a simple, sequential list of items ordered by time of entry. This is useful if the number of items is expected to be small or if each item contains a small number of elements. However, it may become unwieldy as the number grows larger, and this is where the _list with details_ comes into its own. It contains a simple means to navigate through the list, and displays one item at a time:
12
+
13
+ ## Object Array
14
+
15
+ Object arrays are the easiest _form lists_ to build declaratively, and are _ideal_ for small sets of data such as contact information. Here's an example:
16
+
17
+ ```json
18
+ {
19
+ "type": "object",
20
+ "properties": {
21
+ "people": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "object",
25
+ "properties": {
26
+ "firstName": {
27
+ "type": "string"
28
+ },
29
+ "lastName": {
30
+ "type": "string"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ This schema declares an array of firstName/lastName pairs to be collected in a form. The corresponding UI schema is;
40
+
41
+ ```json
42
+ {
43
+ "type": "Control",
44
+ "label": "People",
45
+ "scope": "#/properties/people"
46
+ }
47
+ ```
48
+
49
+ resulting in:
50
+
51
+ ![](/adsp-monorepo/assets/form-service/objectArrayExample.png){: width="400" }
52
+
53
+ Notice how simple the UI-schema is. You just point a control to the json-schema of the object in the array to be rendered. The control makes formatting assumptions, and in this case each property on an item is rendered as a separate row on a card. The list of such cards will quickly become large and difficult to navigate, and because the scope points to an object (_people_ in this example) you loose control over the layout. For complex objects with several, or nested, fields this can be an issue. The formatting assumptions my not be what the designer desires.
54
+
55
+ ## List with Details
56
+
57
+ For more complex data however, the _list with detail_ is a more appropriate choice. You get the benefits of an object list but still retain full control over how the list item is rendered. Using the same JSON schema as the example above, here's how the corresponding UI schema might look:
58
+
59
+ ```json
60
+ {
61
+ "type": "ListWithDetail",
62
+ "scope": "#/properties/people",
63
+ "options": {
64
+ "detail": {
65
+ "elements": [
66
+ {
67
+ "type": "HorizontalLayout",
68
+ "elements": [
69
+ {
70
+ "type": "Control",
71
+ "scope": "#/properties/firstName"
72
+ },
73
+ {
74
+ "type": "Control",
75
+ "scope": "#/properties/lastName"
76
+ }
77
+ ]
78
+ }
79
+ ]
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ Notice that the layout instructions are in the options/detail part of the _ListWithDetail_ schema.
86
+
87
+ ![](/adsp-monorepo/assets/form-service/listWithDetailExample.png){: width="400" }
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: Securing access
3
+ layout: page
4
+ nav_order: 6
5
+ parent: Form Service
6
+ grand_parent: Tutorials
7
+ ---
8
+
9
+ ## Security
10
+
11
+ Security for the _Form Service_ APIs is based on Keycloak, and there are two types of roles that users and clients need to consider when accessing forms: _Form Definition_ roles, and _ADSP_ roles.
12
+
13
+ ### Form Definition roles
14
+
15
+ Developers should assign access roles to each _Form Definition_ within a tenant. The _Form Service_ defines three types of users:
16
+
17
+ - **Applicant**: For users that fill in forms and submit them for review.
18
+ - **Clerk**: For GOA personnel that need to review a form and perhaps fill in missing detail.
19
+ - **Assessor**: For GOA personnel who are able to assess the information, make decisions, and disposition the form as appropriate
20
+
21
+ In the Tenant-Management-Webapp developers can assign one or more these user types to one or more tenant-defined keycloak roles. Note: this security is important enough that this step is mandatory. If, when testing you find you are getting 403's, make sure your test user has the right tenant-defined roles. You can assign user types to these roles via the _Roles_ tab in the Form Definition editor:
22
+
23
+ ![](/adsp-monorepo/assets/form-service/userRoles.png){: width="400" }
24
+
25
+ ### ADSP roles
26
+
27
+ There are several roles that may be required for users to access the form service resources. These can be found under the form-service client in keycloak:
28
+
29
+ ![](/adsp-monorepo/assets/form-service/form-service-roles.png){: width="600" }
30
+
31
+ Applicants will need the _form-admin_ and _intake-application_ role to create and fill out forms, respectively. If the form requires files to be uploaded they will also need:
32
+
33
+ - _form-file-reader_
34
+ - _form-file-uploader_
35
+
36
+ Additional roles are available for form administrators. Clerks and assessors should have the _form-support_ and _form-file-reader_ roles.
@@ -0,0 +1,237 @@
1
+ ---
2
+ layout: page
3
+ title: Steppers
4
+ parent: Form Service
5
+ grand_parent: Tutorials
6
+ nav_exclude: false
7
+ ---
8
+
9
+ # Form Steppers
10
+
11
+ With large, complex, forms it can sometimes be a challenge for users to navigate through the questions and keep track of their answers. One way to mitigate this problem is to organize a form into logical chunks. Each chunk (called a page, or a step) is used to present one or more questions for the user answer. User are provided means to:
12
+
13
+ - navigate between chunks,
14
+ - track their progress on filling out the form, and
15
+ - see a summary of their answers
16
+
17
+ The _Form Service_ provides two implementations of a stepper; a _page stepper_, and a _simple stepper_. Although the look and feel of each type is quite different, the JSON Schema descriptions of each are practically identical and you can move from one to the other with a simple flip of a switch.
18
+
19
+ ## Page Steppers
20
+
21
+ Page steppers - now the [Design System's preferred method](https://design.alberta.ca/patterns/public-form) for managing complex forms - treat a form as a series of pages and include a _Task List_ (table of contents) at the start, e.g.
22
+
23
+ ![](/adsp-monorepo/assets/form-service/task-list.png){: width="400" }
24
+
25
+ The _Task List_ page allows users to see the status of their application, and the status of each page, at a glance. They can enter the application at any stage and continue the application from where they left off.
26
+
27
+ The page stepper also supports these Task List and review-flow options:
28
+
29
+ <table>
30
+ <tr>
31
+ <th>Attribute</th>
32
+ <th>Behavior</th>
33
+ <th>Default</th>
34
+ <th>Scope</th>
35
+ </tr>
36
+ <tr>
37
+ <td><code>hideSummary</code></td>
38
+ <td>Hides the Summary row on the Task List and prevents navigation to the summary review page from the last visible step.</td>
39
+ <td><code>false</code></td>
40
+ <td><code>Categorization.options</code></td>
41
+ </tr>
42
+ <tr>
43
+ <td><code>hideSubmit</code></td>
44
+ <td>Hides the Submit button on the summary review page.</td>
45
+ <td><code>false</code></td>
46
+ <td><code>Categorization.options</code></td>
47
+ </tr>
48
+ <tr>
49
+ <td><code>toAppOverviewLabel</code></td>
50
+ <td>Changes the text of the back link that returns the user from a step page to the Task List.</td>
51
+ <td><code>Back to application overview</code></td>
52
+ <td><code>Categorization.options</code></td>
53
+ </tr>
54
+ <tr>
55
+ <td><code>sectionTitle</code></td>
56
+ <td>Groups categories under a section heading on the Task List.</td>
57
+ <td>Not set</td>
58
+ <td><code>Category.options</code></td>
59
+ </tr>
60
+ <tr>
61
+ <td><code>showInTaskList</code></td>
62
+ <td>When set to <code>false</code>, hides that category from the Task List. Hidden categories do not render their own row, do not render a section header by themselves, and are excluded from the completed-page count. If a hidden category follows a visible task in the same group, its completion is rolled into the visible task.</td>
63
+ <td><code>true</code></td>
64
+ <td><code>Category.options</code></td>
65
+ </tr>
66
+ </table>
67
+
68
+ Examples:
69
+
70
+ ```json
71
+ {
72
+ "type": "Categorization",
73
+ "options": {
74
+ "variant": "pages",
75
+ "hideSummary": true,
76
+ "hideSubmit": true,
77
+ "toAppOverviewLabel": "Back to task list"
78
+ },
79
+ "elements": [
80
+ {
81
+ "type": "Category",
82
+ "label": "What are their contact details?",
83
+ "options": {
84
+ "sectionTitle": "The parties",
85
+ "showInTaskList": false
86
+ },
87
+ "elements": []
88
+ }
89
+ ]
90
+ }
91
+ ```
92
+
93
+ ## Simple Steppers
94
+
95
+ Simple Steppers have the dubious advantage of allowing the user to navigate anywhere from any page. This ease of use comes with a price; the step navigation takes up a lot of real estate, and will sometimes confuse end users. However, it is a common pattern for complex forms and is implemented by the form service. Here's an example:
96
+
97
+ ![](/adsp-monorepo/assets/form-service/formAppExample.png){: width="800" }
98
+
99
+ User's can see at a glance where they are in the overall form structure, and the status of each page. If the form is not too complex and the end users are experienced then a Simple Stepper might be the right choice.
100
+
101
+ The underlying technology for Simple Steppers is the [Design System's stepper](https://design.alberta.ca/components/form-stepper#tab-0) coupled with the conventions used with Jsonforms for steppers.
102
+
103
+ ## Implementation
104
+
105
+ Pages (or steps) are defined through categories in the _UI Schema_. You initially declare your intent to organize you questions into pages with the _Categorization_ element.
106
+
107
+ ```json
108
+ {
109
+ "type": "Categorization",
110
+ "options": {
111
+ "variant": "pages",
112
+ "title": "Tutorial Example",
113
+ "subtitle": "Tell us who you are"
114
+ }
115
+ "elements": []
116
+ }
117
+ ```
118
+
119
+ The variant can be either _pages_ or _stepper_.
120
+
121
+ Each page element is called a _category_. For example, here's a simple schema that could be used to collect a user's name and address information;
122
+
123
+ ```json
124
+ {
125
+ "type": "object",
126
+ "properties": {
127
+ "name": {
128
+ "type": "object",
129
+ "properties": {
130
+ "firstName": {
131
+ "type": "string",
132
+ "minLength": 2
133
+ },
134
+ "lastName": {
135
+ "type": "string",
136
+ "minLength": 2
137
+ },
138
+ "initial": {
139
+ "type": "string",
140
+ "maxLength": 1
141
+ }
142
+ }
143
+ },
144
+ "address": {
145
+ "type": "object",
146
+ "properties": {
147
+ "street": {
148
+ "type": "string"
149
+ },
150
+ "city": {
151
+ "type": "string"
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ ```
158
+
159
+ It's a bit of overkill, but for illustrative purposes we'll put the name and address fields into separate steps, like so:
160
+
161
+ ```json
162
+ {
163
+ "type": "Categorization",
164
+ "options": {
165
+ "variant": "pages",
166
+ "title": "Tutorial Example",
167
+ "subtitle": "Tell us who you are"
168
+ },
169
+ "elements": [
170
+ {
171
+ "type": "Category",
172
+ "label": "Name",
173
+ "options": {
174
+ "sectionTitle": "Identification"
175
+ },
176
+ "elements": [
177
+ {
178
+ "type": "VerticalLayout",
179
+ "elements": [
180
+ {
181
+ "type": "Control",
182
+ "scope": "#/properties/name/properties/firstName"
183
+ },
184
+ {
185
+ "type": "Control",
186
+ "scope": "#/properties/name/properties/lastName"
187
+ },
188
+ {
189
+ "type": "Control",
190
+ "scope": "#/properties/name/properties/initial"
191
+ }
192
+ ]
193
+ }
194
+ ]
195
+ },
196
+ {
197
+ "type": "Category",
198
+ "label": "Address",
199
+ "options": {
200
+ "sectionTitle": "Residence"
201
+ },
202
+ "elements": [
203
+ {
204
+ "type": "VerticalLayout",
205
+ "elements": [
206
+ {
207
+ "type": "Control",
208
+ "scope": "#/properties/address/properties/street"
209
+ },
210
+ {
211
+ "type": "Control",
212
+ "scope": "#/properties/address/properties/city"
213
+ }
214
+ ]
215
+ }
216
+ ]
217
+ }
218
+ ]
219
+ }
220
+ ```
221
+
222
+ Which yields:
223
+
224
+ ![](/adsp-monorepo/assets/form-service/tutorial-example.png){: width="400" }
225
+
226
+ Notice that
227
+
228
+ - The Categorization has two Categories labeled _Name_ and _Address_. This grouping tells the rendering engine to create a stepper with 2 pages.
229
+ - The Categorization element has an _options variant_ set to _pages_. For a simple stepper you would set it to _stepper_.
230
+ - A _Category_ element can have an optional "sectionTitle", which is used to group one ore more categories into a section. Sections only appear on the task list, and are used solely for organization purposes. There is no equivalent concept for the _simple steppers_.
231
+ - Everything else is declared as it would be without the stepper.
232
+ - There is an extra page added to the stepper, called _Summary_. This is a GOA added feature that lets the applicant quickly review the data they have entered before final submission.
233
+ - If `hideSummary` is set to `true`, the Summary row is removed from the Task List and the review page is skipped.
234
+ - If `hideSubmit` is set to `true`, the review page still renders, but its Submit button is hidden.
235
+ - If `toAppOverviewLabel` is set, the page stepper back link uses the provided text instead of `Back to application overview`.
236
+
237
+ ![](/adsp-monorepo/assets/form-service/summary-page.png){: width="400" }
@@ -0,0 +1,75 @@
1
+ ---
2
+ title: Email attachments
3
+ layout: page
4
+ nav_order: 5
5
+ parent: Notification Service
6
+ grand_parent: Tutorials
7
+ ---
8
+
9
+ ### Email attachments
10
+
11
+ You can include file attachments in notification emails. This allows an email with one or more attachments to be sent automatically when a specific event is triggered. The steps below walk through how to define the required event schema, configure a notification to include attachments, and trigger the event.
12
+
13
+ First, create an event schema that includes an emailAddress attribute. This attribute will be used by the notification service to determine where the email should be sent.
14
+
15
+ ```typescript
16
+ {
17
+ "type": "object",
18
+ "properties": {
19
+ "emailAddress": {
20
+ "type": "string"
21
+ }
22
+ },
23
+ "required": [
24
+ "emailAddress"
25
+ ],
26
+ "additionalProperties": true
27
+ }
28
+ ```
29
+
30
+ Next, create a new notification or update an existing one. Add a custom name for the attachment path (for example, myAttachments) and include the emailAddress attribute.
31
+
32
+ ![myAttachments](/adsp-monorepo/assets/notification-service/attachment.png)
33
+
34
+ Associate the notification with the event you created in the previous step.
35
+
36
+ ![add-event](/adsp-monorepo/assets/notification-service/add-event.png)
37
+
38
+ Then, customize the notification content as needed, using Handlebars templates if desired.
39
+
40
+ ![handlebars](/adsp-monorepo/assets/notification-service/handlebars.png)
41
+
42
+ Now you are in a position to trigger the event (example done using postman)
43
+
44
+ At this point, the notification is ready to be triggered. The example below demonstrates triggering the event using Postman.
45
+
46
+ For the myAttachments field, provide the fileId values of the files you want to attach. These IDs can be obtained from the File Service UI or via the File Service API.
47
+
48
+ ![file-id](/adsp-monorepo/assets/notification-service/file-id.png)
49
+
50
+ The file must be accessible to the notification service. This means the file type it is categorized under must grant the platform-service role, or at least one of the notification-service roles.
51
+
52
+ ```typescript
53
+
54
+ POST /event/v1/events
55
+ eg (https://event-service.adsp-dev.gov.ab.ca/event/v1/events)
56
+
57
+
58
+
59
+ BODY
60
+ {
61
+ "namespace": "my-application",
62
+ "name": "application-approved",
63
+ "correlationId": "test-user-001",
64
+ "context": {
65
+ "tenantId": "61e9adc..."
66
+ },
67
+ "timestamp": "2025-04-28T18:00:00Z",
68
+ "payload": {
69
+ "emailAddress": "weyermannx@gmail.com",
70
+ "myAttachments": ["4ea98318-fbad-472e-bf8a-d88507053c29"]
71
+ }
72
+ }
73
+ ```
74
+
75
+ If configured correctly, the recipient will receive an email using the specified template, with the selected file(s) attached.