-
Notifications
You must be signed in to change notification settings - Fork 4
Feat: Improve ADaaS documentation #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6784670
ad88f55
f12d500
0e73c47
1b6813e
3fc1c3f
39d760e
439746c
7c49abd
1c23f3e
626be24
06cb02f
9aa52c7
b6e64a8
dc4624f
9b545f3
2d8083a
fe2cad9
f7648c7
316a82e
e8d766a
2068b7d
ef2f14c
2e7f6a0
2720168
95f4a2c
568b2a3
1e6cdff
7421130
abb979e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
patricijabrecko marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Once you're ready to test your snap-in in a production environment, you can deploy the snap-in to your organization. | ||
|
||
Follow these steps: | ||
|
||
1. Copy `.env.example` to a new file named `.env` and fill in the required variables. | ||
2. Deploy a draft version of your snap-in to your organization by using `make deploy`. | ||
3. Install the snap-in in your DevRev by going to **Settings** > **Snap-ins** > **Install snap-in**. | ||
patricijabrecko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
4. Set up the connection under **Settings** > **Airdrops** > **Connections**. | ||
5. Create an import at **Settings** > **Airdrops** > **Airdrop**. | ||
|
||
This step is also a prerequisite for publishing the snap-in on the DevRev marketplace. | ||
|
||
### Observability | ||
|
||
To observe logs from your snap-in in your development environment: | ||
|
||
```bash | ||
devrev snap_in_package logs | jq | ||
``` | ||
|
||
To open logs in your favorite editor: | ||
|
||
```bash | ||
devrev snap_in_package logs | code - | ||
``` | ||
|
||
For more information, refer to [Debugging](/snapin-development/debugging). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,55 @@ | ||
In the external sync unit extraction phase, the extractor is expected to obtain a list of external | ||
sync units that it can extract with the provided credentials and send it to Airdrop in its response. | ||
|
||
An _external sync unit_ refers to a single unit in the external system that is being airdropped to DevRev. | ||
In some systems, this is a project; in some it is a repository; in support systems it could be | ||
called a brand or an organization. | ||
What a unit of data is called and what it represents depends on the external system's domain model. | ||
It usually combines contacts, users, work-like items, and comments into a unit of domain objects. | ||
|
||
Some external systems may offer a single unit in their free plans, | ||
while their enterprise plans may offer their clients to operate many separate units. | ||
|
||
The external sync unit ID is the identifier of the sync unit (project, repository, or similar) | ||
in the external system. | ||
For GitHub, this would be the repository, for example `cli` in `github.com/devrev/cli`. | ||
|
||
## Triggering event | ||
In the external sync unit extraction phase, the snap-in is expected to obtain a list of external | ||
sync units that it can extract from the external system API and send it to Airdrop in its response. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we remove the extra newline? We haven't defined what an "external sync unit" is. Lets define it or speak in more general terms. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One paragraph above defines external sync unit :) |
||
External sync unit extraction is executed only during the initial import. | ||
It extracts external sync units available in the external system, so that the end user can choose | ||
which external sync unit should be airdropped during the creation of an **Import** in the DevRev App. | ||
|
||
Airdrop initiates the external sync unit extraction phase by starting the worker with a message | ||
with an event of type `EXTRACTION_EXTERNAL_SYNC_UNITS_START`. | ||
### Implementation | ||
|
||
The snap-in must respond to Airdrop with a message with an event of type | ||
`EXTRACTION_EXTERNAL_SYNC_UNITS_DONE`, which contains a list of external sync units as a payload, | ||
or `EXTRACTION_EXTERNAL_SYNC_UNITS_ERROR` in case of an error. | ||
This phase should be implemented in the [`external-sync-units-extraction.ts`](https://github.com/devrev/adaas-template/blob/main/code/src/functions/extraction/workers/external-sync-units-extraction.ts) file. | ||
|
||
## Response from the snap-in | ||
The snap-in should emit the list of external sync units in the given format: | ||
|
||
```typescript | ||
const externalSyncUnits: ExternalSyncUnit[] = [ | ||
{ | ||
id: "devrev", | ||
name: "devrev", | ||
description: "Demo external sync unit", | ||
item_count: 100, | ||
}, | ||
]; | ||
``` | ||
|
||
The snap-in provides the list of external sync units in the provided event message | ||
`event_data.external_sync_units` containing the following fields: | ||
- `id`: The unique identifier in the external system. | ||
- `name`: The human-readable name in the external system. | ||
- `description`: The short description if the external system provides it. | ||
- `item_count`: The number of items (issues, tickets, comments or others) in the external system. | ||
Item count should be provided if it can be obtained in a lightweight manner, such as by calling an API endpoint. | ||
If there is no such way to get it (for example, if the items would need to be extracted to count them), | ||
then the item count should be `-1` to avoid blocking the import with long-running queries. | ||
Item count should be provided if it can be obtained in a lightweight manner, such as by calling an API endpoint. | ||
If there is no such way to get it (for example, if the items would need to be extracted to count them), | ||
then the item count should be `-1` to avoid blocking the import with long-running queries. | ||
|
||
Example: | ||
```json | ||
[ | ||
{ | ||
"id": "a-microservice-repository", | ||
"name": "A Microservice Repository", | ||
"description": "Our greatest microservice repo", | ||
"item_count": 232 | ||
} | ||
] | ||
The snap-in must respond to Airdrop with a message, which contains a list of external sync units as a payload: | ||
|
||
```typescript | ||
await adapter.emit(ExtractorEventType.ExtractionExternalSyncUnitsDone, { | ||
external_sync_units: externalSyncUnits, | ||
}); | ||
``` | ||
|
||
or an error: | ||
|
||
```typescript | ||
await adapter.emit(ExtractorEventType.ExtractionExternalSyncUnitsError, { | ||
error: { | ||
message: "Failed to extract external sync units. Lambda timeout.", | ||
}, | ||
}); | ||
``` | ||
|
||
To test your changes, start a new airdrop in the DevRev App. If external sync units extraction is successful, you should be prompted to choose an external sync unit from the list. |
Uh oh!
There was an error while loading. Please reload this page.