@webiny/api-prerendering-service-so-ddb 0.0.0-unstable.de38392959 → 0.0.0-unstable.e0bfc55d5a

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,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  export interface CreateQueueJobEntityParams {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  export interface CreateRenderEntityParams {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  export interface CreateRenderEntityParams {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  export interface CreateSettingsEntityParams {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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 type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
2
2
  import { Table } from "@webiny/db-dynamodb/toolbox";
3
- import { TableModifier } from "../types";
3
+ import type { 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 type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport type { TableModifier } from \"~/types\";\nimport type { 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,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  interface CreateTagPathLinkEntityParams {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  interface CreateTagUrlLinkEntityParams {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,4 +1,5 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
2
3
  interface Params {
3
4
  table: Table<string, string, string>;
4
5
  entityName: string;
@@ -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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } 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":";;;;;;AACA,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.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { PrerenderingServiceFactory } from "./types";
1
+ import type { PrerenderingServiceFactory } from "./types";
2
2
  export declare const createPrerenderingServiceStorageOperations: PrerenderingServiceFactory;
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,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;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGH,MAAM;EAEpD,IAAIC,UAAU,EAAE;IACZG,MAAM,CAACC,MAAM,CAACJ,UAAU,CAAC,CAACK,OAAO,CAACC,KAAK,IAAI;MACvCH,MAAM,CAACI,IAAI,CAACD,KAAK,CAAC,CAACD,OAAO,CAACX,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AAAoB,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 type { PrerenderingServiceFactory, PrerenderingServiceFactoryParams } from \"~/types\";\nimport { ENTITIES } 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,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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,5 +1,5 @@
1
- import { PrerenderingServiceQueueJobStorageOperations } from "@webiny/api-prerendering-service/types";
2
- import { Entity } from "@webiny/db-dynamodb/toolbox";
1
+ import type { PrerenderingServiceQueueJobStorageOperations } from "@webiny/api-prerendering-service/types";
2
+ import type { Entity } from "@webiny/db-dynamodb/toolbox";
3
3
  export interface CreateQueueJobStorageOperationsParams {
4
4
  entity: Entity<any>;
5
5
  }
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.createQueueJobStorageOperations = void 0;
8
8
  var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _batchWrite = require("@webiny/db-dynamodb/utils/batchWrite");
10
- var _query = require("@webiny/db-dynamodb/utils/query");
11
9
  var _dbDynamodb = require("@webiny/db-dynamodb");
10
+ var _query = require("@webiny/db-dynamodb/utils/query");
12
11
  const createQueueJobStorageOperations = params => {
13
12
  const {
14
13
  entity
@@ -68,17 +67,17 @@ const createQueueJobStorageOperations = params => {
68
67
  const {
69
68
  queueJobs
70
69
  } = params;
71
- const items = queueJobs.map(job => {
72
- return entity.deleteBatch({
73
- PK: createQueueJobPartitionKey(),
74
- SK: createQueueJobSortKey(job.id)
75
- });
70
+ const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
71
+ entity,
72
+ delete: queueJobs.map(job => {
73
+ return {
74
+ PK: createQueueJobPartitionKey(),
75
+ SK: createQueueJobSortKey(job.id)
76
+ };
77
+ })
76
78
  });
77
79
  try {
78
- await (0, _batchWrite.batchWriteAll)({
79
- table: entity.table,
80
- items
81
- });
80
+ await entityBatch.execute();
82
81
  return queueJobs;
83
82
  } catch (ex) {
84
83
  throw new _error.default(ex.message || "Could not delete queue jobs records.", ex.code || "DELETE_QUEUE_JOBS_ERROR", {
@@ -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_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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,GAAGD,SAAS,CAACE,GAAG,CAACC,GAAG,IAAI;MAC/B,OAAO3B,MAAM,CAAC4B,WAAW,CAAC;QACtBpB,EAAE,EAAEP,0BAA0B,CAAC,CAAC;QAChCQ,EAAE,EAAEP,qBAAqB,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"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_dbDynamodb","_query","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","entityBatch","createEntityWriteBatch","delete","map","job","execute","exports"],"sources":["queueJob.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n PrerenderingServiceQueueJobStorageOperations,\n PrerenderingServiceStorageOperationsCreateQueueJobParams,\n PrerenderingServiceStorageOperationsDeleteQueueJobsParams,\n QueueJob\n} from \"@webiny/api-prerendering-service/types\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { createEntityWriteBatch, put } from \"@webiny/db-dynamodb\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { queryAllClean } from \"@webiny/db-dynamodb/utils/query\";\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 entityBatch = createEntityWriteBatch({\n entity,\n delete: queueJobs.map(job => {\n return {\n PK: createQueueJobPartitionKey(),\n SK: createQueueJobSortKey(job.id)\n };\n })\n });\n\n try {\n await entityBatch.execute();\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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0BAA0B,CAAC,CAAC;MAC1CmB,OAAO,EAAE;QACLC,GAAG,EAAE;MACT;IACJ,CAAC;IAED,IAAI;MACA,OAAO,MAAM,IAAAC,oBAAa,EAAWJ,cAAc,CAAC;IACxD,CAAC,CAAC,OAAOL,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,oCAAoC,EAClDF,EAAE,CAACG,IAAI,IAAI,uBAAuB,EAClC;QACIG,YAAY,EAAED,cAAc,CAACC,YAAY;QACzCC,OAAO,EAAEF,cAAc,CAACE;MAC5B,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMG,eAAe,GAAG,MACpBxB,MAAiE,IAChE;IACD,MAAM;MAAEyB;IAAU,CAAC,GAAGzB,MAAM;IAE5B,MAAM0B,WAAW,GAAG,IAAAC,kCAAsB,EAAC;MACvC1B,MAAM;MACN2B,MAAM,EAAEH,SAAS,CAACI,GAAG,CAACC,GAAG,IAAI;QACzB,OAAO;UACHrB,EAAE,EAAEP,0BAA0B,CAAC,CAAC;UAChCQ,EAAE,EAAEP,qBAAqB,CAAC2B,GAAG,CAAC1B,EAAE;QACpC,CAAC;MACL,CAAC;IACL,CAAC,CAAC;IAEF,IAAI;MACA,MAAMsB,WAAW,CAACK,OAAO,CAAC,CAAC;MAC3B,OAAON,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,8 +1,8 @@
1
- import { PrerenderingServiceRenderStorageOperations, Tag } from "@webiny/api-prerendering-service/types";
2
- import { Entity } from "@webiny/db-dynamodb/toolbox";
1
+ import type { PrerenderingServiceRenderStorageOperations, Tag } from "@webiny/api-prerendering-service/types";
2
+ import type { Entity } from "@webiny/db-dynamodb/toolbox";
3
3
  export interface CreateRenderStorageOperationsParams {
4
- entity: Entity<any>;
5
- tagPathLinkEntity: Entity<any>;
4
+ entity: Entity;
5
+ tagPathLinkEntity: Entity;
6
6
  }
7
7
  export interface CreateTagPathLinkPartitionKeyParams {
8
8
  tenant: string;
@@ -6,11 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.createRenderStorageOperations = void 0;
8
8
  var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _get = require("@webiny/db-dynamodb/utils/get");
10
- var _query = require("@webiny/db-dynamodb/utils/query");
11
- var _batchRead = require("@webiny/db-dynamodb/utils/batchRead");
12
- var _batchWrite = require("@webiny/db-dynamodb/utils/batchWrite");
13
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
14
9
  var _dbDynamodb = require("@webiny/db-dynamodb");
15
10
  const createRenderStorageOperations = params => {
16
11
  const {
@@ -87,11 +82,11 @@ const createRenderStorageOperations = params => {
87
82
  SK: createRenderSortKey()
88
83
  };
89
84
  try {
90
- const result = await (0, _get.get)({
85
+ const result = await (0, _dbDynamodb.get)({
91
86
  entity,
92
87
  keys
93
88
  });
94
- const dbItem = (0, _cleanup.cleanupItem)(entity, result);
89
+ const dbItem = (0, _dbDynamodb.cleanupItem)(entity, result);
95
90
  return dbItem ? dbItem.data : null;
96
91
  } catch (ex) {
97
92
  throw new _error.default(ex.message || "Could not get render record by given key.", ex.code || "GET_RENDER_ERROR", {
@@ -174,11 +169,11 @@ const createRenderStorageOperations = params => {
174
169
  });
175
170
  });
176
171
  try {
177
- const results = await (0, _batchRead.batchReadAll)({
172
+ const results = await (0, _dbDynamodb.batchReadAll)({
178
173
  table: entity.table,
179
174
  items
180
175
  });
181
- return (0, _cleanup.cleanupItems)(entity, results).map(item => item.data);
176
+ return (0, _dbDynamodb.cleanupItems)(entity, results).map(item => item.data);
182
177
  } catch (ex) {
183
178
  throw new _error.default(ex.message || "Could not list render records after links.", ex.code || "LIST_LINKS_RENDER_ERROR", {
184
179
  links
@@ -205,7 +200,7 @@ const createRenderStorageOperations = params => {
205
200
  }
206
201
  };
207
202
  try {
208
- const results = await (0, _query.queryAllClean)(queryAllParams);
203
+ const results = await (0, _dbDynamodb.queryAllClean)(queryAllParams);
209
204
  return results.map(item => item.data);
210
205
  } catch (ex) {
211
206
  throw new _error.default(ex.message || "Could not list render records.", ex.code || "LIST_RENDER_ERROR", {
@@ -218,34 +213,34 @@ const createRenderStorageOperations = params => {
218
213
  const {
219
214
  tagPathLinks
220
215
  } = params;
221
- const items = tagPathLinks.map(item => {
222
- return tagPathLinkEntity.putBatch({
223
- data: item,
224
- TYPE: createTagPathLinkType(),
225
- PK: createTagPathLinkPartitionKey({
226
- tenant: item.tenant,
227
- tag: item,
228
- path: item.path
229
- }),
230
- SK: createTagPathLinkSortKey({
231
- tag: item,
232
- path: item.path
233
- }),
234
- GSI1_PK: createTagPathLinkGSI1PartitionKey({
235
- tag: item,
236
- tenant: item.tenant
237
- }),
238
- GSI1_SK: createTagPathLinkGSI1SortKey({
239
- tag: item,
240
- path: item.path
241
- })
242
- });
216
+ const tagPathLinksBatch = (0, _dbDynamodb.createEntityWriteBatch)({
217
+ entity: tagPathLinkEntity,
218
+ put: tagPathLinks.map(item => {
219
+ return {
220
+ data: item,
221
+ TYPE: createTagPathLinkType(),
222
+ PK: createTagPathLinkPartitionKey({
223
+ tenant: item.tenant,
224
+ tag: item,
225
+ path: item.path
226
+ }),
227
+ SK: createTagPathLinkSortKey({
228
+ tag: item,
229
+ path: item.path
230
+ }),
231
+ GSI1_PK: createTagPathLinkGSI1PartitionKey({
232
+ tag: item,
233
+ tenant: item.tenant
234
+ }),
235
+ GSI1_SK: createTagPathLinkGSI1SortKey({
236
+ tag: item,
237
+ path: item.path
238
+ })
239
+ };
240
+ })
243
241
  });
244
242
  try {
245
- await (0, _batchWrite.batchWriteAll)({
246
- table: tagPathLinkEntity.table,
247
- items
248
- });
243
+ await tagPathLinksBatch.execute();
249
244
  return tagPathLinks;
250
245
  } catch (ex) {
251
246
  throw new _error.default(ex.message || "Could not create tagPathLink records.", ex.code || "CREATE_URL_TAG_LINKS_ERROR", {
@@ -259,24 +254,24 @@ const createRenderStorageOperations = params => {
259
254
  tags,
260
255
  path
261
256
  } = params;
262
- const items = tags.map(tag => {
263
- return tagPathLinkEntity.deleteBatch({
264
- PK: createTagPathLinkPartitionKey({
265
- tag,
266
- tenant,
267
- path
268
- }),
269
- SK: createTagPathLinkSortKey({
270
- tag,
271
- path
272
- })
273
- });
257
+ const tagPathLinksBatch = (0, _dbDynamodb.createEntityWriteBatch)({
258
+ entity: tagPathLinkEntity,
259
+ delete: tags.map(tag => {
260
+ return {
261
+ PK: createTagPathLinkPartitionKey({
262
+ tag,
263
+ tenant,
264
+ path
265
+ }),
266
+ SK: createTagPathLinkSortKey({
267
+ tag,
268
+ path
269
+ })
270
+ };
271
+ })
274
272
  });
275
273
  try {
276
- await (0, _batchWrite.batchWriteAll)({
277
- table: tagPathLinkEntity.table,
278
- items
279
- });
274
+ await tagPathLinksBatch.execute();
280
275
  } catch (ex) {
281
276
  throw new _error.default(ex.message || "Could not delete tagPathLink records.", ex.code || "DELETE_URL_TAG_LINKS_ERROR", {
282
277
  tags,
@@ -311,8 +306,8 @@ const createRenderStorageOperations = params => {
311
306
  options
312
307
  };
313
308
  try {
314
- const results = await (0, _query.queryAll)(queryAllParams);
315
- return (0, _cleanup.cleanupItems)(tagPathLinkEntity, results).map(item => item.data);
309
+ const results = await (0, _dbDynamodb.queryAll)(queryAllParams);
310
+ return (0, _dbDynamodb.cleanupItems)(tagPathLinkEntity, results).map(item => item.data);
316
311
  } catch (ex) {
317
312
  throw new _error.default(ex.message || "Could not list tagPathLink records.", ex.code || "LIST_TAG_PATH_LINK_ERROR", {
318
313
  partitionKey,
@@ -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,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;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","_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","tagPathLinksBatch","createEntityWriteBatch","execute","deleteTagPathLinks","tags","delete","beginsWith","queryAll","exports"],"sources":["render.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\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 type { Entity, EntityQueryOptions } from \"@webiny/db-dynamodb/toolbox\";\nimport {\n batchReadAll,\n cleanupItem,\n cleanupItems,\n createEntityWriteBatch,\n deleteItem,\n get,\n put,\n queryAll,\n queryAllClean\n} from \"@webiny/db-dynamodb\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb\";\nimport type { DataContainer } from \"~/types\";\n\nexport interface CreateRenderStorageOperationsParams {\n entity: Entity;\n tagPathLinkEntity: Entity;\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 tagPathLinksBatch = createEntityWriteBatch({\n entity: tagPathLinkEntity,\n put: tagPathLinks.map(item => {\n return {\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\n try {\n await tagPathLinksBatch.execute();\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\n const tagPathLinksBatch = createEntityWriteBatch({\n entity: tagPathLinkEntity,\n delete: tags.map(tag => {\n return {\n PK: createTagPathLinkPartitionKey({\n tag,\n tenant,\n path\n }),\n SK: createTagPathLinkSortKey({\n tag,\n path\n })\n };\n })\n });\n\n try {\n await tagPathLinksBatch.execute();\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,WAAA,GAAAD,OAAA;AAmCO,MAAME,6BAA6B,GACtCC,MAA2C,IACE;EAC7C,MAAM;IAAEC,MAAM;IAAEC;EAAkB,CAAC,GAAGF,MAA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PrerenderingServiceSettingsStorageOperations } from "@webiny/api-prerendering-service/types";
2
- import { Entity } from "@webiny/db-dynamodb/toolbox";
1
+ import type { PrerenderingServiceSettingsStorageOperations } from "@webiny/api-prerendering-service/types";
2
+ import type { Entity } from "@webiny/db-dynamodb/toolbox";
3
3
  export interface CreateSettingsStorageOperationsParams {
4
4
  entity: Entity<any>;
5
5
  }
@@ -29,7 +29,7 @@ const createSettingsStorageOperations = params => {
29
29
  } catch (ex) {
30
30
  throw new _error.default(ex.message || "Could not load prerendering settings!", ex.code || "GET_SETTINGS_ERROR", {
31
31
  keys,
32
- params
32
+ entity: entity.name
33
33
  });
34
34
  }
35
35
  };
@@ -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","name","saveSettings","settings","put","item","TYPE","exports"],"sources":["settings.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n PrerenderingServiceSaveSettingsParams,\n PrerenderingServiceSettingsStorageOperations,\n PrerenderingSettings\n} from \"@webiny/api-prerendering-service/types\";\nimport type { 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 entity: entity.name\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;QACJH,MAAM,EAAEA,MAAM,CAACc;MACnB,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMC,YAAY,GAAG,MAAOhB,MAA6C,IAAK;IAC1E,MAAM;MAAEiB,QAAQ;MAAEd,OAAO,GAAG;IAAU,CAAC,GAAGH,MAAM;IAChD,MAAMI,IAAI,GAAG;MACTC,EAAE,EAAE,aAAa;MACjBC,EAAE,EAAEH;IACR,CAAC;IAED,IAAI;MACA,MAAM,IAAAe,eAAG,EAAC;QACNjB,MAAM;QACNkB,IAAI,EAAE;UACF,GAAGf,IAAI;UACPgB,IAAI,EAAE,aAAa;UACnBV,IAAI,EAAEO;QACV;MACJ,CAAC,CAAC;MAEF,OAAOA,QAAQ;IACnB,CAAC,CAAC,OAAON,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;IACXc;EACJ,CAAC;AACL,CAAC;AAACK,OAAA,CAAAtB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { PrerenderingServiceTenantStorageOperations } from "@webiny/api-prerendering-service/types";
2
- import { Entity } from "@webiny/db-dynamodb/toolbox";
1
+ import type { PrerenderingServiceTenantStorageOperations } from "@webiny/api-prerendering-service/types";
2
+ import type { Entity } from "@webiny/db-dynamodb/toolbox";
3
3
  export interface CreateTenantStorageOperationsParams {
4
4
  entity: Entity<any>;
5
5
  }
@@ -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 type { PrerenderingServiceTenantStorageOperations } from \"@webiny/api-prerendering-service/types\";\nimport type { 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": "0.0.0-unstable.de38392959",
3
+ "version": "0.0.0-unstable.e0bfc55d5a",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,35 +18,27 @@
18
18
  "author": "Webiny Ltd",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@babel/runtime": "7.22.6",
22
- "@webiny/api-prerendering-service": "0.0.0-unstable.de38392959",
23
- "@webiny/aws-sdk": "0.0.0-unstable.de38392959",
24
- "@webiny/error": "0.0.0-unstable.de38392959"
21
+ "@webiny/api-prerendering-service": "0.0.0-unstable.e0bfc55d5a",
22
+ "@webiny/aws-sdk": "0.0.0-unstable.e0bfc55d5a",
23
+ "@webiny/error": "0.0.0-unstable.e0bfc55d5a"
25
24
  },
26
25
  "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": "0.0.0-unstable.de38392959",
33
- "@webiny/db": "0.0.0-unstable.de38392959",
34
- "@webiny/db-dynamodb": "0.0.0-unstable.de38392959",
35
- "@webiny/handler-aws": "0.0.0-unstable.de38392959",
36
- "@webiny/project-utils": "0.0.0-unstable.de38392959",
26
+ "@webiny/db": "0.0.0-unstable.e0bfc55d5a",
27
+ "@webiny/db-dynamodb": "0.0.0-unstable.e0bfc55d5a",
28
+ "@webiny/handler-aws": "0.0.0-unstable.e0bfc55d5a",
29
+ "@webiny/project-utils": "0.0.0-unstable.e0bfc55d5a",
37
30
  "jest-dynalite": "3.6.1",
38
31
  "prettier": "2.8.8",
39
- "rimraf": "3.0.2",
40
- "ttypescript": "1.5.15",
41
- "typescript": "4.7.4"
32
+ "rimraf": "6.0.1",
33
+ "typescript": "5.3.3"
42
34
  },
43
35
  "publishConfig": {
44
36
  "access": "public",
45
37
  "directory": "dist"
46
38
  },
47
39
  "scripts": {
48
- "build": "yarn webiny run build",
49
- "watch": "yarn webiny run watch"
40
+ "build": "node ../cli/bin.js run build",
41
+ "watch": "node ../cli/bin.js run watch"
50
42
  },
51
- "gitHead": "de38392959f2692d1feb08945a3588cd80e4924c"
43
+ "gitHead": "e0bfc55d5a4d6a42b32e6558d9fb2eb6753e331b"
52
44
  }
package/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
2
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
3
- import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
- import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
5
- import { PrerenderingServiceStorageOperations as BasePrerenderingServiceStorageOperations } from "@webiny/api-prerendering-service/types";
6
- export declare type Attributes = Record<string, AttributeDefinition>;
1
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
2
+ import type { Entity, Table } from "@webiny/db-dynamodb/toolbox";
3
+ import type { TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
+ import type { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
5
+ import type { PrerenderingServiceStorageOperations as BasePrerenderingServiceStorageOperations } from "@webiny/api-prerendering-service/types";
6
+ export type Attributes = Record<string, AttributeDefinition>;
7
7
  export declare enum ENTITIES {
8
8
  RENDER = "PrerenderingServiceRender",
9
9
  SETTINGS = "PrerenderingServiceSettings",
@@ -12,11 +12,11 @@ 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
  }
19
- export declare type Entities = "render" | "queueJob" | "tagPathLink";
19
+ export type Entities = "render" | "queueJob" | "tagPathLink";
20
20
  export interface PrerenderingServiceStorageOperations extends BasePrerenderingServiceStorageOperations {
21
21
  getTable(): Table<string, string, string>;
22
22
  getEntities(): Record<Entities, Entity<any>>;
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 type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport type { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport type { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":[]}