@webiny/api-audit-logs-ddb 0.0.0-unstable.9f53ea597d
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/AccessPatternHandler.d.ts +14 -0
- package/AccessPatternHandler.js +39 -0
- package/AccessPatternHandler.js.map +1 -0
- package/Converter.d.ts +17 -0
- package/Converter.js +49 -0
- package/Converter.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/Storage.d.ts +18 -0
- package/Storage.js +81 -0
- package/Storage.js.map +1 -0
- package/abstractions/AccessPattern.d.ts +25 -0
- package/abstractions/AccessPattern.js +0 -0
- package/abstractions/AccessPatternHandler.d.ts +13 -0
- package/abstractions/AccessPatternHandler.js +0 -0
- package/abstractions/Converter.d.ts +7 -0
- package/abstractions/Converter.js +0 -0
- package/accessPatterns/AppAccessPattern.d.ts +9 -0
- package/accessPatterns/AppAccessPattern.js +35 -0
- package/accessPatterns/AppAccessPattern.js.map +1 -0
- package/accessPatterns/AppCreatedByAccessPattern.d.ts +9 -0
- package/accessPatterns/AppCreatedByAccessPattern.js +38 -0
- package/accessPatterns/AppCreatedByAccessPattern.js.map +1 -0
- package/accessPatterns/AppEntityAccessPattern.d.ts +9 -0
- package/accessPatterns/AppEntityAccessPattern.js +35 -0
- package/accessPatterns/AppEntityAccessPattern.js.map +1 -0
- package/accessPatterns/AppEntityActionAccessPattern.d.ts +9 -0
- package/accessPatterns/AppEntityActionAccessPattern.js +35 -0
- package/accessPatterns/AppEntityActionAccessPattern.js.map +1 -0
- package/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +9 -0
- package/accessPatterns/AppEntityActionCreatedByAccessPattern.js +38 -0
- package/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +1 -0
- package/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +9 -0
- package/accessPatterns/AppEntityCreatedByAccessPattern.js +38 -0
- package/accessPatterns/AppEntityCreatedByAccessPattern.js.map +1 -0
- package/accessPatterns/BaseAccessPattern.d.ts +33 -0
- package/accessPatterns/BaseAccessPattern.js +64 -0
- package/accessPatterns/BaseAccessPattern.js.map +1 -0
- package/accessPatterns/CreatedByAccessPattern.d.ts +9 -0
- package/accessPatterns/CreatedByAccessPattern.js +38 -0
- package/accessPatterns/CreatedByAccessPattern.js.map +1 -0
- package/accessPatterns/CreatedOnAccessPattern.d.ts +9 -0
- package/accessPatterns/CreatedOnAccessPattern.js +38 -0
- package/accessPatterns/CreatedOnAccessPattern.js.map +1 -0
- package/accessPatterns/DefaultAccessPattern.d.ts +15 -0
- package/accessPatterns/DefaultAccessPattern.js +35 -0
- package/accessPatterns/DefaultAccessPattern.js.map +1 -0
- package/accessPatterns/EntityIdAccessPattern.d.ts +9 -0
- package/accessPatterns/EntityIdAccessPattern.js +38 -0
- package/accessPatterns/EntityIdAccessPattern.js.map +1 -0
- package/accessPatterns/index.d.ts +6 -0
- package/accessPatterns/index.js +57 -0
- package/accessPatterns/index.js.map +1 -0
- package/cursorSchema.d.ts +5 -0
- package/cursorSchema.js +22 -0
- package/cursorSchema.js.map +1 -0
- package/entity.d.ts +36 -0
- package/entity.js +120 -0
- package/entity.js.map +1 -0
- package/index.d.ts +7 -0
- package/index.js +16 -0
- package/index.js.map +1 -0
- package/package.json +45 -0
- package/results/ListErrorResult.d.ts +10 -0
- package/results/ListErrorResult.js +12 -0
- package/results/ListErrorResult.js.map +1 -0
- package/results/ListSuccessResult.d.ts +14 -0
- package/results/ListSuccessResult.js +17 -0
- package/results/ListSuccessResult.js.map +1 -0
- package/results/index.d.ts +2 -0
- package/results/index.js +2 -0
- package/startKey.d.ts +2 -0
- package/startKey.js +8 -0
- package/startKey.js.map +1 -0
- package/types.d.ts +36 -0
- package/types.js +0 -0
package/entity.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { createEntity, createTable } from "@webiny/db-dynamodb";
|
|
2
|
+
const createTableGSIIndexes = (count)=>{
|
|
3
|
+
const result = {};
|
|
4
|
+
for(let i = 1; i <= count; i++)result[`GSI${i}`] = {
|
|
5
|
+
partitionKey: `GSI${i}_PK`,
|
|
6
|
+
sortKey: `GSI${i}_SK`
|
|
7
|
+
};
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
10
|
+
const entity_createEntity = (params)=>{
|
|
11
|
+
const { gsiAmount, client, tableName } = params;
|
|
12
|
+
const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;
|
|
13
|
+
if (!name) throw new Error("Missing env.DB_TABLE_AUDIT_LOGS environment variable.");
|
|
14
|
+
const table = createTable({
|
|
15
|
+
documentClient: client,
|
|
16
|
+
name,
|
|
17
|
+
indexes: {
|
|
18
|
+
...createTableGSIIndexes(gsiAmount)
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const entity = createEntity({
|
|
22
|
+
name: "AuditLogs",
|
|
23
|
+
table: table.table,
|
|
24
|
+
attributes: {
|
|
25
|
+
PK: {
|
|
26
|
+
partitionKey: true
|
|
27
|
+
},
|
|
28
|
+
SK: {
|
|
29
|
+
sortKey: true
|
|
30
|
+
},
|
|
31
|
+
GSI_TENANT: {
|
|
32
|
+
type: "string",
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
GSI1_PK: {
|
|
36
|
+
type: "string",
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
GSI1_SK: {
|
|
40
|
+
type: "number",
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
GSI2_PK: {
|
|
44
|
+
type: "string",
|
|
45
|
+
required: true
|
|
46
|
+
},
|
|
47
|
+
GSI2_SK: {
|
|
48
|
+
type: "number",
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
GSI3_PK: {
|
|
52
|
+
type: "string",
|
|
53
|
+
required: true
|
|
54
|
+
},
|
|
55
|
+
GSI3_SK: {
|
|
56
|
+
type: "number",
|
|
57
|
+
required: true
|
|
58
|
+
},
|
|
59
|
+
GSI4_PK: {
|
|
60
|
+
type: "string",
|
|
61
|
+
required: true
|
|
62
|
+
},
|
|
63
|
+
GSI4_SK: {
|
|
64
|
+
type: "number",
|
|
65
|
+
required: true
|
|
66
|
+
},
|
|
67
|
+
GSI5_PK: {
|
|
68
|
+
type: "string",
|
|
69
|
+
required: true
|
|
70
|
+
},
|
|
71
|
+
GSI5_SK: {
|
|
72
|
+
type: "number",
|
|
73
|
+
required: true
|
|
74
|
+
},
|
|
75
|
+
GSI6_PK: {
|
|
76
|
+
type: "string",
|
|
77
|
+
required: true
|
|
78
|
+
},
|
|
79
|
+
GSI6_SK: {
|
|
80
|
+
type: "number",
|
|
81
|
+
required: true
|
|
82
|
+
},
|
|
83
|
+
GSI7_PK: {
|
|
84
|
+
type: "string",
|
|
85
|
+
required: true
|
|
86
|
+
},
|
|
87
|
+
GSI7_SK: {
|
|
88
|
+
type: "number",
|
|
89
|
+
required: true
|
|
90
|
+
},
|
|
91
|
+
GSI8_PK: {
|
|
92
|
+
type: "string",
|
|
93
|
+
required: true
|
|
94
|
+
},
|
|
95
|
+
GSI8_SK: {
|
|
96
|
+
type: "number",
|
|
97
|
+
required: true
|
|
98
|
+
},
|
|
99
|
+
GSI9_PK: {
|
|
100
|
+
type: "string",
|
|
101
|
+
required: true
|
|
102
|
+
},
|
|
103
|
+
GSI9_SK: {
|
|
104
|
+
type: "number",
|
|
105
|
+
required: true
|
|
106
|
+
},
|
|
107
|
+
data: {
|
|
108
|
+
type: "map",
|
|
109
|
+
required: true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
entity,
|
|
115
|
+
table
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export { entity_createEntity as createEntity };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=entity.js.map
|
package/entity.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sources":["../src/entity.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IEntity, IStandardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport { createEntity as baseCreateEntity, createTable } from \"@webiny/db-dynamodb\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IStorageAuditLog } from \"~/types.js\";\n\nexport interface IAuditLogsEntityAttributes extends Omit<\n IStandardEntityAttributes<IStorageAuditLog>,\n \"GSI1_SK\" | \"GSI2_SK\" | \"expiresAt\"\n> {\n GSI1_PK: string;\n GSI1_SK: number;\n GSI2_PK: string;\n GSI2_SK: number;\n GSI3_PK: string;\n GSI3_SK: number;\n GSI4_PK: string;\n GSI4_SK: number;\n GSI5_PK: string;\n GSI5_SK: number;\n GSI6_PK: string;\n GSI6_SK: number;\n GSI7_PK: string;\n GSI7_SK: number;\n GSI8_PK: string;\n GSI8_SK: number;\n GSI9_PK: string;\n GSI9_SK: number;\n expiresAt: number;\n}\n\nexport type AuditLogsEntity = IEntity<IAuditLogsEntityAttributes>;\n\nexport interface ICreateEntityParams {\n client: DynamoDBDocument;\n gsiAmount: number;\n tableName: string | undefined;\n}\n\nexport interface ICreateEntityResult {\n entity: AuditLogsEntity;\n table: ReturnType<typeof createTable>;\n}\n\nconst createTableGSIIndexes = (count: number) => {\n const result: GenericRecord = {};\n for (let i = 1; i <= count; i++) {\n result[`GSI${i}`] = {\n partitionKey: `GSI${i}_PK`,\n sortKey: `GSI${i}_SK`\n };\n }\n return result;\n};\n\nexport const createEntity = (params: ICreateEntityParams): ICreateEntityResult => {\n const { gsiAmount, client, tableName } = params;\n const name = tableName || process.env.DB_TABLE_AUDIT_LOGS;\n if (!name) {\n throw new Error(\"Missing env.DB_TABLE_AUDIT_LOGS environment variable.\");\n }\n const table = createTable({\n documentClient: client,\n name,\n indexes: {\n ...createTableGSIIndexes(gsiAmount)\n }\n });\n\n const entity = baseCreateEntity<IAuditLogsEntityAttributes>({\n name: \"AuditLogs\",\n table: table.table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI_TENANT: {\n type: \"string\",\n required: true\n },\n GSI1_PK: {\n type: \"string\",\n required: true\n },\n GSI1_SK: {\n type: \"number\",\n required: true\n },\n GSI2_PK: {\n type: \"string\",\n required: true\n },\n GSI2_SK: {\n type: \"number\",\n required: true\n },\n GSI3_PK: {\n type: \"string\",\n required: true\n },\n GSI3_SK: {\n type: \"number\",\n required: true\n },\n GSI4_PK: {\n type: \"string\",\n required: true\n },\n GSI4_SK: {\n type: \"number\",\n required: true\n },\n GSI5_PK: {\n type: \"string\",\n required: true\n },\n GSI5_SK: {\n type: \"number\",\n required: true\n },\n GSI6_PK: {\n type: \"string\",\n required: true\n },\n GSI6_SK: {\n type: \"number\",\n required: true\n },\n GSI7_PK: {\n type: \"string\",\n required: true\n },\n GSI7_SK: {\n type: \"number\",\n required: true\n },\n GSI8_PK: {\n type: \"string\",\n required: true\n },\n GSI8_SK: {\n type: \"number\",\n required: true\n },\n GSI9_PK: {\n type: \"string\",\n required: true\n },\n GSI9_SK: {\n type: \"number\",\n required: true\n },\n data: {\n type: \"map\",\n required: true\n }\n }\n });\n\n return {\n entity,\n table\n };\n};\n"],"names":["createTableGSIIndexes","count","result","i","createEntity","params","gsiAmount","client","tableName","name","process","Error","table","createTable","entity","baseCreateEntity"],"mappings":";AA4CA,MAAMA,wBAAwB,CAACC;IAC3B,MAAMC,SAAwB,CAAC;IAC/B,IAAK,IAAIC,IAAI,GAAGA,KAAKF,OAAOE,IACxBD,MAAM,CAAC,CAAC,GAAG,EAAEC,GAAG,CAAC,GAAG;QAChB,cAAc,CAAC,GAAG,EAAEA,EAAE,GAAG,CAAC;QAC1B,SAAS,CAAC,GAAG,EAAEA,EAAE,GAAG,CAAC;IACzB;IAEJ,OAAOD;AACX;AAEO,MAAME,sBAAe,CAACC;IACzB,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGH;IACzC,MAAMI,OAAOD,aAAaE,QAAQ,GAAG,CAAC,mBAAmB;IACzD,IAAI,CAACD,MACD,MAAM,IAAIE,MAAM;IAEpB,MAAMC,QAAQC,YAAY;QACtB,gBAAgBN;QAChBE;QACA,SAAS;YACL,GAAGT,sBAAsBM,UAAU;QACvC;IACJ;IAEA,MAAMQ,SAASC,aAA6C;QACxD,MAAM;QACN,OAAOH,MAAM,KAAK;QAClB,YAAY;YACR,IAAI;gBACA,cAAc;YAClB;YACA,IAAI;gBACA,SAAS;YACb;YACA,YAAY;gBACR,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,SAAS;gBACL,MAAM;gBACN,UAAU;YACd;YACA,MAAM;gBACF,MAAM;gBACN,UAAU;YACd;QACJ;IACJ;IAEA,OAAO;QACHE;QACAF;IACJ;AACJ"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
interface RegisterAuditLogsDdbStorageOperationsParams {
|
|
3
|
+
documentClient: DynamoDBDocument;
|
|
4
|
+
tableName?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const registerAuditLogsDdbStorageOperations: (params: RegisterAuditLogsDdbStorageOperationsParams) => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types").Context>;
|
|
7
|
+
export {};
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
2
|
+
import { createStorage } from "./Storage.js";
|
|
3
|
+
import { AuditLogsStorage } from "@webiny/api-audit-logs/abstractions.js";
|
|
4
|
+
import { CompressionHandler } from "@webiny/utils/exports/api.js";
|
|
5
|
+
const registerAuditLogsDdbStorageOperations = (params)=>createRegisterExtensionPlugin((context)=>{
|
|
6
|
+
const compressionHandler = context.container.resolve(CompressionHandler);
|
|
7
|
+
const storage = createStorage({
|
|
8
|
+
client: params.documentClient,
|
|
9
|
+
tableName: params.tableName,
|
|
10
|
+
compressionHandler
|
|
11
|
+
});
|
|
12
|
+
context.container.registerInstance(AuditLogsStorage, storage);
|
|
13
|
+
});
|
|
14
|
+
export { registerAuditLogsDdbStorageOperations };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createStorage } from \"~/Storage.js\";\nimport { AuditLogsStorage } from \"@webiny/api-audit-logs/abstractions.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\n\ninterface RegisterAuditLogsDdbStorageOperationsParams {\n documentClient: DynamoDBDocument;\n tableName?: string;\n}\n\nexport const registerAuditLogsDdbStorageOperations = (\n params: RegisterAuditLogsDdbStorageOperationsParams\n) => {\n return createRegisterExtensionPlugin(context => {\n const compressionHandler = context.container.resolve(CompressionHandler);\n const storage = createStorage({\n client: params.documentClient,\n tableName: params.tableName,\n compressionHandler\n });\n context.container.registerInstance(AuditLogsStorage, storage);\n });\n};\n"],"names":["registerAuditLogsDdbStorageOperations","params","createRegisterExtensionPlugin","context","compressionHandler","CompressionHandler","storage","createStorage","AuditLogsStorage"],"mappings":";;;;AAWO,MAAMA,wCAAwC,CACjDC,SAEOC,8BAA8BC,CAAAA;QACjC,MAAMC,qBAAqBD,QAAQ,SAAS,CAAC,OAAO,CAACE;QACrD,MAAMC,UAAUC,cAAc;YAC1B,QAAQN,OAAO,cAAc;YAC7B,WAAWA,OAAO,SAAS;YAC3BG;QACJ;QACAD,QAAQ,SAAS,CAAC,gBAAgB,CAACK,kBAAkBF;IACzD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/api-audit-logs-ddb",
|
|
3
|
+
"version": "0.0.0-unstable.9f53ea597d",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"@webiny/api-audit-logs",
|
|
7
|
+
"storage-operations",
|
|
8
|
+
"dynamodb",
|
|
9
|
+
"ddb",
|
|
10
|
+
"sau:ddb"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/webiny/webiny-js.git"
|
|
15
|
+
},
|
|
16
|
+
"description": "DynamoDB storage operations for @webiny/api-audit-logs.",
|
|
17
|
+
"author": "Webiny Ltd.",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./index.js",
|
|
21
|
+
"./*": "./*"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@webiny/api": "0.0.0-unstable.9f53ea597d",
|
|
25
|
+
"@webiny/api-audit-logs": "0.0.0-unstable.9f53ea597d",
|
|
26
|
+
"@webiny/aws-sdk": "0.0.0-unstable.9f53ea597d",
|
|
27
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.9f53ea597d",
|
|
28
|
+
"@webiny/error": "0.0.0-unstable.9f53ea597d",
|
|
29
|
+
"@webiny/handler": "0.0.0-unstable.9f53ea597d",
|
|
30
|
+
"@webiny/utils": "0.0.0-unstable.9f53ea597d",
|
|
31
|
+
"zod": "4.4.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@webiny/build-tools": "0.0.0-unstable.9f53ea597d",
|
|
35
|
+
"@webiny/project-utils": "0.0.0-unstable.9f53ea597d",
|
|
36
|
+
"rimraf": "6.1.3",
|
|
37
|
+
"typescript": "7.0.2"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"webiny": {
|
|
43
|
+
"publishFrom": "dist"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IStorageListErrorResult } from "@webiny/api-audit-logs/storage/abstractions/Storage.js";
|
|
2
|
+
export interface IListErrorResultParams {
|
|
3
|
+
error: Error;
|
|
4
|
+
}
|
|
5
|
+
export declare class ListErrorResult implements IStorageListErrorResult {
|
|
6
|
+
readonly error: Error;
|
|
7
|
+
readonly success = false;
|
|
8
|
+
private constructor();
|
|
9
|
+
static create(params: IListErrorResultParams): IStorageListErrorResult;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results/ListErrorResult.js","sources":["../../src/results/ListErrorResult.ts"],"sourcesContent":["import type { IStorageListErrorResult } from \"@webiny/api-audit-logs/storage/abstractions/Storage.js\";\n\nexport interface IListErrorResultParams {\n error: Error;\n}\n\nexport class ListErrorResult implements IStorageListErrorResult {\n public readonly error: Error;\n public readonly success = false;\n\n private constructor(params: IListErrorResultParams) {\n this.error = params.error;\n }\n\n public static create(params: IListErrorResultParams): IStorageListErrorResult {\n return new ListErrorResult(params);\n }\n}\n"],"names":["ListErrorResult","params"],"mappings":"AAMO,MAAMA;IAIT,YAAoBC,MAA8B,CAAE;aAFpC,OAAO,GAAG;QAGtB,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;IAC7B;IAEA,OAAc,OAAOA,MAA8B,EAA2B;QAC1E,OAAO,IAAID,gBAAgBC;IAC/B;AACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IStorageListSuccessResult, IStorageListSuccessResultMeta } from "@webiny/api-audit-logs/storage/abstractions/Storage.js";
|
|
2
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
+
import type { IAuditLog } from "@webiny/api-audit-logs/storage/types.js";
|
|
4
|
+
export interface IListSuccessResultParams {
|
|
5
|
+
data: IAuditLog[];
|
|
6
|
+
lastEvaluatedKey?: GenericRecord;
|
|
7
|
+
}
|
|
8
|
+
export declare class ListSuccessResult implements IStorageListSuccessResult {
|
|
9
|
+
readonly data: IAuditLog[];
|
|
10
|
+
readonly meta: IStorageListSuccessResultMeta;
|
|
11
|
+
readonly success = true;
|
|
12
|
+
protected constructor(params: IListSuccessResultParams);
|
|
13
|
+
static create(params: IListSuccessResultParams): IStorageListSuccessResult;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { encodeCursor } from "@webiny/db-dynamodb";
|
|
2
|
+
class ListSuccessResult {
|
|
3
|
+
constructor(params){
|
|
4
|
+
this.success = true;
|
|
5
|
+
this.data = params.data;
|
|
6
|
+
this.meta = {
|
|
7
|
+
after: encodeCursor(params.lastEvaluatedKey) || void 0,
|
|
8
|
+
hasMoreItems: !!params.lastEvaluatedKey
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
static create(params) {
|
|
12
|
+
return new ListSuccessResult(params);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export { ListSuccessResult };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=ListSuccessResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results/ListSuccessResult.js","sources":["../../src/results/ListSuccessResult.ts"],"sourcesContent":["import type {\n IStorageListSuccessResult,\n IStorageListSuccessResultMeta\n} from \"@webiny/api-audit-logs/storage/abstractions/Storage.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { encodeCursor } from \"@webiny/db-dynamodb\";\nimport type { IAuditLog } from \"@webiny/api-audit-logs/storage/types.js\";\n\nexport interface IListSuccessResultParams {\n data: IAuditLog[];\n lastEvaluatedKey?: GenericRecord;\n}\n\nexport class ListSuccessResult implements IStorageListSuccessResult {\n public readonly data: IAuditLog[];\n public readonly meta: IStorageListSuccessResultMeta;\n public readonly success = true;\n\n protected constructor(params: IListSuccessResultParams) {\n this.data = params.data;\n this.meta = {\n after: encodeCursor(params.lastEvaluatedKey) || undefined,\n hasMoreItems: !!params.lastEvaluatedKey\n };\n }\n\n public static create(params: IListSuccessResultParams): IStorageListSuccessResult {\n return new ListSuccessResult(params);\n }\n}\n"],"names":["ListSuccessResult","params","encodeCursor","undefined"],"mappings":";AAaO,MAAMA;IAKT,YAAsBC,MAAgC,CAAE;aAFxC,OAAO,GAAG;QAGtB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,IAAI,GAAG;YACR,OAAOC,aAAaD,OAAO,gBAAgB,KAAKE;YAChD,cAAc,CAAC,CAACF,OAAO,gBAAgB;QAC3C;IACJ;IAEA,OAAc,OAAOA,MAAgC,EAA6B;QAC9E,OAAO,IAAID,kBAAkBC;IACjC;AACJ"}
|
package/results/index.js
ADDED
package/startKey.d.ts
ADDED
package/startKey.js
ADDED
package/startKey.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startKey.js","sources":["../src/startKey.ts"],"sourcesContent":["import type { IStorageListParams } from \"@webiny/api-audit-logs/storage/abstractions/Storage.js\";\nimport { fetchCursor } from \"~/cursorSchema.js\";\n\nexport const createStartKey = (\n params: Pick<IStorageListParams, \"after\">\n): Record<string, unknown> | undefined => {\n if (!params.after) {\n return undefined;\n }\n return fetchCursor(params.after);\n};\n"],"names":["createStartKey","params","fetchCursor"],"mappings":";AAGO,MAAMA,iBAAiB,CAC1BC;IAEA,IAAI,CAACA,OAAO,KAAK,EACb;IAEJ,OAAOC,YAAYD,OAAO,KAAK;AACnC"}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IAuditLog } from "@webiny/api-audit-logs/storage/types.js";
|
|
2
|
+
export interface IStorageAuditLog extends Omit<IAuditLog, "createdOn" | "content" | "expiresAt"> {
|
|
3
|
+
expiresAt: string;
|
|
4
|
+
createdOn: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IStorageItem {
|
|
8
|
+
PK: string;
|
|
9
|
+
SK: string;
|
|
10
|
+
TYPE: string;
|
|
11
|
+
GSI_TENANT: string;
|
|
12
|
+
GSI1_PK: string;
|
|
13
|
+
GSI1_SK: number;
|
|
14
|
+
GSI2_PK: string;
|
|
15
|
+
GSI2_SK: number;
|
|
16
|
+
GSI3_PK: string;
|
|
17
|
+
GSI3_SK: number;
|
|
18
|
+
GSI4_PK: string;
|
|
19
|
+
GSI4_SK: number;
|
|
20
|
+
GSI5_PK: string;
|
|
21
|
+
GSI5_SK: number;
|
|
22
|
+
GSI6_PK: string;
|
|
23
|
+
GSI6_SK: number;
|
|
24
|
+
GSI7_PK: string;
|
|
25
|
+
GSI7_SK: number;
|
|
26
|
+
GSI8_PK: string;
|
|
27
|
+
GSI8_SK: number;
|
|
28
|
+
GSI9_PK: string;
|
|
29
|
+
GSI9_SK: number;
|
|
30
|
+
data: IStorageAuditLog;
|
|
31
|
+
expiresAt: number;
|
|
32
|
+
}
|
|
33
|
+
export interface IIndexStorageItem {
|
|
34
|
+
PK: string;
|
|
35
|
+
SK: string;
|
|
36
|
+
}
|
package/types.js
ADDED
|
File without changes
|