File tree Expand file tree Collapse file tree 6 files changed +105
-4
lines changed
Expand file tree Collapse file tree 6 files changed +105
-4
lines changed Original file line number Diff line number Diff line change 11import { defineBuildConfig } from 'unbuild'
22
33export default defineBuildConfig ( {
4+ entries : [
5+ {
6+ input : './src/index' ,
7+ name : 'index' ,
8+ } ,
9+ {
10+ input : './src/server/index' ,
11+ name : 'server/index' ,
12+ } ,
13+ ] ,
414 declaration : true ,
515 externals : [
616 'firebase' ,
17+ 'firebase/auth' ,
18+ 'firebase/app-check' ,
719 'firebase/firestore' ,
820 'firebase/database' ,
21+ 'firebase/storage' ,
922 '@firebase/firestore-types' ,
1023 '@firebase/database-types' ,
24+ 'firebase-admin' ,
1125 ] ,
26+
27+ rollup : {
28+ emitCJS : true ,
29+ } ,
30+
31+ // hooks: {
32+ // 'rollup:options': (ctx, options) => {
33+ // if (!Array.isArray(options.output)) {
34+ // options.output = options.output ? [options.output] : []
35+ // }
36+ // options.output.push({
37+ // dir: ctx.options.outDir,
38+ // format: 'cjs',
39+ // entryFileNames: '[name].cjs',
40+ // exports: 'auto',
41+ // externalLiveBindings: false,
42+ // freeze: false,
43+ // })
44+ // },
45+ // },
1246} )
Original file line number Diff line number Diff line change 1010 "." : {
1111 "import" : " ./dist/index.mjs" ,
1212 "require" : " ./dist/index.cjs"
13+ },
14+ "./server" : {
15+ "import" : " ./dist/server/index.mjs" ,
16+ "require" : " ./dist/server/index.cjs"
1317 }
1418 },
1519 "main" : " ./dist/index.cjs" ,
7680 "enquirer" : " ^2.3.6" ,
7781 "execa" : " ^6.1.0" ,
7882 "firebase" : " ^9.14.0" ,
83+ "firebase-admin" : " ^11.3.0" ,
7984 "focus-visible" : " ^5.2.0" ,
8085 "happy-dom" : " ^7.7.0" ,
8186 "lint-staged" : " ^13.0.4" ,
Original file line number Diff line number Diff line change 4343 "@nuxtjs/eslint-config-typescript" : " ^12.0.0" ,
4444 "eslint" : " ^8.28.0" ,
4545 "firebase" : " ^9.14.0" ,
46+ "firebase-admin" : " ^11.3.0" ,
4647 "nuxt" : " ^3.0.0" ,
4748 "vuefire" : " workspace:*"
4849 }
Original file line number Diff line number Diff line change 1+ import type { app } from 'firebase-admin'
2+ import { CustomProvider , initializeAppCheck } from 'firebase/app-check'
3+
4+ /**
5+ * Adds AppCheck using the Firebase Admin SDK. This is necessary on the Server if you have configured AppCheck on the
6+ * client.
7+ *
8+ * @param adminApp - firebase-admin app
9+ * @param appId - appId option passed to firebase/app initializeApp()
10+ * @param param2 options
11+ */
12+ export function VueFireAppCheckServer (
13+ adminApp : app . App ,
14+ appId : string ,
15+ {
16+ // default to 1 week
17+ ttlMillis = 604_800_000 ,
18+ } : {
19+ ttlMillis ?: number
20+ } = { }
21+ ) {
22+ initializeAppCheck ( undefined , {
23+ provider : new CustomProvider ( {
24+ getToken : ( ) =>
25+ adminApp
26+ . appCheck ( )
27+ . createToken ( appId , { ttlMillis } )
28+ . then ( ( { token, ttlMillis : expireTimeMillis } ) => ( {
29+ token,
30+ expireTimeMillis,
31+ } ) ) ,
32+ } ) ,
33+ isTokenAutoRefreshEnabled : false ,
34+ } )
35+ }
Original file line number Diff line number Diff line change 1+ export { VueFireAppCheckServer } from './app-check'
You can’t perform that action at this time.
0 commit comments