Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node: fix imports #2767

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Node: fix imports #2767

merged 1 commit into from
Nov 27, 2024

Conversation

acarbonetto
Copy link
Contributor

@acarbonetto acarbonetto commented Nov 27, 2024

Issue link

This Pull Request is linked to issue (URL): #2335

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Commits will be squashed upon merging.

@@ -175,16 +176,13 @@ function initialize() {
InfBoundary,
KeyWeight,
Boundary,
UpdateOptions,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpdateOptions doesn't exist in Commands.ts (renamed to UpdateByScore I believe)

ProtocolVersion,
RangeByIndex,
RangeByScore,
RangeByLex,
ReadFrom,
ServerCredentials,
SortClusterOptions,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with BaseScanOptions

SortOptions,
SortedSetRange,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SortedSetRange is not exported

interface SortedSetRange<T> {

@@ -215,7 +213,6 @@ function initialize() {
createLeakedDouble,
createLeakedMap,
createLeakedString,
parseInfoResponse,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal function

export function parseInfoResponse(response: string): Record<string, string> {

@@ -233,6 +230,7 @@ function initialize() {
module.exports = {
AggregationType,
BaseScanOptions,
ScanOptions,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used by scan

public async scan(

@@ -253,6 +251,7 @@ function initialize() {
DecoderOption,
GeoAddOptions,
GlideFt,
Field,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used by FT Create

export type Field = TextField | TagField | NumericField | VectorField;

@prateek-kumar-improving
Copy link
Collaborator

prateek-kumar-improving commented Nov 27, 2024

Ran the test again. Below symbols are missing for export:
[
'BaseClient',
'BaseTransaction',
'Field',
'ScanOptions',
'VectorFieldAttributes',
'convertFieldsAndValuesToHashDataType'
]

Field and ScanOptions are added.
We can make convertFieldsAndValuesToHashDataType as internal. Maybe VectorFieldAttributes also.
Why do BaseClient and BaseTransaction are not included in the export?

@Yury-Fridlyand
Copy link
Collaborator

Why do BaseClient and BaseTransaction are not included in the export?

Users should use derived classes only (standalone/cluster)

@acarbonetto
Copy link
Contributor Author

Why do BaseClient and BaseTransaction are not included in the export?

Good question. Because a user will never need them. BaseClient and BaseTransaction are 'abstract' classes that will never be used by a user and should not be exposed. Users can create unions of types if they need wider typing.

In a separate PR, we can make these classes private and not expose them.

@acarbonetto
Copy link
Contributor Author

Ran the test again. Below symbols are missing for export: [ 'BaseClient', 'BaseTransaction', 'Field', 'ScanOptions', 'VectorFieldAttributes', 'convertFieldsAndValuesToHashDataType' ]

  • BaseClient, BaseTransaction are not needed.
  • Field, and ScanOptions are added in this PR.
  • VectorFieldAttributes is also not needed.
  • convertFieldsAndValuesToHashDataType is an internal PR and should be marked as such.

The above will be cleaned up under #2721

@acarbonetto acarbonetto merged commit b1df33d into release-1.2 Nov 27, 2024
18 of 19 checks passed
@acarbonetto acarbonetto deleted the node/fix_imports branch November 27, 2024 01:53
@prateek-kumar-improving
Copy link
Collaborator

prateek-kumar-improving commented Nov 27, 2024

A list of exports that are not in the source code:
[
'ClusterScanCursor',
'FtProfileOtions',
'Script',
'SortClusterOptions',
'SortedSetRange',
'UpdateOptions',
'createLeakedArray',
'createLeakedAttribute',
'createLeakedBigint',
'createLeakedDouble',
'createLeakedMap',
'createLeakedString',
'default',
'parseInfoResponse'
]
parseInfoResponse, ClusterScanCursor, SortedSetRange, UpdateOptions, FtProfileOtions are removed. What about script and default?
Some of these are part of the glide-rs package. Is there a need for our package to export something from another package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node Node.js wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants