@owlmeans/server-auth-identity 0.1.14 → 0.1.16-rc.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.
- package/agent-meta/instructions/server-auth-identity.instructions.md +5 -3
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-auth-identity/SKILL.md +10 -3
- package/build/resource.d.ts.map +1 -1
- package/build/resource.js +6 -0
- package/build/resource.js.map +1 -1
- package/package.json +8 -8
- package/src/resource.ts +6 -0
|
@@ -7,7 +7,7 @@ applyTo: "**/context.ts, **/services/**/*.ts, **/*.ts, **/*.tsx"
|
|
|
7
7
|
# @owlmeans/server-auth-identity
|
|
8
8
|
|
|
9
9
|
**Layer:** Server
|
|
10
|
-
**Install:** `"@owlmeans/server-auth-identity": "^0.1.
|
|
10
|
+
**Install:** `"@owlmeans/server-auth-identity": "^0.1.16-rc.0"` in `dependencies`
|
|
11
11
|
|
|
12
12
|
## Key Exports
|
|
13
13
|
|
|
@@ -75,10 +75,12 @@ const payload = await linking.linkProfile(providerDetails, { username })
|
|
|
75
75
|
|
|
76
76
|
## Key Derivation Conventions
|
|
77
77
|
|
|
78
|
+
- **Profile userId**: the account's mongo id — a declared ObjectId reference (`resource.reference('userId', AUTH_IDENTITY_ACCOUNT)`): stored as `ObjectId`, exchanged as a string, auto-indexed and auto-migrated at boot. The only reference in the trio.
|
|
78
79
|
- **Account credential**: unique Base58 slug (16 chars) — serves as the local `entityId`
|
|
79
|
-
- **Profile profileId**: `"{type}:{accountId}"` — stable across provider re-links
|
|
80
|
-
- **Credentials userId** (external key): `"{type}:{service}:{providerSub}"` —
|
|
80
|
+
- **Profile profileId**: `"{type}:{accountId}"` — stable across provider re-links; a composite key, NOT a reference
|
|
81
|
+
- **Credentials userId** (external key): `"{type}:{service}:{providerSub}"` — same name as `profile.userId`, entirely different meaning; never convert or compare across the two
|
|
81
82
|
- **Credentials credential** (login-service key): `"service:{type}:{service}"` — groups credentials by provider
|
|
83
|
+
- `AuthPayload.userId` = `profile.userId ?? profile.profileId` — a value flowing back into a `userId` query may be a composite key; reference criteria tolerate it (matches nothing)
|
|
82
84
|
|
|
83
85
|
## Resource Indexes
|
|
84
86
|
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"package": "@owlmeans/server-auth-identity",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"generatedAt": "2026-08-
|
|
4
|
+
"version": "0.1.16-rc.0",
|
|
5
|
+
"generatedAt": "2026-08-11T14:02:34.969Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/server-auth-identity
|
|
9
9
|
|
|
10
10
|
**Layer:** Server
|
|
11
|
-
**Install:** `"@owlmeans/server-auth-identity": "^0.1.
|
|
11
|
+
**Install:** `"@owlmeans/server-auth-identity": "^0.1.16-rc.0"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
@@ -92,11 +92,18 @@ interface ProviderProfileDetails {
|
|
|
92
92
|
|
|
93
93
|
## Key Derivation Conventions
|
|
94
94
|
|
|
95
|
+
- **Profile userId**: the account's mongo id — a **declared ObjectId reference**
|
|
96
|
+
(`resource.reference('userId', AUTH_IDENTITY_ACCOUNT)`): stored as `ObjectId`, exchanged
|
|
97
|
+
as a string, auto-indexed and auto-migrated at boot. The only reference in the trio.
|
|
95
98
|
- **Account credential**: unique Base58 slug (16 chars) — serves as the local `entityId`
|
|
96
|
-
- **Profile profileId**: `"{type}:{accountId}"` — stable across provider re-links
|
|
97
|
-
- **Credentials userId** (external key): `"{type}:{service}:{providerSub}"` — uniquely identifies the external account
|
|
99
|
+
- **Profile profileId**: `"{type}:{accountId}"` — stable across provider re-links; a composite key, NOT a reference
|
|
100
|
+
- **Credentials userId** (external key): `"{type}:{service}:{providerSub}"` — uniquely identifies the external account. Same name as `profile.userId`, entirely different meaning — never convert or compare across the two
|
|
98
101
|
- **Credentials credential** (login-service key): `"service:{type}:{service}"` — groups credentials by provider
|
|
99
102
|
|
|
103
|
+
`AuthPayload.userId` is emitted as `profile.userId ?? profile.profileId`, so a value flowing
|
|
104
|
+
back into a `userId` query may be a composite key — criteria tolerate it (matches nothing)
|
|
105
|
+
by the reference conversion's design.
|
|
106
|
+
|
|
100
107
|
## Resource Indexes
|
|
101
108
|
|
|
102
109
|
| Resource | Index | Fields | Notes |
|
package/build/resource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,uBAAuB,EAAmB,uBAAuB,EAAuB,2BAA2B,EAAE,MAAM,YAAY,CAAA;AAMtK,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,KAAG,uBAQ9D,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,uBAAuB,EAAmB,uBAAuB,EAAuB,2BAA2B,EAAE,MAAM,YAAY,CAAA;AAMtK,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,KAAG,uBAQ9D,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,KAAG,uBAe9D,CAAA;AAED,eAAO,MAAM,+BAA+B,GAAI,UAAU,MAAM,KAAG,2BAOlE,CAAA"}
|
package/build/resource.js
CHANGED
|
@@ -9,6 +9,12 @@ export const makeIdentityAccountResource = (dbAlias) => {
|
|
|
9
9
|
};
|
|
10
10
|
export const makeIdentityProfileResource = (dbAlias) => {
|
|
11
11
|
const resource = makeMongoResource(AUTH_IDENTITY_PROFILE, dbAlias, undefined, undefined, AUTH_IDENTITY_PROFILE_COLLECTION);
|
|
12
|
+
/**
|
|
13
|
+
* The account's mongo id — the ONLY ObjectId reference in the identity trio.
|
|
14
|
+
* `profileId` is a composite key (`"{type}:{accountId}"`), `entityId` is the Base58
|
|
15
|
+
* slug, and `credentials.userId` is an external provider key — none of them converts.
|
|
16
|
+
*/
|
|
17
|
+
resource.reference('userId', AUTH_IDENTITY_ACCOUNT);
|
|
12
18
|
resource.index('userId', { userId: 1 });
|
|
13
19
|
resource.index('entityId', { entityId: 1 });
|
|
14
20
|
resource.index('role', { role: 1, entityId: 1 });
|
package/build/resource.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.js","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,OAAO,EACL,qBAAqB,EAAE,qBAAqB,EAAE,yBAAyB,EACvE,gCAAgC,EAAE,gCAAgC,EAAE,oCAAoC,EACzG,MAAM,aAAa,CAAA;AAEpB,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,OAAgB,EAA2B,EAAE;IACvF,MAAM,QAAQ,GAAG,iBAAiB,CAChC,qBAAqB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,gCAAgC,CACvF,CAAA;IACD,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IACjE,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAA;IAC3C,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IACvE,OAAO,QAAQ,CAAA;A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E,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAA;IAChD,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1E,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,OAAgB,EAA+B,EAAE;IAC/F,MAAM,QAAQ,GAAG,iBAAiB,CAChC,yBAAyB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,oCAAoC,CAC/F,CAAA;IACD,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IACnF,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAA;IAC7C,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-auth-identity",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16-rc.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@owlmeans/auth": "^0.1.
|
|
26
|
-
"@owlmeans/basic-ids": "^0.1.
|
|
27
|
-
"@owlmeans/context": "^0.1.
|
|
28
|
-
"@owlmeans/mongo-resource": "^0.1.
|
|
29
|
-
"@owlmeans/oidc": "^0.1.
|
|
30
|
-
"@owlmeans/resource": "^0.1.
|
|
31
|
-
"@owlmeans/server-context": "^0.1.
|
|
25
|
+
"@owlmeans/auth": "^0.1.16-rc.0",
|
|
26
|
+
"@owlmeans/basic-ids": "^0.1.16-rc.0",
|
|
27
|
+
"@owlmeans/context": "^0.1.16-rc.0",
|
|
28
|
+
"@owlmeans/mongo-resource": "^0.1.16-rc.0",
|
|
29
|
+
"@owlmeans/oidc": "^0.1.16-rc.0",
|
|
30
|
+
"@owlmeans/resource": "^0.1.16-rc.0",
|
|
31
|
+
"@owlmeans/server-context": "^0.1.16-rc.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"mongodb": "*"
|
package/src/resource.ts
CHANGED
|
@@ -19,6 +19,12 @@ export const makeIdentityProfileResource = (dbAlias?: string): IdentityProfileRe
|
|
|
19
19
|
const resource = makeMongoResource<IdentityProfile, IdentityProfileResource>(
|
|
20
20
|
AUTH_IDENTITY_PROFILE, dbAlias, undefined, undefined, AUTH_IDENTITY_PROFILE_COLLECTION
|
|
21
21
|
)
|
|
22
|
+
/**
|
|
23
|
+
* The account's mongo id — the ONLY ObjectId reference in the identity trio.
|
|
24
|
+
* `profileId` is a composite key (`"{type}:{accountId}"`), `entityId` is the Base58
|
|
25
|
+
* slug, and `credentials.userId` is an external provider key — none of them converts.
|
|
26
|
+
*/
|
|
27
|
+
resource.reference('userId', AUTH_IDENTITY_ACCOUNT)
|
|
22
28
|
resource.index('userId', { userId: 1 })
|
|
23
29
|
resource.index('entityId', { entityId: 1 })
|
|
24
30
|
resource.index('role', { role: 1, entityId: 1 })
|