@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.
- package/README.md +51 -0
- package/assets/docs/architecture.md +79 -0
- package/assets/docs/getting-started.md +118 -0
- package/assets/docs/important-notes.md +47 -0
- package/assets/docs/index.md +9 -0
- package/assets/docs/platform/deployment.md +80 -0
- package/assets/docs/platform/getting-started.md +66 -0
- package/assets/docs/platform/operations.md +8 -0
- package/assets/docs/platform/platform-django-sdk.md +330 -0
- package/assets/docs/platform/platform-dotnet-sdk.md +457 -0
- package/assets/docs/platform/platform-flask-sdk.md +355 -0
- package/assets/docs/platform/platform-node-sdk.md +433 -0
- package/assets/docs/platform/platform-spring-sdk.md +344 -0
- package/assets/docs/platform/platform.md +8 -0
- package/assets/docs/services/access-service.md +75 -0
- package/assets/docs/services/agent-service.md +316 -0
- package/assets/docs/services/cache-service.md +61 -0
- package/assets/docs/services/calendar-service.md +86 -0
- package/assets/docs/services/comment-service.md +87 -0
- package/assets/docs/services/configuration-service.md +92 -0
- package/assets/docs/services/directory-service.md +57 -0
- package/assets/docs/services/event-service.md +122 -0
- package/assets/docs/services/feedback-service.md +152 -0
- package/assets/docs/services/file-service.md +164 -0
- package/assets/docs/services/form-service.md +149 -0
- package/assets/docs/services/notification-service.md +151 -0
- package/assets/docs/services/pdf-service.md +116 -0
- package/assets/docs/services/pii-service.md +45 -0
- package/assets/docs/services/push-service.md +106 -0
- package/assets/docs/services/services.md +6 -0
- package/assets/docs/services/status-service.md +29 -0
- package/assets/docs/services/task-service.md +139 -0
- package/assets/docs/services/tenant-service.md +18 -0
- package/assets/docs/services/token-handler.md +135 -0
- package/assets/docs/services/value-service.md +80 -0
- package/assets/docs/services/verify-service.md +61 -0
- package/assets/docs/tutorials/access-service/access-service.md +9 -0
- package/assets/docs/tutorials/access-service/adsp-clients.md +29 -0
- package/assets/docs/tutorials/access-service/application-clients.md +61 -0
- package/assets/docs/tutorials/access-service/front-end-access.md +53 -0
- package/assets/docs/tutorials/access-service/introduction.md +33 -0
- package/assets/docs/tutorials/access-service/tenants.md +68 -0
- package/assets/docs/tutorials/access-service/themes.md +43 -0
- package/assets/docs/tutorials/feedback-service/accessing-data.md +41 -0
- package/assets/docs/tutorials/feedback-service/feedback-service.md +9 -0
- package/assets/docs/tutorials/feedback-service/installation.md +142 -0
- package/assets/docs/tutorials/feedback-service/introduction.md +28 -0
- package/assets/docs/tutorials/feedback-service/security.md +40 -0
- package/assets/docs/tutorials/feedback-service/triggering.md +21 -0
- package/assets/docs/tutorials/file-service/file-service.md +9 -0
- package/assets/docs/tutorials/file-service/file-types.md +35 -0
- package/assets/docs/tutorials/file-service/introduction.md +34 -0
- package/assets/docs/tutorials/file-service/security.md +31 -0
- package/assets/docs/tutorials/file-service/working-with.md +65 -0
- package/assets/docs/tutorials/form-service/Integration.md +31 -0
- package/assets/docs/tutorials/form-service/ai-agent.md +450 -0
- package/assets/docs/tutorials/form-service/building-forms.md +264 -0
- package/assets/docs/tutorials/form-service/cheat-sheet.md +1461 -0
- package/assets/docs/tutorials/form-service/custom-error-messages.md +87 -0
- package/assets/docs/tutorials/form-service/data-registers.md +204 -0
- package/assets/docs/tutorials/form-service/file-uploader.md +81 -0
- package/assets/docs/tutorials/form-service/form-app.md +72 -0
- package/assets/docs/tutorials/form-service/form-editor.md +62 -0
- package/assets/docs/tutorials/form-service/form-service.md +9 -0
- package/assets/docs/tutorials/form-service/form-submissions.md +77 -0
- package/assets/docs/tutorials/form-service/instructions.md +173 -0
- package/assets/docs/tutorials/form-service/introduction.md +66 -0
- package/assets/docs/tutorials/form-service/repeated-items.md +87 -0
- package/assets/docs/tutorials/form-service/security.md +36 -0
- package/assets/docs/tutorials/form-service/steppers.md +237 -0
- package/assets/docs/tutorials/notification-service/emailAttachment.md +75 -0
- package/assets/docs/tutorials/notification-service/events.md +20 -0
- package/assets/docs/tutorials/notification-service/introduction.md +37 -0
- package/assets/docs/tutorials/notification-service/notification-service.md +9 -0
- package/assets/docs/tutorials/notification-service/notification-types.md +86 -0
- package/assets/docs/tutorials/notification-service/subscribers.md +33 -0
- package/assets/docs/tutorials/pdf-service/building-a-template.md +339 -0
- package/assets/docs/tutorials/pdf-service/generate-a-pdf.md +150 -0
- package/assets/docs/tutorials/pdf-service/handlebars.md +51 -0
- package/assets/docs/tutorials/pdf-service/introduction.md +26 -0
- package/assets/docs/tutorials/pdf-service/pdf-service.md +9 -0
- package/assets/docs/tutorials/pdf-service/puppeteer.md +25 -0
- package/assets/docs/tutorials/pdf-service/video.md +18 -0
- package/assets/docs/tutorials/status-service/Introduction.md +46 -0
- package/assets/docs/tutorials/status-service/health.md +51 -0
- package/assets/docs/tutorials/status-service/notices.md +34 -0
- package/assets/docs/tutorials/status-service/notifications.md +107 -0
- package/assets/docs/tutorials/status-service/status-service.md +9 -0
- package/assets/docs/tutorials/status-service/status.md +35 -0
- package/assets/docs/tutorials/status-service/webhooks.md +24 -0
- package/assets/docs/tutorials/task-service/introduction.md +23 -0
- package/assets/docs/tutorials/task-service/task-app.md +43 -0
- package/assets/docs/tutorials/task-service/task-definitions.md +49 -0
- package/assets/docs/tutorials/task-service/task-queues.md +67 -0
- package/assets/docs/tutorials/task-service/task-service.md +9 -0
- package/assets/docs/tutorials/tutorials.md +8 -0
- package/package.json +18 -0
- package/src/docs/docsRepository.d.ts +22 -0
- package/src/docs/docsRepository.js +110 -0
- package/src/docs/docsRepository.js.map +1 -0
- package/src/main.d.ts +2 -0
- package/src/main.js +16 -0
- package/src/main.js.map +1 -0
- package/src/sdk-reference/reference.d.ts +17 -0
- package/src/sdk-reference/reference.js +547 -0
- package/src/sdk-reference/reference.js.map +1 -0
- package/src/sdk-reference/search.d.ts +6 -0
- package/src/sdk-reference/search.js +41 -0
- package/src/sdk-reference/search.js.map +1 -0
- package/src/server.d.ts +6 -0
- package/src/server.js +30 -0
- package/src/server.js.map +1 -0
- package/src/tools/registerDocsTools.d.ts +3 -0
- package/src/tools/registerDocsTools.js +66 -0
- package/src/tools/registerDocsTools.js.map +1 -0
- package/src/tools/registerQuickstartTool.d.ts +2 -0
- package/src/tools/registerQuickstartTool.js +82 -0
- package/src/tools/registerQuickstartTool.js.map +1 -0
- package/src/tools/registerSdkTools.d.ts +2 -0
- package/src/tools/registerSdkTools.js +43 -0
- package/src/tools/registerSdkTools.js.map +1 -0
- package/src/tools/types.d.ts +12 -0
- package/src/tools/types.js +3 -0
- package/src/tools/types.js.map +1 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Generate a PDF
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 5
|
|
5
|
+
parent: PDF Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
The PDF Service allows you to automatically build a customized PDF document from an HTML template and some template variables. You can use the PDF Service's [Template Editor](/adsp-monorepo/templates/pdf/building-a-template.html) to build one interactively, and once it's in the system you can start using it in your application to generate downloadable PDF documents for your end users.
|
|
12
|
+
|
|
13
|
+
PDF generation is accomplished through a series of API calls that create the PDF and store it within the [File Service](/adsp-monorepo/services/file-service.html), where you have access to it through a file ID. The main steps are:
|
|
14
|
+
|
|
15
|
+
- Authenticate your application and get an access token from Keycloak,
|
|
16
|
+
- Initiate an asynchronous Job to generate the PDF and store it in the File Service,
|
|
17
|
+
- Get the File ID when the job is complete,
|
|
18
|
+
- present the PDF to your end user for downloading, as required
|
|
19
|
+
|
|
20
|
+
Although you can call the API's from any language, the tutorial examples are written in Node.js. Familiarity with the latter (or Javascript) is desirable, but not absolutely necessary.
|
|
21
|
+
|
|
22
|
+
The API calls to the Platform Service require authentication, via Keycloak. See the instructions for [setting up a tenant and getting access tokens](/adsp-monorepo/tutorials/access-service/introduction.html) for details on how to do this.
|
|
23
|
+
|
|
24
|
+
Continuing on from the tutorial on how to [build a template](/adsp-monorepo/tutorials/building-a-template.html) with the PDF service, our examples will be based on the template set up there for the Child Service's Intervention Record Check. Familiarity with that particular template is not necessary to follow along here, but the information will be useful if you want to understand how the pieces relate to each other.
|
|
25
|
+
|
|
26
|
+
See the [PDF Service](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=PDF%20service) Swagger documentation for detailed descriptions of the APIs.
|
|
27
|
+
|
|
28
|
+
## Submit a PDF Generator Job
|
|
29
|
+
|
|
30
|
+
Generating a PDF is an expensive operation and can take up to several seconds, depending on its size. For this reason the operation is submitted to a Job Queue and performed asynchronously. To submit a job you need to specify:
|
|
31
|
+
|
|
32
|
+
- the template ID
|
|
33
|
+
- a file name, and
|
|
34
|
+
- a File Type collection (optional)
|
|
35
|
+
|
|
36
|
+
The template ID can be seen in your template editor while you are developing it.
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
You supply the filename, which should be something that uniquely identifies the new PDF document.
|
|
41
|
+
|
|
42
|
+
The _File Type_ collection lets you manage access permissions to your PDF files. By default the File Type is _Generated PDF_, which has the correct permissions for the PDF Service to access files. When using your own File Type it is _very important_ to give the correct permissions to these files. At a minimum you must grant read permission to _Urn:Ads:Platform:Pdf-Service:Pdf-Generator_ and write permission to _Urn:Ads:Platform:Tenant-Service:Platform-Service_. See the [File Service](/adsp-monorepo/services/file-service.html) for information on how to create a new File Type collections and grant permissions.
|
|
43
|
+
|
|
44
|
+
The request body for generating a new PDF will look something like this:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
const request = {
|
|
48
|
+
operation: 'generate',
|
|
49
|
+
templateId: 'intervention-record-check',
|
|
50
|
+
filename: 'bobs-intervention-record-check.pdf',
|
|
51
|
+
data: ircData,
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
where ircData is a Json object containing the data collected by the application to use for variable substitutions. Note, the test data for our tutorial can be
|
|
56
|
+
<a href="/adsp-monorepo/assets/pdf/test_data.json" download>downloaded here</a>.
|
|
57
|
+
|
|
58
|
+
Generate the PDF file by submitting a Job
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
const response = await fetch('https://pdf-service.adsp.alberta.ca/pdf/v1/jobs', {
|
|
62
|
+
method: 'POST',
|
|
63
|
+
headers: {
|
|
64
|
+
Authorization: `Bearer ${accessToken}`,
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
},
|
|
67
|
+
body: JSON.stringify(request),
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
which places the request on the job queue and returns:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
const { urn, id, status } = await response.json();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
where
|
|
78
|
+
|
|
79
|
+
- _id_ is a unique ID identifying the job spawned to generate your PDF,
|
|
80
|
+
- _status_ is the job status, and can take on one of three values; _queued_, _completed_, or _failed_. Initially it will be set to _queued_,
|
|
81
|
+
- _urn_ is the [Universal Resource Name](https://en.wikipedia.org/wiki/Uniform_Resource_Name) of the Job that you can use along with the [Directory Service](/adsp-monorepo/services/directory-service.html) to lookup the URL to use for polling its status.
|
|
82
|
+
|
|
83
|
+
## Test for Job Completion
|
|
84
|
+
|
|
85
|
+
Depending on the complexity of your template, the job can take up to several seconds to complete. As the Job progresses the status will change from _queued_ to _completed_. You can poll the Job status to see when it has completed, or, use the Platform's [Push Service](/adsp-monorepo/services/push-service.html).
|
|
86
|
+
|
|
87
|
+
Polling is done using GET /pdf/v1/jobs/{jobID} to see if the returned status is _completed_. The API will return a structure of the form
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
{
|
|
91
|
+
urn,
|
|
92
|
+
id,
|
|
93
|
+
status,
|
|
94
|
+
result: { urn, id, filename }
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
where the first three properties are as described above, and the _result_ property contains:
|
|
99
|
+
|
|
100
|
+
- _id_ the id of the PDF file generated, which can be used to access the file along with the [File Service](/adsp-monorepo/services/file-service.html)
|
|
101
|
+
- _filename_ the name of the file generated
|
|
102
|
+
- _urn_ the [Universal Resource Name](https://en.wikipedia.org/wiki/Uniform_Resource_Name) of the PDF file that you can use along with the [File Service](/adsp-monorepo/services/directory-service.html) to lookup the URL to use for downloading it.
|
|
103
|
+
|
|
104
|
+
Polling forces the application developer to manage retrying and sleeping between tries, however. A less fussy approach would be to use the [Push Service](/adsp-monorepo/services/push-service.html). It enables applications to connect to a socket and listen for events of a specific type, such as "pdf-generated". The latter occurs when a Job successfully creates a PDF. You can connect to a Push Service socket as follows:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { io } from 'socket.io-client';
|
|
108
|
+
|
|
109
|
+
const socket = io(
|
|
110
|
+
`https://push-service.adsp.alberta.ca/${tenantId}?stream=pdf-generation-updates`,
|
|
111
|
+
{ withCredentials: true,
|
|
112
|
+
extraHeaders: {
|
|
113
|
+
Authorization: `Bearer ${accessToken}` }
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
socket.on('pdf-service:pdf-generated', (pdfEvent) => {
|
|
118
|
+
If (pdfEvent.jobId === jobID ) {
|
|
119
|
+
// Handle the event.
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The listener will pick up on all pdf-generated events for your tenant, so you will want to look for the one with the specific JobID. A pdfEvent has the form:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
{
|
|
128
|
+
jobId,
|
|
129
|
+
templateId,
|
|
130
|
+
file: { id, filename, urn },
|
|
131
|
+
requestedBy
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Whichever method you use, the important part is the file ID you get upon successful generation. This identifies the PDF document in the [File Service](/adsp-monorepo/services/file-service.html) which you can use to access it. Job information is cached and has a finite TTL of about 12 hours. Please be sure your application accesses the file ID before the job information expires.
|
|
136
|
+
|
|
137
|
+
## Download a PDF File
|
|
138
|
+
|
|
139
|
+
The file can be downloaded via
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
await fetch(`https://file-service.adsp.alberta.ca/file/v1/files/${fileID}/download`, {
|
|
143
|
+
method: 'GET',
|
|
144
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Learn More
|
|
149
|
+
|
|
150
|
+
- Learn how to [build a PDF template](/adsp-monorepo/tutorials/pdf-service/building-a-template.html) using ADSP's Template Editor
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Handlebars
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 3
|
|
5
|
+
parent: PDF Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
Handlebars are the heart of the PDF service's templates. They're a powerful template language that lets users embed keys into their PDF template and then, later, use a JSON structure to map the keys to actual values when generating a document. The mapping is what allows applications to create customized PDF documents. Designers use HTML, boiler-plate text, CSS, and handlebar keys to build a template, and the applications gathers together values for each of the template keys. Used together with a simple API call, applications can build customized PDF documents.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Handlebar keys are embedded into the template as text values surrounded by curly braces, e.g.
|
|
16
|
+
{% raw %}
|
|
17
|
+
|
|
18
|
+
```handlebars
|
|
19
|
+
The rain in {{data.country}} lies mainly in the {{data.landmark}}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
{% endraw %}
|
|
23
|
+
Here we have two handlebar keys; country and landmark. Notice the keys are prefixed by the data. Identifier. This is specific to the PDF service's implementation and not part of Handlebars itself. It is very important to remember to use this prefix, otherwise the substitution of key to value will not occur, and the key will just be ignored in the generated document.
|
|
24
|
+
|
|
25
|
+
The key-value pairing is specified as a JSON object, e.g.
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"country": "Spain",
|
|
30
|
+
"landmark": "plain"
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Note that the key value pairing does **not** include the _data._ prefix. A document generated with the above template and key-value pairing will have the following text:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
The rain in Spain lies mainly in the plain.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Although this is a trivial example, it illustrates how simple it is to use Handlebars. But the package provides much more power than this, and includes the ability to
|
|
41
|
+
|
|
42
|
+
- Iterate over data in an array
|
|
43
|
+
- Conditionally test for the existence of values
|
|
44
|
+
- Use nested data
|
|
45
|
+
|
|
46
|
+
See the [Handlebars Documentation](https://handlebarsjs.com/guide/) for more information.
|
|
47
|
+
|
|
48
|
+
#### Learn More
|
|
49
|
+
|
|
50
|
+
- Learn how to [build a sophisticated template](/adsp-monorepo/tutorials/pdf-service/building-a-template.html) using ADSP's Template Editor
|
|
51
|
+
- Learn how to [generate a PDF from a template](/adsp-monorepo/tutorials/pdf-service/generate-a-pdf.html)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 1
|
|
5
|
+
parent: PDF Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
The ADSP PDF service allows developers to build templates for their applications to use in generating customized, PDF, documentation for their end users. It bundles together two powerful technologies - [Puppeteer](https://pptr.dev/) and [Handlebars](https://handlebarsjs.com/guide/) - to yield a simple, effective, technique for managing documents requested by end users such as *client reports, registrations, certifications*, and other official GOA documentation.
|
|
12
|
+
|
|
13
|
+
#### Components
|
|
14
|
+
|
|
15
|
+
Two main components are used for managing pdf templates:
|
|
16
|
+
|
|
17
|
+
- The ADSP Tenant Admin Webapp, which provides a GUI for developers to build, test and save their templates using HTML, CSS and a custom designed set of embedded template variables,
|
|
18
|
+
- APIs to access the saved templates and generate a PDF document using a template and application-supplied values for the input data.
|
|
19
|
+
|
|
20
|
+
The template engine is based on [Puppeteer](https://pptr.dev/) - used for the HTML/CSS to PDF conversion process, and [Handlebars](https://handlebarsjs.com/guide/), which manages template customization.
|
|
21
|
+
|
|
22
|
+
#### Learn More
|
|
23
|
+
|
|
24
|
+
- Here are some brief introductions to [Puppeteer](/adsp-monorepo/tutorials/pdf-service/puppeteer.html) and [Handlebars](/adsp-monorepo/tutorials/pdf-service/handlebars.html)
|
|
25
|
+
- Learn more about how to [build a sophisticated template](/adsp-monorepo/tutorials/pdf-service/building-a-template.html) using ADSP's Template Editor
|
|
26
|
+
- Learn more about [generating a PDF from a template](/adsp-monorepo/tutorials/pdf-service/generate-a-pdf.html)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Puppeteer
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 2
|
|
5
|
+
parent: PDF Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
[Puppeteer](https://pptr.dev/) is the heart of the PDF generator and is the final arbitrator on how a generated document will look. Based on a headless chromium engine, it allows users to input HTML and CSS to render a PDF document. Because it's based on chromium, it's best to work on the template using Chrome, or any other Chromium based browser.
|
|
10
|
+
|
|
11
|
+
While puppeteer does a great job of turning HTML into PDF, there are things that must be taken into consideration to get a clean looking document that are non-issues for a continuous media stream, like a browser. These include
|
|
12
|
+
|
|
13
|
+
- Page headers and footers
|
|
14
|
+
- Page margins
|
|
15
|
+
- Page breaks
|
|
16
|
+
- Widows and orphans
|
|
17
|
+
- Box styling over page breaks
|
|
18
|
+
- Page numbering
|
|
19
|
+
|
|
20
|
+
Fortunately, most of these issues can be address through CSS specifically implement to address print media concerns. Here's a [good tutorial](https://www.smashingmagazine.com/2018/05/print-stylesheets-in-2018/) on CSS for print media.
|
|
21
|
+
|
|
22
|
+
#### Learn More
|
|
23
|
+
|
|
24
|
+
- Learn how to [build a sophisticated template](/adsp-monorepo/tutorials/pdf-service/building-a-template.html) using ADSP's Template Editor
|
|
25
|
+
- Learn how to [generate a PDF from a template](/adsp-monorepo/tutorials/pdf-service/generate-a-pdf.html)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Demo Video
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 0
|
|
5
|
+
parent: PDF Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Check out our demo
|
|
10
|
+
|
|
11
|
+
to see how easy it is to generate PDF files from HTML templates.
|
|
12
|
+
|
|
13
|
+
<video width="960" height="540" controls>
|
|
14
|
+
<source src="https://file-service.adsp-uat.alberta.ca/file/v1/files/b854f901-b8cc-4fbe-827d-92e45a0dc079/download?embed=true" type="video/mp4">
|
|
15
|
+
Your browser does not support the video tag.
|
|
16
|
+
</video>
|
|
17
|
+
|
|
18
|
+
Then take a look at the rest of the tutorial to [get the details](/adsp-monorepo/tutorials/pdf-service/introduction.html).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 1
|
|
5
|
+
parent: Status Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
The _Status Service_ lets you
|
|
12
|
+
|
|
13
|
+
- monitor the _health_ of your applications, and
|
|
14
|
+
- keep your users informed of an application's _status_.
|
|
15
|
+
|
|
16
|
+
For our purposes:
|
|
17
|
+
|
|
18
|
+
- Application _health_ is defined by pinging a developer-supplied URL every minute or so, and based on the response is either _healthy_ or _unhealthy_.
|
|
19
|
+
- Application _status_ is set by developers to inform end-users about planned (or otherwise) service outages.
|
|
20
|
+
|
|
21
|
+
In addition, the Status Service
|
|
22
|
+
|
|
23
|
+
- sends notifications to developers when an application's _health_ changes,
|
|
24
|
+
- sends notifications to developers and end-users when an application's _status_ changes,
|
|
25
|
+
- lets you customize notification messages (email or text),
|
|
26
|
+
- provides a public, static status page for your tenant that can be used to inform end users about an Application's Status.
|
|
27
|
+
|
|
28
|
+
## Notices and Notifications
|
|
29
|
+
|
|
30
|
+
Notices are used to inform end-users about an Application's Status. They may include
|
|
31
|
+
|
|
32
|
+
- reasons for the outage
|
|
33
|
+
- a time-frame for planned outages
|
|
34
|
+
|
|
35
|
+
Notices are displayed on a public, static webpage that applications can link to, so users can quickly determine their status.
|
|
36
|
+
|
|
37
|
+
Notifications are triggered when an application's health or status changes. Developers can subscribe to be notified about health changes, while end-users can subscribe to be notified when the status changes. The latter is a self-serve operation available through the public status page mentioned above, and is delivered by email. Developers can be notified by either text or email.
|
|
38
|
+
|
|
39
|
+
## Learn More
|
|
40
|
+
|
|
41
|
+
Learn how to
|
|
42
|
+
|
|
43
|
+
- [monitor](/adsp-monorepo/tutorials/status-service/health.html) your application's health.
|
|
44
|
+
- use [status codes](/adsp-monorepo/tutorials/status-service/status.html) to keep users informed about application health.
|
|
45
|
+
- provide [notices](/adsp-monorepo/tutorials/status-service/notices.html) about application status to end users.
|
|
46
|
+
- get [notified](/adsp-monorepo/tutorials/status-service/notifications.html) about changes in application health and status.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Application Health
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 2
|
|
5
|
+
parent: Status Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Application Health
|
|
10
|
+
|
|
11
|
+
Application health is determined by pinging a URL, supplied by a developer, every minute or so. Health is determined by examining the response returned by the URL and can be either
|
|
12
|
+
|
|
13
|
+
- Healthy, if the status code is not in the 400s or 500s
|
|
14
|
+
- Untimely, if the response takes over 1000ms
|
|
15
|
+
- Unhealthy if the response times out or returns a status code in the 400s or 500s
|
|
16
|
+
|
|
17
|
+
You can see how your application has responded over the last half hour by visiting the _Status Service page_ / _Applications tab_ on the [Tenant Admin Webapp](https://adsp.alberta.ca).
|
|
18
|
+
|
|
19
|
+
### Status Service Webpage
|
|
20
|
+
|
|
21
|
+
You can use the [Tenant Admin Webapp](https://adsp.alberta.ca) to
|
|
22
|
+
|
|
23
|
+
- register which applications you want monitored
|
|
24
|
+
- control monitoring
|
|
25
|
+
- view health checks
|
|
26
|
+
|
|
27
|
+
in addition to working with the application status. The latter is covered [here](/adsp-monorepo/tutorials/status-service/status.html).
|
|
28
|
+
|
|
29
|
+
### Registering an Application
|
|
30
|
+
|
|
31
|
+
To monitor an application's health you simply got to the Tenant Admin Webapp's _Status Service_ page and click the _Add Application_ button.
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
Enter the application name and description - something to identify the application to you and your users, and the URL that will be used to ping it. The URL should be for a public page, such as application's home, otherwise the ping might return a 401 or 403 and be classified as unhealthy. Once the information is submitted you'll see some controls and a status bar.
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+
Click _start health check_ to begin the pinging. The status bar will update every minute, and you will be able see the results pile in for the next 1/2 hour. The status bar is really just for testing purposes; the status service comes into its own when you start using [notifications](/adsp-monorepo/tutorials/status-service/notifications.html) to keep abreast of health changes.
|
|
40
|
+
|
|
41
|
+
### APIs
|
|
42
|
+
|
|
43
|
+
You can also monitor and control the pings via the [Status Service APIs](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=Status%20service), from another application. This would only be necessary if you wished to automate control, provide your own interface to keep user's notified, or perhaps to perform automated diagnostic on the application in question. The [Tenant Management Webapp](https://adsp.alberta.ca) provides basic capabilities for doing these things manually.
|
|
44
|
+
|
|
45
|
+
## Learn More
|
|
46
|
+
|
|
47
|
+
Learn how to
|
|
48
|
+
|
|
49
|
+
- use [status](/adsp-monorepo/tutorials/status-service/status.html) codes to keep users informed about application health.
|
|
50
|
+
- provide [notices](/adsp-monorepo/tutorials/status-service/notices.html) about application status to end users.
|
|
51
|
+
- get [notified](/adsp-monorepo/tutorials/status-service/notifications.html) about changes in application health and status.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Notices
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 4
|
|
5
|
+
parent: Status Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Notices
|
|
10
|
+
|
|
11
|
+
The _Status Service_ provides the ability for developers to post notices to communicate with their end users about upcoming maintenance windows or other events. A _notice_ can tell your users
|
|
12
|
+
|
|
13
|
+
- The current [status](/adsp-monorepo/tutorials/status-service/status.html) of the application e.g. _outage_,
|
|
14
|
+
- Reasons for the current status e.g. _server upgrade_,
|
|
15
|
+
- A time frame for the current status e.g. _1am till 3am_.
|
|
16
|
+
|
|
17
|
+
Notices can be created manually through the [Tenant Admin Webapp](https://adsp.alberta.ca) by navigating to the _Status Service_ page / _Notices_ tab, and clicking on the _Add Notice_ button
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
Type the message you want end users to see in the description box, select the application that the notice applies to, and select the dates / times that are applicable. When you save the notice it is in draft form. You can _publish_ the notice at any time, thereby making it available on your tenant's public status page. It will look something like this:
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
Your public static page for can be found at https://status.adsp.alberta.ca/{tenant name}, e.g.
|
|
26
|
+
https://status.adsp.alberta.ca/autotest. You can provide link to it from any page(s) available to your users when a service is down.
|
|
27
|
+
|
|
28
|
+
## Learn More
|
|
29
|
+
|
|
30
|
+
Learn how to
|
|
31
|
+
|
|
32
|
+
- get [notified](/adsp-monorepo/tutorials/status-service/notifications.html) about changes in application health and status.
|
|
33
|
+
- [monitor](/adsp-monorepo/tutorials/status-service/health.html) your application's health.
|
|
34
|
+
- use [status](/adsp-monorepo/tutorials/status-service/status.html) codes to keep users informed about application health.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Notifications
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 5
|
|
5
|
+
parent: Status Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Notifications
|
|
10
|
+
|
|
11
|
+
Developers can subscribe to be notified for _health check_ or _status_ changes to their applications. Additionally, it is possible for end users to be notified of changes to an application's status.
|
|
12
|
+
|
|
13
|
+
### Health Check Change
|
|
14
|
+
|
|
15
|
+
Developers can subscribe to be notified whenever the health of a tenant's application changes, by logging in to the [Tenant Admin Webapp](https://adsp.alberta.ca)) and navigating to the _Status page_ / _Applications_ tab:
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
When the _I want to subscribe and receive notifications_ box is checked, you will be notified of changes to any application your tenant is monitoring, including those not publicly displayed on the tenant's _public status page_ (at https://status.adsp.alberta.ca/{tenant-name}).
|
|
20
|
+
|
|
21
|
+
### Status Update
|
|
22
|
+
|
|
23
|
+
End Users can subscribe to be notified whenever the status of a tenant's application changes. Each application can display a _public status page_ that lists the tenant's monitored applications and their current status. If a user enters their email address on the page, they will receive an email whenever a developer updates an application's status.
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
The email contains a link so that the users can unsubscribe if they wish, which brings them to their personal ADSP _Subscription Management Page_. Users will see something like this on the page
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
### Custom Email Templates
|
|
32
|
+
|
|
33
|
+
The above notifications are managed by the ADSP _Notification Service_, which provides email templates that you can customize to suit your application's needs. Simply log in to the [Tenant Management Webapp](https://adsp.alberata.ca) and navigate to the _Notification Service_ / _Notifications Type_ tab, where you will see a list of notifications. In particular, you will see the _Application Health Check Change_, and the _Application Status Update_ notification types.
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
Each _Notification Type_ consists of a set of _Events_, and a notification is triggered when one of the events is triggered. The _Application Health Check Change_ type, for example, responds to four events
|
|
38
|
+
|
|
39
|
+
- health-check-started
|
|
40
|
+
- health-check-stopped
|
|
41
|
+
- application-unhealthy
|
|
42
|
+
- application-healthy
|
|
43
|
+
|
|
44
|
+
You can customize the message sent for each of these events.
|
|
45
|
+
|
|
46
|
+
Email templates are built using HTML/CSS and a template language called [Handlebars](https://handlebarsjs.com/guide/), which is used for mapping a set of keys into the event properties. You would use a template key to represent the application name, for example, like this
|
|
47
|
+
|
|
48
|
+
{% raw %}
|
|
49
|
+
|
|
50
|
+
```handlebars
|
|
51
|
+
Health check has been started for {{event.payload.application.name}}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
{% endraw %}
|
|
55
|
+
|
|
56
|
+
The following properties are available, depending on _Event Type_:
|
|
57
|
+
|
|
58
|
+
#### All
|
|
59
|
+
|
|
60
|
+
- event.payload.application.id
|
|
61
|
+
- event.payload.application.name
|
|
62
|
+
- event.payload.application.description
|
|
63
|
+
- event.payload.application.url
|
|
64
|
+
- event.payload.application.monitorOnly
|
|
65
|
+
|
|
66
|
+
In addition to the properties above, the individual, unique event types have:
|
|
67
|
+
|
|
68
|
+
#### Health Check Started
|
|
69
|
+
|
|
70
|
+
- event.payload.startedBy
|
|
71
|
+
|
|
72
|
+
#### Health Check Stopped
|
|
73
|
+
|
|
74
|
+
- event.payload.stoppedBy
|
|
75
|
+
|
|
76
|
+
#### Application Unhealthy
|
|
77
|
+
|
|
78
|
+
- event.payload.error
|
|
79
|
+
|
|
80
|
+
#### Application Healthy
|
|
81
|
+
|
|
82
|
+
- N/A
|
|
83
|
+
|
|
84
|
+
#### Application Status Changed
|
|
85
|
+
|
|
86
|
+
- event.payload.application.originalStatus
|
|
87
|
+
- event.payload.application.newStatus
|
|
88
|
+
- event.payload.application.updatedBy.userId
|
|
89
|
+
- event.payload.application.updatedBy.userName
|
|
90
|
+
|
|
91
|
+
#### Application Notice Published
|
|
92
|
+
|
|
93
|
+
- event.payload.notice.description
|
|
94
|
+
- event.payload.notice.startTimestamp
|
|
95
|
+
- event.payload.notice.endTimestamp
|
|
96
|
+
- event.payload.postedBy.userId
|
|
97
|
+
- event.payload.postedBy.userName
|
|
98
|
+
|
|
99
|
+
There are out-of-the-box default templates that you can start using right away. For a custom user experience though, consider building and managing your own.
|
|
100
|
+
|
|
101
|
+
## Learn More
|
|
102
|
+
|
|
103
|
+
Learn how to
|
|
104
|
+
|
|
105
|
+
- [monitor](/adsp-monorepo/tutorials/status-service/health.html) your application's health.
|
|
106
|
+
- use [status](/adsp-monorepo/tutorials/status-service/status.html) codes to keep users informed about application health.
|
|
107
|
+
- provide [notices](/adsp-monorepo/tutorials/status-service/notices.html) about application status to end users.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Application Status
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 3
|
|
5
|
+
parent: Status Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Application Status
|
|
10
|
+
|
|
11
|
+
Application status is the _operational status_ of your application that can be set manually through the Status Service page on the [Tenant Admin Webapp](https://adsp.alberta.ca) or automatically, by integrating the [status service APIs](https://api.adsp-uat.alberta.ca/autotest/?urls.primaryName=Status%20service) with your application. Operational status can take on one of four values:
|
|
12
|
+
|
|
13
|
+
- Operational: The application is up and running,
|
|
14
|
+
- Maintenance: The application is undergoing routine maintenance,
|
|
15
|
+
- Outage: The application is down,
|
|
16
|
+
- Reported Issues: An issue has been reported and is being looked into.
|
|
17
|
+
|
|
18
|
+
To set the status manually, simply go to the [Tenant Admin Webapp](https://adsp.alberta.ca) and go to the _Applications_ tab. Look for your application of interest, and click on the _change status_ button.
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
You can select one of the four statuses mentioned above.
|
|
23
|
+
|
|
24
|
+
Changing an application's status can affect users in a couple of ways. It will
|
|
25
|
+
|
|
26
|
+
- update the status on the public static webpage provided for your tenant, and
|
|
27
|
+
- notify anyone who has subscribed for notification of change. This includes end users.
|
|
28
|
+
|
|
29
|
+
The public status page for your tenant can be found at at https://status.adsp.alberta.ca/{tenant-name}. Linking to this will give your users information about your tenant applications, including any [notices](/adsp-monorepo/tutorials/status-service/notifications.html) you may have posted. The latter gives you the ability to post information about a status change, including expected times. This is useful, for example, to inform users of upcoming maintenance windows or current outages.
|
|
30
|
+
|
|
31
|
+
## Learn More
|
|
32
|
+
|
|
33
|
+
- Learn how to [monitor](/adsp-monorepo/tutorials/status-service/health.html) your application's health.
|
|
34
|
+
- Learn how to provide [Notices](/adsp-monorepo/tutorials/status-service/notices.html) about application status to end users.
|
|
35
|
+
- Learn how to [get notified](/adsp-monorepo/tutorials/status-service/notifications.html) about changes in application health and status.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Webhooks
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 6
|
|
5
|
+
parent: Status Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Webhooks
|
|
10
|
+
|
|
11
|
+
<span style="color:red">--- Coming soon ---</span>
|
|
12
|
+
|
|
13
|
+
The _Status Service_ will soon be offering functionality that allows you to specify a webhook that would be called when certain events occur, such as
|
|
14
|
+
|
|
15
|
+
- a monitored application has not been responding for more than a certain number of minutes
|
|
16
|
+
- a monitored application has been back up for a certain number of minutes.
|
|
17
|
+
|
|
18
|
+
You could use these webhooks
|
|
19
|
+
|
|
20
|
+
- to enhance notifications,
|
|
21
|
+
- to start recovery procedures,
|
|
22
|
+
- to take other decisive actions,
|
|
23
|
+
- keep logs,
|
|
24
|
+
- etc.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
layout: page
|
|
4
|
+
nav_order: 1
|
|
5
|
+
parent: Task Service
|
|
6
|
+
grand_parent: Tutorials
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Introduction
|
|
10
|
+
|
|
11
|
+
The _Task Service_ is designed to assist applications in creating a persistent, ordered, and prioritized set of tasks for later processing. For the purposes of this service, a task is defined as an abstract work item that can be assigned to a user for completion. For example, it could involve reviewing a recent _Application for a Farmer’s Market License_. When an end user submits an application, the intake system generates a new review task, which another application can pick up as needed. The key benefit is that applications can easily decouple task creation from task processing, enabling asynchronous processing, load balancing, and improved scalability.
|
|
12
|
+
|
|
13
|
+
The service is based on message queues, and consists of a set of APIs that allow developers to create and manage task queues. In addition, there is also a generic _Task Application_ that can be used to process certain pre-defined tasks, such as [form submissions](/adsp-monorepo/tutorials/form-service/introduction.html).
|
|
14
|
+
|
|
15
|
+
As with most ADSP services, the task service is a highly scalable microservice deployed on the Government's ARO servers so that developers can use it with confidence.
|
|
16
|
+
|
|
17
|
+
### Learn More
|
|
18
|
+
|
|
19
|
+
Learn how to create and use [Task Queues](/adsp-monorepo/tutorials/task-service/task-queues.html) in your application.
|
|
20
|
+
|
|
21
|
+
Learn how [tasks are defined](/adsp-monorepo/tutorials/task-service/task-definitions.html).
|
|
22
|
+
|
|
23
|
+
Learn about the use of the [task app](/adsp-monorepo/tutorials/task-service/task-app.html) to deliver _form review_ capabilities to your clients, without deployment.
|