@webiny/api-opensearch 6.3.0 → 6.4.0-beta.1

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.
Files changed (139) hide show
  1. package/client.js +52 -62
  2. package/client.js.map +1 -1
  3. package/cursors.js +20 -32
  4. package/cursors.js.map +1 -1
  5. package/db/entity.js +14 -16
  6. package/db/entity.js.map +1 -1
  7. package/db/index.js +0 -2
  8. package/db/table.js +10 -14
  9. package/db/table.js.map +1 -1
  10. package/db/types.js +0 -3
  11. package/exports/api/opensearch.js +0 -2
  12. package/features/OpenSearchClient/OpenSearchClient.js +13 -10
  13. package/features/OpenSearchClient/OpenSearchClient.js.map +1 -1
  14. package/features/OpenSearchClient/abstraction.js +2 -1
  15. package/features/OpenSearchClient/abstraction.js.map +1 -1
  16. package/features/OpenSearchClient/feature.js +6 -5
  17. package/features/OpenSearchClient/feature.js.map +1 -1
  18. package/features/OpenSearchClientFactory/OpenSearchClientFactory.js +8 -9
  19. package/features/OpenSearchClientFactory/OpenSearchClientFactory.js.map +1 -1
  20. package/features/OpenSearchClientFactory/abstraction.js +2 -1
  21. package/features/OpenSearchClientFactory/abstraction.js.map +1 -1
  22. package/features/OpenSearchClientFactory/feature.js +6 -5
  23. package/features/OpenSearchClientFactory/feature.js.map +1 -1
  24. package/features/OpenSearchContext/OpenSearchContext.js +11 -10
  25. package/features/OpenSearchContext/OpenSearchContext.js.map +1 -1
  26. package/features/OpenSearchContext/abstraction.js +2 -1
  27. package/features/OpenSearchContext/abstraction.js.map +1 -1
  28. package/features/OpenSearchContext/feature.js +7 -8
  29. package/features/OpenSearchContext/feature.js.map +1 -1
  30. package/index.js +14 -16
  31. package/index.js.map +1 -1
  32. package/indexConfiguration/base.js +25 -26
  33. package/indexConfiguration/base.js.map +1 -1
  34. package/indexConfiguration/common.js +39 -41
  35. package/indexConfiguration/common.js.map +1 -1
  36. package/indexConfiguration/index.js +0 -2
  37. package/indexPrefix.js +2 -3
  38. package/indexPrefix.js.map +1 -1
  39. package/indices.js +8 -16
  40. package/indices.js.map +1 -1
  41. package/limit.js +5 -27
  42. package/limit.js.map +1 -1
  43. package/normalize.js +50 -49
  44. package/normalize.js.map +1 -1
  45. package/operations/OpenSearchCatHealth.js +24 -25
  46. package/operations/OpenSearchCatHealth.js.map +1 -1
  47. package/operations/OpenSearchCatNodes.js +22 -23
  48. package/operations/OpenSearchCatNodes.js.map +1 -1
  49. package/operations/index.js +0 -2
  50. package/operations/stripConnectionFromException.js +11 -14
  51. package/operations/stripConnectionFromException.js.map +1 -1
  52. package/operations/types.js +6 -5
  53. package/operations/types.js.map +1 -1
  54. package/operators.js +20 -7
  55. package/operators.js.map +1 -1
  56. package/package.json +11 -11
  57. package/plugins/definition/OpenSearchBodyModifierPlugin.js +12 -13
  58. package/plugins/definition/OpenSearchBodyModifierPlugin.js.map +1 -1
  59. package/plugins/definition/OpenSearchFieldPlugin.js +43 -60
  60. package/plugins/definition/OpenSearchFieldPlugin.js.map +1 -1
  61. package/plugins/definition/OpenSearchIndexPlugin.js +12 -13
  62. package/plugins/definition/OpenSearchIndexPlugin.js.map +1 -1
  63. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js +5 -5
  64. package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js.map +1 -1
  65. package/plugins/definition/OpenSearchQueryModifierPlugin.js +12 -13
  66. package/plugins/definition/OpenSearchQueryModifierPlugin.js.map +1 -1
  67. package/plugins/definition/OpenSearchSortModifierPlugin.js +12 -13
  68. package/plugins/definition/OpenSearchSortModifierPlugin.js.map +1 -1
  69. package/plugins/definition/index.js +0 -2
  70. package/plugins/index.js +0 -2
  71. package/plugins/operator/andIn.js +20 -28
  72. package/plugins/operator/andIn.js.map +1 -1
  73. package/plugins/operator/between.js +21 -27
  74. package/plugins/operator/between.js.map +1 -1
  75. package/plugins/operator/contains.js +21 -19
  76. package/plugins/operator/contains.js.map +1 -1
  77. package/plugins/operator/equal.js +27 -44
  78. package/plugins/operator/equal.js.map +1 -1
  79. package/plugins/operator/gt.js +18 -18
  80. package/plugins/operator/gt.js.map +1 -1
  81. package/plugins/operator/gte.js +18 -18
  82. package/plugins/operator/gte.js.map +1 -1
  83. package/plugins/operator/in.js +18 -24
  84. package/plugins/operator/in.js.map +1 -1
  85. package/plugins/operator/index.js +0 -2
  86. package/plugins/operator/lt.js +18 -18
  87. package/plugins/operator/lt.js.map +1 -1
  88. package/plugins/operator/lte.js +18 -18
  89. package/plugins/operator/lte.js.map +1 -1
  90. package/plugins/operator/not.js +29 -36
  91. package/plugins/operator/not.js.map +1 -1
  92. package/plugins/operator/notBetween.js +21 -27
  93. package/plugins/operator/notBetween.js.map +1 -1
  94. package/plugins/operator/notContains.js +21 -19
  95. package/plugins/operator/notContains.js.map +1 -1
  96. package/plugins/operator/notIn.js +18 -22
  97. package/plugins/operator/notIn.js.map +1 -1
  98. package/plugins/operator/notStartsWith.js +16 -18
  99. package/plugins/operator/notStartsWith.js.map +1 -1
  100. package/plugins/operator/startsWith.js +16 -18
  101. package/plugins/operator/startsWith.js.map +1 -1
  102. package/sharedIndex.js +2 -3
  103. package/sharedIndex.js.map +1 -1
  104. package/sort.js +29 -58
  105. package/sort.js.map +1 -1
  106. package/types.js +5 -65
  107. package/types.js.map +1 -1
  108. package/utils/createIndex.js +56 -78
  109. package/utils/createIndex.js.map +1 -1
  110. package/utils/index.js +0 -2
  111. package/utils/waitUntilHealthy/UnhealthyClusterError.js +8 -7
  112. package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -1
  113. package/utils/waitUntilHealthy/WaitUntilHealthy.js +111 -141
  114. package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -1
  115. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +8 -7
  116. package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -1
  117. package/utils/waitUntilHealthy/index.js +0 -2
  118. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +9 -10
  119. package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -1
  120. package/utils/waitUntilHealthy/reason/IReason.js +0 -3
  121. package/utils/waitUntilHealthy/reason/MemoryReason.js +9 -10
  122. package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -1
  123. package/utils/waitUntilHealthy/reason/ProcessorReason.js +9 -10
  124. package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -1
  125. package/utils/waitUntilHealthy/reason/index.js +0 -2
  126. package/where.js +41 -74
  127. package/where.js.map +1 -1
  128. package/db/index.js.map +0 -1
  129. package/db/types.js.map +0 -1
  130. package/exports/api/opensearch.js.map +0 -1
  131. package/indexConfiguration/index.js.map +0 -1
  132. package/operations/index.js.map +0 -1
  133. package/plugins/definition/index.js.map +0 -1
  134. package/plugins/index.js.map +0 -1
  135. package/plugins/operator/index.js.map +0 -1
  136. package/utils/index.js.map +0 -1
  137. package/utils/waitUntilHealthy/index.js.map +0 -1
  138. package/utils/waitUntilHealthy/reason/IReason.js.map +0 -1
  139. package/utils/waitUntilHealthy/reason/index.js.map +0 -1
