@superdurable/connector-elasticsearch 0.0.0-stage → 0.1.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.
package/dist/mock.js ADDED
@@ -0,0 +1,176 @@
1
+ import {
2
+ DeleteDocumentDefinition,
3
+ DeleteDocumentInputSchema,
4
+ DeletedDocumentSchema,
5
+ IndexDocumentDefinition,
6
+ IndexDocumentInputSchema,
7
+ IndexedDocumentSchema,
8
+ ProviderID,
9
+ SearchDocumentsDefinition,
10
+ SearchDocumentsInputSchema,
11
+ SearchHitSchema,
12
+ SearchPageSchema,
13
+ newConnectionWithOperations
14
+ } from "./chunk-5WBVTQWI.js";
15
+
16
+ // src/generated/mock.ts
17
+ import { branchCase, retryCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
18
+ var emptyIndexDocumentInput = IndexDocumentInputSchema.parse({
19
+ "index": "",
20
+ "documentId": "",
21
+ "source": null
22
+ });
23
+ var emptyIndexedDocument = IndexedDocumentSchema.parse({
24
+ "index": "",
25
+ "id": ""
26
+ });
27
+ var emptyDeleteDocumentInput = DeleteDocumentInputSchema.parse({
28
+ "index": "",
29
+ "documentId": ""
30
+ });
31
+ var emptyDeletedDocument = DeletedDocumentSchema.parse({
32
+ "index": "",
33
+ "id": "",
34
+ "wasDeleted": false
35
+ });
36
+ var emptySearchDocumentsInput = SearchDocumentsInputSchema.parse({
37
+ "index": "",
38
+ "query": ""
39
+ });
40
+ var emptySearchHit = SearchHitSchema.parse({
41
+ "index": "",
42
+ "id": "",
43
+ "source": null
44
+ });
45
+ var emptySearchPage = SearchPageSchema.parse({
46
+ "total": 0,
47
+ "relation": "",
48
+ "hits": []
49
+ });
50
+ function indexDocumentIndexed(value, failure) {
51
+ return branchCase("indexed", value, failure);
52
+ }
53
+ function indexDocumentProviderRejected(value, failure) {
54
+ return branchCase("providerRejected", value, failure);
55
+ }
56
+ function indexDocumentDefect(value, failure) {
57
+ return branchCase("defect", value, failure);
58
+ }
59
+ function indexDocumentRetry(failure, retryAfterMs = 0) {
60
+ return retryCase(failure, retryAfterMs);
61
+ }
62
+ function indexDocumentIndexedProduct() {
63
+ const value = IndexedDocumentSchema.parse({ "id": "sku-42", "index": "products" });
64
+ return branchCase("indexed", value);
65
+ }
66
+ function indexDocumentDefault() {
67
+ return indexDocumentIndexedProduct();
68
+ }
69
+ function deleteDocumentAbsent(value, failure) {
70
+ return branchCase("absent", value, failure);
71
+ }
72
+ function deleteDocumentIndexNotFound(value, failure) {
73
+ return branchCase("indexNotFound", value, failure);
74
+ }
75
+ function deleteDocumentProviderRejected(value, failure) {
76
+ return branchCase("providerRejected", value, failure);
77
+ }
78
+ function deleteDocumentDefect(value, failure) {
79
+ return branchCase("defect", value, failure);
80
+ }
81
+ function deleteDocumentRetry(failure, retryAfterMs = 0) {
82
+ return retryCase(failure, retryAfterMs);
83
+ }
84
+ function deleteDocumentDeletedProduct() {
85
+ const value = DeletedDocumentSchema.parse({ "id": "sku-42", "index": "products", "wasDeleted": true });
86
+ return branchCase("absent", value);
87
+ }
88
+ function deleteDocumentDefault() {
89
+ return deleteDocumentDeletedProduct();
90
+ }
91
+ function searchDocumentsFound(value, failure) {
92
+ return branchCase("found", value, failure);
93
+ }
94
+ function searchDocumentsIndexNotFound(value, failure) {
95
+ return branchCase("indexNotFound", value, failure);
96
+ }
97
+ function searchDocumentsProviderRejected(value, failure) {
98
+ return branchCase("providerRejected", value, failure);
99
+ }
100
+ function searchDocumentsInvalidResponse(value, failure) {
101
+ return branchCase("invalidResponse", value, failure);
102
+ }
103
+ function searchDocumentsDefect(value, failure) {
104
+ return branchCase("defect", value, failure);
105
+ }
106
+ function searchDocumentsRetry(failure, retryAfterMs = 0) {
107
+ return retryCase(failure, retryAfterMs);
108
+ }
109
+ function searchDocumentsMatchingDocument() {
110
+ const value = SearchPageSchema.parse({ "hits": [{ "id": "sku-42", "index": "products", "score": 1.25, "source": { "category": "release", "title": "Meridian" } }], "relation": "eq", "total": 1 });
111
+ return branchCase("found", value);
112
+ }
113
+ function searchDocumentsDefault() {
114
+ return searchDocumentsMatchingDocument();
115
+ }
116
+ var GeneratedMock = class {
117
+ #indexDocument;
118
+ #deleteDocument;
119
+ #searchDocuments;
120
+ #connection;
121
+ constructor(connectionName) {
122
+ this.#indexDocument = newMutation(IndexDocumentDefinition).default(indexDocumentDefault());
123
+ this.#deleteDocument = newMutation(DeleteDocumentDefinition).default(deleteDocumentDefault());
124
+ this.#searchDocuments = newQuery(SearchDocumentsDefinition).default(searchDocumentsDefault());
125
+ this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
126
+ }
127
+ connection() {
128
+ return this.#connection;
129
+ }
130
+ indexDocument() {
131
+ return this.#indexDocument;
132
+ }
133
+ deleteDocument() {
134
+ return this.#deleteDocument;
135
+ }
136
+ searchDocuments() {
137
+ return this.#searchDocuments;
138
+ }
139
+ assertNoFailures() {
140
+ this.#indexDocument.assertNoFailures();
141
+ this.#deleteDocument.assertNoFailures();
142
+ this.#searchDocuments.assertNoFailures();
143
+ }
144
+ };
145
+ export {
146
+ GeneratedMock,
147
+ GeneratedMock as Mock,
148
+ deleteDocumentAbsent,
149
+ deleteDocumentDefault,
150
+ deleteDocumentDefect,
151
+ deleteDocumentDeletedProduct,
152
+ deleteDocumentIndexNotFound,
153
+ deleteDocumentProviderRejected,
154
+ deleteDocumentRetry,
155
+ emptyDeleteDocumentInput,
156
+ emptyDeletedDocument,
157
+ emptyIndexDocumentInput,
158
+ emptyIndexedDocument,
159
+ emptySearchDocumentsInput,
160
+ emptySearchHit,
161
+ emptySearchPage,
162
+ indexDocumentDefault,
163
+ indexDocumentDefect,
164
+ indexDocumentIndexed,
165
+ indexDocumentIndexedProduct,
166
+ indexDocumentProviderRejected,
167
+ indexDocumentRetry,
168
+ searchDocumentsDefault,
169
+ searchDocumentsDefect,
170
+ searchDocumentsFound,
171
+ searchDocumentsIndexNotFound,
172
+ searchDocumentsInvalidResponse,
173
+ searchDocumentsMatchingDocument,
174
+ searchDocumentsProviderRejected,
175
+ searchDocumentsRetry
176
+ };
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@superdurable/connector-elasticsearch",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "license": "MIT",
5
+ "description": "Elasticsearch document indexing, deletion, and search for Dex TypeScript applications",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/superdurable/dex-connectors-library.git",
9
+ "directory": "connectors/elastic/elasticsearch/typescript"
10
+ },
11
+ "type": "module",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org"
15
+ },
16
+ "engines": {
17
+ "node": "^22.0.0 || ^24.0.0"
18
+ },
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ },
26
+ "./mock": {
27
+ "types": "./dist/mock.d.ts",
28
+ "import": "./dist/mock.js"
29
+ },
30
+ "./dex-connector.json": "./dex-connector.json"
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "README.md",
35
+ "LICENSE",
36
+ "dex-connector.json"
37
+ ],
38
+ "scripts": {
39
+ "prepack": "npm run build",
40
+ "build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
41
+ "typecheck": "tsc --noEmit",
42
+ "lint": "eslint src test examples",
43
+ "test": "vitest run --exclude 'test/integration/**'",
44
+ "test:integration": "vitest run test/integration/*.integration.test.ts",
45
+ "example:worker": "tsx examples/provider-operations/worker.ts",
46
+ "check": "npm run typecheck && npm run lint && npm test && npm run build"
47
+ },
48
+ "dependencies": {
49
+ "@superdurable/connectors-sdk": "0.7.0",
50
+ "@superdurable/dex": ">=1.28.0",
51
+ "zod": "^4.1.0"
52
+ },
53
+ "devDependencies": {
54
+ "@eslint/js": "^9.0.0",
55
+ "@types/node": "^22.0.0",
56
+ "eslint": "^9.0.0",
57
+ "tsup": "^8.0.0",
58
+ "tsx": "^4.23.15",
59
+ "typescript": "^5.9.0",
60
+ "typescript-eslint": "^8.0.0",
61
+ "vitest": "^3.0.0"
62
+ }
63
+ }