Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4c83051
feat: add spacecat-shared-data-access package
solaris007 Nov 29, 2023
9e93178
fix: key validation
solaris007 Nov 29, 2023
595123a
Merge branch 'main' into add-repo-module
solaris007 Nov 29, 2023
49263dc
feat: add models, access patterns and tests
solaris007 Nov 29, 2023
25cbba0
feat: add data access layer
solaris007 Nov 30, 2023
9954c80
fix: use correct doc client
solaris007 Nov 30, 2023
d167973
Merge branch 'main' into add-repo-module
solaris007 Nov 30, 2023
41f4782
fix: allow use of index for getItem
solaris007 Nov 30, 2023
7dcd7ce
Merge branch 'main' into add-repo-module
solaris007 Nov 30, 2023
6b94f38
feat: add data access
solaris007 Nov 30, 2023
0d04ae8
chore: doc
solaris007 Nov 30, 2023
a27ccb2
fix: verify start before end date
solaris007 Nov 30, 2023
2047fbf
fix: add audit result validation, tests
solaris007 Nov 30, 2023
dfbcba1
fix: set updated and created at, add touch
solaris007 Nov 30, 2023
ca51663
fix: use array check instead of object
solaris007 Nov 30, 2023
d07dc7a
chore: typo
solaris007 Nov 30, 2023
3be0749
fix: bugs and more integration tests
solaris007 Dec 1, 2023
32ec089
fix: integration test rejectedWith
solaris007 Dec 1, 2023
3fb1b02
chore: run integration tests in CI
solaris007 Dec 1, 2023
38e1748
fix: add java to ci image
solaris007 Dec 1, 2023
9545fc4
fix: adjust dynamo launch for CI env
solaris007 Dec 1, 2023
a70fd89
fix: provide dummy creds for it-test
solaris007 Dec 1, 2023
4f3aae6
fix: set dummy creds in env
solaris007 Dec 1, 2023
67c2ec2
fix: only run IT tests if needed
solaris007 Dec 1, 2023
ab64662
fix: directory structure
solaris007 Dec 1, 2023
5c24998
feat: add removeSite pattern
solaris007 Dec 1, 2023
5d0b00f
fix: removeSite, add integration test
solaris007 Dec 1, 2023
cfc2448
chore: move tests to appropriate folders
solaris007 Dec 1, 2023
a15ac06
chore: types and small corrections
solaris007 Dec 1, 2023
e33e1a5
feat: add wrapper, update doc
solaris007 Dec 1, 2023
5d50b16
chore: doc
solaris007 Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2.1
executors:
node18:
node-java:
docker:
- image: cimg/node:18.18
- image: cimg/node:18.18-browsers

orbs:
codecov: codecov/codecov@3.3.0
Expand All @@ -20,7 +20,7 @@ commands:

jobs:
build:
executor: node18
executor: node-java
parallelism: 15

steps:
Expand All @@ -34,6 +34,15 @@ jobs:
- run:
name: Running tests and getting code coverage
command: cat /tmp/tests-to-run | xargs -I % npm run test -w %
- run:
name: Running integration tests
command: |
if grep -q "packages/spacecat-shared-data-access" /tmp/tests-to-run; then
echo "Running integration tests for spacecat-shared-data-access"
npm run test:it -w packages/spacecat-shared-data-access
else
echo "Skipping integration tests"
fi
- codecov/upload
- run:
name: Copy test results
Expand Down
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,11 @@ module.exports = {
files: ['*.js', '*.cjs'],
rules: {},
},
{
files: ["*.test.js"],
rules: {
"no-unused-expressions": "off"
}
}
],
};
65 changes: 51 additions & 14 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
## Constants

<dl>
<dt><a href="#createDataAccess">createDataAccess</a> ⇒ <code>object</code></dt>
<dd><p>Creates a data access object.</p>
</dd>
</dl>

## Functions

