Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ reviews:
collapse_walkthrough: false
auto_review:
enabled: true
drafts: true
drafts: false
chat:
auto_reply: true
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
**/node_modules/*
**/.wrangler/*
**/node_modules/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Files
.wrangler
.vscode
.idea
.DS_Store
Expand Down Expand Up @@ -29,3 +30,4 @@ smoke/react/package.json

# Local PartyKit folder
.partykit
.dev.vars*
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ To run a single test by its full name, you can use the `-t` flag followed by the
```console
$ pnpm test-gateways --project partykit -t "should sync to an empty db"
```

Cloud Meta Merge Datastructure:

1. PK(reqId,resId,tenant,ledger) accessed(date) (delete after x of time)
2. PK(tenant,ledger,reqId,resId) meta deliveryCount (delete if deiveryCount > y)
if meta is updated deliveryCount = 0

getMeta updates deliveryCount
getMeta on stream starts updates stream of resGetMeta
avoid subscribe method
Comment on lines +27 to +35
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve formatting and clarity of Cloud Meta Merge documentation

The Cloud Meta Merge documentation needs better formatting and clarity:

  1. There's a typo: "deiveryCount" should be "deliveryCount"
  2. The structure is hard to read and understand

Consider this improved format:

## Cloud Meta Merge Data Structure

### Primary Key Formats

1. **Time-based Access Record**

PK(reqId, resId, tenant, ledger)

  • Includes: accessed(date)
  • Cleanup: Entries deleted after time period X

2. **Delivery Tracking Record**

PK(tenant, ledger, reqId, resId)

  • Includes: meta deliveryCount
  • Cleanup: Entries deleted if deliveryCount > Y
  • Note: deliveryCount resets to 0 when meta is updated

### Operations

- **getMeta**:
- Updates the deliveryCount
- When used with stream, initiates updates stream of resGetMeta
- ⚠️ Warning: Avoid using the subscribe method

17 changes: 17 additions & 0 deletions globalSetup.v2-cloud.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ensureSuperThis } from "@fireproof/core";
import { setupBackend } from "./src/v2-cloud/test-helper.js";
import { wranglerParams } from "./src/v2-cloud/test-utils.js";

const sthis = ensureSuperThis();
export async function setup() {
const r = await setupBackend(sthis);
process.env[`FP_TEST_CF_BACKEND`] = JSON.stringify(r);
// eslint-disable-next-line no-console
console.log("Started wrangler process - ", wranglerParams(sthis).pid);
}

export async function teardown() {
// eslint-disable-next-line no-console
console.log("Stopping wrangler process - ", wranglerParams(sthis).pid);
process.kill(wranglerParams(sthis).pid);
}
5 changes: 0 additions & 5 deletions netlify.toml

This file was deleted.

