Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add standalone MPR postgres module #41

Merged
merged 18 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
71eb74e
feat: Initial commit add standalone MPR postgress module
gabrielmatau79 Dec 18, 2024
c8d3cf8
refactor: Resolve the requested changes regarding module configuratio…
gabrielmatau79 Dec 18, 2024
e3a532d
refactor: Resolve the requested changes regarding the refactoring of …
gabrielmatau79 Dec 18, 2024
99f4fb2
feat: Resolve the requested changes regarding the introduction of a c…
gabrielmatau79 Dec 18, 2024
a20acf9
fix: fix export class into package/postgress/index.ts
gabrielmatau79 Dec 18, 2024
3d66932
fix: fix name packages postgres
gabrielmatau79 Dec 19, 2024
23852ae
refactor: Resolve the requested changes in variable names and type ex…
gabrielmatau79 Dec 19, 2024
a57ab7e
feat: add release configuration and encapsulated in an options object…
gabrielmatau79 Dec 19, 2024
2decf51
docs: Add documentation for using the PostgresMessagePickupRepository
gabrielmatau79 Dec 19, 2024
d07f5bc
fix: fix request changes about package.json and remove fcmServiceBaseUrl
gabrielmatau79 Dec 19, 2024
739e45f
fix: Fix description package.json
gabrielmatau79 Dec 19, 2024
1aceb9c
fix: fix querys sql into dbcollections.ts
gabrielmatau79 Dec 20, 2024
2061999
fix: remove conditionial 'this.instance' to publish message when live…
gabrielmatau79 Dec 20, 2024
fe221a6
refactor: The table names are changed to livesession and queuedmessage.
gabrielmatau79 Dec 20, 2024
4621818
fix: fix include indexMessageTable in buildPgDatabase
gabrielmatau79 Dec 20, 2024
8f86e72
chore: fix names, simplify example in README
genaris Dec 24, 2024
7493cbe
style: ignore CHANGELOG
genaris Dec 24, 2024
e2ae0ad
revert: changes in CHANGELOG
genaris Dec 24, 2024
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
3 changes: 3 additions & 0 deletions packages/postgres/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"packages/postgres": "0.0.1"
}
29 changes: 29 additions & 0 deletions packages/postgres/config/dbCollections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const messagesTableName = 'storequeuedMessage'

export const createTableMessage = `
CREATE TABLE IF NOT EXISTS ${messagesTableName} (
id VARCHAR(20) DEFAULT substr(md5(random()::text), 1, 20) PRIMARY KEY,
connectionId VARCHAR(255),
recipientKeys TEXT[],
encryptedMessage JSONB,
state VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX IF NOT EXISTS "${messagesTableName}_connectionId_index" ON "queuedmessages" (connectionId);
CREATE INDEX IF NOT EXISTS "${messagesTableName}_created_at_index" ON "queuedmessages" (created_at);
`

export const liveSessionTableName = 'storelivesession'

export const createTableLive = `
CREATE TABLE IF NOT EXISTS ${liveSessionTableName} (
sessionid VARCHAR(255) PRIMARY KEY,
connectionid VARCHAR(50),
protocolVersion VARCHAR(50),
role VARCHAR(50),
instance VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX IF NOT EXISTS "${liveSessionTableName}_connectionid" ON "${liveSessionTableName}" USING btree ("connectionid");`
21 changes: 21 additions & 0 deletions packages/postgres/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Config } from '@jest/types'

const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'node',
coveragePathIgnorePatterns: ['/build/', '/node_modules/', '/__tests__/', 'tests'],
coverageDirectory: '<rootDir>/coverage/',
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
isolatedModules: true,
},
],
'^.+\\.jsx?$': require.resolve('babel-jest'),
},
moduleNameMapper: { '^uuid$': 'uuid' },
}

export default config
46 changes: 46 additions & 0 deletions packages/postgres/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@2060.io/credo-ts-message-pickup-repository-pg",
"main": "build/index",
"types": "build/index",
"version": "0.0.1",
"files": [
"build"
],
"publishConfig": {
"access": "public"
},
"description": "Message Pickup Repository postgress module",
gabrielmatau79 marked this conversation as resolved.
Show resolved Hide resolved
"license": "Apache-2.0",
"homepage": "https://github.com/2060-io/message-pickup-repository/tree/main/packages/postgress",
gabrielmatau79 marked this conversation as resolved.
Show resolved Hide resolved
"repository": {
"type": "git",
"url": "https://github.com/2060-io/message-pickup-repository",
"directory": "packages/postgress"
},
"scripts": {
"build": "yarn run clean && yarn run compile",
"clean": "rimraf -rf ./build",
"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "yarn run build",
"test": "jest"
},
"dependencies": {
"@credo-ts/core": "^0.5.11",
"loglevel": "^1.8.0",
"pg": "^8.11.3",
"pg-pubsub": "^0.8.1",
"typescript": "^4.0.0"
},
"devDependencies": {
"@types/node": "^16.0.0",
"@types/pg": "^8.11.10",
"jest": "^27.0.0",
"ts-jest": "^27.0.0",
"ts-loader": "^9.0.0",
"webpack": "^5.0.0",
"webpack-cli": "^4.0.0"
},
"peerDependencies": {
"@credo-ts/core": "^0.5.11"
}
}
5 changes: 5 additions & 0 deletions packages/postgres/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"packages/postgres": {
"release-type": "node"
}
}
Loading
Loading