@webiny/api-audit-logs 6.4.5 → 6.6.0-alpha.0
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/AuditLogsFeature.d.ts +8 -0
- package/AuditLogsFeature.js +43 -0
- package/AuditLogsFeature.js.map +1 -0
- package/abstractions.d.ts +8 -3
- package/abstractions.js +2 -1
- package/abstractions.js.map +1 -1
- package/context/AuditLogsContextValue.js +5 -3
- package/context/AuditLogsContextValue.js.map +1 -1
- package/graphql/AuditLogsGraphQLSchema.d.ts +9 -0
- package/graphql/AuditLogsGraphQLSchema.js +134 -0
- package/graphql/AuditLogsGraphQLSchema.js.map +1 -0
- package/index.d.ts +2 -8
- package/index.js +1 -25
- package/package.json +23 -23
- package/storage/types.d.ts +0 -35
- package/types.d.ts +1 -2
- package/utils/getAuditConfig.js +4 -2
- package/utils/getAuditConfig.js.map +1 -1
- package/context/index.d.ts +0 -9
- package/context/index.js +0 -31
- package/context/index.js.map +0 -1
- package/graphql/schema.d.ts +0 -3
- package/graphql/schema.js +0 -115
- package/graphql/schema.js.map +0 -1
- package/index.js.map +0 -1
- package/storage/AccessPatternHandler.d.ts +0 -14
- package/storage/AccessPatternHandler.js +0 -39
- package/storage/AccessPatternHandler.js.map +0 -1
- package/storage/Converter.d.ts +0 -16
- package/storage/Converter.js +0 -49
- package/storage/Converter.js.map +0 -1
- package/storage/Storage.d.ts +0 -18
- package/storage/Storage.js +0 -81
- package/storage/Storage.js.map +0 -1
- package/storage/abstractions/AccessPattern.d.ts +0 -24
- package/storage/abstractions/AccessPattern.js +0 -0
- package/storage/abstractions/AccessPatternHandler.d.ts +0 -13
- package/storage/abstractions/AccessPatternHandler.js +0 -0
- package/storage/abstractions/Converter.d.ts +0 -6
- package/storage/abstractions/Converter.js +0 -0
- package/storage/accessPatterns/AppAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppAccessPattern.js +0 -35
- package/storage/accessPatterns/AppAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppCreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/AppCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityAccessPattern.js +0 -35
- package/storage/accessPatterns/AppEntityAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionAccessPattern.js +0 -35
- package/storage/accessPatterns/AppEntityActionAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/AppEntityActionCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/AppEntityCreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/BaseAccessPattern.d.ts +0 -32
- package/storage/accessPatterns/BaseAccessPattern.js +0 -60
- package/storage/accessPatterns/BaseAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedByAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedByAccessPattern.js +0 -38
- package/storage/accessPatterns/CreatedByAccessPattern.js.map +0 -1
- package/storage/accessPatterns/CreatedOnAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/CreatedOnAccessPattern.js +0 -38
- package/storage/accessPatterns/CreatedOnAccessPattern.js.map +0 -1
- package/storage/accessPatterns/DefaultAccessPattern.d.ts +0 -15
- package/storage/accessPatterns/DefaultAccessPattern.js +0 -35
- package/storage/accessPatterns/DefaultAccessPattern.js.map +0 -1
- package/storage/accessPatterns/EntityIdAccessPattern.d.ts +0 -9
- package/storage/accessPatterns/EntityIdAccessPattern.js +0 -38
- package/storage/accessPatterns/EntityIdAccessPattern.js.map +0 -1
- package/storage/accessPatterns/index.d.ts +0 -6
- package/storage/accessPatterns/index.js +0 -57
- package/storage/accessPatterns/index.js.map +0 -1
- package/storage/cursorSchema.d.ts +0 -4
- package/storage/cursorSchema.js +0 -22
- package/storage/cursorSchema.js.map +0 -1
- package/storage/entity.d.ts +0 -36
- package/storage/entity.js +0 -120
- package/storage/entity.js.map +0 -1
- package/storage/results/ListErrorResult.d.ts +0 -10
- package/storage/results/ListErrorResult.js +0 -12
- package/storage/results/ListErrorResult.js.map +0 -1
- package/storage/results/ListSuccessResult.d.ts +0 -14
- package/storage/results/ListSuccessResult.js +0 -17
- package/storage/results/ListSuccessResult.js.map +0 -1
- package/storage/results/index.d.ts +0 -2
- package/storage/results/index.js +0 -2
- package/storage/startKey.d.ts +0 -6
- package/storage/startKey.js +0 -8
- package/storage/startKey.js.map +0 -1
package/storage/entity.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
-
import type { IEntity, IStandardEntityAttributes } from "@webiny/db-dynamodb";
|
|
3
|
-
import { createTable } from "@webiny/db-dynamodb";
|
|
4
|
-
import type { IStorageAuditLog } from "../storage/types.js";
|
|
5
|
-
export interface IAuditLogsEntityAttributes extends Omit<IStandardEntityAttributes<IStorageAuditLog>, "GSI1_SK" | "GSI2_SK" | "expiresAt"> {
|
|
6
|
-
GSI1_PK: string;
|
|
7
|
-
GSI1_SK: number;
|
|
8
|
-
GSI2_PK: string;
|
|
9
|
-
GSI2_SK: number;
|
|
10
|
-
GSI3_PK: string;
|
|
11
|
-
GSI3_SK: number;
|
|
12
|
-
GSI4_PK: string;
|
|
13
|
-
GSI4_SK: number;
|
|
14
|
-
GSI5_PK: string;
|
|
15
|
-
GSI5_SK: number;
|
|
16
|
-
GSI6_PK: string;
|
|
17
|
-
GSI6_SK: number;
|
|
18
|
-
GSI7_PK: string;
|
|
19
|
-
GSI7_SK: number;
|
|
20
|
-
GSI8_PK: string;
|
|
21
|
-
GSI8_SK: number;
|
|
22
|
-
GSI9_PK: string;
|
|
23
|
-
GSI9_SK: number;
|
|
24
|
-
expiresAt: number;
|
|
25
|
-
}
|
|
26
|
-
export type AuditLogsEntity = IEntity<IAuditLogsEntityAttributes>;
|
|
27
|
-
export interface ICreateEntityParams {
|
|
28
|
-
client: DynamoDBDocument;
|
|
29
|
-
gsiAmount: number;
|
|
30
|
-
tableName: string | undefined;
|
|
31
|
-
}
|
|
32
|
-
export interface ICreateEntityResult {
|
|
33
|
-
entity: AuditLogsEntity;
|
|
34
|
-
table: ReturnType<typeof createTable>;
|
|
35
|
-
}
|
|
36
|
-
export declare const createEntity: (params: ICreateEntityParams) => ICreateEntityResult;
|
package/storage/entity.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
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/storage/entity.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage/entity.js","sources":["../../src/storage/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 \"~/storage/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"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IStorageListErrorResult } from "../../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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage/results/ListErrorResult.js","sources":["../../../src/storage/results/ListErrorResult.ts"],"sourcesContent":["import type { IStorageListErrorResult } from \"~/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"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IStorageListSuccessResult, IStorageListSuccessResultMeta } from "../../storage/abstractions/Storage.js";
|
|
2
|
-
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
-
import type { IAuditLog } from "../../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
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage/results/ListSuccessResult.js","sources":["../../../src/storage/results/ListSuccessResult.ts"],"sourcesContent":["import type {\n IStorageListSuccessResult,\n IStorageListSuccessResultMeta\n} from \"~/storage/abstractions/Storage.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { encodeCursor } from \"@webiny/db-dynamodb\";\nimport type { IAuditLog } from \"~/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/storage/results/index.js
DELETED
package/storage/startKey.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IStorageListParams } from "../storage/abstractions/Storage.js";
|
|
2
|
-
export interface ICreateStartKeyResult {
|
|
3
|
-
PK: string;
|
|
4
|
-
SK: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const createStartKey: (params: Pick<IStorageListParams, "after">) => ICreateStartKeyResult | undefined;
|
package/storage/startKey.js
DELETED
package/storage/startKey.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage/startKey.js","sources":["../../src/storage/startKey.ts"],"sourcesContent":["import type { IStorageListParams } from \"~/storage/abstractions/Storage.js\";\nimport { fetchCursor } from \"~/storage/cursorSchema.js\";\n\nexport interface ICreateStartKeyResult {\n PK: string;\n SK: string;\n}\n\nexport const createStartKey = (\n params: Pick<IStorageListParams, \"after\">\n): ICreateStartKeyResult | undefined => {\n if (!params.after) {\n return undefined;\n }\n return fetchCursor(params.after);\n};\n"],"names":["createStartKey","params","fetchCursor"],"mappings":";AAQO,MAAMA,iBAAiB,CAC1BC;IAEA,IAAI,CAACA,OAAO,KAAK,EACb;IAEJ,OAAOC,YAAYD,OAAO,KAAK;AACnC"}
|