3.14.0-win • Published 7 months ago

@a_team/prisma v3.14.0-win

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

A.Team prisma library

  • This package contains a shared Prisma schema, organized into multiple files, to be used across multiple repositories/projects.
  • By centralizing the schema definitions, we ensure consistency and reduce duplication of effort:
    • Consistency: We are targeting the same MongoDB database. If we use different schema definition files, there's a risk of having inconsistent model definitions, which could lead to conflicts and data overrides.
    • Efficiency: A single schema definition can reduce redundant work. Currently, the schema file has over 300 lines, and this could easily grow to 1000+ lines as we onboard more collections. By working collaboratively on a single schema definition, we can streamline our efforts and improve the overall quality.

Installation

  • To install this package, add the following optional dependencies (where X.Y.Z represents the version):
"optionalDependencies": {
    "@a_team/prisma-win": "npm:@a_team/prisma@X.Y.Z-win",
    "@a_team/prisma-macos": "npm:@a_team/prisma@X.Y.Z-macos",
    "@a_team/prisma-linux": "npm:@a_team/prisma@X.Y.Z-linux",
    "@a_team/prisma-linux-debian": "npm:@a_team/prisma@X.Y.Z-linux-debian"
}
  • Add the following script as postinstall & change per need in your service:
const fs = require('fs');
const path = require('path');

