2.7.1 • Published 8 months ago

@exogee/graphweaver-mikroorm v2.7.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
8 months ago

@exogee/graphweaver-mikroorm

MikroORM adapter package for Graphweaver

Documentation

Comprehensive documentation and usage examples can be found on our Docs Site. It covers installation instructions, detailed API documentation, and guides to help you get started with Graphweaver.

Graphweaver CLI graphweaver

The Graphweaver Command Line Interface (CLI) tool enables you to set up and manage Graphweaver using commands in your command-line shell. Check the graphweaver npm package here.

Environment Variables

To configure a single database it is possible to use env vars. There are two options:

  1. Specify a single AWS Secrets Manager ARN that contains a JSON object of the connection details
DATABASE_SECRET_ARN='<AWS SECRET ARN>'
  1. Specify all the parameters as separate env vars
DATABASE_HOST='localhost'
DATABASE_NAME='no_acls'
DATABASE_PORT='5432'
DATABASE_USERNAME='postgres'
DATABASE_PASSWORD='postgres'

If you have multiple databases connected to graphweaver then you will need to pass in the configuration settings in your own code.

const connection = {
    connectionManagerId: 'postgresql',
    entities,
    driver: PostgreSqlDriver,
    mikroOrmConfig: {
        host: process.env.DATABASE_HOST || 'localhost',
        dbName: process.env.DATABASE_NAME || 'no_acls',
        port: process.env.DATABASE_PORT ? Number(process.env.DATABASE_PORT) : 5432,
        user: process.env.DATABASE_USERNAME || 'postgres',
        password: process.env.DATABASE_PASSWORD || 'postgres',
    }
}
@Entity('Tag', {
	provider: new MikroBackendProvider(OrmTag, connection),
})

You can also pass a different ARN per connection:

const connection = {
    connectionManagerId: 'postgresql',
    entities,
    driver: PostgreSqlDriver,
    secretArn: process.env.DATABASE_ONE_SECRET_ARN
}
@Entity('Tag', {
	provider: new MikroBackendProvider(OrmTag, connection),
})

Lastly, you can also pass a function to the MikroOrmConfig option and Graphweaver will await the result. For example:

export const postgresqlConnection: ConnectionOptions = {
	connectionManagerId: 'postgresql',
	mikroOrmConfig: async () => {
		if (!config) {
			logger.info('Resolving new connection config');
			const credentials = await postgresqlCredentials();
			config = {
				entities: [LinkDataEntity, SubmissionDataEntity, UploadDataEntity, VisitDataEntity],
				driver: PostgreSqlDriver,
				...credentials,
			};
		} else {
			logger.info('Returning pre-cached connection config');
		}

		return config;
	},
};
2.7.0

8 months ago

2.7.1

8 months ago

2.6.0

9 months ago

2.4.0

9 months ago

2.5.0

9 months ago

2.3.2

9 months ago

2.3.1

9 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

1 year ago

1.0.4

12 months ago

1.0.3

12 months ago

2.2.1

10 months ago

2.0.3

11 months ago

2.2.0

10 months ago

2.0.2

11 months ago

2.2.3

10 months ago

2.0.5

11 months ago

2.2.2

10 months ago

2.0.4

11 months ago

2.2.5

10 months ago

2.0.7

11 months ago

2.2.4

10 months ago

2.0.6

11 months ago

2.2.7

10 months ago

2.2.6

10 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.1.0

11 months ago

2.3.0

10 months ago

2.1.0

10 months ago

1.0.0-beta.2

1 year ago

1.0.0-beta.3

1 year ago

1.0.0-beta.1

1 year ago

0.2.24

1 year ago

0.2.23

1 year ago

0.2.22

1 year ago

0.2.20

1 year ago

0.2.18

1 year ago

0.2.17

1 year ago

0.2.16

1 year ago

0.2.15

1 year ago

0.2.14

1 year ago

0.2.13

1 year ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.25

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.20

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.24

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.16

2 years ago

0.1.8

2 years ago

0.1.17

2 years ago

0.1.7

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.9

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.0-alpha.6

2 years ago

0.1.0-alpha.5

3 years ago

0.1.0-alpha.1

3 years ago

0.1.0-alpha.0

3 years ago