@jskit-ai/auth-provider-supabase-core 0.1.31 → 0.1.33
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/package.descriptor.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default Object.freeze({
|
|
2
2
|
"packageVersion": 1,
|
|
3
3
|
"packageId": "@jskit-ai/auth-provider-supabase-core",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.33",
|
|
5
5
|
"kind": "runtime",
|
|
6
6
|
"options": {
|
|
7
7
|
"auth-supabase-url": {
|
|
@@ -83,8 +83,8 @@ export default Object.freeze({
|
|
|
83
83
|
"mutations": {
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"runtime": {
|
|
86
|
-
"@jskit-ai/auth-core": "0.1.
|
|
87
|
-
"@jskit-ai/kernel": "0.1.
|
|
86
|
+
"@jskit-ai/auth-core": "0.1.33",
|
|
87
|
+
"@jskit-ai/kernel": "0.1.34",
|
|
88
88
|
"dotenv": "^16.4.5",
|
|
89
89
|
"@supabase/supabase-js": "^2.57.4",
|
|
90
90
|
"jose": "^6.1.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/auth-provider-supabase-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test"
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"./client": "./src/client/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@jskit-ai/auth-core": "0.1.
|
|
16
|
-
"@jskit-ai/kernel": "0.1.
|
|
15
|
+
"@jskit-ai/auth-core": "0.1.33",
|
|
16
|
+
"@jskit-ai/kernel": "0.1.34",
|
|
17
17
|
"jose": "^6.1.0",
|
|
18
18
|
"@supabase/supabase-js": "^2.57.4"
|
|
19
19
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizeRecordId } from "@jskit-ai/kernel/shared/support/normalize";
|
|
2
2
|
|
|
3
3
|
function createAuthSessionEventsService() {
|
|
4
4
|
async function notifySessionChanged(options = {}) {
|
|
5
|
-
const actorId =
|
|
5
|
+
const actorId = normalizeRecordId(options?.context?.actor?.id, { fallback: null });
|
|
6
6
|
if (!actorId) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
buildOAuthMethodId
|
|
7
7
|
} from "@jskit-ai/auth-core/shared/authMethods";
|
|
8
8
|
import { normalizeEmail } from "@jskit-ai/auth-core/server/utils";
|
|
9
|
+
import { normalizeRecordId } from "@jskit-ai/kernel/shared/support/normalize";
|
|
9
10
|
import { validators } from "@jskit-ai/auth-core/server/validators";
|
|
10
11
|
import {
|
|
11
12
|
isTransientAuthMessage,
|
|
@@ -387,7 +388,7 @@ function createService(options) {
|
|
|
387
388
|
}
|
|
388
389
|
|
|
389
390
|
function requireSynchronizedProfile(profile) {
|
|
390
|
-
if (profile &&
|
|
391
|
+
if (profile && normalizeRecordId(profile.id, { fallback: null }) && String(profile.displayName || "").trim()) {
|
|
391
392
|
return profile;
|
|
392
393
|
}
|
|
393
394
|
|
|
@@ -48,7 +48,7 @@ function createEmailConflictError() {
|
|
|
48
48
|
function createStandaloneProfileSyncService() {
|
|
49
49
|
const profilesByIdentityKey = new Map();
|
|
50
50
|
const identityKeyByEmail = new Map();
|
|
51
|
-
let nextId =
|
|
51
|
+
let nextId = 1n;
|
|
52
52
|
|
|
53
53
|
async function findByIdentity(identityLike) {
|
|
54
54
|
const identity = normalizeIdentity(identityLike);
|
|
@@ -65,8 +65,13 @@ function createStandaloneProfileSyncService() {
|
|
|
65
65
|
throw createEmailConflictError();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
const nextIdValue = existing?.id ? String(existing.id) : String(nextId);
|
|
69
|
+
if (!existing?.id) {
|
|
70
|
+
nextId += 1n;
|
|
71
|
+
}
|
|
72
|
+
|
|
68
73
|
const next = {
|
|
69
|
-
id:
|
|
74
|
+
id: nextIdValue,
|
|
70
75
|
authProvider: normalizedProfile.authProvider,
|
|
71
76
|
authProviderUserSid: normalizedProfile.authProviderUserSid,
|
|
72
77
|
email: normalizedProfile.email,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolveAllowedOriginsFromSurfaceDefinitions } from "@jskit-ai/kernel/shared/support/returnToPath";
|
|
2
2
|
import { withActionDefaults } from "@jskit-ai/kernel/shared/actions";
|
|
3
|
+
import { normalizeRecordId } from "@jskit-ai/kernel/shared/support/normalize";
|
|
3
4
|
import { createService } from "../lib/service.js";
|
|
4
5
|
import { createStandaloneProfileSyncService } from "../lib/standaloneProfileSyncService.js";
|
|
5
6
|
import { createAuthSessionEventsService } from "../lib/authSessionEventsService.js";
|
|
@@ -91,15 +92,18 @@ function createInMemoryUserSettingsRepository() {
|
|
|
91
92
|
const settingsByUserId = new Map();
|
|
92
93
|
|
|
93
94
|
function ensure(userId) {
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
const normalizedUserId = normalizeRecordId(userId, { fallback: null });
|
|
96
|
+
if (!normalizedUserId) {
|
|
97
|
+
throw new TypeError("User settings require a valid user id.");
|
|
98
|
+
}
|
|
99
|
+
if (!settingsByUserId.has(normalizedUserId)) {
|
|
100
|
+
settingsByUserId.set(normalizedUserId, {
|
|
101
|
+
userId: normalizedUserId,
|
|
98
102
|
passwordSignInEnabled: true,
|
|
99
103
|
passwordSetupRequired: false
|
|
100
104
|
});
|
|
101
105
|
}
|
|
102
|
-
return settingsByUserId.get(
|
|
106
|
+
return settingsByUserId.get(normalizedUserId);
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
return Object.freeze({
|