Skip to content

Commit

Permalink
feat: add base ci workflow (#2)
Browse files Browse the repository at this point in the history
* feat: add base ci workflow
* feat: add clients exports and top level exports
* fix: simplify top level command exports
* fix: fix e2e imports
  • Loading branch information
T1B0 committed Jul 4, 2024
1 parent 0458d57 commit 4cbde14
Show file tree
Hide file tree
Showing 35 changed files with 287 additions and 215 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

name: build
on: [push]
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]

jobs:

install:
runs-on: node:20
steps:
- run: npm ci

build:
runs-on: node:20
needs: install
steps:
- run: npm run build

test:
runs-on: node:20
needs:
- install
- build
steps:
- run: npm run test


12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"name": "iggy-binary",
"name": "iggy-node-bin",
"type": "module",
"version": "0.1.0",
"description": "nodejs iggy.rs binary client",
"main": "index.js",
"files": [
"dist/**/*.js",
"dist/**/*.d.ts",
"dist/index.d.ts"
],
"types":"dist/index.d.ts",
"main":"dist/index.js",
"scripts": {
"test": "node --test --experimental-test-coverage dist/**/**/*.test.js",
"clean": "rm -Rf dist/",
"build": "tsc -p tsconfig.json",
"start": "node dist/index.js"
},
"author": "",
"author": "github.com/T1B0",
"license": "MIT",
"dependencies": {
"@fails-components/webtransport": "^1.0.8",
Expand Down
5 changes: 5 additions & 0 deletions src/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

export { Client, SimpleClient, SingleClient } from './client.js'
export { TcpClient, TcpOption } from './tcp.client.js';
export { TlsClient, TlsOption } from './tls.client.js';
export * from './client.utils.js';
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

export { PollingStrategy } from "./wire/message/poll.utils.js";
export { ConsumerKind } from "./wire/offset/offset.utils.js";
export { Partitioning } from './wire/message/partitioning.utils.js';
export { HeaderValue } from './wire/message/header.utils.js';

export * from './client/index.js'
export { ClientProvider, RawClient, CommandResponse } from './client/client.type.js';
export { Id } from './wire/identifier.utils.js'
7 changes: 2 additions & 5 deletions src/panic.serial.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

import { createTcpSocket } from './client/tcp.client.js';
import { handleResponse } from './client/client.utils.js';
import { LOGIN } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { GET_STREAMS } from './wire/stream/get-streams.command.js';
import { GET_USERS } from './wire/user/get-users.command.js';
import { handleResponse } from './client/index.js';
import { LOGIN, logout, GET_USERS, GET_STREAMS } from './wire/index.js';

try {
// create socket
Expand Down
8 changes: 2 additions & 6 deletions src/tcp.client.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

import { TcpClient } from './client/tcp.client.js';
import { login } from './wire/session/login.command.js';
import { getMe } from './wire/client/get-me.command.js';
import { getClients } from './wire/client/get-clients.command.js';
import { getClient } from './wire/client/get-client.command.js';
import { logout } from './wire/session/logout.command.js';
import { TcpClient } from './client/index.js';
import { login, getMe, getClients, getClient, logout } from './wire/index.js';

try {
// create socket
Expand Down
29 changes: 10 additions & 19 deletions src/tcp.consumer-group.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@

import { TcpClient } from './client/tcp.client.js';
import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { createGroup } from './wire/consumer-group/create-group.command.js';
import { joinGroup } from './wire/consumer-group/join-group.command.js';
import { getGroup } from './wire/consumer-group/get-group.command.js';
import { getGroups } from './wire/consumer-group/get-groups.command.js';
import { leaveGroup } from './wire/consumer-group/leave-group.command.js';
import { deleteGroup } from './wire/consumer-group/delete-group.command.js';
import { createTopic } from './wire/topic/create-topic.command.js';
import { deleteTopic } from './wire/topic/delete-topic.command.js';
import { purgeTopic } from './wire/topic/purge-topic.command.js';
import { createStream } from './wire/stream/create-stream.command.js';
import { deleteStream } from './wire/stream/delete-stream.command.js';
import { TcpClient } from './client/index.js';
import {
login, logout,
createGroup, joinGroup, getGroup, getGroups, leaveGroup, deleteGroup,
createTopic, deleteTopic, purgeTopic,
createStream, deleteStream,
pollMessages,
ConsumerKind, PollingStrategy, Partitioning
} from './wire/index.js';

import { sendSomeMessages } from './tcp.sm.utils.js';
import { ConsumerKind } from './wire/offset/offset.utils.js';
import { PollingStrategy } from './wire/message/poll.utils.js';
import { pollMessages } from './wire/message/poll-messages.command.js';
import { Partitioning } from './wire/message/partitioning.utils.js';
// import { getStats } from './wire/system/get-stats.command.js';


try {
Expand Down
25 changes: 10 additions & 15 deletions src/tcp.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@

import { TcpClient } from './client/tcp.client.js';
import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { createStream } from './wire/stream/create-stream.command.js';
import { updateStream } from './wire/stream/update-stream.command.js';
import { getStream } from './wire/stream/get-stream.command.js';
import { getStreams } from './wire/stream/get-streams.command.js';
import { deleteStream } from './wire/stream/delete-stream.command.js';
import { createTopic } from './wire/topic/create-topic.command.js';
import { updateTopic } from './wire/topic/update-topic.command.js';
import { getTopic } from './wire/topic/get-topic.command.js';
import { getTopics } from './wire/topic/get-topics.command.js';
import { deleteTopic } from './wire/topic/delete-topic.command.js';
import { createPartition } from './wire/partition/create-partition.command.js';
import { deletePartition } from './wire/partition/delete-partition.command.js';
import { TcpClient } from './client/index.js';

import {
login, logout,
updateStream, getStream, getStreams,
updateTopic, getTopic, getTopics,
createPartition, deletePartition,
createTopic, deleteTopic,
createStream, deleteStream,
} from './wire/index.js';


try {
Expand Down
28 changes: 10 additions & 18 deletions src/tcp.send-message.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@

import { v7 } from './wire/uuid.utils.js';
import { TcpClient } from './client/tcp.client.js';

import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { sendMessages, type SendMessages } from './wire/message/send-messages.command.js';
import { pollMessages } from './wire/message/poll-messages.command.js';
import { createTopic } from './wire/topic/create-topic.command.js';
import { deleteTopic } from './wire/topic/delete-topic.command.js';
import { purgeTopic } from './wire/topic/purge-topic.command.js';
import { createStream } from './wire/stream/create-stream.command.js';
import { deleteStream } from './wire/stream/delete-stream.command.js';
import { purgeStream } from './wire/stream/purge-stream.command.js';
import { getOffset } from './wire/offset/get-offset.command.js';
import { storeOffset } from './wire/offset/store-offset.command.js';
import { HeaderValue } from './wire/message/header.type.js';
import { ConsumerKind } from './wire/offset/offset.utils.js';
import { Partitioning } from './wire/message/partitioning.utils.js';
import { PollingStrategy } from './wire/message/poll.utils.js';
import { TcpClient } from './client/index.js';

import {
login, logout,
createTopic, deleteTopic, purgeTopic,
createStream, deleteStream, purgeStream,
pollMessages, sendMessages,
getOffset, storeOffset,
ConsumerKind, PollingStrategy, Partitioning, HeaderValue
} from './wire/index.js';


try {
Expand Down
6 changes: 3 additions & 3 deletions src/tcp.sm.utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import { v7 } from './wire/uuid.utils.js';
import { sendMessages } from './wire/message/send-messages.command.js';
import { HeaderValue } from './wire/message/header.type.js';
import { Partitioning } from './wire/message/partitioning.utils.js';
import { sendMessages, Partitioning, HeaderValue } from './wire/index.js';


import { ClientProvider } from './client/client.type.js';
import { Id } from './wire/identifier.utils.js';

Expand Down
7 changes: 2 additions & 5 deletions src/tcp.system.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

import { TcpClient } from './client/tcp.client.js';
import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { getStats } from './wire/system/get-stats.command.js';
import { ping } from './wire/system/ping.command.js';
import { TcpClient } from './client/index.js';
import { login, logout, getStats, ping } from './wire/index.js';

try {
// create socket
Expand Down
9 changes: 2 additions & 7 deletions src/tcp.token.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@

import { TcpClient } from './client/tcp.client.js';
import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
// import { LOGIN_WITH_TOKEN } from './wire/session/login-with-token.command.js';
import { getTokens } from './wire/token/get-tokens.command.js';
import { createToken } from './wire/token/create-token.command.js';
import { deleteToken } from './wire/token/delete-token.command.js';
import { TcpClient } from './client/index.js';
import { login, logout, getTokens, createToken, deleteToken } from './wire/index.js';

try {
// create socket
Expand Down
12 changes: 6 additions & 6 deletions src/tcp.topic.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TcpClient } from './client/index.js';

import {
login, logout,
createTopic, createStream, deleteStream
} from './wire/index.js';

import { TcpClient } from './client/tcp.client.js';
import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { createStream } from './wire/stream/create-stream.command.js';
import { createTopic } from './wire/topic/create-topic.command.js';
import { deleteStream } from './wire/stream/delete-stream.command.js';


try {
Expand Down
18 changes: 8 additions & 10 deletions src/tcp.user.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

import { TcpClient } from './client/tcp.client.js';
import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { getUser } from './wire/user/get-user.command.js';
import { createUser } from './wire/user/create-user.command.js';
import { changePassword } from './wire/user/change-password.command.js';
import { updateUser } from './wire/user/update-user.command.js';
import { updatePermissions } from './wire/user/update-permissions.command.js';
import { deleteUser } from './wire/user/delete-user.command.js';
import { getUsers } from './wire/user/get-users.command.js';
import { TcpClient } from './client/index.js';

import {
login, logout,
getUser, getUsers,
createUser, changePassword, updateUser, updatePermissions, deleteUser,
} from './wire/index.js';


try {
// create socket
Expand Down
7 changes: 2 additions & 5 deletions src/tls.system.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

import { TlsClient } from './client/tls.client.js';
import { login } from './wire/session/login.command.js';
import { logout } from './wire/session/logout.command.js';
import { getStats } from './wire/system/get-stats.command.js';
import { ping } from './wire/system/ping.command.js';
import { TlsClient } from './client/index.js';
import { login, logout, getStats, ping } from './wire/index.js';

try {
// create socket
Expand Down
4 changes: 4 additions & 0 deletions src/wire/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export * from './get-client.command.js';
export * from './get-clients.command.js';
export * from './get-me.command.js';
6 changes: 0 additions & 6 deletions src/wire/command-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ import { updatePermissions } from './user/update-permissions.command.js';
import { deleteUser } from './user/delete-user.command.js';
import { getUsers } from './user/get-users.command.js';

import { ConsumerKind } from './offset/offset.utils.js';
import { PollingStrategy } from './message/poll.utils.js';
import { Partitioning } from './message/partitioning.utils.js';
import { HeaderValue } from './message/header.type.js';
import { RawClient } from 'src/client/client.type.js';
import { Pool } from 'generic-pool';

const userAPI = (c: ClientProvider) => ({
get: getUser(c),
Expand Down
8 changes: 8 additions & 0 deletions src/wire/consumer-group/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

export * from './create-group.command.js';
export * from './delete-group.command.js';
export * from './get-group.command.js';
export * from './get-groups.command.js';
export * from './join-group.command.js';
export * from './leave-group.command.js';

12 changes: 12 additions & 0 deletions src/wire/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

export * from './client/index.js';
export * from './consumer-group/index.js';
export * from './message/index.js';
export * from './offset/index.js';
export * from './partition/index.js';
export * from './session/index.js';
export * from './stream/index.js';
export * from './system/index.js';
export * from './token/index.js';
export * from './topic/index.js';
export * from './user/index.js';
Loading

0 comments on commit 4cbde14

Please sign in to comment.