@webiny/api-elasticsearch-tasks 5.41.0-dbt.0 → 5.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-elasticsearch-tasks",
|
|
3
|
-
"version": "5.41.0
|
|
3
|
+
"version": "5.41.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/runtime": "7.24.1",
|
|
16
|
-
"@webiny/api": "5.41.0
|
|
17
|
-
"@webiny/api-elasticsearch": "5.41.0
|
|
18
|
-
"@webiny/aws-sdk": "5.41.0
|
|
19
|
-
"@webiny/db-dynamodb": "5.41.0
|
|
20
|
-
"@webiny/error": "5.41.0
|
|
21
|
-
"@webiny/tasks": "5.41.0
|
|
22
|
-
"@webiny/utils": "5.41.0
|
|
16
|
+
"@webiny/api": "5.41.0",
|
|
17
|
+
"@webiny/api-elasticsearch": "5.41.0",
|
|
18
|
+
"@webiny/aws-sdk": "5.41.0",
|
|
19
|
+
"@webiny/db-dynamodb": "5.41.0",
|
|
20
|
+
"@webiny/error": "5.41.0",
|
|
21
|
+
"@webiny/tasks": "5.41.0",
|
|
22
|
+
"@webiny/utils": "5.41.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@babel/cli": "7.24.1",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"@babel/preset-env": "7.24.3",
|
|
28
28
|
"@babel/preset-typescript": "7.24.1",
|
|
29
29
|
"@webiny/api": "0.0.0",
|
|
30
|
-
"@webiny/api-headless-cms": "5.41.0
|
|
31
|
-
"@webiny/api-i18n": "5.41.0
|
|
32
|
-
"@webiny/api-security": "5.41.0
|
|
33
|
-
"@webiny/api-tenancy": "5.41.0
|
|
34
|
-
"@webiny/api-wcp": "5.41.0
|
|
35
|
-
"@webiny/cli": "5.41.0
|
|
36
|
-
"@webiny/handler": "5.41.0
|
|
37
|
-
"@webiny/handler-aws": "5.41.0
|
|
38
|
-
"@webiny/handler-db": "5.41.0
|
|
39
|
-
"@webiny/handler-graphql": "5.41.0
|
|
40
|
-
"@webiny/plugins": "5.41.0
|
|
41
|
-
"@webiny/project-utils": "5.41.0
|
|
30
|
+
"@webiny/api-headless-cms": "5.41.0",
|
|
31
|
+
"@webiny/api-i18n": "5.41.0",
|
|
32
|
+
"@webiny/api-security": "5.41.0",
|
|
33
|
+
"@webiny/api-tenancy": "5.41.0",
|
|
34
|
+
"@webiny/api-wcp": "5.41.0",
|
|
35
|
+
"@webiny/cli": "5.41.0",
|
|
36
|
+
"@webiny/handler": "5.41.0",
|
|
37
|
+
"@webiny/handler-aws": "5.41.0",
|
|
38
|
+
"@webiny/handler-db": "5.41.0",
|
|
39
|
+
"@webiny/handler-graphql": "5.41.0",
|
|
40
|
+
"@webiny/plugins": "5.41.0",
|
|
41
|
+
"@webiny/project-utils": "5.41.0",
|
|
42
42
|
"rimraf": "5.0.5",
|
|
43
43
|
"ttypescript": "1.5.15",
|
|
44
44
|
"type-fest": "2.19.0",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"build": "yarn webiny run build",
|
|
53
53
|
"watch": "yarn webiny run watch"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "a542f4d0806744c5e2333b3786478c4af3b6b750"
|
|
56
56
|
}
|
|
@@ -11,10 +11,11 @@ class EnableIndexing {
|
|
|
11
11
|
}
|
|
12
12
|
async exec(index, settings) {
|
|
13
13
|
try {
|
|
14
|
+
const refreshInterval = parseInt(settings.refreshInterval || "", 10) || 0;
|
|
14
15
|
await this.settings.setSettings(index, {
|
|
15
16
|
...settings,
|
|
16
17
|
numberOfReplicas: settings.numberOfReplicas < 1 ? 1 : settings.numberOfReplicas,
|
|
17
|
-
refreshInterval:
|
|
18
|
+
refreshInterval: refreshInterval <= 0 ? "1s" : settings.refreshInterval
|
|
18
19
|
});
|
|
19
20
|
} catch (ex) {
|
|
20
21
|
throw new _errors.IndexingEnableError(ex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_errors","require","EnableIndexing","constructor","settings","exec","index","
|
|
1
|
+
{"version":3,"names":["_errors","require","EnableIndexing","constructor","settings","exec","index","refreshInterval","parseInt","setSettings","numberOfReplicas","ex","IndexingEnableError","exports"],"sources":["EnableIndexing.ts"],"sourcesContent":["import { IndexingEnableError } from \"~/errors\";\nimport { IIndexSettingsValues } from \"~/types\";\nimport { IndexSettingsManager } from \"./IndexSettingsManager\";\n\nexport class EnableIndexing {\n private readonly settings: IndexSettingsManager;\n\n public constructor(settings: IndexSettingsManager) {\n this.settings = settings;\n }\n\n public async exec(index: string, settings: IIndexSettingsValues): Promise<void> {\n try {\n const refreshInterval = parseInt(settings.refreshInterval || \"\", 10) || 0;\n await this.settings.setSettings(index, {\n ...settings,\n numberOfReplicas: settings.numberOfReplicas < 1 ? 1 : settings.numberOfReplicas,\n refreshInterval: refreshInterval <= 0 ? \"1s\" : settings.refreshInterval\n });\n } catch (ex) {\n throw new IndexingEnableError(ex);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAIO,MAAMC,cAAc,CAAC;EAGjBC,WAAWA,CAACC,QAA8B,EAAE;IAC/C,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAaC,IAAIA,CAACC,KAAa,EAAEF,QAA8B,EAAiB;IAC5E,IAAI;MACA,MAAMG,eAAe,GAAGC,QAAQ,CAACJ,QAAQ,CAACG,eAAe,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;MACzE,MAAM,IAAI,CAACH,QAAQ,CAACK,WAAW,CAACH,KAAK,EAAE;QACnC,GAAGF,QAAQ;QACXM,gBAAgB,EAAEN,QAAQ,CAACM,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAGN,QAAQ,CAACM,gBAAgB;QAC/EH,eAAe,EAAEA,eAAe,IAAI,CAAC,GAAG,IAAI,GAAGH,QAAQ,CAACG;MAC5D,CAAC,CAAC;IACN,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,2BAAmB,CAACD,EAAE,CAAC;IACrC;EACJ;AACJ;AAACE,OAAA,CAAAX,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -26,7 +26,12 @@ class CreateIndexesTaskRunner {
|
|
|
26
26
|
tenant: tenant.id,
|
|
27
27
|
locale: locale.code
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
for (const result of results) {
|
|
30
|
+
if (indexes.some(i => i.index === result.index)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
indexes.push(result);
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_CreateElasticsearchIndexTaskPlugin","require","CreateIndexesTaskRunner","constructor","manager","indexManager","execute","matching","done","plugins","context","byType","CreateElasticsearchIndexTaskPlugin","type","length","response","indexes","tenants","tenancy","listTenants","tenant","locales","i18n","getLocales","locale","plugin","results","getIndexList","id","code","
|
|
1
|
+
{"version":3,"names":["_CreateElasticsearchIndexTaskPlugin","require","CreateIndexesTaskRunner","constructor","manager","indexManager","execute","matching","done","plugins","context","byType","CreateElasticsearchIndexTaskPlugin","type","length","response","indexes","tenants","tenancy","listTenants","tenant","locales","i18n","getLocales","locale","plugin","results","getIndexList","id","code","result","some","i","index","push","isIndexAllowed","includes","settings","isAborted","aborted","isCloseToTimeout","continue","exists","indexExists","createIndex","store","addInfoLog","message","data","ex","addErrorLog","error","exports"],"sources":["CreateIndexesTaskRunner.ts"],"sourcesContent":["import { Manager } from \"~/tasks/Manager\";\nimport { IndexManager } from \"~/settings\";\nimport { ITaskResponseResult } from \"@webiny/tasks\";\nimport {\n CreateElasticsearchIndexTaskPlugin,\n CreateElasticsearchIndexTaskPluginIndex\n} from \"./CreateElasticsearchIndexTaskPlugin\";\nimport { Context } from \"~/types\";\n\nexport class CreateIndexesTaskRunner {\n private readonly manager: Manager;\n private readonly indexManager: IndexManager;\n\n public constructor(manager: Manager, indexManager: IndexManager) {\n this.manager = manager;\n\n this.indexManager = indexManager;\n }\n\n public async execute(\n matching: string | undefined,\n done: string[]\n ): Promise<ITaskResponseResult> {\n const plugins = this.manager.context.plugins.byType<\n CreateElasticsearchIndexTaskPlugin<Context>\n >(CreateElasticsearchIndexTaskPlugin.type);\n if (plugins.length === 0) {\n return this.manager.response.done(\"No index plugins found.\");\n }\n const indexes: CreateElasticsearchIndexTaskPluginIndex[] = [];\n\n const tenants = await this.manager.context.tenancy.listTenants();\n\n for (const tenant of tenants) {\n const locales = await this.manager.context.i18n.getLocales();\n for (const locale of locales) {\n for (const plugin of plugins) {\n const results = await plugin.getIndexList({\n context: this.manager.context,\n tenant: tenant.id,\n locale: locale.code\n });\n for (const result of results) {\n if (indexes.some(i => i.index === result.index)) {\n continue;\n }\n indexes.push(result);\n }\n }\n }\n }\n if (indexes.length === 0) {\n return this.manager.response.done(\"No indexes found.\");\n }\n\n const isIndexAllowed = (index: string): boolean => {\n if (typeof matching !== \"string\" || !matching) {\n return true;\n }\n return index.includes(matching);\n };\n\n for (const { index, settings } of indexes) {\n if (this.manager.isAborted()) {\n return this.manager.response.aborted();\n } else if (this.manager.isCloseToTimeout()) {\n return this.manager.response.continue({\n done\n });\n }\n try {\n if (done.includes(index)) {\n continue;\n } else if (isIndexAllowed(index) === false) {\n continue;\n }\n const exists = await this.indexManager.indexExists(index);\n if (exists) {\n continue;\n }\n done.push(index);\n await this.indexManager.createIndex(index, settings);\n await this.manager.store.addInfoLog({\n message: `Index \"${index}\" created.`,\n data: {\n index\n }\n });\n } catch (ex) {\n await this.manager.store.addErrorLog({\n message: `Failed to create index \"${index}\".`,\n error: ex\n });\n }\n }\n\n return this.manager.response.done(\"Indexes created.\", {\n done\n });\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,mCAAA,GAAAC,OAAA;AAMO,MAAMC,uBAAuB,CAAC;EAI1BC,WAAWA,CAACC,OAAgB,EAAEC,YAA0B,EAAE;IAC7D,IAAI,CAACD,OAAO,GAAGA,OAAO;IAEtB,IAAI,CAACC,YAAY,GAAGA,YAAY;EACpC;EAEA,MAAaC,OAAOA,CAChBC,QAA4B,EAC5BC,IAAc,EACc;IAC5B,MAAMC,OAAO,GAAG,IAAI,CAACL,OAAO,CAACM,OAAO,CAACD,OAAO,CAACE,MAAM,CAEjDC,sEAAkC,CAACC,IAAI,CAAC;IAC1C,IAAIJ,OAAO,CAACK,MAAM,KAAK,CAAC,EAAE;MACtB,OAAO,IAAI,CAACV,OAAO,CAACW,QAAQ,CAACP,IAAI,CAAC,yBAAyB,CAAC;IAChE;IACA,MAAMQ,OAAkD,GAAG,EAAE;IAE7D,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACb,OAAO,CAACM,OAAO,CAACQ,OAAO,CAACC,WAAW,CAAC,CAAC;IAEhE,KAAK,MAAMC,MAAM,IAAIH,OAAO,EAAE;MAC1B,MAAMI,OAAO,GAAG,MAAM,IAAI,CAACjB,OAAO,CAACM,OAAO,CAACY,IAAI,CAACC,UAAU,CAAC,CAAC;MAC5D,KAAK,MAAMC,MAAM,IAAIH,OAAO,EAAE;QAC1B,KAAK,MAAMI,MAAM,IAAIhB,OAAO,EAAE;UAC1B,MAAMiB,OAAO,GAAG,MAAMD,MAAM,CAACE,YAAY,CAAC;YACtCjB,OAAO,EAAE,IAAI,CAACN,OAAO,CAACM,OAAO;YAC7BU,MAAM,EAAEA,MAAM,CAACQ,EAAE;YACjBJ,MAAM,EAAEA,MAAM,CAACK;UACnB,CAAC,CAAC;UACF,KAAK,MAAMC,MAAM,IAAIJ,OAAO,EAAE;YAC1B,IAAIV,O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