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 client has missing exports #2334

Closed
Yury-Fridlyand opened this issue Sep 19, 2024 · 8 comments
Closed

Node client has missing exports #2334

Yury-Fridlyand opened this issue Sep 19, 2024 · 8 comments
Assignees
Labels
bug Something isn't working node Node.js wrapper Release blocker Can't release without.
Milestone

Comments

@Yury-Fridlyand
Copy link
Collaborator

Yury-Fridlyand commented Sep 19, 2024

Describe the bug

The following are missing the init.py module exports:

./BaseClient.ts
ReturnTypeRecord
ReturnTypeMap
WritePromiseOptions

./GlideClusterClient.ts
ClusterResponse

./BaseClient.ts
ReturnTypeAttribute

Expected Behavior

The above types/interfaces must be exported.
Any internal function, type, or interface must not be exported.

Current Behavior

.

Reproduction Steps

.

Possible Solution

No response

Additional Information/Context

No response

Client version used

1.1

Engine type and version

N/A

OS

N/A

Language

TypeScript

Language Version

N/A

Cluster information

No response

Logs

No response

Other information

No response

@Yury-Fridlyand Yury-Fridlyand added bug Something isn't working Release blocker Can't release without. node Node.js wrapper labels Sep 19, 2024
@Yury-Fridlyand Yury-Fridlyand added this to the 1.1 milestone Sep 19, 2024
@acarbonetto acarbonetto moved this to In Progress in Valkey-GLIDE - internal Sep 19, 2024
@acarbonetto
Copy link
Contributor

to verify imports, we can use import. For example:
package.json:

{
    "type": "module",
    "dependencies": {
        "@valkey/valkey-glide": "^1.1.0rc10",
        "@types/node": "^20.4.8"
    },
    "devDependencies": {
        "typescript": "^5.1.6"
    }
}

and run index.ts:

import glide from "@valkey/valkey-glide";
console.log(glide);

@jamesx-improving
Copy link
Collaborator

Current exported list:

