@webiny/db-dynamodb 0.0.0-unstable.e3f4727c56 → 0.0.0-unstable.ecd8734205
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/index.d.ts +2 -0
- package/index.js +24 -1
- package/index.js.map +1 -1
- package/package.json +9 -9
- package/types.d.ts +8 -0
- package/types.js.map +1 -1
- package/utils/createStandardEntity.d.ts +2 -0
- package/utils/createStandardEntity.js +34 -0
- package/utils/createStandardEntity.js.map +1 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -4,10 +4,33 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
DynamoDbDriver: true,
|
|
9
|
+
DbItem: true
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "DbItem", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () {
|
|
14
|
+
return _types.DbItem;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
7
17
|
Object.defineProperty(exports, "DynamoDbDriver", {
|
|
8
18
|
enumerable: true,
|
|
9
19
|
get: function () {
|
|
10
20
|
return _DynamoDbDriver.default;
|
|
11
21
|
}
|
|
12
22
|
});
|
|
13
|
-
var _DynamoDbDriver = _interopRequireDefault(require("./DynamoDbDriver"));
|
|
23
|
+
var _DynamoDbDriver = _interopRequireDefault(require("./DynamoDbDriver"));
|
|
24
|
+
var _createStandardEntity = require("./utils/createStandardEntity");
|
|
25
|
+
Object.keys(_createStandardEntity).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
+
if (key in exports && exports[key] === _createStandardEntity[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _createStandardEntity[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
var _types = require("./types");
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import { default as DynamoDbDriver } from \"./DynamoDbDriver\";\n\nexport { DynamoDbDriver };\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import { default as DynamoDbDriver } from \"./DynamoDbDriver\";\nexport * from \"./utils/createStandardEntity\";\nexport { DbItem } from \"./types\";\n\nexport { DynamoDbDriver };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/db-dynamodb",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.ecd8734205",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"author": "Webiny Ltd",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@webiny/api": "0.0.0-unstable.
|
|
14
|
-
"@webiny/db": "0.0.0-unstable.
|
|
15
|
-
"@webiny/error": "0.0.0-unstable.
|
|
16
|
-
"@webiny/handler-db": "0.0.0-unstable.
|
|
17
|
-
"@webiny/plugins": "0.0.0-unstable.
|
|
13
|
+
"@webiny/api": "0.0.0-unstable.ecd8734205",
|
|
14
|
+
"@webiny/db": "0.0.0-unstable.ecd8734205",
|
|
15
|
+
"@webiny/error": "0.0.0-unstable.ecd8734205",
|
|
16
|
+
"@webiny/handler-db": "0.0.0-unstable.ecd8734205",
|
|
17
|
+
"@webiny/plugins": "0.0.0-unstable.ecd8734205",
|
|
18
18
|
"date-fns": "2.29.3",
|
|
19
19
|
"dot-prop": "6.0.1",
|
|
20
20
|
"fuse.js": "6.6.2",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@babel/cli": "^7.19.3",
|
|
26
26
|
"@babel/core": "^7.19.3",
|
|
27
27
|
"@types/is-number": "^7.0.2",
|
|
28
|
-
"@webiny/cli": "^0.0.0-unstable.
|
|
29
|
-
"@webiny/project-utils": "^0.0.0-unstable.
|
|
28
|
+
"@webiny/cli": "^0.0.0-unstable.ecd8734205",
|
|
29
|
+
"@webiny/project-utils": "^0.0.0-unstable.ecd8734205",
|
|
30
30
|
"dynamodb-toolbox": "^0.3.5",
|
|
31
31
|
"jest": "^28.1.0",
|
|
32
32
|
"jest-dynalite": "^3.2.0",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"build": "yarn webiny run build",
|
|
43
43
|
"watch": "yarn webiny run watch"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "ecd8734205e0e21ae04076c28ff9806dad07a730"
|
|
46
46
|
}
|
package/types.d.ts
CHANGED
|
@@ -55,4 +55,12 @@ export interface QueryKey {
|
|
|
55
55
|
}
|
|
56
56
|
export declare type QueryKeys = QueryKey[];
|
|
57
57
|
export declare type QuerySort = Record<string, -1 | 1>;
|
|
58
|
+
export declare type DbItem<TData extends Record<string, any> = Record<string, any>> = {
|
|
59
|
+
PK: string;
|
|
60
|
+
SK: string;
|
|
61
|
+
GSI1_PK: string;
|
|
62
|
+
GSI1_SK: string;
|
|
63
|
+
TYPE: string;
|
|
64
|
+
data: TData;
|
|
65
|
+
};
|
|
58
66
|
export {};
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface OperatorArgs {\n expression: string;\n attributeNames: Record<string, any>;\n attributeValues: Record<string, any>;\n}\n\ninterface CanProcessArgs {\n key: string;\n value: any;\n args: OperatorArgs;\n}\n\ninterface ProcessArgs {\n key: string;\n value: any;\n args: OperatorArgs;\n processStatement: any;\n}\n\nexport interface Operator {\n canProcess: ({ key }: CanProcessArgs) => boolean;\n process: ({ key, value, args }: ProcessArgs) => void;\n}\n\n/**\n * We use this definition to search for a value in any given field that was passed.\n * It works as an \"OR\" condition.\n */\nexport interface DynamoDbContainsFilter {\n fields: string[];\n value: string;\n}\n\nexport interface ProcessStatementArgsParam {\n expression: string;\n attributeNames: Record<string, any>;\n attributeValues: Record<string, any>;\n}\nexport interface ProcessStatementQueryParam {\n [key: string]: any;\n}\nexport interface ProcessStatementParams {\n args: ProcessStatementArgsParam;\n query: ProcessStatementQueryParam;\n}\n\nexport interface ProcessStatementCallable {\n (params: ProcessStatementParams): void;\n}\n\nexport interface Query {\n [key: string]: string;\n}\nexport interface QueryKeyField {\n name: string;\n}\nexport interface QueryKey {\n fields: QueryKeyField[];\n primary?: boolean;\n unique?: boolean;\n name: string;\n}\nexport type QueryKeys = QueryKey[];\n\nexport type QuerySort = Record<string, -1 | 1>;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface OperatorArgs {\n expression: string;\n attributeNames: Record<string, any>;\n attributeValues: Record<string, any>;\n}\n\ninterface CanProcessArgs {\n key: string;\n value: any;\n args: OperatorArgs;\n}\n\ninterface ProcessArgs {\n key: string;\n value: any;\n args: OperatorArgs;\n processStatement: any;\n}\n\nexport interface Operator {\n canProcess: ({ key }: CanProcessArgs) => boolean;\n process: ({ key, value, args }: ProcessArgs) => void;\n}\n\n/**\n * We use this definition to search for a value in any given field that was passed.\n * It works as an \"OR\" condition.\n */\nexport interface DynamoDbContainsFilter {\n fields: string[];\n value: string;\n}\n\nexport interface ProcessStatementArgsParam {\n expression: string;\n attributeNames: Record<string, any>;\n attributeValues: Record<string, any>;\n}\nexport interface ProcessStatementQueryParam {\n [key: string]: any;\n}\nexport interface ProcessStatementParams {\n args: ProcessStatementArgsParam;\n query: ProcessStatementQueryParam;\n}\n\nexport interface ProcessStatementCallable {\n (params: ProcessStatementParams): void;\n}\n\nexport interface Query {\n [key: string]: string;\n}\nexport interface QueryKeyField {\n name: string;\n}\nexport interface QueryKey {\n fields: QueryKeyField[];\n primary?: boolean;\n unique?: boolean;\n name: string;\n}\nexport type QueryKeys = QueryKey[];\n\nexport type QuerySort = Record<string, -1 | 1>;\n\nexport type DbItem<TData extends Record<string, any> = Record<string, any>> = {\n PK: string;\n SK: string;\n GSI1_PK: string;\n GSI1_SK: string;\n TYPE: string;\n data: TData;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createStandardEntity = void 0;
|
|
7
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
8
|
+
const createStandardEntity = (table, name) => {
|
|
9
|
+
return new _dynamodbToolbox.Entity({
|
|
10
|
+
name,
|
|
11
|
+
table,
|
|
12
|
+
attributes: {
|
|
13
|
+
PK: {
|
|
14
|
+
partitionKey: true
|
|
15
|
+
},
|
|
16
|
+
SK: {
|
|
17
|
+
sortKey: true
|
|
18
|
+
},
|
|
19
|
+
GSI1_PK: {
|
|
20
|
+
type: "string"
|
|
21
|
+
},
|
|
22
|
+
GSI1_SK: {
|
|
23
|
+
type: "string"
|
|
24
|
+
},
|
|
25
|
+
TYPE: {
|
|
26
|
+
type: "string"
|
|
27
|
+
},
|
|
28
|
+
data: {
|
|
29
|
+
type: "map"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
exports.createStandardEntity = createStandardEntity;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createStandardEntity","table","name","Entity","attributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","data"],"sources":["createStandardEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\n\nexport const createStandardEntity = (table: Table, name: string): Entity<any> => {\n return new Entity({\n name,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA;AAEO,MAAMA,oBAAoB,GAAG,CAACC,KAAY,EAAEC,IAAY,KAAkB;EAC7E,OAAO,IAAIC,uBAAM,CAAC;IACdD,IAAI;IACJD,KAAK;IACLG,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|