@cravery/firebase 0.0.1
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/dist/iam/converters.d.ts +4 -0
- package/dist/iam/converters.d.ts.map +1 -0
- package/dist/iam/converters.js +39 -0
- package/dist/iam/converters.js.map +1 -0
- package/dist/iam/index.d.ts +2 -0
- package/dist/iam/index.d.ts.map +1 -0
- package/dist/iam/index.js +18 -0
- package/dist/iam/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/recipe/converters.d.ts +5 -0
- package/dist/recipe/converters.d.ts.map +1 -0
- package/dist/recipe/converters.js +90 -0
- package/dist/recipe/converters.js.map +1 -0
- package/dist/recipe/index.d.ts +4 -0
- package/dist/recipe/index.d.ts.map +1 -0
- package/dist/recipe/index.js +20 -0
- package/dist/recipe/index.js.map +1 -0
- package/dist/recipe/repository.d.ts +21 -0
- package/dist/recipe/repository.d.ts.map +1 -0
- package/dist/recipe/repository.js +157 -0
- package/dist/recipe/repository.js.map +1 -0
- package/dist/recipe/utils.d.ts +7 -0
- package/dist/recipe/utils.d.ts.map +1 -0
- package/dist/recipe/utils.js +118 -0
- package/dist/recipe/utils.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/strip-undefined.d.ts +13 -0
- package/dist/utils/strip-undefined.d.ts.map +1 -0
- package/dist/utils/strip-undefined.js +33 -0
- package/dist/utils/strip-undefined.js.map +1 -0
- package/dist/utils/timestamp.d.ts +6 -0
- package/dist/utils/timestamp.d.ts.map +1 -0
- package/dist/utils/timestamp.js +19 -0
- package/dist/utils/timestamp.js.map +1 -0
- package/package.json +58 -0
- package/src/iam/converters.ts +38 -0
- package/src/iam/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/recipe/converters.ts +93 -0
- package/src/recipe/index.ts +3 -0
- package/src/recipe/repository.ts +220 -0
- package/src/recipe/utils.ts +143 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/strip-undefined.ts +32 -0
- package/src/utils/timestamp.ts +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Timestamp as FirestoreTimestamp } from "firebase-admin/firestore";
|
|
2
|
+
import type { Timestamp } from "@cravery/core/types";
|
|
3
|
+
|
|
4
|
+
export function toTimestamp(timestamp: FirestoreTimestamp): Timestamp {
|
|
5
|
+
return {
|
|
6
|
+
seconds: timestamp.seconds,
|
|
7
|
+
nanoseconds: timestamp.nanoseconds,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function fromTimestamp(timestamp: Timestamp): FirestoreTimestamp {
|
|
12
|
+
return FirestoreTimestamp.fromMillis(
|
|
13
|
+
timestamp.seconds * 1000 + timestamp.nanoseconds / 1000000,
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function toOptionalTimestamp(
|
|
18
|
+
timestamp?: FirestoreTimestamp,
|
|
19
|
+
): Timestamp | undefined {
|
|
20
|
+
return timestamp ? toTimestamp(timestamp) : undefined;
|
|
21
|
+
}
|