@storecraft/database-postgres 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -11
 - package/package.json +2 -1
 - package/tests/docker-compose.yml +23 -0
 - package/tests/runner.test.js +3 -1
 
    
        package/README.md
    CHANGED
    
    | 
         @@ -58,14 +58,12 @@ const server = http.createServer(app.handler).listen( 
     | 
|
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
            ## Testing Locally
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
            1. First  
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
            	        -v $(pwd):/var/lib/postgresql/data \
         
     | 
| 
       68 
     | 
    
         
            -
                      -p 5432:5432 -d postgres
         
     | 
| 
      
 61 
     | 
    
         
            +
            1. First start a `postgres` server
         
     | 
| 
      
 62 
     | 
    
         
            +
            First, make sure you have `docker` installed,
         
     | 
| 
      
 63 
     | 
    
         
            +
            Then, run
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 66 
     | 
    
         
            +
            npm run database-postgres:docker-compose-up
         
     | 
| 
       69 
67 
     | 
    
         
             
            ```
         
     | 
| 
       70 
68 
     | 
    
         | 
| 
       71 
69 
     | 
    
         
             
            2. create Environment
         
     | 
| 
         @@ -73,9 +71,9 @@ docker run --name some-postgres -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admi 
     | 
|
| 
       73 
71 
     | 
    
         
             
            create `.env` file with
         
     | 
| 
       74 
72 
     | 
    
         | 
| 
       75 
73 
     | 
    
         
             
            ```bash
         
     | 
| 
       76 
     | 
    
         
            -
            POSTGRES_USER=' 
     | 
| 
       77 
     | 
    
         
            -
            POSTGRES_PASSWORD=' 
     | 
| 
       78 
     | 
    
         
            -
            POSTGRES_PORT= 
     | 
| 
      
 74 
     | 
    
         
            +
            POSTGRES_USER='admin'
         
     | 
| 
      
 75 
     | 
    
         
            +
            POSTGRES_PASSWORD='admin'
         
     | 
| 
      
 76 
     | 
    
         
            +
            POSTGRES_PORT=6432
         
     | 
| 
       79 
77 
     | 
    
         
             
            POSTGRES_HOST='localhost'
         
     | 
| 
       80 
78 
     | 
    
         
             
            ```
         
     | 
| 
       81 
79 
     | 
    
         | 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "@storecraft/database-postgres",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "1.0. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "1.0.13",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "description": "Official Postgres Database driver for storecraft",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "license": "MIT",
         
     | 
| 
       6 
6 
     | 
    
         
             
              "author": "Tomer Shalev (https://github.com/store-craft)",
         
     | 
| 
         @@ -29,6 +29,7 @@ 
     | 
|
| 
       29 
29 
     | 
    
         
             
                }
         
     | 
| 
       30 
30 
     | 
    
         
             
              },
         
     | 
| 
       31 
31 
     | 
    
         
             
              "scripts": {
         
     | 
| 
      
 32 
     | 
    
         
            +
                "database-postgres:docker-compose-up": "docker compose -f ./tests/docker-compose.yml up -d ",
         
     | 
| 
       32 
33 
     | 
    
         
             
                "database-postgres:test": "node ./tests/runner.test.js",
         
     | 
| 
       33 
34 
     | 
    
         
             
                "test": "npm run database-postgres:test",
         
     | 
| 
       34 
35 
     | 
    
         
             
                "prepublishOnly": "npm version patch --force"
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            services:
         
     | 
| 
      
 2 
     | 
    
         
            +
              db:
         
     | 
| 
      
 3 
     | 
    
         
            +
                image: postgres
         
     | 
| 
      
 4 
     | 
    
         
            +
                container_name: test-postgres
         
     | 
| 
      
 5 
     | 
    
         
            +
                restart: always
         
     | 
| 
      
 6 
     | 
    
         
            +
                extra_hosts:
         
     | 
| 
      
 7 
     | 
    
         
            +
                  - "host.docker.internal:host-gateway"
         
     | 
| 
      
 8 
     | 
    
         
            +
                environment:
         
     | 
| 
      
 9 
     | 
    
         
            +
                  POSTGRES_USER: admin
         
     | 
| 
      
 10 
     | 
    
         
            +
                  POSTGRES_PASSWORD: admin
         
     | 
| 
      
 11 
     | 
    
         
            +
                volumes:
         
     | 
| 
      
 12 
     | 
    
         
            +
                  - pgdata:/var/lib/postgresql/data 
         
     | 
| 
      
 13 
     | 
    
         
            +
                healthcheck:
         
     | 
| 
      
 14 
     | 
    
         
            +
                  test: ["CMD-SHELL", "pg_isready"]
         
     | 
| 
      
 15 
     | 
    
         
            +
                  interval: 1s
         
     | 
| 
      
 16 
     | 
    
         
            +
                  timeout: 5s
         
     | 
| 
      
 17 
     | 
    
         
            +
                  retries: 10
         
     | 
| 
      
 18 
     | 
    
         
            +
                ports:
         
     | 
| 
      
 19 
     | 
    
         
            +
                  - 6432:5432
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            volumes:
         
     | 
| 
      
 23 
     | 
    
         
            +
              pgdata:
         
     | 
    
        package/tests/runner.test.js
    CHANGED
    
    | 
         @@ -11,7 +11,9 @@ export const create_app = async () => { 
     | 
|
| 
       11 
11 
     | 
    
         
             
                {
         
     | 
| 
       12 
12 
     | 
    
         
             
                  auth_admins_emails: ['admin@sc.com'],
         
     | 
| 
       13 
13 
     | 
    
         
             
                  auth_secret_access_token: 'auth_secret_access_token',
         
     | 
| 
       14 
     | 
    
         
            -
                  auth_secret_refresh_token: 'auth_secret_refresh_token'
         
     | 
| 
      
 14 
     | 
    
         
            +
                  auth_secret_refresh_token: 'auth_secret_refresh_token',
         
     | 
| 
      
 15 
     | 
    
         
            +
                  auth_secret_confirm_email_token: 'auth_secret_confirm_email_token',
         
     | 
| 
      
 16 
     | 
    
         
            +
                  auth_secret_forgot_password_token: 'auth_secret_forgot_password_token',
         
     | 
| 
       15 
17 
     | 
    
         
             
                }
         
     | 
| 
       16 
18 
     | 
    
         
             
              )
         
     | 
| 
       17 
19 
     | 
    
         
             
              .withPlatform(new NodePlatform())
         
     |