@aesop-fables/containr-dynamofx 0.1.4 → 0.3.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/lib/DynamoFactory.d.ts +2 -2
- package/lib/DynamoFactory.js +2 -2
- package/lib/DynamoServices.d.ts +0 -1
- package/lib/DynamoServices.js +0 -1
- package/lib/index.d.ts +3 -7
- package/lib/index.js +17 -3
- package/lib/resolveEnvironmentSettings.d.ts +17 -0
- package/lib/resolveEnvironmentSettings.js +17 -0
- package/package.json +13 -17
package/lib/DynamoFactory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DynamoDB
|
|
1
|
+
import { DynamoDB } from 'aws-sdk';
|
|
2
2
|
export declare class DynamoFactory {
|
|
3
|
-
static createFullClient(configuration?:
|
|
3
|
+
static createFullClient(configuration?: DynamoDB.Types.ClientConfiguration): DynamoDB;
|
|
4
4
|
}
|
package/lib/DynamoFactory.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DynamoFactory = void 0;
|
|
4
|
-
const
|
|
4
|
+
const aws_sdk_1 = require("aws-sdk");
|
|
5
5
|
class DynamoFactory {
|
|
6
6
|
static createFullClient(configuration) {
|
|
7
|
-
return new
|
|
7
|
+
return new aws_sdk_1.DynamoDB(configuration !== null && configuration !== void 0 ? configuration : {});
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.DynamoFactory = DynamoFactory;
|
package/lib/DynamoServices.d.ts
CHANGED
package/lib/DynamoServices.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { IServiceModule } from '@aesop-fables/containr';
|
|
2
|
-
import { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
|
|
3
|
-
import { TranslateConfig } from '@aws-sdk/lib-dynamodb';
|
|
4
2
|
import { DynamoFactory } from './DynamoFactory';
|
|
5
3
|
import { DynamoServices } from './DynamoServices';
|
|
6
4
|
import { IDynamoOperation } from './IDynamoOperation';
|
|
7
5
|
import { DynamoService, IDynamoService } from './IDynamoService';
|
|
6
|
+
import { DynamoDB } from 'aws-sdk';
|
|
8
7
|
export { IDynamoOperation, IDynamoService, DynamoService, DynamoFactory, DynamoServices };
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
documentTranslation?: TranslateConfig;
|
|
12
|
-
}
|
|
13
|
-
export declare const useDynamo: (options: UseDynamoConfiguration) => IServiceModule;
|
|
8
|
+
export * from './resolveEnvironmentSettings';
|
|
9
|
+
export declare const useDynamo: (options: DynamoDB.Types.ClientConfiguration) => IServiceModule;
|
package/lib/index.js
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.useDynamo = exports.DynamoServices = exports.DynamoFactory = exports.DynamoService = void 0;
|
|
4
18
|
const containr_1 = require("@aesop-fables/containr");
|
|
5
|
-
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
6
19
|
const DynamoFactory_1 = require("./DynamoFactory");
|
|
7
20
|
Object.defineProperty(exports, "DynamoFactory", { enumerable: true, get: function () { return DynamoFactory_1.DynamoFactory; } });
|
|
8
21
|
const DynamoServices_1 = require("./DynamoServices");
|
|
9
22
|
Object.defineProperty(exports, "DynamoServices", { enumerable: true, get: function () { return DynamoServices_1.DynamoServices; } });
|
|
10
23
|
const IDynamoService_1 = require("./IDynamoService");
|
|
11
24
|
Object.defineProperty(exports, "DynamoService", { enumerable: true, get: function () { return IDynamoService_1.DynamoService; } });
|
|
25
|
+
const aws_sdk_1 = require("aws-sdk");
|
|
26
|
+
__exportStar(require("./resolveEnvironmentSettings"), exports);
|
|
12
27
|
exports.useDynamo = (0, containr_1.createServiceModuleWithOptions)('useDynamo', (services, options) => {
|
|
13
|
-
const client =
|
|
28
|
+
const client = new aws_sdk_1.DynamoDB(options !== null && options !== void 0 ? options : {});
|
|
14
29
|
services.register(DynamoServices_1.DynamoServices.Service, (container) => new IDynamoService_1.DynamoService(container));
|
|
15
30
|
services.register(DynamoServices_1.DynamoServices.Client, client);
|
|
16
|
-
services.register(DynamoServices_1.DynamoServices.DocClient, lib_dynamodb_1.DynamoDBDocumentClient.from(client, options === null || options === void 0 ? void 0 : options.documentTranslation));
|
|
17
31
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare type SettingsExpression<T> = {
|
|
2
|
+
/**
|
|
3
|
+
* The name of the environmental variable.
|
|
4
|
+
*/
|
|
5
|
+
variable: string;
|
|
6
|
+
/**
|
|
7
|
+
* The default value to use if the variable is undefined.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue: T;
|
|
10
|
+
};
|
|
11
|
+
declare type SettingsRegistry<Settings> = {
|
|
12
|
+
[Property in keyof Settings]: SettingsExpression<Settings[Property]>;
|
|
13
|
+
};
|
|
14
|
+
export declare function resolveEnvironmentSettings<Settings extends {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>(registry: SettingsRegistry<Settings>): Settings;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveEnvironmentSettings = void 0;
|
|
4
|
+
function resolveEnvironmentSettings(registry) {
|
|
5
|
+
const settings = {};
|
|
6
|
+
Object.entries(registry).forEach(([key, val]) => {
|
|
7
|
+
var _a;
|
|
8
|
+
const property = key;
|
|
9
|
+
const { variable, defaultValue } = val;
|
|
10
|
+
const variableValue = (_a = process.env[variable]) !== null && _a !== void 0 ? _a : defaultValue;
|
|
11
|
+
if (variableValue) {
|
|
12
|
+
settings[property] = variableValue;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return settings;
|
|
16
|
+
}
|
|
17
|
+
exports.resolveEnvironmentSettings = resolveEnvironmentSettings;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aesop-fables/containr-dynamofx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A collection of services and utilities to make DynamoDb development easier",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"exports": {
|
|
@@ -26,36 +26,32 @@
|
|
|
26
26
|
"reflect-metadata": "^0.1.13"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@aesop-fables/containr": "^0.
|
|
30
|
-
"@aws-sdk/client-dynamodb": "^3.267.0",
|
|
31
|
-
"@aws-sdk/lib-dynamodb": "^3.267.0",
|
|
29
|
+
"@aesop-fables/containr": "^0.3.4",
|
|
32
30
|
"@types/aws-lambda": "^8.10.110",
|
|
33
|
-
"@aws-sdk/
|
|
34
|
-
"
|
|
35
|
-
"aws-sdk": "^2.1311.0",
|
|
31
|
+
"@aws-sdk/types": "^3.357.0",
|
|
32
|
+
"aws-sdk": "^2.1413.0",
|
|
36
33
|
"@types/jest": "^29.2.4",
|
|
37
34
|
"@types/node": "^18.11.11",
|
|
38
35
|
"@typescript-eslint/eslint-plugin": "^5.45.1",
|
|
39
36
|
"@typescript-eslint/parser": "5.45.0",
|
|
40
|
-
"esbuild": "^0.
|
|
41
|
-
"eslint": "8.
|
|
37
|
+
"esbuild": "^0.18.11",
|
|
38
|
+
"eslint": "8.44.0",
|
|
42
39
|
"eslint-config-prettier": "^8.5.0",
|
|
43
|
-
"eslint-plugin-jest": "27.1
|
|
40
|
+
"eslint-plugin-jest": "27.2.1",
|
|
44
41
|
"eslint-plugin-prettier": "^4.2.1",
|
|
45
|
-
"jest": "29.
|
|
42
|
+
"jest": "29.5.0",
|
|
46
43
|
"jest-environment-jsdom": "^29.3.1",
|
|
47
44
|
"prettier": "^2.8.1",
|
|
48
|
-
"
|
|
45
|
+
"reflect-metadata": "^0.1.13",
|
|
46
|
+
"ts-jest": "29.1.0",
|
|
49
47
|
"typescript": "4.9.3"
|
|
50
48
|
},
|
|
51
49
|
"peerDependencies": {
|
|
52
|
-
"@aesop-fables/containr": "0.
|
|
53
|
-
"@aws-sdk/client-dynamodb": "3.x",
|
|
54
|
-
"@aws-sdk/lib-dynamodb": "3.x",
|
|
50
|
+
"@aesop-fables/containr": "0.3.x",
|
|
55
51
|
"@types/aws-lambda": "8.x",
|
|
56
|
-
"@aws-sdk/smithy-client": "3.x",
|
|
57
52
|
"@aws-sdk/types": "3.x",
|
|
58
|
-
"aws-sdk": "2.x"
|
|
53
|
+
"aws-sdk": "2.x",
|
|
54
|
+
"reflect-metadata": "0.1.x"
|
|
59
55
|
},
|
|
60
56
|
"files": [
|
|
61
57
|
"lib/**/*"
|