@cedarjs/auth-firebase-web 9.0.0-canary.1784 → 9.0.0-canary.3124

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":"firebase.d.ts","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAiB,IAAI,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,qBAAqB,MAAM,eAAe,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,KAAK,YAAY,GAAG,OAAO,qBAAqB,CAAA;AAOhD,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,aAAa,GACb,eAAe,GACf,WAAW,CAAA;AAEf,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAA;AAC3C,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAA;AAC/C,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAA;AAE3C,UAAU,OAAO;IACf,UAAU,CAAC,EACP,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,aAAa,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAuCD,wBAAgB,UAAU,CACxB,cAAc,EAAE,cAAc,EAC9B,mBAAmB,CAAC,EAAE;IACpB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3C,UAAU,CAAC,EAAE,CACX,WAAW,EAAE,WA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AC,CAAA;IAC3C,UAAU,CAAC,EAAE,CACX,WAAW,EAAE,WAAW,GAAG,IAAI,KAC5B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAA;CAClD;;;;EAKF;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAA;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/auth-firebase-web",
3
- "version": "9.0.0-canary.1784+baa47810a",
3
+ "version": "9.0.0-canary.3124",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
@@ -10,63 +10,55 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
- "import": {
13
+ "default": {
14
14
  "types": "./dist/index.d.ts",
15
15
  "default": "./dist/index.js"
16
- },
17
- "default": {
18
- "types": "./dist/cjs/index.d.ts",
19
- "default": "./dist/cjs/index.js"
20
16
  }
21
17
  },
22
18
  "./dist/firebase": {
23
- "import": {
19
+ "default": {
24
20
  "types": "./dist/firebase.d.ts",
25
21
  "default": "./dist/firebase.js"
26
- },
27
- "default": {
28
- "types": "./dist/cjs/firebase.d.ts",
29
- "default": "./dist/cjs/firebase.js"
30
22
  }
31
23
  }
32
24
  },
33
- "main": "./dist/cjs/index.js",
34
- "module": "./dist/index.js",
25
+ "main": "./dist/index.js",
35
26
  "types": "./dist/index.d.ts",
36
27
  "files": [
37
28
  "dist"
38
29
  ],
39
30
  "scripts": {
40
- "build": "tsx ./build.ts",
31
+ "build": "node ./build.ts",
41
32
  "build:pack": "yarn pack -o cedarjs-auth-firebase-web.tgz",
42
33
  "build:types": "tsc --build --verbose ./tsconfig.build.json",
43
- "build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
44
34
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
45
- "check:attw": "yarn rw-fwtools-attw",
35
+ "check:attw": "yarn cedar-fwtools-attw",
46
36
  "check:package": "concurrently npm:check:attw yarn:publint",
47
37
  "prepublishOnly": "NODE_ENV=production yarn build",
48
38
  "test": "vitest run",
49
39
  "test:watch": "vitest watch"
50
40
  },
51
41
  "dependencies": {
52
- "@cedarjs/auth": "9.0.0-canary.1784"
42
+ "@cedarjs/auth": "9.0.0-canary.3124"
53
43
  },
54
44
  "devDependencies": {
55
- "@cedarjs/framework-tools": "9.0.0-canary.1784",
56
- "@types/react": "^18.2.55",
57
- "concurrently": "9.2.1",
45
+ "@cedarjs/framework-tools": "9.0.0-canary.3124",
46
+ "@types/react": "^19.2.0",
47
+ "concurrently": "9.2.4",
58
48
  "firebase": "10.14.1",
59
- "publint": "0.3.17",
60
- "react": "19.2.3",
61
- "tsx": "4.21.0",
49
+ "publint": "0.3.24",
50
+ "react": "19.2.8",
62
51
  "typescript": "5.9.3",
63
- "vitest": "3.2.4"
52
+ "vitest": "4.1.11"
64
53
  },
65
54
  "peerDependencies": {
66
55
  "firebase": "10.14.1"
67
56
  },
57
+ "engines": {
58
+ "node": ">=24"
59
+ },
68
60
  "publishConfig": {
69
61
  "access": "public"
70
62
  },
