|
4 | 4 |
|
5 | 5 | - The Function implements part of The Snap-In functionality. |
6 | 6 | - Details on how The Function must be invoked are provided in the resource [Function Invocation](docs/function_invocation.mdx). |
| 7 | + - The Function should only take the first event from the array of events and process it. The Function can be invoked multiple times for multiple events. |
7 | 8 |
|
8 | 9 | - The Airdrop SDK Library for TypeScript helps developers build snap-ins that integrate with DevRev’s Airdrop platform. |
9 | 10 | - The documentation for the The Airdrop SDK Library is provided in the resource [airdrop_sdk_library_documentation.md](docs/airdrop_sdk_library_documentation.md). |
|
13 | 14 |
|
14 | 15 | - The Initial Domain Mapping is a JSON object that defines how the logical domain model described by The External Domain Metadata maps to the target domain model in DevRev. It specifies the correspondence between each external record type and DevRev leaf type, as well as the mapping of individual fields, including transformation logic, value conversions, and any fixed or default values. |
15 | 16 |
|
| 17 | +- The External Sync Unit Item Count is a numeric field representing the total number of items (such as cards) contained within a given external sync unit. It is accessible as "item_count" field of the external sync unit. |
| 18 | + |
| 19 | +- The Normalization Function is a function that is responsible for normalizing the data from The API to the data expected by The External Domain Metadata JSON object's record type. |
| 20 | + |
| 21 | +- The Extraction Function is The Function named "extraction". It is responsible for pushing data to the DevRev servers (The DevRev Servers) based on various event types. |
| 22 | + - "event_type" equals "EXTRACTION_DATA_START" or "event_type" equals "EXTRACTION_DATA_CONTINUE" and we get a timeout, The Worker Thread should emit event "EXTRACTION_DATA_PROGRESS". |
16 | 23 |
|
17 | 24 | ***Non-Functional Requirements:*** |
18 | 25 |
|
|
21 | 28 | - The Snap-In will run on Node.js as the runtime environment. |
22 | 29 |
|
23 | 30 | - The Snap-In should use The Airdrop SDK Library version "1.5.1" for handling data extraction and loading, pushing data, event-driven actions, state management, and artifact handling. |
24 | | - - Please note that 'processTask' function **only** executes task if 'processTask' function is called from a worker thread. Therefore 'processTask' function should be called from a worker thread spawned using 'Spawn' class. |
25 | | - - If the worker is written in TypeScript, it must be referenced with a .ts extension, not .js. |
26 | 31 |
|
27 | 32 | - Use snake_case for JSON keys. |
28 | 33 |
|
|
32 | 37 |
|
33 | 38 | - The shared code (including libraries, utilities, adapters, and other common code) used by multiple The Function should be placed in the `src/core` folder. The code in this folder should not depend on any specific The Function implementation. |
34 | 39 |
|
| 40 | +- During the data extraction phase, The Normalization Function's "data" field for specific record type should map precisely the fields that are present in The External Domain Metadata JSON object for that record type. The Normalization Function should map no additional fields other than those specified in The External Domain Metadata JSON object, and also no object fields from The External Domain Metadata JSON should be omitted in normalization. |
| 41 | + |
35 | 42 |
|
36 | 43 | ***Test Requirements:*** |
37 | 44 |
|
38 | | -- The Conformance Tests of The Snap-In should be implemented in TypeScript. |
| 45 | +- The Conformance Tests of The Snap-In should be implemented in TypeScript with target language version es2017. The Conformance Tests should utilize the TypeScript target language version es2017 with configuration settings for module interoperability, strict type checking, declaration file generation, and JSON module support. |
39 | 46 |
|
40 | 47 | - The Conformance Tests must be in the top folder. |
41 | 48 |
|
42 | 49 | - The Conformance Tests will run on Node.js as the runtime environment. |
43 | 50 |
|
44 | | -- The Conformance Tests will be executed using the "npm test" command. |
| 51 | +- The Conformance Tests will be executed using the "npm test" command. The command "npm test" should be accessible in the `package.json` file of The Conformance Tests. |
45 | 52 |
|
46 | 53 | - The Conformance Tests must complete within 120 seconds (The Conformance Tests Timeout). If The Conformance Tests Timeout elapses, the process executing The Conformance Tests will be terminated. |
47 | 54 |
|
|
55 | 62 |
|
56 | 63 | - The Worker Data Server is part of The DevRev Server and is accessible at http://localhost:8003/external-worker, so it must not be mocked. |
57 | 64 |
|
| 65 | +- The `jest.setup.js` file is managed externally and cannot be modified within The Conformance Tests. |
58 | 66 |
|
59 | | -# The TypeScript Node.js application boilerplate |
| 67 | +- All test files from The Conformance Tests must use the `.test.ts` suffix to be discoverable by Jest's default test pattern matching. |
60 | 68 |
|
61 | | -***Functional Requirements:*** |
| 69 | +- The Conformance Tests should send a single event to the Snap-In Server in the request body without wrapping it in an array. |
62 | 70 |
|
63 | | -- Implement The Function that only checks if The Function can be invoked. |
64 | 71 |
|
65 | | -- Implement The Function that only checks if the data extraction workflow can be invoked. |
| 72 | +# The TypeScript Node.js application boilerplate |
66 | 73 |
|
67 | | - ***Acceptance Tests:*** |
| 74 | +***Non-Functional Requirements:*** |
| 75 | + |
| 76 | +- Logic of pushing data to The DevRev Servers must be implemented in the worker thread and invoked with the "spawn" method from The Airdrop SDK Library. |
68 | 77 |
|
69 | | - - Test the data extraction workflow invocation using the resource [extraction_health_check.json](test_data/extraction_health_check.json). |
| 78 | +- The Function being implemented *MUST not* be called "extraction" or "loading". |
70 | 79 |
|
71 | | -- Implement The Function that checks if pushing data works. The URL where data is to be pushed is provided in the "callback_url" field of the "event_context" dictionary which is part of "payload" dictionary. |
| 80 | +***Functional Requirements:*** |
| 81 | + |
| 82 | +- Implement The Function that only checks if The Function can be invoked. |
72 | 83 |
|
73 | | -- Implement The Function that provides a test of the 'external sync units' part of the extraction workflow. The name of The Function must be 'extraction_external_sync_unit_check'. |
| 84 | +- Implement The Function called "test_external_sync_units" that provides a test of the 'external sync units' part of the extraction workflow as described in the resource [external-sync-units-extraction.mdx](docs/external-sync-units-extraction.mdx). Only check if the extraction can be triggered and that it successfully completes. Disregard all other details. |
74 | 85 |
|
75 | 86 | ***Acceptance Tests:*** |
76 | 87 |
|
77 | 88 | - Test The Function using the resource [external_sync_unit_check.json](test_data/external_sync_unit_check.json). Test is successful if The Callback Server receives from DevRev an event with "event_type" that equals "EXTRACTION_EXTERNAL_SYNC_UNITS_DONE". The test must not send the event directly to The Callback Server. |
78 | 89 |
|
79 | | -- Implement The Function that provides a test of the 'data extraction' part of the extraction workflow as described in the resource [data-extraction.md](docs/data-extraction.md). Only check if data extraction can be triggered and that it successfully completes. Disregard all other details. The name of The Function must be 'data_extraction_check'. |
| 90 | +- Implement The Function called "data_extraction_check" (The Data Extraction Check Function) that provides a test of the 'data extraction' part of the extraction workflow as described in the resource [data-extraction.md](docs/data-extraction.md). The Data Extraction Check Function should: |
| 91 | + - Initialize a single repo "users" |
| 92 | + - normalize the users data using The Normalization Function |
| 93 | + - push the normalized users data to The DevRev Servers |
| 94 | + - Note: The Data Extraction Check Function should be simplified and should disregard all other details. |
80 | 95 |
|
81 | 96 | ***Acceptance Tests:*** |
82 | 97 |
|
|
0 commit comments