<dl>
<dt><a href="#createClient">createClient(log, dbClient, docClient)</a> ⇒ <code>Object</code></dt>
<dd><p>Creates a client object for interacting with DynamoDB.</p>
</dd>
<dt><a href="#isArray">isArray(value)</a> ⇒ <code>boolean</code></dt>
<dd><p>Determines if the given parameter is an array.</p>
</dd>
<dt><a href="#isBoolean">isBoolean(value)</a> ⇒ <code>boolean</code></dt>
<dd><p>Determines if the given value is a boolean or a string representation of a boolean.</p>
<dd><p>Determines case-insensitively if the given value is a boolean or a string
representation of a boolean.</p>
</dd>
<dt><a href="#isInteger">isInteger(value)</a> ⇒ <code>boolean</code></dt>
<dd><p>Checks if the given value is an integer.</p>
</dd>
<dt><a href="#isNumber">isNumber(value)</a> ⇒ <code>boolean</code></dt>
<dd><p>Determines if the given value is a number.</p>
</dd>
<dt><a href="#isObject">isObject(obj)</a> ⇒ <code>boolean</code></dt>
<dt><a href="#isObject">isObject(value)</a> ⇒ <code>boolean</code></dt>
<dd><p>Checks if the given parameter is an object and not an array or null.</p>
</dd>
<dt><a href="#isString">isString(str)</a> ⇒ <code>boolean</code></dt>
<dt><a href="#isString">isString(value)</a> ⇒ <code>boolean</code></dt>
<dd><p>Determines if the given parameter is a string.</p>
</dd>
<dt><a href="#hasText">hasText(str)</a> ⇒ <code>boolean</code></dt>
<dd><p>Checks if the given string is not empty.</p>
</dd>
<dt><a href="#isValidDate">isValidDate(obj)</a> ⇒ <code>boolean</code></dt>
<dt><a href="#isValidDate">isValidDate(value)</a> ⇒ <code>boolean</code></dt>
<dd><p>Checks whether the given object is a valid JavaScript Date.</p>
</dd>
<dt><a href="#isIsoDate">isIsoDate(str)</a> ⇒ <code>boolean</code></dt>
Expand All @@ -41,10 +53,22 @@ following UTC time offsets format.</p>
<dd><p>Converts a given value to a boolean. Throws an error if the value is not a boolean.</p>
</dd>
<dt><a href="#arrayEquals">arrayEquals(a, b)</a> ⇒ <code>boolean</code></dt>
<dd><p>Compares two arrays for equality.</p>
<dd><p>Compares two arrays for equality. Supports primitive array item types only.</p>
</dd>
</dl>

<a name="createDataAccess"></a>

## createDataAccess ⇒ <code>object</code>
Creates a data access object.

**Kind**: global constant
**Returns**: <code>object</code> - data access object

| Param | Type | Description |
| --- | --- | --- |
| log | <code>Logger</code> | logger |

<a name="createClient"></a>

## createClient(log, dbClient, docClient) ⇒ <code>Object</code>
Expand All @@ -57,12 +81,25 @@ Creates a client object for interacting with DynamoDB.
| --- | --- | --- |
| log | <code>Object</code> | The logging object, defaults to console. |
| dbClient | <code>DynamoDB</code> | The AWS SDK DynamoDB client instance. |
| docClient | <code>DynamoDBDocumentClient</code> | The AWS SDK DynamoDB Document client instance. |
| docClient | <code>DynamoDBDocument</code> | The AWS SDK DynamoDB Document client instance. |

<a name="isArray"></a>

## isArray(value) ⇒ <code>boolean</code>
Determines if the given parameter is an array.

**Kind**: global function
**Returns**: <code>boolean</code> - True if the parameter is an array, false otherwise.

| Param | Type | Description |
| --- | --- | --- |
| value | <code>\*</code> | The value to check. |

<a name="isBoolean"></a>

## isBoolean(value) ⇒ <code>boolean</code>
Determines if the given value is a boolean or a string representation of a boolean.
Determines case-insensitively if the given value is a boolean or a string
representation of a boolean.

**Kind**: global function
**Returns**: <code>boolean</code> - True if the value is a boolean or a string representation of a boolean.
Expand Down Expand Up @@ -97,27 +134,27 @@ Determines if the given value is a number.

<a name="isObject"></a>

## isObject(obj) ⇒ <code>boolean</code>
## isObject(value) ⇒ <code>boolean</code>
Checks if the given parameter is an object and not an array or null.

**Kind**: global function
**Returns**: <code>boolean</code> - True if the parameter is an object, false otherwise.

| Param | Type | Description |
| --- | --- | --- |
| obj | <code>\*</code> | The object to check. |
| value | <code>\*</code> | The value to check. |

<a name="isString"></a>

## isString(str) ⇒ <code>boolean</code>
## isString(value) ⇒ <code>boolean</code>
Determines if the given parameter is a string.

**Kind**: global function
**Returns**: <code>boolean</code> - True if the parameter is a string, false otherwise.

| Param | Type | Description |
| --- | --- | --- |
| str | <code>\*</code> | The string to check. |
| value | <code>\*</code> | The value to check. |

<a name="hasText"></a>

Expand All @@ -133,15 +170,15 @@ Checks if the given string is not empty.

<a name="isValidDate"></a>

## isValidDate(obj) ⇒ <code>boolean</code>
## isValidDate(value) ⇒ <code>boolean</code>
Checks whether the given object is a valid JavaScript Date.

**Kind**: global function
**Returns**: <code>boolean</code> - True if the given object is a valid Date object, false otherwise.

| Param | Type | Description |
| --- | --- | --- |
| obj | <code>\*</code> | The object to check. |
| value | <code>\*</code> | The value to check. |

<a name="isIsoDate"></a>

Expand Down Expand Up @@ -201,7 +238,7 @@ Converts a given value to a boolean. Throws an error if the value is not a boole
<a name="arrayEquals"></a>

## arrayEquals(a, b) ⇒ <code>boolean</code>
Compares two arrays for equality.
Compares two arrays for equality. Supports primitive array item types only.

**Kind**: global function
**Returns**: <code>boolean</code> - True if the arrays are equal, false otherwise.
Expand Down
Loading