71
- "gitHead": "baa47810a7defb73de27fdf513b815d679509b5e"
63
+ "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
72
64
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Cedar
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,32 +0,0 @@
1
- import type { FirebaseApp } from 'firebase/app';
2
- import type { CustomParameters, User } from 'firebase/auth';
3
- import type FirebaseAuthNamespace from 'firebase/auth';
4
- import type { CurrentUser } from '@cedarjs/auth';
5
- type FirebaseAuth = typeof FirebaseAuthNamespace;
6
- export type oAuthProvider = 'google.com' | 'facebook.com' | 'github.com' | 'twitter.com' | 'microsoft.com' | 'apple.com';
7
- export type anonymousProvider = 'anonymous';
8
- export type customTokenProvider = 'customToken';
9
- export type emailLinkProvider = 'emailLink';
10
- interface Options {
11
- providerId?: anonymousProvider | customTokenProvider | emailLinkProvider | oAuthProvider;
12
- email?: string;
13
- emailLink?: string;
14
- customToken?: string;
15
- password?: string;
16
- scopes?: string[];
17
- customParameters?: CustomParameters;
18
- }
19
- export declare function createAuth(firebaseClient: FirebaseClient, customProviderHooks?: {
20
- useCurrentUser?: () => Promise<CurrentUser>;
21
- useHasRole?: (currentUser: CurrentUser | null) => (rolesToCheck: string | string[]) => boolean;
22
- }): {
23
- AuthContext: import("react").Context<import("@cedarjs/auth").AuthContextInterface<User, "google.com" | "facebook.com" | "github.com" | "twitter.com" | "microsoft.com" | "apple.com" | Options, FirebaseAuthNamespace.UserCredential | undefined, unknown, void, "google.com" | "facebook.com" | "github.com" | "twitter.com" | "microsoft.com" | "apple.com" | Options, FirebaseAuthNamespace.UserCredential | undefined, unknown, unknown, unknown, unknown, FirebaseAuthNamespace.Auth> | undefined>;
24
- AuthProvider: ({ children }: import("@cedarjs/auth").AuthProviderProps) => import("react").JSX.Element;
25
- useAuth: () => import("@cedarjs/auth").AuthContextInterface<User, "google.com" | "facebook.com" | "github.com" | "twitter.com" | "microsoft.com" | "apple.com" | Options, FirebaseAuthNamespace.UserCredential | undefined, unknown, void, "google.com" | "facebook.com" | "github.com" | "twitter.com" | "microsoft.com" | "apple.com" | Options, FirebaseAuthNamespace.UserCredential | undefined, unknown, unknown, unknown, unknown, FirebaseAuthNamespace.Auth>;
26
- };
27
- export interface FirebaseClient {
28
- firebaseAuth: FirebaseAuth;
29
- firebaseApp?: FirebaseApp;
30
- }
31
- export {};
32
- //# sourceMappingURL=firebase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebase.d.ts","sourceRoot":"","sources":["../../src/firebase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAiB,IAAI,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,qBAAqB,MAAM,eAAe,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,KAAK,YAAY,GAAG,OAAO,qBAAqB,CAAA;AAOhD,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,aAAa,GACb,eAAe,GACf,WAAW,CAAA;AAEf,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAA;AAC3C,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAA;AAC/C,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAA;AAE3C,UAAU,OAAO;IACf,UAAU,CAAC,EACP,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,aAAa,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAuCD,wBAAgB,UAAU,CACxB,cAAc,EAAE,cAAc,EAC9B,mBAAmB,CAAC,EAAE;IACpB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3C,UAAU,CAAC,EAAE,CACX,WAAW,EAAE,WAAW,GAAG,IAAI,KAC5B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAA;CAClD;;;;EAKF;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAA;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B"}
@@ -1,131 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var firebase_exports = {};
20
- __export(firebase_exports, {
21
- createAuth: () => createAuth
22
- });
23
- module.exports = __toCommonJS(firebase_exports);
24
- var import_auth = require("@cedarjs/auth");
25
- const hasPasswordCredentials = (options) => {
26
- return options.email !== void 0 && options.password !== void 0;
27
- };
28
- const isEmailLinkOptions = (options) => {
29
- return options.providerId === "emailLink" && options.email !== void 0 && options.emailLink !== void 0;
30
- };
31
- const applyProviderOptions = (provider, options) => {
32
- if (options.customParameters) {
33
- provider.setCustomParameters(options.customParameters);
34
- }
35
- if (options.scopes) {
36
- options.scopes.forEach((scope) => provider.addScope(scope));
37
- }
38
- return provider;
39
- };
40
- function createAuth(firebaseClient, customProviderHooks) {
41
- const authImplementation = createAuthImplementation(firebaseClient);
42
- return (0, import_auth.createAuthentication)(authImplementation, customProviderHooks);
43
- }
44
- function createAuthImplementation({
45
- firebaseAuth,
46
- firebaseApp
47
- }) {
48
- const auth = firebaseAuth.getAuth(firebaseApp);
49
- function getProvider(providerId) {
50
- return new firebaseAuth.OAuthProvider(providerId);
51
- }
52
- const loginWithEmailLink = ({ email, emailLink }) => {
53
- if (firebaseAuth.isSignInWithEmailLink(auth, emailLink)) {
54
- return firebaseAuth.signInWithEmailLink(auth, email, emailLink);
55
- }
56
- return void 0;
57
- };
58
- return {
59
- type: "firebase",
60
- // TODO: Should we change this to { firebaseAuth, firebaseApp } to match
61
- // what's created in the user's RW App?
62
- client: auth,
63
- restoreAuthState: () => {
64
- return new Promise((resolve, reject) => {
65
- const unsubscribe = auth.onAuthStateChanged((user) => {
66
- unsubscribe();
67
- resolve(user);
68
- }, reject);
69
- });
70
- },
71
- login: async (options = { providerId: "google.com" }) => {
72
- if (typeof options === "string") {
73
- options = { providerId: options };
74
- }
75
- if (hasPasswordCredentials(options)) {
76
- return firebaseAuth.signInWithEmailAndPassword(
77
- auth,
78
- options.email,
79
- options.password
80
- );
81
- }
82
- if (isEmailLinkOptions(options)) {
83
- return loginWithEmailLink(options);
84
- }
85
- if (options.providerId === "anonymous") {
86
- return firebaseAuth.signInAnonymously(auth);
87
- }
88
- if (options.providerId === "customToken" && options.customToken) {
89
- return firebaseAuth.signInWithCustomToken(auth, options.customToken);
90
- }
91
- const provider = getProvider(options.providerId || "google.com");
92
- const providerWithOptions = applyProviderOptions(provider, options);
93
- return firebaseAuth.signInWithPopup(auth, providerWithOptions);
94
- },
95
- logout: () => auth.signOut(),
96
- signup: async (options = { providerId: "google.com" }) => {
97
- if (typeof options === "string") {
98
- options = { providerId: options };
99
- }
100
- if (hasPasswordCredentials(options)) {
101
- return firebaseAuth.createUserWithEmailAndPassword(
102
- auth,
103
- options.email,
104
- options.password
105
- );
106
- }
107
- if (isEmailLinkOptions(options)) {
108
- return loginWithEmailLink(options);
109
- }
110
- if (options.providerId === "anonymous") {
111
- return firebaseAuth.signInAnonymously(auth);
112
- }
113
- if (options.providerId === "customToken" && options.customToken) {
114
- return firebaseAuth.signInWithCustomToken(auth, options.customToken);
115
- }
116
- const provider = getProvider(options.providerId || "google.com");
117
- const providerWithOptions = applyProviderOptions(provider, options);
118
- return firebaseAuth.signInWithPopup(auth, providerWithOptions);
119
- },
120
- getToken: async () => {
121
- return auth.currentUser ? auth.currentUser.getIdToken() : null;
122
- },
123
- getUserMetadata: async () => {
124
- return auth.currentUser;
125
- }
126
- };
127
- }
128
- // Annotate the CommonJS export names for ESM import in node:
129
- 0 && (module.exports = {
130
- createAuth
131
- });
@@ -1,2 +0,0 @@
1
- export { createAuth } from './firebase.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
package/dist/cjs/index.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var src_exports = {};
20
- __export(src_exports, {
21
- createAuth: () => import_firebase.createAuth
22
- });
23
- module.exports = __toCommonJS(src_exports);
24
- var import_firebase = require("./firebase.js");
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {
27
- createAuth
28
- });
@@ -1 +0,0 @@
1
- {"type":"commonjs"}