const getLinuxDistribution = () => {
  try {
    const osRelease = fs.readFileSync('/etc/os-release', 'utf-8');
    const match = osRelease.match(/^ID=(.+)$/m);
    return match ? match[1].replace(/"/g, '') : 'unknown';
  } catch (error) {
    console.error('Failed to detect Linux distribution:', error.message);
    return 'unknown';
  }
};

const getPlatformPackage = () => {
  switch (process.platform) {
    case 'darwin':
      return '@a_team/prisma-macos';
    case 'win32':
      return '@a_team/prisma-win';
    default:
      const linuxDistro = getLinuxDistribution();

      if (linuxDistro === 'debian') {
        return '@a_team/prisma-linux-debian';
      }

      return '@a_team/prisma-linux';
  }
};

const platformPackage = getPlatformPackage();
const nodeModulesPath = path.join(__dirname, '..', 'node_modules');
const sourcePath = path.join(nodeModulesPath, platformPackage);
const targetPath = path.join(nodeModulesPath, '@a_team/prisma');

if (fs.existsSync(sourcePath)) {
  if (fs.existsSync(targetPath)) {
    fs.rmSync(targetPath, { recursive: true, force: true });
  }

  fs.renameSync(sourcePath, targetPath);
  console.log(`Renamed ${platformPackage} to @a_team/prisma`);
} else {
  console.error(`Platform-specific package ${platformPackage} not found`);
  process.exit(1);
}
  • The script above will link the required OS dependency as the main one.

Usage

  • To use the library:
import { ATeamPrismaClient } from '@a_team/prisma';

export class DbClient extends ATeamPrismaClient {
  constructor(connectionUrl: string) {
    super(connectionUrl);
  }

  async onModuleInit() {
    await this.connect();
  }

  async onModuleDestroy() {
    await this.disconnect();
  }
}

Playground

  • The playground is a dedicated space where you can test and experiment with the prisma client and schema.
  • It contains various scripts that demonstrate how to interact with your database models.
  • Before running any playground scripts, make sure to set up your environment variables. First, copy the .env.sample file to .env:
cp .env.sample .env
  • Then, fill in the required environment variables in the .env file.
  • To run a playground script, use the following command:
npx ts-node playground/missionSpec.ts

Deployment versioning

  • Given a version pattern MAJOR.MINOR.PATCH, incrementing and releasing should be done as:
    • MAJOR version must be increased when incompatible service/code changes are made,
    • MINOR version must be increased when functionality in a backwards-compatible manner is made,
    • PATCH version must be increased when backwards-compatible bug fixes (for existing features) are made.

Publishing a new version

  • Pull the latest changes on the main branch and push the following tag to the repository:

    git tag v<major>.<minor>.<patch> # matches v0.0.1
    git push origin tag v<major>.<minor>.<patch> # runs the publishing process
  • This tag creates the new package versions needed and pushes them towards the npm repository,

  • A release on the github repository is generated,
  • A slack notification is sent to the required channel with the release changes.
3.14.0-win

7 months ago

3.14.0-macos

7 months ago

3.14.0-linux

7 months ago

3.13.8-win

7 months ago

3.13.8-macos

7 months ago

3.13.8-linux

7 months ago

3.13.7-win

7 months ago

3.13.7-macos

7 months ago

3.13.7-linux

7 months ago

3.13.6-win

8 months ago

3.13.6-macos

8 months ago

3.13.6-linux

8 months ago

3.13.5-win

8 months ago

3.13.5-macos

8 months ago

3.13.5-linux

8 months ago

3.13.4-win

8 months ago

3.13.4-macos

8 months ago

3.13.4-linux

8 months ago

3.13.3-win

8 months ago

3.13.3-macos

8 months ago

3.13.3-linux

8 months ago

3.13.2-win

8 months ago

3.13.2-macos

8 months ago

3.13.2-linux

8 months ago

3.13.1-win

8 months ago

3.13.1-macos

8 months ago

3.13.1-linux

8 months ago

3.13.0-win

8 months ago

3.13.0-macos

8 months ago

3.13.0-linux

8 months ago

3.12.9-win

8 months ago

3.12.9-macos

8 months ago

3.12.9-linux

8 months ago

3.12.8-win

8 months ago

3.12.8-macos

8 months ago

3.12.8-linux

8 months ago

3.12.7-win

8 months ago

3.12.7-macos

8 months ago

3.12.7-linux

8 months ago

3.12.6-win

8 months ago

3.12.6-macos

8 months ago

3.12.6-linux

8 months ago

3.12.5-win

8 months ago

3.12.5-macos

8 months ago

3.12.5-linux

8 months ago

3.12.4-win

8 months ago

3.12.4-macos

8 months ago

3.12.4-linux

8 months ago

3.12.3-win

9 months ago

3.12.3-macos

9 months ago

3.12.3-linux

9 months ago

3.12.2-win

9 months ago

3.12.2-macos

9 months ago

3.12.2-linux

9 months ago

3.12.1-win

9 months ago

3.12.1-macos

9 months ago

3.12.1-linux

9 months ago

3.12.0-win

9 months ago

3.12.0-macos

9 months ago

3.12.0-linux

9 months ago

3.11.1-win

9 months ago

3.11.1-macos

9 months ago

3.11.1-linux

9 months ago

3.11.0-win

9 months ago

3.11.0-macos

9 months ago

3.11.0-linux

9 months ago

3.10.1-win

10 months ago

3.10.1-macos

10 months ago

3.10.1-linux-debian

10 months ago

3.10.1-linux

10 months ago

3.10.0-win

10 months ago

3.10.0-macos

10 months ago

3.10.0-linux-debian

10 months ago

3.10.0-linux

10 months ago

3.9.5-win

10 months ago

3.9.5-macos

10 months ago

3.9.5-linux-debian

10 months ago

3.9.5-linux

10 months ago

3.9.4-win

10 months ago

3.9.4-macos

10 months ago

3.9.4-linux-debian

10 months ago

3.9.4-linux

10 months ago

3.9.3-win

11 months ago

3.9.3-macos

11 months ago

3.9.3-linux-debian

11 months ago

3.9.3-linux

11 months ago

3.9.2-win

11 months ago

3.9.2-macos

11 months ago

3.9.2-linux-debian

11 months ago

3.9.2-linux

11 months ago

3.9.1-win

11 months ago

3.9.1-macos

11 months ago

3.9.1-linux-debian

11 months ago

3.9.1-linux

11 months ago

3.9.0-win

11 months ago

3.9.0-macos

11 months ago

3.9.0-linux-debian

11 months ago

3.9.0-linux

11 months ago

3.8.6-win

12 months ago

3.8.6-macos

12 months ago

3.8.6-linux-debian

12 months ago

3.8.6-linux

12 months ago

3.8.5-win

12 months ago

3.8.5-macos

12 months ago

3.8.5-linux-debian

12 months ago

3.8.5-linux

12 months ago

3.8.4-win

12 months ago

3.8.4-macos

12 months ago

3.8.4-linux-debian

12 months ago

3.8.4-linux

12 months ago

3.8.3-win

1 year ago

3.8.3-macos

1 year ago

3.8.3-linux

1 year ago

3.8.2-win

1 year ago

3.8.2-macos

1 year ago

3.8.2-linux

1 year ago

3.8.1-win

1 year ago

3.8.1-macos

1 year ago

3.8.1-linux

1 year ago

3.8.0-win

1 year ago

3.8.0-macos

1 year ago

3.8.0-linux

1 year ago

3.7.1-macos

1 year ago

3.7.1-linux

1 year ago

3.7.0-win

1 year ago

3.7.0-macos

1 year ago

3.7.0-linux

1 year ago

3.6.17-win

1 year ago

3.6.17-macos

1 year ago

3.6.17-linux

1 year ago

3.6.16-win

1 year ago

3.6.16-macos

1 year ago

3.6.16-linux

1 year ago

3.6.15-win

1 year ago

3.6.15-macos

1 year ago

3.6.15-linux

1 year ago

3.6.5-win

1 year ago

3.6.5-macos

1 year ago

3.6.5-linux

1 year ago

3.6.4-win

1 year ago

3.6.4-macos

1 year ago

3.6.4-linux

1 year ago

3.6.3-win

1 year ago

3.6.3-macos

1 year ago

3.6.3-linux

1 year ago

3.6.2-win

1 year ago

3.6.2-macos

1 year ago

3.6.2-linux

1 year ago

3.6.1-win

1 year ago

3.6.1-macos

1 year ago

3.6.1-linux

1 year ago

3.6.0-win

1 year ago

3.6.0-macos

1 year ago

3.6.0-linux

1 year ago

3.5.5-win

1 year ago

3.5.5-macos

1 year ago

3.5.5-linux

1 year ago

3.5.4-win

1 year ago

3.5.4-macos

1 year ago

3.5.4-linux

1 year ago

3.5.3-win

1 year ago

3.5.2-win

1 year ago

3.5.3-macos

1 year ago

3.5.2-macos

1 year ago

3.5.3-linux

1 year ago

3.5.2-linux

1 year ago

3.5.1-win

1 year ago

3.5.1-macos

1 year ago

3.5.1-linux

1 year ago

3.4.8-win

1 year ago

3.4.8-macos

1 year ago

3.4.8-linux

1 year ago

3.4.7-win

1 year ago

3.4.7-macos

1 year ago

3.4.7-linux

1 year ago

3.4.6-win

1 year ago

3.4.6-macos

1 year ago

3.4.6-linux

1 year ago

3.4.5-win

1 year ago

3.4.5-macos

1 year ago

3.4.5-linux

1 year ago

3.4.4-win

1 year ago

3.4.4-macos

1 year ago

3.4.4-linux

1 year ago

3.4.3-win

1 year ago

3.4.3-macos

1 year ago

3.4.3-linux

1 year ago

3.5.0-win

1 year ago

3.5.0-macos

1 year ago

3.5.0-linux

1 year ago

3.4.2-win

1 year ago

3.4.2-macos

1 year ago

3.4.2-linux

1 year ago

3.4.1-win

1 year ago

3.4.1-macos

1 year ago

3.4.1-linux

1 year ago

3.4.0-win

1 year ago

3.4.0-macos

1 year ago

3.4.0-linux

1 year ago

3.3.0-win

1 year ago

3.3.0-macos

1 year ago

3.3.0-linux

1 year ago

3.2.11-win

1 year ago

3.2.11-macos

1 year ago

3.2.11-linux

1 year ago

3.2.10-win

1 year ago

3.2.10-macos

1 year ago

3.2.10-linux

1 year ago

3.2.9-win

1 year ago

3.2.9-macos

1 year ago

3.2.9-linux

1 year ago

3.2.8-win

1 year ago

3.2.8-macos

1 year ago

3.2.8-linux

1 year ago

3.2.7-win

1 year ago

3.2.7-macos

1 year ago

3.2.7-linux

1 year ago

3.2.6-win

1 year ago

3.2.6-macos

1 year ago

3.2.6-linux

1 year ago

3.2.5-win

1 year ago

3.2.5-macos

1 year ago

3.2.5-linux

1 year ago

3.2.4-win

1 year ago

3.2.4-macos

1 year ago

3.2.4-linux

1 year ago

3.2.3-win

1 year ago

3.2.3-macos

1 year ago

3.2.3-linux

1 year ago

3.1.2-win

1 year ago

3.1.2-macos

1 year ago

3.1.2-linux

1 year ago

3.2.2-win

1 year ago

3.2.2-macos

1 year ago

3.2.2-linux

1 year ago

3.2.1-win

1 year ago

3.2.1-macos

1 year ago

3.2.1-linux

1 year ago

3.2.0-win

1 year ago

3.2.0-macos

1 year ago

3.2.0-linux

1 year ago

3.1.1-win

1 year ago

3.1.1-macos

1 year ago

3.1.1-linux

1 year ago

3.1.0-win

1 year ago

3.1.0-macos

1 year ago

3.1.0-linux

1 year ago

3.0.22-macos

1 year ago

3.0.22-win

1 year ago

3.0.22-linux

1 year ago

3.0.20-macos

1 year ago

3.0.20-win

1 year ago

3.0.20-linux

1 year ago

3.0.0-macos

1 year ago

2.1.21-macos

1 year ago

2.1.21-linux

1 year ago

2.1.21-win

1 year ago

2.1.20-win

1 year ago

2.1.20-linux

1 year ago

2.1.20-macos

1 year ago

2.1.20

1 year ago

2.1.15

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago