@tetrascience-npm/ts-connectors-sdk 3.1.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/CHANGELOG.md +201 -0
- package/LICENSE +201 -0
- package/README.md +123 -0
- package/dist/api-tests/configuration.test.d.ts +2 -0
- package/dist/api-tests/configuration.test.d.ts.map +1 -0
- package/dist/api-tests/configuration.test.js +49 -0
- package/dist/api-tests/configuration.test.js.map +1 -0
- package/dist/api-tests/connector-lifetime.test.d.ts +2 -0
- package/dist/api-tests/connector-lifetime.test.d.ts.map +1 -0
- package/dist/api-tests/connector-lifetime.test.js +64 -0
- package/dist/api-tests/connector-lifetime.test.js.map +1 -0
- package/dist/api-tests/connector-shutdown.test.d.ts +2 -0
- package/dist/api-tests/connector-shutdown.test.d.ts.map +1 -0
- package/dist/api-tests/connector-shutdown.test.js +76 -0
- package/dist/api-tests/connector-shutdown.test.js.map +1 -0
- package/dist/api-tests/fixture/assertions.d.ts +4 -0
- package/dist/api-tests/fixture/assertions.d.ts.map +1 -0
- package/dist/api-tests/fixture/assertions.js +8 -0
- package/dist/api-tests/fixture/assertions.js.map +1 -0
- package/dist/api-tests/fixture/config.d.ts +65 -0
- package/dist/api-tests/fixture/config.d.ts.map +1 -0
- package/dist/api-tests/fixture/config.js +24 -0
- package/dist/api-tests/fixture/config.js.map +1 -0
- package/dist/api-tests/fixture/connector-api.d.ts +126 -0
- package/dist/api-tests/fixture/connector-api.d.ts.map +1 -0
- package/dist/api-tests/fixture/connector-api.js +151 -0
- package/dist/api-tests/fixture/connector-api.js.map +1 -0
- package/dist/api-tests/fixture/connectors/test-connector.d.ts +39 -0
- package/dist/api-tests/fixture/connectors/test-connector.d.ts.map +1 -0
- package/dist/api-tests/fixture/connectors/test-connector.js +188 -0
- package/dist/api-tests/fixture/connectors/test-connector.js.map +1 -0
- package/dist/api-tests/fixture/create-http-client.d.ts +6 -0
- package/dist/api-tests/fixture/create-http-client.d.ts.map +1 -0
- package/dist/api-tests/fixture/create-http-client.js +52 -0
- package/dist/api-tests/fixture/create-http-client.js.map +1 -0
- package/dist/api-tests/fixture/fixture.d.ts +34 -0
- package/dist/api-tests/fixture/fixture.d.ts.map +1 -0
- package/dist/api-tests/fixture/fixture.js +62 -0
- package/dist/api-tests/fixture/fixture.js.map +1 -0
- package/dist/api-tests/fixture/test-connector-factory.d.ts +21 -0
- package/dist/api-tests/fixture/test-connector-factory.d.ts.map +1 -0
- package/dist/api-tests/fixture/test-connector-factory.js +78 -0
- package/dist/api-tests/fixture/test-connector-factory.js.map +1 -0
- package/dist/api-tests/label-validation.test.d.ts +2 -0
- package/dist/api-tests/label-validation.test.d.ts.map +1 -0
- package/dist/api-tests/label-validation.test.js +158 -0
- package/dist/api-tests/label-validation.test.js.map +1 -0
- package/dist/api-tests/standalone-cloudwatch-logs.test.d.ts +2 -0
- package/dist/api-tests/standalone-cloudwatch-logs.test.d.ts.map +1 -0
- package/dist/api-tests/standalone-cloudwatch-logs.test.js +32 -0
- package/dist/api-tests/standalone-cloudwatch-logs.test.js.map +1 -0
- package/dist/api-tests/user-agent.test.d.ts +2 -0
- package/dist/api-tests/user-agent.test.d.ts.map +1 -0
- package/dist/api-tests/user-agent.test.js +191 -0
- package/dist/api-tests/user-agent.test.js.map +1 -0
- package/dist/src/api.d.ts +353 -0
- package/dist/src/api.d.ts.map +1 -0
- package/dist/src/api.js +278 -0
- package/dist/src/api.js.map +1 -0
- package/dist/src/auth/auth-token-provider.d.ts +7 -0
- package/dist/src/auth/auth-token-provider.d.ts.map +1 -0
- package/dist/src/auth/auth-token-provider.js +3 -0
- package/dist/src/auth/auth-token-provider.js.map +1 -0
- package/dist/src/auth/aws-client-provider.d.ts +11 -0
- package/dist/src/auth/aws-client-provider.d.ts.map +1 -0
- package/dist/src/auth/aws-client-provider.js +3 -0
- package/dist/src/auth/aws-client-provider.js.map +1 -0
- package/dist/src/auth/aws-env-client-provider.d.ts +20 -0
- package/dist/src/auth/aws-env-client-provider.d.ts.map +1 -0
- package/dist/src/auth/aws-env-client-provider.js +69 -0
- package/dist/src/auth/aws-env-client-provider.js.map +1 -0
- package/dist/src/auth/aws-refresh-client-provider.d.ts +26 -0
- package/dist/src/auth/aws-refresh-client-provider.d.ts.map +1 -0
- package/dist/src/auth/aws-refresh-client-provider.js +111 -0
- package/dist/src/auth/aws-refresh-client-provider.js.map +1 -0
- package/dist/src/auth/aws-secret-auth-token-provider.d.ts +9 -0
- package/dist/src/auth/aws-secret-auth-token-provider.d.ts.map +1 -0
- package/dist/src/auth/aws-secret-auth-token-provider.js +58 -0
- package/dist/src/auth/aws-secret-auth-token-provider.js.map +1 -0
- package/dist/src/auth/index.d.ts +7 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/index.js +23 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/auth/predefined-auth-token-provider.d.ts +7 -0
- package/dist/src/auth/predefined-auth-token-provider.d.ts.map +1 -0
- package/dist/src/auth/predefined-auth-token-provider.js +24 -0
- package/dist/src/auth/predefined-auth-token-provider.js.map +1 -0
- package/dist/src/auth/user-supplied-auth-token-provider.d.ts +7 -0
- package/dist/src/auth/user-supplied-auth-token-provider.d.ts.map +1 -0
- package/dist/src/auth/user-supplied-auth-token-provider.js +24 -0
- package/dist/src/auth/user-supplied-auth-token-provider.js.map +1 -0
- package/dist/src/certificates.d.ts +6 -0
- package/dist/src/certificates.d.ts.map +1 -0
- package/dist/src/certificates.js +88 -0
- package/dist/src/certificates.js.map +1 -0
- package/dist/src/checksums.d.ts +50 -0
- package/dist/src/checksums.d.ts.map +1 -0
- package/dist/src/checksums.js +32 -0
- package/dist/src/checksums.js.map +1 -0
- package/dist/src/config.d.ts +41 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +35 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/connector.d.ts +101 -0
- package/dist/src/connector.d.ts.map +1 -0
- package/dist/src/connector.js +374 -0
- package/dist/src/connector.js.map +1 -0
- package/dist/src/get-log-event-size.d.ts +3 -0
- package/dist/src/get-log-event-size.d.ts.map +1 -0
- package/dist/src/get-log-event-size.js +9 -0
- package/dist/src/get-log-event-size.js.map +1 -0
- package/dist/src/https-proxy-agent.d.ts +15 -0
- package/dist/src/https-proxy-agent.d.ts.map +1 -0
- package/dist/src/https-proxy-agent.js +31 -0
- package/dist/src/https-proxy-agent.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +25 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/logger.d.ts +60 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +284 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/manifest.d.ts +4 -0
- package/dist/src/manifest.d.ts.map +1 -0
- package/dist/src/manifest.js +30 -0
- package/dist/src/manifest.js.map +1 -0
- package/dist/src/metrics.d.ts +59 -0
- package/dist/src/metrics.d.ts.map +1 -0
- package/dist/src/metrics.js +125 -0
- package/dist/src/metrics.js.map +1 -0
- package/dist/src/polling-connector.d.ts +50 -0
- package/dist/src/polling-connector.d.ts.map +1 -0
- package/dist/src/polling-connector.js +169 -0
- package/dist/src/polling-connector.js.map +1 -0
- package/dist/src/schemas.d.ts +77 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/schemas.js +80 -0
- package/dist/src/schemas.js.map +1 -0
- package/dist/src/streamToString.d.ts +3 -0
- package/dist/src/streamToString.d.ts.map +1 -0
- package/dist/src/streamToString.js +25 -0
- package/dist/src/streamToString.js.map +1 -0
- package/dist/src/tdp-client.d.ts +307 -0
- package/dist/src/tdp-client.d.ts.map +1 -0
- package/dist/src/tdp-client.js +823 -0
- package/dist/src/tdp-client.js.map +1 -0
- package/dist/src/to-cloudwatch-log-event.d.ts +4 -0
- package/dist/src/to-cloudwatch-log-event.d.ts.map +1 -0
- package/dist/src/to-cloudwatch-log-event.js +10 -0
- package/dist/src/to-cloudwatch-log-event.js.map +1 -0
- package/dist/src/types.d.ts +57 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +30 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +10 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +20 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/test/api.test.d.ts +2 -0
- package/dist/test/api.test.d.ts.map +1 -0
- package/dist/test/api.test.js +245 -0
- package/dist/test/api.test.js.map +1 -0
- package/dist/test/auth/aws-env-client-provider.test.d.ts +2 -0
- package/dist/test/auth/aws-env-client-provider.test.d.ts.map +1 -0
- package/dist/test/auth/aws-env-client-provider.test.js +56 -0
- package/dist/test/auth/aws-env-client-provider.test.js.map +1 -0
- package/dist/test/auth/aws-refresh-client-provider.test.d.ts +2 -0
- package/dist/test/auth/aws-refresh-client-provider.test.d.ts.map +1 -0
- package/dist/test/auth/aws-refresh-client-provider.test.js +118 -0
- package/dist/test/auth/aws-refresh-client-provider.test.js.map +1 -0
- package/dist/test/auth/aws-secret-auth-token-provider.test.d.ts +2 -0
- package/dist/test/auth/aws-secret-auth-token-provider.test.d.ts.map +1 -0
- package/dist/test/auth/aws-secret-auth-token-provider.test.js +74 -0
- package/dist/test/auth/aws-secret-auth-token-provider.test.js.map +1 -0
- package/dist/test/auth/predefined-auth-token-provider.test.d.ts +2 -0
- package/dist/test/auth/predefined-auth-token-provider.test.d.ts.map +1 -0
- package/dist/test/auth/predefined-auth-token-provider.test.js +24 -0
- package/dist/test/auth/predefined-auth-token-provider.test.js.map +1 -0
- package/dist/test/auth/user-supplied-auth-token-provider.test.d.ts +2 -0
- package/dist/test/auth/user-supplied-auth-token-provider.test.d.ts.map +1 -0
- package/dist/test/auth/user-supplied-auth-token-provider.test.js +24 -0
- package/dist/test/auth/user-supplied-auth-token-provider.test.js.map +1 -0
- package/dist/test/certificates.test.d.ts +2 -0
- package/dist/test/certificates.test.d.ts.map +1 -0
- package/dist/test/certificates.test.js +83 -0
- package/dist/test/certificates.test.js.map +1 -0
- package/dist/test/checksums.test.d.ts +2 -0
- package/dist/test/checksums.test.d.ts.map +1 -0
- package/dist/test/checksums.test.js +29 -0
- package/dist/test/checksums.test.js.map +1 -0
- package/dist/test/connector-shutdown.test.d.ts +2 -0
- package/dist/test/connector-shutdown.test.d.ts.map +1 -0
- package/dist/test/connector-shutdown.test.js +145 -0
- package/dist/test/connector-shutdown.test.js.map +1 -0
- package/dist/test/connector.test.d.ts +2 -0
- package/dist/test/connector.test.d.ts.map +1 -0
- package/dist/test/connector.test.js +286 -0
- package/dist/test/connector.test.js.map +1 -0
- package/dist/test/healthstatus-enum-values.test.d.ts +2 -0
- package/dist/test/healthstatus-enum-values.test.d.ts.map +1 -0
- package/dist/test/healthstatus-enum-values.test.js +18 -0
- package/dist/test/healthstatus-enum-values.test.js.map +1 -0
- package/dist/test/logger.test.d.ts +2 -0
- package/dist/test/logger.test.d.ts.map +1 -0
- package/dist/test/logger.test.js +301 -0
- package/dist/test/logger.test.js.map +1 -0
- package/dist/test/manifest.test.d.ts +2 -0
- package/dist/test/manifest.test.d.ts.map +1 -0
- package/dist/test/manifest.test.js +55 -0
- package/dist/test/manifest.test.js.map +1 -0
- package/dist/test/polling-connector.test.d.ts +2 -0
- package/dist/test/polling-connector.test.d.ts.map +1 -0
- package/dist/test/polling-connector.test.js +170 -0
- package/dist/test/polling-connector.test.js.map +1 -0
- package/dist/test/schemas.test.d.ts +2 -0
- package/dist/test/schemas.test.d.ts.map +1 -0
- package/dist/test/schemas.test.js +211 -0
- package/dist/test/schemas.test.js.map +1 -0
- package/dist/test/tdp-client.test.d.ts +2 -0
- package/dist/test/tdp-client.test.d.ts.map +1 -0
- package/dist/test/tdp-client.test.js +1204 -0
- package/dist/test/tdp-client.test.js.map +1 -0
- package/dist/test/test-connector/index.d.ts +2 -0
- package/dist/test/test-connector/index.d.ts.map +1 -0
- package/dist/test/test-connector/index.js +23 -0
- package/dist/test/test-connector/index.js.map +1 -0
- package/dist/test/test-connector/test-connector.d.ts +7 -0
- package/dist/test/test-connector/test-connector.d.ts.map +1 -0
- package/dist/test/test-connector/test-connector.js +32 -0
- package/dist/test/test-connector/test-connector.js.map +1 -0
- package/dist/test/test-utils/api-mocks.d.ts +6 -0
- package/dist/test/test-utils/api-mocks.d.ts.map +1 -0
- package/dist/test/test-utils/api-mocks.js +19 -0
- package/dist/test/test-utils/api-mocks.js.map +1 -0
- package/dist/test/test-utils/aws-mocks.d.ts +8 -0
- package/dist/test/test-utils/aws-mocks.d.ts.map +1 -0
- package/dist/test/test-utils/aws-mocks.js +39 -0
- package/dist/test/test-utils/aws-mocks.js.map +1 -0
- package/dist/test/test-utils/regex.d.ts +2 -0
- package/dist/test/test-utils/regex.d.ts.map +1 -0
- package/dist/test/test-utils/regex.js +7 -0
- package/dist/test/test-utils/regex.js.map +1 -0
- package/dist/test/utils.test.d.ts +2 -0
- package/dist/test/utils.test.d.ts.map +1 -0
- package/dist/test/utils.test.js +17 -0
- package/dist/test/utils.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vitest.config.d.mts +3 -0
- package/dist/vitest.config.d.mts.map +1 -0
- package/dist/vitest.config.mjs +20 -0
- package/dist/vitest.config.mjs.map +1 -0
- package/package.json +133 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Major Changes
|
|
2
|
+
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
* Prepare initial public npm release of `@tetrascience-npm/ts-connectors-sdk`.
|
|
6
|
+
* Change project license from MIT to Apache 2.0 to align with public SDK requirements.
|
|
7
|
+
* No runtime behavior changes since 3.0.1-rc2; 3.1.0 is identical to 3.1.0-rc1 aside from licensing, packaging, and documentation updates.
|
|
8
|
+
|
|
9
|
+
## 3.1.0-rc1
|
|
10
|
+
|
|
11
|
+
* Fix some minor issues with user agent config published in v3.0.1-rc2
|
|
12
|
+
* Increment minor version to signify new feature
|
|
13
|
+
|
|
14
|
+
## 3.0.1-rc2
|
|
15
|
+
|
|
16
|
+
* Added User-Agent header support to all TDP API requests
|
|
17
|
+
* Default format is `<connector-slug> v<connector-version>` using information from manifest.json
|
|
18
|
+
* If manifest.json is not available, defaults to `PluggableConnector TDPClient`
|
|
19
|
+
* Setting `TS_SDK.TS_SDK_DISABLE_USER_AGENT_HTTP_HEADER` to `true` in the connector KV store will disable the custom behavior and revert to use the default axios user agent
|
|
20
|
+
* In the connector KV store, `TS_SDK` is the key and the expected value is a JSON object with the key `TS_SDK_DISABLE_USER_AGENT_HTTP_HEADER` and a boolean value
|
|
21
|
+
* Example: `{"TS_SDK_DISABLE_USER_AGENT_HTTP_HEADER": true}`
|
|
22
|
+
|
|
23
|
+
## 3.0.1-rc1
|
|
24
|
+
|
|
25
|
+
* Sends command REJECTED instead of SUCCESS when processing an unrecognized command
|
|
26
|
+
|
|
27
|
+
## 3.0.0
|
|
28
|
+
|
|
29
|
+
* When initializing with CONNECTOR_TOKEN env var, explicitly writes logs to AWS Cloudwatch in addition to stdout.
|
|
30
|
+
* Added a peer dependency on `@aws-sdk/client-cloudwatch-logs@>=3.0.0 <4.0.0` to support AWS Cloudwatch logging
|
|
31
|
+
* Also adds the following configuration env vars to override various aspects of this behavior:
|
|
32
|
+
* SKIP_CLOUDWATCH - disables cloudwatch logging entirely.
|
|
33
|
+
* CLOUDWATCH_BUFFER_LIMIT - how many messages will be stored in the cloudwatch buffer before we begin discarding them to prevent memory issues. Default 5000.
|
|
34
|
+
* CLOUDWATCH_FLUSH_LIMIT - how many messages will be stored in the cloudwatch buffer before we trigger a flush. Default 100.
|
|
35
|
+
* CLOUDWATCH_FLUSH_INTERVAL - how long we will wait after each flush before triggering the next one, in milliseconds. Default 30 * 1000.
|
|
36
|
+
* When a connector is shutdown the base `Connector` class now calls the [shutdown method](https://github.com/tetrascience/ts-sdk-connectors-nodejs/blob/2374b65db6ce8d28bb6545db8f6fe30125ad1f4f/src/connector.ts#L312) instead of the `onShutdown` method
|
|
37
|
+
* The `shutdown` method of the base class will call the `onShutdown` method before the base connector performs some cleanup
|
|
38
|
+
* Any developer that overrides the base `shutdown` method must invoke `super.shutdown` to perform proper cleanup
|
|
39
|
+
|
|
40
|
+
## 2.3.0
|
|
41
|
+
|
|
42
|
+
* Add `destinationId` as option to `tdpClient.uploadFile`. This allows connectors to use a different UUIDv4 in place of the connector ID when creating file keys in the datalake
|
|
43
|
+
* Fix bug where HTTPS proxy ignored `rejectUnauthorized` setting
|
|
44
|
+
* Support SDK initialization with a TDP JWT in the CONNECTOR_TOKEN env var. When this is supplied, the SDK will operate in Standalone mode, exchanging this JWT for a temporary AWS credential and supplying AWS SDK clients with those credentials instead of relying on AWS credentials in the environment.
|
|
45
|
+
|
|
46
|
+
## 2.2.7
|
|
47
|
+
|
|
48
|
+
* Improved logging of environmental proxy settings when not set via Hub env file
|
|
49
|
+
* Supports HTTP_PROXY, HTTPS_PROXY, and NO_PROXY via environment variables when the hub proxy env file is not available. Previously only the lowercase versions http_proxy, https_proxy, and no_proxy were supported.
|
|
50
|
+
|
|
51
|
+
## 2.2.6
|
|
52
|
+
|
|
53
|
+
* Added object size and abort controller options to `tdpClient.uploadFile`
|
|
54
|
+
* Updated various AWS SDK libraries, including `@smithy/node-http-handler`
|
|
55
|
+
|
|
56
|
+
## 2.2.5
|
|
57
|
+
|
|
58
|
+
* Added content type and encoding to `tdpClient.uploadFile`
|
|
59
|
+
|
|
60
|
+
## 2.2.4
|
|
61
|
+
|
|
62
|
+
* Updated dependencies to clear vulnerability warnings
|
|
63
|
+
|
|
64
|
+
## 2.2.3
|
|
65
|
+
|
|
66
|
+
* Removed incorrect validation on file upload 'trace' value
|
|
67
|
+
* Exports upload file request validation schemas
|
|
68
|
+
|
|
69
|
+
## 2.2.2
|
|
70
|
+
|
|
71
|
+
* Fixed incorrect response code and message for failed key validation
|
|
72
|
+
|
|
73
|
+
## 2.2.1
|
|
74
|
+
|
|
75
|
+
* Fix HTTP proxy and certificate support for TDPClient.
|
|
76
|
+
* Adds support of `NODE_TLS_REJECT_UNAUTHORIZED` environment variable to disable TLS certificate validation.
|
|
77
|
+
* Add support for `HTTPS_AGENT` environment variable to override the default HTTPS agent. Possible values: `hpagent`.
|
|
78
|
+
|
|
79
|
+
## 2.2.0
|
|
80
|
+
|
|
81
|
+
* Add support for large command payloads (passed over s3 signed URLs) handling.
|
|
82
|
+
* Breaking change: `Command` type is split to `CommandRequest` and `CommandResponse` types.
|
|
83
|
+
|
|
84
|
+
## 2.1.2
|
|
85
|
+
|
|
86
|
+
* Allow requestId in all sdk queries, generated one if none is passed.
|
|
87
|
+
|
|
88
|
+
## 2.1.1
|
|
89
|
+
|
|
90
|
+
* Fixed an issue where saveFile failures do not report the correct error message.
|
|
91
|
+
|
|
92
|
+
## 2.1.0
|
|
93
|
+
|
|
94
|
+
* uploadFile validates provided metadata, tags, labels, and trace against TDP 3.6 MTL rules.
|
|
95
|
+
* Connector uploadFile requests using invalid metadata will now log a warning containing the validation failures.
|
|
96
|
+
* During development or for stricter behavior, you can pass strictMtlValidation: true to instead throw an error containing the validation failures.
|
|
97
|
+
* These rules are slightly more lenient than TDP 3.5 rules around [multibyte labels in particular](https://developers.tetrascience.com/docs/creating-and-deleting-custom-labels-metadata-and-tags#create-a-new-label), so be aware that such labels will pass this validation but may cause problems in TDP 3.5.
|
|
98
|
+
|
|
99
|
+
## 2.0.1
|
|
100
|
+
|
|
101
|
+
* Fixed an issue where PollingConnector restarts running on updates.
|
|
102
|
+
|
|
103
|
+
## 2.0.0
|
|
104
|
+
|
|
105
|
+
* Moved aws-sdk and axios to dev dependencies
|
|
106
|
+
* Connectors using this version will need to depend on a compatible library version:
|
|
107
|
+
* @aws-sdk/client-s3: >=3.0.0 <4.0.0
|
|
108
|
+
* @aws-sdk/client-sqs: >=3.0.0 <4.0.0
|
|
109
|
+
* @aws-sdk/client-ssm: >=3.0.0 <4.0.0
|
|
110
|
+
* @aws-sdk/lib-storage: >=3.0.0 <4.0.0
|
|
111
|
+
* axios: >=1.5.0 <2.0.0
|
|
112
|
+
|
|
113
|
+
## 1.1.6
|
|
114
|
+
|
|
115
|
+
* Added checksum functionality
|
|
116
|
+
* Automatically populates MD5 checksums for files uploaded
|
|
117
|
+
* Optional checksumAlgorithm parameter overrides the default SHA256
|
|
118
|
+
* Also allows raw checksum uploads that are saved as metadata
|
|
119
|
+
* rawXXXChecksum, where XXX is one of Md5, Sha1, Sha256, Crc32, Crc32c, saved in checksums object
|
|
120
|
+
|
|
121
|
+
## 1.1.5
|
|
122
|
+
|
|
123
|
+
* Added baseURL to tdp-client options
|
|
124
|
+
* Added checks to prevent certificate lookup to fire errors on setup/restart
|
|
125
|
+
* Sanitized axios logging configuration
|
|
126
|
+
* Removed connectorSlug from traceMetadata
|
|
127
|
+
|
|
128
|
+
## 1.1.4
|
|
129
|
+
|
|
130
|
+
* Updated Dependencies to Fix Vulnerabilities
|
|
131
|
+
|
|
132
|
+
## 1.1.3
|
|
133
|
+
|
|
134
|
+
* Replaces @aws-sdk/node-http-handler with @smithy/node-http-handler
|
|
135
|
+
|
|
136
|
+
## 1.1.2
|
|
137
|
+
|
|
138
|
+
* Makes @aws-sdk/node-http-handler an explicit dependency, as it was removed from @aws-sdk/client-s3 dependencies
|
|
139
|
+
|
|
140
|
+
## 1.1.1
|
|
141
|
+
|
|
142
|
+
* Added error information in response messages for commands
|
|
143
|
+
|
|
144
|
+
## 1.1.0
|
|
145
|
+
|
|
146
|
+
* Loads a certificate file from STREAM_BUCKET/TDP_CERTIFICATE_KEY if one exists, allowing Connectors to trust a self-signed certificate for the TDP API.
|
|
147
|
+
|
|
148
|
+
## 1.0.0
|
|
149
|
+
|
|
150
|
+
* Adds API.getCertificates - calls TDP endpoint to download organization CA certificates
|
|
151
|
+
* Adds TDPClient.getCertificates - wrapper around API.getCertificates that supplies connector org slug
|
|
152
|
+
* Adds TDPClient.certificates - setup during initialization from the methods above, contains an array of organization certificate CAs that should be trusted for outgoing http requests.
|
|
153
|
+
|
|
154
|
+
### Breaking Changes
|
|
155
|
+
|
|
156
|
+
* The signature of TDPClient.createProxyAgentsForBaseUrl has changed to take an options object instead of primitive parameters.
|
|
157
|
+
|
|
158
|
+
## 0.12.1
|
|
159
|
+
|
|
160
|
+
* Updated testing support for v16, 18, and 20.
|
|
161
|
+
|
|
162
|
+
## 0.12.0
|
|
163
|
+
|
|
164
|
+
* Added connector metadata to s3 metadata for files uploaded to TDP
|
|
165
|
+
|
|
166
|
+
## 0.10.1
|
|
167
|
+
|
|
168
|
+
* Simplify loading of files to processed. Logic moved to the base `Connector` class.
|
|
169
|
+
|
|
170
|
+
### Breaking Changes
|
|
171
|
+
|
|
172
|
+
* None
|
|
173
|
+
|
|
174
|
+
## 0.10.0
|
|
175
|
+
|
|
176
|
+
* Reject expired commands and do not emit messages for them
|
|
177
|
+
|
|
178
|
+
### Breaking Changes
|
|
179
|
+
|
|
180
|
+
* `ConnectorFileDto`.`externalId` has been renamed to `uniqueExternalId`
|
|
181
|
+
* `TdpClient`.`getFiles` returns 50 files by default instead of all
|
|
182
|
+
|
|
183
|
+
## 0.9.0
|
|
184
|
+
|
|
185
|
+
* Reject expired commands and do not emit messages for them
|
|
186
|
+
|
|
187
|
+
### Breaking Changes
|
|
188
|
+
|
|
189
|
+
* None
|
|
190
|
+
|
|
191
|
+
## 0.5.1
|
|
192
|
+
|
|
193
|
+
* Changelog introduced
|
|
194
|
+
|
|
195
|
+
### Breaking Changes
|
|
196
|
+
|
|
197
|
+
* None
|
|
198
|
+
|
|
199
|
+
### Breaking Changes
|
|
200
|
+
|
|
201
|
+
* None yet
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
## @tetrascience-npm/ts-connectors-sdk
|
|
2
|
+
|
|
3
|
+
TetraScience Node.js Connectors SDK.
|
|
4
|
+
|
|
5
|
+
Provides base classes and utilities for building TetraScience Connectors in Node.js.
|
|
6
|
+
|
|
7
|
+
It is primarily intended to be used by TetraScience connectors running on the
|
|
8
|
+
Tetra Data Platform (TDP).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
This SDK relies on a small set of peer dependencies that your application must
|
|
13
|
+
provide. These are not bundled with the SDK so that you can control the exact
|
|
14
|
+
versions used in your environment.
|
|
15
|
+
|
|
16
|
+
Required peer dependencies:
|
|
17
|
+
|
|
18
|
+
- `@aws-sdk/client-cloudwatch-logs`
|
|
19
|
+
- `@aws-sdk/client-s3`
|
|
20
|
+
- `@aws-sdk/client-sqs`
|
|
21
|
+
- `@aws-sdk/client-ssm`
|
|
22
|
+
- `@aws-sdk/lib-storage`
|
|
23
|
+
- `axios`
|
|
24
|
+
|
|
25
|
+
If you are not already using these packages, you can install everything together:
|
|
26
|
+
|
|
27
|
+
Using **npm**:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @tetrascience-npm/ts-connectors-sdk \
|
|
31
|
+
@aws-sdk/client-cloudwatch-logs @aws-sdk/client-s3 \
|
|
32
|
+
@aws-sdk/client-sqs @aws-sdk/client-ssm @aws-sdk/lib-storage axios
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Using **Yarn**:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
yarn add @tetrascience-npm/ts-connectors-sdk \
|
|
39
|
+
@aws-sdk/client-cloudwatch-logs @aws-sdk/client-s3 \
|
|
40
|
+
@aws-sdk/client-sqs @aws-sdk/client-ssm @aws-sdk/lib-storage axios
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If your project already depends on the AWS SDK v3 clients or `axios`, you only
|
|
44
|
+
need to add `@tetrascience-npm/ts-connectors-sdk` and ensure that your existing
|
|
45
|
+
versions satisfy the peer dependency ranges in `package.json`.
|
|
46
|
+
|
|
47
|
+
This SDK is tested with Node.js versions 16, 18, and 20 (see the `engines` field in
|
|
48
|
+
`package.json`).
|
|
49
|
+
|
|
50
|
+
## Overview
|
|
51
|
+
|
|
52
|
+
The SDK exposes the following primary building blocks:
|
|
53
|
+
|
|
54
|
+
- **TDPClient** – wraps the Tetra Data Platform data-acquisition API and handles
|
|
55
|
+
datalake uploads directly to S3, including metadata options and validation.
|
|
56
|
+
- **Connector** – base class that encapsulates common connector lifecycle concerns
|
|
57
|
+
such as initialization, health reporting, metrics, and command handling.
|
|
58
|
+
- **PollingConnector** – extends `Connector` with a polling loop implementation
|
|
59
|
+
suitable for connectors that primarily poll external systems on an interval.
|
|
60
|
+
|
|
61
|
+
All of these are exported from the package root, for example:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { Connector, PollingConnector, TDPClient } from '@tetrascience-npm/ts-connectors-sdk';
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Basic usage
|
|
68
|
+
|
|
69
|
+
### TDPClient
|
|
70
|
+
|
|
71
|
+
In a typical connector environment, `TDPClient` is initialized with configuration
|
|
72
|
+
derived from the connector runtime (environment variables, manifests, and
|
|
73
|
+
connector settings). At a high level you use it to make API calls and upload
|
|
74
|
+
files into the Tetra Data Platform:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { TDPClient } from '@tetrascience-npm/ts-connectors-sdk';
|
|
78
|
+
|
|
79
|
+
async function uploadExample() {
|
|
80
|
+
const client = new TDPClient(/* see source for available options */);
|
|
81
|
+
|
|
82
|
+
await client.uploadFile({
|
|
83
|
+
content: Buffer.from('example'),
|
|
84
|
+
filepath: 'path/in/datalake/example.txt',
|
|
85
|
+
// Optional metadata, tags, labels, and other fields are validated
|
|
86
|
+
// against the platform metadata rules.
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Refer to the `TDPClient` source (`src/tdp-client.ts`) for the full set of
|
|
92
|
+
options and behaviors.
|
|
93
|
+
|
|
94
|
+
### Connector and PollingConnector
|
|
95
|
+
|
|
96
|
+
To build a connector, extend either `Connector` or `PollingConnector` and
|
|
97
|
+
implement the appropriate hooks for your integration.
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { PollingConnector } from '@tetrascience-npm/ts-connectors-sdk';
|
|
101
|
+
|
|
102
|
+
class MyPollingConnector extends PollingConnector {
|
|
103
|
+
// Implement required hooks such as poll(), onStartup(), onShutdown(), etc.
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The base classes handle boilerplate such as:
|
|
108
|
+
|
|
109
|
+
- Connector lifecycle and shutdown behavior
|
|
110
|
+
- Health and metrics reporting
|
|
111
|
+
- Command reception and dispatch
|
|
112
|
+
|
|
113
|
+
## Versioning and changelog
|
|
114
|
+
|
|
115
|
+
All notable changes are documented in [CHANGELOG.md](./CHANGELOG.md).
|
|
116
|
+
|
|
117
|
+
## Contributing
|
|
118
|
+
|
|
119
|
+
For more details, see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
This project is licensed under the [Apache License 2.0](./LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.test.d.ts","sourceRoot":"","sources":["../../api-tests/configuration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
16
|
+
const vitest_1 = require("vitest");
|
|
17
|
+
const fixture_1 = require("./fixture/fixture");
|
|
18
|
+
(0, vitest_1.describe)('Configuration', () => {
|
|
19
|
+
(0, fixture_1.connectorTest)('DAM-T81: Standalone connector does not change for invalid configuration', (_a) => __awaiter(void 0, [_a], void 0, function* ({ expect, connectorApi, standaloneConnector }) {
|
|
20
|
+
yield standaloneConnector.start();
|
|
21
|
+
const onlineCheck = yield connectorApi.waitForConnectorToBeOnline(standaloneConnector.connector.id);
|
|
22
|
+
expect(onlineCheck.status).toBe(200);
|
|
23
|
+
expect(onlineCheck.data.operatingStatus).toBe('IDLE');
|
|
24
|
+
const originalConnector = lodash_1.default.cloneDeep(standaloneConnector.connector);
|
|
25
|
+
const invalidConfig = { name: 'test-user' };
|
|
26
|
+
yield connectorApi.updateConfiguration(standaloneConnector.connector.id, invalidConfig);
|
|
27
|
+
const validationResults = standaloneConnector.configValidationAttempts;
|
|
28
|
+
expect(validationResults).toHaveLength(1);
|
|
29
|
+
expect(validationResults[0].result.valid).toBe(false);
|
|
30
|
+
expect(standaloneConnector.connector).toEqual(originalConnector);
|
|
31
|
+
expect(standaloneConnector.updateCounts).toBe(0);
|
|
32
|
+
}));
|
|
33
|
+
(0, fixture_1.connectorTest)('DAM-T83: Standalone connector updates on valid configuration', (_a) => __awaiter(void 0, [_a], void 0, function* ({ expect, connectorApi, standaloneConnector }) {
|
|
34
|
+
yield standaloneConnector.start();
|
|
35
|
+
const onlineCheck = yield connectorApi.waitForConnectorToBeOnline(standaloneConnector.connector.id);
|
|
36
|
+
expect(onlineCheck.status).toBe(200);
|
|
37
|
+
expect(onlineCheck.data.operatingStatus).toBe('IDLE');
|
|
38
|
+
const originalConnector = lodash_1.default.cloneDeep(standaloneConnector.connector);
|
|
39
|
+
const validConfig = { username: 'test' };
|
|
40
|
+
yield connectorApi.updateConfiguration(standaloneConnector.connector.id, validConfig);
|
|
41
|
+
const validationResults = standaloneConnector.configValidationAttempts;
|
|
42
|
+
expect(validationResults).toHaveLength(1);
|
|
43
|
+
expect(validationResults[0].result.valid).toBe(true);
|
|
44
|
+
expect(standaloneConnector.connector).not.toEqual(originalConnector);
|
|
45
|
+
expect(standaloneConnector.config).toEqual(validConfig);
|
|
46
|
+
expect(standaloneConnector.updateCounts).toBe(1);
|
|
47
|
+
}));
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=configuration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.test.js","sourceRoot":"","sources":["../../api-tests/configuration.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAAuB;AACvB,mCAAkC;AAElC,+CAAkD;AAElD,IAAA,iBAAQ,EAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAA,uBAAa,EACX,yEAAyE,EACzE,KAAsD,EAAE,4CAAjD,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE;QAClD,MAAM,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAClC,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACpG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,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AC,SAAS,CAAC,CAAC;QACrE,MAAM,WAAW,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QAEzC,MAAM,YAAY,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QAEtF,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,wBAAwB,CAAC;QACvE,MAAM,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACrE,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACxD,MAAM,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC,CAAA,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-lifetime.test.d.ts","sourceRoot":"","sources":["../../api-tests/connector-lifetime.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const vitest_1 = require("vitest");
|
|
13
|
+
const types_js_1 = require("../src/types.js");
|
|
14
|
+
const assertions_1 = require("./fixture/assertions");
|
|
15
|
+
const fixture_1 = require("./fixture/fixture");
|
|
16
|
+
(0, vitest_1.describe)('Connector lifetime', () => {
|
|
17
|
+
(0, fixture_1.connectorTest)('DAM-T82: Connector can transition between idle and running', (_a) => __awaiter(void 0, [_a], void 0, function* ({ standaloneConnector, connectorApi, expect }) {
|
|
18
|
+
yield standaloneConnector.start();
|
|
19
|
+
const onlineCheck = yield connectorApi.waitForConnectorToBeOnline(standaloneConnector.connector.id);
|
|
20
|
+
expect(onlineCheck.status).toBe(200);
|
|
21
|
+
expect(standaloneConnector.connector.operatingStatus).toBe('IDLE');
|
|
22
|
+
expect(onlineCheck.data.operatingStatus).toBe('IDLE');
|
|
23
|
+
yield connectorApi.setStatus(standaloneConnector.connector.id, 'RUNNING');
|
|
24
|
+
const command = yield standaloneConnector.waitForCommand(types_js_1.CommandAction.Start);
|
|
25
|
+
expect(command).toBeDefined();
|
|
26
|
+
expect(standaloneConnector.connector.operatingStatus).toBe('RUNNING');
|
|
27
|
+
const apiResponse = yield connectorApi.get(standaloneConnector.connector.id);
|
|
28
|
+
expect(apiResponse.status).toBe(200);
|
|
29
|
+
expect(apiResponse.data.operatingStatus).toBe('RUNNING');
|
|
30
|
+
}));
|
|
31
|
+
(0, fixture_1.connectorTest)('DAM-T84: Disabling connector invalidates auth token', { timeout: 10 * 60 * 1000 }, (_a) => __awaiter(void 0, [_a], void 0, function* ({ standaloneConnector, connectorApi, expect, config, delay }) {
|
|
32
|
+
var _b, _c;
|
|
33
|
+
yield standaloneConnector.start();
|
|
34
|
+
const onlineCheck = yield connectorApi.waitForConnectorToBeOnline(standaloneConnector.connector.id);
|
|
35
|
+
expect(onlineCheck.status).toBe(200);
|
|
36
|
+
expect(onlineCheck.data.networkStatus).toBe('Online');
|
|
37
|
+
const disableRes = yield connectorApi.setStatus(standaloneConnector.connector.id, 'DISABLED');
|
|
38
|
+
expect(disableRes.status).toBe(200);
|
|
39
|
+
const shutdownCommand = yield standaloneConnector.waitForCommand(types_js_1.CommandAction.Shutdown);
|
|
40
|
+
expect(shutdownCommand).toBeDefined();
|
|
41
|
+
// it takes 3 minutes for the connector to be shown as offline
|
|
42
|
+
yield delay(3 * 60);
|
|
43
|
+
const offlineCheck = yield connectorApi.waitForConnectorToBeOffline(standaloneConnector.connector.id);
|
|
44
|
+
expect(offlineCheck.status).toBe(200);
|
|
45
|
+
expect(offlineCheck.data.networkStatus).toBe('Offline');
|
|
46
|
+
try {
|
|
47
|
+
yield standaloneConnector.uploadFile(config);
|
|
48
|
+
expect.fail('Expected upload to fail');
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
(0, assertions_1.expectToBeAxiosError)(expect, e);
|
|
52
|
+
expect((_b = e.response) === null || _b === void 0 ? void 0 : _b.status).toBe(401);
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
yield standaloneConnector.uploadFile(config);
|
|
56
|
+
expect.fail('Expected upload to fail');
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
(0, assertions_1.expectToBeAxiosError)(expect, e);
|
|
60
|
+
expect((_c = e.response) === null || _c === void 0 ? void 0 : _c.status).toBe(401);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=connector-lifetime.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-lifetime.test.js","sourceRoot":"","sources":["../../api-tests/connector-lifetime.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAkC;AAElC,8CAAgD;AAChD,qDAA4D;AAC5D,+CAAkD;AAElD,IAAA,iBAAQ,EAAC,oBAAoB,E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