@awsless/dynamodb-server 0.0.8 → 0.0.10

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.
@@ -0,0 +1,24 @@
1
+ import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
2
+ import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
3
+
4
+ declare class DynamoDBServer {
5
+ private region;
6
+ private client?;
7
+ private documentClient?;
8
+ private endpoint;
9
+ private process;
10
+ constructor(region?: string);
11
+ listen(port: number): Promise<void>;
12
+ /** Kill the DynamoDB server. */
13
+ kill(): Promise<void>;
14
+ /** Ping the DynamoDB server if its ready. */
15
+ ping(): Promise<boolean>;
16
+ /** Ping the DynamoDB server untill its ready. */
17
+ wait(times?: number): Promise<void>;
18
+ /** Get DynamoDBClient connected to dynamodb local. */
19
+ getClient(): DynamoDBClient;
20
+ /** Get DynamoDBDocumentClient connected to dynamodb local. */
21
+ getDocumentClient(): DynamoDBDocumentClient;
22
+ }
23
+
24
+ export { DynamoDBServer };
package/dist/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -37,7 +27,7 @@ var import_client_dynamodb = require("@aws-sdk/client-dynamodb");
37
27
  var import_lib_dynamodb = require("@aws-sdk/lib-dynamodb");
38
28
  var import_url_parser = require("@aws-sdk/url-parser");
39
29
  var import_sleep_await = require("sleep-await");
40
- var import_dynamo_db_local = __toESM(require("dynamo-db-local"));
30
+ var import_dynamo_db_local = require("dynamo-db-local");
41
31
  var DynamoDBServer = class {
42
32
  constructor(region = "us-east-1") {
43
33
  this.region = region;
@@ -55,7 +45,7 @@ var DynamoDBServer = class {
55
45
  throw new RangeError(`Port should be >= 0 and < 65536. Received ${port}.`);
56
46
  }
57
47
  this.endpoint.port = port;
58
- this.process = await import_dynamo_db_local.default.spawn({ port });
48
+ this.process = await (0, import_dynamo_db_local.spawn)({ port });
59
49
  }
60
50
  /** Kill the DynamoDB server. */
61
51
  async kill() {
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { DynamoDBClient, ListTablesCommand } from "@aws-sdk/client-dynamodb";
3
3
  import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
4
4
  import { parseUrl } from "@aws-sdk/url-parser";
5
5
  import { sleepAwait } from "sleep-await";
6
- import dynamoDbLocal from "dynamo-db-local";
6
+ import { spawn } from "dynamo-db-local";
7
7
  var DynamoDBServer = class {
8
8
  constructor(region = "us-east-1") {
9
9
  this.region = region;
@@ -21,7 +21,7 @@ var DynamoDBServer = class {
21
21
  throw new RangeError(`Port should be >= 0 and < 65536. Received ${port}.`);
22
22
  }
23
23
  this.endpoint.port = port;
24
- this.process = await dynamoDbLocal.spawn({ port });
24
+ this.process = await spawn({ port });
25
25
  }
26
26
  /** Kill the DynamoDB server. */
27
27
  async kill() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/dynamodb-server",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,7 +19,7 @@
19
19
  "@aws-sdk/client-dynamodb": "3.363.0",
20
20
  "@aws-sdk/lib-dynamodb": "3.363.0",
21
21
  "@aws-sdk/url-parser": "^3.272.0",
22
- "dynamo-db-local": "^7.0.0",
22
+ "dynamo-db-local": "^9.1.1",
23
23
  "sleep-await": "^1.0.2"
24
24
  },
25
25
  "scripts": {