@webiny/api-dynamodb-to-elasticsearch 6.1.0 → 6.2.0-beta.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.
@@ -1,7 +1,7 @@
1
1
  import type { IOperations, IOperationsBuilder, IOperationsBuilderBuildParams } from "./types.js";
2
- import type { ICompressor } from "@webiny/utils/compression/Compressor.js";
2
+ import type { CompressionHandler } from "@webiny/utils/exports/api.js";
3
3
  export interface IOperationsBuilderParams {
4
- compressor: ICompressor;
4
+ compressor: CompressionHandler.Interface;
5
5
  }
6
6
  export declare class OperationsBuilder implements IOperationsBuilder {
7
7
  private readonly compressor;
@@ -1 +1 @@
1
- {"version":3,"names":["Operations","OperationType","unmarshall","OperationsBuilder","constructor","params","compressor","build","operations","record","records","dynamodb","eventName","console","error","eventID","keys","Keys","PK","SK","id","INSERT","MODIFY","newImage","NewImage","Object","length","ignore","index","log","data","decompress","undefined","insert","REMOVE","oldImage","OldImage","delete"],"sources":["OperationsBuilder.ts"],"sourcesContent":["import type { IOperations, IOperationsBuilder, IOperationsBuilderBuildParams } from \"./types.js\";\nimport { Operations, OperationType } from \"~/Operations.js\";\nimport { unmarshall } from \"~/marshall.js\";\nimport type { ICompressor } from \"@webiny/utils/compression/Compressor.js\";\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 operations;\n }\n}\n"],"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A;AACA;QACgB;QAAA,KACK,IAAIH,QAAQ,CAACI,MAAM,KAAK,IAAI,EAAE;UAC/B;UACA;QACJ;QACA;AAChB;AACA;QACgB;QAAA,KACK,IAAI,CAACJ,QAAQ,CAACK,KAAK,EAAE;UACtBf,OAAO,CAACC,KAAK,CACT,2DAA2DL,MAAM,CAACM,OAAO,IAC7E,CAAC;UACDF,OAAO,CAACgB,GAAG,CAAC;YAAEN;UAAS,CAAC,CAAC;UACzB;QACJ;QACA;AAChB;AACA;QACgB,MAAMO,IAAI,GAAG,MAAM,IAAI,CAACxB,UAAU,CAACyB,UAAU,CAACR,QAAQ,CAACO,IAAI,CAAC;QAC5D;AAChB;AACA;AACA;AACA;AACA;AACA;QACgB,IAAIA,IAAI,KAAKE,SAAS,IAAIF,IAAI,KAAK,IAAI,EAAE;UACrCjB,OAAO,CAACC,KAAK,CACT,2DAA2DL,MAAM,CAACG,SAAS,SAASQ,EAAE,eAC1F,CAAC;UACD;QACJ;QAEAZ,UAAU,CAACyB,MAAM,CAAC;UACdb,EAAE;UACFQ,KAAK,EAAEL,QAAQ,CAACK,KAAK;UACrBE;QACJ,CAAC,CAAC;MACN,CAAC,MAAM,IAAIrB,MAAM,CAACG,SAAS,KAAKX,aAAa,CAACiC,MAAM,EAAE;QAClD,MAAMC,QAAQ,GAAGjC,UAAU,CAAsBO,MAAM,CAACE,QAAQ,CAACyB,QAAQ,CAAC;QAC1E;AAChB;AACA;QACgB,IAAI,CAACD,QAAQ,EAAEP,KAAK,EAAE;UAClB;QACJ;QACApB,UAAU,CAAC6B,MAAM,CAAC;UACdjB,EAAE;UACFQ,KAAK,EAAEO,QAAQ,CAACP;QACpB,CAAC,CAAC;MACN;IACJ;IACA,OAAOpB,UAAU;EACrB;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["Operations","OperationType","unmarshall","OperationsBuilder","constructor","params","compressor","build","operations","record","records","dynamodb","eventName","console","error","eventID","keys","Keys","PK","SK","id","INSERT","MODIFY","newImage","NewImage","Object","length","ignore","index","log","data","decompress","undefined","insert","REMOVE","oldImage","OldImage","delete"],"sources":["OperationsBuilder.ts"],"sourcesContent":["import type { IOperations, IOperationsBuilder, IOperationsBuilderBuildParams } from \"./types.js\";\nimport { Operations, OperationType } from \"~/Operations.js\";\nimport { unmarshall } from \"~/marshall.js\";\nimport type { CompressionHandler } from \"@webiny/utils/exports/api.js\";\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: CompressionHandler.Interface;\n}\n\nexport class OperationsBuilder implements IOperationsBuilder {\n private readonly compressor: CompressionHandler.Interface;\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 operations;\n }\n}\n"],"mappings":"AACA,SAASA,UAAU,EAAEC,aAAa;AAClC,SAASC,UAAU;AAqBnB,OAAO,MAAMC,iBAAiB,CAA+B;EAGlDC,WAAWA,CAACC,MAAgC,EAAE;IACjD,IAAI,CAACC,UAAU,GAAGD,MAAM,CAACC,UAAU;EACvC;EAEA,MAAaC,KAAKA,CAACF,MAAqC,EAAwB;IAC5E,MAAMG,UAAU,GAAG,IAAIR,UAAU,CAAC,CAAC;IACnC,KAAK,MAAMS,MAAM,IAAIJ,MAAM,CAACK,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,GAAGd,U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DL,MAAM,CAACG,SAAS,SAASQ,EAAE,eAC1F,CAAC;UACD;QACJ;QAEAZ,UAAU,CAACyB,MAAM,CAAC;UACdb,EAAE;UACFQ,KAAK,EAAEL,QAAQ,CAACK,KAAK;UACrBE;QACJ,CAAC,CAAC;MACN,CAAC,MAAM,IAAIrB,MAAM,CAACG,SAAS,KAAKX,aAAa,CAACiC,MAAM,EAAE;QAClD,MAAMC,QAAQ,GAAGjC,UAAU,CAAsBO,MAAM,CAACE,QAAQ,CAACyB,QAAQ,CAAC;QAC1E;AAChB;AACA;QACgB,IAAI,CAACD,QAAQ,EAAEP,KAAK,EAAE;UAClB;QACJ;QACApB,UAAU,CAAC6B,MAAM,CAAC;UACdjB,EAAE;UACFQ,KAAK,EAAEO,QAAQ,CAACP;QACpB,CAAC,CAAC;MACN;IACJ;IACA,OAAOpB,UAAU;EACrB;AACJ","ignoreList":[]}
package/eventHandler.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createDynamoDBEventHandler, timerFactory } from "@webiny/handler-aws";
2
2
  import { OperationsBuilder } from "./OperationsBuilder.js";
3
3
  import { executeWithRetry } from "./executeWithRetry.js";
4
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
4
5
 
5
6
  /**
6
7
  * Also, we need to set the maximum running time for the Lambda Function.
@@ -20,8 +21,9 @@ export const createEventHandler = () => {
20
21
  console.error("Missing opensearch definition on context.");
21
22
  return null;
22
23
  }
24
+ const compressor = context.container.resolve(CompressionHandler);
23
25
  const builder = new OperationsBuilder({
24
- compressor: context.compressor
26
+ compressor
25
27
  });
26
28
  const operations = await builder.build({
27
29
  records: event.Records
@@ -1 +1 @@
1
- {"version":3,"names":["createDynamoDBEventHandler","timerFactory","OperationsBuilder","executeWithRetry","MAX_RUNNING_TIME","createEventHandler","event","context","ctx","lambdaContext","timer","opensearch","console","error","builder","compressor","operations","build","records","Records","total","maxRunningTime"],"sources":["eventHandler.ts"],"sourcesContent":["import { createDynamoDBEventHandler, timerFactory } from \"@webiny/handler-aws\";\nimport type { Context } from \"~/types.js\";\nimport { OperationsBuilder } from \"~/OperationsBuilder.js\";\nimport { executeWithRetry } from \"~/executeWithRetry.js\";\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.opensearch) {\n console.error(\"Missing opensearch 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,SAASA,0BAA0B,EAAEC,YAAY,QAAQ,qBAAqB;AAE9E,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;;AAEzB;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,GAAG;AAE5B,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACpC,OAAOL,0BAA0B,CAAC,OAAO;IAAEM,KAAK;IAAEC,OAAO,EAAEC,GAAG;IAAEC;EAAc,CAAC,KAAK;IAChF,MAAMC,KAAK,GAAGT,YAAY,CAACQ,aAAa,CAAC;IACzC,MAAMF,OAAO,GAAGC,GAAyB;IACzC,IAAI,CAACD,OAAO,CAACI,UAAU,EAAE;MACrBC,OAAO,CAACC,KAAK,CAAC,2CAA2C,CAAC;MAC1D,OAAO,IAAI;IACf;IAEA,MAAMC,OAAO,GAAG,IAAIZ,iBAAiB,CAAC;MAClCa,UAAU,EAAER,OAAO,CAACQ;IACxB,CAAC,CAAC;IAEF,MAAMC,UAAU,GAAG,MAAMF,OAAO,CAACG,KAAK,CAAC;MACnCC,OAAO,EAAEZ,KAAK,CAACa;IACnB,CAAC,CAAC;IACF;AACR;AACA;IACQ,IAAIH,UAAU,CAACI,KAAK,KAAK,CAAC,EAAE;MACxB,OAAO,IAAI;IACf;IACA;AACR;AACA;IACQ,MAAMjB,gBAAgB,CAAC;MACnBO,KAAK;MACLW,cAAc,EAAEjB,gBAAgB;MAChCG,OAAO;MACPS;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createDynamoDBEventHandler","timerFactory","OperationsBuilder","executeWithRetry","CompressionHandler","MAX_RUNNING_TIME","createEventHandler","event","context","ctx","lambdaContext","timer","opensearch","console","error","compressor","container","resolve","builder","operations","build","records","Records","total","maxRunningTime"],"sources":["eventHandler.ts"],"sourcesContent":["import { createDynamoDBEventHandler, timerFactory } from \"@webiny/handler-aws\";\nimport type { Context } from \"~/types.js\";\nimport { OperationsBuilder } from \"~/OperationsBuilder.js\";\nimport { executeWithRetry } from \"~/executeWithRetry.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\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.opensearch) {\n console.error(\"Missing opensearch definition on context.\");\n return null;\n }\n\n const compressor = context.container.resolve(CompressionHandler);\n\n const builder = new OperationsBuilder({\n 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,SAASA,0BAA0B,EAAEC,YAAY,QAAQ,qBAAqB;AAE9E,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,kBAAkB,QAAQ,8BAA8B;;AAEjE;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,GAAG;AAE5B,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACpC,OAAON,0BAA0B,CAAC,OAAO;IAAEO,KAAK;IAAEC,OAAO,EAAEC,GAAG;IAAEC;EAAc,CAAC,KAAK;IAChF,MAAMC,KAAK,GAAGV,YAAY,CAACS,aAAa,CAAC;IACzC,MAAMF,OAAO,GAAGC,GAAyB;IACzC,IAAI,CAACD,OAAO,CAACI,UAAU,EAAE;MACrBC,OAAO,CAACC,KAAK,CAAC,2CAA2C,CAAC;MAC1D,OAAO,IAAI;IACf;IAEA,MAAMC,UAAU,GAAGP,OAAO,CAACQ,SAAS,CAACC,OAAO,CAACb,kBAAkB,CAAC;IAEhE,MAAMc,OAAO,GAAG,IAAIhB,iBAAiB,CAAC;MAClCa;IACJ,CAAC,CAAC;IAEF,MAAMI,UAAU,GAAG,MAAMD,OAAO,CAACE,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,MAAMpB,gBAAgB,CAAC;MACnBQ,KAAK;MACLa,cAAc,EAAEnB,gBAAgB;MAChCG,OAAO;MACPW;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
package/execute.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createWaitUntilHealthy","OpenSearchCatClusterHealthStatus","UnhealthyClusterError","WaitingHealthyClusterAbortedError","WebinyError","shouldShowLogs","getError","item","index","error","reason","match","checkErrors","result","body","items","err","process","env","DEBUG","console","JSON","stringify","execute","params","context","timer","maxRunningTime","maxProcessorPercent","operations","total","remainingTime","getRemainingSeconds","runningTime","maxWaitingTime","debug","healthCheck","opensearch","minClusterHealthStatus","Yellow","waitingTimeStep","log","notice","info","warn","wait","onUnhealthy","startedAt","runs","mustEndAt","waitingReason","onTimeout","ex","res","bulk","tenant","meta"],"sources":["execute.ts"],"sourcesContent":["import {\n createWaitUntilHealthy,\n OpenSearchCatClusterHealthStatus,\n UnhealthyClusterError,\n WaitingHealthyClusterAbortedError\n} from \"@webiny/api-opensearch\";\nimport type { ITimer } from \"@webiny/handler-aws\";\nimport type { ApiResponse } from \"@webiny/api-opensearch/types.js\";\n\nimport { WebinyError } from \"@webiny/error\";\nimport type { Context, IOperations } from \"./types.js\";\nimport { shouldShowLogs } from \"~/helpers/shouldShowLogs.js\";\n\nexport interface BulkOperationsResponseBodyItemIndexError {\n reason?: string;\n}\n\nexport interface BulkOperationsResponseBodyItemIndex {\n error?: BulkOperationsResponseBodyItemIndexError;\n}\n\nexport interface BulkOperationsResponseBodyItem {\n index?: BulkOperationsResponseBodyItemIndex;\n error?: string;\n}\n\nexport interface BulkOperationsResponseBody {\n items: BulkOperationsResponseBodyItem[];\n}\n\nexport interface IExecuteParams {\n timer: ITimer;\n maxRunningTime: number;\n maxProcessorPercent: number;\n context: Pick<Context, \"opensearch\">;\n operations: Pick<IOperations, \"items\" | \"total\">;\n}\n\nconst getError = (item: BulkOperationsResponseBodyItem): string | null => {\n if (!item.index?.error?.reason) {\n return null;\n }\n const reason = item.index.error.reason;\n if (reason.match(/no such index \\[([a-zA-Z0-9_-]+)\\]/) !== null) {\n return \"index\";\n }\n return reason;\n};\n\nconst checkErrors = (result?: ApiResponse<BulkOperationsResponseBody>): void => {\n if (!result || !result.body || !result.body.items) {\n return;\n }\n for (const item of result.body.items) {\n const err = getError(item);\n if (!err) {\n continue;\n } else if (err === \"index\") {\n if (process.env.DEBUG === \"true\") {\n console.error(\"Bulk response\", JSON.stringify(result, null, 2));\n }\n continue;\n }\n console.error(\"Body item with error\", item);\n throw new WebinyError(err, \"DYNAMODB_TO_OPENSEARCH_ERROR\", item);\n }\n};\n\nexport const execute = (params: IExecuteParams) => {\n return async (): Promise<void> => {\n const { context, timer, maxRunningTime, maxProcessorPercent, operations } = params;\n\n if (operations.total === 0) {\n return;\n }\n\n const remainingTime = timer.getRemainingSeconds();\n const runningTime = maxRunningTime - remainingTime;\n const maxWaitingTime = remainingTime - 90;\n\n if (shouldShowLogs()) {\n console.debug(\n `The Lambda is already running for ${runningTime}s. Setting Health Check max waiting time: ${maxWaitingTime}s`\n );\n }\n\n const healthCheck = createWaitUntilHealthy(context.opensearch, {\n minClusterHealthStatus: OpenSearchCatClusterHealthStatus.Yellow,\n waitingTimeStep: 30,\n maxProcessorPercent,\n maxWaitingTime\n });\n\n // const log = context.logger.withSource(\"dynamodbToElasticsearch\");\n const log = {\n notice: (...params: any[]) => {\n console.log(...params);\n },\n debug: (...params: any[]) => {\n console.debug(...params);\n },\n info: (...params: any[]) => {\n console.info(...params);\n },\n warn: (...params: any[]) => {\n console.warn(...params);\n },\n error: (...params: any[]) => {\n console.error(...params);\n }\n };\n\n try {\n await healthCheck.wait({\n async onUnhealthy({ startedAt, runs, mustEndAt, waitingTimeStep, waitingReason }) {\n console.debug(`Cluster is unhealthy on run #${runs}.`, {\n startedAt,\n mustEndAt,\n waitingTimeStep,\n waitingReason\n });\n },\n async onTimeout({ startedAt, runs, waitingTimeStep, mustEndAt, waitingReason }) {\n console.error(`Cluster health check timeout on run #${runs}.`, {\n startedAt,\n mustEndAt,\n waitingTimeStep,\n waitingReason\n });\n }\n });\n } catch (ex) {\n if (\n ex instanceof UnhealthyClusterError ||\n ex instanceof WaitingHealthyClusterAbortedError\n ) {\n throw ex;\n }\n console.error(`Cluster health check failed.`, ex);\n throw ex;\n }\n\n try {\n const res = await context.opensearch.bulk<BulkOperationsResponseBody>({\n body: operations.items\n });\n checkErrors(res);\n } catch (error) {\n log.error(error, {\n tenant: \"root\"\n });\n\n if (shouldShowLogs() === false) {\n throw error;\n }\n const meta = error?.meta || {};\n delete meta[\"meta\"];\n console.error(\"Bulk error\", JSON.stringify(error, null, 2));\n throw error;\n }\n if (shouldShowLogs() === false) {\n return;\n }\n console.info(`Transferred ${operations.total} record operations to Elasticsearch.`);\n };\n};\n"],"mappings":"AAAA,SACIA,sBAAsB,EACtBC,gCAAgC,EAChCC,qBAAqB,EACrBC,iCAAiC,QAC9B,wBAAwB;AAI/B,SAASC,WAAW,QAAQ,eAAe;AAE3C,SAASC,cAAc;AA2BvB,MAAMC,QAAQ,GAAIC,IAAoC,IAAoB;EACtE,IAAI,CAACA,IAAI,CAACC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAE;IAC5B,OAAO,IAAI;EACf;EACA,MAAMA,MAAM,GAAGH,IAAI,CAACC,KAAK,CAACC,KAAK,CAACC,MAAM;EACtC,IAAIA,MAAM,CAACC,KAAK,CAAC,oCAAoC,CAAC,KAAK,IAAI,EAAE;IAC7D,OAAO,OAAO;EAClB;EACA,OAAOD,MAAM;AACjB,CAAC;AAED,MAAME,WAAW,GAAIC,MAAgD,IAAW;EAC5E,IAAI,CAACA,MAAM,IAAI,CAACA,MAAM,CAACC,IAAI,IAAI,CAACD,MAAM,CAACC,IAAI,CAACC,KAAK,EAAE;IAC/C;EACJ;EACA,KAAK,MAAMR,IAAI,IAAIM,MAAM,CAACC,IAAI,CAACC,KAAK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AAE2C,EAAE,CAAC;MACjD,MAAMA,EAAE;IACZ;IAEA,IAAI;MACA,MAAMC,GAAG,GAAG,MAAM5B,OAAO,CAACY,UAAU,CAACiB,IAAI,CAA6B;QAClExC,IAAI,EAAEe,UAAU,CAACd;MACrB,CAAC,CAAC;MACFH,WAAW,CAACyC,GAAG,CAAC;IACpB,CAAC,CAAC,OAAO5C,KAAK,EAAE;MACZgC,GAAG,CAAChC,KAAK,CAACA,KAAK,EAAE;QACb8C,MAAM,EAAE;MACZ,CAAC,CAAC;MAEF,IAAIlD,cAAc,CAAC,CAAC,KAAK,KAAK,EAAE;QAC5B,MAAMI,KAAK;MACf;MACA,MAAM+C,IAAI,GAAG/C,KAAK,EAAE+C,IAAI,IAAI,CAAC,CAAC;MAC9B,OAAOA,IAAI,CAAC,MAAM,CAAC;MACnBpC,OAAO,CAACX,KAAK,CAAC,YAAY,EAAEY,IAAI,CAACC,SAAS,CAACb,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;MAC3D,MAAMA,KAAK;IACf;IACA,IAAIJ,cAAc,CAAC,CAAC,KAAK,KAAK,EAAE;MAC5B;IACJ;IACAe,OAAO,CAACuB,IAAI,CAAC,eAAed,UAAU,CAACC,KAAK,sCAAsC,CAAC;EACvF,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createWaitUntilHealthy","OpenSearchCatClusterHealthStatus","UnhealthyClusterError","WaitingHealthyClusterAbortedError","WebinyError","shouldShowLogs","getError","item","index","error","reason","match","checkErrors","result","body","items","err","process","env","DEBUG","console","JSON","stringify","execute","params","context","timer","maxRunningTime","maxProcessorPercent","operations","total","remainingTime","getRemainingSeconds","runningTime","maxWaitingTime","debug","healthCheck","opensearch","minClusterHealthStatus","Yellow","waitingTimeStep","log","notice","info","warn","wait","onUnhealthy","startedAt","runs","mustEndAt","waitingReason","onTimeout","ex","res","bulk","tenant","meta"],"sources":["execute.ts"],"sourcesContent":["import {\n createWaitUntilHealthy,\n OpenSearchCatClusterHealthStatus,\n UnhealthyClusterError,\n WaitingHealthyClusterAbortedError\n} from \"@webiny/api-opensearch\";\nimport type { ITimer } from \"@webiny/handler-aws\";\nimport type { ApiResponse } from \"@webiny/api-opensearch/types.js\";\n\nimport { WebinyError } from \"@webiny/error\";\nimport type { Context, IOperations } from \"./types.js\";\nimport { shouldShowLogs } from \"~/helpers/shouldShowLogs.js\";\n\nexport interface BulkOperationsResponseBodyItemIndexError {\n reason?: string;\n}\n\nexport interface BulkOperationsResponseBodyItemIndex {\n error?: BulkOperationsResponseBodyItemIndexError;\n}\n\nexport interface BulkOperationsResponseBodyItem {\n index?: BulkOperationsResponseBodyItemIndex;\n error?: string;\n}\n\nexport interface BulkOperationsResponseBody {\n items: BulkOperationsResponseBodyItem[];\n}\n\nexport interface IExecuteParams {\n timer: ITimer;\n maxRunningTime: number;\n maxProcessorPercent: number;\n context: Pick<Context, \"opensearch\">;\n operations: Pick<IOperations, \"items\" | \"total\">;\n}\n\nconst getError = (item: BulkOperationsResponseBodyItem): string | null => {\n if (!item.index?.error?.reason) {\n return null;\n }\n const reason = item.index.error.reason;\n if (reason.match(/no such index \\[([a-zA-Z0-9_-]+)\\]/) !== null) {\n return \"index\";\n }\n return reason;\n};\n\nconst checkErrors = (result?: ApiResponse): void => {\n if (!result || !result.body || !result.body.items) {\n return;\n }\n for (const item of result.body.items) {\n const err = getError(item);\n if (!err) {\n continue;\n } else if (err === \"index\") {\n if (process.env.DEBUG === \"true\") {\n console.error(\"Bulk response\", JSON.stringify(result, null, 2));\n }\n continue;\n }\n console.error(\"Body item with error\", item);\n throw new WebinyError(err, \"DYNAMODB_TO_OPENSEARCH_ERROR\", item);\n }\n};\n\nexport const execute = (params: IExecuteParams) => {\n return async (): Promise<void> => {\n const { context, timer, maxRunningTime, maxProcessorPercent, operations } = params;\n\n if (operations.total === 0) {\n return;\n }\n\n const remainingTime = timer.getRemainingSeconds();\n const runningTime = maxRunningTime - remainingTime;\n const maxWaitingTime = remainingTime - 90;\n\n if (shouldShowLogs()) {\n console.debug(\n `The Lambda is already running for ${runningTime}s. Setting Health Check max waiting time: ${maxWaitingTime}s`\n );\n }\n\n const healthCheck = createWaitUntilHealthy(context.opensearch, {\n minClusterHealthStatus: OpenSearchCatClusterHealthStatus.Yellow,\n waitingTimeStep: 30,\n maxProcessorPercent,\n maxWaitingTime\n });\n\n // const log = context.logger.withSource(\"dynamodbToElasticsearch\");\n const log = {\n notice: (...params: any[]) => {\n console.log(...params);\n },\n debug: (...params: any[]) => {\n console.debug(...params);\n },\n info: (...params: any[]) => {\n console.info(...params);\n },\n warn: (...params: any[]) => {\n console.warn(...params);\n },\n error: (...params: any[]) => {\n console.error(...params);\n }\n };\n\n try {\n await healthCheck.wait({\n async onUnhealthy({ startedAt, runs, mustEndAt, waitingTimeStep, waitingReason }) {\n console.debug(`Cluster is unhealthy on run #${runs}.`, {\n startedAt,\n mustEndAt,\n waitingTimeStep,\n waitingReason\n });\n },\n async onTimeout({ startedAt, runs, waitingTimeStep, mustEndAt, waitingReason }) {\n console.error(`Cluster health check timeout on run #${runs}.`, {\n startedAt,\n mustEndAt,\n waitingTimeStep,\n waitingReason\n });\n }\n });\n } catch (ex) {\n if (\n ex instanceof UnhealthyClusterError ||\n ex instanceof WaitingHealthyClusterAbortedError\n ) {\n throw ex;\n }\n console.error(`Cluster health check failed.`, ex);\n throw ex;\n }\n\n try {\n const res = await context.opensearch.bulk({\n body: operations.items\n });\n checkErrors(res);\n } catch (error) {\n log.error(error, {\n tenant: \"root\"\n });\n\n if (shouldShowLogs() === false) {\n throw error;\n }\n const meta = error?.meta || {};\n delete meta[\"meta\"];\n console.error(\"Bulk error\", JSON.stringify(error, null, 2));\n throw error;\n }\n if (shouldShowLogs() === false) {\n return;\n }\n console.info(`Transferred ${operations.total} record operations to Elasticsearch.`);\n };\n};\n"],"mappings":"AAAA,SACIA,sBAAsB,EACtBC,gCAAgC,EAChCC,qBAAqB,EACrBC,iCAAiC,QAC9B,wBAAwB;AAI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;IACf;IACA,IAAIJ,cAAc,CAAC,CAAC,KAAK,KAAK,EAAE;MAC5B;IACJ;IACAe,OAAO,CAACuB,IAAI,CAAC,eAAed,UAAU,CAACC,KAAK,sCAAsC,CAAC;EACvF,CAAC;AACL,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-dynamodb-to-elasticsearch",
3
- "version": "6.1.0",
3
+ "version": "6.2.0-beta.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -12,17 +12,17 @@
12
12
  "license": "MIT",
13
13
  "author": "Webiny Ltd.",
14
14
  "dependencies": {
15
- "@webiny/api": "6.1.0",
16
- "@webiny/api-opensearch": "6.1.0",
17
- "@webiny/aws-sdk": "6.1.0",
18
- "@webiny/error": "6.1.0",
19
- "@webiny/handler-aws": "6.1.0",
20
- "@webiny/utils": "6.1.0",
21
- "p-retry": "7.1.1"
15
+ "@webiny/api": "6.2.0-beta.0",
16
+ "@webiny/api-opensearch": "6.2.0-beta.0",
17
+ "@webiny/aws-sdk": "6.2.0-beta.0",
18
+ "@webiny/error": "6.2.0-beta.0",
19
+ "@webiny/handler-aws": "6.2.0-beta.0",
20
+ "@webiny/utils": "6.2.0-beta.0",
21
+ "p-retry": "8.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@webiny/build-tools": "6.1.0",
25
- "@webiny/plugins": "6.1.0",
24
+ "@webiny/build-tools": "6.2.0-beta.0",
25
+ "@webiny/plugins": "6.2.0-beta.0",
26
26
  "typescript": "5.9.3"
27
27
  },
28
28
  "publishConfig": {
@@ -34,5 +34,5 @@
34
34
  "__tests__"
35
35
  ]
36
36
  },
37
- "gitHead": "65e0ac1889b3392c99b8cac6cde508e1e831c715"
37
+ "gitHead": "3d3148358b6febbc857371930871743bec3b3939"
38
38
  }