Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_v28.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- typesense: '28.0'
otp: '27'
elixir: '1.18'
lint: true
lint: false

services:
typesense:
Expand Down
167 changes: 167 additions & 0 deletions .github/workflows/ci_v29.0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: CI v29.0

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
# https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
# Workflows that would otherwise be triggered using `on: push` or
# `on: pull_request` won't be triggered if you add any of the
# following strings to the commit message in a push, or the HEAD
# commit of a pull request:
# - [skip ci]
# - [ci skip]
# - [no ci]
# - [skip actions]
# - [actions skip]

test:
runs-on: ubuntu-latest

env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LATEST_TYPESENSE: '29.0'

strategy:
matrix:
include:
- typesense: '29.0'
otp: '25'
elixir: '1.14'
lint: false
- typesense: '29.0'
otp: '28'
elixir: '1.18'
lint: true

services:
typesense:
image: typesense/typesense:${{ matrix.typesense }}

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Check for misspellings
uses: codespell-project/actions-codespell@v2

Check warning on line 50 in .github/workflows/ci_v29.0.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/ci_v29.0.yml#L50

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.

- name: Start Typesense
run: |
docker run -id \
-p 8108:8108 \
--name typesense \
-v /tmp/typesense-data:/data \
-v /tmp/typesense-analytics-data:/analytics-data \
typesense/typesense:${{ matrix.typesense}} \
--api-key xyz \
--data-dir /data \
--enable-search-analytics=true \
--analytics-dir=/analytics-data \
--analytics-flush-interval=60 \
--analytics-minute-rate-limit=100 \
--enable-cors

- name: Wait for Typesense to be healthy
shell: bash
run: |
start_time=$(date +%s)
timeout=30
counter=0
until curl -s http://localhost:8108/health | grep -q '"ok":true'; do
if [ $counter -eq $timeout ]; then
echo "Timed out waiting for Typesense to be healthy"
exit 1
fi
echo "Waiting for Typesense to be healthy..."
sleep 1
counter=$((counter + 1))
done
end_time=$(date +%s)
elapsed=$((end_time - start_time))
echo "Typesense healthcheck elapsed: ${elapsed}s"

- name: Setup Elixir/OTP
uses: erlef/setup-beam@v1

Check warning on line 88 in .github/workflows/ci_v29.0.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/ci_v29.0.yml#L88

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Cache dependencies/builds
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-typesense-${{ matrix.typesense}}-${{ matrix.otp}}-${{ matrix.elixir}}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-typesense-${{ matrix.typesense}}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-

- name: Install Dependencies
run: |
mix local.rebar --if-missing
mix local.hex --if-missing
mix deps.get

- name: Find unused dependencies
run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}

- name: Check retired dependencies
run: mix hex.audit
if: ${{ matrix.lint }}

- name: Security audit of dependencies
run: mix deps.audit
if: ${{ matrix.lint }}

- name: Compile project
run: mix compile --all-warnings

- name: Run static analysis
run: mix credo --all --strict
if: ${{ matrix.lint }}

- name: Check format files
run: mix format --check-formatted
if: ${{ matrix.lint }}

- name: Restore PLT cache
id: plt_cache
uses: actions/cache/restore@v4
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
path: |
priv/plts
if: ${{ matrix.lint }}

- name: Create PLTs
if: ${{ steps.plt_cache.outputs.cache-hit != 'true' && matrix.lint }}
run: mix dialyzer --plt

- name: Save PLT cache
id: plt_cache_save
uses: actions/cache/save@v4
if: ${{ steps.plt_cache.outputs.cache-hit != 'true' && matrix.lint }}
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
path: |
priv/plts

- name: Dialyzer
run: mix dialyzer --format github --format dialyxir
if: ${{ matrix.lint }}

- name: Run tests
run: mix test --only ${{ matrix.typesense }}:true --trace

