@infrascan/s3-connector 0.2.1 → 0.3.1

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/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { S3Client, PutObjectCommandOutput } from '@aws-sdk/client-s3';
2
+ import { Connector } from '@infrascan/shared-types';
2
3
  import Cache from './cache.mjs';
3
4
 
4
5
  interface ConstructorArgs {
@@ -7,7 +8,7 @@ interface ConstructorArgs {
7
8
  bucket: string;
8
9
  cacheLimit?: number;
9
10
  }
10
- declare class S3Connector {
11
+ declare class S3Connector implements Connector {
11
12
  S3: S3Client;
12
13
  prefix: string;
13
14
  bucket: string;
@@ -23,7 +24,7 @@ declare class S3Connector {
23
24
  * - /Lambda-listFunctions/1234567890/us-east-1.json can be listed by function which allows for cross account resolution
24
25
  */
25
26
  buildFilePathForServiceCall(account: string, region: string, service: string, functionName: string): string;
26
- onServiceScanCompleteCallback(account: string, region: string, service: string, functionName: string, functionState: any): Promise<PutObjectCommandOutput>;
27
+ onServiceScanCompleteCallback(account: string, region: string, service: string, functionName: string, functionState: any): Promise<void>;
27
28
  resolveStateForServiceFunction(account: string, region: string, service: string, functionCall: string): Promise<any>;
28
29
  listObjectsForService(service: string, functionCall: string): Promise<Array<string>>;
29
30
  getGlobalStateForServiceFunction(service: string, functionCall: string): Promise<Array<any | undefined>>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { S3Client, PutObjectCommandOutput } from '@aws-sdk/client-s3';
2
+ import { Connector } from '@infrascan/shared-types';
2
3
  import Cache from './cache.js';
3
4
 
4
5
  interface ConstructorArgs {
@@ -7,7 +8,7 @@ interface ConstructorArgs {
7
8
  bucket: string;
8
9
  cacheLimit?: number;
9
10
  }
10
- declare class S3Connector {
11
+ declare class S3Connector implements Connector {
11
12
  S3: S3Client;
12
13
  prefix: string;
13
14
  bucket: string;
@@ -23,7 +24,7 @@ declare class S3Connector {
23
24
  * - /Lambda-listFunctions/1234567890/us-east-1.json can be listed by function which allows for cross account resolution
24
25
  */
25
26
  buildFilePathForServiceCall(account: string, region: string, service: string, functionName: string): string;
26
- onServiceScanCompleteCallback(account: string, region: string, service: string, functionName: string, functionState: any): Promise<PutObjectCommandOutput>;
27
+ onServiceScanCompleteCallback(account: string, region: string, service: string, functionName: string, functionState: any): Promise<void>;
27
28
  resolveStateForServiceFunction(account: string, region: string, service: string, functionCall: string): Promise<any>;
28
29
  listObjectsForService(service: string, functionCall: string): Promise<Array<string>>;
29
30
  getGlobalStateForServiceFunction(service: string, functionCall: string): Promise<Array<any | undefined>>;
package/dist/index.js CHANGED
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  default: () => S3Connector
24
24
  });
25
- module.exports = __toCommonJS(src_exports);
25
+ module.exports = __toCommonJS(index_exports);
26
26
  var import_client_s3 = require("@aws-sdk/client-s3");
27
27
 
28
28
  // src/cache.ts
@@ -95,14 +95,14 @@ var S3Connector = class {
95
95
  buildFilePathForServiceCall(account, region, service, functionName) {
96
96
  return `${this.prefix}/${service}-${functionName}/${account}/${region}.json`;
97
97
  }
98
- onServiceScanCompleteCallback(account, region, service, functionName, functionState) {
98
+ async onServiceScanCompleteCallback(account, region, service, functionName, functionState) {
99
99
  const filePath = this.buildFilePathForServiceCall(
100
100
  account,
101
101
  region,
102
102
  service,
103
103
  functionName
104
104
  );
105
- return this.recordServiceCall(filePath, functionState);
105
+ await this.recordServiceCall(filePath, functionState);
106
106
  }
107
107
  resolveStateForServiceFunction(account, region, service, functionCall) {
108
108
  const filePath = this.buildFilePathForServiceCall(
package/dist/index.mjs CHANGED
@@ -75,14 +75,14 @@ var S3Connector = class {
75
75
  buildFilePathForServiceCall(account, region, service, functionName) {
76
76
  return `${this.prefix}/${service}-${functionName}/${account}/${region}.json`;
77
77
  }
78
- onServiceScanCompleteCallback(account, region, service, functionName, functionState) {
78
+ async onServiceScanCompleteCallback(account, region, service, functionName, functionState) {
79
79
  const filePath = this.buildFilePathForServiceCall(
80
80
  account,
81
81
  region,
82
82
  service,
83
83
  functionName
84
84
  );
85
- return this.recordServiceCall(filePath, functionState);
85
+ await this.recordServiceCall(filePath, functionState);
86
86
  }
87
87
  resolveStateForServiceFunction(account, region, service, functionCall) {
88
88
  const filePath = this.buildFilePathForServiceCall(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrascan/s3-connector",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Connector for the Infrascan SDK to read and write state to an S3 bucket",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -8,8 +8,7 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "require": "./dist/index.js",
11
- "import": "./dist/index.mjs",
12
- "types": "./dist/index.d.ts"
11
+ "import": "./dist/index.mjs"
13
12
  }
14
13
  },
15
14
  "files": [
@@ -33,12 +32,12 @@
33
32
  "license": "MPL-2.0",
34
33
  "devDependencies": {
35
34
  "@aws-sdk/util-stream-node": "^3.374.0",
36
- "@infrascan/shared-types": "^0.5.1",
35
+ "@infrascan/shared-types": "^0.6.2",
37
36
  "aws-sdk-client-mock": "^3.0.0",
38
37
  "eslint-config-custom": "*",
39
- "tap": "^18.7.0",
38
+ "tap": "^21",
40
39
  "tsconfig": "*",
41
- "typescript": "^5.1.6"
40
+ "typescript": "^5.4.5"
42
41
  },
43
42
  "dependencies": {
44
43
  "@aws-sdk/client-s3": "3.624.0",