@ttoss/lambda-postgres-query 0.2.4 → 0.2.6

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.
@@ -1,7 +1,7 @@
1
1
  import { CloudFormationTemplate } from '@ttoss/cloudformation';
2
2
  export { CloudFormationTemplate } from '@ttoss/cloudformation';
3
3
  import { Handler } from 'aws-lambda';
4
- import { QueryParams } from '../index.cjs';
4
+ import { QueryParams } from '../index.mjs';
5
5
  import 'pg';
6
6
 
7
7
  declare const HANDLER_DEFAULT = "handler.handler";
package/dist/esm/index.js CHANGED
@@ -7,15 +7,12 @@ var asciiDecoder = new TextDecoder("ascii");
7
7
  var query = async params => {
8
8
  try {
9
9
  const {
10
- readOnly,
11
- lambdaPostgresQueryFunction,
10
+ readOnly = true,
11
+ // eslint-disable-next-line turbo/no-undeclared-env-vars
12
+ lambdaPostgresQueryFunction = process.env.LAMBDA_POSTGRES_QUERY_FUNCTION,
12
13
  ...pgParams
13
14
  } = typeof params === "string" ? {
14
- text: params,
15
- readOnly: true,
16
- lambdaPostgresQueryFunction:
17
- // eslint-disable-next-line turbo/no-undeclared-env-vars
18
- process.env.LAMBDA_POSTGRES_QUERY_FUNCTION
15
+ text: params
19
16
  } : params;
20
17
  const input = {
21
18
  FunctionName: lambdaPostgresQueryFunction,
package/dist/index.js CHANGED
@@ -38,15 +38,12 @@ var asciiDecoder = new TextDecoder("ascii");
38
38
  var query = async params => {
39
39
  try {
40
40
  const {
41
- readOnly,
42
- lambdaPostgresQueryFunction,
41
+ readOnly = true,
42
+ // eslint-disable-next-line turbo/no-undeclared-env-vars
43
+ lambdaPostgresQueryFunction = process.env.LAMBDA_POSTGRES_QUERY_FUNCTION,
43
44
  ...pgParams
44
45
  } = typeof params === "string" ? {
45
- text: params,
46
- readOnly: true,
47
- lambdaPostgresQueryFunction:
48
- // eslint-disable-next-line turbo/no-undeclared-env-vars
49
- process.env.LAMBDA_POSTGRES_QUERY_FUNCTION
46
+ text: params
50
47
  } : params;
51
48
  const input = {
52
49
  FunctionName: lambdaPostgresQueryFunction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/lambda-postgres-query",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Create a Lambda function that queries a PostgreSQL database.",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -11,7 +11,7 @@
11
11
  "url": "https://github.com/ttoss/ttoss.git",
12
12
  "directory": "packages/lambda-postgres-query"
13
13
  },
14
- "type": "module",
14
+ "type": "commonjs",
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": "./dist/esm/index.js",
package/src/query.ts CHANGED
@@ -25,16 +25,16 @@ export const query = async <Rows extends QueryResultRow = any>(
25
25
  params: QueryParams | string
26
26
  ) => {
27
27
  try {
28
- const { readOnly, lambdaPostgresQueryFunction, ...pgParams } =
29
- typeof params === 'string'
30
- ? {
31
- text: params,
32
- readOnly: true,
33
- lambdaPostgresQueryFunction:
34
- // eslint-disable-next-line turbo/no-undeclared-env-vars
35
- process.env.LAMBDA_POSTGRES_QUERY_FUNCTION,
36
- }
37
- : params;
28
+ const {
29
+ readOnly = true,
30
+ // eslint-disable-next-line turbo/no-undeclared-env-vars
31
+ lambdaPostgresQueryFunction = process.env.LAMBDA_POSTGRES_QUERY_FUNCTION,
32
+ ...pgParams
33
+ } = typeof params === 'string'
34
+ ? {
35
+ text: params,
36
+ }
37
+ : params;
38
38
 
39
39
  const input: InvokeCommandInput = {
40
40
  FunctionName: lambdaPostgresQueryFunction,
File without changes