@open-xamu-co/firebase-nuxt 2.0.0-next.2 → 2.0.0-next.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  Firebase nuxt
2
2
 
3
+ # [2.0.0-next.4](https://github.com/xamu-co/firebase-nuxt/compare/v2.0.0-next.3...v2.0.0-next.4) (2026-01-20)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * crash firestore method if missing instance ([4d29aec](https://github.com/xamu-co/firebase-nuxt/commit/4d29aece4c13e80070e97aa63ee8d8609755ef4b))
9
+ * preserve creation date ([7a3c2d2](https://github.com/xamu-co/firebase-nuxt/commit/7a3c2d21a3ef82cc6d736f918d30f3086c4f6fae))
10
+ * soundex algorithm as param ([2fceb8d](https://github.com/xamu-co/firebase-nuxt/commit/2fceb8d3097e92dee91baae642a0c88a3c3e061a))
11
+
12
+
13
+ ### Features
14
+
15
+ * bump for code editor ([838f5b3](https://github.com/xamu-co/firebase-nuxt/commit/838f5b327c3dd4681cb3d68200ec4aa1be9a6afe))
16
+
17
+
18
+ ### BREAKING CHANGES
19
+
20
+ * onDelete >>> onDeleted
21
+
22
+ # [2.0.0-next.3](https://github.com/xamu-co/firebase-nuxt/compare/v2.0.0-next.2...v2.0.0-next.3) (2026-01-16)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * bump dependencies for h3 vurnerability ([30f8565](https://github.com/xamu-co/firebase-nuxt/commit/30f85650c08814838bf967a4f524d32f245f1f45))
28
+
3
29
  # [2.0.0-next.2](https://github.com/xamu-co/firebase-nuxt/compare/v2.0.0-next.1...v2.0.0-next.2) (2026-01-15)
4
30
 
5
31
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Xamu nuxt firebase module
2
2
 
3
- Powered by Nuxt.js
3
+ Powered by [Nuxt.js](https://nuxt.com) & [Xamu UI](https://github.com/xamu-co/ui)
4
4
 
5
5
  ## Prerequisites
6
6
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "2.0.0-next.1",
7
+ "version": "2.0.0-next.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -109,6 +109,12 @@ export declare const locale: {
109
109
  form_invalid_data: string;
110
110
  form_no_values: string;
111
111
  form_new_value: string;
112
+ form_editor_preview: string;
113
+ form_editor_see_preview: string;
114
+ form_editor_bold: string;
115
+ form_editor_italic: string;
116
+ form_editor_link: string;
117
+ form_editor_link_add_url: string;
112
118
  table_see_values: string;
113
119
  table_see_name: string;
114
120
  table_hide_name: string;
@@ -13,10 +13,11 @@ import { getDocumentId } from "../../client/utils/resolver.js";
13
13
  import { TimedPromise } from "../../server/utils/guards.js";
14
14
  import { useAppLogger, useInstanceStore, useNuxtApp, useSessionStore } from "#imports";
15
15
  export async function useDocumentCreate(collectionPath, partialRef, createdCallback, { omitLoggings, ...config } = { omitLoggings: false, level: 0 }) {
16
- const { $clientFirestore, $resolveClientRefs } = useNuxtApp();
17
- if (!collectionPath || !$clientFirestore) throw new Error("Collection path is required");
18
16
  const SESSION = useSessionStore();
19
17
  const INSTANCE = useInstanceStore();
18
+ const { $clientFirestore, $resolveClientRefs } = useNuxtApp();
19
+ if (!collectionPath || !$clientFirestore) throw new Error("Collection path is required");
20
+ if (!INSTANCE) throw new Error("Missing instance");
20
21
  const collRef = collection($clientFirestore, collectionPath);
21
22
  if (collectionPath === "users") {
22
23
  const instanceRef = doc($clientFirestore, INSTANCE.id);
@@ -90,10 +91,11 @@ export async function useDocumentCreate(collectionPath, partialRef, createdCallb
90
91
  }
91
92
  }
92
93
  export async function useDocumentUpdate(node, middleRef = {}, { omitLoggings, ...config } = { omitLoggings: false, level: 0 }) {
93
- const { $clientFirestore, $resolveClientRefs } = useNuxtApp();
94
- if (!node.id || !$clientFirestore) throw new Error("Document id is required");
95
94
  const SESSION = useSessionStore();
96
95
  const INSTANCE = useInstanceStore();
96
+ const { $clientFirestore, $resolveClientRefs } = useNuxtApp();
97
+ if (!node.id || !$clientFirestore) throw new Error("Document id is required");
98
+ if (!INSTANCE) throw new Error("Missing instance");
97
99
  const docRef = doc($clientFirestore, node.id || "");
98
100
  const partialRef = middleRef;
99
101
  const lastUpdatedAt = node.updatedAt ? new Date(node.updatedAt).getTime() : 0;
@@ -158,10 +160,11 @@ export async function useDocumentUpdate(node, middleRef = {}, { omitLoggings, ..
158
160
  }
159
161
  }
160
162
  export async function useDocumentClone(node, middleRef = {}, { omitLoggings, ...config } = { omitLoggings: false, level: 0 }) {
161
- const { $clientFirestore, $resolveClientRefs } = useNuxtApp();
162
- if (!node.id || !$clientFirestore) throw new Error("Document id is required");
163
163
  const SESSION = useSessionStore();
164
164
  const INSTANCE = useInstanceStore();
165
+ const { $clientFirestore, $resolveClientRefs } = useNuxtApp();
166
+ if (!node.id || !$clientFirestore) throw new Error("Document id is required");
167
+ if (!INSTANCE) throw new Error("Missing instance");
165
168
  const docRef = doc($clientFirestore, node.id);
166
169
  const partialRef = middleRef;
167
170
  const source = (await getDoc(docRef)).data();
@@ -233,10 +236,11 @@ export async function useDocumentClone(node, middleRef = {}, { omitLoggings, ...
233
236
  }
234
237
  }
235
238
  export async function useDocumentDelete(node, { omitLoggings } = { omitLoggings: false, level: 0 }) {
236
- const { $clientFirestore } = useNuxtApp();
237
- if (!node.id || !$clientFirestore) throw new Error("Document id is required");
238
239
  const SESSION = useSessionStore();
239
240
  const INSTANCE = useInstanceStore();
241
+ const { $clientFirestore } = useNuxtApp();
242
+ if (!node.id || !$clientFirestore) throw new Error("Document id is required");
243
+ if (!INSTANCE) throw new Error("Missing instance");
240
244
  const docRef = doc($clientFirestore, node.id);
241
245
  const memberId = getDocumentId(SESSION.path);
242
246
  const memberPath = `${INSTANCE.id}/members/${memberId}`;
@@ -1,7 +1,6 @@
1
1
  import { deleteUser } from "firebase/auth";
2
2
  import { defineStore, skipHydrate } from "pinia";
3
3
  import { computed } from "vue";
4
- import { getDocumentId } from "../../client/utils/resolver.js";
5
4
  import { useCookie, useRuntimeConfig, useSwal } from "#imports";
6
5
  const cookieOptionsDefaults = {
7
6
  sameSite: "strict",
@@ -28,10 +27,7 @@ export const useSessionStore = defineStore("session", () => {
28
27
  partitioned: false,
29
28
  default: () => void 0
30
29
  });
31
- const path = computed(() => {
32
- const id = user.value?.id;
33
- return id ? `users/${getDocumentId(id)}` : "";
34
- });
30
+ const path = computed(() => user.value?.id || "");
35
31
  function setToken(newToken, newExpiredToken = false) {
36
32
  token.value = newToken || null;
37
33
  expiredToken.value = newExpiredToken;
@@ -49,7 +49,7 @@ export declare function onUpdated<T extends SharedData>(collectionPath: string,
49
49
  * @param callback callback fn
50
50
  * @returns firebase function
51
51
  */
52
- export declare function onDelete<T extends SharedData>(collectionPath: string, callback: (deletedDoc: QueryDocumentSnapshot<T>, utils: {
52
+ export declare function onDeleted<T extends SharedData>(collectionPath: string, callback: (deletedDoc: QueryDocumentSnapshot<T>, utils: {
53
53
  deletedAt: Date;
54
54
  logger: tLogger;
55
55
  }) => void): import("firebase-functions/core").CloudFunction<import("firebase-functions/v2/firestore").FirestoreEvent<import("firebase-functions/v2/firestore").QueryDocumentSnapshot | undefined, Record<string, string>>>;
@@ -51,8 +51,14 @@ export function onUpdated(collectionPath, callback, { defaults = {} } = {}) {
51
51
  const newDoc = data?.after;
52
52
  const oldDoc = data?.before;
53
53
  if (!newDoc || !oldDoc) return null;
54
- const { updatedAt: oldUpdatedAt, updatedByRef, deletedByRef, lock } = newDoc.data();
55
- const { updatedAt: newUpdatedAt } = oldDoc.data();
54
+ const {
55
+ updatedAt: oldUpdatedAt,
56
+ createdAt: newCreatedAt,
57
+ updatedByRef,
58
+ deletedByRef,
59
+ lock
60
+ } = newDoc.data();
61
+ const { updatedAt: newUpdatedAt, createdAt: oldCreatedAt = newCreatedAt } = oldDoc.data();
56
62
  const at = updatedByRef?.parent.parent || firebaseFirestore;
57
63
  const logger = makeFunctionsLogger(at, updatedByRef, metadata);
58
64
  if (deletedByRef && (!lock || Array.isArray(lock) && !lock.length)) {
@@ -60,10 +66,13 @@ export function onUpdated(collectionPath, callback, { defaults = {} } = {}) {
60
66
  }
61
67
  if (!oldUpdatedAt || !newUpdatedAt || !newUpdatedAt.isEqual(oldUpdatedAt)) return null;
62
68
  const callbackData = await callback?.(newDoc, oldDoc, { updatedAt, logger });
63
- return newDoc.ref.set({ ...defaults, ...callbackData, updatedAt }, { merge: true });
69
+ return newDoc.ref.set(
70
+ { ...defaults, ...callbackData, updatedAt, createdAt: oldCreatedAt },
71
+ { merge: true }
72
+ );
64
73
  });
65
74
  }
66
- export function onDelete(collectionPath, callback) {
75
+ export function onDeleted(collectionPath, callback) {
67
76
  const document = getDocumentPath(collectionPath);
68
77
  return onDocumentDeleted({ document, region: "us-east1" }, async ({ data, ...metadata }) => {
69
78
  const { firebaseFirestore } = getFirebase(`onDeleted: "${document}"`);
@@ -12,4 +12,4 @@ export declare function soundexEs(phrase: string): string;
12
12
  /**
13
13
  * Generate indexes to be used as tokens in a fuzzy search
14
14
  */
15
- export declare function getSearchIndexes(phrase: string): string[];
15
+ export declare function getSearchIndexes(phrase: string, soundexAlgorithm?: (phrase: string) => string): string[];
@@ -15,21 +15,21 @@ export function soundexEs(phrase) {
15
15
  rest = tmp.slice(1).replace(/[AEIOUHWY]/g, "").replace(/[BPFV]/g, "1").replace(/[CGKSXZ]/g, "2").replace(/[DT]/g, "3").replace(/[L]/g, "4").replace(/[MN]/g, "5").replace(/[R]/g, "6").replace(/[QJ]/g, "7").replace(/(\d)\1+/g, "$1");
16
16
  return (firstLetter + rest).padEnd(4, "0").slice(0, 4);
17
17
  }
18
- export function getSearchIndexes(phrase) {
18
+ export function getSearchIndexes(phrase, soundexAlgorithm = soundexEs) {
19
19
  const words2 = getWords(phrase);
20
20
  const indexes = /* @__PURE__ */ new Set();
21
21
  for (let i = 0; i < words2.length; i++) {
22
22
  const forwardWords = words2.slice(0, words2.length - i);
23
23
  const backwardWords = words2.slice(i);
24
24
  [forwardWords, backwardWords].forEach((currentWords) => {
25
- const perPhraseIndex = soundexEs(currentWords.join(" "));
25
+ const perPhraseIndex = soundexAlgorithm(currentWords.join(" "));
26
26
  const perWordIndex = currentWords.map((word) => {
27
27
  if (word.length >= 7) {
28
- const threeIndex = soundexEs(word.slice(0, 3));
29
- const fiveIndex = soundexEs(word.slice(0, 5));
28
+ const threeIndex = soundexAlgorithm(word.slice(0, 3));
29
+ const fiveIndex = soundexAlgorithm(word.slice(0, 5));
30
30
  indexes.add(threeIndex).add(fiveIndex);
31
31
  }
32
- return soundexEs(word);
32
+ return soundexAlgorithm(word);
33
33
  }).join(" ");
34
34
  indexes.add(perPhraseIndex).add(perWordIndex);
35
35
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xamu-co/firebase-nuxt",
3
- "version": "2.0.0-next.2",
3
+ "version": "2.0.0-next.4",
4
4
  "stableVersion": "1.1.0",
5
5
  "description": "Nuxt 3 module for the xamu project",
6
6
  "author": "@xamu-co",
@@ -85,12 +85,13 @@
85
85
  ],
86
86
  "dependencies": {
87
87
  "@nuxt/kit": "^3.20.2",
88
- "@open-xamu-co/ui-common-enums": "^4.0.0-next.1",
89
- "@open-xamu-co/ui-common-helpers": "^4.0.0-next.2",
90
- "@open-xamu-co/ui-nuxt": "^4.0.0-next.6",
88
+ "@open-xamu-co/ui-common-enums": "^4.0.0-next.2",
89
+ "@open-xamu-co/ui-common-helpers": "^4.0.0-next.4",
90
+ "@open-xamu-co/ui-components-vue": "^4.0.0-next.6",
91
+ "@open-xamu-co/ui-nuxt": "^4.0.0-next.7",
91
92
  "@pinia/nuxt": "^0.11.0",
92
93
  "accept-language-parser": "^1.5.0",
93
- "firebase": "^11.0.2",
94
+ "firebase": "^12.8.0",
94
95
  "firebase-admin": "^13.6.0",
95
96
  "firebase-functions": "^7.0.3",
96
97
  "lodash-es": "^4.17.21",
@@ -106,8 +107,8 @@
106
107
  "@nuxt/schema": "^3.20.2",
107
108
  "@nuxt/test-utils": "^3.21.0",
108
109
  "@open-xamu-co/eslint-config": "^3.0.1",
109
- "@open-xamu-co/ui-common-types": "^4.0.0-next.3",
110
- "@open-xamu-co/ui-styles": "^5.0.0-next.2",
110
+ "@open-xamu-co/ui-common-types": "^4.0.0-next.4",
111
+ "@open-xamu-co/ui-styles": "^5.0.0-next.4",
111
112
  "@semantic-release/changelog": "^6.0.3",
112
113
  "@semantic-release/exec": "^7.0.3",
113
114
  "@semantic-release/git": "^10.0.1",