package/client.js CHANGED
@@ -1,70 +1,60 @@
1
- import crypto from "crypto";
2
- import WebinyError from "@webiny/error";
1
+ import crypto_0 from "crypto";
2
+ import error from "@webiny/error";
3
3
  import { Client } from "@opensearch-project/opensearch";
4
4
  import { AwsSigv4Signer } from "@opensearch-project/opensearch/aws";
5
- export { Client };
6
5
  const clients = new Map();
7
- const createClientKey = options => {
8
- const key = JSON.stringify(options);
9
- const hash = crypto.createHash("sha256");
10
- hash.update(key);
11
- return hash.digest("hex");
6
+ const createClientKey = (options)=>{
7
+ const key = JSON.stringify(options);
8
+ const hash = crypto_0.createHash("sha256");
9
+ hash.update(key);
10
+ return hash.digest("hex");
12
11
  };
13
- export const createOpenSearchClient = options => {
14
- const key = createClientKey(options);
15
- const existing = clients.get(key);
16
- if (existing) {
17
- return existing;
18
- }
19
- const {
20
- endpoint,
21
- node,
22
- ...rest
23
- } = options;
24
- let clientOptions = {
25
- node: endpoint || node,
26
- ...rest
27
- };
28
- if (!clientOptions.auth) {
29
- const region = process.env.AWS_REGION;
30
- if (!region) {
31
- throw new WebinyError("Missing AWS_REGION environment variable.", "MISSING_AWS_REGION");
32
- }
33
- clientOptions = {
34
- ...clientOptions,
35
- ...AwsSigv4Signer({
36
- region,
37
- service: "es",
38
- getCredentials: () => {
39
- const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
40
- const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
41
- const sessionToken = process.env.AWS_SESSION_TOKEN;
42
- if (!accessKeyId || !secretAccessKey) {
43
- throw new WebinyError("Missing AWS credentials (AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY).", "MISSING_AWS_CREDENTIALS");
44
- }
45
- return Promise.resolve({
46
- accessKeyId,
47
- secretAccessKey,
48
- sessionToken
49
- });
50
- }
51
- })
52
- };
53
- }
54
- try {
55
- const client = new Client(clientOptions);
56
- clients.set(key, client);
57
- return client;
58
- } catch (ex) {
59
- const data = {
60
- error: ex,
61
- node: endpoint || node,
62
- ...rest,
63
- auth: undefined
12
+ const createOpenSearchClient = (options)=>{
13
+ const key = createClientKey(options);
14
+ const existing = clients.get(key);
15
+ if (existing) return existing;
16
+ const { endpoint, node, ...rest } = options;
17
+ let clientOptions = {
18
+ node: endpoint || node,
19
+ ...rest
64
20
  };
65
- console.error(data);
66
- throw new WebinyError("Could not connect to OpenSearch.", "OPENSEARCH_CLIENT_ERROR", data);
67
- }
21
+ if (!clientOptions.auth) {
22
+ const region = process.env.AWS_REGION;
23
+ if (!region) throw new error("Missing AWS_REGION environment variable.", "MISSING_AWS_REGION");
24
+ clientOptions = {
25
+ ...clientOptions,
26
+ ...AwsSigv4Signer({
27
+ region,
28
+ service: "es",
29
+ getCredentials: ()=>{
30
+ const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
31
+ const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
32
+ const sessionToken = process.env.AWS_SESSION_TOKEN;
33
+ if (!accessKeyId || !secretAccessKey) throw new error("Missing AWS credentials (AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY).", "MISSING_AWS_CREDENTIALS");
34
+ return Promise.resolve({
35
+ accessKeyId,
36
+ secretAccessKey,
37
+ sessionToken
38
+ });
39
+ }
40
+ })
41
+ };
42
+ }
43
+ try {
44
+ const client = new Client(clientOptions);
45
+ clients.set(key, client);
46
+ return client;
47
+ } catch (ex) {
48
+ const data = {
49
+ error: ex,
50
+ node: endpoint || node,
51
+ ...rest,
52
+ auth: void 0
53
+ };
54
+ console.error(data);
55
+ throw new error("Could not connect to OpenSearch.", "OPENSEARCH_CLIENT_ERROR", data);
56
+ }
68
57
  };
58
+ export { Client, createOpenSearchClient };
69
59
 
70
60
  //# sourceMappingURL=client.js.map
package/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["crypto","WebinyError","Client","AwsSigv4Signer","clients","Map","createClientKey","options","key","JSON","stringify","hash","createHash","update","digest","createOpenSearchClient","existing","get","endpoint","node","rest","clientOptions","auth","region","process","env","AWS_REGION","service","getCredentials","accessKeyId","AWS_ACCESS_KEY_ID","secretAccessKey","AWS_SECRET_ACCESS_KEY","sessionToken","AWS_SESSION_TOKEN","Promise","resolve","client","set","ex","data","error","undefined","console"],"sources":["client.ts"],"sourcesContent":["import crypto from \"crypto\";\nimport WebinyError from \"@webiny/error\";\nimport { Client } from \"@opensearch-project/opensearch\";\nimport type { ClientOptions } from \"@opensearch-project/opensearch\";\nimport { AwsSigv4Signer } from \"@opensearch-project/opensearch/aws\";\n\nexport interface OpenSearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nexport { Client };\nexport type { OpenSearchClientOptions as ClientOptions };\n\nconst clients = new Map<string, Client>();\n\nconst createClientKey = (options: OpenSearchClientOptions): string => {\n const key = JSON.stringify(options);\n const hash = crypto.createHash(\"sha256\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nexport const createOpenSearchClient = (options: OpenSearchClientOptions): Client => {\n const key = createClientKey(options);\n const existing = clients.get(key);\n if (existing) {\n return existing;\n }\n\n const { endpoint, node, ...rest } = options;\n\n let clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n if (!clientOptions.auth) {\n const region = process.env.AWS_REGION;\n if (!region) {\n throw new WebinyError(\"Missing AWS_REGION environment variable.\", \"MISSING_AWS_REGION\");\n }\n\n clientOptions = {\n ...clientOptions,\n ...AwsSigv4Signer({\n region,\n service: \"es\",\n getCredentials: () => {\n const accessKeyId = process.env.AWS_ACCESS_KEY_ID;\n const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;\n const sessionToken = process.env.AWS_SESSION_TOKEN;\n\n if (!accessKeyId || !secretAccessKey) {\n throw new WebinyError(\n \"Missing AWS credentials (AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY).\",\n \"MISSING_AWS_CREDENTIALS\"\n );\n }\n\n return Promise.resolve({ accessKeyId, secretAccessKey, sessionToken });\n }\n })\n };\n }\n\n try {\n const client = new Client(clientOptions);\n clients.set(key, client);\n return client;\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.error(data);\n throw new WebinyError(\"Could not connect to OpenSearch.\", \"OPENSEARCH_CLIENT_ERROR\", data);\n }\n};\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,OAAOC,WAAW,MAAM,eAAe;AACvC,SAASC,MAAM,QAAQ,gCAAgC;AAEvD,SAASC,cAAc,QAAQ,oCAAoC;AAMnE,SAASD,MAAM;AAGf,MAAME,OAAO,GAAG,IAAIC,GAAG,CAAiB,CAAC;AAEzC,MAAMC,eAAe,GAAIC,OAAgC,IAAa;EAClE,MAAMC,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC;EACnC,MAAMI,IAAI,GAAGX,MAAM,CAACY,UAAU,CAAC,QAAQ,CAAC;EACxCD,IAAI,CAACE,MAAM,CAACL,GAAG,CAAC;EAChB,OAAOG,IAAI,CAACG,MAAM,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,OAAO,MAAMC,sBAAsB,GAAIR,OAAgC,IAAa;EAChF,MAAMC,GAAG,GAAGF,eAAe,CAACC,OAAO,CAAC;EACpC,MAAMS,QAAQ,GAAGZ,OAAO,CAACa,GAAG,CAACT,GAAG,CAAC;EACjC,IAAIQ,QAAQ,EAAE;IACV,OAAOA,QAAQ;EACnB;EAEA,MAAM;IAAEE,QAAQ;IAAEC,IAAI;IAAE,GAAGC;EAAK,CAAC,GAAGb,OAAO;EAE3C,IAAIc,aAA4B,GAAG;IAC/BF,IAAI,EAAED,QAAQ,IAAIC,IAAI;IACtB,GAAGC;EACP,CAAC;EAED,IAAI,CAACC,aAAa,CAACC,IAAI,EAAE;IACrB,MAAMC,MAAM,GAAGC,OAAO,CAACC,GAAG,CAACC,UAAU;IACrC,IAAI,CAACH,MAAM,EAAE;MACT,MAAM,IAAItB,WAAW,CAAC,0CAA0C,EAAE,oBAAoB,CAAC;IAC3F;IAEAoB,aAAa,GAAG;MACZ,GAAGA,aAAa;MAChB,GAAGlB,cAAc,CAAC;QACdoB,MAAM;QACNI,OAAO,EAAE,IAAI;QACbC,cAAc,EAAEA,CAAA,KAAM;UAClB,MAAMC,WAAW,GAAGL,OAAO,CAACC,GAAG,CAACK,iBAAiB;UACjD,MAAMC,eAAe,GAAGP,OAAO,CAACC,GAAG,CAACO,qBAAqB;UACzD,MAAMC,YAAY,GAAGT,OAAO,CAACC,GAAG,CAACS,iBAAiB;UAElD,IAAI,CAACL,WAAW,IAAI,CAACE,eAAe,EAAE;YAClC,MAAM,IAAI9B,WAAW,CACjB,uEAAuE,EACvE,yBACJ,CAAC;UACL;UAEA,OAAOkC,OAAO,CAACC,OAAO,CAAC;YAAEP,WAAW;YAAEE,eAAe;YAAEE;UAAa,CAAC,CAAC;QAC1E;MACJ,CAAC;IACL,CAAC;EACL;EAEA,IAAI;IACA,MAAMI,MAAM,GAAG,IAAInC,MAAM,CAACmB,aAAa,CAAC;IACxCjB,OAAO,CAACkC,GAAG,CAAC9B,GAAG,EAAE6B,MAAM,CAAC;IACxB,OAAOA,MAAM;EACjB,CAAC,CAAC,OAAOE,EAAE,EAAE;IACT,MAAMC,IAAI,GAAG;MACTC,KAAK,EAAEF,EAAE;MACTpB,IAAI,EAAED,QAAQ,IAAIC,IAAI;MACtB,GAAGC,IAAI;MACPE,IAAI,EAAEoB;IACV,CAAC;IACDC,OAAO,CAACF,KAAK,CAACD,IAAI,CAAC;IACnB,MAAM,IAAIvC,WAAW,CAAC,kCAAkC,EAAE,yBAAyB,EAAEuC,IAAI,CAAC;EAC9F;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"client.js","sources":["../src/client.ts"],"sourcesContent":["import crypto from \"crypto\";\nimport WebinyError from \"@webiny/error\";\nimport { Client } from \"@opensearch-project/opensearch\";\nimport type { ClientOptions } from \"@opensearch-project/opensearch\";\nimport { AwsSigv4Signer } from \"@opensearch-project/opensearch/aws\";\n\nexport interface OpenSearchClientOptions extends ClientOptions {\n endpoint?: string;\n}\n\nexport { Client };\nexport type { OpenSearchClientOptions as ClientOptions };\n\nconst clients = new Map<string, Client>();\n\nconst createClientKey = (options: OpenSearchClientOptions): string => {\n const key = JSON.stringify(options);\n const hash = crypto.createHash(\"sha256\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nexport const createOpenSearchClient = (options: OpenSearchClientOptions): Client => {\n const key = createClientKey(options);\n const existing = clients.get(key);\n if (existing) {\n return existing;\n }\n\n const { endpoint, node, ...rest } = options;\n\n let clientOptions: ClientOptions = {\n node: endpoint || node,\n ...rest\n };\n\n if (!clientOptions.auth) {\n const region = process.env.AWS_REGION;\n if (!region) {\n throw new WebinyError(\"Missing AWS_REGION environment variable.\", \"MISSING_AWS_REGION\");\n }\n\n clientOptions = {\n ...clientOptions,\n ...AwsSigv4Signer({\n region,\n service: \"es\",\n getCredentials: () => {\n const accessKeyId = process.env.AWS_ACCESS_KEY_ID;\n const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;\n const sessionToken = process.env.AWS_SESSION_TOKEN;\n\n if (!accessKeyId || !secretAccessKey) {\n throw new WebinyError(\n \"Missing AWS credentials (AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY).\",\n \"MISSING_AWS_CREDENTIALS\"\n );\n }\n\n return Promise.resolve({ accessKeyId, secretAccessKey, sessionToken });\n }\n })\n };\n }\n\n try {\n const client = new Client(clientOptions);\n clients.set(key, client);\n return client;\n } catch (ex) {\n const data = {\n error: ex,\n node: endpoint || node,\n ...rest,\n auth: undefined\n };\n console.error(data);\n throw new WebinyError(\"Could not connect to OpenSearch.\", \"OPENSEARCH_CLIENT_ERROR\", data);\n }\n};\n"],"names":["clients","Map","createClientKey","options","key","JSON","hash","crypto","createOpenSearchClient","existing","endpoint","node","rest","clientOptions","region","process","WebinyError","AwsSigv4Signer","accessKeyId","secretAccessKey","sessionToken","Promise","client","Client","ex","data","undefined","console"],"mappings":";;;;AAaA,MAAMA,UAAU,IAAIC;AAEpB,MAAMC,kBAAkB,CAACC;IACrB,MAAMC,MAAMC,KAAK,SAAS,CAACF;IAC3B,MAAMG,OAAOC,SAAAA,UAAiB,CAAC;IAC/BD,KAAK,MAAM,CAACF;IACZ,OAAOE,KAAK,MAAM,CAAC;AACvB;AAEO,MAAME,yBAAyB,CAACL;IACnC,MAAMC,MAAMF,gBAAgBC;IAC5B,MAAMM,WAAWT,QAAQ,GAAG,CAACI;IAC7B,IAAIK,UACA,OAAOA;IAGX,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGC,MAAM,GAAGT;IAEpC,IAAIU,gBAA+B;QAC/B,MAAMH,YAAYC;QAClB,GAAGC,IAAI;IACX;IAEA,IAAI,CAACC,cAAc,IAAI,EAAE;QACrB,MAAMC,SAASC,QAAQ,GAAG,CAAC,UAAU;QACrC,IAAI,CAACD,QACD,MAAM,IAAIE,MAAY,4CAA4C;QAGtEH,gBAAgB;YACZ,GAAGA,aAAa;YAChB,GAAGI,eAAe;gBACdH;gBACA,SAAS;gBACT,gBAAgB;oBACZ,MAAMI,cAAcH,QAAQ,GAAG,CAAC,iBAAiB;oBACjD,MAAMI,kBAAkBJ,QAAQ,GAAG,CAAC,qBAAqB;oBACzD,MAAMK,eAAeL,QAAQ,GAAG,CAAC,iBAAiB;oBAElD,IAAI,CAACG,eAAe,CAACC,iBACjB,MAAM,IAAIH,MACN,yEACA;oBAIR,OAAOK,QAAQ,OAAO,CAAC;wBAAEH;wBAAaC;wBAAiBC;oBAAa;gBACxE;YACJ,EAAE;QACN;IACJ;IAEA,IAAI;QACA,MAAME,SAAS,IAAIC,OAAOV;QAC1Bb,QAAQ,GAAG,CAACI,KAAKkB;QACjB,OAAOA;IACX,EAAE,OAAOE,IAAI;QACT,MAAMC,OAAO;YACT,OAAOD;YACP,MAAMd,YAAYC;YAClB,GAAGC,IAAI;YACP,MAAMc;QACV;QACAC,QAAQ,KAAK,CAACF;QACd,MAAM,IAAIT,MAAY,oCAAoC,2BAA2BS;IACzF;AACJ"}
package/cursors.js CHANGED
@@ -1,37 +1,25 @@
1
- /**
2
- * Encode a received cursor value into something that can be passed on to the user.
3
- */
4
- export const encodeCursor = input => {
5
- if (!input) {
6
- return undefined;
7
- }
8
- const cursor = Array.isArray(input) ? input.filter(item => item != null).map(item => encodeURIComponent(item)) : encodeURIComponent(input);
9
- try {
10
- return Buffer.from(JSON.stringify(cursor)).toString("base64");
11
- } catch (ex) {
12
- console.error(ex.message);
13
- }
14
- return undefined;
1
+ const encodeCursor = (input)=>{
2
+ if (!input) return;
3
+ const cursor = Array.isArray(input) ? input.filter((item)=>null != item).map((item)=>encodeURIComponent(item)) : encodeURIComponent(input);
4
+ try {
5
+ return Buffer.from(JSON.stringify(cursor)).toString("base64");
6
+ } catch (ex) {
7
+ console.error(ex.message);
8
+ }
15
9
  };
16
- /**
17
- * Decode a received value into an OpenSearch cursor.
18
- * If no value is received or is not decodable, return undefined.
19
- */
20
- export const decodeCursor = cursor => {
21
- if (!cursor) {
22
- return undefined;
23
- }
24
- try {
25
- const value = JSON.parse(Buffer.from(cursor, "base64").toString("ascii"));
26
- if (Array.isArray(value)) {
27
- return value.filter(item => item !== null).map(decodeURIComponent);
10
+ const decodeCursor = (cursor)=>{
11
+ if (!cursor) return;
12
+ try {
13
+ const value = JSON.parse(Buffer.from(cursor, "base64").toString("ascii"));
14
+ if (Array.isArray(value)) return value.filter((item)=>null !== item).map(decodeURIComponent);
15
+ const decoded = decodeURIComponent(value);
16
+ return decoded ? [
17
+ decoded
18
+ ] : void 0;
19
+ } catch (ex) {
20
+ console.error(ex.message);
28
21
  }
29
- const decoded = decodeURIComponent(value);
30
- return decoded ? [decoded] : undefined;
31
- } catch (ex) {
32
- console.error(ex.message);
33
- }
34
- return undefined;
35
22
  };
23
+ export { decodeCursor, encodeCursor };
36
24
 
37
25
  //# sourceMappingURL=cursors.js.map
package/cursors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["encodeCursor","input","undefined","cursor","Array","isArray","filter","item","map","encodeURIComponent","Buffer","from","JSON","stringify","toString","ex","console","error","message","decodeCursor","value","parse","decodeURIComponent","decoded"],"sources":["cursors.ts"],"sourcesContent":["import type { PrimitiveValue } from \"~/types.js\";\n\n/**\n * Encode a received cursor value into something that can be passed on to the user.\n */\nexport const encodeCursor = (input?: PrimitiveValue[]): string | undefined => {\n if (!input) {\n return undefined;\n }\n\n const cursor = Array.isArray(input)\n ? input\n .filter((item: PrimitiveValue): item is string | number | boolean => item != null)\n .map(item => encodeURIComponent(item))\n : encodeURIComponent(input);\n\n try {\n return Buffer.from(JSON.stringify(cursor)).toString(\"base64\");\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n/**\n * Decode a received value into an OpenSearch cursor.\n * If no value is received or is not decodable, return undefined.\n */\nexport const decodeCursor = (cursor?: string | null): PrimitiveValue[] | undefined => {\n if (!cursor) {\n return undefined;\n }\n try {\n const value = JSON.parse(Buffer.from(cursor, \"base64\").toString(\"ascii\"));\n if (Array.isArray(value)) {\n return value.filter(item => item !== null).map(decodeURIComponent);\n }\n const decoded = decodeURIComponent(value);\n return decoded ? [decoded] : undefined;\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n"],"mappings":"AAEA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAIC,KAAwB,IAAyB;EAC1E,IAAI,CAACA,KAAK,EAAE;IACR,OAAOC,SAAS;EACpB;EAEA,MAAMC,MAAM,GAAGC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,GAC7BA,KAAK,CACAK,MAAM,CAAEC,IAAoB,IAAwCA,IAAI,IAAI,IAAI,CAAC,CACjFC,GAAG,CAACD,IAAI,IAAIE,kBAAkB,CAACF,IAAI,CAAC,CAAC,GAC1CE,kBAAkB,CAACR,KAAK,CAAC;EAE/B,IAAI;IACA,OAAOS,MAAM,CAACC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACV,MAAM,CAAC,CAAC,CAACW,QAAQ,CAAC,QAAQ,CAAC;EACjE,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOhB,SAAS;AACpB,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMiB,YAAY,GAAIhB,MAAsB,IAAmC;EAClF,IAAI,CAACA,MAAM,EAAE;IACT,OAAOD,SAAS;EACpB;EACA,IAAI;IACA,MAAMkB,KAAK,GAAGR,IAAI,CAACS,KAAK,CAACX,MAAM,CAACC,IAAI,CAACR,MAAM,EAAE,QAAQ,CAAC,CAACW,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzE,IAAIV,KAAK,CAACC,OAAO,CAACe,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK,CAACd,MAAM,CAACC,IAAI,IAAIA,IAAI,KAAK,IAAI,CAAC,CAACC,GAAG,CAACc,kBAAkB,CAAC;IACtE;IACA,MAAMC,OAAO,GAAGD,kBAAkB,CAACF,KAAK,CAAC;IACzC,OAAOG,OAAO,GAAG,CAACA,OAAO,CAAC,GAAGrB,SAAS;EAC1C,CAAC,CAAC,OAAOa,EAAE,EAAE;IACTC,OAAO,CAACC,KAAK,CAACF,EAAE,CAACG,OAAO,CAAC;EAC7B;EACA,OAAOhB,SAAS;AACpB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"cursors.js","sources":["../src/cursors.ts"],"sourcesContent":["import type { PrimitiveValue } from \"~/types.js\";\n\n/**\n * Encode a received cursor value into something that can be passed on to the user.\n */\nexport const encodeCursor = (input?: PrimitiveValue[]): string | undefined => {\n if (!input) {\n return undefined;\n }\n\n const cursor = Array.isArray(input)\n ? input\n .filter((item: PrimitiveValue): item is string | number | boolean => item != null)\n .map(item => encodeURIComponent(item))\n : encodeURIComponent(input);\n\n try {\n return Buffer.from(JSON.stringify(cursor)).toString(\"base64\");\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n/**\n * Decode a received value into an OpenSearch cursor.\n * If no value is received or is not decodable, return undefined.\n */\nexport const decodeCursor = (cursor?: string | null): PrimitiveValue[] | undefined => {\n if (!cursor) {\n return undefined;\n }\n try {\n const value = JSON.parse(Buffer.from(cursor, \"base64\").toString(\"ascii\"));\n if (Array.isArray(value)) {\n return value.filter(item => item !== null).map(decodeURIComponent);\n }\n const decoded = decodeURIComponent(value);\n return decoded ? [decoded] : undefined;\n } catch (ex) {\n console.error(ex.message);\n }\n return undefined;\n};\n"],"names":["encodeCursor","input","cursor","Array","item","encodeURIComponent","Buffer","JSON","ex","console","decodeCursor","value","decodeURIComponent","decoded","undefined"],"mappings":"AAKO,MAAMA,eAAe,CAACC;IACzB,IAAI,CAACA,OACD;IAGJ,MAAMC,SAASC,MAAM,OAAO,CAACF,SACvBA,MACK,MAAM,CAAC,CAACG,OAA4DA,AAAQ,QAARA,MACpE,GAAG,CAACA,CAAAA,OAAQC,mBAAmBD,SACpCC,mBAAmBJ;IAEzB,IAAI;QACA,OAAOK,OAAO,IAAI,CAACC,KAAK,SAAS,CAACL,SAAS,QAAQ,CAAC;IACxD,EAAE,OAAOM,IAAI;QACTC,QAAQ,KAAK,CAACD,GAAG,OAAO;IAC5B;AAEJ;AAKO,MAAME,eAAe,CAACR;IACzB,IAAI,CAACA,QACD;IAEJ,IAAI;QACA,MAAMS,QAAQJ,KAAK,KAAK,CAACD,OAAO,IAAI,CAACJ,QAAQ,UAAU,QAAQ,CAAC;QAChE,IAAIC,MAAM,OAAO,CAACQ,QACd,OAAOA,MAAM,MAAM,CAACP,CAAAA,OAAQA,AAAS,SAATA,MAAe,GAAG,CAACQ;QAEnD,MAAMC,UAAUD,mBAAmBD;QACnC,OAAOE,UAAU;YAACA;SAAQ,GAAGC;IACjC,EAAE,OAAON,IAAI;QACTC,QAAQ,KAAK,CAACD,GAAG,OAAO;IAC5B;AAEJ"}
package/db/entity.js CHANGED
@@ -1,20 +1,18 @@
1
1
  import { createEntity, standardEntityAttributes } from "@webiny/db-dynamodb";
2
- export const createOpenSearchEntity = params => {
3
- const {
4
- table,
5
- entityName
6
- } = params;
7
- return createEntity({
8
- name: entityName,
9
- table: table.table,
10
- attributes: {
11
- ...standardEntityAttributes,
12
- index: {
13
- type: "string",
14
- required: true
15
- }
16
- }
17
- });
2
+ const createOpenSearchEntity = (params)=>{
3
+ const { table, entityName } = params;
4
+ return createEntity({
5
+ name: entityName,
6
+ table: table.table,
7
+ attributes: {
8
+ ...standardEntityAttributes,
9
+ index: {
10
+ type: "string",
11
+ required: true
12
+ }
13
+ }
14
+ });
18
15
  };
16
+ export { createOpenSearchEntity };
19
17
 
20
18
  //# sourceMappingURL=entity.js.map
package/db/entity.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createEntity","standardEntityAttributes","createOpenSearchEntity","params","table","entityName","name","attributes","index","type","required"],"sources":["entity.ts"],"sourcesContent":["import { createEntity, type ITable, standardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport type { IOpenSearchEntity, IOpenSearchEntityAttributes } from \"~/db/types.js\";\n\nexport interface ICreateOpenSearchEntityParams {\n table: ITable;\n entityName: string;\n}\n\nexport const createOpenSearchEntity = (\n params: ICreateOpenSearchEntityParams\n): IOpenSearchEntity => {\n const { table, entityName } = params;\n return createEntity<IOpenSearchEntityAttributes>({\n name: entityName,\n table: table.table,\n attributes: {\n ...standardEntityAttributes,\n index: {\n type: \"string\",\n required: true\n }\n }\n });\n};\n"],"mappings":"AAAA,SAASA,YAAY,EAAeC,wBAAwB,QAAQ,qBAAqB;AAQzF,OAAO,MAAMC,sBAAsB,GAC/BC,MAAqC,IACjB;EACpB,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,MAAM;EACpC,OAAOH,YAAY,CAA8B;IAC7CM,IAAI,EAAED,UAAU;IAChBD,KAAK,EAAEA,KAAK,CAACA,KAAK;IAClBG,UAAU,EAAE;MACR,GAAGN,wBAAwB;MAC3BO,KAAK,EAAE;QACHC,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd;IACJ;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"db/entity.js","sources":["../../src/db/entity.ts"],"sourcesContent":["import { createEntity, type ITable, standardEntityAttributes } from \"@webiny/db-dynamodb\";\nimport type { IOpenSearchEntity, IOpenSearchEntityAttributes } from \"~/db/types.js\";\n\nexport interface ICreateOpenSearchEntityParams {\n table: ITable;\n entityName: string;\n}\n\nexport const createOpenSearchEntity = (\n params: ICreateOpenSearchEntityParams\n): IOpenSearchEntity => {\n const { table, entityName } = params;\n return createEntity<IOpenSearchEntityAttributes>({\n name: entityName,\n table: table.table,\n attributes: {\n ...standardEntityAttributes,\n index: {\n type: \"string\",\n required: true\n }\n }\n });\n};\n"],"names":["createOpenSearchEntity","params","table","entityName","createEntity","standardEntityAttributes"],"mappings":";AAQO,MAAMA,yBAAyB,CAClCC;IAEA,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,aAA0C;QAC7C,MAAMD;QACN,OAAOD,MAAM,KAAK;QAClB,YAAY;YACR,GAAGG,wBAAwB;YAC3B,OAAO;gBACH,MAAM;gBACN,UAAU;YACd;QACJ;IACJ;AACJ"}
package/db/index.js CHANGED
@@ -1,5 +1,3 @@
1
1
  export * from "./table.js";
2
2
  export * from "./entity.js";
3
3
  export * from "./types.js";
4
-
5
- //# sourceMappingURL=index.js.map
package/db/table.js CHANGED
@@ -1,17 +1,13 @@
1
1
  import { createTable } from "@webiny/db-dynamodb";
2
- export const createOpenSearchTable = ({
3
- name,
4
- documentClient
5
- }) => {
6
- return createTable({
7
- name: name || process.env.DB_TABLE_OPENSEARCH,
8
- indexes: {
9
- GSI_TENANT: {
10
- partitionKey: "GSI_TENANT"
11
- }
12
- },
13
- documentClient
14
- });
15
- };
2
+ const createOpenSearchTable = ({ name, documentClient })=>createTable({
3
+ name: name || process.env.DB_TABLE_OPENSEARCH,
4
+ indexes: {
5
+ GSI_TENANT: {
6
+ partitionKey: "GSI_TENANT"
7
+ }
8
+ },
9
+ documentClient
10
+ });
11
+ export { createOpenSearchTable };
16
12
 
17
13
  //# sourceMappingURL=table.js.map
package/db/table.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createTable","createOpenSearchTable","name","documentClient","process","env","DB_TABLE_OPENSEARCH","indexes","GSI_TENANT","partitionKey"],"sources":["table.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createTable, type ITable } from \"@webiny/db-dynamodb\";\n\nexport interface ICreateOpenSearchTableParams {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createOpenSearchTable = ({\n name,\n documentClient\n}: ICreateOpenSearchTableParams): ITable => {\n return createTable({\n name: name || (process.env.DB_TABLE_OPENSEARCH as string),\n indexes: {\n GSI_TENANT: {\n partitionKey: \"GSI_TENANT\"\n }\n },\n documentClient\n });\n};\n"],"mappings":"AACA,SAASA,WAAW,QAAqB,qBAAqB;AAO9D,OAAO,MAAMC,qBAAqB,GAAGA,CAAC;EAClCC,IAAI;EACJC;AAC0B,CAAC,KAAa;EACxC,OAAOH,WAAW,CAAC;IACfE,IAAI,EAAEA,IAAI,IAAKE,OAAO,CAACC,GAAG,CAACC,mBAA8B;IACzDC,OAAO,EAAE;MACLC,UAAU,EAAE;QACRC,YAAY,EAAE;MAClB;IACJ,CAAC;IACDN;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"db/table.js","sources":["../../src/db/table.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createTable, type ITable } from \"@webiny/db-dynamodb\";\n\nexport interface ICreateOpenSearchTableParams {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createOpenSearchTable = ({\n name,\n documentClient\n}: ICreateOpenSearchTableParams): ITable => {\n return createTable({\n name: name || (process.env.DB_TABLE_OPENSEARCH as string),\n indexes: {\n GSI_TENANT: {\n partitionKey: \"GSI_TENANT\"\n }\n },\n documentClient\n });\n};\n"],"names":["createOpenSearchTable","name","documentClient","createTable","process"],"mappings":";AAQO,MAAMA,wBAAwB,CAAC,EAClCC,IAAI,EACJC,cAAc,EACa,GACpBC,YAAY;QACf,MAAMF,QAASG,QAAQ,GAAG,CAAC,mBAAmB;QAC9C,SAAS;YACL,YAAY;gBACR,cAAc;YAClB;QACJ;QACAF;IACJ"}
package/db/types.js CHANGED
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -2,5 +2,3 @@ export { createOpenSearchClient } from "../../client.js";
2
2
  export { OpenSearchClient } from "../../features/OpenSearchClient/abstraction.js";
