@pbvision/cloud-run-service 0.0.6 → 0.0.8

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/placeholder.js +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pbvision/cloud-run-service",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "fastify-firestore-service Web Framework on Cloud Run",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "debug": "yarn -s start-local-db && INDEBUGGER=1 NODE_ENV=localhost PORT=8080 K_REVISION=unittest REGION=us-central1 PROJECT=xyz-dev GIT_HASH=`git rev-parse HEAD` SERVICE=tbd ./node_modules/nodemon/bin/nodemon.js --no-lazy --legacy-watch --watch ./src --watch ./test --inspect=9229 node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config=./jest.config.json --runInBand",
14
14
  "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
15
15
  "setup": "yarn install --frozen-lockfile",
16
- "start-docker": "wd=`pwd`; tag=`basename $wd`; docker build --build-arg PROJECT=xyz-dev --build-arg GIT_HASH=`git rev-parse HEAD` . --tag $tag && docker run -p 127.0.0.1:8080:8080/tcp --env REGION us-central1 --env PORT=8080 --env K_REVISION=localhost --env SERVICE=tbd $tag:latest",
16
+ "start-docker": "wd=`pwd`; tag=`basename $wd`; docker build --build-arg PROJECT=xyz-dev --build-arg GIT_HASH=`git rev-parse HEAD` . --tag $tag && docker run -p 127.0.0.1:8080:8080/tcp --env REGION='us-central1' --env PORT=8080 --env K_REVISION=localhost --env SERVICE=tbd $tag:latest && docker run $tag:latest",
17
17
  "start-local-db": "./node_modules/@pbvision/firestore-orm/scripts/start-local-db.sh",
18
18
  "test": "yarn -s start-local-db && yarn -s test-without-starting-db",
19
19
  "test-without-starting-db": "NODE_ENV=localhost PORT=8080 K_REVISION='unittest' REGION=us-central1 PROJECT=xyz-dev GIT_HASH=`git rev-parse HEAD` SERVICE=tbd node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config=./jest.config.json",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@google-cloud/tasks": "^4.0.1",
32
- "@pbvision/fastify-firestore-service": "^0.0.21",
32
+ "@pbvision/fastify-firestore-service": "^0.0.23",
33
33
  "google-auth-library": "^9.4.2"
34
34
  },
35
35
  "devDependencies": {
@@ -2,12 +2,18 @@
2
2
  // shipped to Cloud Run. They only exist for local testing.
3
3
  import assert from 'node:assert'
4
4
 
5
- import { API } from '@pbvision/fastify-firestore-service'
5
+ import { API, DatabaseAPI } from '@pbvision/fastify-firestore-service'
6
+ import db from '@pbvision/firestore-orm'
6
7
  import S from '@pbvision/schema'
7
8
 
8
9
  import { isUnitTesting, now } from './utils.js'
9
10
 
10
- export class TestAPI extends API {
11
+ class Test extends db.Model {
12
+ static KEY = { id: S.str }
13
+ static FIELDS = { x: S.int }
14
+ }
15
+
16
+ export class TestAPI extends DatabaseAPI {
11
17
  static METHOD = 'GET'
12
18
  static PATH = '/time'
13
19
  static DESC = 'Just for testing'
@@ -16,6 +22,8 @@ export class TestAPI extends API {
16
22
  }
17
23
 
18
24
  async computeResponse () {
25
+ const doesNotExist = await this.tx.get(Test, 'abc')
26
+ assert(doesNotExist === undefined)
19
27
  return { epoch: now() }
20
28
  }
21
29
  }