Skip to content

Commit eda692e

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/undici-5.26.2
2 parents ae7f3d5 + 48758d3 commit eda692e

File tree

16 files changed

+175
-80
lines changed

16 files changed

+175
-80
lines changed

Diff for: .github/workflows/ci.yml

+1-60
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ name: CI
22

33
on:
44
pull_request:
5-
branches:
6-
- main
7-
push:
8-
branches:
9-
- main
105

116
env:
12-
TURBO_API: https://turborepo-remote-cache.fly.dev
7+
TURBO_API: ${{ vars.TURBO_API }}
138
TURBO_TEAM: team_ducktors
149
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
1510

@@ -122,57 +117,3 @@ jobs:
122117

123118
- name: Lint code
124119
run: pnpm lint
125-
126-
test:
127-
runs-on: macos-latest
128-
name: Test
129-
steps:
130-
- uses: actions/checkout@v4
131-
- name: Use Node.js
132-
uses: actions/setup-node@v4
133-
with:
134-
node-version: 20
135-
136-
- uses: pnpm/action-setup@v2
137-
with:
138-
version: 8
139-
140-
- name: Get pnpm store directory
141-
id: pnpm-cache
142-
shell: bash
143-
run: |
144-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
145-
146-
- uses: actions/cache@v3
147-
name: Setup pnpm cache
148-
with:
149-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
150-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
151-
restore-keys: |
152-
${{ runner.os }}-pnpm-store-
153-
154-
- name: Install dependencies
155-
run: pnpm install --frozen-lockfile
156-
157-
- name: Run tests
158-
run: pnpm turbo test:coverage
159-
160-
- name: Copy c8 json coverage report
161-
run: |
162-
mkdir -p coverage/tmp
163-
cp -r ./packages/*/coverage/tmp/. coverage/tmp
164-
165-
- name: Merge json coverage reports
166-
run: pnpm dlx c8 report --reporter lcov --reporter text --extension ts
167-
168-
- name: Coveralls
169-
uses: coverallsapp/github-action@master
170-
with:
171-
github-token: ${{ secrets.GITHUB_TOKEN }}
172-
path-to-lcov: ./coverage/lcov.info
173-
174-
- name: CodeClimate
175-
continue-on-error: true
176-
uses: paambaati/[email protected]
177-
env:
178-
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}

Diff for: .github/workflows/test.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
TURBO_API: ${{ vars.TURBO_API }}
11+
TURBO_TEAM: team_ducktors
12+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
test:
20+
runs-on: macos-latest
21+
name: Test
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20
28+
29+
- uses: pnpm/action-setup@v2
30+
with:
31+
version: 8
32+
33+
- name: Get pnpm store directory
34+
id: pnpm-cache
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
38+
39+
- uses: actions/cache@v3
40+
name: Setup pnpm cache
41+
with:
42+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
- name: Install dependencies
48+
run: pnpm install --frozen-lockfile
49+
50+
- name: Run tests
51+
run: pnpm turbo test:coverage
52+
53+
- name: Copy c8 json coverage report
54+
run: |
55+
mkdir -p coverage/tmp
56+
cp -r ./packages/*/coverage/tmp/. coverage/tmp
57+
58+
- name: Merge json coverage reports
59+
run: pnpm dlx c8 report --reporter lcov --reporter text --extension ts
60+
61+
- name: Coveralls
62+
uses: coverallsapp/github-action@master
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
path-to-lcov: ./coverage/lcov.info
66+
67+
- name: CodeClimate
68+
continue-on-error: true
69+
uses: paambaati/[email protected]
70+
env:
71+
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}

Diff for: .kodiak.toml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# .kodiak.toml
2+
# https://kodiakhq.com/docs/config-reference
3+
version = 1
4+
5+
[merge]
6+
automerge_label = "automerge"
7+
blocking_labels = ["do not merge"]
8+
delete_branch_on_merge = true
9+
prioritize_ready_to_merge = true
10+
message.include_pull_request_author = true
11+
12+
[update]
13+
autoupdate_label = "autoupdate"
14+
always = false

Diff for: .lintstagedrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"*": "biome check . && biome format ."
2+
"*": "biome check . && biome format --apply ."
33
}

Diff for: .turbo/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"teamid": "team_ducktors",
3-
"apiurl": "https://turborepo-remote-cache.fly.dev",
3+
"apiurl": "https://turbo.ducktors.dev",
44
"token": "turbotoken-oss"
55
}

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22

33
<p align="center">
4-
<img align="center" alt="CRRETTO" src="https://user-images.githubusercontent.com/1620916/216588133-2ebcacd8-0ede-4b01-a863-cffdd0e041c6.png">
4+
<img align="center" alt="CARRETTO" src="https://user-images.githubusercontent.com/1620916/216588133-2ebcacd8-0ede-4b01-a863-cffdd0e041c6.png">
55
</p>
66

77
---
88

