@webiny/api-prerendering-service-so-ddb 5.40.0-beta.2 → 5.40.0-beta.3

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 +1 @@
1
- {"version":3,"names":["_toolbox","require","createQueueJobEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","args","exports"],"sources":["queueJob.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateQueueJobEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createQueueJobEntity = (params: CreateQueueJobEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n args: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAkC,IAAkB;EACrF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAAf,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createQueueJobEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","args","exports"],"sources":["queueJob.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateQueueJobEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createQueueJobEntity = (params: CreateQueueJobEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n args: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAkC,IAAkB;EACrF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAAf,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createRenderEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","GSI1_PK","GSI1_SK","data","exports"],"sources":["render.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateRenderEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createRenderEntity = (params: CreateRenderEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAgC,IAAkB;EACjF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,OAAO,EAAE;QACLF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createRenderEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","GSI1_PK","GSI1_SK","data","exports"],"sources":["render.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateRenderEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createRenderEntity = (params: CreateRenderEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAgC,IAAkB;EACjF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,OAAO,EAAE;QACLF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createRenderEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","namespace","url","args","configuration","files","exports"],"sources":["renderLegacy.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateRenderEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createRenderEntity = (params: CreateRenderEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n namespace: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n args: {\n type: \"map\"\n },\n configuration: {\n type: \"map\"\n },\n files: {\n type: \"list\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAgC,IAAkB;EACjF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,SAAS,EAAE;QACPD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACDI,aAAa,EAAE;QACXJ,IAAI,EAAE;MACV,CAAC;MACDK,KAAK,EAAE;QACHL,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAAlB,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createRenderEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","namespace","url","args","configuration","files","exports"],"sources":["renderLegacy.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateRenderEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createRenderEntity = (params: CreateRenderEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n namespace: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n args: {\n type: \"map\"\n },\n configuration: {\n type: \"map\"\n },\n files: {\n type: \"list\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAgC,IAAkB;EACjF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,SAAS,EAAE;QACPD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACDI,aAAa,EAAE;QACXJ,IAAI,EAAE;MACV,CAAC;MACDK,KAAK,EAAE;QACHL,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAAlB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createSettingsEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","data","exports"],"sources":["settings.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateSettingsEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: CreateSettingsEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAkC,IAAkB;EACrF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAd,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createSettingsEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","data","exports"],"sources":["settings.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\nexport interface CreateSettingsEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: CreateSettingsEntityParams): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAkC,IAAkB;EACrF,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAd,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
1
+ import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
2
2
  import { Table } from "@webiny/db-dynamodb/toolbox";
3
3
  import { TableModifier } from "../types";
4
4
  interface CreateTableParams {
5
5
  table?: TableModifier;
6
- documentClient: DynamoDBClient;
6
+ documentClient: DynamoDBDocument;
7
7
  }
8
8
  export declare const createTable: (params: CreateTableParams) => Table<string, string, string>;
9
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createTable","params","table","documentClient","tableConfig","name","process","env","DB_TABLE_PRERENDERING_SERVICE","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableModifier } from \"~/types\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface CreateTableParams {\n table?: TableModifier;\n documentClient: DynamoDBClient;\n}\n\nexport const createTable = (params: CreateTableParams): Table<string, string, string> => {\n const { table, documentClient } = params;\n\n const tableConfig: TableConstructor<string, string, string> = {\n name: (process.env.DB_TABLE_PRERENDERING_SERVICE || process.env.DB_TABLE) as string,\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n },\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,WAAW,GAAIC,MAAyB,IAAoC;EACrF,MAAM;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAExC,MAAMG,WAAqD,GAAG;IAC1DC,IAAI,EAAGC,OAAO,CAACC,GAAG,CAACC,6BAA6B,IAAIF,OAAO,CAACC,GAAG,CAACE,QAAmB;IACnFC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOf,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIc,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAnB,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["_toolbox","require","createTable","params","table","documentClient","tableConfig","name","process","env","DB_TABLE_PRERENDERING_SERVICE","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableModifier } from \"~/types\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface CreateTableParams {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = (params: CreateTableParams): Table<string, string, string> => {\n const { table, documentClient } = params;\n\n const tableConfig: TableConstructor<string, string, string> = {\n name: (process.env.DB_TABLE_PRERENDERING_SERVICE || process.env.DB_TABLE) as string,\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n },\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,WAAW,GAAIC,MAAyB,IAAoC;EACrF,MAAM;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAExC,MAAMG,WAAqD,GAAG;IAC1DC,IAAI,EAAGC,OAAO,CAACC,GAAG,CAACC,6BAA6B,IAAIF,OAAO,CAACC,GAAG,CAACE,QAAmB;IACnFC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOf,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIc,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAnB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createTagPathLinkEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","GSI1_PK","GSI1_SK","data","exports"],"sources":["tagPathLink.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface CreateTagPathLinkEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createTagPathLinkEntity = (params: CreateTagPathLinkEntityParams) => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,OAAO,EAAE;QACLF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createTagPathLinkEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","GSI1_PK","GSI1_SK","data","exports"],"sources":["tagPathLink.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface CreateTagPathLinkEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createTagPathLinkEntity = (params: CreateTagPathLinkEntityParams) => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,OAAO,EAAE;QACLF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createTagUrlLinkEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","namespace","url","value","key","exports"],"sources":["tagPathLinkLegacy.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface CreateTagUrlLinkEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createTagUrlLinkEntity = (params: CreateTagUrlLinkEntityParams) => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n namespace: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n value: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,sBAAsB,GAAIC,MAAoC,IAAK;EAC5E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,SAAS,EAAE;QACPD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,KAAK,EAAE;QACHH,IAAI,EAAE;MACV,CAAC;MACDI,GAAG,EAAE;QACDJ,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAjB,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createTagUrlLinkEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","namespace","url","value","key","exports"],"sources":["tagPathLinkLegacy.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface CreateTagUrlLinkEntityParams {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createTagUrlLinkEntity = (params: CreateTagUrlLinkEntityParams) => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n namespace: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n value: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,sBAAsB,GAAIC,MAAoC,IAAK;EAC5E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,SAAS,EAAE;QACPD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,KAAK,EAAE;QACHH,IAAI,EAAE;MACV,CAAC;MACDI,GAAG,EAAE;QACDJ,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAjB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createTenantEntity","entityName","table","Entity","name","attributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","id","exports"],"sources":["tenantEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n}\n\nexport const createTenantEntity = ({ entityName, table }: Params): Entity<any> => {\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,KAAkB;EAC9E,OAAO,IAAIC,eAAM,CAAC;IACdD,KAAK;IACLE,IAAI,EAAEH,UAAU;IAChBI,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,EAAE,EAAE;QACAH,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAf,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createTenantEntity","entityName","table","Entity","name","attributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","id","exports"],"sources":["tenantEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n}\n\nexport const createTenantEntity = ({ entityName, table }: Params): Entity<any> => {\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,KAAkB;EAC9E,OAAO,IAAIC,eAAM,CAAC;IACdD,KAAK;IACLE,IAAI,EAAEH,UAAU;IAChBI,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,EAAE,EAAE;QACAH,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAf,kBAAA,GAAAA,kBAAA","ignoreList":[]}
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_types","_table","_render","_settings","_queueJob","_render2","_tenant","_settings2","_queueJob2","_tagPathLink","_tenantEntity","reservedFields","isReserved","name","includes","WebinyError","createPrerenderingServiceStorageOperations","params","attributes","table","documentClient","Object","values","forEach","attrs","keys","tableInstance","createTable","entities","render","createRenderEntity","entityName","ENTITIES","RENDER","settings","createSettingsEntity","SETTINGS","queueJob","createQueueJobEntity","QUEUE_JOB","tagPathLink","createTagPathLinkEntity","TAG_PATH_LINK","tenant","createTenantEntity","TENANT","getTable","getEntities","createRenderStorageOperations","entity","tagPathLinkEntity","createQueueJobStorageOperations","createSettingsStorageOperations","createTenantStorageOperations","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ENTITIES, PrerenderingServiceFactory, PrerenderingServiceFactoryParams } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createRenderEntity } from \"~/definitions/render\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createQueueJobEntity } from \"~/definitions/queueJob\";\nimport { createRenderStorageOperations } from \"~/operations/render\";\nimport { createTenantStorageOperations } from \"~/operations/tenant\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createQueueJobStorageOperations } from \"~/operations/queueJob\";\nimport { createTagPathLinkEntity } from \"~/definitions/tagPathLink\";\nimport { createTenantEntity } from \"~/definitions/tenantEntity\";\n\nconst reservedFields = [\"PK\", \"SK\", \"index\", \"data\", \"TYPE\", \"__type\", \"GSI1_PK\", \"GSI1_SK\"];\n\nconst isReserved = (name: string): void => {\n if (reservedFields.includes(name) === false) {\n return;\n }\n throw new WebinyError(`Attribute name \"${name}\" is not allowed.`, \"ATTRIBUTE_NOT_ALLOWED\", {\n name\n });\n};\n\nexport const createPrerenderingServiceStorageOperations: PrerenderingServiceFactory = (\n params: PrerenderingServiceFactoryParams\n) => {\n const { attributes, table, documentClient } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const tableInstance = createTable({ table, documentClient });\n\n const entities = {\n render: createRenderEntity({\n entityName: ENTITIES.RENDER,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.RENDER] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n queueJob: createQueueJobEntity({\n entityName: ENTITIES.QUEUE_JOB,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.QUEUE_JOB] : {}\n }),\n tagPathLink: createTagPathLinkEntity({\n entityName: ENTITIES.TAG_PATH_LINK,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.TAG_PATH_LINK] : {}\n }),\n tenant: createTenantEntity({\n entityName: ENTITIES.TENANT,\n table: tableInstance\n })\n };\n\n return {\n getTable: () => tableInstance,\n getEntities: () => entities,\n ...createRenderStorageOperations({\n entity: entities.render,\n tagPathLinkEntity: entities.tagPathLink\n }),\n ...createQueueJobStorageOperations({\n entity: entities.queueJob\n }),\n ...createSettingsStorageOperations({\n entity: entities.settings\n }),\n ...createTenantStorageOperations({\n entity: entities.tenant\n })\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAEA,MAAMY,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;AAE5F,MAAMC,UAAU,GAAIC,IAAY,IAAW;EACvC,IAAIF,cAAc,CAACG,QAAQ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W,EAAE,IAAAC,oCAAuB,EAAC;MACjCV,UAAU,EAAEC,eAAQ,CAACU,aAAa;MAClCvB,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACU,aAAa,CAAC,GAAG,CAAC;IACnE,CAAC,CAAC;IACFC,MAAM,EAAE,IAAAC,gCAAkB,EAAC;MACvBb,UAAU,EAAEC,eAAQ,CAACa,MAAM;MAC3B1B,KAAK,EAAEO;IACX,CAAC;EACL,CAAC;EAED,OAAO;IACHoB,QAAQ,EAAEA,CAAA,KAAMpB,aAAa;IAC7BqB,WAAW,EAAEA,CAAA,KAAMnB,QAAQ;IAC3B,GAAG,IAAAoB,sCAA6B,EAAC;MAC7BC,MAAM,EAAErB,QAAQ,CAACC,MAAM;MACvBqB,iBAAiB,EAAEtB,QAAQ,CAACY;IAChC,CAAC,CAAC;IACF,GAAG,IAAAW,0CAA+B,EAAC;MAC/BF,MAAM,EAAErB,QAAQ,CAACS;IACrB,CAAC,CAAC;IACF,GAAG,IAAAe,0CAA+B,EAAC;MAC/BH,MAAM,EAAErB,QAAQ,CAACM;IACrB,CAAC,CAAC;IACF,GAAG,IAAAmB,qCAA6B,EAAC;MAC7BJ,MAAM,EAAErB,QAAQ,CAACe;IACrB,CAAC;EACL,CAAC;AACL,CAAC;AAACW,OAAA,CAAAtC,0CAAA,GAAAA,0CAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_types","_table","_render","_settings","_queueJob","_render2","_tenant","_settings2","_queueJob2","_tagPathLink","_tenantEntity","reservedFields","isReserved","name","includes","WebinyError","createPrerenderingServiceStorageOperations","params","attributes","table","documentClient","Object","values","forEach","attrs","keys","tableInstance","createTable","entities","render","createRenderEntity","entityName","ENTITIES","RENDER","settings","createSettingsEntity","SETTINGS","queueJob","createQueueJobEntity","QUEUE_JOB","tagPathLink","createTagPathLinkEntity","TAG_PATH_LINK","tenant","createTenantEntity","TENANT","getTable","getEntities","createRenderStorageOperations","entity","tagPathLinkEntity","createQueueJobStorageOperations","createSettingsStorageOperations","createTenantStorageOperations","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ENTITIES, PrerenderingServiceFactory, PrerenderingServiceFactoryParams } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createRenderEntity } from \"~/definitions/render\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createQueueJobEntity } from \"~/definitions/queueJob\";\nimport { createRenderStorageOperations } from \"~/operations/render\";\nimport { createTenantStorageOperations } from \"~/operations/tenant\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createQueueJobStorageOperations } from \"~/operations/queueJob\";\nimport { createTagPathLinkEntity } from \"~/definitions/tagPathLink\";\nimport { createTenantEntity } from \"~/definitions/tenantEntity\";\n\nconst reservedFields = [\"PK\", \"SK\", \"index\", \"data\", \"TYPE\", \"__type\", \"GSI1_PK\", \"GSI1_SK\"];\n\nconst isReserved = (name: string): void => {\n if (reservedFields.includes(name) === false) {\n return;\n }\n throw new WebinyError(`Attribute name \"${name}\" is not allowed.`, \"ATTRIBUTE_NOT_ALLOWED\", {\n name\n });\n};\n\nexport const createPrerenderingServiceStorageOperations: PrerenderingServiceFactory = (\n params: PrerenderingServiceFactoryParams\n) => {\n const { attributes, table, documentClient } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const tableInstance = createTable({ table, documentClient });\n\n const entities = {\n render: createRenderEntity({\n entityName: ENTITIES.RENDER,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.RENDER] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n queueJob: createQueueJobEntity({\n entityName: ENTITIES.QUEUE_JOB,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.QUEUE_JOB] : {}\n }),\n tagPathLink: createTagPathLinkEntity({\n entityName: ENTITIES.TAG_PATH_LINK,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.TAG_PATH_LINK] : {}\n }),\n tenant: createTenantEntity({\n entityName: ENTITIES.TENANT,\n table: tableInstance\n })\n };\n\n return {\n getTable: () => tableInstance,\n getEntities: () => entities,\n ...createRenderStorageOperations({\n entity: entities.render,\n tagPathLinkEntity: entities.tagPathLink\n }),\n ...createQueueJobStorageOperations({\n entity: entities.queueJob\n }),\n ...createSettingsStorageOperations({\n entity: entities.settings\n }),\n ...createTenantStorageOperations({\n entity: entities.tenant\n })\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAEA,MAAMY,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;AAE5F,MAAMC,UAAU,GAAIC,IAAY,IAAW;EACvC,IAAIF,cAAc,CAACG,QAAQ,CAACD,IAAI,CAAC,KAAK,KAAK,EAAE;IACzC;EACJ;EACA,MAAM,IAAIE,cAAW,CAAE,mBAAkBF,IAAK,mBAAkB,EAAE,uBAAuB,EAAE;IACvFA;EACJ,CAAC,CAAC;AACN,CAAC;AAEM,MAAMG,0CAAsE,GAC/EC,MAAwC,IACvC;EACD,MAAM;IAAEC,UAAU;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AkB,EAAC;MACvBb,UAAU,EAAEC,eAAQ,CAACa,MAAM;MAC3B1B,KAAK,EAAEO;IACX,CAAC;EACL,CAAC;EAED,OAAO;IACHoB,QAAQ,EAAEA,CAAA,KAAMpB,aAAa;IAC7BqB,WAAW,EAAEA,CAAA,KAAMnB,QAAQ;IAC3B,GAAG,IAAAoB,sCAA6B,EAAC;MAC7BC,MAAM,EAAErB,QAAQ,CAACC,MAAM;MACvBqB,iBAAiB,EAAEtB,QAAQ,CAACY;IAChC,CAAC,CAAC;IACF,GAAG,IAAAW,0CAA+B,EAAC;MAC/BF,MAAM,EAAErB,QAAQ,CAACS;IACrB,CAAC,CAAC;IACF,GAAG,IAAAe,0CAA+B,EAAC;MAC/BH,MAAM,EAAErB,QAAQ,CAACM;IACrB,CAAC,CAAC;IACF,GAAG,IAAAmB,qCAA6B,EAAC;MAC7BJ,MAAM,EAAErB,QAAQ,CAACe;IACrB,CAAC;EACL,CAAC;AACL,CAAC;AAACW,OAAA,CAAAtC,0CAAA,GAAAA,0CAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_batchWrite","_query","_dbDynamodb","createQueueJobStorageOperations","params","entity","createQueueJobPartitionKey","createQueueJobSortKey","id","createQueueJobType","createQueueJob","queueJob","keys","PK","SK","put","item","TYPE","ex","WebinyError","message","code","listQueueJobs","queryAllParams","partitionKey","options","gte","queryAllClean","deleteQueueJobs","queueJobs","items","map","job","deleteBatch","batchWriteAll","table","exports"],"sources":["queueJob.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n PrerenderingServiceQueueJobStorageOperations,\n PrerenderingServiceStorageOperationsCreateQueueJobParams,\n PrerenderingServiceStorageOperationsDeleteQueueJobsParams,\n QueueJob\n} from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { queryAllClean, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateQueueJobStorageOperationsParams {\n entity: Entity<any>;\n}\n\nexport const createQueueJobStorageOperations = (\n params: CreateQueueJobStorageOperationsParams\n): PrerenderingServiceQueueJobStorageOperations => {\n const { entity } = params;\n\n const createQueueJobPartitionKey = (): string => {\n return \"PS#Q#JOB\";\n };\n const createQueueJobSortKey = (id: string): string => {\n return id;\n };\n\n const createQueueJobType = () => {\n return \"ps.queue.job\";\n };\n\n const createQueueJob = async (\n params: PrerenderingServiceStorageOperationsCreateQueueJobParams\n ): Promise<QueueJob> => {\n const { queueJob } = params;\n const keys = {\n PK: createQueueJobPartitionKey(),\n SK: createQueueJobSortKey(queueJob.id)\n };\n\n try {\n await put({\n entity,\n item: {\n ...queueJob,\n ...keys,\n TYPE: createQueueJobType()\n }\n });\n return queueJob;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create render record.\",\n ex.code || \"CREATE_RENDER_ERROR\",\n {\n keys,\n queueJob\n }\n );\n }\n };\n\n const listQueueJobs = async () => {\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createQueueJobPartitionKey(),\n options: {\n gte: \" \"\n }\n };\n\n try {\n return await queryAllClean<QueueJob>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list queue jobs records.\",\n ex.code || \"LIST_QUEUE_JOBS_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n };\n\n const deleteQueueJobs = async (\n params: PrerenderingServiceStorageOperationsDeleteQueueJobsParams\n ) => {\n const { queueJobs } = params;\n\n const items = queueJobs.map(job => {\n return entity.deleteBatch({\n PK: createQueueJobPartitionKey(),\n SK: createQueueJobSortKey(job.id)\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n return queueJobs;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete queue jobs records.\",\n ex.code || \"DELETE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batchWrite","_query","_dbDynamodb","createQueueJobStorageOperations","params","entity","createQueueJobPartitionKey","createQueueJobSortKey","id","createQueueJobType","createQueueJob","queueJob","keys","PK","SK","put","item","TYPE","ex","WebinyError","message","code","listQueueJobs","queryAllParams","partitionKey","options","gte","queryAllClean","deleteQueueJobs","queueJobs","items","map","job","deleteBatch","batchWriteAll","table","exports"],"sources":["queueJob.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n PrerenderingServiceQueueJobStorageOperations,\n PrerenderingServiceStorageOperationsCreateQueueJobParams,\n PrerenderingServiceStorageOperationsDeleteQueueJobsParams,\n QueueJob\n} from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { queryAllClean, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateQueueJobStorageOperationsParams {\n entity: Entity<any>;\n}\n\nexport const createQueueJobStorageOperations = (\n params: CreateQueueJobStorageOperationsParams\n): PrerenderingServiceQueueJobStorageOperations => {\n const { entity } = params;\n\n const createQueueJobPartitionKey = (): string => {\n return \"PS#Q#JOB\";\n };\n const createQueueJobSortKey = (id: string): string => {\n return id;\n };\n\n const createQueueJobType = () => {\n return \"ps.queue.job\";\n };\n\n const createQueueJob = async (\n params: PrerenderingServiceStorageOperationsCreateQueueJobParams\n ): Promise<QueueJob> => {\n const { queueJob } = params;\n const keys = {\n PK: createQueueJobPartitionKey(),\n SK: createQueueJobSortKey(queueJob.id)\n };\n\n try {\n await put({\n entity,\n item: {\n ...queueJob,\n ...keys,\n TYPE: createQueueJobType()\n }\n });\n return queueJob;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create render record.\",\n ex.code || \"CREATE_RENDER_ERROR\",\n {\n keys,\n queueJob\n }\n );\n }\n };\n\n const listQueueJobs = async () => {\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createQueueJobPartitionKey(),\n options: {\n gte: \" \"\n }\n };\n\n try {\n return await queryAllClean<QueueJob>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list queue jobs records.\",\n ex.code || \"LIST_QUEUE_JOBS_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n };\n\n const deleteQueueJobs = async (\n params: PrerenderingServiceStorageOperationsDeleteQueueJobsParams\n ) => {\n const { queueJobs } = params;\n\n const items = queueJobs.map(job => {\n return entity.deleteBatch({\n PK: createQueueJobPartitionKey(),\n SK: createQueueJobSortKey(job.id)\n });\n });\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n return queueJobs;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete queue jobs records.\",\n ex.code || \"DELETE_QUEUE_JOBS_ERROR\",\n {\n queueJobs\n }\n );\n }\n };\n\n return {\n createQueueJob,\n deleteQueueJobs,\n listQueueJobs\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMO,MAAMI,+BAA+B,GACxCC,MAA6C,IACE;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,0BAA0B,GAAGA,CAAA,KAAc;IAC7C,OAAO,UAAU;EACrB,CAAC;EACD,MAAMC,qBAAqB,GAAIC,EAAU,IAAa;IAClD,OAAOA,EAAE;EACb,CAAC;EAED,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;IAC7B,OAAO,cAAc;EACzB,CAAC;EAED,MAAMC,cAAc,GAAG,MACnBN,MAAgE,IAC5C;IACpB,MAAM;MAAEO;IAAS,CAAC,GAAGP,MAAM;IAC3B,MAAMQ,IAAI,GAAG;MACTC,EAAE,EAAEP,0BAA0B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,CAACyB,GAAG,CAACxB,EAAE;MACpC,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,IAAI;MACA,MAAM,IAAA0B,yBAAa,EAAC;QAChBC,KAAK,EAAE9B,MAAM,CAAC8B,KAAK;QACnBL;MACJ,CAAC,CAAC;MACF,OAAOD,SAAS;IACpB,CAAC,CAAC,OAAOX,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,sCAAsC,EACpDF,EAAE,CAACG,IAAI,IAAI,yBAAyB,EACpC;QACIQ;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHnB,cAAc;IACdkB,eAAe;IACfN;EACJ,CAAC;AACL,CAAC;AAACc,OAAA,CAAAjC,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_get","_query","_batchRead","_batchWrite","_cleanup","_dbDynamodb","createRenderStorageOperations","params","entity","tagPathLinkEntity","createRenderPartitionKey","tenant","path","startsWith","replace","createRenderSortKey","createRenderGSI1PartitionKey","createRenderType","createTagPathLinkPartitionKey","tag","key","value","createTagPathLinkSortKey","values","push","join","createTagPathLinkGSI1PartitionKey","createTagPathLinkGSI1SortKey","createTagPathLinkType","getRender","where","keys","PK","SK","result","get","dbItem","cleanupItem","data","ex","WebinyError","message","code","createRender","render","put","item","TYPE","GSI1_PK","GSI1_SK","deleteRender","deleteItem","listRendersByTag","links","listTagPathLinks","items","map","link","getBatch","results","batchReadAll","table","cleanupItems","listRenders","queryAllParams","partitionKey","options","index","gte","queryAllClean","createTagPathLinks","tagPathLinks","putBatch","batchWriteAll","deleteTagPathLinks","tags","deleteBatch","beginsWith","queryAll","exports"],"sources":["render.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n PrerenderingServiceRenderStorageOperations,\n PrerenderingServiceStorageOperationsCreateRenderParams,\n PrerenderingServiceStorageOperationsCreateTagPathLinksParams,\n PrerenderingServiceStorageOperationsDeleteRenderParams,\n PrerenderingServiceStorageOperationsDeleteTagPathLinksParams,\n PrerenderingServiceStorageOperationsGetRenderParams,\n PrerenderingServiceStorageOperationsListRendersParams,\n PrerenderingServiceStorageOperationsListTagPathLinksParams,\n Render,\n Tag,\n TagPathLink\n} from \"@webiny/api-prerendering-service/types\";\nimport { Entity, EntityQueryOptions } from \"@webiny/db-dynamodb/toolbox\";\nimport { get } from \"@webiny/db-dynamodb/utils/get\";\nimport { queryAll, queryAllClean, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { cleanupItem, cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { DataContainer } from \"~/types\";\nimport { deleteItem, put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateRenderStorageOperationsParams {\n entity: Entity<any>;\n tagPathLinkEntity: Entity<any>;\n}\n\nexport interface CreateTagPathLinkPartitionKeyParams {\n tenant: string;\n tag: Tag;\n path: string;\n}\n\nexport interface CreateTagPathLinkGSI1PartitionKeyParams {\n tenant: string;\n tag: Tag;\n}\n\nexport interface CreateTagPathLinkSortKeyParams {\n tag: Tag;\n path?: string;\n}\n\nexport const createRenderStorageOperations = (\n params: CreateRenderStorageOperationsParams\n): PrerenderingServiceRenderStorageOperations => {\n const { entity, tagPathLinkEntity } = params;\n\n const createRenderPartitionKey = (tenant: string, path: string): string => {\n /**\n * For backwards compatibility remove the T# if it exists.\n */\n if (tenant.startsWith(\"T#\")) {\n tenant = tenant.replace(/^T#/, \"\");\n }\n return `T#${tenant}#PS#RENDER#${path}`;\n };\n\n const createRenderSortKey = (): string => {\n return \"A\";\n };\n\n const createRenderGSI1PartitionKey = (tenant: string): string => {\n return `T#${tenant}#PS#RENDER`;\n };\n\n const createRenderType = (): string => {\n return \"ps.render\";\n };\n\n const createTagPathLinkPartitionKey = (params: CreateTagPathLinkPartitionKeyParams): string => {\n const { tag, path } = params;\n let { tenant } = params;\n if (tenant.startsWith(\"T#\")) {\n tenant = tenant.replace(/^T#/, \"\");\n }\n return `T#${tenant}#PS#TAG#${tag.key}#${tag.value}#${path}`;\n };\n\n const createTagPathLinkSortKey = (params: CreateTagPathLinkSortKeyParams): string => {\n const { tag, path } = params;\n const values = [tag.value];\n if (path) {\n values.push(path);\n }\n return values.join(\"#\");\n };\n\n const createTagPathLinkGSI1PartitionKey = (\n params: CreateTagPathLinkGSI1PartitionKeyParams\n ): string => {\n let { tenant } = params;\n if (tenant.startsWith(\"T#\")) {\n tenant = tenant.replace(/^T#/, \"\");\n }\n return `T#${tenant}#PS#TAG`;\n };\n\n const createTagPathLinkGSI1SortKey = (params: CreateTagPathLinkSortKeyParams): string => {\n const { tag, path } = params;\n\n return `${tag.key}#${tag.value}#${path}`;\n };\n\n const createTagPathLinkType = (): string => {\n return \"ps.tagPathLink\";\n };\n\n const getRender = async (\n params: PrerenderingServiceStorageOperationsGetRenderParams\n ): Promise<Render | null> => {\n const { where } = params;\n\n const keys = {\n PK: createRenderPartitionKey(where.tenant, where.path),\n SK: createRenderSortKey()\n };\n\n try {\n const result = await get<DataContainer<Render>>({\n entity,\n keys\n });\n\n const dbItem = cleanupItem(entity, result);\n\n return dbItem ? dbItem.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get render record by given key.\",\n ex.code || \"GET_RENDER_ERROR\",\n {\n keys,\n params\n }\n );\n }\n };\n const createRender = async (params: PrerenderingServiceStorageOperationsCreateRenderParams) => {\n const { render } = params;\n\n const keys = {\n PK: createRenderPartitionKey(render.tenant, render.path),\n SK: createRenderSortKey()\n };\n\n try {\n await put({\n entity,\n item: {\n ...keys,\n data: render,\n TYPE: createRenderType(),\n GSI1_PK: createRenderGSI1PartitionKey(render.tenant),\n GSI1_SK: render.path\n }\n });\n\n return render;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create render record.\",\n ex.code || \"CREATE_RENDER_ERROR\",\n {\n keys,\n render\n }\n );\n }\n };\n const deleteRender = async (\n params: PrerenderingServiceStorageOperationsDeleteRenderParams\n ): Promise<void> => {\n const { render } = params;\n\n const keys = {\n PK: createRenderPartitionKey(render.tenant, render.path),\n SK: createRenderSortKey()\n };\n\n try {\n await deleteItem({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete render record.\",\n ex.code || \"DELETE_RENDER_ERROR\",\n {\n keys,\n render\n }\n );\n }\n };\n\n const listRendersByTag = async (\n params: PrerenderingServiceStorageOperationsListRendersParams\n ) => {\n const { where } = params;\n const { tenant, tag } = where;\n /**\n * Possibly there is no tag.key so no need to go further\n */\n if (!tag || !tag.key) {\n return [];\n }\n\n const links = await listTagPathLinks({\n where: {\n tenant,\n tag\n }\n });\n\n const items = links.map(link => {\n return entity.getBatch({\n PK: createRenderPartitionKey(tenant, link.path),\n SK: createRenderSortKey()\n });\n });\n try {\n const results = await batchReadAll<DataContainer<Render>>({\n table: entity.table,\n items\n });\n return cleanupItems(entity, results).map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list render records after links.\",\n ex.code || \"LIST_LINKS_RENDER_ERROR\",\n {\n links\n }\n );\n }\n };\n\n const listRenders = async (params: PrerenderingServiceStorageOperationsListRendersParams) => {\n const { where } = params;\n const { tenant, tag } = where;\n\n if (tag) {\n return listRendersByTag(params);\n }\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createRenderGSI1PartitionKey(tenant),\n options: {\n index: \"GSI1\",\n gte: \" \"\n }\n };\n\n try {\n const results = await queryAllClean<DataContainer<Render>>(queryAllParams);\n\n return results.map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list render records.\",\n ex.code || \"LIST_RENDER_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n };\n\n const createTagPathLinks = async (\n params: PrerenderingServiceStorageOperationsCreateTagPathLinksParams\n ) => {\n const { tagPathLinks } = params;\n\n const items = tagPathLinks.map(item => {\n return tagPathLinkEntity.putBatch({\n data: item,\n TYPE: createTagPathLinkType(),\n PK: createTagPathLinkPartitionKey({\n tenant: item.tenant,\n tag: item,\n path: item.path\n }),\n SK: createTagPathLinkSortKey({\n tag: item,\n path: item.path\n }),\n GSI1_PK: createTagPathLinkGSI1PartitionKey({ tag: item, tenant: item.tenant }),\n GSI1_SK: createTagPathLinkGSI1SortKey({ tag: item, path: item.path })\n });\n });\n\n try {\n await batchWriteAll({\n table: tagPathLinkEntity.table,\n items\n });\n return tagPathLinks;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create tagPathLink records.\",\n ex.code || \"CREATE_URL_TAG_LINKS_ERROR\",\n {\n tagPathLinks\n }\n );\n }\n };\n\n const deleteTagPathLinks = async (\n params: PrerenderingServiceStorageOperationsDeleteTagPathLinksParams\n ): Promise<void> => {\n const { tenant, tags, path } = params;\n const items = tags.map(tag => {\n return tagPathLinkEntity.deleteBatch({\n PK: createTagPathLinkPartitionKey({\n tag,\n tenant,\n path\n }),\n SK: createTagPathLinkSortKey({\n tag,\n path\n })\n });\n });\n\n try {\n await batchWriteAll({\n table: tagPathLinkEntity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete tagPathLink records.\",\n ex.code || \"DELETE_URL_TAG_LINKS_ERROR\",\n {\n tags,\n tenant,\n path\n }\n );\n }\n };\n\n const listTagPathLinks = async (\n params: PrerenderingServiceStorageOperationsListTagPathLinksParams\n ) => {\n const { where } = params;\n const { tenant, tag } = where;\n\n const partitionKey = createTagPathLinkGSI1PartitionKey({\n tenant,\n tag\n });\n\n const options: EntityQueryOptions = {\n index: \"GSI1\"\n };\n\n if (tag.value) {\n options.beginsWith = `${tag.key}#${tag.value}#`;\n } else {\n options.beginsWith = `${tag.key}#`;\n }\n\n const queryAllParams: QueryAllParams = {\n entity: tagPathLinkEntity,\n partitionKey,\n options\n };\n\n try {\n const results = await queryAll<DataContainer<TagPathLink>>(queryAllParams);\n\n return cleanupItems(tagPathLinkEntity, results).map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list tagPathLink records.\",\n ex.code || \"LIST_TAG_PATH_LINK_ERROR\",\n {\n partitionKey,\n options\n }\n );\n }\n };\n\n return {\n createRender,\n deleteRender,\n listRenders,\n getRender,\n createTagPathLinks,\n deleteTagPathLinks,\n listTagPathLinks\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAeA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AAuBO,MAAMO,6BAA6B,GACtCC,MAA2C,IACE;EAC7C,MAAM;IAAEC,MAAM;IAAEC;EAAkB,CAAC,GAAGF,MAAM;EAE5C,MAAMG,wBAAwB,GAAGA,CAACC,MAAc,EAAEC,IAAY,KAAa;IACvE;AACR;AACA;IACQ,IAAID,MAAM,CAACE,UAAU,CAAC,IAAI,CAAC,EAAE;MACzBF,MAAM,GAAGA,MAAM,CAACG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IACtC;IACA,OAAQ,KAAIH,MAAO,cAAaC,IAAK,EAAC;EAC1C,CAAC;EAED,MAAMG,mBAAmB,GAAGA,CAAA,KAAc;IACtC,OAAO,GAAG;EACd,CAAC;EAED,MAAMC,4BAA4B,GAAIL,MAAc,IAAa;IAC7D,OAAQ,KAAIA,MAAO,YAAW;EAClC,CAAC;EAED,MAAMM,gBAAgB,GAAGA,CAAA,KAAc;IACnC,OAAO,WAAW;EACtB,CAAC;EAED,MAAMC,6BAA6B,GAAIX,MAA2C,IAAa;IAC3F,MAAM;MAAEY,GAAG;MAAEP;IAAK,CAAC,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AAM4C,cAA8B,GAAG;MACnCxD,MAAM,EAAEC,iBAAiB;MACzBwD,YAAY;MACZC;IACJ,CAAC;IAED,IAAI;MACA,MAAMP,OAAO,GAAG,MAAM,IAAAmB,eAAQ,EAA6Bd,cAAc,CAAC;MAE1E,OAAO,IAAAF,qBAAY,EAACrD,iBAAiB,EAAEkD,OAAO,CAAC,CAACH,GAAG,CAACV,IAAI,IAAIA,IAAI,CAACR,IAAI,CAAC;IAC1E,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,qCAAqC,EACnDF,EAAE,CAACG,IAAI,IAAI,0BAA0B,EACrC;QACIuB,YAAY;QACZC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHvB,YAAY;IACZO,YAAY;IACZa,WAAW;IACXlC,SAAS;IACTyC,kBAAkB;IAClBI,kBAAkB;IAClBpB;EACJ,CAAC;AACL,CAAC;AAACyB,OAAA,CAAAzE,6BAAA,GAAAA,6BAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_get","_query","_batchRead","_batchWrite","_cleanup","_dbDynamodb","createRenderStorageOperations","params","entity","tagPathLinkEntity","createRenderPartitionKey","tenant","path","startsWith","replace","createRenderSortKey","createRenderGSI1PartitionKey","createRenderType","createTagPathLinkPartitionKey","tag","key","value","createTagPathLinkSortKey","values","push","join","createTagPathLinkGSI1PartitionKey","createTagPathLinkGSI1SortKey","createTagPathLinkType","getRender","where","keys","PK","SK","result","get","dbItem","cleanupItem","data","ex","WebinyError","message","code","createRender","render","put","item","TYPE","GSI1_PK","GSI1_SK","deleteRender","deleteItem","listRendersByTag","links","listTagPathLinks","items","map","link","getBatch","results","batchReadAll","table","cleanupItems","listRenders","queryAllParams","partitionKey","options","index","gte","queryAllClean","createTagPathLinks","tagPathLinks","putBatch","batchWriteAll","deleteTagPathLinks","tags","deleteBatch","beginsWith","queryAll","exports"],"sources":["render.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n PrerenderingServiceRenderStorageOperations,\n PrerenderingServiceStorageOperationsCreateRenderParams,\n PrerenderingServiceStorageOperationsCreateTagPathLinksParams,\n PrerenderingServiceStorageOperationsDeleteRenderParams,\n PrerenderingServiceStorageOperationsDeleteTagPathLinksParams,\n PrerenderingServiceStorageOperationsGetRenderParams,\n PrerenderingServiceStorageOperationsListRendersParams,\n PrerenderingServiceStorageOperationsListTagPathLinksParams,\n Render,\n Tag,\n TagPathLink\n} from \"@webiny/api-prerendering-service/types\";\nimport { Entity, EntityQueryOptions } from \"@webiny/db-dynamodb/toolbox\";\nimport { get } from \"@webiny/db-dynamodb/utils/get\";\nimport { queryAll, queryAllClean, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { cleanupItem, cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { DataContainer } from \"~/types\";\nimport { deleteItem, put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateRenderStorageOperationsParams {\n entity: Entity<any>;\n tagPathLinkEntity: Entity<any>;\n}\n\nexport interface CreateTagPathLinkPartitionKeyParams {\n tenant: string;\n tag: Tag;\n path: string;\n}\n\nexport interface CreateTagPathLinkGSI1PartitionKeyParams {\n tenant: string;\n tag: Tag;\n}\n\nexport interface CreateTagPathLinkSortKeyParams {\n tag: Tag;\n path?: string;\n}\n\nexport const createRenderStorageOperations = (\n params: CreateRenderStorageOperationsParams\n): PrerenderingServiceRenderStorageOperations => {\n const { entity, tagPathLinkEntity } = params;\n\n const createRenderPartitionKey = (tenant: string, path: string): string => {\n /**\n * For backwards compatibility remove the T# if it exists.\n */\n if (tenant.startsWith(\"T#\")) {\n tenant = tenant.replace(/^T#/, \"\");\n }\n return `T#${tenant}#PS#RENDER#${path}`;\n };\n\n const createRenderSortKey = (): string => {\n return \"A\";\n };\n\n const createRenderGSI1PartitionKey = (tenant: string): string => {\n return `T#${tenant}#PS#RENDER`;\n };\n\n const createRenderType = (): string => {\n return \"ps.render\";\n };\n\n const createTagPathLinkPartitionKey = (params: CreateTagPathLinkPartitionKeyParams): string => {\n const { tag, path } = params;\n let { tenant } = params;\n if (tenant.startsWith(\"T#\")) {\n tenant = tenant.replace(/^T#/, \"\");\n }\n return `T#${tenant}#PS#TAG#${tag.key}#${tag.value}#${path}`;\n };\n\n const createTagPathLinkSortKey = (params: CreateTagPathLinkSortKeyParams): string => {\n const { tag, path } = params;\n const values = [tag.value];\n if (path) {\n values.push(path);\n }\n return values.join(\"#\");\n };\n\n const createTagPathLinkGSI1PartitionKey = (\n params: CreateTagPathLinkGSI1PartitionKeyParams\n ): string => {\n let { tenant } = params;\n if (tenant.startsWith(\"T#\")) {\n tenant = tenant.replace(/^T#/, \"\");\n }\n return `T#${tenant}#PS#TAG`;\n };\n\n const createTagPathLinkGSI1SortKey = (params: CreateTagPathLinkSortKeyParams): string => {\n const { tag, path } = params;\n\n return `${tag.key}#${tag.value}#${path}`;\n };\n\n const createTagPathLinkType = (): string => {\n return \"ps.tagPathLink\";\n };\n\n const getRender = async (\n params: PrerenderingServiceStorageOperationsGetRenderParams\n ): Promise<Render | null> => {\n const { where } = params;\n\n const keys = {\n PK: createRenderPartitionKey(where.tenant, where.path),\n SK: createRenderSortKey()\n };\n\n try {\n const result = await get<DataContainer<Render>>({\n entity,\n keys\n });\n\n const dbItem = cleanupItem(entity, result);\n\n return dbItem ? dbItem.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get render record by given key.\",\n ex.code || \"GET_RENDER_ERROR\",\n {\n keys,\n params\n }\n );\n }\n };\n const createRender = async (params: PrerenderingServiceStorageOperationsCreateRenderParams) => {\n const { render } = params;\n\n const keys = {\n PK: createRenderPartitionKey(render.tenant, render.path),\n SK: createRenderSortKey()\n };\n\n try {\n await put({\n entity,\n item: {\n ...keys,\n data: render,\n TYPE: createRenderType(),\n GSI1_PK: createRenderGSI1PartitionKey(render.tenant),\n GSI1_SK: render.path\n }\n });\n\n return render;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create render record.\",\n ex.code || \"CREATE_RENDER_ERROR\",\n {\n keys,\n render\n }\n );\n }\n };\n const deleteRender = async (\n params: PrerenderingServiceStorageOperationsDeleteRenderParams\n ): Promise<void> => {\n const { render } = params;\n\n const keys = {\n PK: createRenderPartitionKey(render.tenant, render.path),\n SK: createRenderSortKey()\n };\n\n try {\n await deleteItem({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete render record.\",\n ex.code || \"DELETE_RENDER_ERROR\",\n {\n keys,\n render\n }\n );\n }\n };\n\n const listRendersByTag = async (\n params: PrerenderingServiceStorageOperationsListRendersParams\n ) => {\n const { where } = params;\n const { tenant, tag } = where;\n /**\n * Possibly there is no tag.key so no need to go further\n */\n if (!tag || !tag.key) {\n return [];\n }\n\n const links = await listTagPathLinks({\n where: {\n tenant,\n tag\n }\n });\n\n const items = links.map(link => {\n return entity.getBatch({\n PK: createRenderPartitionKey(tenant, link.path),\n SK: createRenderSortKey()\n });\n });\n try {\n const results = await batchReadAll<DataContainer<Render>>({\n table: entity.table,\n items\n });\n return cleanupItems(entity, results).map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list render records after links.\",\n ex.code || \"LIST_LINKS_RENDER_ERROR\",\n {\n links\n }\n );\n }\n };\n\n const listRenders = async (params: PrerenderingServiceStorageOperationsListRendersParams) => {\n const { where } = params;\n const { tenant, tag } = where;\n\n if (tag) {\n return listRendersByTag(params);\n }\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createRenderGSI1PartitionKey(tenant),\n options: {\n index: \"GSI1\",\n gte: \" \"\n }\n };\n\n try {\n const results = await queryAllClean<DataContainer<Render>>(queryAllParams);\n\n return results.map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list render records.\",\n ex.code || \"LIST_RENDER_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n };\n\n const createTagPathLinks = async (\n params: PrerenderingServiceStorageOperationsCreateTagPathLinksParams\n ) => {\n const { tagPathLinks } = params;\n\n const items = tagPathLinks.map(item => {\n return tagPathLinkEntity.putBatch({\n data: item,\n TYPE: createTagPathLinkType(),\n PK: createTagPathLinkPartitionKey({\n tenant: item.tenant,\n tag: item,\n path: item.path\n }),\n SK: createTagPathLinkSortKey({\n tag: item,\n path: item.path\n }),\n GSI1_PK: createTagPathLinkGSI1PartitionKey({ tag: item, tenant: item.tenant }),\n GSI1_SK: createTagPathLinkGSI1SortKey({ tag: item, path: item.path })\n });\n });\n\n try {\n await batchWriteAll({\n table: tagPathLinkEntity.table,\n items\n });\n return tagPathLinks;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create tagPathLink records.\",\n ex.code || \"CREATE_URL_TAG_LINKS_ERROR\",\n {\n tagPathLinks\n }\n );\n }\n };\n\n const deleteTagPathLinks = async (\n params: PrerenderingServiceStorageOperationsDeleteTagPathLinksParams\n ): Promise<void> => {\n const { tenant, tags, path } = params;\n const items = tags.map(tag => {\n return tagPathLinkEntity.deleteBatch({\n PK: createTagPathLinkPartitionKey({\n tag,\n tenant,\n path\n }),\n SK: createTagPathLinkSortKey({\n tag,\n path\n })\n });\n });\n\n try {\n await batchWriteAll({\n table: tagPathLinkEntity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete tagPathLink records.\",\n ex.code || \"DELETE_URL_TAG_LINKS_ERROR\",\n {\n tags,\n tenant,\n path\n }\n );\n }\n };\n\n const listTagPathLinks = async (\n params: PrerenderingServiceStorageOperationsListTagPathLinksParams\n ) => {\n const { where } = params;\n const { tenant, tag } = where;\n\n const partitionKey = createTagPathLinkGSI1PartitionKey({\n tenant,\n tag\n });\n\n const options: EntityQueryOptions = {\n index: \"GSI1\"\n };\n\n if (tag.value) {\n options.beginsWith = `${tag.key}#${tag.value}#`;\n } else {\n options.beginsWith = `${tag.key}#`;\n }\n\n const queryAllParams: QueryAllParams = {\n entity: tagPathLinkEntity,\n partitionKey,\n options\n };\n\n try {\n const results = await queryAll<DataContainer<TagPathLink>>(queryAllParams);\n\n return cleanupItems(tagPathLinkEntity, results).map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list tagPathLink records.\",\n ex.code || \"LIST_TAG_PATH_LINK_ERROR\",\n {\n partitionKey,\n options\n }\n );\n }\n };\n\n return {\n createRender,\n deleteRender,\n listRenders,\n getRender,\n createTagPathLinks,\n deleteTagPathLinks,\n listTagPathLinks\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAeA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AAuBO,MAAMO,6BAA6B,GACtCC,MAA2C,IACE;EAC7C,MAAM;IAAEC,MAAM;IAAEC;EAAkB,CAAC,GAAGF,MAAM;EAE5C,MAAMG,wBAAwB,GAAGA,CAACC,MAAc,EAAEC,IAAY,KAAa;IACvE;AACR;AACA;IACQ,IAAID,MAAM,CAACE,UAAU,CAAC,IAAI,CAAC,EAAE;MACzBF,MAAM,GAAGA,MAAM,CAACG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IACtC;IACA,OAAQ,KAAIH,MAAO,cAAaC,IAAK,EAAC;EAC1C,CAAC;EAED,MAAMG,mBAAmB,GAAGA,CAAA,KAAc;IACtC,OAAO,GAAG;EACd,CAAC;EAED,MAAMC,4BAA4B,GAAIL,MAAc,IAAa;IAC7D,OAAQ,KAAIA,MAAO,YAAW;EAClC,CAAC;EAED,MAAMM,gBAAgB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AACC,GAAI,IAAGD,GAAG,CAACE,KAAM,GAAE;IACnD,CAAC,MAAM;MACH6C,OAAO,CAACW,UAAU,GAAI,GAAE1D,GAAG,CAACC,GAAI,GAAE;IACtC;IAEA,MAAM4C,cAA8B,GAAG;MACnCxD,MAAM,EAAEC,iBAAiB;MACzBwD,YAAY;MACZC;IACJ,CAAC;IAED,IAAI;MACA,MAAMP,OAAO,GAAG,MAAM,IAAAmB,eAAQ,EAA6Bd,cAAc,CAAC;MAE1E,OAAO,IAAAF,qBAAY,EAACrD,iBAAiB,EAAEkD,OAAO,CAAC,CAACH,GAAG,CAACV,IAAI,IAAIA,IAAI,CAACR,IAAI,CAAC;IAC1E,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,qCAAqC,EACnDF,EAAE,CAACG,IAAI,IAAI,0BAA0B,EACrC;QACIuB,YAAY;QACZC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHvB,YAAY;IACZO,YAAY;IACZa,WAAW;IACXlC,SAAS;IACTyC,kBAAkB;IAClBI,kBAAkB;IAClBpB;EACJ,CAAC;AACL,CAAC;AAACyB,OAAA,CAAAzE,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_get","_dbDynamodb","createSettingsStorageOperations","params","entity","getSettings","variant","keys","PK","SK","result","get","Error","data","ex","WebinyError","message","code","saveSettings","settings","put","item","TYPE","exports"],"sources":["settings.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n PrerenderingServiceSaveSettingsParams,\n PrerenderingServiceSettingsStorageOperations,\n PrerenderingSettings\n} from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { get } from \"@webiny/db-dynamodb/utils/get\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateSettingsStorageOperationsParams {\n entity: Entity<any>;\n}\n\nexport const createSettingsStorageOperations = (\n params: CreateSettingsStorageOperationsParams\n): PrerenderingServiceSettingsStorageOperations => {\n const { entity } = params;\n\n const getSettings = async (variant = \"default\"): Promise<PrerenderingSettings> => {\n const keys = {\n PK: \"PS#SETTINGS\",\n SK: variant\n };\n\n try {\n const result = await get<{ data: PrerenderingSettings }>({\n entity,\n keys\n });\n\n if (!result) {\n throw Error();\n }\n\n return result.data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load prerendering settings!\",\n ex.code || \"GET_SETTINGS_ERROR\",\n {\n keys,\n params\n }\n );\n }\n };\n\n const saveSettings = async (params: PrerenderingServiceSaveSettingsParams) => {\n const { settings, variant = \"default\" } = params;\n const keys = {\n PK: \"PS#SETTINGS\",\n SK: variant\n };\n\n try {\n await put({\n entity,\n item: {\n ...keys,\n TYPE: \"ps.settings\",\n data: settings\n }\n });\n\n return settings;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not save settings.\",\n ex.code || \"SAVE_SETTINGS_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n return {\n getSettings,\n saveSettings\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAOA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMO,MAAMG,+BAA+B,GACxCC,MAA6C,IACE;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,WAAW,GAAG,MAAAA,CAAOC,OAAO,GAAG,SAAS,KAAoC;IAC9E,MAAMC,IAAI,GAAG;MACTC,EAAE,EAAE,aAAa;MACjBC,EAAE,EAAEH;IACR,CAAC;IAED,IAAI;MACA,MAAMI,MAAM,GAAG,MAAM,IAAAC,QAAG,EAAiC;QACrDP,MAAM;QACNG;MACJ,CAAC,CAAC;MAEF,IAAI,CAACG,MAAM,EAAE;QACT,MAAME,KAAK,CAAC,CAAC;MACjB;MAEA,OAAOF,MAAM,CAACG,IAAI;IACtB,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,uCAAuC,EACrDF,EAAE,CAACG,IAAI,IAAI,oBAAoB,EAC/B;QACIV,IAAI;QACJJ;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMe,YAAY,GAAG,MAAOf,MAA6C,IAAK;IAC1E,MAAM;MAAEgB,QAAQ;MAAEb,OAAO,GAAG;IAAU,CAAC,GAAGH,MAAM;IAChD,MAAMI,IAAI,GAAG;MACTC,EAAE,EAAE,aAAa;MACjBC,EAAE,EAAEH;IACR,CAAC;IAED,IAAI;MACA,MAAM,IAAAc,eAAG,EAAC;QACNhB,MAAM;QACNiB,IAAI,EAAE;UACF,GAAGd,IAAI;UACPe,IAAI,EAAE,aAAa;UACnBT,IAAI,EAAEM;QACV;MACJ,CAAC,CAAC;MAEF,OAAOA,QAAQ;IACnB,CAAC,CAAC,OAAOL,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIV;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHF,WAAW;IACXa;EACJ,CAAC;AACL,CAAC;AAACK,OAAA,CAAArB,+BAAA,GAAAA,+BAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_get","_dbDynamodb","createSettingsStorageOperations","params","entity","getSettings","variant","keys","PK","SK","result","get","Error","data","ex","WebinyError","message","code","saveSettings","settings","put","item","TYPE","exports"],"sources":["settings.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n PrerenderingServiceSaveSettingsParams,\n PrerenderingServiceSettingsStorageOperations,\n PrerenderingSettings\n} from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { get } from \"@webiny/db-dynamodb/utils/get\";\nimport { put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateSettingsStorageOperationsParams {\n entity: Entity<any>;\n}\n\nexport const createSettingsStorageOperations = (\n params: CreateSettingsStorageOperationsParams\n): PrerenderingServiceSettingsStorageOperations => {\n const { entity } = params;\n\n const getSettings = async (variant = \"default\"): Promise<PrerenderingSettings> => {\n const keys = {\n PK: \"PS#SETTINGS\",\n SK: variant\n };\n\n try {\n const result = await get<{ data: PrerenderingSettings }>({\n entity,\n keys\n });\n\n if (!result) {\n throw Error();\n }\n\n return result.data;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load prerendering settings!\",\n ex.code || \"GET_SETTINGS_ERROR\",\n {\n keys,\n params\n }\n );\n }\n };\n\n const saveSettings = async (params: PrerenderingServiceSaveSettingsParams) => {\n const { settings, variant = \"default\" } = params;\n const keys = {\n PK: \"PS#SETTINGS\",\n SK: variant\n };\n\n try {\n await put({\n entity,\n item: {\n ...keys,\n TYPE: \"ps.settings\",\n data: settings\n }\n });\n\n return settings;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not save settings.\",\n ex.code || \"SAVE_SETTINGS_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n return {\n getSettings,\n saveSettings\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAOA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMO,MAAMG,+BAA+B,GACxCC,MAA6C,IACE;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,WAAW,GAAG,MAAAA,CAAOC,OAAO,GAAG,SAAS,KAAoC;IAC9E,MAAMC,IAAI,GAAG;MACTC,EAAE,EAAE,aAAa;MACjBC,EAAE,EAAEH;IACR,CAAC;IAED,IAAI;MACA,MAAMI,MAAM,GAAG,MAAM,IAAAC,QAAG,EAAiC;QACrDP,MAAM;QACNG;MACJ,CAAC,CAAC;MAEF,IAAI,CAACG,MAAM,EAAE;QACT,MAAME,KAAK,CAAC,CAAC;MACjB;MAEA,OAAOF,MAAM,CAACG,IAAI;IACtB,CAAC,CAAC,OAAOC,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,uCAAuC,EACrDF,EAAE,CAACG,IAAI,IAAI,oBAAoB,EAC/B;QACIV,IAAI;QACJJ;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMe,YAAY,GAAG,MAAOf,MAA6C,IAAK;IAC1E,MAAM;MAAEgB,QAAQ;MAAEb,OAAO,GAAG;IAAU,CAAC,GAAGH,MAAM;IAChD,MAAMI,IAAI,GAAG;MACTC,EAAE,EAAE,aAAa;MACjBC,EAAE,EAAEH;IACR,CAAC;IAED,IAAI;MACA,MAAM,IAAAc,eAAG,EAAC;QACNhB,MAAM;QACNiB,IAAI,EAAE;UACF,GAAGd,IAAI;UACPe,IAAI,EAAE,aAAa;UACnBT,IAAI,EAAEM;QACV;MACJ,CAAC,CAAC;MAEF,OAAOA,QAAQ;IACnB,CAAC,CAAC,OAAOL,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIV;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHF,WAAW;IACXa;EACJ,CAAC;AACL,CAAC;AAACK,OAAA,CAAArB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_query","require","createTenantStorageOperations","params","entity","getTenantIds","tenants","queryAll","partitionKey","options","index","gt","map","tenant","data","id","exports"],"sources":["tenant.ts"],"sourcesContent":["import { PrerenderingServiceTenantStorageOperations } from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { queryAll } from \"@webiny/db-dynamodb/utils/query\";\n\nexport interface CreateTenantStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface Tenant {\n data: { id: string };\n}\n\nexport const createTenantStorageOperations = (\n params: CreateTenantStorageOperationsParams\n): PrerenderingServiceTenantStorageOperations => {\n const { entity } = params;\n\n const getTenantIds = async (): Promise<string[]> => {\n const tenants = await queryAll<Tenant>({\n entity,\n partitionKey: \"TENANTS\",\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n return tenants.map(tenant => tenant.data.id);\n };\n\n return { getTenantIds };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAUO,MAAMC,6BAA6B,GACtCC,MAA2C,IACE;EAC7C,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,YAAY,GAAG,MAAAA,CAAA,KAA+B;IAChD,MAAMC,OAAO,GAAG,MAAM,IAAAC,eAAQ,EAAS;MACnCH,MAAM;MACNI,YAAY,EAAE,SAAS;MACvBC,OAAO,EAAE;QACLC,KAAK,EAAE,MAAM;QACbC,EAAE,EAAE;MACR;IACJ,CAAC,CAAC;IAEF,OAAOL,OAAO,CAACM,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACC,IAAI,CAACC,EAAE,CAAC;EAChD,CAAC;EAED,OAAO;IAAEV;EAAa,CAAC;AAC3B,CAAC;AAACW,OAAA,CAAAd,6BAAA,GAAAA,6BAAA"}
1
+ {"version":3,"names":["_query","require","createTenantStorageOperations","params","entity","getTenantIds","tenants","queryAll","partitionKey","options","index","gt","map","tenant","data","id","exports"],"sources":["tenant.ts"],"sourcesContent":["import { PrerenderingServiceTenantStorageOperations } from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { queryAll } from \"@webiny/db-dynamodb/utils/query\";\n\nexport interface CreateTenantStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface Tenant {\n data: { id: string };\n}\n\nexport const createTenantStorageOperations = (\n params: CreateTenantStorageOperationsParams\n): PrerenderingServiceTenantStorageOperations => {\n const { entity } = params;\n\n const getTenantIds = async (): Promise<string[]> => {\n const tenants = await queryAll<Tenant>({\n entity,\n partitionKey: \"TENANTS\",\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n return tenants.map(tenant => tenant.data.id);\n };\n\n return { getTenantIds };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAUO,MAAMC,6BAA6B,GACtCC,MAA2C,IACE;EAC7C,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,YAAY,GAAG,MAAAA,CAAA,KAA+B;IAChD,MAAMC,OAAO,GAAG,MAAM,IAAAC,eAAQ,EAAS;MACnCH,MAAM;MACNI,YAAY,EAAE,SAAS;MACvBC,OAAO,EAAE;QACLC,KAAK,EAAE,MAAM;QACbC,EAAE,EAAE;MACR;IACJ,CAAC,CAAC;IAEF,OAAOL,OAAO,CAACM,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACC,IAAI,CAACC,EAAE,CAAC;EAChD,CAAC;EAED,OAAO;IAAEV;EAAa,CAAC;AAC3B,CAAC;AAACW,OAAA,CAAAd,6BAAA,GAAAA,6BAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-prerendering-service-so-ddb",
3
- "version": "5.40.0-beta.2",
3
+ "version": "5.40.0-beta.3",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,25 +18,25 @@
18
18
  "author": "Webiny Ltd",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@babel/runtime": "7.22.6",
22
- "@webiny/api-prerendering-service": "5.40.0-beta.2",
23
- "@webiny/aws-sdk": "5.40.0-beta.2",
24
- "@webiny/error": "5.40.0-beta.2"
21
+ "@babel/runtime": "7.24.1",
22
+ "@webiny/api-prerendering-service": "5.40.0-beta.3",
23
+ "@webiny/aws-sdk": "5.40.0-beta.3",
24
+ "@webiny/error": "5.40.0-beta.3"
25
25
  },
26
26
  "devDependencies": {
27
- "@babel/cli": "7.22.6",
28
- "@babel/core": "7.22.8",
29
- "@babel/plugin-proposal-export-default-from": "7.18.10",
30
- "@babel/preset-env": "7.22.7",
31
- "@babel/preset-typescript": "7.22.5",
32
- "@webiny/cli": "5.40.0-beta.2",
33
- "@webiny/db": "5.40.0-beta.2",
34
- "@webiny/db-dynamodb": "5.40.0-beta.2",
35
- "@webiny/handler-aws": "5.40.0-beta.2",
36
- "@webiny/project-utils": "5.40.0-beta.2",
27
+ "@babel/cli": "7.24.1",
28
+ "@babel/core": "7.24.3",
29
+ "@babel/plugin-proposal-export-default-from": "7.24.1",
30
+ "@babel/preset-env": "7.24.3",
31
+ "@babel/preset-typescript": "7.24.1",
32
+ "@webiny/cli": "5.40.0-beta.3",
33
+ "@webiny/db": "5.40.0-beta.3",
34
+ "@webiny/db-dynamodb": "5.40.0-beta.3",
35
+ "@webiny/handler-aws": "5.40.0-beta.3",
36
+ "@webiny/project-utils": "5.40.0-beta.3",
37
37
  "jest-dynalite": "3.6.1",
38
38
  "prettier": "2.8.8",
39
- "rimraf": "3.0.2",
39
+ "rimraf": "5.0.5",
40
40
  "ttypescript": "1.5.15",
41
41
  "typescript": "4.7.4"
42
42
  },
@@ -48,5 +48,5 @@
48
48
  "build": "yarn webiny run build",
49
49
  "watch": "yarn webiny run watch"
50
50
  },
