@electric-sql/experimental
Advanced tools
Comparing version 0.1.2-beta.0 to 0.1.2-beta.1
@@ -7,11 +7,15 @@ // src/match.ts | ||
return new Promise((resolve, reject) => { | ||
const unsubscribe = stream.subscribe((messages) => { | ||
const message = messages.filter(isChangeMessage).find((message2) => { | ||
const operation = message2.headers.operation; | ||
return operations.includes(operation) && matchFn(message2); | ||
}); | ||
if (message) { | ||
return finish(message); | ||
const unsubscribe = stream.subscribe( | ||
(messages) => { | ||
const message = messages.filter( | ||
(msg) => isChangeMessage(msg) | ||
).find((message2) => { | ||
const operation = message2.headers.operation; | ||
return operations.includes(operation) && matchFn(message2); | ||
}); | ||
if (message) { | ||
return finish(message); | ||
} | ||
} | ||
}); | ||
); | ||
const timeoutId = setTimeout(() => { | ||
@@ -18,0 +22,0 @@ const msg = `matchStream timed out after ${timeout}ms`; |
{ | ||
"name": "@electric-sql/experimental", | ||
"version": "0.1.2-beta.0", | ||
"description": "Experimental TypeScript features for ElectricSQL.", | ||
"type": "module", | ||
"main": "dist/cjs/index.cjs", | ||
"module": "dist/index.legacy-esm.js", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"default": "./dist/cjs/index.cjs" | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"sideEffects": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/electric-sql/electric.git" | ||
}, | ||
"version": "0.1.2-beta.1", | ||
"author": "ElectricSQL team and contributors.", | ||
"license": "Apache-2", | ||
"bugs": { | ||
"url": "https://github.com/electric-sql/electric/issues" | ||
}, | ||
"homepage": "https://electric-sql.com", | ||
"dependencies": { | ||
"@electric-sql/client": "1.0.0-beta.1" | ||
"@electric-sql/client": "1.0.0-beta.2" | ||
}, | ||
@@ -53,5 +30,33 @@ "devDependencies": { | ||
}, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/index.d.cts", | ||
"default": "./dist/cjs/index.cjs" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"homepage": "https://electric-sql.com", | ||
"license": "Apache-2", | ||
"main": "dist/cjs/index.cjs", | ||
"module": "dist/index.legacy-esm.js", | ||
"optionalDependencies": { | ||
"@rollup/rollup-darwin-arm64": "^4.18.1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/electric-sql/electric.git" | ||
}, | ||
"sideEffects": false, | ||
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"typesVersions": { | ||
@@ -65,8 +70,8 @@ "*": { | ||
"scripts": { | ||
"build": "shx rm -rf dist && tsup && tsc -p tsconfig.build.json", | ||
"format": "eslint . --fix", | ||
"stylecheck": "eslint . --quiet", | ||
"test": "pnpm exec vitest", | ||
"typecheck": "tsc -p tsconfig.json", | ||
"build": "shx rm -rf dist && concurrently \"tsup\" \"tsc -p tsconfig.build.json\"", | ||
"stylecheck": "eslint . --quiet", | ||
"format": "eslint . --fix" | ||
"typecheck": "tsc -p tsconfig.json" | ||
} | ||
} |
@@ -9,2 +9,3 @@ import { | ||
type Value, | ||
type Message, | ||
} from '@electric-sql/client' | ||
@@ -19,16 +20,22 @@ | ||
return new Promise<ChangeMessage<T>>((resolve, reject) => { | ||
const unsubscribe: () => void = stream.subscribe((messages) => { | ||
const message = messages.filter(isChangeMessage).find((message) => { | ||
const operation = message.headers.operation | ||
const unsubscribe: () => void = stream.subscribe( | ||
(messages: Array<unknown>) => { | ||
const message = messages | ||
.filter((msg): msg is ChangeMessage<T> => | ||
isChangeMessage(msg as Message<Row<never>>) | ||
) | ||
.find((message) => { | ||
const operation: Operation = message.headers.operation | ||
return operations.includes(operation) && matchFn(message) | ||
}) | ||
return operations.includes(operation) && matchFn(message) | ||
}) | ||
if (message) { | ||
return finish(message) | ||
if (message) { | ||
return finish(message) | ||
} | ||
} | ||
}) | ||
) | ||
const timeoutId = setTimeout(() => { | ||
const msg = `matchStream timed out after ${timeout}ms` | ||
const timeoutId: NodeJS.Timeout = setTimeout(() => { | ||
const msg: string = `matchStream timed out after ${timeout}ms` | ||
@@ -40,3 +47,3 @@ console.error(msg) | ||
function finish(message: ChangeMessage<T>) { | ||
function finish(message: ChangeMessage<T>): void { | ||
clearTimeout(timeoutId) | ||
@@ -55,3 +62,3 @@ | ||
): (message: ChangeMessage<T>) => boolean { | ||
return (message) => message.value[column] === value | ||
return (message: ChangeMessage<T>) => message.value[column] === value | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29640
15
195
+ Added@electric-sql/client@1.0.0-beta.2(transitive)
- Removed@electric-sql/client@1.0.0-beta.1(transitive)