elasticlink 0.2.1-beta → 0.2.2-beta
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/query.builder.js +1 -1
- package/dist/query.types.d.ts +1 -1
- package/dist/query.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/__tests__/aggregation-builder.test.d.ts +0 -2
- package/dist/__tests__/aggregation-builder.test.d.ts.map +0 -1
- package/dist/__tests__/aggregation-builder.test.js +0 -662
- package/dist/__tests__/bulk.test.d.ts +0 -2
- package/dist/__tests__/bulk.test.d.ts.map +0 -1
- package/dist/__tests__/bulk.test.js +0 -684
- package/dist/__tests__/examples.test.d.ts +0 -2
- package/dist/__tests__/examples.test.d.ts.map +0 -1
- package/dist/__tests__/examples.test.js +0 -2006
- package/dist/__tests__/fixtures/finance.d.ts +0 -26
- package/dist/__tests__/fixtures/finance.d.ts.map +0 -1
- package/dist/__tests__/fixtures/finance.js +0 -32
- package/dist/__tests__/fixtures/legal.d.ts +0 -8
- package/dist/__tests__/fixtures/legal.d.ts.map +0 -1
- package/dist/__tests__/fixtures/legal.js +0 -20
- package/dist/__tests__/fixtures/real-estate.d.ts +0 -19
- package/dist/__tests__/fixtures/real-estate.d.ts.map +0 -1
- package/dist/__tests__/fixtures/real-estate.js +0 -20
- package/dist/__tests__/index-management.test.d.ts +0 -2
- package/dist/__tests__/index-management.test.d.ts.map +0 -1
- package/dist/__tests__/index-management.test.js +0 -1148
- package/dist/__tests__/integration/aggregation.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/aggregation.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/aggregation.integration.test.js +0 -200
- package/dist/__tests__/integration/bulk.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/bulk.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/bulk.integration.test.js +0 -93
- package/dist/__tests__/integration/fixtures/finance.d.ts +0 -17
- package/dist/__tests__/integration/fixtures/finance.d.ts.map +0 -1
- package/dist/__tests__/integration/fixtures/finance.js +0 -42
- package/dist/__tests__/integration/fixtures/legal.d.ts +0 -21
- package/dist/__tests__/integration/fixtures/legal.d.ts.map +0 -1
- package/dist/__tests__/integration/fixtures/legal.js +0 -52
- package/dist/__tests__/integration/fixtures/real-estate.d.ts +0 -7
- package/dist/__tests__/integration/fixtures/real-estate.d.ts.map +0 -1
- package/dist/__tests__/integration/fixtures/real-estate.js +0 -22
- package/dist/__tests__/integration/helpers.d.ts +0 -15
- package/dist/__tests__/integration/helpers.d.ts.map +0 -1
- package/dist/__tests__/integration/helpers.js +0 -21
- package/dist/__tests__/integration/index-management.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/index-management.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/index-management.integration.test.js +0 -79
- package/dist/__tests__/integration/multi-search.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/multi-search.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/multi-search.integration.test.js +0 -55
- package/dist/__tests__/integration/query.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/query.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/query.integration.test.js +0 -118
- package/dist/__tests__/integration/suggester.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/suggester.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/suggester.integration.test.js +0 -48
- package/dist/__tests__/multi-search.test.d.ts +0 -2
- package/dist/__tests__/multi-search.test.d.ts.map +0 -1
- package/dist/__tests__/multi-search.test.js +0 -336
- package/dist/__tests__/query-builder.test.d.ts +0 -2
- package/dist/__tests__/query-builder.test.d.ts.map +0 -1
- package/dist/__tests__/query-builder.test.js +0 -5624
- package/dist/__tests__/suggester.test.d.ts +0 -2
- package/dist/__tests__/suggester.test.d.ts.map +0 -1
- package/dist/__tests__/suggester.test.js +0 -1001
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregation.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/aggregation.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { query, indexBuilder, keyword, integer, float, date } from '../../index.js';
|
|
2
|
-
import { createIndex, deleteIndex, indexDoc, refreshIndex, search } from './helpers.js';
|
|
3
|
-
import { MATTERS } from './fixtures/legal.js';
|
|
4
|
-
const INDEX = 'int-aggregation';
|
|
5
|
-
describe('AggregationBuilder', () => {
|
|
6
|
-
beforeAll(async () => {
|
|
7
|
-
await createIndex(INDEX, indexBuilder()
|
|
8
|
-
.mappings({
|
|
9
|
-
title: 'text',
|
|
10
|
-
practice_area: keyword(),
|
|
11
|
-
billing_rate: integer(),
|
|
12
|
-
risk_score: float(),
|
|
13
|
-
opened_at: date()
|
|
14
|
-
})
|
|
15
|
-
.build());
|
|
16
|
-
for (const doc of MATTERS)
|
|
17
|
-
await indexDoc(INDEX, doc);
|
|
18
|
-
await refreshIndex(INDEX);
|
|
19
|
-
});
|
|
20
|
-
afterAll(() => deleteIndex(INDEX));
|
|
21
|
-
describe('Aggregation — terms', () => {
|
|
22
|
-
it('buckets documents by a keyword field', async () => {
|
|
23
|
-
const result = await search(INDEX, query()
|
|
24
|
-
.matchAll()
|
|
25
|
-
.aggs((agg) => agg.terms('by_area', 'practice_area'))
|
|
26
|
-
.size(0)
|
|
27
|
-
.build());
|
|
28
|
-
expect(result.aggregations.by_area.buckets).toMatchInlineSnapshot(`
|
|
29
|
-
[
|
|
30
|
-
{
|
|
31
|
-
"doc_count": 1,
|
|
32
|
-
"key": "corporate",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"doc_count": 1,
|
|
36
|
-
"key": "intellectual-property",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"doc_count": 1,
|
|
40
|
-
"key": "real-estate",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"doc_count": 1,
|
|
44
|
-
"key": "securities",
|
|
45
|
-
},
|
|
46
|
-
]
|
|
47
|
-
`);
|
|
48
|
-
});
|
|
49
|
-
it('supports size option and sub-aggregations', async () => {
|
|
50
|
-
const result = await search(INDEX, query()
|
|
51
|
-
.matchAll()
|
|
52
|
-
.aggs((agg) => agg
|
|
53
|
-
.terms('by_area', 'practice_area', { size: 2 })
|
|
54
|
-
.subAgg((sub) => sub.avg('avg_rate', 'billing_rate')))
|
|
55
|
-
.size(0)
|
|
56
|
-
.build());
|
|
57
|
-
expect(result.aggregations.by_area.buckets).toMatchInlineSnapshot(`
|
|
58
|
-
[
|
|
59
|
-
{
|
|
60
|
-
"avg_rate": {
|
|
61
|
-
"value": 850,
|
|
62
|
-
},
|
|
63
|
-
"doc_count": 1,
|
|
64
|
-
"key": "corporate",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"avg_rate": {
|
|
68
|
-
"value": 780,
|
|
69
|
-
},
|
|
70
|
-
"doc_count": 1,
|
|
71
|
-
"key": "intellectual-property",
|
|
72
|
-
},
|
|
73
|
-
]
|
|
74
|
-
`);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe('Aggregation — metrics', () => {
|
|
78
|
-
it('computes avg, min, max, sum, and value_count in one request', async () => {
|
|
79
|
-
const result = await search(INDEX, query()
|
|
80
|
-
.matchAll()
|
|
81
|
-
.aggs((agg) => agg
|
|
82
|
-
.avg('avg_rate', 'billing_rate')
|
|
83
|
-
.min('min_rate', 'billing_rate')
|
|
84
|
-
.max('max_rate', 'billing_rate')
|
|
85
|
-
.sum('total_rate', 'billing_rate')
|
|
86
|
-
.valueCount('count', 'billing_rate'))
|
|
87
|
-
.size(0)
|
|
88
|
-
.build());
|
|
89
|
-
expect(result.aggregations).toMatchInlineSnapshot(`
|
|
90
|
-
{
|
|
91
|
-
"avg_rate": {
|
|
92
|
-
"value": 792.5,
|
|
93
|
-
},
|
|
94
|
-
"count": {
|
|
95
|
-
"value": 4,
|
|
96
|
-
},
|
|
97
|
-
"max_rate": {
|
|
98
|
-
"value": 920,
|
|
99
|
-
},
|
|
100
|
-
"min_rate": {
|
|
101
|
-
"value": 620,
|
|
102
|
-
},
|
|
103
|
-
"total_rate": {
|
|
104
|
-
"value": 3170,
|
|
105
|
-
},
|
|
106
|
-
}
|
|
107
|
-
`);
|
|
108
|
-
});
|
|
109
|
-
it('computes stats and cardinality', async () => {
|
|
110
|
-
const result = await search(INDEX, query()
|
|
111
|
-
.matchAll()
|
|
112
|
-
.aggs((agg) => agg
|
|
113
|
-
.stats('rate_stats', 'billing_rate')
|
|
114
|
-
.cardinality('unique_areas', 'practice_area'))
|
|
115
|
-
.size(0)
|
|
116
|
-
.build());
|
|
117
|
-
expect(result.aggregations).toMatchInlineSnapshot(`
|
|
118
|
-
{
|
|
119
|
-
"rate_stats": {
|
|
120
|
-
"avg": 792.5,
|
|
121
|
-
"count": 4,
|
|
122
|
-
"max": 920,
|
|
123
|
-
"min": 620,
|
|
124
|
-
"sum": 3170,
|
|
125
|
-
},
|
|
126
|
-
"unique_areas": {
|
|
127
|
-
"value": 4,
|
|
128
|
-
},
|
|
129
|
-
}
|
|
130
|
-
`);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
describe('Aggregation — range', () => {
|
|
134
|
-
it('buckets documents into named billing rate ranges', async () => {
|
|
135
|
-
const result = await search(INDEX, query()
|
|
136
|
-
.matchAll()
|
|
137
|
-
.aggs((agg) => agg.range('rate_bands', 'billing_rate', {
|
|
138
|
-
ranges: [
|
|
139
|
-
{ key: 'standard', to: 700 },
|
|
140
|
-
{ key: 'senior', from: 700, to: 850 },
|
|
141
|
-
{ key: 'partner', from: 850 }
|
|
142
|
-
]
|
|
143
|
-
}))
|
|
144
|
-
.size(0)
|
|
145
|
-
.build());
|
|
146
|
-
expect(result.aggregations.rate_bands.buckets).toMatchInlineSnapshot(`
|
|
147
|
-
[
|
|
148
|
-
{
|
|
149
|
-
"doc_count": 1,
|
|
150
|
-
"key": "standard",
|
|
151
|
-
"to": 700,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
"doc_count": 1,
|
|
155
|
-
"from": 700,
|
|
156
|
-
"key": "senior",
|
|
157
|
-
"to": 850,
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"doc_count": 2,
|
|
161
|
-
"from": 850,
|
|
162
|
-
"key": "partner",
|
|
163
|
-
},
|
|
164
|
-
]
|
|
165
|
-
`);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
describe('Aggregation — dateHistogram', () => {
|
|
169
|
-
it('groups documents into yearly buckets', async () => {
|
|
170
|
-
const result = await search(INDEX, query()
|
|
171
|
-
.matchAll()
|
|
172
|
-
.aggs((agg) => agg.dateHistogram('by_year', 'opened_at', {
|
|
173
|
-
calendar_interval: 'year',
|
|
174
|
-
min_doc_count: 1,
|
|
175
|
-
format: 'yyyy'
|
|
176
|
-
}))
|
|
177
|
-
.size(0)
|
|
178
|
-
.build());
|
|
179
|
-
expect(result.aggregations.by_year.buckets.map((b) => ({
|
|
180
|
-
year: b.key_as_string,
|
|
181
|
-
doc_count: b.doc_count
|
|
182
|
-
}))).toMatchInlineSnapshot(`
|
|
183
|
-
[
|
|
184
|
-
{
|
|
185
|
-
"doc_count": 1,
|
|
186
|
-
"year": "2021",
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
"doc_count": 1,
|
|
190
|
-
"year": "2022",
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"doc_count": 2,
|
|
194
|
-
"year": "2023",
|
|
195
|
-
},
|
|
196
|
-
]
|
|
197
|
-
`);
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/bulk.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { bulk, query, indexBuilder, keyword, integer } from '../../index.js';
|
|
2
|
-
import { createIndex, deleteIndex, refreshIndex, search, bulkRequest } from './helpers.js';
|
|
3
|
-
const INDEX = 'int-bulk';
|
|
4
|
-
describe('BulkBuilder', () => {
|
|
5
|
-
beforeAll(() => createIndex(INDEX, indexBuilder()
|
|
6
|
-
.mappings({ reference: 'text', status: keyword(), priority: integer() })
|
|
7
|
-
.build()));
|
|
8
|
-
afterAll(() => deleteIndex(INDEX));
|
|
9
|
-
describe('Bulk — index and create', () => {
|
|
10
|
-
it('indexes and creates documents via bulk, then retrieves them', async () => {
|
|
11
|
-
const ndjson = bulk()
|
|
12
|
-
.index({ reference: 'TRD-001 AAPL Buy 100', status: 'settled', priority: 1 }, { _index: INDEX, _id: 'trd-1' })
|
|
13
|
-
.index({ reference: 'TRD-002 MSFT Sell 50', status: 'pending', priority: 2 }, { _index: INDEX, _id: 'trd-2' })
|
|
14
|
-
.create({ reference: 'TRD-003 GOOG Buy 25', status: 'pending', priority: 3 }, { _index: INDEX, _id: 'trd-3' })
|
|
15
|
-
.build();
|
|
16
|
-
const bulkResult = await bulkRequest(ndjson);
|
|
17
|
-
await refreshIndex(INDEX);
|
|
18
|
-
expect(bulkResult.errors).toBe(false);
|
|
19
|
-
const searchResult = await search(INDEX, query().matchAll().build());
|
|
20
|
-
expect(searchResult.hits.total.value).toBe(3);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe('Bulk — update', () => {
|
|
24
|
-
it('partially updates a document', async () => {
|
|
25
|
-
const ndjson = bulk()
|
|
26
|
-
.update({ _index: INDEX, _id: 'trd-2', doc: { status: 'settled' } })
|
|
27
|
-
.build();
|
|
28
|
-
await bulkRequest(ndjson);
|
|
29
|
-
await refreshIndex(INDEX);
|
|
30
|
-
const result = await search(INDEX, query().term('status', 'settled').build());
|
|
31
|
-
expect(result.hits.total.value).toBe(2);
|
|
32
|
-
});
|
|
33
|
-
it('upserts a document that does not exist', async () => {
|
|
34
|
-
const ndjson = bulk()
|
|
35
|
-
.update({
|
|
36
|
-
_index: INDEX,
|
|
37
|
-
_id: 'trd-4',
|
|
38
|
-
doc: {
|
|
39
|
-
reference: 'TRD-004 TSLA Buy 10',
|
|
40
|
-
status: 'pending',
|
|
41
|
-
priority: 4
|
|
42
|
-
},
|
|
43
|
-
doc_as_upsert: true
|
|
44
|
-
})
|
|
45
|
-
.build();
|
|
46
|
-
await bulkRequest(ndjson);
|
|
47
|
-
await refreshIndex(INDEX);
|
|
48
|
-
const result = await search(INDEX, query().matchAll().build());
|
|
49
|
-
expect(result.hits.total.value).toBe(4);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
describe('Bulk — delete', () => {
|
|
53
|
-
it('deletes a document via bulk', async () => {
|
|
54
|
-
const ndjson = bulk()
|
|
55
|
-
.delete({ _index: INDEX, _id: 'trd-4' })
|
|
56
|
-
.build();
|
|
57
|
-
await bulkRequest(ndjson);
|
|
58
|
-
await refreshIndex(INDEX);
|
|
59
|
-
const result = await search(INDEX, query().matchAll().build());
|
|
60
|
-
expect(result.hits.total.value).toBe(3);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
describe('Bulk — mixed operations', () => {
|
|
64
|
-
it('executes index, update, and delete in a single bulk call', async () => {
|
|
65
|
-
const ndjson = bulk()
|
|
66
|
-
.index({ reference: 'TRD-099 NVDA Buy 5', status: 'pending', priority: 99 }, { _index: INDEX, _id: 'trd-temp' })
|
|
67
|
-
.update({ _index: INDEX, _id: 'trd-1', doc: { priority: 10 } })
|
|
68
|
-
.delete({ _index: INDEX, _id: 'trd-3' })
|
|
69
|
-
.build();
|
|
70
|
-
const bulkResult = await bulkRequest(ndjson);
|
|
71
|
-
expect(bulkResult.errors).toBe(false);
|
|
72
|
-
expect(bulkResult.items.map((i) => {
|
|
73
|
-
const op = Object.keys(i)[0];
|
|
74
|
-
return { op, result: i[op].result };
|
|
75
|
-
})).toMatchInlineSnapshot(`
|
|
76
|
-
[
|
|
77
|
-
{
|
|
78
|
-
"op": "index",
|
|
79
|
-
"result": "created",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"op": "update",
|
|
83
|
-
"result": "updated",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"op": "delete",
|
|
87
|
-
"result": "deleted",
|
|
88
|
-
},
|
|
89
|
-
]
|
|
90
|
-
`);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type Instrument = {
|
|
2
|
-
name: string;
|
|
3
|
-
asset_class: string;
|
|
4
|
-
sector: string;
|
|
5
|
-
tags: string[];
|
|
6
|
-
price: number;
|
|
7
|
-
yield_rate: number;
|
|
8
|
-
active: boolean;
|
|
9
|
-
listed_date: string;
|
|
10
|
-
};
|
|
11
|
-
export declare const INSTRUMENTS: Instrument[];
|
|
12
|
-
export type Trade = {
|
|
13
|
-
reference: string;
|
|
14
|
-
status: string;
|
|
15
|
-
priority: number;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=finance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"finance.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/integration/fixtures/finance.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,UAAU,EAyCnC,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export const INSTRUMENTS = [
|
|
2
|
-
{
|
|
3
|
-
name: 'US Treasury 10-Year Note',
|
|
4
|
-
asset_class: 'fixed-income',
|
|
5
|
-
sector: 'government',
|
|
6
|
-
tags: ['sovereign', 'investment-grade', 'liquid'],
|
|
7
|
-
price: 98,
|
|
8
|
-
yield_rate: 4.3,
|
|
9
|
-
active: true,
|
|
10
|
-
listed_date: '2023-02-15'
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: 'Investment Grade Corporate Bond ETF',
|
|
14
|
-
asset_class: 'fixed-income',
|
|
15
|
-
sector: 'corporate',
|
|
16
|
-
tags: ['etf', 'investment-grade', 'diversified'],
|
|
17
|
-
price: 112,
|
|
18
|
-
yield_rate: 5.1,
|
|
19
|
-
active: true,
|
|
20
|
-
listed_date: '2023-07-01'
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'Emerging Market Equity Fund',
|
|
24
|
-
asset_class: 'equity',
|
|
25
|
-
sector: 'emerging-markets',
|
|
26
|
-
tags: ['high-risk', 'growth', 'diversified'],
|
|
27
|
-
price: 54,
|
|
28
|
-
yield_rate: 2.8,
|
|
29
|
-
active: false,
|
|
30
|
-
listed_date: '2022-09-12'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'S&P 500 Index Fund',
|
|
34
|
-
asset_class: 'equity',
|
|
35
|
-
sector: 'broad-market',
|
|
36
|
-
tags: ['index', 'sp500', 'liquid'],
|
|
37
|
-
price: 479,
|
|
38
|
-
yield_rate: 1.5,
|
|
39
|
-
active: true,
|
|
40
|
-
listed_date: '2021-03-22'
|
|
41
|
-
}
|
|
42
|
-
];
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type Matter = {
|
|
2
|
-
title: string;
|
|
3
|
-
practice_area: string;
|
|
4
|
-
billing_rate: number;
|
|
5
|
-
risk_score: number;
|
|
6
|
-
opened_at: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const MATTERS: Matter[];
|
|
9
|
-
export type Attorney = {
|
|
10
|
-
name: string;
|
|
11
|
-
practice_area: string;
|
|
12
|
-
name_suggest: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const ATTORNEYS: {
|
|
15
|
-
name: string;
|
|
16
|
-
practice_area: string;
|
|
17
|
-
name_suggest: {
|
|
18
|
-
input: string[];
|
|
19
|
-
};
|
|
20
|
-
}[];
|
|
21
|
-
//# sourceMappingURL=legal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legal.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/integration/fixtures/legal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MAAM,EA6B3B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;GAqBrB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export const MATTERS = [
|
|
2
|
-
{
|
|
3
|
-
title: 'Mergers & Acquisitions Advisory',
|
|
4
|
-
practice_area: 'corporate',
|
|
5
|
-
billing_rate: 850,
|
|
6
|
-
risk_score: 3.2,
|
|
7
|
-
opened_at: '2023-01-10'
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
title: 'SEC Enforcement Defense',
|
|
11
|
-
practice_area: 'securities',
|
|
12
|
-
billing_rate: 920,
|
|
13
|
-
risk_score: 4.7,
|
|
14
|
-
opened_at: '2023-05-22'
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
title: 'Patent Infringement Litigation',
|
|
18
|
-
practice_area: 'intellectual-property',
|
|
19
|
-
billing_rate: 780,
|
|
20
|
-
risk_score: 3.9,
|
|
21
|
-
opened_at: '2022-08-14'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
title: 'Commercial Real Estate Finance',
|
|
25
|
-
practice_area: 'real-estate',
|
|
26
|
-
billing_rate: 620,
|
|
27
|
-
risk_score: 2.1,
|
|
28
|
-
opened_at: '2021-11-03'
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
export const ATTORNEYS = [
|
|
32
|
-
{
|
|
33
|
-
name: 'Sarah Chen',
|
|
34
|
-
practice_area: 'corporate',
|
|
35
|
-
name_suggest: { input: ['Sarah Chen', 'Chen'] }
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'Marcus Williams',
|
|
39
|
-
practice_area: 'securities',
|
|
40
|
-
name_suggest: { input: ['Marcus Williams', 'Williams'] }
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: 'Priya Kapoor',
|
|
44
|
-
practice_area: 'intellectual-property',
|
|
45
|
-
name_suggest: { input: ['Priya Kapoor', 'Kapoor'] }
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: 'James Okafor',
|
|
49
|
-
practice_area: 'real-estate',
|
|
50
|
-
name_suggest: { input: ['James Okafor', 'Okafor'] }
|
|
51
|
-
}
|
|
52
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-estate.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/integration/fixtures/real-estate.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,OAAO,EAqB7B,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const LISTINGS = [
|
|
2
|
-
{
|
|
3
|
-
address: '200 Harbor View Dr, Unit 12A',
|
|
4
|
-
property_class: 'condo',
|
|
5
|
-
list_price: 1_250_000
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
address: '845 Park Avenue, Apt 8B',
|
|
9
|
-
property_class: 'condo',
|
|
10
|
-
list_price: 2_100_000
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
address: '12 Park Terrace',
|
|
14
|
-
property_class: 'townhouse',
|
|
15
|
-
list_price: 3_100_000
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
address: '500 Riverside Drive',
|
|
19
|
-
property_class: 'townhouse',
|
|
20
|
-
list_price: 4_800_000
|
|
21
|
-
}
|
|
22
|
-
];
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type EsRequest = {
|
|
2
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
3
|
-
path?: string;
|
|
4
|
-
body?: any;
|
|
5
|
-
};
|
|
6
|
-
export declare const createIndex: (index: string, config: any) => Promise<any>;
|
|
7
|
-
export declare const deleteIndex: (index: string) => Promise<any>;
|
|
8
|
-
export declare const refreshIndex: (index: string) => Promise<any>;
|
|
9
|
-
export declare const search: (index: string, body: any) => Promise<any>;
|
|
10
|
-
export declare const indexDoc: (index: string, body: any) => Promise<any>;
|
|
11
|
-
export declare const bulkRequest: (ndjson: string) => Promise<any>;
|
|
12
|
-
export declare const msearchRequest: (index: string, ndjson: string) => Promise<any>;
|
|
13
|
-
export declare const esGet: (path: string) => Promise<any>;
|
|
14
|
-
export declare const esPost: (path: string, body?: any) => Promise<any>;
|
|
15
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/helpers.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAgBF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,QAAQ,GAAG,iBACT,CAAC;AAE9C,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,iBACD,CAAC;AAEzC,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,iBACK,CAAC;AAEhD,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,EAAE,MAAM,GAAG,iBACK,CAAC;AAErD,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,EAAE,MAAM,GAAG,iBACA,CAAC;AAElD,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,iBACL,CAAC;AAEtC,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,EAAE,QAAQ,MAAM,iBACX,CAAC;AAElD,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,iBAAsC,CAAC;AAEzE,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,OAAO,GAAG,iBACL,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
const ES_URL = process.env.ELASTICSEARCH_URL || 'http://localhost:9200';
|
|
3
|
-
const esJson = (url, method, body) => fetch(url, {
|
|
4
|
-
method,
|
|
5
|
-
headers: { 'Content-Type': 'application/json' },
|
|
6
|
-
...(body && { body: JSON.stringify(body) })
|
|
7
|
-
}).then((r) => r.json());
|
|
8
|
-
const esNdjson = (url, body) => fetch(url, {
|
|
9
|
-
method: 'POST',
|
|
10
|
-
headers: { 'Content-Type': 'application/x-ndjson' },
|
|
11
|
-
body
|
|
12
|
-
}).then((r) => r.json());
|
|
13
|
-
export const createIndex = (index, config) => esJson(`${ES_URL}/${index}`, 'PUT', config);
|
|
14
|
-
export const deleteIndex = (index) => esJson(`${ES_URL}/${index}`, 'DELETE');
|
|
15
|
-
export const refreshIndex = (index) => esJson(`${ES_URL}/${index}/_refresh`, 'POST');
|
|
16
|
-
export const search = (index, body) => esJson(`${ES_URL}/${index}/_search`, 'POST', body);
|
|
17
|
-
export const indexDoc = (index, body) => esJson(`${ES_URL}/${index}/_doc`, 'POST', body);
|
|
18
|
-
export const bulkRequest = (ndjson) => esNdjson(`${ES_URL}/_bulk`, ndjson);
|
|
19
|
-
export const msearchRequest = (index, ndjson) => esNdjson(`${ES_URL}/${index}/_msearch`, ndjson);
|
|
20
|
-
export const esGet = (path) => esJson(`${ES_URL}${path}`, 'GET');
|
|
21
|
-
export const esPost = (path, body) => esJson(`${ES_URL}${path}`, 'POST', body);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-management.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/index-management.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { indexBuilder, text, keyword, integer, float, date, boolean, geoPoint, denseVector, nested, completion } from '../../index.js';
|
|
2
|
-
import { createIndex, deleteIndex, esGet } from './helpers.js';
|
|
3
|
-
const INDEX_FULL = 'int-index-mgmt-full';
|
|
4
|
-
const INDEX_DYNAMIC = 'int-index-mgmt-dynamic';
|
|
5
|
-
const INDEX_ALIAS = 'int-index-mgmt-alias';
|
|
6
|
-
const fieldTypes = (props) => Object.fromEntries(Object.entries(props).map(([k, v]) => [k, v.type]));
|
|
7
|
-
describe('Index Management — full index config', () => {
|
|
8
|
-
beforeAll(() => createIndex(INDEX_FULL, indexBuilder()
|
|
9
|
-
.mappings({
|
|
10
|
-
title: text(),
|
|
11
|
-
category: keyword(),
|
|
12
|
-
count: integer(),
|
|
13
|
-
score: float(),
|
|
14
|
-
created_at: date(),
|
|
15
|
-
active: boolean(),
|
|
16
|
-
location: geoPoint(),
|
|
17
|
-
embedding: denseVector({ dims: 3 }),
|
|
18
|
-
tags: nested({ label: 'keyword', weight: 'float' }),
|
|
19
|
-
suggest: completion()
|
|
20
|
-
})
|
|
21
|
-
.settings({ number_of_shards: 1, number_of_replicas: 0 })
|
|
22
|
-
.build()));
|
|
23
|
-
afterAll(() => deleteIndex(INDEX_FULL));
|
|
24
|
-
it('registers all field types in the mapping', async () => {
|
|
25
|
-
const result = await esGet(`/${INDEX_FULL}/_mapping`);
|
|
26
|
-
expect(fieldTypes(result[INDEX_FULL].mappings.properties))
|
|
27
|
-
.toMatchInlineSnapshot(`
|
|
28
|
-
{
|
|
29
|
-
"active": "boolean",
|
|
30
|
-
"category": "keyword",
|
|
31
|
-
"count": "integer",
|
|
32
|
-
"created_at": "date",
|
|
33
|
-
"embedding": "dense_vector",
|
|
34
|
-
"location": "geo_point",
|
|
35
|
-
"score": "float",
|
|
36
|
-
"suggest": "completion",
|
|
37
|
-
"tags": "nested",
|
|
38
|
-
"title": "text",
|
|
39
|
-
}
|
|
40
|
-
`);
|
|
41
|
-
});
|
|
42
|
-
it('applies index settings', async () => {
|
|
43
|
-
const result = await esGet(`/${INDEX_FULL}/_settings`);
|
|
44
|
-
const { number_of_shards, number_of_replicas } = result[INDEX_FULL].settings.index;
|
|
45
|
-
expect({ number_of_shards, number_of_replicas }).toMatchInlineSnapshot(`
|
|
46
|
-
{
|
|
47
|
-
"number_of_replicas": "0",
|
|
48
|
-
"number_of_shards": "1",
|
|
49
|
-
}
|
|
50
|
-
`);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
describe('Index Management — dynamic mapping option', () => {
|
|
54
|
-
beforeAll(() => createIndex(INDEX_DYNAMIC, indexBuilder().mappings({ title: 'text', dynamic: 'strict' }).build()));
|
|
55
|
-
afterAll(() => deleteIndex(INDEX_DYNAMIC));
|
|
56
|
-
it('persists the dynamic setting in the mapping', async () => {
|
|
57
|
-
const result = await esGet(`/${INDEX_DYNAMIC}/_mapping`);
|
|
58
|
-
expect(result[INDEX_DYNAMIC].mappings.dynamic).toMatchInlineSnapshot(`"strict"`);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('Index Management — aliases', () => {
|
|
62
|
-
beforeAll(() => createIndex(INDEX_ALIAS, indexBuilder()
|
|
63
|
-
.mappings({ title: 'text' })
|
|
64
|
-
.alias('int-alias-read')
|
|
65
|
-
.alias('int-alias-write', { is_write_index: true })
|
|
66
|
-
.build()));
|
|
67
|
-
afterAll(() => deleteIndex(INDEX_ALIAS));
|
|
68
|
-
it('creates aliases with correct configuration', async () => {
|
|
69
|
-
const result = await esGet(`/${INDEX_ALIAS}/_alias`);
|
|
70
|
-
expect(result[INDEX_ALIAS].aliases).toMatchInlineSnapshot(`
|
|
71
|
-
{
|
|
72
|
-
"int-alias-read": {},
|
|
73
|
-
"int-alias-write": {
|
|
74
|
-
"is_write_index": true,
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
`);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-search.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/multi-search.integration.test.ts"],"names":[],"mappings":""}
|