3
3
  export { OpenSearchContext } from "../../features/OpenSearchContext/abstraction.js";
4
4
  export { OpenSearchClientFactory } from "../../features/OpenSearchClientFactory/abstraction.js";
5
-
6
- //# sourceMappingURL=opensearch.js.map
@@ -1,16 +1,19 @@
1
- import { OpenSearchClient as OpenSearchClientAbstraction } from "./abstraction.js";
1
+ import { OpenSearchClient } from "./abstraction.js";
2
2
  import { OpenSearchContext } from "../OpenSearchContext/abstraction.js";
3
3
  class OpenSearchClientImpl {
4
- constructor(context) {
5
- this.context = context;
6
- }
7
- use() {
8
- return this.context.opensearch;
9
- }
4
+ constructor(context){
5
+ this.context = context;
6
+ }
7
+ use() {
8
+ return this.context.opensearch;
9
+ }
10
10
  }
11
- export const OpenSearchClient = OpenSearchClientAbstraction.createImplementation({
12
- implementation: OpenSearchClientImpl,
13
- dependencies: [OpenSearchContext]
11
+ const OpenSearchClient_OpenSearchClient = OpenSearchClient.createImplementation({
12
+ implementation: OpenSearchClientImpl,
13
+ dependencies: [
14
+ OpenSearchContext
15
+ ]
14
16
  });
17
+ export { OpenSearchClient_OpenSearchClient as OpenSearchClient };
15
18
 
16
19
  //# sourceMappingURL=OpenSearchClient.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["OpenSearchClient","OpenSearchClientAbstraction","OpenSearchContext","OpenSearchClientImpl","constructor","context","use","opensearch","createImplementation","implementation","dependencies"],"sources":["OpenSearchClient.ts"],"sourcesContent":["import { OpenSearchClient as OpenSearchClientAbstraction } from \"./abstraction.js\";\nimport type { Client } from \"~/types.js\";\nimport { OpenSearchContext } from \"~/features/OpenSearchContext/abstraction.js\";\n\nclass OpenSearchClientImpl implements OpenSearchClientAbstraction.Interface {\n public constructor(private readonly context: OpenSearchContext.Interface) {}\n\n public use(): Client {\n return this.context.opensearch;\n }\n}\n\nexport const OpenSearchClient = OpenSearchClientAbstraction.createImplementation({\n implementation: OpenSearchClientImpl,\n dependencies: [OpenSearchContext]\n});\n"],"mappings":"AAAA,SAASA,gBAAgB,IAAIC,2BAA2B;AAExD,SAASC,iBAAiB;AAE1B,MAAMC,oBAAoB,CAAkD;EACjEC,WAAWA,CAAkBC,OAAoC,EAAE;IAAA,KAAtCA,OAAoC,GAApCA,OAAoC;EAAG;EAEpEC,GAAGA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACD,OAAO,CAACE,UAAU;EAClC;AACJ;AAEA,OAAO,MAAMP,gBAAgB,GAAGC,2BAA2B,CAACO,oBAAoB,CAAC;EAC7EC,cAAc,EAAEN,oBAAoB;EACpCO,YAAY,EAAE,CAACR,iBAAiB;AACpC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchClient/OpenSearchClient.js","sources":["../../../src/features/OpenSearchClient/OpenSearchClient.ts"],"sourcesContent":["import { OpenSearchClient as OpenSearchClientAbstraction } from \"./abstraction.js\";\nimport type { Client } from \"~/types.js\";\nimport { OpenSearchContext } from \"~/features/OpenSearchContext/abstraction.js\";\n\nclass OpenSearchClientImpl implements OpenSearchClientAbstraction.Interface {\n public constructor(private readonly context: OpenSearchContext.Interface) {}\n\n public use(): Client {\n return this.context.opensearch;\n }\n}\n\nexport const OpenSearchClient = OpenSearchClientAbstraction.createImplementation({\n implementation: OpenSearchClientImpl,\n dependencies: [OpenSearchContext]\n});\n"],"names":["OpenSearchClientImpl","context","OpenSearchClient","OpenSearchClientAbstraction","OpenSearchContext"],"mappings":";;AAIA,MAAMA;IACF,YAAoCC,OAAoC,CAAE;aAAtCA,OAAO,GAAPA;IAAuC;IAEpE,MAAc;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU;IAClC;AACJ;AAEO,MAAMC,oCAAmBC,iBAAAA,oBAAgD,CAAC;IAC7E,gBAAgBH;IAChB,cAAc;QAACI;KAAkB;AACrC"}
@@ -1,4 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- export const OpenSearchClient = createAbstraction("OpenSearch/Client");
2
+ const OpenSearchClient = createAbstraction("OpenSearch/Client");
3
+ export { OpenSearchClient };
3
4
 
4
5
  //# sourceMappingURL=abstraction.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","OpenSearchClient"],"sources":["abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client } from \"~/client.js\";\n\nexport interface IOpenSearchClient {\n use(): Client;\n}\n\nexport const OpenSearchClient = createAbstraction<IOpenSearchClient>(\"OpenSearch/Client\");\n\nexport namespace OpenSearchClient {\n export type Interface = IOpenSearchClient;\n export type Return = Client;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD,OAAO,MAAMC,gBAAgB,GAAGD,iBAAiB,CAAoB,mBAAmB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchClient/abstraction.js","sources":["../../../src/features/OpenSearchClient/abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client } from \"~/client.js\";\n\nexport interface IOpenSearchClient {\n use(): Client;\n}\n\nexport const OpenSearchClient = createAbstraction<IOpenSearchClient>(\"OpenSearch/Client\");\n\nexport namespace OpenSearchClient {\n export type Interface = IOpenSearchClient;\n export type Return = Client;\n}\n"],"names":["OpenSearchClient","createAbstraction"],"mappings":";AAOO,MAAMA,mBAAmBC,kBAAqC"}
@@ -1,10 +1,11 @@
1
1
  import { createFeature } from "@webiny/feature/api/index.js";
2
2
  import { OpenSearchClient } from "./OpenSearchClient.js";
3
- export const OpenSearchClientFeature = createFeature({
4
- name: "opensearch.internal.client",
5
- register(container) {
6
- container.register(OpenSearchClient);
7
- }
3
+ const OpenSearchClientFeature = createFeature({
4
+ name: "opensearch.internal.client",
5
+ register (container) {
6
+ container.register(OpenSearchClient);
7
+ }
8
8
  });
9
+ export { OpenSearchClientFeature };
9
10
 
10
11
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","OpenSearchClient","OpenSearchClientFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\n\nimport { OpenSearchClient } from \"./OpenSearchClient.js\";\n\nexport const OpenSearchClientFeature = createFeature({\n name: \"opensearch.internal.client\",\n register(container) {\n container.register(OpenSearchClient);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,uBAAuB,GAAGF,aAAa,CAAC;EACjDG,IAAI,EAAE,4BAA4B;EAClCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,gBAAgB,CAAC;EACxC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchClient/feature.js","sources":["../../../src/features/OpenSearchClient/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\n\nimport { OpenSearchClient } from \"./OpenSearchClient.js\";\n\nexport const OpenSearchClientFeature = createFeature({\n name: \"opensearch.internal.client\",\n register(container) {\n container.register(OpenSearchClient);\n }\n});\n"],"names":["OpenSearchClientFeature","createFeature","container","OpenSearchClient"],"mappings":";;AAIO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,16 +1,15 @@
1
- import { OpenSearchClientFactory as OpenSearchClientFactoryAbstraction } from "./abstraction.js";
1
+ import { OpenSearchClientFactory } from "./abstraction.js";
2
2
  import { createOpenSearchClient } from "../../client.js";
3
3
  class OpenSearchClientFactoryImpl {
4
- getClient(params) {
5
- if (!params.endpoint && !params.node && !params.nodes) {
6
- throw new Error("OpenSearch client requires an endpoint, nodes or node to be specified.");
4
+ getClient(params) {
5
+ if (!params.endpoint && !params.node && !params.nodes) throw new Error("OpenSearch client requires an endpoint, nodes or node to be specified.");
6
+ return createOpenSearchClient(params);
7
7
  }
8
- return createOpenSearchClient(params);
9
- }
10
8
  }
11
- export const OpenSearchClientFactory = OpenSearchClientFactoryAbstraction.createImplementation({
12
- implementation: OpenSearchClientFactoryImpl,
13
- dependencies: []
9
+ const OpenSearchClientFactory_OpenSearchClientFactory = OpenSearchClientFactory.createImplementation({
10
+ implementation: OpenSearchClientFactoryImpl,
11
+ dependencies: []
14
12
  });
13
+ export { OpenSearchClientFactory_OpenSearchClientFactory as OpenSearchClientFactory };
15
14
 
16
15
  //# sourceMappingURL=OpenSearchClientFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["OpenSearchClientFactory","OpenSearchClientFactoryAbstraction","createOpenSearchClient","OpenSearchClientFactoryImpl","getClient","params","endpoint","node","nodes","Error","createImplementation","implementation","dependencies"],"sources":["OpenSearchClientFactory.ts"],"sourcesContent":["import { OpenSearchClientFactory as OpenSearchClientFactoryAbstraction } from \"./abstraction.js\";\nimport { Client, type OpenSearchClientOptions, createOpenSearchClient } from \"~/client.js\";\n\nclass OpenSearchClientFactoryImpl implements OpenSearchClientFactoryAbstraction.Interface {\n public getClient(params: OpenSearchClientOptions): Client {\n if (!params.endpoint && !params.node && !params.nodes) {\n throw new Error(\n \"OpenSearch client requires an endpoint, nodes or node to be specified.\"\n );\n }\n return createOpenSearchClient(params);\n }\n}\n\nexport const OpenSearchClientFactory = OpenSearchClientFactoryAbstraction.createImplementation({\n implementation: OpenSearchClientFactoryImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,uBAAuB,IAAIC,kCAAkC;AACtE,SAA+CC,sBAAsB;AAErE,MAAMC,2BAA2B,CAAyD;EAC/EC,SAASA,CAACC,MAA+B,EAAU;IACtD,IAAI,CAACA,MAAM,CAACC,QAAQ,IAAI,CAACD,MAAM,CAACE,IAAI,IAAI,CAACF,MAAM,CAACG,KAAK,EAAE;MACnD,MAAM,IAAIC,KAAK,CACX,wEACJ,CAAC;IACL;IACA,OAAOP,sBAAsB,CAACG,MAAM,CAAC;EACzC;AACJ;AAEA,OAAO,MAAML,uBAAuB,GAAGC,kCAAkC,CAACS,oBAAoB,CAAC;EAC3FC,cAAc,EAAER,2BAA2B;EAC3CS,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchClientFactory/OpenSearchClientFactory.js","sources":["../../../src/features/OpenSearchClientFactory/OpenSearchClientFactory.ts"],"sourcesContent":["import { OpenSearchClientFactory as OpenSearchClientFactoryAbstraction } from \"./abstraction.js\";\nimport { Client, type OpenSearchClientOptions, createOpenSearchClient } from \"~/client.js\";\n\nclass OpenSearchClientFactoryImpl implements OpenSearchClientFactoryAbstraction.Interface {\n public getClient(params: OpenSearchClientOptions): Client {\n if (!params.endpoint && !params.node && !params.nodes) {\n throw new Error(\n \"OpenSearch client requires an endpoint, nodes or node to be specified.\"\n );\n }\n return createOpenSearchClient(params);\n }\n}\n\nexport const OpenSearchClientFactory = OpenSearchClientFactoryAbstraction.createImplementation({\n implementation: OpenSearchClientFactoryImpl,\n dependencies: []\n});\n"],"names":["OpenSearchClientFactoryImpl","params","Error","createOpenSearchClient","OpenSearchClientFactory","OpenSearchClientFactoryAbstraction"],"mappings":";;AAGA,MAAMA;IACK,UAAUC,MAA+B,EAAU;QACtD,IAAI,CAACA,OAAO,QAAQ,IAAI,CAACA,OAAO,IAAI,IAAI,CAACA,OAAO,KAAK,EACjD,MAAM,IAAIC,MACN;QAGR,OAAOC,uBAAuBF;IAClC;AACJ;AAEO,MAAMG,kDAA0BC,wBAAAA,oBAAuD,CAAC;IAC3F,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
@@ -1,4 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- export const OpenSearchClientFactory = createAbstraction("OpenSearch/ClientFactory");
2
+ const OpenSearchClientFactory = createAbstraction("OpenSearch/ClientFactory");
3
+ export { OpenSearchClientFactory };
3
4
 
4
5
  //# sourceMappingURL=abstraction.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","OpenSearchClientFactory"],"sources":["abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client, OpenSearchClientOptions } from \"~/client.js\";\n\nexport interface IOpenSearchClientFactory {\n getClient(params: OpenSearchClientOptions): Client;\n}\n\nexport const OpenSearchClientFactory = createAbstraction<IOpenSearchClientFactory>(\n \"OpenSearch/ClientFactory\"\n);\n\nexport namespace OpenSearchClientFactory {\n export type Interface = IOpenSearchClientFactory;\n export type Params = OpenSearchClientOptions;\n export type Return = Client;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAOvD,OAAO,MAAMC,uBAAuB,GAAGD,iBAAiB,CACpD,0BACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchClientFactory/abstraction.js","sources":["../../../src/features/OpenSearchClientFactory/abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client, OpenSearchClientOptions } from \"~/client.js\";\n\nexport interface IOpenSearchClientFactory {\n getClient(params: OpenSearchClientOptions): Client;\n}\n\nexport const OpenSearchClientFactory = createAbstraction<IOpenSearchClientFactory>(\n \"OpenSearch/ClientFactory\"\n);\n\nexport namespace OpenSearchClientFactory {\n export type Interface = IOpenSearchClientFactory;\n export type Params = OpenSearchClientOptions;\n export type Return = Client;\n}\n"],"names":["OpenSearchClientFactory","createAbstraction"],"mappings":";AAOO,MAAMA,0BAA0BC,kBACnC"}
@@ -1,10 +1,11 @@
1
1
  import { createFeature } from "@webiny/feature/api/index.js";
2
2
  import { OpenSearchClientFactory } from "./OpenSearchClientFactory.js";
3
- export const OpenSearchClientFactoryFeature = createFeature({
4
- name: "opensearch.internal.clientFactory",
5
- register(container) {
6
- container.register(OpenSearchClientFactory).inSingletonScope();
7
- }
3
+ const OpenSearchClientFactoryFeature = createFeature({
4
+ name: "opensearch.internal.clientFactory",
5
+ register (container) {
6
+ container.register(OpenSearchClientFactory).inSingletonScope();
7
+ }
8
8
  });
9
+ export { OpenSearchClientFactoryFeature };
9
10
 
10
11
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","OpenSearchClientFactory","OpenSearchClientFactoryFeature","name","register","container","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { OpenSearchClientFactory } from \"./OpenSearchClientFactory.js\";\n\nexport const OpenSearchClientFactoryFeature = createFeature({\n name: \"opensearch.internal.clientFactory\",\n register(container) {\n container.register(OpenSearchClientFactory).inSingletonScope();\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,uBAAuB;AAEhC,OAAO,MAAMC,8BAA8B,GAAGF,aAAa,CAAC;EACxDG,IAAI,EAAE,mCAAmC;EACzCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,uBAAuB,CAAC,CAACK,gBAAgB,CAAC,CAAC;EAClE;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchClientFactory/feature.js","sources":["../../../src/features/OpenSearchClientFactory/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { OpenSearchClientFactory } from \"./OpenSearchClientFactory.js\";\n\nexport const OpenSearchClientFactoryFeature = createFeature({\n name: \"opensearch.internal.clientFactory\",\n register(container) {\n container.register(OpenSearchClientFactory).inSingletonScope();\n }\n});\n"],"names":["OpenSearchClientFactoryFeature","createFeature","container","OpenSearchClientFactory"],"mappings":";;AAGO,MAAMA,iCAAiCC,cAAc;IACxD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,yBAAyB,gBAAgB;IAChE;AACJ"}
@@ -1,13 +1,14 @@
1
- export class OpenSearchContext {
2
- constructor(context) {
3
- this.context = context;
4
- }
5
- get opensearch() {
6
- return this.context.opensearch;
7
- }
8
- get elasticsearch() {
9
- return this.context.opensearch;
10
- }
1
+ class OpenSearchContext {
2
+ constructor(context){
3
+ this.context = context;
4
+ }
5
+ get opensearch() {
6
+ return this.context.opensearch;
7
+ }
8
+ get elasticsearch() {
9
+ return this.context.opensearch;
10
+ }
11
11
  }
12
+ export { OpenSearchContext };
12
13
 
13
14
  //# sourceMappingURL=OpenSearchContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["OpenSearchContext","constructor","context","opensearch","elasticsearch"],"sources":["OpenSearchContext.ts"],"sourcesContent":["import { OpenSearchContext as OpenSearchContextAbstraction } from \"./abstraction.js\";\nimport { OpenSearchContext as OpenSearchContextType } from \"~/types.js\";\n\nexport class OpenSearchContext implements OpenSearchContextAbstraction.Interface {\n private readonly context;\n\n public constructor(context: OpenSearchContextType) {\n this.context = context;\n }\n\n public get opensearch(): OpenSearchContextAbstraction.Client {\n return this.context.opensearch;\n }\n\n public get elasticsearch(): OpenSearchContextAbstraction.Client {\n return this.context.opensearch;\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,iBAAiB,CAAmD;EAGtEC,WAAWA,CAACC,OAA8B,EAAE;IAC/C,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;EAEA,IAAWC,UAAUA,CAAA,EAAwC;IACzD,OAAO,IAAI,CAACD,OAAO,CAACC,UAAU;EAClC;EAEA,IAAWC,aAAaA,CAAA,EAAwC;IAC5D,OAAO,IAAI,CAACF,OAAO,CAACC,UAAU;EAClC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchContext/OpenSearchContext.js","sources":["../../../src/features/OpenSearchContext/OpenSearchContext.ts"],"sourcesContent":["import { OpenSearchContext as OpenSearchContextAbstraction } from \"./abstraction.js\";\nimport { OpenSearchContext as OpenSearchContextType } from \"~/types.js\";\n\nexport class OpenSearchContext implements OpenSearchContextAbstraction.Interface {\n private readonly context;\n\n public constructor(context: OpenSearchContextType) {\n this.context = context;\n }\n\n public get opensearch(): OpenSearchContextAbstraction.Client {\n return this.context.opensearch;\n }\n\n public get elasticsearch(): OpenSearchContextAbstraction.Client {\n return this.context.opensearch;\n }\n}\n"],"names":["OpenSearchContext","context"],"mappings":"AAGO,MAAMA;IAGT,YAAmBC,OAA8B,CAAE;QAC/C,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEA,IAAW,aAAkD;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU;IAClC;IAEA,IAAW,gBAAqD;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU;IAClC;AACJ"}
@@ -1,4 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
- export const OpenSearchContext = createAbstraction("OpenSearch/Context");
2
+ const OpenSearchContext = createAbstraction("OpenSearch/Context");
3
+ export { OpenSearchContext };
3
4
 
4
5
  //# sourceMappingURL=abstraction.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","OpenSearchContext"],"sources":["abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client as OpenSearchClient } from \"~/types.js\";\n\nexport interface IOpenSearchContext {\n opensearch: OpenSearchClient;\n /**\n * @deprecated use `opensearch`property instead.\n * @see IOpenSearchContext.opensearch\n */\n elasticsearch: OpenSearchClient;\n}\n\nexport const OpenSearchContext = createAbstraction<IOpenSearchContext>(\"OpenSearch/Context\");\n\nexport namespace OpenSearchContext {\n export type Interface = IOpenSearchContext;\n export type Client = OpenSearchClient;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAYvD,OAAO,MAAMC,iBAAiB,GAAGD,iBAAiB,CAAqB,oBAAoB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchContext/abstraction.js","sources":["../../../src/features/OpenSearchContext/abstraction.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Client as OpenSearchClient } from \"~/types.js\";\n\nexport interface IOpenSearchContext {\n opensearch: OpenSearchClient;\n /**\n * @deprecated use `opensearch`property instead.\n * @see IOpenSearchContext.opensearch\n */\n elasticsearch: OpenSearchClient;\n}\n\nexport const OpenSearchContext = createAbstraction<IOpenSearchContext>(\"OpenSearch/Context\");\n\nexport namespace OpenSearchContext {\n export type Interface = IOpenSearchContext;\n export type Client = OpenSearchClient;\n}\n"],"names":["OpenSearchContext","createAbstraction"],"mappings":";AAYO,MAAMA,oBAAoBC,kBAAsC"}
@@ -1,13 +1,12 @@
1
1
  import { createFeature } from "@webiny/feature/api/index.js";
2
2
  import { OpenSearchContext } from "./abstraction.js";
3
- import { OpenSearchContext as OpenSearchContextImplementation } from "./OpenSearchContext.js";
4
- export const OpenSearchContextFeature = createFeature({
5
- name: "opensearch.internal.context",
6
- register(container, context) {
7
- container.registerFactory(OpenSearchContext, () => {
8
- return new OpenSearchContextImplementation(context);
9
- });
10
- }
3
+ import { OpenSearchContext as external_OpenSearchContext_js_OpenSearchContext } from "./OpenSearchContext.js";
4
+ const OpenSearchContextFeature = createFeature({
5
+ name: "opensearch.internal.context",
6
+ register (container, context) {
7
+ container.registerFactory(OpenSearchContext, ()=>new external_OpenSearchContext_js_OpenSearchContext(context));
8
+ }
11
9
  });
10
+ export { OpenSearchContextFeature };
12
11
 
13
12
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","OpenSearchContext","OpenSearchContextImplementation","OpenSearchContextFeature","name","register","container","context","registerFactory"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { OpenSearchContext } from \"./abstraction.js\";\nimport { OpenSearchContext as OpenSearchContextType } from \"~/types.js\";\nimport { OpenSearchContext as OpenSearchContextImplementation } from \"./OpenSearchContext.js\";\n\nexport const OpenSearchContextFeature = createFeature<OpenSearchContextType>({\n name: \"opensearch.internal.context\",\n register(container, context) {\n container.registerFactory(OpenSearchContext, () => {\n return new OpenSearchContextImplementation(context!);\n });\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,iBAAiB;AAE1B,SAASA,iBAAiB,IAAIC,+BAA+B;AAE7D,OAAO,MAAMC,wBAAwB,GAAGH,aAAa,CAAwB;EACzEI,IAAI,EAAE,6BAA6B;EACnCC,QAAQA,CAACC,SAAS,EAAEC,OAAO,EAAE;IACzBD,SAAS,CAACE,eAAe,CAACP,iBAAiB,EAAE,MAAM;MAC/C,OAAO,IAAIC,+BAA+B,CAACK,OAAQ,CAAC;IACxD,CAAC,CAAC;EACN;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/OpenSearchContext/feature.js","sources":["../../../src/features/OpenSearchContext/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { OpenSearchContext } from \"./abstraction.js\";\nimport { OpenSearchContext as OpenSearchContextType } from \"~/types.js\";\nimport { OpenSearchContext as OpenSearchContextImplementation } from \"./OpenSearchContext.js\";\n\nexport const OpenSearchContextFeature = createFeature<OpenSearchContextType>({\n name: \"opensearch.internal.context\",\n register(container, context) {\n container.registerFactory(OpenSearchContext, () => {\n return new OpenSearchContextImplementation(context!);\n });\n }\n});\n"],"names":["OpenSearchContextFeature","createFeature","container","context","OpenSearchContext","OpenSearchContextImplementation"],"mappings":";;;AAKO,MAAMA,2BAA2BC,cAAqC;IACzE,MAAM;IACN,UAASC,SAAS,EAAEC,OAAO;QACvBD,UAAU,eAAe,CAACE,mBAAmB,IAClC,IAAIC,gDAAgCF;IAEnD;AACJ"}