./Transaction.ts
export class BaseTransaction
export class Transaction
export class ClusterTransaction
./BaseClient.ts
export type ReturnTypeRecord
export type ReturnTypeMap
export interface ReturnTypeAttribute
export enum ProtocolVersion
export type GlideReturnType
export type GlideString
export enum Decoder
export interface DecoderOption
export type GlideRecord
export type SortedSetDataType
export type HashDataType
export type StreamEntryDataType
export function convertGlideRecord
export function convertGlideRecordToRecord
export function isGlideRecord
export type ReturnTypeXinfoStream
export type StreamEntries
export function convertRecordToGlideRecord
export interface ServerCredentials
export type ReadFrom
export interface BaseClientConfiguration
export enum ObjectType
export interface PubSubMsg
export type WritePromiseOptions
export class BaseClient
./Commands.ts
export function parseInfoResponse
export function createGet
export function createGetDel
export function createGetRange
export interface SetOptions
export function createSet
export enum InfoOptions
export function createPing
export function createInfo
export function createDel
export function createSelect
export function createClientGetName
export function createConfigRewrite
export function createConfigResetStat
export function createMGet
export function createMSet
export function createMSetNX
export function createIncr
export function createIncrBy
export function createIncrByFloat
export function createClientId
export function createConfigGet
export function createConfigSet
export function createHGet
export function convertFieldsAndValuesToHashDataType
export function createHSet
export function createHKeys
export function createHSetNX
export function createDecr
export function createDecrBy
export enum BitwiseOperation
export function createBitOp
export function createGetBit
export function createSetBit
export interface BitEncoding
export class SignedEncoding
export class UnsignedEncoding
export interface BitFieldOffset
export class BitOffset
export class BitOffsetMultiplier
export interface BitFieldSubCommands
export class BitFieldGet
export class BitFieldSet
export class BitFieldIncrBy
export enum BitOverflowControl
export class BitFieldOverflow
export function createBitField
export function createHDel
export function createHMGet
export function createHExists
export function createHGetAll
export function createLPush
export function createLPushX
export function createLPop
export function createLRange
export function createLLen
export enum ListDirection
export function createLMove
export function createBLMove
export function createLSet
export function createLTrim
export function createLRem
export function createRPush
export function createRPushX
export function createRPop
export function createSAdd
export function createSRem
export function createSScan
export function createSMembers
export function createSMove
export function createSCard
export function createSInter
export function createSInterCard
export function createSInterStore
export function createSDiff
export function createSDiffStore
export function createSUnion
export function createSUnionStore
export function createSIsMember
export function createSMIsMember
export function createSPop
export function createSRandMember
export function createCustomCommand
export function createHIncrBy
export function createHIncrByFloat
export function createHLen
export function createHVals
export function createExists
export function createUnlink
export enum ExpireOptions
export function createExpire
export function createExpireAt
export function createExpireTime
export function createPExpire
export function createPExpireAt
export function createPExpireTime
export function createTTL
export enum UpdateByScore
export interface ZAddOptions
export function convertElementsAndScores
export function createZAdd
export type KeyWeight
export type AggregationType
export function createZInterstore
export function createZInter
export function createZUnion
export function createZRem
export function createZCard
export function createZInterCard
export function createZDiff
export function createZDiffWithScores
export function createZDiffStore
export function createZScore
export function createZUnionStore
export function createZMScore
export function createScan
export enum InfBoundary
export type Boundary
export interface RangeByIndex
export type RangeByScore
export type RangeByLex
export function createZCount
export function createZRange
export function createZRangeWithScores
export function createZRangeStore
export function createType
export function createStrlen
export function createLIndex
export enum InsertPosition
export function createLInsert
export function createZPopMin
export function createZPopMax
export function createEcho
export function createPTTL
export function createZRemRangeByRank
export function createZRemRangeByLex
export function createZRemRangeByScore
export function createPersist
export function createZLexCount
export function createZRank
export type StreamTrimOptions
export interface StreamAddOptions
export function createXAdd
export function createXDel
export function createXTrim
export function createXRange
export function createXRevRange
export function createXGroupCreateConsumer
export function createXGroupDelConsumer
export function createTime
export function createPublish
export function createBRPop
export function createBLPop
export function createFCall
export function createFCallReadOnly
export function createFunctionDelete
export function createFunctionFlush
export function createFunctionLoad
export interface FunctionListOptions
export type FunctionListResponse
export function createFunctionList
export type FunctionStatsSingleResponse
export type FunctionStatsFullResponse
export function createFunctionStats
export function createFunctionKill
export function createFunctionDump
export enum FunctionRestorePolicy
export function createFunctionRestore
export interface BitOffsetOptions
export function createBitCount
export enum BitmapIndexType
export function createBitPos
export enum FlushMode
export function convertKeysAndEntries
export interface StreamReadOptions
export type StreamReadGroupOptions
export function createXRead
export function createXReadGroup
export function createXInfoStream
export function createXInfoGroups
export function createXLen
export interface StreamPendingOptions
export function createXPending
export function createXInfoConsumers
export interface StreamClaimOptions
export function createXClaim
export function createXAutoClaim
export interface StreamGroupOptions
export function createXGroupCreate
export function createXGroupDestroy
export function createRename
export function createRenameNX
export function createPfAdd
export function createPfCount
export function createPfMerge
export function createObjectEncoding
export function createObjectFreq
export function createObjectIdletime
export function createObjectRefcount
export interface LolwutOptions
export function createLolwut
export function createFlushAll
export function createFlushDB
export function createCopy
export function createMove
export function createDump
export interface RestoreOptions
export function createRestore
export interface LPosOptions
export function createLPos
export function createDBSize
export enum ConditionalChange
export interface GeospatialData
export interface GeoAddOptions
export function createGeoAdd
export enum GeoUnit
export function createGeoPos
export function createGeoDist
export function createGeoHash
export type GeoSearchResultOptions
export type GeoSearchStoreResultOptions
export enum SortOrder
export type GeoSearchShape
export interface GeoCircleShape
export interface GeoBoxShape
export type SearchOrigin
export interface CoordOrigin
export interface MemberOrigin
export function createGeoSearch
export function createGeoSearchStore
export function createZRevRank
export function createZRevRankWithScore
export enum ScoreFilter
export function createZMPop
export function createBZMPop
export function createZIncrBy
export interface SortOptions
export interface Limit
export function createSort
export function createSortReadOnly
export function createHStrlen
export function createHRandField
export function createHScan
export function createZRandMember
export function createLastSave
export function createLCS
export function createTouch
export function createRandomKey
export function createWatch
export function createUnWatch
export function createWait
export interface BaseScanOptions
export interface ScanOptions
export type ZScanOptions
export type HScanOptions
export function createZScan
export function createSetRange
export function createAppend
export function createLMPop
export function createBLMPop
export function createPubSubChannels
export function createPubSubNumPat
export function createPubSubNumSub
export function createPubsubShardChannels
export function createPubSubShardNumSub
export function createBZPopMax
export function createBZPopMin
export function createScriptShow
export enum TimeUnit
export function createGetEx
export function createXAck
export function createXGroupSetid
export function createScriptExists
export function createScriptFlush
export function createScriptKill
./Logger.ts
export type LevelOptions
export class Logger
./GlideClusterClient.ts
export interface RouteOption
export interface PeriodicChecksManualInterval
export type PeriodicChecks
export namespace GlideClusterClientConfiguration
export enum PubSubChannelModes
export interface PubSubSubscriptions
export type GlideClusterClientConfiguration
export type ClusterResponse
export interface SlotIdTypes
export interface SlotKeyTypes
export interface RouteByAddress
export type Routes
export type SingleNodeRoute
export class GlideClusterClient
./Errors.ts
export abstract class ValkeyError
export class ClosingError
export class RequestError
export class TimeoutError
export class ExecAbortError
export class ConnectionError
export class ConfigurationError
./GlideClient.ts
export namespace GlideClientConfiguration
export enum PubSubChannelModes
export interface PubSubSubscriptions
export type GlideClientConfiguration
export class GlideClient

