Skip to content

Commit 35f83be

Browse files
oskardudyczoskardudycz
authored andcommitted
Added explicit package for Mongo shims and configured TS7
1 parent 46af039 commit 35f83be

74 files changed

Lines changed: 7768 additions & 2717 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build_and_test.yml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ jobs:
4444
- name: Ensure specific npm version
4545
run: npm install -g npm@11.9.0
4646

47-
# - name: Install Playwright chromium browser
48-
# working-directory: ./src/e2e/browser
49-
# run: npx playwright install chromium
50-
5147
- name: Verify generated Cloudflare types
5248
run: npm run types:cloudflare:check
5349

@@ -63,5 +59,8 @@ jobs:
6359
- name: Verify bundle boundaries
6460
run: npm run test:bundles
6561

62+
- name: Verify browser and ESM/CommonJS package compatibility
63+
run: npm run test:compat
64+
6665
- name: Test
6766
run: npm run test

‎.github/workflows/publish.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: Publish packages on NPM 📦
4343
run: |
44-
for pkg_dir in packages/*/; do
44+
for pkg_dir in packages/pongo-shims/ packages/dumbo/ packages/pongo/ packages/testing/; do
4545
[ -f "${pkg_dir}package.json" ] || { echo "⏭ ${pkg_dir} has no package.json — skipping"; continue; }
4646
4747
read -r pkg_name pkg_version pkg_private < <(node -p "

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ dist
119119
# vitepress
120120
src/docs/.vitepress/dist
121121
src/docs/.vitepress/cache
122+
src/docs/.vitepress/.temp
122123
lib
123124

124125
.DS_Store

‎.vscode/extensions.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
44
"esbenp.prettier-vscode",
5+
"TypeScriptTeam.native-preview",
56
"vitest.explorer"
67
]
78
}

‎.vscode/settings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"typescript.preferences.importModuleSpecifier": "relative",
2727
"eslint.workingDirectories": [{ "mode": "auto" }],
2828
"debug.javascript.terminalOptions": {
29-
"nodeVersionHint": 20
29+
"nodeVersionHint": 24
3030
},
3131
"nodejs-testing.include": ["./**/**"],
3232
"nodejs-testing.extensions": [

‎AGENTS.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ Pongo provides a MongoDB-style document API backed by PostgreSQL and SQLite.
44

55
## Repository structure
66

7-
Repository is using npm workspaces and have three packages;
7+
Repository is using npm workspaces and has four packages;
88

99
- `src/packages/dumbo`: relational database foundations (connection pooling, management, SQL querying, etc.).
1010
- `src/packages/pongo`: MongoDB-compatible document database API.
11+
- `src/packages/pongo-shims`: bundled third-party type declarations used by Pongo's compatibility shims.
1112
- `src/packages/testing`: private helpers sharing one database container per test run. Prepared to move to its own repository.
1213

1314
Besides that:

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Pongo
66

7-
Pongo - Mongo but on PostgreSQL and with strong consistency benefits.
7+
Pongo - like Mongo but on Postgres or SQLite, with strong consistency benefits
88

99
## Getting Started
1010

‎src/.prettierignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**/dist/
22
**/lib/
33
**/cache/
4-
!packages/pongo/src/core/cache
4+
!packages/pongo/src/core/cache
5+
packages/pongo-shims/licenses/

‎src/docs/.vitepress/config.mts‎

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { defineConfig } from 'vitepress';
22

3-
const env = process.env.NODE_ENV;
3+
const description =
4+
'Pongo - like Mongo but on Postgres or SQLite, with strong consistency benefits';
45

56
// https://vitepress.dev/reference/site-config
67
export default defineConfig({
7-
base: env === 'production' ? '/Pongo/' : '/',
8+
base: './',
89
lang: 'en-GB',
910
title: 'Pongo',
10-
description: 'Event Sourcing made simple',
11+
description,
1112
themeConfig: {
1213
logo: '/logo.png',
1314
// https://vitepress.dev/reference/default-theme-config
@@ -40,30 +41,26 @@ export default defineConfig({
4041

4142
editLink: {
4243
pattern:
43-
'https://github.com/event-driven-io/Pongo/edit/master/docs/:path',
44+
'https://github.com/event-driven-io/Pongo/edit/main/src/docs/:path',
4445
text: 'Suggest changes to this page',
4546
},
4647

4748
socialLinks: [
48-
{ icon: 'github', link: 'https://github.com/event-driven-io/pongo' },
49+
{ icon: 'github', link: 'https://github.com/event-driven-io/Pongo' },
4950
{ icon: 'discord', link: 'https://discord.gg/VzvxR5Rb38' },
5051
],
5152
footer: {
5253
copyright: 'Copyright © Oskar Dudycz and contributors.',
5354
},
5455
},
5556
head: [
56-
// ['link', { rel: 'apple-touch-icon', type: 'image/png', size: "180x180", href: '/apple-touch-icon.png' }],
57-
// ['link', { rel: 'icon', type: 'image/png', size: "32x32", href: '/favicon-32x32.png' }],
58-
// ['link', { rel: 'icon', type: 'image/png', size: "16x16", href: '/favicon-16x16.png' }],
59-
// ['link', { rel: 'manifest', manifest: '/manifest.json' }],
6057
['meta', { property: 'og:title', content: 'Pongo' }],
6158
['meta', { property: 'og:type', content: 'website' }],
6259
[
6360
'meta',
6461
{
6562
property: 'og:description',
66-
content: 'Event Sourcing development made simple',
63+
content: description,
6764
},
6865
],
6966
[
@@ -77,16 +74,14 @@ export default defineConfig({
7774
'meta',
7875
{
7976
property: 'og:url',
80-
content: 'https://event-driven-io.github.io/pongo',
77+
content: 'https://event-driven-io.github.io/Pongo/',
8178
},
8279
],
83-
['meta', { property: 'twitter:card', content: 'summary_large_image' }],
84-
['meta', { property: 'twitter:site', content: 'marten_lib' }],
85-
['meta', { property: 'twitter:creator', content: 'marten_lib' }],
80+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
8681
[
8782
'meta',
8883
{
89-
property: 'twitter:image',
84+
name: 'twitter:image',
9085
content: 'https://event-driven-io.github.io/Pongo/social.png',
9186
},
9287
],

‎src/e2e/browser/browser.mjs‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { pongoCache, pongoClient, pongoSchema } from '@event-driven-io/pongo';
2+
import { pongoDriver } from '@event-driven-io/pongo/cloudflare';
3+
import { MongoClient } from '@event-driven-io/pongo/shim';
4+
5+
const users = pongoSchema.collection('users');
6+
const schema = pongoSchema.client({
7+
browser: pongoSchema.db('browser', { collections: { users } }),
8+
});
9+
const options = {
10+
driver: pongoDriver,
11+
database: {},
12+
schema: { definition: schema, autoMigration: 'None' },
13+
};
14+
const client = pongoClient(options);
15+
const shim = new MongoClient(options);
16+
const cache = pongoCache({ type: 'in-memory', max: 2 });
17+
cache.set('users:1', { _id: '1', name: 'Ada' });
18+
19+
window.pongoBrowser = {
20+
collectionName: client.db('browser').collection('users').collectionName,
21+
shimCollectionName: shim.db('browser').collection('users').collectionName,
22+
cachedDocument: await cache.get('users:1'),
23+
processType: typeof process,
24+
bufferType: typeof Buffer,
25+
requireType: typeof require,
26+
};

0 commit comments

Comments
 (0)