@ddd-ts/store-firestore 0.0.42 → 0.0.44

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.
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,0BAA0B,CAAC;AAElC,qBAAa,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,CAAC,YAAY,CACpE,YAAW,sBAAsB,CAAC,CAAC,CAAC;IAE7B,WAAW,CAAC,WAAW,EAAE,CAAC,GAAG,iBAAiB,CAAC,YAAY;IAI3D,aAAa,CAAC,QAAQ,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,CAAC;IAInE,qBAAqB,CAC1B,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,GAC3C,CAAC,GAAG,SAAS;IAQT,kBAAkB,CACvB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,GACxD,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;CAGnC;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAmCxC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,iBAAiB,CAAC,YAAY,GAClC,iBAAiB,CAAC,YAAY,CAgChC"}
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,sBAAsB,EAE5B,MAAM,0BAA0B,CAAC;AAElC,qBAAa,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,CAAC,YAAY,CACpE,YAAW,sBAAsB,CAAC,CAAC,CAAC;IAE7B,WAAW,CAAC,WAAW,EAAE,CAAC,GAAG,iBAAiB,CAAC,YAAY;IAI3D,aAAa,CAAC,QAAQ,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,CAAC;IAInE,qBAAqB,CAC1B,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,GAC3C,CAAC,GAAG,SAAS;IAQT,kBAAkB,CACvB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,GACxD,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;CAGnC;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA0CxC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,iBAAiB,CAAC,YAAY,GAClC,iBAAiB,CAAC,YAAY,CAgChC"}
package/dist/converter.js CHANGED
@@ -22,8 +22,13 @@ function toFirestore(obj) {
22
22
  if (obj instanceof Date) {
23
23
  if ("microseconds" in obj && typeof obj.microseconds === "bigint") {
24
24
  const microseconds = obj.microseconds;
25
- const seconds = microseconds / 1000000n;
26
- const nanoseconds = microseconds % 1000000n * 1000n;
25
+ let seconds = microseconds / 1000000n;
26
+ let micros = microseconds % 1000000n;
27
+ if (micros < 0n) {
28
+ seconds -= 1n;
29
+ micros += 1000000n;
30
+ }
31
+ const nanoseconds = micros * 1000n;
27
32
  return new firebase_admin_firestore.Timestamp(Number(seconds), Number(nanoseconds));
28
33
  }
29
34
  return obj;
@@ -22,8 +22,13 @@ function toFirestore(obj) {
22
22
  if (obj instanceof Date) {
23
23
  if ("microseconds" in obj && typeof obj.microseconds === "bigint") {
24
24
  const microseconds = obj.microseconds;
25
- const seconds = microseconds / 1000000n;
26
- const nanoseconds = microseconds % 1000000n * 1000n;
25
+ let seconds = microseconds / 1000000n;
26
+ let micros = microseconds % 1000000n;
27
+ if (micros < 0n) {
28
+ seconds -= 1n;
29
+ micros += 1000000n;
30
+ }
31
+ const nanoseconds = micros * 1000n;
27
32
  return new Timestamp(Number(seconds), Number(nanoseconds));
28
33
  }
29
34
  return obj;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-ts/store-firestore",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "types": "dist/index.d.ts",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,13 +10,13 @@
10
10
  "dist"
11
11
  ],
12
12
  "dependencies": {
13
- "@ddd-ts/core": "0.0.42",
13
+ "@ddd-ts/core": "0.0.44",
14
14
  "firebase-admin": "^13.2.0"
15
15
  },
16
16
  "devDependencies": {
17
- "@ddd-ts/shape": "0.0.42",
18
- "@ddd-ts/tools": "0.0.42",
19
- "@ddd-ts/types": "0.0.42",
17
+ "@ddd-ts/shape": "0.0.44",
18
+ "@ddd-ts/tools": "0.0.44",
19
+ "@ddd-ts/types": "0.0.44",
20
20
  "@types/jest": "^29.5.1"
21
21
  },
22
22
  "exports": {