@pulseindex/sdk 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -66
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +7 -1
- package/dist/index.mjs +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,84 +1,56 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
### Breaking: three methods removed
|
|
6
|
-
|
|
7
|
-
`createSnapshot()`, `getRecoveryState()` and `setCdcOffset()` are gone, along
|
|
8
|
-
with the `RecoveryState`, `CreateSnapshotResponse` and `SetCdcOffsetResponse`
|
|
9
|
-
types and the RPCs behind them in the bundled proto.
|
|
10
|
-
|
|
11
|
-
No key issued from the dashboard could call them — every attempt returned a
|
|
12
|
-
permission error — so nothing that worked before stops working. If you were
|
|
13
|
-
calling them and getting errors, that is the code to delete.
|
|
14
|
-
|
|
15
|
-
**Checking readiness:** use `health()`, or `servingStatus()` when you need to
|
|
16
|
-
tell "not answering" apart from "not reachable". Both work with any key.
|
|
17
|
-
|
|
18
|
-
### The bundled proto now describes only the client's contract
|
|
3
|
+
## 3.0.0
|
|
19
4
|
|
|
20
|
-
|
|
21
|
-
drift check that keeps this file honest was changed to match: it verifies every
|
|
22
|
-
declaration here exists identically in the service, and no longer requires the
|
|
23
|
-
two to be identical.
|
|
5
|
+
### Breaking: a query returns a page instead of everything
|
|
24
6
|
|
|
25
|
-
|
|
7
|
+
`QueryBuilder` defaulted to a limit of 0, which the engine read as "no
|
|
8
|
+
ceiling" and answered with every matching id the tenant held. Nobody calling
|
|
9
|
+
`search()` without a limit meant to ask for that, and the cost of it landed on
|
|
10
|
+
the service rather than on the caller who never mentioned one.
|
|
26
11
|
|
|
27
|
-
|
|
12
|
+
The default is now `DEFAULT_LIMIT`, a hundred, on the builder and on the plain
|
|
13
|
+
options object alike. If you relied on getting every match back, say so:
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
environment variable that holds API keys, which is not the client's business.
|
|
15
|
+
```ts
|
|
16
|
+
await client.search(PulseIndex.query().tenant('acme').must('status:active').limit(5000));
|
|
17
|
+
```
|
|
33
18
|
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
A limit above the engine's maximum is refused with the maximum named, rather
|
|
20
|
+
than quietly trimmed — a short page that looks complete is worse than an error.
|
|
36
21
|
|
|
37
|
-
|
|
38
|
-
part of the product.
|
|
22
|
+
### Zero now means the count
|
|
39
23
|
|
|
40
|
-
|
|
24
|
+
`limit(0)` no longer means "no ceiling". It asks the engine for the number of
|
|
25
|
+
matches and no ids at all, which is the cheap way to count:
|
|
41
26
|
|
|
42
|
-
|
|
27
|
+
```ts
|
|
28
|
+
const { totalMatches } = await client.search(
|
|
29
|
+
PulseIndex.query().tenant('acme').must('status:active').limit(0),
|
|
30
|
+
);
|
|
31
|
+
```
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
JavaScript is unminified, so stack traces still land somewhere readable.
|
|
47
|
-
- Build, release and proto-sync notes moved out of the README; they described
|
|
48
|
-
how the SDK is maintained, not how to call it.
|
|
49
|
-
- The RPC table lists the calls a normal API key can make. The three
|
|
50
|
-
operator-only ones are noted rather than tabulated.
|
|
33
|
+
Requires an engine that speaks this contract. Against an older engine, a limit
|
|
34
|
+
of 0 still returns every id.
|
|
51
35
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## 1.1.2
|
|
55
|
-
|
|
56
|
-
Documentation only; the code is identical to 1.1.0.
|
|
57
|
-
|
|
58
|
-
The vendored `engine.proto` still described how the service works rather than
|
|
59
|
-
how to call it. Found by reading the file rather than searching it for known
|
|
60
|
-
words — which is the only method that finds what you did not already know to
|
|
61
|
-
look for.
|
|
62
|
-
|
|
63
|
-
## 1.1.1
|
|
36
|
+
## 2.0.0
|
|
64
37
|
|
|
65
|
-
|
|
38
|
+
### Breaking: the operator-only methods are gone
|
|
66
39
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
40
|
+
Three methods that no API key could ever call have been removed, along with
|
|
41
|
+
their types. Every attempt returned a permission error, so nothing that worked
|
|
42
|
+
before stops working. If you were calling them and handling the failure, that
|
|
43
|
+
is the code to delete.
|
|
70
44
|
|
|
71
|
-
|
|
45
|
+
**Checking readiness:** use `health()`, or `servingStatus()` when you need to
|
|
46
|
+
tell "not answering" apart from "not reachable". Both work with any key.
|
|
72
47
|
|
|
73
48
|
### `health()` no longer reports false for every key
|
|
74
49
|
|
|
75
|
-
`health()`
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
It now uses the standard `grpc.health.v1.Health` protocol, which requires no
|
|
80
|
-
particular scope. The signature is unchanged. If you were working around this by
|
|
81
|
-
ignoring `health()`, you can stop.
|
|
50
|
+
`health()` returned `false` no matter how the service was actually doing. It
|
|
51
|
+
now uses the standard `grpc.health.v1.Health` protocol. The signature is
|
|
52
|
+
unchanged — if you were working around this by ignoring `health()`, you can
|
|
53
|
+
stop.
|
|
82
54
|
|
|
83
55
|
### Added
|
|
84
56
|
|
|
@@ -89,7 +61,7 @@ ignoring `health()`, you can stop.
|
|
|
89
61
|
- `healthProtoPath` on the client config, for the rare case of overriding the
|
|
90
62
|
bundled `health.proto`.
|
|
91
63
|
|
|
92
|
-
`proto/health.proto`
|
|
64
|
+
`proto/health.proto` ships with the package. It is the standard health
|
|
93
65
|
protocol, vendored rather than pulled in as a dependency.
|
|
94
66
|
|
|
95
67
|
### Compatibility
|
|
@@ -97,6 +69,6 @@ protocol, vendored rather than pulled in as a dependency.
|
|
|
97
69
|
Against a service deployed before this release, the health protocol answers but
|
|
98
70
|
always reports `SERVING`. `health()` is then equivalent to a reachability check.
|
|
99
71
|
|
|
100
|
-
##
|
|
72
|
+
## Earlier versions
|
|
101
73
|
|
|
102
|
-
|
|
74
|
+
1.x was withdrawn and is not installable. 2.0.0 is the first supported release.
|
package/dist/index.d.mts
CHANGED
|
@@ -138,6 +138,15 @@ interface PulseIndexClientConfig {
|
|
|
138
138
|
interface QueryExecutor {
|
|
139
139
|
search(query: QueryBuilder): Promise<SearchResponse>;
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* A page, for callers who never say otherwise.
|
|
143
|
+
*
|
|
144
|
+
* The default used to be 0, which the engine read as "no ceiling" and answered
|
|
145
|
+
* with every matching id the tenant held. Nobody meant to ask for that, and
|
|
146
|
+
* the cost of it landed on the service rather than on the caller who forgot
|
|
147
|
+
* the limit. Zero is still expressible and now means the total alone.
|
|
148
|
+
*/
|
|
149
|
+
declare const DEFAULT_LIMIT = 100;
|
|
141
150
|
declare class QueryBuilder {
|
|
142
151
|
private readonly executor;
|
|
143
152
|
private state;
|
|
@@ -152,6 +161,10 @@ declare class QueryBuilder {
|
|
|
152
161
|
withinRadius(lat: number, lon: number, radiusKm: number, precision?: number): QueryBuilder;
|
|
153
162
|
withinRadius(options: RadiusOptions): QueryBuilder;
|
|
154
163
|
range(field: string, min: number, max: number): QueryBuilder;
|
|
164
|
+
/**
|
|
165
|
+
* How many ids to return. Zero asks the engine for the number of matches
|
|
166
|
+
* and no ids at all, which is the cheap way to count.
|
|
167
|
+
*/
|
|
155
168
|
limit(limit: number): QueryBuilder;
|
|
156
169
|
offset(offset: number): QueryBuilder;
|
|
157
170
|
toRequest(defaultTenantId?: string): SearchQueryRequest;
|
|
@@ -321,4 +334,4 @@ declare class PulseIndexQueryError extends PulseIndexError {
|
|
|
321
334
|
constructor(message: string, options?: ConstructorParameters<typeof PulseIndexError>[1]);
|
|
322
335
|
}
|
|
323
336
|
|
|
324
|
-
export { type BatchEntityInput, type BatchIndexResponse, ConnectionManager, type DeleteResponse, type EncodedEntity, type EntityAttributes, type EntityId, type EntityInput, FilterOperation, type FilterPredicate, GeoHash, type IndexEntityRequest, type IndexEntityResponse, PulseIndex, PulseIndexAuthError, PulseIndexClient, type PulseIndexClientConfig, PulseIndexConnectionError, PulseIndexError, PulseIndexQueryError, QueryBuilder, type RadiusOptions, type RangePredicate, SERVING_STATUS, type SearchQueryRequest, type SearchRequestOptions, type SearchResponse, PulseIndex as default, encodeEntity, sslEnabled, toUint64String };
|
|
337
|
+
export { type BatchEntityInput, type BatchIndexResponse, ConnectionManager, DEFAULT_LIMIT, type DeleteResponse, type EncodedEntity, type EntityAttributes, type EntityId, type EntityInput, FilterOperation, type FilterPredicate, GeoHash, type IndexEntityRequest, type IndexEntityResponse, PulseIndex, PulseIndexAuthError, PulseIndexClient, type PulseIndexClientConfig, PulseIndexConnectionError, PulseIndexError, PulseIndexQueryError, QueryBuilder, type RadiusOptions, type RangePredicate, SERVING_STATUS, type SearchQueryRequest, type SearchRequestOptions, type SearchResponse, PulseIndex as default, encodeEntity, sslEnabled, toUint64String };
|
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,15 @@ interface PulseIndexClientConfig {
|
|
|
138
138
|
interface QueryExecutor {
|
|
139
139
|
search(query: QueryBuilder): Promise<SearchResponse>;
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* A page, for callers who never say otherwise.
|
|
143
|
+
*
|
|
144
|
+
* The default used to be 0, which the engine read as "no ceiling" and answered
|
|
145
|
+
* with every matching id the tenant held. Nobody meant to ask for that, and
|
|
146
|
+
* the cost of it landed on the service rather than on the caller who forgot
|
|
147
|
+
* the limit. Zero is still expressible and now means the total alone.
|
|
148
|
+
*/
|
|
149
|
+
declare const DEFAULT_LIMIT = 100;
|
|
141
150
|
declare class QueryBuilder {
|
|
142
151
|
private readonly executor;
|
|
143
152
|
private state;
|
|
@@ -152,6 +161,10 @@ declare class QueryBuilder {
|
|
|
152
161
|
withinRadius(lat: number, lon: number, radiusKm: number, precision?: number): QueryBuilder;
|
|
153
162
|
withinRadius(options: RadiusOptions): QueryBuilder;
|
|
154
163
|
range(field: string, min: number, max: number): QueryBuilder;
|
|
164
|
+
/**
|
|
165
|
+
* How many ids to return. Zero asks the engine for the number of matches
|
|
166
|
+
* and no ids at all, which is the cheap way to count.
|
|
167
|
+
*/
|
|
155
168
|
limit(limit: number): QueryBuilder;
|
|
156
169
|
offset(offset: number): QueryBuilder;
|
|
157
170
|
toRequest(defaultTenantId?: string): SearchQueryRequest;
|
|
@@ -321,4 +334,4 @@ declare class PulseIndexQueryError extends PulseIndexError {
|
|
|
321
334
|
constructor(message: string, options?: ConstructorParameters<typeof PulseIndexError>[1]);
|
|
322
335
|
}
|
|
323
336
|
|
|
324
|
-
export { type BatchEntityInput, type BatchIndexResponse, ConnectionManager, type DeleteResponse, type EncodedEntity, type EntityAttributes, type EntityId, type EntityInput, FilterOperation, type FilterPredicate, GeoHash, type IndexEntityRequest, type IndexEntityResponse, PulseIndex, PulseIndexAuthError, PulseIndexClient, type PulseIndexClientConfig, PulseIndexConnectionError, PulseIndexError, PulseIndexQueryError, QueryBuilder, type RadiusOptions, type RangePredicate, SERVING_STATUS, type SearchQueryRequest, type SearchRequestOptions, type SearchResponse, PulseIndex as default, encodeEntity, sslEnabled, toUint64String };
|
|
337
|
+
export { type BatchEntityInput, type BatchIndexResponse, ConnectionManager, DEFAULT_LIMIT, type DeleteResponse, type EncodedEntity, type EntityAttributes, type EntityId, type EntityInput, FilterOperation, type FilterPredicate, GeoHash, type IndexEntityRequest, type IndexEntityResponse, PulseIndex, PulseIndexAuthError, PulseIndexClient, type PulseIndexClientConfig, PulseIndexConnectionError, PulseIndexError, PulseIndexQueryError, QueryBuilder, type RadiusOptions, type RangePredicate, SERVING_STATUS, type SearchQueryRequest, type SearchRequestOptions, type SearchResponse, PulseIndex as default, encodeEntity, sslEnabled, toUint64String };
|
package/dist/index.js
CHANGED
|
@@ -384,11 +384,12 @@ var DEFAULT_TIMEOUT_MS = 5e3;
|
|
|
384
384
|
var DEFAULT_POOL_SIZE = 1;
|
|
385
385
|
|
|
386
386
|
// src/builder/QueryBuilder.ts
|
|
387
|
+
var DEFAULT_LIMIT = 100;
|
|
387
388
|
function emptyState() {
|
|
388
389
|
return {
|
|
389
390
|
tenantId: "",
|
|
390
391
|
locationPrefix: "0",
|
|
391
|
-
limit:
|
|
392
|
+
limit: DEFAULT_LIMIT,
|
|
392
393
|
offset: 0,
|
|
393
394
|
filters: [],
|
|
394
395
|
ranges: []
|
|
@@ -488,6 +489,10 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
488
489
|
});
|
|
489
490
|
});
|
|
490
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* How many ids to return. Zero asks the engine for the number of matches
|
|
494
|
+
* and no ids at all, which is the cheap way to count.
|
|
495
|
+
*/
|
|
491
496
|
limit(limit) {
|
|
492
497
|
return this.fork((state) => {
|
|
493
498
|
state.limit = Math.max(0, Math.floor(limit));
|
|
@@ -1179,6 +1184,7 @@ function toIndexRequest(encoded) {
|
|
|
1179
1184
|
var index_default = PulseIndex;
|
|
1180
1185
|
|
|
1181
1186
|
exports.ConnectionManager = ConnectionManager;
|
|
1187
|
+
exports.DEFAULT_LIMIT = DEFAULT_LIMIT;
|
|
1182
1188
|
exports.FilterOperation = FilterOperation;
|
|
1183
1189
|
exports.GeoHash = GeoHash;
|
|
1184
1190
|
exports.PulseIndex = PulseIndex;
|
package/dist/index.mjs
CHANGED
|
@@ -361,11 +361,12 @@ var DEFAULT_TIMEOUT_MS = 5e3;
|
|
|
361
361
|
var DEFAULT_POOL_SIZE = 1;
|
|
362
362
|
|
|
363
363
|
// src/builder/QueryBuilder.ts
|
|
364
|
+
var DEFAULT_LIMIT = 100;
|
|
364
365
|
function emptyState() {
|
|
365
366
|
return {
|
|
366
367
|
tenantId: "",
|
|
367
368
|
locationPrefix: "0",
|
|
368
|
-
limit:
|
|
369
|
+
limit: DEFAULT_LIMIT,
|
|
369
370
|
offset: 0,
|
|
370
371
|
filters: [],
|
|
371
372
|
ranges: []
|
|
@@ -465,6 +466,10 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
465
466
|
});
|
|
466
467
|
});
|
|
467
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* How many ids to return. Zero asks the engine for the number of matches
|
|
471
|
+
* and no ids at all, which is the cheap way to count.
|
|
472
|
+
*/
|
|
468
473
|
limit(limit) {
|
|
469
474
|
return this.fork((state) => {
|
|
470
475
|
state.limit = Math.max(0, Math.floor(limit));
|
|
@@ -1155,4 +1160,4 @@ function toIndexRequest(encoded) {
|
|
|
1155
1160
|
// src/index.ts
|
|
1156
1161
|
var index_default = PulseIndex;
|
|
1157
1162
|
|
|
1158
|
-
export { ConnectionManager, FilterOperation, GeoHash, PulseIndex, PulseIndexAuthError, PulseIndexClient, PulseIndexConnectionError, PulseIndexError, PulseIndexQueryError, QueryBuilder, SERVING_STATUS, index_default as default, encodeEntity, sslEnabled, toUint64String };
|
|
1163
|
+
export { ConnectionManager, DEFAULT_LIMIT, FilterOperation, GeoHash, PulseIndex, PulseIndexAuthError, PulseIndexClient, PulseIndexConnectionError, PulseIndexError, PulseIndexQueryError, QueryBuilder, SERVING_STATUS, index_default as default, encodeEntity, sslEnabled, toUint64String };
|
package/package.json
CHANGED