@Yury-Fridlyand
Copy link
Collaborator Author

Keep in mind that a symbol which should be exported may not have export keyword. Like it was with LevelOptions in #2301.

@jamesx-improving
Copy link
Collaborator

jamesx-improving commented Sep 21, 2024

Missing types and interfaces that has export in their own .ts file but didn't included in node/npm/glide/index.ts:
types:

./BaseClient.ts
ReturnTypeRecord
ReturnTypeMap
WritePromiseOptions

./GlideClusterClient.ts
ClusterResponse

interfaces:

./BaseClient.ts
ReturnTypeAttribute

./GlideClusterClient.ts
PubSubSubscriptions

./GlideClient.ts
PubSubSubscriptions

Also, noticed that the definition of interface PubSubSubscriptions appears to be exactly the same between GlideClient.ts and GlideClusterClient.ts, but the underlying enum PubSubChannelModes used are actually defined differently. Maybe a rename is needed for these 2 objects.

Per internal discussion, no function should be exported externally. Here are the functions that are included in node/npm/glide/index.ts:

./Commands.ts
parseInfoResponse

There are more functions in node/npm/glide/index.ts which are not imported from valkey-GLIDE node code but from glide-rs. Not sure how to do exhaust search on those yet. An incomplete list of these functions:

createLeakedArray
createLeakedAttribute
createLeakedBigint
createLeakedDouble
createLeakedMap
createLeakedString

@acarbonetto
Copy link
Contributor

Also, noticed that the definition of interface PubSubSubscriptions appears to be exactly the same between GlideClient.ts and GlideClusterClient.ts, but the underlying enum PubSubChannelModes used are actually defined differently. Maybe a rename is needed for these 2 objects.

No changes needed for PubSubSubscriptions and PubSubChannelModes as these interfaces are exported as part of their respective namespaces: GlideClusterClientConfiguration and GlideClientConfiguration. The namespaces are already exported as part of the native bindings.

@acarbonetto
Copy link
Contributor

This issue is related to: #2307

@acarbonetto
Copy link
Contributor

The issue is followed by: #2335

@acarbonetto acarbonetto moved this from In Progress to Review in Valkey-GLIDE - internal Sep 21, 2024
@adarovadya
Copy link
Collaborator

#2342

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node Node.js wrapper Release blocker Can't release without.
Projects
Status: Done
Development

No branches or pull requests

5 participants