99
![chariot_full_of_barrels_covered_by_a_cloath_pulled_by_a_e402c499-fc99-412b-b57a-024e6377974d](https://user-images.githubusercontent.com/1620916/216587459-568a3504-7998-4979-952c-e75fd03440b9.png)
1010

11-
[![CI](https://github.com/ducktors/carretto/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ducktors/carretto/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/ducktors/carretto/badge.svg)](https://coveralls.io/github/ducktors/carretto) [![Maintainability](https://api.codeclimate.com/v1/badges/1099ccb45fa45a4d0507/maintainability)](https://codeclimate.com/github/ducktors/carretto/maintainability)
11+
[![CI](https://github.com/ducktors/carretto/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ducktors/carretto/actions/workflows/ci.yml) [![Test](https://github.com/ducktors/carretto/actions/workflows/test.yaml/badge.svg)](https://github.com/ducktors/carretto/actions/workflows/test.yaml) [![Coverage Status](https://coveralls.io/repos/github/ducktors/carretto/badge.svg)](https://coveralls.io/github/ducktors/carretto) [![Maintainability](https://api.codeclimate.com/v1/badges/1099ccb45fa45a4d0507/maintainability)](https://codeclimate.com/github/ducktors/carretto/maintainability)
1212
[![main-loader](https://img.shields.io/npm/v/@carretto/main-loader?label=main-loader)](https://www.npmjs.com/package/@carretto/main-loader)
1313
[![mongodb](https://img.shields.io/npm/v/@carretto/mongodb?label=mongodb)](https://www.npmjs.com/package/@carretto/mongodb)
1414
[![http](https://img.shields.io/npm/v/@carretto/http?label=http)](https://www.npmjs.com/package/@carretto/http)

Diff for: packages/http/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# @carretto/http
22

3+
## 0.2.0
4+
5+
### Minor Changes
6+
7+
- 06ff64b: Remove sorting as generic, only support Record<string, 1 | -1> as sorting type
8+
9+
### Patch Changes
10+
11+
- Updated dependencies [06ff64b]
12+
- @carretto/main-loader@0.5.0
13+
314
## 0.1.7
415

516
### Patch Changes

Diff for: packages/http/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@carretto/http",
3-
"version": "0.1.7",
3+
"version": "0.2.0",
44
"private": false,
55
"description": "Http adapter for Carretto dataloader",
66
"main": "dist/index.js",
@@ -30,7 +30,5 @@
3030
"dataloader": "^2.1.0",
3131
"undici": "^5.0.0"
3232
},
33-
"files": [
34-
"dist"
35-
]
33+
"files": ["dist"]
3634
}

Diff for: packages/main-loader/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @carretto/main-loader
22

3+
## 0.5.0
4+
5+
### Minor Changes
6+
7+
- 06ff64b: Remove sorting as generic, only support Record<string, 1 | -1> as sorting type
8+
39
## 0.4.1
410

511
### Patch Changes

Diff for: packages/main-loader/lib/key.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Projection } from '@carretto/projection';
22

3-
export interface Key<TQuery extends object, TSort = Record<string, 1 | -1>> {
3+
export interface Key<TQuery extends object> {
44
query: TQuery;
55
projection: Projection;
66
skip?: number;
77
limit?: number;
8-
sort?: TSort;
8+
sort?: Record<string, 1 | -1>;
99
}

Diff for: packages/main-loader/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@carretto/main-loader",
3-
"version": "0.4.1",
3+
"version": "0.5.0",
44
"private": false,
55
"description": "A dataloader implementation with adapters",
66
"main": "dist/index.js",
@@ -31,7 +31,5 @@
3131
"dataloader": "^2.1.0",
3232
"mongodb": "^4.17.0"
3333
},
34-
"files": [
35-
"dist"
36-
]
34+
"files": ["dist"]
3735
}

Diff for: packages/main-loader/test/pre-load.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import assert from 'assert';
2+
import { test } from 'node:test';
3+
import { TestLoader } from './util/test-loader-preload';
4+
5+
test('should change the key in the pre load hook', async (t) => {
6+
const spy = t.mock.fn();
7+
const loader = new TestLoader(spy);
8+
9+
await loader.load({
10+
query: { test: 'test' },
11+
projection: { firstName: 1 },
12+
});
13+
14+
assert.deepStrictEqual(spy.mock.calls[0].arguments, [
15+
{
16+
query: { test: 'test', added: 'added' },
17+
projection: { firstName: 1 },
18+
},
19+
]);
20+
});
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Key, MainLoader } from '../../';
2+
3+
interface TestQuery {
4+
test: string;
5+
added?: string;
6+
}
7+
8+
export class TestLoader extends MainLoader<void, TestQuery> {
9+
public spy: (key: Key<TestQuery>) => Promise<void>;
10+
11+
constructor(spy: any) {
12+
super();
13+
this.spy = spy;
14+
}
15+
16+
protected preLoad(key: Key<TestQuery>) {
17+
const { query: queryKey, ...restKey } = key;
18+
return {
19+
query: { added: 'added', ...queryKey },
20+
...restKey,
21+
};
22+
}
23+
24+
protected execute(key: Key<any>) {
25+
return this.spy(key);
26+
}
27+
}

Diff for: packages/mongodb/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# @carretto/mongodb
22

3+
## 0.3.0
4+
5+
### Minor Changes
6+
7+
- 06ff64b: Remove sorting as generic, only support Record<string, 1 | -1> as sorting type
8+
9+
### Patch Changes
10+
11+
- Updated dependencies [06ff64b]
12+
- @carretto/main-loader@0.5.0
13+
314
## 0.2.1
415

516
### Patch Changes

Diff for: packages/mongodb/lib/key.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Filter, Sort } from 'mongodb';
1+
import { Filter } from 'mongodb';
22

33
import { Key as MainLoaderKey } from '@carretto/main-loader';
44

5-
export type Key<T> = MainLoaderKey<Filter<T>, Sort>;
5+
export type Key<T> = MainLoaderKey<Filter<T>>;

Diff for: packages/mongodb/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@carretto/mongodb",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"private": false,
55
"description": "MongoDB adapter for Zaino dataloader",
66
"main": "dist/index.js",
@@ -31,7 +31,5 @@
3131
"dataloader": "^2.1.0",
3232
"mongodb": "^4.0.0"
3333
},
34-
"files": [
35-
"dist"
36-
]
34+
"files": ["dist"]
3735
}

0 commit comments

Comments
 (0)