@webiny/api-prerendering-service-so-ddb 0.0.0-unstable.990c3ab1b6 → 0.0.0-unstable.b02d94bba0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/definitions/tenantEntity.d.ts +7 -0
- package/definitions/tenantEntity.js +37 -0
- package/definitions/tenantEntity.js.map +1 -0
- package/index.js +9 -1
- package/index.js.map +1 -1
- package/operations/tenant.d.ts +6 -0
- package/operations/tenant.js +28 -0
- package/operations/tenant.js.map +1 -0
- package/package.json +10 -10
- package/types.d.ts +2 -1
- package/types.js +1 -0
- package/types.js.map +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createTenantEntity = void 0;
|
|
7
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
8
|
+
const createTenantEntity = ({
|
|
9
|
+
entityName,
|
|
10
|
+
table
|
|
11
|
+
}) => {
|
|
12
|
+
return new _dynamodbToolbox.Entity({
|
|
13
|
+
table,
|
|
14
|
+
name: entityName,
|
|
15
|
+
attributes: {
|
|
16
|
+
PK: {
|
|
17
|
+
partitionKey: true
|
|
18
|
+
},
|
|
19
|
+
SK: {
|
|
20
|
+
sortKey: true
|
|
21
|
+
},
|
|
22
|
+
GSI1_PK: {
|
|
23
|
+
type: "string"
|
|
24
|
+
},
|
|
25
|
+
GSI1_SK: {
|
|
26
|
+
type: "string"
|
|
27
|
+
},
|
|
28
|
+
TYPE: {
|
|
29
|
+
type: "string"
|
|
30
|
+
},
|
|
31
|
+
id: {
|
|
32
|
+
type: "string"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.createTenantEntity = createTenantEntity;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTenantEntity","entityName","table","Entity","name","attributes","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","id"],"sources":["tenantEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\n\ninterface Params {\n table: Table;\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;AAOO,MAAMA,kBAAkB,GAAG,CAAC;EAAEC,UAAU;EAAEC;AAAc,CAAC,KAAkB;EAC9E,OAAO,IAAIC,uBAAM,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;AAAC"}
|
package/index.js
CHANGED
|
@@ -13,9 +13,11 @@ var _render = require("./definitions/render");
|
|
|
13
13
|
var _settings = require("./definitions/settings");
|
|
14
14
|
var _queueJob = require("./definitions/queueJob");
|
|
15
15
|
var _render2 = require("./operations/render");
|
|
16
|
+
var _tenant = require("./operations/tenant");
|
|
16
17
|
var _settings2 = require("./operations/settings");
|
|
17
18
|
var _queueJob2 = require("./operations/queueJob");
|
|
18
19
|
var _tagPathLink = require("./definitions/tagPathLink");
|
|
20
|
+
var _tenantEntity = require("./definitions/tenantEntity");
|
|
19
21
|
const reservedFields = ["PK", "SK", "index", "data", "TYPE", "__type", "GSI1_PK", "GSI1_SK"];
|
|
20
22
|
const isReserved = name => {
|
|
21
23
|
if (reservedFields.includes(name) === false) {
|
|
@@ -60,9 +62,13 @@ const createPrerenderingServiceStorageOperations = params => {
|
|
|
60
62
|
entityName: _types.ENTITIES.TAG_PATH_LINK,
|
|
61
63
|
table: tableInstance,
|
|
62
64
|
attributes: attributes ? attributes[_types.ENTITIES.TAG_PATH_LINK] : {}
|
|
65
|
+
}),
|
|
66
|
+
tenant: (0, _tenantEntity.createTenantEntity)({
|
|
67
|
+
entityName: _types.ENTITIES.TENANT,
|
|
68
|
+
table: tableInstance
|
|
63
69
|
})
|
|
64
70
|
};
|
|
65
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
71
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
66
72
|
getTable: () => tableInstance,
|
|
67
73
|
getEntities: () => entities
|
|
68
74
|
}, (0, _render2.createRenderStorageOperations)({
|
|
@@ -72,6 +78,8 @@ const createPrerenderingServiceStorageOperations = params => {
|
|
|
72
78
|
entity: entities.queueJob
|
|
73
79
|
})), (0, _settings2.createSettingsStorageOperations)({
|
|
74
80
|
entity: entities.settings
|
|
81
|
+
})), (0, _tenant.createTenantStorageOperations)({
|
|
82
|
+
entity: entities.tenant
|
|
75
83
|
}));
|
|
76
84
|
};
|
|
77
85
|
exports.createPrerenderingServiceStorageOperations = createPrerenderingServiceStorageOperations;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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","getTable","getEntities","createRenderStorageOperations","entity","tagPathLinkEntity","createQueueJobStorageOperations","createSettingsStorageOperations"],"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 { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createQueueJobStorageOperations } from \"~/operations/queueJob\";\nimport { createTagPathLinkEntity } from \"~/definitions/tagPathLink\";\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 };\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 };\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,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,UAAU,CAAC;IAC1C,CAAC,CAAC;EACN;EAEA,MAAMc,aAAa,GAAG,IAAAC,kBAAW,EAAC;IAAER,KAAK;IAAEC;EAAe,CAAC,CAAC;EAE5D,MAAMQ,QAAQ,GAAG;IACbC,MAAM,EAAE,IAAAC,0BAAkB,EAAC;MACvBC,UAAU,EAAEC,eAAQ,CAACC,MAAM;MAC3Bd,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACC,MAAM,CAAC,GAAG,CAAC;IAC5D,CAAC,CAAC;IACFC,QAAQ,EAAE,IAAAC,8BAAoB,EAAC;MAC3BJ,UAAU,EAAEC,eAAQ,CAACI,QAAQ;MAC7BjB,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACI,QAAQ,CAAC,GAAG,CAAC;IAC9D,CAAC,CAAC;IACFC,QAAQ,EAAE,IAAAC,8BAAoB,EAAC;MAC3BP,UAAU,EAAEC,eAAQ,CAACO,SAAS;MAC9BpB,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACO,SAAS,CAAC,GAAG,CAAC;IAC/D,CAAC,CAAC;IACFC,WAAW,EAAE,IAAAC,oCAAuB,EAAC;MACjCV,UAAU,EAAEC,eAAQ,CAACU,aAAa;MAClCvB,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACU,aAAa,CAAC,GAAG,CAAC;IACnE,CAAC;EACL,CAAC;EAED;
|
|
1
|
+
{"version":3,"names":["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"],"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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,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,UAAU,CAAC;IAC1C,CAAC,CAAC;EACN;EAEA,MAAMc,aAAa,GAAG,IAAAC,kBAAW,EAAC;IAAER,KAAK;IAAEC;EAAe,CAAC,CAAC;EAE5D,MAAMQ,QAAQ,GAAG;IACbC,MAAM,EAAE,IAAAC,0BAAkB,EAAC;MACvBC,UAAU,EAAEC,eAAQ,CAACC,MAAM;MAC3Bd,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACC,MAAM,CAAC,GAAG,CAAC;IAC5D,CAAC,CAAC;IACFC,QAAQ,EAAE,IAAAC,8BAAoB,EAAC;MAC3BJ,UAAU,EAAEC,eAAQ,CAACI,QAAQ;MAC7BjB,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACI,QAAQ,CAAC,GAAG,CAAC;IAC9D,CAAC,CAAC;IACFC,QAAQ,EAAE,IAAAC,8BAAoB,EAAC;MAC3BP,UAAU,EAAEC,eAAQ,CAACO,SAAS;MAC9BpB,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACO,SAAS,CAAC,GAAG,CAAC;IAC/D,CAAC,CAAC;IACFC,WAAW,EAAE,IAAAC,oCAAuB,EAAC;MACjCV,UAAU,EAAEC,eAAQ,CAACU,aAAa;MAClCvB,KAAK,EAAEO,aAAa;MACpBR,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACc,eAAQ,CAACU,aAAa,CAAC,GAAG,CAAC;IACnE,CAAC,CAAC;IACFC,MAAM,EAAE,IAAAC,gCAAkB,EAAC;MACvBb,UAAU,EAAEC,eAAQ,CAACa,MAAM;MAC3B1B,KAAK,EAAEO;IACX,CAAC;EACL,CAAC;EAED;IACIoB,QAAQ,EAAE,MAAMpB,aAAa;IAC7BqB,WAAW,EAAE,MAAMnB;EAAQ,GACxB,IAAAoB,sCAA6B,EAAC;IAC7BC,MAAM,EAAErB,QAAQ,CAACC,MAAM;IACvBqB,iBAAiB,EAAEtB,QAAQ,CAACY;EAChC,CAAC,CAAC,GACC,IAAAW,0CAA+B,EAAC;IAC/BF,MAAM,EAAErB,QAAQ,CAACS;EACrB,CAAC,CAAC,GACC,IAAAe,0CAA+B,EAAC;IAC/BH,MAAM,EAAErB,QAAQ,CAACM;EACrB,CAAC,CAAC,GACC,IAAAmB,qCAA6B,EAAC;IAC7BJ,MAAM,EAAErB,QAAQ,CAACe;EACrB,CAAC,CAAC;AAEV,CAAC;AAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PrerenderingServiceTenantStorageOperations } from "@webiny/api-prerendering-service/types";
|
|
2
|
+
import { Entity } from "dynamodb-toolbox";
|
|
3
|
+
export interface CreateTenantStorageOperationsParams {
|
|
4
|
+
entity: Entity<any>;
|
|
5
|
+
}
|
|
6
|
+
export declare const createTenantStorageOperations: (params: CreateTenantStorageOperationsParams) => PrerenderingServiceTenantStorageOperations;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createTenantStorageOperations = void 0;
|
|
7
|
+
var _query = require("@webiny/db-dynamodb/utils/query");
|
|
8
|
+
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
9
|
+
const createTenantStorageOperations = params => {
|
|
10
|
+
const {
|
|
11
|
+
entity
|
|
12
|
+
} = params;
|
|
13
|
+
const getTenantIds = async () => {
|
|
14
|
+
const tenants = await (0, _query.queryAll)({
|
|
15
|
+
entity,
|
|
16
|
+
partitionKey: "TENANTS",
|
|
17
|
+
options: {
|
|
18
|
+
index: "GSI1",
|
|
19
|
+
gt: " "
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return (0, _cleanup.cleanupItems)(entity, tenants).map(tenant => tenant.id);
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
getTenantIds
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.createTenantStorageOperations = createTenantStorageOperations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTenantStorageOperations","params","entity","getTenantIds","tenants","queryAll","partitionKey","options","index","gt","cleanupItems","map","tenant","id"],"sources":["tenant.ts"],"sourcesContent":["import { PrerenderingServiceTenantStorageOperations } from \"@webiny/api-prerendering-service/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { queryAll } from \"@webiny/db-dynamodb/utils/query\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\n\nexport interface CreateTenantStorageOperationsParams {\n entity: Entity<any>;\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<{ id: string }>({\n entity,\n partitionKey: \"TENANTS\",\n options: {\n index: \"GSI1\",\n gt: \" \"\n }\n });\n\n return cleanupItems(entity, tenants).map(tenant => tenant.id);\n };\n\n return {\n getTenantIds\n };\n};\n"],"mappings":";;;;;;AAEA;AACA;AAMO,MAAMA,6BAA6B,GACtCC,MAA2C,IACE;EAC7C,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,YAAY,GAAG,YAA+B;IAChD,MAAMC,OAAO,GAAG,MAAM,IAAAC,eAAQ,EAAiB;MAC3CH,MAAM;MACNI,YAAY,EAAE,SAAS;MACvBC,OAAO,EAAE;QACLC,KAAK,EAAE,MAAM;QACbC,EAAE,EAAE;MACR;IACJ,CAAC,CAAC;IAEF,OAAO,IAAAC,qBAAY,EAACR,MAAM,EAAEE,OAAO,CAAC,CAACO,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,CAAC;EACjE,CAAC;EAED,OAAO;IACHV;EACJ,CAAC;AACL,CAAC;AAAC"}
|
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.
|
|
3
|
+
"version": "0.0.0-unstable.b02d94bba0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"author": "Webiny Ltd",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@babel/runtime": "7.20.
|
|
21
|
-
"@webiny/api-prerendering-service": "0.0.0-unstable.
|
|
22
|
-
"@webiny/error": "0.0.0-unstable.
|
|
20
|
+
"@babel/runtime": "7.20.13",
|
|
21
|
+
"@webiny/api-prerendering-service": "0.0.0-unstable.b02d94bba0",
|
|
22
|
+
"@webiny/error": "0.0.0-unstable.b02d94bba0",
|
|
23
23
|
"dynamodb-toolbox": "0.3.5"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"@babel/plugin-proposal-export-default-from": "^7.16.0",
|
|
29
29
|
"@babel/preset-env": "^7.19.4",
|
|
30
30
|
"@babel/preset-typescript": "^7.18.6",
|
|
31
|
-
"@webiny/cli": "^0.0.0-unstable.
|
|
32
|
-
"@webiny/db": "^0.0.0-unstable.
|
|
33
|
-
"@webiny/db-dynamodb": "^0.0.0-unstable.
|
|
34
|
-
"@webiny/handler-aws": "^0.0.0-unstable.
|
|
35
|
-
"@webiny/project-utils": "^0.0.0-unstable.
|
|
31
|
+
"@webiny/cli": "^0.0.0-unstable.b02d94bba0",
|
|
32
|
+
"@webiny/db": "^0.0.0-unstable.b02d94bba0",
|
|
33
|
+
"@webiny/db-dynamodb": "^0.0.0-unstable.b02d94bba0",
|
|
34
|
+
"@webiny/handler-aws": "^0.0.0-unstable.b02d94bba0",
|
|
35
|
+
"@webiny/project-utils": "^0.0.0-unstable.b02d94bba0",
|
|
36
36
|
"jest-dynalite": "^3.3.1",
|
|
37
37
|
"jest-environment-node": "^27.3.0",
|
|
38
38
|
"prettier": "^2.3.2",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
]
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b02d94bba01eb4d2b17732279216fbc1c7ab5cd5"
|
|
59
59
|
}
|
package/types.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export declare enum ENTITIES {
|
|
|
9
9
|
RENDER = "PrerenderingServiceRender",
|
|
10
10
|
SETTINGS = "PrerenderingServiceSettings",
|
|
11
11
|
QUEUE_JOB = "PrerenderingServiceQueueJob",
|
|
12
|
-
TAG_PATH_LINK = "PrerenderingServiceTagPathLink"
|
|
12
|
+
TAG_PATH_LINK = "PrerenderingServiceTagPathLink",
|
|
13
|
+
TENANT = "Tenant"
|
|
13
14
|
}
|
|
14
15
|
export interface PrerenderingServiceFactoryParams {
|
|
15
16
|
documentClient: DocumentClient;
|
package/types.js
CHANGED
|
@@ -11,4 +11,5 @@ exports.ENTITIES = ENTITIES;
|
|
|
11
11
|
ENTITIES["SETTINGS"] = "PrerenderingServiceSettings";
|
|
12
12
|
ENTITIES["QUEUE_JOB"] = "PrerenderingServiceQueueJob";
|
|
13
13
|
ENTITIES["TAG_PATH_LINK"] = "PrerenderingServiceTagPathLink";
|
|
14
|
+
ENTITIES["TENANT"] = "Tenant";
|
|
14
15
|
})(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table, Entity } from \"dynamodb-toolbox\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { PrerenderingServiceStorageOperations as BasePrerenderingServiceStorageOperations } from \"@webiny/api-prerendering-service/types\";\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\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}\n\nexport interface PrerenderingServiceFactoryParams {\n documentClient: DocumentClient;\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;\n getEntities(): Record<Entities, Entity<any>>;\n}\n\nexport interface PrerenderingServiceFactory {\n (params: PrerenderingServiceFactoryParams): PrerenderingServiceStorageOperations;\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface DataContainer<T> {\n PK: string;\n SK: string;\n data: T;\n}\n"],"mappings":";;;;;;IAaYA,QAAQ;AAAA;AAAA,WAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;AAAA,GAARA,QAAQ,wBAARA,QAAQ"}
|
|
1
|
+
{"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table, Entity } from \"dynamodb-toolbox\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { PrerenderingServiceStorageOperations as BasePrerenderingServiceStorageOperations } from \"@webiny/api-prerendering-service/types\";\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\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: DocumentClient;\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;\n getEntities(): Record<Entities, Entity<any>>;\n}\n\nexport interface PrerenderingServiceFactory {\n (params: PrerenderingServiceFactoryParams): PrerenderingServiceStorageOperations;\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface DataContainer<T> {\n PK: string;\n SK: string;\n data: T;\n}\n"],"mappings":";;;;;;IAaYA,QAAQ;AAAA;AAAA,WAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;AAAA,GAARA,QAAQ,wBAARA,QAAQ"}
|