@open-xamu-co/firebase-nuxt 1.0.0 → 1.1.0

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 (133) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +0 -14
  3. package/dist/module.d.mts +50 -0
  4. package/dist/module.json +12 -0
  5. package/dist/module.mjs +137 -0
  6. package/dist/runtime/client/types/entities/base.d.ts +29 -0
  7. package/dist/runtime/client/types/entities/base.js +0 -0
  8. package/dist/runtime/client/types/entities/instance.d.ts +42 -0
  9. package/dist/runtime/client/types/entities/instance.js +0 -0
  10. package/dist/runtime/client/types/entities/logs.d.ts +9 -0
  11. package/dist/runtime/client/types/entities/logs.js +0 -0
  12. package/dist/runtime/client/types/entities/user.d.ts +27 -0
  13. package/dist/runtime/client/types/entities/user.js +0 -0
  14. package/dist/runtime/client/types/firestore.d.ts +55 -0
  15. package/dist/runtime/client/types/firestore.js +0 -0
  16. package/dist/runtime/client/types/index.d.ts +5 -0
  17. package/dist/runtime/client/types/index.js +5 -0
  18. package/dist/runtime/client/utils/locale.d.ts +185 -0
  19. package/dist/runtime/client/utils/locale.js +63 -0
  20. package/dist/runtime/client/utils/logger.d.ts +14 -0
  21. package/dist/runtime/client/utils/logger.js +65 -0
  22. package/dist/runtime/client/utils/resolver.d.ts +14 -0
  23. package/dist/runtime/client/utils/resolver.js +88 -0
  24. package/dist/runtime/components/ValueCellphone.d.vue.ts +24 -0
  25. package/dist/runtime/components/ValueCellphone.vue +21 -0
  26. package/dist/runtime/components/ValueCellphone.vue.d.ts +24 -0
  27. package/dist/runtime/components/ValueID.d.vue.ts +18 -0
  28. package/dist/runtime/components/ValueID.vue +14 -0
  29. package/dist/runtime/components/ValueID.vue.d.ts +18 -0
  30. package/dist/runtime/components/ValueIP.d.vue.ts +18 -0
  31. package/dist/runtime/components/ValueIP.vue +28 -0
  32. package/dist/runtime/components/ValueIP.vue.d.ts +18 -0
  33. package/dist/runtime/components/ValueLocation.d.vue.ts +21 -0
  34. package/dist/runtime/components/ValueLocation.vue +20 -0
  35. package/dist/runtime/components/ValueLocation.vue.d.ts +21 -0
  36. package/dist/runtime/components/ValuePrice.d.vue.ts +11 -0
  37. package/dist/runtime/components/ValuePrice.vue +12 -0
  38. package/dist/runtime/components/ValuePrice.vue.d.ts +11 -0
  39. package/dist/runtime/composables/firestore/auth.d.ts +4 -0
  40. package/dist/runtime/composables/firestore/auth.js +46 -0
  41. package/dist/runtime/composables/firestore/index.d.ts +2 -0
  42. package/dist/runtime/composables/firestore/index.js +2 -0
  43. package/dist/runtime/composables/firestore/write.d.ts +21 -0
  44. package/dist/runtime/composables/firestore/write.js +279 -0
  45. package/dist/runtime/composables/index.d.ts +4 -0
  46. package/dist/runtime/composables/index.js +4 -0
  47. package/dist/runtime/composables/store/app.d.ts +82 -0
  48. package/dist/runtime/composables/store/app.js +90 -0
  49. package/dist/runtime/composables/store/instance.d.ts +57 -0
  50. package/dist/runtime/composables/store/instance.js +94 -0
  51. package/dist/runtime/composables/store/session.d.ts +41 -0
  52. package/dist/runtime/composables/store/session.js +89 -0
  53. package/dist/runtime/composables/useAppLogger.d.ts +2 -0
  54. package/dist/runtime/composables/useAppLogger.js +8 -0
  55. package/dist/runtime/composables/useFilesUpload.d.ts +19 -0
  56. package/dist/runtime/composables/useFilesUpload.js +110 -0
  57. package/dist/runtime/composables/usePrice.d.ts +9 -0
  58. package/dist/runtime/composables/usePrice.js +6 -0
  59. package/dist/runtime/composables/useQuery.d.ts +12 -0
  60. package/dist/runtime/composables/useQuery.js +33 -0
  61. package/dist/runtime/composables/utils.d.ts +14 -0
  62. package/dist/runtime/composables/utils.js +65 -0
  63. package/dist/runtime/functions/types/entities/base.d.ts +56 -0
  64. package/dist/runtime/functions/types/entities/base.js +0 -0
  65. package/dist/runtime/functions/types/entities/instance.d.ts +73 -0
  66. package/dist/runtime/functions/types/entities/instance.js +0 -0
  67. package/dist/runtime/functions/types/entities/logs.d.ts +15 -0
  68. package/dist/runtime/functions/types/entities/logs.js +0 -0
  69. package/dist/runtime/functions/types/entities/user.d.ts +13 -0
  70. package/dist/runtime/functions/types/entities/user.js +0 -0
  71. package/dist/runtime/functions/types/index.d.ts +4 -0
  72. package/dist/runtime/functions/types/index.js +4 -0
  73. package/dist/runtime/functions/utils/encrypt.d.ts +24 -0
  74. package/dist/runtime/functions/utils/encrypt.js +17 -0
  75. package/dist/runtime/functions/utils/enums.d.ts +40 -0
  76. package/dist/runtime/functions/utils/enums.js +24 -0
  77. package/dist/runtime/functions/utils/event.d.ts +71 -0
  78. package/dist/runtime/functions/utils/event.js +91 -0
  79. package/dist/runtime/functions/utils/firebase.d.ts +7 -0
  80. package/dist/runtime/functions/utils/firebase.js +21 -0
  81. package/dist/runtime/functions/utils/logger.d.ts +3 -0
  82. package/dist/runtime/functions/utils/logger.js +17 -0
  83. package/dist/runtime/functions/utils/logs.d.ts +10 -0
  84. package/dist/runtime/functions/utils/logs.js +47 -0
  85. package/dist/runtime/functions/utils/price.d.ts +12 -0
  86. package/dist/runtime/functions/utils/price.js +26 -0
  87. package/dist/runtime/functions/utils/queue.d.ts +4 -0
  88. package/dist/runtime/functions/utils/queue.js +11 -0
  89. package/dist/runtime/functions/utils/search.d.ts +15 -0
  90. package/dist/runtime/functions/utils/search.js +38 -0
  91. package/dist/runtime/functions/utils/slugs.d.ts +2 -0
  92. package/dist/runtime/functions/utils/slugs.js +16 -0
  93. package/dist/runtime/plugins/firebase-setup.d.ts +26 -0
  94. package/dist/runtime/plugins/firebase-setup.js +35 -0
  95. package/dist/runtime/plugins/loaded.client.d.ts +2 -0
  96. package/dist/runtime/plugins/loaded.client.js +44 -0
  97. package/dist/runtime/plugins/scrollBehavior.client.d.ts +2 -0
  98. package/dist/runtime/plugins/scrollBehavior.client.js +20 -0
  99. package/dist/runtime/providers/firebase.d.ts +2 -0
  100. package/dist/runtime/providers/firebase.js +7 -0
  101. package/dist/runtime/public/js/file-upload.d.ts +1 -0
  102. package/dist/runtime/public/js/file-upload.js +67 -0
  103. package/dist/runtime/public/sample-loading.png +0 -0
  104. package/dist/runtime/public/sample-missing.png +0 -0
  105. package/dist/runtime/public/sample.png +0 -0
  106. package/dist/runtime/server/api/all-collection-document.get.d.ts +7 -0
  107. package/dist/runtime/server/api/all-collection-document.get.js +56 -0
  108. package/dist/runtime/server/api/all-collection.get.d.ts +8 -0
  109. package/dist/runtime/server/api/all-collection.get.js +67 -0
  110. package/dist/runtime/server/api/media.get.d.ts +8 -0
  111. package/dist/runtime/server/api/media.get.js +114 -0
  112. package/dist/runtime/server/middleware/0.hotlinking.d.ts +5 -0
  113. package/dist/runtime/server/middleware/0.hotlinking.js +28 -0
  114. package/dist/runtime/server/middleware/1.context.d.ts +5 -0
  115. package/dist/runtime/server/middleware/1.context.js +108 -0
  116. package/dist/runtime/server/types/index.d.ts +34 -0
  117. package/dist/runtime/server/types/index.js +0 -0
  118. package/dist/runtime/server/utils/auth.d.ts +10 -0
  119. package/dist/runtime/server/utils/auth.js +31 -0
  120. package/dist/runtime/server/utils/cache.d.ts +21 -0
  121. package/dist/runtime/server/utils/cache.js +20 -0
  122. package/dist/runtime/server/utils/environment.d.ts +45 -0
  123. package/dist/runtime/server/utils/environment.js +50 -0
  124. package/dist/runtime/server/utils/firebase.d.ts +9 -0
  125. package/dist/runtime/server/utils/firebase.js +13 -0
  126. package/dist/runtime/server/utils/firestore.d.ts +27 -0
  127. package/dist/runtime/server/utils/firestore.js +137 -0
  128. package/dist/runtime/server/utils/guards.d.ts +15 -0
  129. package/dist/runtime/server/utils/guards.js +23 -0
  130. package/dist/runtime/server/utils/instance.d.ts +21 -0
  131. package/dist/runtime/server/utils/instance.js +68 -0
  132. package/dist/types.d.mts +7 -0
  133. package/package.json +17 -17
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  Firebase nuxt
2
2
 