22 changes: 22 additions & 0 deletions package-cloud-backend.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@fireproof/fireproof-cloud",
"version": "0.0.0",
"private": true,
"scripts": {
"deploy": "wrangler deploy --keep-vars",
"dev": "wrangler dev",
"start": "(env | grep -vi npm) > .dev.vars && wrangler dev --port 1968 --ip '::'",
"test": "vitest",
"cf-typegen": "wrangler types"
},
"dependencies": {
"@adviser/cement": "from-main-package-json",
"@cloudflare/workers-types": "from-main-package-json",
"aws4fetch": "from-main-package-json",
"partyserver": "from-main-package-json",
"partysocket": "from-main-package-json",
"valibot": "from-main-package-json",
"wrangler": "from-main-package-json"
},
"devDependencies": {}
}
47 changes: 34 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
"private": true,
"description": "Live database connector for the web",
"type": "module",
"engines": {
"node": ">=20"
},
"scripts": {
"publish": "pnpm run '/publish:/'",
"publish:aws": "tsx ./publish-package.ts ./dist/aws/package.json",
"publish:v1-cloud": "tsx ./publish-package.ts ./dist/v1-cloud/package.json",
"publish:netlify": "tsx ./publish-package.ts ./dist/netlify/package.json",
"publish:s3": "tsx ./publish-package.ts ./dist/s3/package.json",
"publish:partykit": "tsx ./publish-package.ts ./dist/partykit/package.json",
"publish:ucan": "tsx ./publish-package.ts ./dist/ucan/package.json",
"xpublish": "pnpm run '/publish:/'",
"xpublish:aws": "tsx ./publish-package.ts ./dist/aws/package.json",
"xpublish:cloud": "tsx ./publish-package.ts ./dist/cloud/package.json",
"xpublish:netlify": "tsx ./publish-package.ts ./dist/netlify/package.json",
"xpublish:s3": "tsx ./publish-package.ts ./dist/s3/package.json",
"xpublish:partykit": "tsx ./publish-package.ts ./dist/partykit/package.json",
"xpublish:ucan": "tsx ./publish-package.ts ./dist/ucan/package.json",
"prebuild": "rm -rf dist",
"xprepare": "pnpm run build",
"build": "pnpm run '/^build:/' && pnpm run '/^pub:/'",
Expand All @@ -20,7 +23,7 @@
"pub:noop": "echo",
"pub:aws": "tsx ./version-copy-package.ts ./dist/aws/package-aws.json && cp ./src/aws/README.md ./dist/aws/",
"pub:v1-cloud": "tsx ./version-copy-package.ts ./dist/v1-cloud/package-v1-cloud.json && cp ./src/v1-cloud/README.md ./dist/v1-cloud/",
"pub:netlify": "tsx ./version-copy-package.ts ./dist/netlify/package-netlify.json && cp ./src/netlify/server.ts ./dist/netlify/ && cp ./src/netlify/README.md ./dist/netlify/",
"pub:netlify": "tsx ./version-copy-package.ts ./dist/netlify/package-netlify.json && cp ./src/netlify/README.md ./dist/netlify/",
"pub:s3": "tsx ./version-copy-package.ts ./dist/s3/package-s3.json && cp ./src/s3/README.md ./dist/s3/",
"pub:partykit": "tsx ./version-copy-package.ts ./dist/partykit/package-partykit.json && cp ./src/partykit/server.ts ./dist/partykit/ && cp ./src/partykit/README.md ./dist/partykit/",
"pub:ucan": "tsx ./version-copy-package.ts ./dist/ucan/package-ucan.json && cp ./src/ucan/README.md ./dist/ucan/",
Expand All @@ -31,6 +34,7 @@
"pretest-docker": "tsx tests/docker-compose.ts -f tests/docker-compose.yaml up -d --wait --build",
"test": "vitest --run",
"posttest-docker": "tsx tests/docker-compose.ts -f tests/docker-compose.yaml down",
"dev:netlify": "netlify functions:serve --functions src/netlify/backend --port 8888",
"format": "prettier .",
"lint": "eslint"
},
Expand All @@ -57,7 +61,6 @@
"@smithy/types": "^4.1.0",
"@types/aws-lambda": "^8.10.147",
"@types/better-sqlite3": "^7.6.12",
"@types/eslint__js": "^9.14.0",
"@types/node": "^22.13.10",
"@types/wait-on": "^5.3.4",
"@types/ws": "^8.18.0",
Expand All @@ -68,6 +71,9 @@
"esbuild-plugin-replace": "^1.4.0",
"esbuild-plugin-resolve": "^2.0.0",
"eslint": "^9.22.0",
"jose": "^6.0.8",
"netlify": "^13.3.3",
"netlify-cli": "^19.0.0",
"partyserver": "^0.0.65",
"prettier": "^3.5.3",
"semver": "^7.7.1",
Expand All @@ -79,7 +85,7 @@
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.0.8",
"wait-on": "^8.0.2",
"wrangler": "^3.112.0",
"wrangler": "^3.114.1",
"zx": "^8.4.0"
},
"repository": {
Expand All @@ -90,8 +96,11 @@
"url": "https://github.com/fireproof-storage/connect/issues"
},
"homepage": "https://github.com/fireproof-storage/connect#readme",
"peerDependencies": {
"@adviser/cement": "^0.4.2"
},
"dependencies": {
"@adviser/cement": "^0.4.0",
"@adviser/cement": "^0.4.2",
"@aws-sdk/client-dynamodb": "^3.758.0",
"@aws-sdk/client-lambda": "^3.758.0",
"@aws-sdk/client-s3": "^3.758.0",
Expand All @@ -101,8 +110,11 @@
"@cloudflare/workers-types": "^4.20250303.0",
"@fireproof/core": "0.20.0-dev-preview-53",
"@fireproof/vendor": "~2.0.0",
"@hono/node-server": "^1.13.8",
"@hono/node-ws": "^1.0.4",
"@ipld/dag-ucan": "^3.4.5",
"@jspm/core": "^2.1.0",
"@libsql/client": "^0.14.0",
"@netlify/blobs": "^8.1.1",
"@ucanto/client": "^9.0.1",
"@ucanto/core": "^10.3.1",
Expand All @@ -120,17 +132,23 @@
"aws-lambda": "^1.0.7",
"aws4fetch": "^1.0.20",
"better-sqlite3": "^11.8.1",
"cmd-ts": "^0.13.0",
"dotenv": "^16.4.5",
"events": "^3.3.0",
"hono": "^4.6.13",
"idb-keyval": "^6.2.1",
"is-deep-strict-equal-x": "^1.1.2",
"jose": "^6.0.8",
"multiformats": "^13.3.2",
"node-sqlite3-wasm": "^0.8.36",
"partykit": "^0.0.111",
"partysocket": "^1.0.3",
"partyserver": "^0.0.65",
"partysocket": "^1.0.2",
"path": "^0.12.7",
"smol-toml": "^1.3.1",
"util": "^0.12.5",
"wait-on": "^8.0.2",
"valibot": "1.0.0-beta.7",
"vitest-pool-workers": "^0.0.1",
"ws": "^8.18.1"
},
"exports": {
Expand All @@ -144,12 +162,15 @@
},
"pnpm": {
"onlyBuiltDependencies": [
"@parcel/watcher",
"aws-sdk",
"better-sqlite3",
"es5-ext",
"esbuild",
"netlify-cli",
"protobufjs",
"sharp",
"unix-dgram",
"workerd"
]
}
Expand Down
Loading
Loading