@webiny/api-dynamodb-to-elasticsearch 5.43.0-beta.0 → 5.43.0-beta.2

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.
@@ -1,9 +1,10 @@
1
- import { IDecompressor, IOperations, IOperationsBuilder, IOperationsBuilderBuildParams } from "./types";
1
+ import { IOperations, IOperationsBuilder, IOperationsBuilderBuildParams } from "./types";
2
+ import { ICompressor } from "@webiny/utils/compression/Compressor";
2
3
  export interface IOperationsBuilderParams {
3
- decompressor: IDecompressor;
4
+ compressor: ICompressor;
4
5
  }
5
6
  export declare class OperationsBuilder implements IOperationsBuilder {
6
- private readonly decompressor;
7
+ private readonly compressor;
7
8
  constructor(params: IOperationsBuilderParams);
8
9
  build(params: IOperationsBuilderBuildParams): Promise<IOperations>;
9
10
  }
@@ -8,7 +8,7 @@ var _Operations = require("./Operations");
8
8
  var _marshall = require("./marshall");
9
9
  class OperationsBuilder {
10
10
  constructor(params) {
11
- this.decompressor = params.decompressor;
11
+ this.compressor = params.compressor;
12
12
  }
13
13
  async build(params) {
14
14
  const operations = new _Operations.Operations();
@@ -62,7 +62,7 @@ class OperationsBuilder {
62
62
  /**
63
63
  * We must decompress the data that is going into the Elasticsearch.
64
64
  */
65
- const data = await this.decompressor.decompress(newImage.data);
65
+ const data = await this.compressor.decompress(newImage.data);
66
66
  /**
67
67
  * No point in writing null or undefined data into the Elasticsearch.
68
68
  * This might happen on some error while decompressing. We will log it.
@@ -1 +1 @@
1
- {"version":3,"names":["_Operations","require","_marshall","OperationsBuilder","constructor","params","decompressor","build","operations","Operations","record","records","dynamodb","eventName","console","error","eventID","keys","unmarshall","Keys","PK","SK","id","OperationType","INSERT","MODIFY","newImage","NewImage","Object","length","ignore","index","log","data","decompress","undefined","insert","REMOVE","oldImage","OldImage","delete","exports"],"sources":["OperationsBuilder.ts"],"sourcesContent":["import {\n IDecompressor,\n IOperations,\n IOperationsBuilder,\n IOperationsBuilderBuildParams\n} from \"./types\";\nimport { Operations, OperationType } from \"~/Operations\";\nimport { unmarshall } from \"~/marshall\";\n\ninterface RecordDynamoDbImage {\n data: Record<string, any>;\n ignore?: boolean;\n index: string;\n}\n\ninterface RecordDynamoDbKeys {\n PK: string;\n SK: string;\n}\n\nexport interface IOperationsBuilderParams {\n decompressor: IDecompressor;\n}\n\nexport class OperationsBuilder implements IOperationsBuilder {\n private readonly decompressor: IDecompressor;\n\n public constructor(params: IOperationsBuilderParams) {\n this.decompressor = params.decompressor;\n }\n\n public async build(params: IOperationsBuilderBuildParams): Promise<IOperations> {\n const operations = new Operations();\n for (const record of params.records) {\n if (!record.dynamodb) {\n continue;\n } else if (!record.eventName) {\n console.error(\n `Could not get operation from the record, skipping event \"${record.eventID}\".`\n );\n continue;\n }\n\n const keys = unmarshall<RecordDynamoDbKeys>(record.dynamodb.Keys);\n if (!keys?.PK || !keys.SK) {\n console.error(\n `Could not get keys from the record, skipping event \"${record.eventID}\".`\n );\n continue;\n }\n\n const id = `${keys.PK}:${keys.SK}`;\n\n /**\n * On operations other than REMOVE we decompress the data and store it into the Elasticsearch.\n * No need to try to decompress if operation is REMOVE since there is no data sent into that operation.\n */\n if (\n record.eventName === OperationType.INSERT ||\n record.eventName === OperationType.MODIFY\n ) {\n const newImage = unmarshall<RecordDynamoDbImage>(record.dynamodb.NewImage);\n /**\n * If there is no newImage, silently continue to the next operation.\n */\n if (\n !newImage ||\n typeof newImage !== \"object\" ||\n Object.keys(newImage).length === 0\n ) {\n continue;\n }\n /**\n * Note that with the `REMOVE` event, there is no `NewImage` property. Which means,\n * if the `newImage` is `undefined`, we are dealing with a `REMOVE` event and we still\n * need to process it.\n */\n //\n else if (newImage.ignore === true) {\n // Nothing to log here, we are skipping the record intentionally.\n continue;\n }\n /**\n * Also, possibly there is no index?\n */\n //\n else if (!newImage.index) {\n console.error(\n `Could not get index from the new image, skipping event \"${record.eventID}\".`\n );\n console.log({ newImage });\n continue;\n }\n /**\n * We must decompress the data that is going into the Elasticsearch.\n */\n const data = await this.decompressor.decompress(newImage.data);\n /**\n * No point in writing null or undefined data into the Elasticsearch.\n * This might happen on some error while decompressing. We will log it.\n *\n * Data should NEVER be null or undefined in the Elasticsearch DynamoDB table, unless it is a delete operations.\n * If it is - it is a bug.\n */\n if (data === undefined || data === null) {\n console.error(\n `Could not get decompressed data, skipping ES operation \"${record.eventName}\", ID ${id}. Skipping...`\n );\n continue;\n }\n\n operations.insert({\n id,\n index: newImage.index,\n data\n });\n } else if (record.eventName === OperationType.REMOVE) {\n const oldImage = unmarshall<RecordDynamoDbImage>(record.dynamodb.OldImage);\n /**\n * If there is no index found, silently continue to the next operation.\n */\n if (!oldImage?.index) {\n continue;\n }\n operations.delete({\n id,\n index: oldImage.index\n });\n }\n }\n return operations;\n }\n}\n"],"mappings":";;;;;;AAMA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAiBO,MAAME,iBAAiB,CAA+B;EAGlDC,WAAWA,CAACC,MAAgC,EAAE;IACjD,IAAI,CAACC,YAAY,GAAGD,MAAM,CAACC,YAAY;EAC3C;EAEA,MAAaC,KAAKA,CAACF,MAAqC,EAAwB;IAC5E,MAAMG,UAAU,GAAG,IAAIC,sBAAU,CAAC,CAAC;IACnC,KAAK,MAAMC,MAAM,IAAIL,MAAM,CAACM,OAAO,EAAE;MACjC,IAAI,CAACD,MAAM,CAACE,QAAQ,EAAE;QAClB;MACJ,CAAC,MAAM,IAAI,CAACF,MAAM,CAACG,SAAS,EAAE;QAC1BC,OAAO,CAACC,KAAK,CACT,4DAA4DL,MAAM,CAACM,OAAO,IAC9E,CAAC;QACD;MACJ;MAEA,MAAMC,IAAI,GAAG,IAAAC,oBAAU,EAAqBR,MAAM,CAACE,QAAQ,CAACO,IAAI,CAAC;MACjE,IAAI,CAACF,IAAI,EAAEG,EAAE,IAAI,CAACH,IAAI,CAACI,EAAE,EAAE;QACvBP,OAAO,CAACC,KAAK,CACT,uDAAuDL,MAAM,C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AC;MACN,CAAC,MAAM,IAAIvB,MAAM,CAACG,SAAS,KAAKU,yBAAa,CAACc,MAAM,EAAE;QAClD,MAAMC,QAAQ,GAAG,IAAApB,oBAAU,EAAsBR,MAAM,CAACE,QAAQ,CAAC2B,QAAQ,CAAC;QAC1E;AAChB;AACA;QACgB,IAAI,CAACD,QAAQ,EAAEP,KAAK,EAAE;UAClB;QACJ;QACAvB,UAAU,CAACgC,MAAM,CAAC;UACdlB,EAAE;UACFS,KAAK,EAAEO,QAAQ,CAACP;QACpB,CAAC,CAAC;MACN;IACJ;IACA,OAAOvB,UAAU;EACrB;AACJ;AAACiC,OAAA,CAAAtC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_Operations","require","_marshall","OperationsBuilder","constructor","params","compressor","build","operations","Operations","record","records","dynamodb","eventName","console","error","eventID","keys","unmarshall","Keys","PK","SK","id","OperationType","INSERT","MODIFY","newImage","NewImage","Object","length","ignore","index","log","data","decompress","undefined","insert","REMOVE","oldImage","OldImage","delete","exports"],"sources":["OperationsBuilder.ts"],"sourcesContent":["import { IOperations, IOperationsBuilder, IOperationsBuilderBuildParams } from \"./types\";\nimport { Operations, OperationType } from \"~/Operations\";\nimport { unmarshall } from \"~/marshall\";\nimport { ICompressor } from \"@webiny/utils/compression/Compressor\";\n\ninterface RecordDynamoDbImage {\n data: {\n compression: string;\n value: string;\n };\n ignore?: boolean;\n index: string;\n}\n\ninterface RecordDynamoDbKeys {\n PK: string;\n SK: string;\n}\n\nexport interface IOperationsBuilderParams {\n compressor: ICompressor;\n}\n\nexport class OperationsBuilder implements IOperationsBuilder {\n private readonly compressor: ICompressor;\n\n public constructor(params: IOperationsBuilderParams) {\n this.compressor = params.compressor;\n }\n\n public async build(params: IOperationsBuilderBuildParams): Promise<IOperations> {\n const operations = new Operations();\n for (const record of params.records) {\n if (!record.dynamodb) {\n continue;\n } else if (!record.eventName) {\n console.error(\n `Could not get operation from the record, skipping event \"${record.eventID}\".`\n );\n continue;\n }\n\n const keys = unmarshall<RecordDynamoDbKeys>(record.dynamodb.Keys);\n if (!keys?.PK || !keys.SK) {\n console.error(\n `Could not get keys from the record, skipping event \"${record.eventID}\".`\n );\n continue;\n }\n\n const id = `${keys.PK}:${keys.SK}`;\n\n /**\n * On operations other than REMOVE we decompress the data and store it into the Elasticsearch.\n * No need to try to decompress if operation is REMOVE since there is no data sent into that operation.\n */\n if (\n record.eventName === OperationType.INSERT ||\n record.eventName === OperationType.MODIFY\n ) {\n const newImage = unmarshall<RecordDynamoDbImage>(record.dynamodb.NewImage);\n /**\n * If there is no newImage, silently continue to the next operation.\n */\n if (\n !newImage ||\n typeof newImage !== \"object\" ||\n Object.keys(newImage).length === 0\n ) {\n continue;\n }\n /**\n * Note that with the `REMOVE` event, there is no `NewImage` property. Which means,\n * if the `newImage` is `undefined`, we are dealing with a `REMOVE` event and we still\n * need to process it.\n */\n //\n else if (newImage.ignore === true) {\n // Nothing to log here, we are skipping the record intentionally.\n continue;\n }\n /**\n * Also, possibly there is no index?\n */\n //\n else if (!newImage.index) {\n console.error(\n `Could not get index from the new image, skipping event \"${record.eventID}\".`\n );\n console.log({ newImage });\n continue;\n }\n /**\n * We must decompress the data that is going into the Elasticsearch.\n */\n const data = await this.compressor.decompress(newImage.data);\n /**\n * No point in writing null or undefined data into the Elasticsearch.\n * This might happen on some error while decompressing. We will log it.\n *\n * Data should NEVER be null or undefined in the Elasticsearch DynamoDB table, unless it is a delete operations.\n * If it is - it is a bug.\n */\n if (data === undefined || data === null) {\n console.error(\n `Could not get decompressed data, skipping ES operation \"${record.eventName}\", ID ${id}. Skipping...`\n );\n continue;\n }\n\n operations.insert({\n id,\n index: newImage.index,\n data\n });\n } else if (record.eventName === OperationType.REMOVE) {\n const oldImage = unmarshall<RecordDynamoDbImage>(record.dynamodb.OldImage);\n /**\n * If there is no index found, silently continue to the next operation.\n */\n if (!oldImage?.index) {\n continue;\n }\n operations.delete({\n id,\n index: oldImage.index\n });\n }\n }\n return oper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ineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createEventHandler = void 0;
7
7
  var _handlerAws = require("@webiny/handler-aws");
8
- var _Decompressor = require("./Decompressor");
9
8
  var _OperationsBuilder = require("./OperationsBuilder");
10
9
  var _executeWithRetry = require("./executeWithRetry");
11
10
  /**
@@ -26,11 +25,8 @@ const createEventHandler = () => {
26
25
  console.error("Missing elasticsearch definition on context.");
27
26
  return null;
28
27
  }
29
- const decompressor = new _Decompressor.Decompressor({
30
- plugins: context.plugins
31
- });
32
28
  const builder = new _OperationsBuilder.OperationsBuilder({
33
- decompressor
29
+ compressor: context.compressor
34
30
  });
35
31
  const operations = await builder.build({
36
32
  records: event.Records
@@ -1 +1 @@
1
- {"version":3,"names":["_handlerAws","require","_Decompressor","_OperationsBuilder","_executeWithRetry","MAX_RUNNING_TIME","createEventHandler","createDynamoDBEventHandler","event","context","ctx","lambdaContext","timer","timerFactory","elasticsearch","console","error","decompressor","Decompressor","plugins","builder","OperationsBuilder","operations","build","records","Records","total","executeWithRetry","maxRunningTime","exports"],"sources":["eventHandler.ts"],"sourcesContent":["import { createDynamoDBEventHandler, timerFactory } from \"@webiny/handler-aws\";\nimport { Context } from \"~/types\";\nimport { Decompressor } from \"~/Decompressor\";\nimport { OperationsBuilder } from \"~/OperationsBuilder\";\nimport { executeWithRetry } from \"~/executeWithRetry\";\n\n/**\n * Also, we need to set the maximum running time for the Lambda Function.\n * https://github.com/webiny/webiny-js/blob/f7352d418da2b5ae0b781376be46785aa7ac6ae0/packages/pulumi-aws/src/apps/core/CoreOpenSearch.ts#L232\n * https://github.com/webiny/webiny-js/blob/f7352d418da2b5ae0b781376be46785aa7ac6ae0/packages/pulumi-aws/src/apps/core/CoreElasticSearch.ts#L218\n */\nconst MAX_RUNNING_TIME = 900;\n\nexport const createEventHandler = () => {\n return createDynamoDBEventHandler(async ({ event, context: ctx, lambdaContext }) => {\n const timer = timerFactory(lambdaContext);\n const context = ctx as unknown as Context;\n if (!context.elasticsearch) {\n console.error(\"Missing elasticsearch definition on context.\");\n return null;\n }\n\n const decompressor = new Decompressor({\n plugins: context.plugins\n });\n\n const builder = new OperationsBuilder({\n decompressor\n });\n\n const operations = await builder.build({\n records: event.Records\n });\n /**\n * No need to do anything if there are no operations.\n */\n if (operations.total === 0) {\n return null;\n }\n /**\n * Execute the operations with retry.\n */\n await executeWithRetry({\n timer,\n maxRunningTime: MAX_RUNNING_TIME,\n context,\n operations\n });\n\n return null;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMI,gBAAgB,GAAG,GAAG;AAErB,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACpC,OAAO,IAAAC,sCAA0B,EAAC,OAAO;IAAEC,KAAK;IAAEC,OAAO,EAAEC,GAAG;IAAEC;EAAc,CAAC,KAAK;IAChF,MAAMC,KAAK,GAAG,IAAAC,wBAAY,EAACF,aAAa,CAAC;IACzC,MAAMF,OAAO,GAAGC,GAAyB;IACzC,IAAI,CAACD,OAAO,CAACK,aAAa,EAAE;MACxBC,OAAO,CAACC,KAAK,CAAC,8CAA8C,CAAC;MAC7D,OAAO,IAAI;IACf;IAEA,MAAMC,YAAY,GAAG,IAAIC,0BAAY,CAAC;MAClCC,OAAO,EAAEV,OAAO,CAACU;IACrB,CAAC,CAAC;IAEF,MAAMC,OAAO,GAAG,IAAIC,oCAAiB,CAAC;MAClCJ;IACJ,CAAC,CAAC;IAEF,MAAMK,UAAU,GAAG,MAAMF,OAAO,CAACG,KAAK,CAAC;MACnCC,OAAO,EAAEhB,KAAK,CAACiB;IACnB,CAAC,CAAC;IACF;AACR;AACA;IACQ,IAAIH,UAAU,CAACI,KAAK,KAAK,CAAC,EAAE;MACxB,OAAO,IAAI;IACf;IACA;AACR;AACA;IACQ,MAAM,IAAAC,kCAAgB,EAAC;MACnBf,KAAK;MACLgB,cAAc,EAAEvB,gBAAgB;MAChCI,OAAO;MACPa;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAvB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_handlerAws","require","_OperationsBuilder","_executeWithRetry","MAX_RUNNING_TIME","createEventHandler","createDynamoDBEventHandler","event","context","ctx","lambdaContext","timer","timerFactory","elasticsearch","console","error","builder","OperationsBuilder","compressor","operations","build","records","Records","total","executeWithRetry","maxRunningTime","exports"],"sources":["eventHandler.ts"],"sourcesContent":["import { createDynamoDBEventHandler, timerFactory } from \"@webiny/handler-aws\";\nimport { Context } from \"~/types\";\nimport { OperationsBuilder } from \"~/OperationsBuilder\";\nimport { executeWithRetry } from \"~/executeWithRetry\";\n\n/**\n * Also, we need to set the maximum running time for the Lambda Function.\n * https://github.com/webiny/webiny-js/blob/f7352d418da2b5ae0b781376be46785aa7ac6ae0/packages/pulumi-aws/src/apps/core/CoreOpenSearch.ts#L232\n * https://github.com/webiny/webiny-js/blob/f7352d418da2b5ae0b781376be46785aa7ac6ae0/packages/pulumi-aws/src/apps/core/CoreElasticSearch.ts#L218\n */\nconst MAX_RUNNING_TIME = 900;\n\nexport const createEventHandler = () => {\n return createDynamoDBEventHandler(async ({ event, context: ctx, lambdaContext }) => {\n const timer = timerFactory(lambdaContext);\n const context = ctx as unknown as Context;\n if (!context.elasticsearch) {\n console.error(\"Missing elasticsearch definition on context.\");\n return null;\n }\n\n const builder = new OperationsBuilder({\n compressor: context.compressor\n });\n\n const operations = await builder.build({\n records: event.Records\n });\n /**\n * No need to do anything if there are no operations.\n */\n if (operations.total === 0) {\n return null;\n }\n /**\n * Execute the operations with retry.\n */\n await executeWithRetry({\n timer,\n maxRunningTime: MAX_RUNNING_TIME,\n context,\n operations\n });\n\n return null;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAG,GAAG;AAErB,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACpC,OAAO,IAAAC,sCAA0B,EAAC,OAAO;IAAEC,KAAK;IAAEC,OAAO,EAAEC,GAAG;IAAEC;EAAc,CAAC,KAAK;IAChF,MAAMC,KAAK,GAAG,IAAAC,wBAAY,EAACF,aAAa,CAAC;IACzC,MAAMF,OAAO,GAAGC,GAAyB;IACzC,IAAI,CAACD,OAAO,CAACK,aAAa,EAAE;MACxBC,OAAO,CAACC,KAAK,CAAC,8CAA8C,CAAC;MAC7D,OAAO,IAAI;IACf;IAEA,MAAMC,OAAO,GAAG,IAAIC,oCAAiB,CAAC;MAClCC,UAAU,EAAEV,OAAO,CAACU;IACxB,CAAC,CAAC;IAEF,MAAMC,UAAU,GAAG,MAAMH,OAAO,CAACI,KAAK,CAAC;MACnCC,OAAO,EAAEd,KAAK,CAACe;IACnB,CAAC,CAAC;IACF;AACR;AACA;IACQ,IAAIH,UAAU,CAACI,KAAK,KAAK,CAAC,EAAE;MACxB,OAAO,IAAI;IACf;IACA;AACR;AACA;IACQ,MAAM,IAAAC,kCAAgB,EAAC;MACnBb,KAAK;MACLc,cAAc,EAAErB,gBAAgB;MAChCI,OAAO;MACPW;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAArB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./Decompressor";
2
1
  export * from "./eventHandler";
3
2
  export * from "./execute";
4
3
  export * from "./executeWithRetry";
package/index.js CHANGED
@@ -3,17 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _Decompressor = require("./Decompressor");
7
- Object.keys(_Decompressor).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _Decompressor[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _Decompressor[key];
14
- }
15
- });
16
- });
17
6
  var _eventHandler = require("./eventHandler");
18
7
  Object.keys(_eventHandler).forEach(function (key) {
19
8
  if (key === "default" || key === "__esModule") return;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_Decompressor","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_eventHandler","_execute","_executeWithRetry","_marshall","_NotEnoughRemainingTimeError","_Operations","_OperationsBuilder","_SynchronizationBuilder","_types"],"sources":["index.ts"],"sourcesContent":["export * from \"./Decompressor\";\nexport * from \"./eventHandler\";\nexport * from \"./execute\";\nexport * from \"./executeWithRetry\";\nexport * from \"./marshall\";\nexport * from \"./NotEnoughRemainingTimeError\";\nexport * from \"./Operations\";\nexport * from \"./OperationsBuilder\";\nexport * from \"./SynchronizationBuilder\";\nexport * from \"./types\";\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,aAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,aAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD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AAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAY,uBAAA,CAAAZ,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,uBAAA,CAAAZ,GAAA;IAAA;EAAA;AAAA;AACA,IAAAa,MAAA,GAAAjB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAe,MAAA,EAAAd,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAa,MAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,MAAA,CAAAb,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_eventHandler","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_execute","_executeWithRetry","_marshall","_NotEnoughRemainingTimeError","_Operations","_OperationsBuilder","_SynchronizationBuilder","_types"],"sources":["index.ts"],"sourcesContent":["export * from \"./eventHandler\";\nexport * from \"./execute\";\nexport * from \"./executeWithRetry\";\nexport * from \"./marshall\";\nexport * from \"./NotEnoughRemainingTimeError\";\nexport * from \"./Operations\";\nexport * from \"./OperationsBuilder\";\nexport * from \"./SynchronizationBuilder\";\nexport * from \"./types\";\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,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AA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,uBAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,uBAAA,CAAAX,GAAA;IAAA;EAAA;AAAA;AACA,IAAAY,MAAA,GAAAhB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAc,MAAA,EAAAb,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAY,MAAA,CAAAZ,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,MAAA,CAAAZ,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-dynamodb-to-elasticsearch",
3
- "version": "5.43.0-beta.0",
3
+ "version": "5.43.0-beta.2",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,18 +11,19 @@
11
11
  "license": "MIT",
12
12
  "author": "Webiny Ltd.",
13
13
  "dependencies": {
14
- "@webiny/api": "5.43.0-beta.0",
15
- "@webiny/api-elasticsearch": "5.43.0-beta.0",
16
- "@webiny/api-log": "5.43.0-beta.0",
17
- "@webiny/aws-sdk": "5.43.0-beta.0",
18
- "@webiny/error": "5.43.0-beta.0",
19
- "@webiny/handler-aws": "5.43.0-beta.0",
14
+ "@webiny/api": "5.43.0-beta.2",
15
+ "@webiny/api-elasticsearch": "5.43.0-beta.2",
16
+ "@webiny/api-log": "5.43.0-beta.2",
17
+ "@webiny/aws-sdk": "5.43.0-beta.2",
18
+ "@webiny/error": "5.43.0-beta.2",
19
+ "@webiny/handler-aws": "5.43.0-beta.2",
20
+ "@webiny/utils": "5.43.0-beta.2",
20
21
  "p-retry": "4.6.2"
21
22
  },
22
23
  "devDependencies": {
23
- "@webiny/plugins": "5.43.0-beta.0",
24
- "@webiny/project-utils": "5.43.0-beta.0",
25
- "typescript": "4.9.5"
24
+ "@webiny/plugins": "5.43.0-beta.2",
25
+ "@webiny/project-utils": "5.43.0-beta.2",
26
+ "typescript": "5.3.3"
26
27
  },
27
28
  "publishConfig": {
28
29
  "access": "public",
@@ -37,5 +38,5 @@
37
38
  "__tests__"
38
39
  ]
39
40
  },
40
- "gitHead": "abfb4ec7b4391f2414cd22f2c5539c84b6c8abbf"
41
+ "gitHead": "dbed8c263df662358aca18c3cf452cd280f2dfd9"
41
42
  }
package/types.d.ts CHANGED
@@ -26,8 +26,5 @@ export interface IOperations {
26
26
  modify(params: IModifyOperationParams): void;
27
27
  delete(params: IDeleteOperationParams): void;
28
28
  }
29
- export interface IDecompressor {
30
- decompress(data: GenericRecord): Promise<GenericRecord | null>;
31
- }
32
29
  export interface Context extends ElasticsearchContext, Pick<LoggerContext, "logger"> {
33
30
  }
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { GenericRecord } from \"@webiny/api/types\";\nimport { DynamoDBRecord } from \"@webiny/handler-aws/types\";\nimport { ElasticsearchContext } from \"@webiny/api-elasticsearch/types\";\nimport { Context as LoggerContext } from \"@webiny/api-log/types\";\n\nexport interface IOperationsBuilderBuildParams {\n records: DynamoDBRecord[];\n}\n\nexport interface IOperationsBuilder {\n build(params: IOperationsBuilderBuildParams): Promise<IOperations>;\n}\n\nexport interface IInsertOperationParams {\n id: string;\n index: string;\n data: GenericRecord;\n}\n\nexport type IModifyOperationParams = IInsertOperationParams;\n\nexport interface IDeleteOperationParams {\n id: string;\n index: string;\n}\n\nexport interface IOperations {\n items: GenericRecord[];\n total: number;\n clear(): void;\n insert(params: IInsertOperationParams): void;\n modify(params: IModifyOperationParams): void;\n delete(params: IDeleteOperationParams): void;\n}\n\nexport interface IDecompressor {\n decompress(data: GenericRecord): Promise<GenericRecord | null>;\n}\n\nexport interface Context extends ElasticsearchContext, Pick<LoggerContext, \"logger\"> {}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { GenericRecord } from \"@webiny/api/types\";\nimport { DynamoDBRecord } from \"@webiny/handler-aws/types\";\nimport { ElasticsearchContext } from \"@webiny/api-elasticsearch/types\";\nimport { Context as LoggerContext } from \"@webiny/api-log/types\";\n\nexport interface IOperationsBuilderBuildParams {\n records: DynamoDBRecord[];\n}\n\nexport interface IOperationsBuilder {\n build(params: IOperationsBuilderBuildParams): Promise<IOperations>;\n}\n\nexport interface IInsertOperationParams {\n id: string;\n index: string;\n data: GenericRecord;\n}\n\nexport type IModifyOperationParams = IInsertOperationParams;\n\nexport interface IDeleteOperationParams {\n id: string;\n index: string;\n}\n\nexport interface IOperations {\n items: GenericRecord[];\n total: number;\n clear(): void;\n insert(params: IInsertOperationParams): void;\n modify(params: IModifyOperationParams): void;\n delete(params: IDeleteOperationParams): void;\n}\n\nexport interface Context extends ElasticsearchContext, Pick<LoggerContext, \"logger\"> {}\n"],"mappings":"","ignoreList":[]}
package/Decompressor.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { IDecompressor } from "./types";
2
- import { GenericRecord } from "@webiny/api/types";
3
- import { PluginsContainer } from "@webiny/plugins";
4
- export interface IDecompressorParams {
5
- plugins: PluginsContainer;
6
- }
7
- export declare class Decompressor implements IDecompressor {
8
- private readonly plugins;
9
- constructor(params: IDecompressorParams);
10
- decompress(data: GenericRecord): Promise<GenericRecord | null>;
11
- }
package/Decompressor.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Decompressor = void 0;
7
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
8
- class Decompressor {
9
- constructor(params) {
10
- this.plugins = params.plugins;
11
- }
12
- async decompress(data) {
13
- try {
14
- return await (0, _apiElasticsearch.decompress)(this.plugins, data);
15
- } catch (ex) {
16
- return null;
17
- }
18
- }
19
- }
20
- exports.Decompressor = Decompressor;
21
-
22
- //# sourceMappingURL=Decompressor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_apiElasticsearch","require","Decompressor","constructor","params","plugins","decompress","data","ex","exports"],"sources":["Decompressor.ts"],"sourcesContent":["import { IDecompressor } from \"./types\";\nimport { decompress } from \"@webiny/api-elasticsearch\";\nimport { GenericRecord } from \"@webiny/api/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface IDecompressorParams {\n plugins: PluginsContainer;\n}\n\nexport class Decompressor implements IDecompressor {\n private readonly plugins: PluginsContainer;\n\n public constructor(params: IDecompressorParams) {\n this.plugins = params.plugins;\n }\n\n public async decompress(data: GenericRecord): Promise<GenericRecord | null> {\n try {\n return await decompress(this.plugins, data);\n } catch (ex) {\n return null;\n }\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAQO,MAAMC,YAAY,CAA0B;EAGxCC,WAAWA,CAACC,MAA2B,EAAE;IAC5C,IAAI,CAACC,OAAO,GAAGD,MAAM,CAACC,OAAO;EACjC;EAEA,MAAaC,UAAUA,CAACC,IAAmB,EAAiC;IACxE,IAAI;MACA,OAAO,MAAM,IAAAD,4BAAU,EAAC,IAAI,CAACD,OAAO,EAAEE,IAAI,CAAC;IAC/C,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,OAAO,IAAI;IACf;EACJ;AACJ;AAACC,OAAA,CAAAP,YAAA,GAAAA,YAAA","ignoreList":[]}