@aesop-fables/containr-dynamofx 0.1.0 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aesop-fables/containr-dynamofx",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "A collection of services and utilities to make DynamoDb development easier",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -23,14 +23,16 @@
23
23
  "postversion": "git push && git push --tags"
24
24
  },
25
25
  "dependencies": {
26
- "@aesop-fables/containr": "^0.2.0",
26
+ "reflect-metadata": "^0.1.13"
27
+ },
28
+ "devDependencies": {
29
+ "@aesop-fables/containr": "^0.2.1",
27
30
  "@aws-sdk/client-dynamodb": "^3.267.0",
28
31
  "@aws-sdk/lib-dynamodb": "^3.267.0",
29
32
  "@types/aws-lambda": "^8.10.110",
33
+ "@aws-sdk/smithy-client": "^3.0.0",
34
+ "@aws-sdk/types": "^3.0.0",
30
35
  "aws-sdk": "^2.1311.0",
31
- "reflect-metadata": "^0.1.13"
32
- },
33
- "devDependencies": {
34
36
  "@types/jest": "^29.2.4",
35
37
  "@types/node": "^18.11.11",
36
38
  "@typescript-eslint/eslint-plugin": "^5.45.1",
@@ -46,6 +48,15 @@
46
48
  "ts-jest": "29.0.5",
47
49
  "typescript": "4.9.3"
48
50
  },
51
+ "peerDependencies": {
52
+ "@aesop-fables/containr": "^0.2.1",
53
+ "@aws-sdk/client-dynamodb": "^3.267.0",
54
+ "@aws-sdk/lib-dynamodb": "^3.267.0",
55
+ "@types/aws-lambda": "^8.10.110",
56
+ "@aws-sdk/smithy-client": "^3.0.0",
57
+ "@aws-sdk/types": "^3.0.0",
58
+ "aws-sdk": "^2.1311.0"
59
+ },
49
60
  "files": [
50
61
  "lib/**/*"
51
62
  ]
@@ -1,4 +0,0 @@
1
- import { DynamoDB, DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
2
- export declare class DynamoFactory {
3
- static createFullClient(configuration?: DynamoDBClientConfig): DynamoDB;
4
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DynamoFactory = void 0;
4
- const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
5
- class DynamoFactory {
6
- static createFullClient(configuration) {
7
- return new client_dynamodb_1.DynamoDB(configuration !== null && configuration !== void 0 ? configuration : {});
8
- }
9
- }
10
- exports.DynamoFactory = DynamoFactory;
@@ -1,5 +0,0 @@
1
- export declare const DynamoServices: {
2
- Client: string;
3
- DocClient: string;
4
- Service: string;
5
- };
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DynamoServices = void 0;
4
- exports.DynamoServices = {
5
- Client: 'dynamoClient',
6
- DocClient: 'dynamoClient',
7
- Service: 'dynamoService',
8
- };
@@ -1,3 +0,0 @@
1
- export interface IDynamoOperation<Result = void, Params = any> {
2
- execute(params: Params): Promise<Result>;
3
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- import { IServiceContainer, Newable } from '@aesop-fables/containr';
2
- import { IDynamoOperation } from './IDynamoOperation';
3
- export interface IDynamoService {
4
- execute<Result, Params>(constructor: Newable<IDynamoOperation<Result, Params>>, params?: Params): Promise<Result>;
5
- }
6
- export declare class DynamoService implements IDynamoService {
7
- private readonly container;
8
- constructor(container: IServiceContainer);
9
- execute<Result, Params>(constructor: Newable<IDynamoOperation<Result, Params>>, params?: Params | undefined): Promise<Result>;
10
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DynamoService = void 0;
4
- class DynamoService {
5
- constructor(container) {
6
- this.container = container;
7
- }
8
- execute(constructor, params) {
9
- const operation = this.container.resolve(constructor);
10
- return operation.execute(params);
11
- }
12
- }
13
- exports.DynamoService = DynamoService;
package/lib/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { IServiceModule } from '@aesop-fables/containr';
2
- import { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
3
- import { TranslateConfig } from '@aws-sdk/lib-dynamodb';
4
- import { DynamoFactory } from './DynamoFactory';
5
- import { DynamoServices } from './DynamoServices';
6
- import { DynamoService, IDynamoService } from './IDynamoService';
7
- export { IDynamoService, DynamoService, DynamoFactory, DynamoServices };
8
- export interface UseDynamoConfiguration {
9
- core?: DynamoDBClientConfig;
10
- documentTranslation?: TranslateConfig;
11
- }
12
- export declare const useDynamo: (options: UseDynamoConfiguration) => IServiceModule;
package/lib/index.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDynamo = exports.DynamoServices = exports.DynamoFactory = exports.DynamoService = void 0;
4
- const containr_1 = require("@aesop-fables/containr");
5
- const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
6
- const DynamoFactory_1 = require("./DynamoFactory");
7
- Object.defineProperty(exports, "DynamoFactory", { enumerable: true, get: function () { return DynamoFactory_1.DynamoFactory; } });
8
- const DynamoServices_1 = require("./DynamoServices");
9
- Object.defineProperty(exports, "DynamoServices", { enumerable: true, get: function () { return DynamoServices_1.DynamoServices; } });
10
- const IDynamoService_1 = require("./IDynamoService");
11
- Object.defineProperty(exports, "DynamoService", { enumerable: true, get: function () { return IDynamoService_1.DynamoService; } });
12
- exports.useDynamo = (0, containr_1.createServiceModuleWithOptions)('useDynamo', (services, options) => {
13
- const client = DynamoFactory_1.DynamoFactory.createFullClient(options.core);
14
- services.register(DynamoServices_1.DynamoServices.Service, (container) => new IDynamoService_1.DynamoService(container));
15
- 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
- });