@webiny/api-headless-cms-utils-os 0.0.0-unstable.3fddf667ea → 0.0.0-unstable.4373247389
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.
|
@@ -22,7 +22,7 @@ describe("createInitialQuery", ()=>{
|
|
|
22
22
|
it("filters by tenant and model when the index is shared, even if the variable says otherwise", ()=>{
|
|
23
23
|
process.env.OPENSEARCH_SHARED_INDEXES = "false";
|
|
24
24
|
const query = createInitialQuery({
|
|
25
|
-
model
|
|
25
|
+
model,
|
|
26
26
|
where: {
|
|
27
27
|
latest: true
|
|
28
28
|
},
|
|
@@ -34,7 +34,7 @@ describe("createInitialQuery", ()=>{
|
|
|
34
34
|
it("doesn't filter by tenant when the index isn't shared, even if the variable says it is", ()=>{
|
|
35
35
|
process.env.OPENSEARCH_SHARED_INDEXES = "true";
|
|
36
36
|
const query = createInitialQuery({
|
|
37
|
-
model
|
|
37
|
+
model,
|
|
38
38
|
where: {
|
|
39
39
|
latest: true
|
|
40
40
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/elasticsearch/initialQuery.test.js","sources":["../../../../src/operations/entry/elasticsearch/initialQuery.test.ts"],"sourcesContent":["import { afterEach, describe, expect, it } from \"vitest\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createInitialQuery } from \"./initialQuery.js\";\n\nconst model = { modelId: \"article\", tenant: \"acme\" } as CmsModel;\n\nconst tenantFilter = { term: { \"tenant.keyword\": \"acme\" } };\nconst modelFilter = { term: { \"modelId.keyword\": \"article\" } };\n\n/*\n * Whether entries are filtered by tenant must follow the model's index (CmsModelOpenSearchIndex),\n * not the OPENSEARCH_SHARED_INDEXES variable. A decorator can isolate or share an index per model,\n * so the two can disagree.\n */\ndescribe(\"createInitialQuery\", () => {\n const original = process.env.OPENSEARCH_SHARED_INDEXES;\n\n afterEach(() => {\n process.env.OPENSEARCH_SHARED_INDEXES = original;\n });\n\n it(\"filters by tenant and model when the index is shared, even if the variable says otherwise\", () => {\n process.env.OPENSEARCH_SHARED_INDEXES = \"false\";\n\n const query = createInitialQuery({ model, where: { latest: true }, shared: true });\n\n expect(query.filter).toContainEqual(tenantFilter);\n expect(query.filter).toContainEqual(modelFilter);\n });\n\n it(\"doesn't filter by tenant when the index isn't shared, even if the variable says it is\", () => {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n\n const query = createInitialQuery({ model, where: { latest: true }, shared: false });\n\n expect(query.filter).not.toContainEqual(tenantFilter);\n expect(query.filter).not.toContainEqual(modelFilter);\n });\n});\n"],"names":["model","tenantFilter","modelFilter","describe","original","process","afterEach","it","query","createInitialQuery","expect"],"mappings":";;AAIA,MAAMA,QAAQ;IAAE,SAAS;IAAW,QAAQ;AAAO;AAEnD,MAAMC,eAAe;IAAE,MAAM;QAAE,kBAAkB;IAAO;AAAE;AAC1D,MAAMC,cAAc;IAAE,MAAM;QAAE,mBAAmB;IAAU;AAAE;AAO7DC,SAAS,sBAAsB;IAC3B,MAAMC,WAAWC,QAAQ,GAAG,CAAC,yBAAyB;IAEtDC,UAAU;QACND,QAAQ,GAAG,CAAC,yBAAyB,GAAGD;IAC5C;IAEAG,GAAG,6FAA6F;QAC5FF,QAAQ,GAAG,CAAC,yBAAyB,GAAG;QAExC,MAAMG,QAAQC,mBAAmB;YAAET
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/initialQuery.test.js","sources":["../../../../src/operations/entry/elasticsearch/initialQuery.test.ts"],"sourcesContent":["import { afterEach, describe, expect, it } from \"vitest\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createInitialQuery } from \"./initialQuery.js\";\n\nconst model = { modelId: \"article\", tenant: \"acme\" } as CmsModel;\n\nconst tenantFilter = { term: { \"tenant.keyword\": \"acme\" } };\nconst modelFilter = { term: { \"modelId.keyword\": \"article\" } };\n\n/*\n * Whether entries are filtered by tenant must follow the model's index (CmsModelOpenSearchIndex),\n * not the OPENSEARCH_SHARED_INDEXES variable. A decorator can isolate or share an index per model,\n * so the two can disagree.\n */\ndescribe(\"createInitialQuery\", () => {\n const original = process.env.OPENSEARCH_SHARED_INDEXES;\n\n afterEach(() => {\n process.env.OPENSEARCH_SHARED_INDEXES = original;\n });\n\n it(\"filters by tenant and model when the index is shared, even if the variable says otherwise\", () => {\n process.env.OPENSEARCH_SHARED_INDEXES = \"false\";\n\n const query = createInitialQuery({ model, where: { latest: true }, shared: true });\n\n expect(query.filter).toContainEqual(tenantFilter);\n expect(query.filter).toContainEqual(modelFilter);\n });\n\n it(\"doesn't filter by tenant when the index isn't shared, even if the variable says it is\", () => {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n\n const query = createInitialQuery({ model, where: { latest: true }, shared: false });\n\n expect(query.filter).not.toContainEqual(tenantFilter);\n expect(query.filter).not.toContainEqual(modelFilter);\n });\n});\n"],"names":["model","tenantFilter","modelFilter","describe","original","process","afterEach","it","query","createInitialQuery","expect"],"mappings":";;AAIA,MAAMA,QAAQ;IAAE,SAAS;IAAW,QAAQ;AAAO;AAEnD,MAAMC,eAAe;IAAE,MAAM;QAAE,kBAAkB;IAAO;AAAE;AAC1D,MAAMC,cAAc;IAAE,MAAM;QAAE,mBAAmB;IAAU;AAAE;AAO7DC,SAAS,sBAAsB;IAC3B,MAAMC,WAAWC,QAAQ,GAAG,CAAC,yBAAyB;IAEtDC,UAAU;QACND,QAAQ,GAAG,CAAC,yBAAyB,GAAGD;IAC5C;IAEAG,GAAG,6FAA6F;QAC5FF,QAAQ,GAAG,CAAC,yBAAyB,GAAG;QAExC,MAAMG,QAAQC,mBAAmB;YAAET;YAAO,OAAO;gBAAE,QAAQ;YAAK;YAAG,QAAQ;QAAK;QAEhFU,OAAOF,MAAM,MAAM,EAAE,cAAc,CAACP;QACpCS,OAAOF,MAAM,MAAM,EAAE,cAAc,CAACN;IACxC;IAEAK,GAAG,yFAAyF;QACxFF,QAAQ,GAAG,CAAC,yBAAyB,GAAG;QAExC,MAAMG,QAAQC,mBAAmB;YAAET;YAAO,OAAO;gBAAE,QAAQ;YAAK;YAAG,QAAQ;QAAM;QAEjFU,OAAOF,MAAM,MAAM,EAAE,GAAG,CAAC,cAAc,CAACP;QACxCS,OAAOF,MAAM,MAAM,EAAE,GAAG,CAAC,cAAc,CAACN;IAC5C;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-utils-os",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.4373247389",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "Webiny Ltd.",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@webiny/api-headless-cms": "0.0.0-unstable.
|
|
19
|
-
"@webiny/api-opensearch": "0.0.0-unstable.
|
|
20
|
-
"@webiny/error": "0.0.0-unstable.
|
|
21
|
-
"@webiny/feature": "0.0.0-unstable.
|
|
18
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.4373247389",
|
|
19
|
+
"@webiny/api-opensearch": "0.0.0-unstable.4373247389",
|
|
20
|
+
"@webiny/error": "0.0.0-unstable.4373247389",
|
|
21
|
+
"@webiny/feature": "0.0.0-unstable.4373247389"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
24
|
+
"@webiny/build-tools": "0.0.0-unstable.4373247389",
|
|
25
25
|
"typescript": "7.0.2",
|
|
26
|
-
"vitest": "5.
|
|
26
|
+
"vitest": "5.1.1"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|