@certik/skynet 0.11.1 → 0.11.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.3
4
+
5
+ - Fixed: get aws credential for production
6
+
7
+ ## 0.11.2
8
+
9
+ - Fixed: updated alias option for meow
10
+
3
11
  ## 0.11.1
4
12
 
5
13
  - Fixed: missing option for meow
package/deploy.js CHANGED
@@ -497,12 +497,12 @@ ${getSelectorDesc(selector)}
497
497
  default: "delta",
498
498
  },
499
499
  from: {
500
- alias: "since",
500
+ aliases: ["since"],
501
501
  type: "number",
502
502
  default: 0,
503
503
  },
504
504
  to: {
505
- alias: "until",
505
+ aliases: ["until"],
506
506
  type: "number",
507
507
  default: 0,
508
508
  },
@@ -514,7 +514,7 @@ ${getSelectorDesc(selector)}
514
514
  default: false,
515
515
  },
516
516
  production: {
517
- alias: "prd",
517
+ aliases: ["prd"],
518
518
  type: "boolean",
519
519
  default: false,
520
520
  },
@@ -667,7 +667,7 @@ ${getSelectorDesc(selector)}
667
667
  default: false,
668
668
  },
669
669
  production: {
670
- alias: "prd",
670
+ aliases: ["prd"],
671
671
  type: "boolean",
672
672
  default: false,
673
673
  },
package/dynamodb.js CHANGED
@@ -8,29 +8,15 @@ import {
8
8
  UpdateCommand,
9
9
  } from "@aws-sdk/lib-dynamodb";
10
10
  import { DynamoDBClient, DescribeTableCommand } from "@aws-sdk/client-dynamodb";
11
- import { getAWSAccessKeyId, getAWSSecretAccessKey, getAWSRegion } from "./env.js";
11
+ import { getAWSSDKConfig } from "./env.js";
12
12
  import { wait } from "./availability.js";
13
13
 
14
14
  function getDynamoDB() {
15
- return new DynamoDBClient({
16
- credentials: {
17
- accessKeyId: getAWSAccessKeyId(),
18
- secretAccessKey: getAWSSecretAccessKey(),
19
- },
20
- region: getAWSRegion(),
21
- });
15
+ return new DynamoDBClient(getAWSSDKConfig());
22
16
  }
23
17
 
24
18
  function getDocClient() {
25
- return DynamoDBDocumentClient.from(
26
- new DynamoDBClient({
27
- credentials: {
28
- accessKeyId: getAWSAccessKeyId(),
29
- secretAccessKey: getAWSSecretAccessKey(),
30
- },
31
- region: getAWSRegion(),
32
- }),
33
- );
19
+ return DynamoDBDocumentClient.from(new DynamoDBClient(getAWSSDKConfig()));
34
20
  }
35
21
 
36
22
  function mergeQueries(q1, q2) {
package/env.js CHANGED
@@ -6,6 +6,24 @@ function getAWSSecretAccessKey() {
6
6
  return ensureAndGet(["SKYNET_AWS_SECRET_ACCESS_KEY"], undefined);
7
7
  }
8
8
 
9
+ function getAWSSDKConfig() {
10
+ const region = getAWSRegion();
11
+ const accessKeyId = getAWSAccessKeyId();
12
+ const secretAccessKey = getAWSSecretAccessKey();
13
+
14
+ if (!accessKeyId || !secretAccessKey) {
15
+ return { region };
16
+ }
17
+
18
+ return {
19
+ region,
20
+ credentials: {
21
+ accessKeyId,
22
+ secretAccessKey,
23
+ },
24
+ };
25
+ }
26
+
9
27
  function getAWSRegion() {
10
28
  return ensureAndGet(["SKYNET_AWS_REGION"], "us-east-1");
11
29
  }
@@ -56,6 +74,7 @@ export {
56
74
  getEnvOrThrow,
57
75
  getAWSAccessKeyId,
58
76
  getAWSSecretAccessKey,
77
+ getAWSSDKConfig,
59
78
  getAWSRegion,
60
79
  getEnvironment,
61
80
  isProduction,
package/indexer.js CHANGED
@@ -516,11 +516,11 @@ ${getSelectorDesc(selector)}
516
516
  default: "delta",
517
517
  },
518
518
  from: {
519
- alias: "since",
519
+ aliases: ["since"],
520
520
  type: "string",
521
521
  },
522
522
  to: {
523
- alias: "until",
523
+ aliases: ["until"],
524
524
  type: "string",
525
525
  },
526
526
  status: {
package/kafka.js CHANGED
@@ -174,12 +174,12 @@ ${getSelectorDesc(selector)}
174
174
  flags: {
175
175
  ...getSelectorFlags(selector),
176
176
  from: {
177
- alias: "since",
177
+ aliases: ["since"],
178
178
  type: "number",
179
179
  default: 0,
180
180
  },
181
181
  to: {
182
- alias: "until",
182
+ aliases: ["until"],
183
183
  type: "number",
184
184
  default: 0,
185
185
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "Skynet Shared JS library",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/s3.js CHANGED
@@ -7,16 +7,10 @@ import {
7
7
  ListObjectsV2Command,
8
8
  NotFound,
9
9
  } from "@aws-sdk/client-s3";
10
- import { getAWSAccessKeyId, getAWSSecretAccessKey, getAWSRegion } from "./env.js";
10
+ import { getAWSSDKConfig } from "./env.js";
11
11
 
12
12
  function getS3() {
13
- return new S3Client({
14
- credentials: {
15
- accessKeyId: getAWSAccessKeyId(),
16
- secretAccessKey: getAWSSecretAccessKey(),
17
- },
18
- region: getAWSRegion(),
19
- });
13
+ return new S3Client(getAWSSDKConfig());
20
14
  }
21
15
 
22
16
  async function readFile(bucketName, key, verbose = false) {
package/sqs.js CHANGED
@@ -1,10 +1,6 @@
1
- import { SQS } from "@aws-sdk/client-sqs";
2
- import { getAWSAccessKeyId, getAWSSecretAccessKey, getAWSRegion } from "./env.js";
1
+ import { SQSClient } from "@aws-sdk/client-sqs";
2
+ import { getAWSSDKConfig } from "./env.js";
3
3
 
4
4
  export function getSQS() {
5
- return new SQS({
6
- accessKeyId: getAWSAccessKeyId(),
7
- secretAccessKey: getAWSSecretAccessKey(),
8
- region: getAWSRegion(),
9
- });
5
+ return new SQSClient(getAWSSDKConfig());
10
6
  }