s3db.js 8.0.2 → 8.0.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/dist/s3db.cjs.js +12 -3
- package/dist/s3db.cjs.min.js +1 -1
- package/dist/s3db.es.js +12 -3
- package/dist/s3db.es.min.js +1 -1
- package/dist/s3db.iife.js +12 -3
- package/dist/s3db.iife.min.js +1 -1
- package/package.json +1 -1
- package/src/client.class.js +1 -1
- package/src/database.class.js +3 -1
- package/src/resource.class.js +11 -5
package/package.json
CHANGED
package/src/client.class.js
CHANGED
|
@@ -34,7 +34,7 @@ export class Client extends EventEmitter {
|
|
|
34
34
|
}) {
|
|
35
35
|
super();
|
|
36
36
|
this.verbose = verbose;
|
|
37
|
-
this.id = id ?? idGenerator();
|
|
37
|
+
this.id = id ?? idGenerator(77);
|
|
38
38
|
this.parallelism = parallelism;
|
|
39
39
|
this.config = new ConnectionString(connectionString);
|
|
40
40
|
this.httpClientOptions = {
|
package/src/database.class.js
CHANGED
|
@@ -6,13 +6,15 @@ import jsonStableStringify from "json-stable-stringify";
|
|
|
6
6
|
import Client from "./client.class.js";
|
|
7
7
|
import tryFn from "./concerns/try-fn.js";
|
|
8
8
|
import Resource from "./resource.class.js";
|
|
9
|
-
import { streamToString } from "./stream/index.js";
|
|
10
9
|
import { ResourceNotFound } from "./errors.js";
|
|
10
|
+
import { idGenerator } from "./concerns/id.js";
|
|
11
|
+
import { streamToString } from "./stream/index.js";
|
|
11
12
|
|
|
12
13
|
export class Database extends EventEmitter {
|
|
13
14
|
constructor(options) {
|
|
14
15
|
super();
|
|
15
16
|
|
|
17
|
+
this.id = idGenerator(7)
|
|
16
18
|
this.version = "1";
|
|
17
19
|
// Version is injected during build, fallback to "latest" for development
|
|
18
20
|
this.s3dbVersion = (() => {
|
package/src/resource.class.js
CHANGED
|
@@ -7,14 +7,13 @@ import { PromisePool } from "@supercharge/promise-pool";
|
|
|
7
7
|
import { chunk, cloneDeep, merge, isEmpty, isObject } from "lodash-es";
|
|
8
8
|
|
|
9
9
|
import Schema from "./schema.class.js";
|
|
10
|
-
import tryFn, { tryFnSync } from "./concerns/try-fn.js";
|
|
11
10
|
import { streamToString } from "./stream/index.js";
|
|
12
|
-
import
|
|
11
|
+
import tryFn, { tryFnSync } from "./concerns/try-fn.js";
|
|
13
12
|
import { ResourceReader, ResourceWriter } from "./stream/index.js"
|
|
14
13
|
import { getBehavior, DEFAULT_BEHAVIOR } from "./behaviors/index.js";
|
|
15
14
|
import { idGenerator as defaultIdGenerator } from "./concerns/id.js";
|
|
16
15
|
import { calculateTotalSize, calculateEffectiveLimit } from "./concerns/calculator.js";
|
|
17
|
-
import { mapAwsError } from "./errors.js";
|
|
16
|
+
import { mapAwsError, InvalidResourceItem, ResourceError, PartitionError } from "./errors.js";
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
export class Resource extends EventEmitter {
|
|
@@ -99,12 +98,19 @@ export class Resource extends EventEmitter {
|
|
|
99
98
|
*/
|
|
100
99
|
constructor(config = {}) {
|
|
101
100
|
super();
|
|
102
|
-
this._instanceId =
|
|
101
|
+
this._instanceId = defaultIdGenerator(7);
|
|
103
102
|
|
|
104
103
|
// Validate configuration
|
|
105
104
|
const validation = validateResourceConfig(config);
|
|
106
105
|
if (!validation.isValid) {
|
|
107
|
-
|
|
106
|
+
const errorDetails = validation.errors.map(err => ` • ${err}`).join('\n');
|
|
107
|
+
throw new ResourceError(
|
|
108
|
+
`Invalid Resource ${config.name || '[unnamed]'} configuration:\n${errorDetails}`,
|
|
109
|
+
{
|
|
110
|
+
resourceName: config.name,
|
|
111
|
+
validation: validation.errors,
|
|
112
|
+
}
|
|
113
|
+
);
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
// Extract configuration with defaults - all at root level
|