aws-sdk-wrap
Advanced tools
Comparing version 13.0.3 to 13.0.4
@@ -42,15 +42,18 @@ import assert from 'assert'; | ||
const getService = (service) => { | ||
const getService = (service, init = true) => { | ||
const serviceLower = service.toLowerCase(); | ||
if (servicesCache[serviceLower] === undefined) { | ||
const cacheKey = `${serviceLower}.${init}`; | ||
if (servicesCache[cacheKey] === undefined) { | ||
assert(services[serviceLower] !== undefined, `Service "${serviceLower}" not injected.`); | ||
const Service = services[serviceLower]; | ||
try { | ||
servicesCache[serviceLower] = new Service(get(configService, serviceLower, config)); | ||
servicesCache[cacheKey] = init === true | ||
? new Service(get(configService, serviceLower, config)) | ||
: Service; | ||
} catch (e) { | ||
assert(e instanceof TypeError); | ||
servicesCache[serviceLower] = Service; | ||
servicesCache[cacheKey] = Service; | ||
} | ||
} | ||
return servicesCache[serviceLower]; | ||
return servicesCache[cacheKey]; | ||
}; | ||
@@ -57,0 +60,0 @@ |
@@ -15,3 +15,3 @@ import assert from 'assert'; | ||
import UcManager from './dy/uc-manager.js'; | ||
import { ModelNotFound, ModelAlreadyExists } from '../resources/errors.js'; | ||
import { ModelAlreadyExists, ModelNotFound } from '../resources/errors.js'; | ||
@@ -40,2 +40,18 @@ export default ({ | ||
assert(typeof onCreate === 'function' && onCreate.length === 1); | ||
const DyClient = getService('DynamoDB'); | ||
const DocumentClient = getService('DynamoDBDocument', false).from(DyClient, { | ||
marshallOptions: { | ||
// Whether to automatically convert empty strings, blobs, and sets to `null`. | ||
convertEmptyValues: false, // if not false explicitly, we set it to true. | ||
// Whether to remove undefined values while marshalling. | ||
removeUndefinedValues: false, // false, by default. | ||
// Whether to convert typeof object to map attribute. | ||
convertClassInstanceToMap: false // false, by default. | ||
}, | ||
unmarshallOptions: { | ||
// Whether to return numbers as a string instead of converting them to native JavaScript numbers. | ||
// NOTE: this is required to be true in order to use the bigint data type. | ||
wrapNumbers: false // false, by default. | ||
} | ||
}); | ||
const model = createModel({ | ||
@@ -45,3 +61,3 @@ name, | ||
indices, | ||
DocumentClient: getService('DynamoDB.DocumentClient'), | ||
DocumentClient, | ||
Table, | ||
@@ -48,0 +64,0 @@ Entity |
{ | ||
"name": "aws-sdk-wrap", | ||
"type": "module", | ||
"version": "13.0.3", | ||
"version": "13.0.4", | ||
"description": "Wrapper around aws-sdk", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98198
2410