3
+ # [1.1.0](https://github.com/xamu-co/firebase-nuxt/compare/v1.0.0...v1.1.0) (2026-01-08)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * include missing distributables ([a455111](https://github.com/xamu-co/firebase-nuxt/commit/a455111cb9500bc5755590cdd45da4b6e46f8ee3))
9
+ * make stable ([38ba0fe](https://github.com/xamu-co/firebase-nuxt/commit/38ba0fea5aa365c9c5354df566d3181a3e716d5c))
10
+ * remove problematic schema ([c53c195](https://github.com/xamu-co/firebase-nuxt/commit/c53c1952d5713e75479d4d32d99645d5fccb9a1f))
11
+
12
+
13
+ ### Features
14
+
15
+ * conditional media handler ([d472288](https://github.com/xamu-co/firebase-nuxt/commit/d4722881de6b4b7238e3bcc3fd31378dd8fb1489))
16
+ * get instance documents & files ([4846801](https://github.com/xamu-co/firebase-nuxt/commit/4846801d6b80fb95fde8475943ef872351ba43ac))
17
+
3
18
  # 1.0.0 (2026-01-08)
4
19
 
5
20
 
package/README.md CHANGED
@@ -4,8 +4,6 @@ Powered by Nuxt.js
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- See [Enviroment variables](#environment-variables)
8
-
9
7
  A firebase service account would be required. You could find a sample on the discord server
10
8
 
11
9
  See [Enviroment variables](#environment-variables)
@@ -42,15 +40,6 @@ Due to an [issue with volar](https://github.com/vuejs/language-tools/issues/5018
42
40
 
43
41
  Firebase requires 2 keys, the private one from recaptcha, and the site key from recaptcha enterprise. The former one is passed from the config file.
44
42
 
45
- It is required to manually authorize [IAM for App Hosting](https://stackoverflow.com/questions/79473624/firebase-app-hosting-unable-to-retrieve-secrets-from-cloud-secret-manager)
46
-
47
- ```bash
48
- # Replace secretName, backendName & userEmail
49
- firebase apphosting:secrets:grantaccess secretName --backend backendName
50
- # Also for emulation
51
- firebase apphosting:secrets:grantaccess secretName --emails userEmail
52
- ```
53
-
54
43
  For app check create the key from Recaptcha v3 console instead of enterprise to avoid issues with legacy keys validation. The debug token allows bypassing the validation on dev environments
55
44
 
56
45
  ### Enviroment variables
@@ -70,9 +59,6 @@ F_CLIENT_EMAIL=""
70
59
  # App check, site key, public
71
60
  RECAPTCHA_ENTERPRISE_SITE_KEY=
72
61
 
73
- # Google fonts
74
- FONTS_API_KEY=
75
-
76
62
  # Project
77
63
  ORIGIN=
78
64
  COUNTRIES_API=
@@ -0,0 +1,50 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+ import { ClientProvide } from '../dist/runtime/plugins/firebase-setup.js';
3
+ import { H3Context } from '../dist/runtime/server/types/index.js';
4
+ import { FirebaseNuxtPublicRuntimeConfig } from '../dist/runtime/server/utils/environment.js';
5
+
6
+ /**
7
+ * Nuxt specific configuration
8
+ */
9
+ interface FirebaseNuxtModuleOptions {
10
+ /** Enable tenants */
11
+ tenants: boolean;
12
+ /** Enable media */
13
+ media: boolean;
14
+ /**
15
+ * Whether the current auth is authorized to read the given instance's collection
16
+ *
17
+ * @server Runs server side only
18
+ */
19
+ readInstanceCollection: (collection: string, context: H3Context) => boolean;
20
+ /**
21
+ * Whether the current auth is authorized to read the given collection
22
+ *
23
+ * @server Runs server side only
24
+ */
25
+ readCollection: (collection: string, context: H3Context) => boolean;
26
+ /**
27
+ * Whether the current auth is a super user
28
+ *
29
+ * @server Runs server side only
30
+ */
31
+ sudo: (context: H3Context) => boolean;
32
+ }
33
+ declare module "@nuxt/schema" {
34
+ interface PublicRuntimeConfig extends FirebaseNuxtPublicRuntimeConfig {
35
+ }
36
+ }
37
+ type Decorate<T extends Record<string, any>> = {
38
+ [K in keyof T as K extends string ? `$${K}` : never]: T[K];
39
+ };
40
+ declare module "#app" {
41
+ interface NuxtApp extends Decorate<ClientProvide> {
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Nuxt module for @open-xamu-co/firebase-nuxt
47
+ */
48
+ declare const _default: _nuxt_schema.NuxtModule<FirebaseNuxtModuleOptions, FirebaseNuxtModuleOptions, false>;
49
+
50
+ export { _default as default };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@open-xamu-co/firebase-nuxt",
3
+ "configKey": "firebaseNuxt",
4
+ "compatibility": {
5
+ "nuxt": "^3.0.0"
6
+ },
7
+ "version": "1.0.0",
8
+ "builder": {
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "3.6.1"
11
+ }
12
+ }
@@ -0,0 +1,137 @@
1
+ import { defineNuxtModule, createResolver, addPlugin, addImportsDir, addComponentsDir, addServerTemplate, addServerHandler } from '@nuxt/kit';
2
+ import { locale } from '../dist/runtime/client/utils/locale.js';
3
+ import { debugNuxt, port, publicRuntimeConfig } from '../dist/runtime/server/utils/environment.js';
4
+
5
+ const module$1 = defineNuxtModule({
6
+ meta: {
7
+ name: "@open-xamu-co/firebase-nuxt",
8
+ configKey: "firebaseNuxt",
9
+ compatibility: { nuxt: "^3.0.0" }
10
+ },
11
+ async setup(moduleOptions, nuxt) {
12
+ const { resolve } = createResolver(import.meta.url);
13
+ const runtimePath = resolve("./runtime");
14
+ nuxt.options.devtools.enabled = debugNuxt;
15
+ nuxt.options.devtools.timeline = { enabled: debugNuxt };
16
+ nuxt.options.experimental.asyncContext = true;
17
+ nuxt.options.experimental.viewTransition = true;
18
+ nuxt.options.nitro.compressPublicAssets = true;
19
+ nuxt.options.vite.optimizeDeps = {
20
+ ...nuxt.options.vite.optimizeDeps,
21
+ exclude: [
22
+ ...nuxt.options.vite.optimizeDeps?.exclude || [],
23
+ // Server imports
24
+ "nitropack/runtime"
25
+ ]
26
+ };
27
+ nuxt.options.vite.resolve = {
28
+ ...nuxt.options.vite.resolve,
29
+ dedupe: [
30
+ ...nuxt.options.vite.resolve?.dedupe || [],
31
+ "firebase",
32
+ "firebase/app",
33
+ "firebase/auth",
34
+ "firebase/app-check",
35
+ "firebase/firestore",
36
+ "firebase/analytics",
37
+ "pinia"
38
+ ]
39
+ };
40
+ if (debugNuxt) {
41
+ nuxt.options.devServer = { ...nuxt.options.devServer, host: "0.0.0.0", port };
42
+ }
43
+ nuxt.options.runtimeConfig.public = {
44
+ ...nuxt.options.runtimeConfig.public,
45
+ ...publicRuntimeConfig,
46
+ tenants: moduleOptions.tenants
47
+ // Globally available
48
+ };
49
+ addPlugin(resolve(runtimePath, "plugins/scrollBehavior.client"));
50
+ addPlugin(resolve(runtimePath, "plugins/firebase-setup"));
51
+ addPlugin(resolve(runtimePath, "plugins/loaded.client"));
52
+ addImportsDir(resolve(runtimePath, "composables"));
53
+ addComponentsDir({ path: resolve(runtimePath, "components") });
54
+ nuxt.hook("nitro:config", (nitroConfig) => {
55
+ nitroConfig.publicAssets ||= [];
56
+ nitroConfig.publicAssets.push({
57
+ dir: resolve(runtimePath, "public"),
58
+ maxAge: 60 * 60 * 24 * 365
59
+ // 1 year
60
+ });
61
+ });
62
+ addServerTemplate({
63
+ filename: "#internal/firebase-nuxt",
64
+ getContents: () => `
65
+ export const readInstanceCollection = ${moduleOptions.readInstanceCollection?.toString() || "() => false"};
66
+ export const readCollection = ${moduleOptions.readCollection?.toString() || "() => false"};
67
+ export const sudo = ${moduleOptions.sudo?.toString() || "() => false"};
68
+ `
69
+ });
70
+ addServerHandler({
71
+ middleware: true,
72
+ handler: resolve(runtimePath, "server/middleware/0.hotlinking")
73
+ });
74
+ addServerHandler({
75
+ middleware: true,
76
+ handler: resolve(runtimePath, "server/middleware/1.context")
77
+ });
78
+ if (moduleOptions.media) {
79
+ addServerHandler({
80
+ method: "get",
81
+ route: "/api/media/[...path]",
82
+ handler: resolve(runtimePath, "server/api/media.get")
83
+ });
84
+ }
85
+ addServerHandler({
86
+ method: "get",
87
+ route: "/api/all/:collectionId",
88
+ handler: resolve(runtimePath, "server/api/all-collection.get")
89
+ });
90
+ addServerHandler({
91
+ method: "get",
92
+ route: "/api/all/:collectionId/:documentId",
93
+ handler: resolve(runtimePath, "server/api/all-collection-document.get")
94
+ });
95
+ addServerHandler({
96
+ method: "get",
97
+ route: "/api/instance/all/:collectionId",
98
+ handler: resolve(runtimePath, "server/api/all-collection.get")
99
+ });
100
+ addServerHandler({
101
+ method: "get",
102
+ route: "/api/instance/all/:collectionId/:documentId",
103
+ handler: resolve(runtimePath, "server/api/all-collection-document.get")
104
+ });
105
+ },
106
+ moduleDependencies() {
107
+ const { resolve } = createResolver(import.meta.url);
108
+ const runtimePath = resolve("./runtime");
109
+ return {
110
+ "nuxt-csurf": {
111
+ version: ">=1.6.5"
112
+ },
113
+ "@open-xamu-co/ui-nuxt": {
114
+ version: ">=4.0.0-next.4",
115
+ defaults: {
116
+ locale,
117
+ lang: "es",
118
+ country: "CO",
119
+ image: {
120
+ provider: "firebase",
121
+ domains: ["firebasestorage.googleapis.com"],
122
+ providers: {
123
+ firebase: { provider: resolve(runtimePath, "providers/firebase") }
124
+ }
125
+ },
126
+ imageHosts: ["lh3.googleusercontent.com"],
127
+ imagePlaceholder: "/sample-missing.png"
128
+ }
129
+ },
130
+ "@pinia/nuxt": {
131
+ version: ">=0.11.0"
132
+ }
133
+ };
134
+ }
135
+ });
136
+
137
+ export { module$1 as default };
@@ -0,0 +1,29 @@
1
+ import type { DocumentReference, Timestamp } from "firebase/firestore";
2
+ import type { GetSharedRef } from "./user.js";
3
+ import type { SharedDocument } from "./instance.js";
4
+ export interface FirebaseDocument {
5
+ /** @automated Document path */
6
+ id?: string;
7
+ /** @automated Creation date */
8
+ createdAt?: string | Date;
9
+ /** @automated Last update date */
10
+ updatedAt?: string | Date;
11
+ /**
12
+ * Lock document & prevent deletion
13
+ * A boolean or an array of reference paths locking the document
14
+ *
15
+ * @automated
16
+ */
17
+ lock?: boolean | string[];
18
+ }
19
+ export type FromData<Data extends Record<string, any>> = {
20
+ [K in keyof Data as K extends `${string}Ref` | `${string}Refs` ? never : K]: K extends `${string}At` ? string | Date | undefined : Data[K];
21
+ } & {
22
+ id?: string;
23
+ lock?: boolean | string[];
24
+ };
25
+ export type GetRef<T extends SharedDocument, O extends keyof T = never> = GetSharedRef<T, O> & {
26
+ createdAt?: Timestamp;
27
+ updatedAt?: Timestamp;
28
+ instanceRef?: DocumentReference;
29
+ };
File without changes
@@ -0,0 +1,42 @@
1
+ import type { DocumentReference, FieldValue } from "firebase/firestore";
2
+ import type { InstanceMemberData, InstanceLogData, InstanceData, RootData } from "../../../functions/types/index.js";
3
+ import type { FirebaseDocument, FromData, GetRef } from "./base.js";
4
+ import type { GetSharedRef, User, UserRef } from "./user.js";
5
+ /**
6
+ * Document can be modified by any user
7
+ *
8
+ * This data is used to keep track of the changes
9
+ */
10
+ export interface SharedDocument extends FirebaseDocument {
11
+ createdBy?: FirebaseDocument;
12
+ updatedBy?: FirebaseDocument;
13
+ deletedBy?: FirebaseDocument;
14
+ }
15
+ /** @output Root instance*/
16
+ export interface Root extends SharedDocument, FromData<RootData> {
17
+ }
18
+ /** @input Omit automation */
19
+ export interface RootRef extends GetSharedRef<Root> {
20
+ }
21
+ /** @output App instance */
22
+ export interface Instance extends SharedDocument, FromData<InstanceData> {
23
+ }
24
+ /** @input Omit automation */
25
+ export interface InstanceRef extends GetSharedRef<Instance> {
26
+ }
27
+ /** @output Firebase log */
28
+ export interface InstanceLog extends SharedDocument, FromData<InstanceLogData> {
29
+ }
30
+ /** @input Omit automation */
31
+ export interface InstanceLogRef extends GetSharedRef<InstanceLog> {
32
+ }
33
+ /** @output Instance member */
34
+ export interface InstanceMember extends SharedDocument, FromData<InstanceMemberData> {
35
+ user?: User;
36
+ rootMember?: InstanceMember;
37
+ }
38
+ /** @input Omit automation */
39
+ export interface InstanceMemberRef extends GetRef<InstanceMember> {
40
+ userRef?: DocumentReference<User, UserRef> | FieldValue;
41
+ rootMemberRef?: DocumentReference<InstanceMember, InstanceMemberRef> | FieldValue;
42
+ }
File without changes
@@ -0,0 +1,9 @@
1
+ import type { LogData } from "../../../functions/types/index.js";
2
+ import type { FromData } from "./base.js";
3
+ import type { GetSharedRef } from "./user.js";
4
+ /** @output Log */
5
+ export interface Log extends FromData<LogData> {
6
+ }
7
+ /** @input Omit automation */
8
+ export interface LogRef extends GetSharedRef<Log> {
9
+ }
File without changes
@@ -0,0 +1,27 @@
1
+ import type { DocumentReference, FieldValue } from "firebase/firestore";
2
+ import type { UserData } from "../../../functions/types/index.js";
3
+ import type { FromData } from "./base.js";
4
+ import type { Instance, SharedDocument } from "./instance.js";
5
+ /**
6
+ * Remove FirebaseDocument properties to make valid Ref
7
+ *
8
+ * Ref are used to create and modify firebase document
9
+ * Removed properties are not required or are part of automation
10
+ */
11
+ export type GetSharedRef<T extends SharedDocument, O extends keyof T = never> = {
12
+ [K in keyof FromData<Omit<T, "id" | O>> as K extends `${string}At` ? never : K]: FromData<Omit<T, "id" | O>>[K];
13
+ } & {
14
+ createdByRef?: DocumentReference | FieldValue;
15
+ updatedByRef?: DocumentReference | FieldValue;
16
+ deletedByRef?: DocumentReference | FieldValue;
17
+ };
18
+ /**
19
+ * Firebase user
20
+ */
21
+ export interface User extends SharedDocument, FromData<UserData> {
22
+ instances?: Instance[];
23
+ }
24
+ /** This one goes to the database */
25
+ export interface UserRef extends GetSharedRef<User, "instances"> {
26
+ instancesRefs?: DocumentReference[] | FieldValue;
27
+ }
File without changes
@@ -0,0 +1,55 @@
1
+ import type { iPagination, tLogger } from "@open-xamu-co/ui-common-types";
2
+ import type { FirebaseDocument, FromData } from "./entities/base.js";
3
+ export interface PseudoNode extends Record<string, any> {
4
+ [key: `${string}Ref`]: Record<string, any>;
5
+ [key: `${string}Refs`]: Record<string, any>[];
6
+ }
7
+ export interface PseudoDocumentSnapshot<T extends PseudoNode, R extends FirebaseDocument = FromData<T>> extends Record<string, any> {
8
+ data(): T | undefined;
9
+ exists: boolean | (() => this is PseudoDocumentSnapshot<T, R>);
10
+ }
11
+ export interface PseudoDocumentReference<T extends PseudoNode, R extends FirebaseDocument = FromData<T>> extends Record<string, any> {
12
+ get: () => Promise<PseudoDocumentSnapshot<T, R>>;
13
+ converter: any;
14
+ type: any;
15
+ firestore: any;
16
+ id: any;
17
+ parent: any;
18
+ path: any;
19
+ withConverter: any;
20
+ toJSON: any;
21
+ }
22
+ export interface iSnapshotConfig {
23
+ /**
24
+ * Refs level
25
+ *
26
+ * @default 0 - All refs will be omited
27
+ */
28
+ level?: number;
29
+ /**
30
+ * Omit these properties
31
+ *
32
+ * to omit "productRef"
33
+ * @example { omit: [ "product"]}
34
+ */
35
+ omit?: string[];
36
+ logger?: tLogger;
37
+ }
38
+ export interface iUseEdges extends iPagination, iSnapshotConfig {
39
+ /**
40
+ * Get these specific documents from collection.
41
+ *
42
+ * @example "nodeUid" and "collectionId/nodeUid" are valid id structures
43
+ *
44
+ * According to firebase docs, queries are limited to 30 disjuntion operations
45
+ * @see https://firebase.google.com/docs/firestore/query-data/queries#limits_on_or_queries
46
+ */
47
+ include?: boolean | string[];
48
+ }
49
+ export interface iUsePage extends iUseEdges {
50
+ /**
51
+ * Bypass limitations
52
+ */
53
+ visible?: boolean;
54
+ page?: boolean;
55
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ export * from "./entities/base.js";
2
+ export * from "./entities/user.js";
3
+ export * from "./entities/instance.js";
4
+ export * from "./entities/logs.js";
5
+ export * from "./firestore.js";
@@ -0,0 +1,5 @@
1
+ export * from "./entities/base.js";
2
+ export * from "./entities/user.js";
3
+ export * from "./entities/instance.js";
4
+ export * from "./entities/logs.js";
5
+ export * from "./firestore.js";
@@ -0,0 +1,185 @@
1
+ export declare const locale: {
2
+ refresh: string;
3
+ table_update: string;
4
+ yes: string;
5
+ no: string;
6
+ increase: string;
7
+ decrease: string;
8
+ could_not_get_data: string;
9
+ nothing_to_show: string;
10
+ loading: string;
11
+ close: string;
12
+ ok: string;
13
+ see_value: string;
14
+ see_name: string;
15
+ add: string;
16
+ clear: string;
17
+ required_verification: string;
18
+ previous: string;
19
+ next: string;
20
+ send: string;
21
+ delete: string;
22
+ delete_all: string;
23
+ pick: string;
24
+ render_error: string;
25
+ swal: {
26
+ cancel: string;
27
+ continue: string;
28
+ error: string;
29
+ error_message: string;
30
+ connection_error: string;
31
+ connection_error_message: string;
32
+ connection_error_confirm: string;
33
+ incomplete_data: string;
34
+ incomplete_data_message: string;
35
+ dont_close_window: string;
36
+ } & {
37
+ file_limit: string;
38
+ file_limit_text: string;
39
+ file_unsupported_format: string;
40
+ file_unsupported_format_text: string;
41
+ file_wrong_format: string;
42
+ file_wrong_format_text: string;
43
+ file_too_big: string;
44
+ file_too_big_text: string;
45
+ file_unknown_error: string;
46
+ file_unknown_error_text: string;
47
+ } & {
48
+ modal_unauthorized: string;
49
+ modal_unauthorized_text: string;
50
+ } & {
51
+ table_delete_node_title: string;
52
+ table_delete_node_disclaimer: string;
53
+ table_deleted: string;
54
+ table_deleted_text: string;
55
+ table_delete_nodes_title: string;
56
+ table_delete_nodes_disclaimer: string;
57
+ table_possibly_not_deleted: string;
58
+ table_possibly_not_deleted_text: string;
59
+ table_updated: string;
60
+ table_updated_text: string;
61
+ table_possibly_not_updated: string;
62
+ table_possibly_not_updated_text: string;
63
+ table_created: string;
64
+ table_created_text: string;
65
+ table_possibly_not_created: string;
66
+ table_possibly_not_created_text: string;
67
+ table_cloned: string;
68
+ table_cloned_text: string;
69
+ table_possibly_not_cloned: string;
70
+ table_possibly_not_cloned_text: string;
71
+ };
72
+ select_selected: string;
73
+ select_placeholder: string;
74
+ select_restablish_field: string;
75
+ select_filter_options: string;
76
+ file_one_of_amount: string;
77
+ file_delete_files: string;
78
+ file_thumb: string;
79
+ file_choose_file: string;
80
+ file_or_drop_files_here: string;
81
+ file_max_file_size_mb: string;
82
+ file_drop_files_here: string;
83
+ file_completed: string;
84
+ file_loading_files: string;
85
+ modal_taking_too_long: string;
86
+ form_required_options: string;
87
+ form_requires_n_values: string;
88
+ form_loading_countries: string;
89
+ form_awaiting_countries: string;
90
+ form_country: string;
91
+ form_state: string;
92
+ form_city: string;
93
+ form_desired_password: string;
94
+ form_confirm_password: string;
95
+ form_check_password: string;
96
+ form_password: string;
97
+ form_email: string;
98
+ form_phone_line: string;
99
+ form_cellphone: string;
100
+ form_id_number: string;
101
+ form_complete_the_field: string;
102
+ form_location: string;
103
+ form_invalid_field: string;
104
+ form_required_field: string;
105
+ form_use_valid_email: string;
106
+ form_use_valid_phone: string;
107
+ form_use_valid_cellphone: string;
108
+ form_unmatching_passwords: string;
109
+ form_invalid_data: string;
110
+ form_no_values: string;
111
+ form_new_value: string;
112
+ table_see_values: string;
113
+ table_see_name: string;
114
+ table_hide_name: string;
115
+ table_create_new: string;
116
+ table_create_new_name: string;
117
+ table_quantity: string;
118
+ table_modify: string;
119
+ table_select: string;
120
+ table_select_all: string;
121
+ table_update_name: string;
122
+ table_delete: string;
123
+ table_delete_name: string;
124
+ table_showing_name: string;
125
+ table_sort_by_name: string;
126
+ table_duplicate: string;
127
+ table_options: string;
128
+ table_open_url: string;
129
+ table_hide_all: string;
130
+ table_show_all: string;
131
+ pagination_items: string;
132
+ pagination_pages: string;
133
+ pagination_page: string;
134
+ address: string;
135
+ at: string;
136
+ body: string;
137
+ categories: string;
138
+ category: string;
139
+ cellphone: string;
140
+ description: string;
141
+ document: string;
142
+ due_at: string;
143
+ highlight: string;
144
+ image: string;
145
+ images: string;
146
+ is_anonymous: string;
147
+ keywords: string;
148
+ location_city: string;
149
+ location_country: string;
150
+ location_state: string;
151
+ location: string;
152
+ lock: string;
153
+ main_variant: string;
154
+ main: string;
155
+ message: string;
156
+ metadata: string;
157
+ month: string;
158
+ name: string;
159
+ observations: string;
160
+ old_observations: string;
161
+ paid_at: string;
162
+ pending_quantity: string;
163
+ photo_url: string;
164
+ possible_variants: string;
165
+ price: string;
166
+ product: string;
167
+ quantity: string;
168
+ reference: string;
169
+ role: string;
170
+ sales: string;
171
+ slug: string;
172
+ sold_quantity: string;
173
+ tracking_code: string;
174
+ type: string;
175
+ uid: string;
176
+ value: string;
177
+ values: string;
178
+ variants: string;
179
+ visible_products: string;
180
+ with_debug_key: string;
181
+ created_at: string;
182
+ created_by: string;
183
+ updated_at: string;
184
+ updated_by: string;
185
+ };