@webiny/api-headless-cms-pg-os 0.0.0-unstable.7c2def32a7 → 0.0.0-unstable.9609e4e0c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/entry/search/list.js","sources":["../../../../src/operations/entry/search/list.ts"],"sourcesContent":["import type {\n CmsEntryValues,\n CmsModel,\n CmsEntryStorageOperationsListParams,\n CmsEntryStorageOperationsListResponse,\n CmsEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport {\n createLimit,\n decodeCursor,\n encodeCursor,\n getTotalCount,\n type OpenSearchSearchResponse\n} from \"@webiny/api-opensearch\";\nimport { shouldIgnoreEsResponseError } from \"@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js\";\nimport { extractEntriesFromIndex } from \"@webiny/api-headless-cms-utils-os/helpers/entryIndexHelpers.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport type { CmsIndexEntry } from \"@webiny/api-headless-cms-utils-os/types.js\";\nimport type { SearchOperationDeps } from \"./types.js\";\nimport \"~/debuggerNamespaces.js\";\n\nexport const createListOperation = (deps: SearchOperationDeps) => {\n return async <T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n listParams: CmsEntryStorageOperationsListParams\n ): Promise<CmsEntryStorageOperationsListResponse<CmsEntry<T>>> => {\n const model = deps.getStorageOperationsModel<T>(initialModel);\n const limit = createLimit(listParams.limit);\n\n const configurations = createConfigurations(deps.indexProvider);\n const { index } = await configurations.es({ model });\n\n const body = deps.bodyBuilder.build({\n model,\n params: {\n ...listParams,\n limit,\n after: decodeCursor(listParams.after)\n }\n });\n\n let response: OpenSearchSearchResponse;\n const startedAt = Date.now();\n try {\n response = await deps.elasticsearch.search({ index, body });\n\n deps.debuggerService.log(\"cms.os.list\", () => ({\n index,\n query: body,\n /**\n * Only the response body and status. The full client response also carries\n * `meta.connection.url` (the cluster endpoint) plus request headers.\n */\n body: response.body,\n statusCode: response.statusCode,\n tookMs: Date.now() - startedAt\n }));\n } catch (error) {\n /**\n * Logged before the `index_not_found` check below, which swallows the error and returns\n * an empty result. That silent exit is exactly what is hard to see from the outside.\n */\n deps.debuggerService.log(\"cms.os.list\", () => ({\n index,\n query: body,\n error,\n tookMs: Date.now() - startedAt\n }));\n\n if (shouldIgnoreEsResponseError(error)) {\n return { hasMoreItems: false, totalCount: 0, cursor: null, items: [] };\n }\n throw new WebinyError(error.message, error.code || \"OPENSEARCH_ERROR\", {\n error,\n index,\n body,\n model\n });\n }\n\n const { hits, total } = response.body.hits;\n\n const items = extractEntriesFromIndex<T>({\n fieldRegistry: deps.fieldRegistry,\n fieldIndexRegistry: deps.fieldIndexRegistry,\n model,\n entries: hits.map(item => item._source as CmsIndexEntry<T>)\n });\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n items.pop();\n }\n\n
|
|
1
|
+
{"version":3,"file":"operations/entry/search/list.js","sources":["../../../../src/operations/entry/search/list.ts"],"sourcesContent":["import type {\n CmsEntryValues,\n CmsModel,\n CmsEntryStorageOperationsListParams,\n CmsEntryStorageOperationsListResponse,\n CmsEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport {\n createLimit,\n decodeCursor,\n encodeCursor,\n getTotalCount,\n type OpenSearchSearchResponse\n} from \"@webiny/api-opensearch\";\nimport { shouldIgnoreEsResponseError } from \"@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js\";\nimport { extractEntriesFromIndex } from \"@webiny/api-headless-cms-utils-os/helpers/entryIndexHelpers.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport type { CmsIndexEntry } from \"@webiny/api-headless-cms-utils-os/types.js\";\nimport type { SearchOperationDeps } from \"./types.js\";\nimport \"~/debuggerNamespaces.js\";\n\nexport const createListOperation = (deps: SearchOperationDeps) => {\n return async <T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n listParams: CmsEntryStorageOperationsListParams\n ): Promise<CmsEntryStorageOperationsListResponse<CmsEntry<T>>> => {\n const model = deps.getStorageOperationsModel<T>(initialModel);\n const limit = createLimit(listParams.limit);\n\n const configurations = createConfigurations(deps.indexProvider);\n const { index } = await configurations.es({ model });\n\n const body = deps.bodyBuilder.build({\n model,\n params: {\n ...listParams,\n limit,\n after: decodeCursor(listParams.after)\n }\n });\n\n let response: OpenSearchSearchResponse;\n const startedAt = Date.now();\n try {\n response = await deps.elasticsearch.search({ index, body });\n\n deps.debuggerService.log(\"cms.os.list\", () => ({\n index,\n query: body,\n /**\n * Only the response body and status. The full client response also carries\n * `meta.connection.url` (the cluster endpoint) plus request headers.\n */\n body: response.body,\n statusCode: response.statusCode,\n tookMs: Date.now() - startedAt\n }));\n } catch (error) {\n /**\n * Logged before the `index_not_found` check below, which swallows the error and returns\n * an empty result. That silent exit is exactly what is hard to see from the outside.\n */\n deps.debuggerService.log(\"cms.os.list\", () => ({\n index,\n query: body,\n error,\n tookMs: Date.now() - startedAt\n }));\n\n if (shouldIgnoreEsResponseError(error)) {\n return { hasMoreItems: false, totalCount: 0, cursor: null, items: [] };\n }\n throw new WebinyError(error.message, error.code || \"OPENSEARCH_ERROR\", {\n error,\n index,\n body,\n model\n });\n }\n\n const { hits, total } = response.body.hits;\n\n const items = extractEntriesFromIndex<T>({\n fieldRegistry: deps.fieldRegistry,\n fieldIndexRegistry: deps.fieldIndexRegistry,\n model,\n entries: hits.map(item => item._source as CmsIndexEntry<T>)\n });\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n items.pop();\n }\n\n const cursor = items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null;\n\n return {\n hasMoreItems,\n totalCount: getTotalCount(total),\n cursor,\n items\n };\n };\n};\n"],"names":["createListOperation","deps","initialModel","listParams","model","limit","createLimit","configurations","createConfigurations","index","body","decodeCursor","response","startedAt","Date","error","shouldIgnoreEsResponseError","WebinyError","hits","total","items","extractEntriesFromIndex","item","hasMoreItems","cursor","encodeCursor","getTotalCount"],"mappings":";;;;;;AAsBO,MAAMA,sBAAsB,CAACC,OACzB,OACHC,cACAC;QAEA,MAAMC,QAAQH,KAAK,yBAAyB,CAAIC;QAChD,MAAMG,QAAQC,YAAYH,WAAW,KAAK;QAE1C,MAAMI,iBAAiBC,qBAAqBP,KAAK,aAAa;QAC9D,MAAM,EAAEQ,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YAAEH;QAAM;QAElD,MAAMM,OAAOT,KAAK,WAAW,CAAC,KAAK,CAAC;YAChCG;YACA,QAAQ;gBACJ,GAAGD,UAAU;gBACbE;gBACA,OAAOM,aAAaR,WAAW,KAAK;YACxC;QACJ;QAEA,IAAIS;QACJ,MAAMC,YAAYC,KAAK,GAAG;QAC1B,IAAI;YACAF,WAAW,MAAMX,KAAK,aAAa,CAAC,MAAM,CAAC;gBAAEQ;gBAAOC;YAAK;YAEzDT,KAAK,eAAe,CAAC,GAAG,CAAC,eAAe,IAAO;oBAC3CQ;oBACA,OAAOC;oBAKP,MAAME,SAAS,IAAI;oBACnB,YAAYA,SAAS,UAAU;oBAC/B,QAAQE,KAAK,GAAG,KAAKD;gBACzB;QACJ,EAAE,OAAOE,OAAO;YAKZd,KAAK,eAAe,CAAC,GAAG,CAAC,eAAe,IAAO;oBAC3CQ;oBACA,OAAOC;oBACPK;oBACA,QAAQD,KAAK,GAAG,KAAKD;gBACzB;YAEA,IAAIG,4BAA4BD,QAC5B,OAAO;gBAAE,cAAc;gBAAO,YAAY;gBAAG,QAAQ;gBAAM,OAAO,EAAE;YAAC;YAEzE,MAAM,IAAIE,cAAYF,MAAM,OAAO,EAAEA,MAAM,IAAI,IAAI,oBAAoB;gBACnEA;gBACAN;gBACAC;gBACAN;YACJ;QACJ;QAEA,MAAM,EAAEc,IAAI,EAAEC,KAAK,EAAE,GAAGP,SAAS,IAAI,CAAC,IAAI;QAE1C,MAAMQ,QAAQC,wBAA2B;YACrC,eAAepB,KAAK,aAAa;YACjC,oBAAoBA,KAAK,kBAAkB;YAC3CG;YACA,SAASc,KAAK,GAAG,CAACI,CAAAA,OAAQA,KAAK,OAAO;QAC1C;QAEA,MAAMC,eAAeH,MAAM,MAAM,GAAGf;QACpC,IAAIkB,cACAH,MAAM,GAAG;QAGb,MAAMI,SAASJ,MAAM,MAAM,GAAG,IAAIK,aAAaP,IAAI,CAACE,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,KAAK,OAAO;QAEtF,OAAO;YACHG;YACA,YAAYG,cAAcP;YAC1BK;YACAJ;QACJ;IACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-pg-os",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.9609e4e0c9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"author": "Webiny Ltd.",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@webiny/api": "0.0.0-unstable.
|
|
27
|
-
"@webiny/api-core": "0.0.0-unstable.
|
|
28
|
-
"@webiny/api-core-sql": "0.0.0-unstable.
|
|
29
|
-
"@webiny/api-headless-cms": "0.0.0-unstable.
|
|
30
|
-
"@webiny/api-headless-cms-sql": "0.0.0-unstable.
|
|
31
|
-
"@webiny/api-headless-cms-storage": "0.0.0-unstable.
|
|
32
|
-
"@webiny/api-headless-cms-utils-os": "0.0.0-unstable.
|
|
33
|
-
"@webiny/api-opensearch": "0.0.0-unstable.
|
|
34
|
-
"@webiny/api-sync-to-opensearch": "0.0.0-unstable.
|
|
35
|
-
"@webiny/db-utils": "0.0.0-unstable.
|
|
36
|
-
"@webiny/error": "0.0.0-unstable.
|
|
37
|
-
"@webiny/feature": "0.0.0-unstable.
|
|
38
|
-
"@webiny/handler": "0.0.0-unstable.
|
|
39
|
-
"@webiny/plugins": "0.0.0-unstable.
|
|
40
|
-
"@webiny/utils": "0.0.0-unstable.
|
|
26
|
+
"@webiny/api": "0.0.0-unstable.9609e4e0c9",
|
|
27
|
+
"@webiny/api-core": "0.0.0-unstable.9609e4e0c9",
|
|
28
|
+
"@webiny/api-core-sql": "0.0.0-unstable.9609e4e0c9",
|
|
29
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.9609e4e0c9",
|
|
30
|
+
"@webiny/api-headless-cms-sql": "0.0.0-unstable.9609e4e0c9",
|
|
31
|
+
"@webiny/api-headless-cms-storage": "0.0.0-unstable.9609e4e0c9",
|
|
32
|
+
"@webiny/api-headless-cms-utils-os": "0.0.0-unstable.9609e4e0c9",
|
|
33
|
+
"@webiny/api-opensearch": "0.0.0-unstable.9609e4e0c9",
|
|
34
|
+
"@webiny/api-sync-to-opensearch": "0.0.0-unstable.9609e4e0c9",
|
|
35
|
+
"@webiny/db-utils": "0.0.0-unstable.9609e4e0c9",
|
|
36
|
+
"@webiny/error": "0.0.0-unstable.9609e4e0c9",
|
|
37
|
+
"@webiny/feature": "0.0.0-unstable.9609e4e0c9",
|
|
38
|
+
"@webiny/handler": "0.0.0-unstable.9609e4e0c9",
|
|
39
|
+
"@webiny/plugins": "0.0.0-unstable.9609e4e0c9",
|
|
40
|
+
"@webiny/utils": "0.0.0-unstable.9609e4e0c9",
|
|
41
41
|
"knex": "3.3.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@electric-sql/pglite": "0.5.
|
|
45
|
-
"@electric-sql/pglite-socket": "0.2.
|
|
46
|
-
"@webiny/api-sync-pg-to-opensearch": "0.0.0-unstable.
|
|
47
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
44
|
+
"@electric-sql/pglite": "0.5.13",
|
|
45
|
+
"@electric-sql/pglite-socket": "0.2.16",
|
|
46
|
+
"@webiny/api-sync-pg-to-opensearch": "0.0.0-unstable.9609e4e0c9",
|
|
47
|
+
"@webiny/build-tools": "0.0.0-unstable.9609e4e0c9",
|
|
48
48
|
"@webiny/di": "2.0.0",
|
|
49
49
|
"@webiny/stdlib": "0.0.21",
|
|
50
50
|
"typescript": "7.0.2",
|
|
51
|
-
"vitest": "
|
|
51
|
+
"vitest": "5.0.5"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|