51
- "gitHead": "15e414a228687140ce2f30bd2f55763368e99827"
51
+ "gitHead": "638d8b84063906cd1aa979ed6e0487ad26fbcf2f"
52
52
  }
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
1
+ import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
2
2
  import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
3
3
  import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
4
  import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
@@ -12,7 +12,7 @@ export declare enum ENTITIES {
12
12
  TENANT = "Tenant"
13
13
  }
14
14
  export interface PrerenderingServiceFactoryParams {
15
- documentClient: DynamoDBClient;
15
+ documentClient: DynamoDBDocument;
16
16
  table?: TableModifier;
17
17
  attributes?: Record<ENTITIES, Attributes>;
18
18
  }
package/types.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ENTITIES = void 0;
7
- let ENTITIES = /*#__PURE__*/function (ENTITIES) {
7
+ let ENTITIES = exports.ENTITIES = /*#__PURE__*/function (ENTITIES) {
8
8
  ENTITIES["RENDER"] = "PrerenderingServiceRender";
9
9
  ENTITIES["SETTINGS"] = "PrerenderingServiceSettings";
10
10
  ENTITIES["QUEUE_JOB"] = "PrerenderingServiceQueueJob";
@@ -12,6 +12,5 @@ let ENTITIES = /*#__PURE__*/function (ENTITIES) {
12
12
  ENTITIES["TENANT"] = "Tenant";
13
13
  return ENTITIES;
14
14
  }({});
15
- exports.ENTITIES = ENTITIES;
16
15
 
17
16
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\nimport { PrerenderingServiceStorageOperations as BasePrerenderingServiceStorageOperations } from \"@webiny/api-prerendering-service/types\";\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n RENDER = \"PrerenderingServiceRender\",\n SETTINGS = \"PrerenderingServiceSettings\",\n QUEUE_JOB = \"PrerenderingServiceQueueJob\",\n TAG_PATH_LINK = \"PrerenderingServiceTagPathLink\",\n TENANT = \"Tenant\"\n}\n\nexport interface PrerenderingServiceFactoryParams {\n documentClient: DynamoDBClient;\n table?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n}\n\nexport type Entities = \"render\" | \"queueJob\" | \"tagPathLink\";\n\nexport interface PrerenderingServiceStorageOperations\n extends BasePrerenderingServiceStorageOperations {\n getTable(): Table<string, string, string>;\n getEntities(): Record<Entities, Entity<any>>;\n}\n\nexport interface PrerenderingServiceFactory {\n (params: PrerenderingServiceFactoryParams): PrerenderingServiceStorageOperations;\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface DataContainer<T> {\n PK: string;\n SK: string;\n data: T;\n}\n"],"mappings":";;;;;;IAQYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAAC,OAAA,CAAAD,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\nimport { PrerenderingServiceStorageOperations as BasePrerenderingServiceStorageOperations } from \"@webiny/api-prerendering-service/types\";\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n RENDER = \"PrerenderingServiceRender\",\n SETTINGS = \"PrerenderingServiceSettings\",\n QUEUE_JOB = \"PrerenderingServiceQueueJob\",\n TAG_PATH_LINK = \"PrerenderingServiceTagPathLink\",\n TENANT = \"Tenant\"\n}\n\nexport interface PrerenderingServiceFactoryParams {\n documentClient: DynamoDBDocument;\n table?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n}\n\nexport type Entities = \"render\" | \"queueJob\" | \"tagPathLink\";\n\nexport interface PrerenderingServiceStorageOperations\n extends BasePrerenderingServiceStorageOperations {\n getTable(): Table<string, string, string>;\n getEntities(): Record<Entities, Entity<any>>;\n}\n\nexport interface PrerenderingServiceFactory {\n (params: PrerenderingServiceFactoryParams): PrerenderingServiceStorageOperations;\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface DataContainer<T> {\n PK: string;\n SK: string;\n data: T;\n}\n"],"mappings":";;;;;;IAQYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}