- name: Post test coverage to Coveralls
run: mix coveralls.github
if: ${{ matrix.lint && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
91 changes: 91 additions & 0 deletions .github/workflows/llm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: LLM
on:
push:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
ci_workflow:
uses: ./.github/workflows/ci_v29.0.yml
secrets: inherit

staging_deploy:
runs-on: ubuntu-latest
needs: [ci_workflow]

env:
MIX_ENV: test

strategy:
matrix:
include:
- typesense: '29.0'
otp: '28'
elixir: '1.18'

services:
typesense:
image: typesense/typesense:${{ matrix.typesense }}

steps:
- name: Start Typesense
run: |
docker run -id \
-p 8108:8108 \
--name typesense \
-v /tmp/typesense-data:/data \
-v /tmp/typesense-analytics-data:/analytics-data \
typesense/typesense:${{ matrix.typesense}} \
--api-key xyz \
--data-dir /data \
--enable-search-analytics=true \
--analytics-dir=/analytics-data \
--analytics-flush-interval=60 \
--analytics-minute-rate-limit=100 \
--enable-cors

- name: Wait for Typesense to be healthy
shell: bash
run: |
start_time=$(date +%s)
timeout=30
counter=0
until curl -s http://localhost:8108/health | grep -q '"ok":true'; do
if [ $counter -eq $timeout ]; then
echo "Timed out waiting for Typesense to be healthy"
exit 1
fi
echo "Waiting for Typesense to be healthy..."
sleep 1
counter=$((counter + 1))
done
end_time=$(date +%s)
elapsed=$((end_time - start_time))
echo "Typesense healthcheck elapsed: ${elapsed}s"

- name: Checkout repo
uses: actions/checkout@v5

- name: Setup Elixir/OTP
uses: erlef/setup-beam@v1

Check warning on line 71 in .github/workflows/llm.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/llm.yml#L71

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Cache typesense-data
uses: actions/cache@v4
with:
path: |
typesense-data
key: ${{ runner.os }}-typesense-data
restore-keys: |
${{ runner.os }}-typesense-data

- name: Test natural language search
run: mix test --only nls:true --trace
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}

- name: Post test coverage to Coveralls
run: mix coveralls.github
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ open_api_typesense-*.tar
.elixir_ls
**.DS_Store

*.env

/priv/plts/*.plt
/priv/plts/*.plt.hash
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@

## major.minor.patch (yyyy.mm.dd)

## 1.1.1 ???

### Added

* `NlSearchModels` operation
* `Analytics.flush_analytics/1`
* `Analytics.get_analytics_status/1`
* `Analytics.get_analytics_events/1`

### Chore

* update `priv/open_api.yml` to https://github.com/typesense/typesense-api-spec/commit/eac4e46bc934dd1f621406602c2c46184961788f

Check notice on line 21 in CHANGELOG.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

CHANGELOG.md#L21

Bare URL used
* Changed `DropTokensMode` schema from string to object.

### Removed

* `Operations.config/2`. Use `Operations.toggle_slow_request_log/2`

## 1.0.4 (2025.06.18)

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Restful client for Typesense with adherence to Open API spec 3 (formerly Swagger
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/965dd3f8866d49c3b3e82edd0f6270cb)](https://app.codacy.com/gh/jaeyson/open_api_typesense/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![codescenene Average Code Health](https://codescene.io/projects/63240/status-badges/average-code-health)](https://codescene.io/projects/63240)

[![CI v29.0](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v29.0.yml/badge.svg)](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v29.0.yml)
[![CI v28.0](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v28.0.yml/badge.svg)](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v28.0.yml)
[![CI v27.1](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v27.1.yml/badge.svg)](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v27.1.yml)
[![CI v27.0](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v27.0.yml/badge.svg)](https://github.com/jaeyson/open_api_typesense/actions/workflows/ci_v27.0.yml)
Expand All @@ -32,6 +33,9 @@ Collections.get_collections(conn: conn)
# another way (v1)
opts = [limit: 1, conn: conn]
Collections.get_collections(opts)

# or (v1)
Collections.get_collections(limit: 1, conn: conn)
```
## Installation

Expand All @@ -41,7 +45,7 @@ by adding `open_api_typesense` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:open_api_typesense, "~> 1.0"}
{:open_api_typesense, "~> 1.1"}

# Or from GitHub repository, if you want the latest greatest from main branch
{:open_api_typesense, git: "https://github.com/jaeyson/open_api_typesense.git"}
Expand Down
1 change: 1 addition & 0 deletions dev.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export GEMINI_API_KEY=google_xyz
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typesense:
image: docker.io/typesense/typesense:28.0
image: docker.io/typesense/typesense:29.0
container_name: typesense
restart: on-failure
ports:
Expand All @@ -18,7 +18,7 @@ services:
--analytics-minute-rate-limit=100
--enable-cors
typesense_dashboard:
image: ghcr.io/bfritscher/typesense-dashboard:1.9.3
image: ghcr.io/bfritscher/typesense-dashboard:2.1.0
container_name: typesense_dashboard
restart: on-failure
ports:
Expand Down
2 changes: 1 addition & 1 deletion lib/open_api_typesense/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ defmodule OpenApiTypesense.Client do
{:ok, []}
end

defp parse_body(_code, [{mod, _t}], body) when is_binary(body) do
defp parse_body(_code, [{mod, _t}], body) do
{:ok, Poison.decode!(body, as: [mod.__struct__()])}
end

Expand Down
Loading
Loading