@reventlessdev/reventless-core 3.0.0-alpha.306 → 3.0.0-alpha.307
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.307 (2026-10-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **aws:** a new account gets a domain user id, carried as a token claim from a pool-scoped identity store ([ccfc90c](https://github.com/ReventlessDev/reventless-core/commit/ccfc90ced0c211cab23843864a2b4e580001b3ae))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
# 3.0.0-alpha.306 (2026-10-22)
|
|
7
14
|
|
|
8
15
|
**Note:** Version bump only for package @reventlessdev/reventless-core
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.307",
|
|
4
4
|
"description": "Core package for Reventless framework",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"sury": "11.0.0",
|
|
30
30
|
"uuid": "^13.0.0",
|
|
31
31
|
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
32
|
+
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.23",
|
|
32
33
|
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
33
34
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
34
|
-
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.23",
|
|
35
35
|
"@reventlessdev/rescript-node": "2.0.0-alpha.23",
|
|
36
|
-
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
37
36
|
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.24",
|
|
37
|
+
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
38
38
|
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
39
39
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.42",
|
|
40
|
-
"@reventlessdev/reventless-
|
|
41
|
-
"@reventlessdev/reventless-
|
|
40
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.204",
|
|
41
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.175"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"rescript": "12.3.1",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The domain's own user id, as distinct from the identity provider's handle.
|
|
2
|
+
//
|
|
3
|
+
// 🚨 **A domain event must never persist a provider-shaped id.** A reference
|
|
4
|
+
// written into a million events is permanent, and a log full of one provider's
|
|
5
|
+
// ids cannot be moved to another. What the log holds is this id; the mapping to
|
|
6
|
+
// the provider's handle lives in the identity capability's store.
|
|
7
|
+
//
|
|
8
|
+
// Two platforms mint and read it and must agree on both halves: the shape, so a
|
|
9
|
+
// seed or a test can tell a minted id from a `sub`, and the claim name, so a
|
|
10
|
+
// client reads its own id the same way whichever platform signed its token.
|
|
11
|
+
|
|
12
|
+
/** The claim a token carries the domain id in. Added by the Cognito pre-token
|
|
13
|
+
trigger from the identity store; absent on every account created before the
|
|
14
|
+
store existed, whose id stays the `sub` it always was. */
|
|
15
|
+
let claim = "domainUserId"
|
|
16
|
+
|
|
17
|
+
let prefix = "u_"
|
|
18
|
+
|
|
19
|
+
/** A fresh id. Prefixed so it cannot be mistaken for a bare UUID, which is what
|
|
20
|
+
a Cognito `sub` is. */
|
|
21
|
+
let mint = (): string => prefix ++ Message.uuid()->String.replaceAll("-", "")
|
|
22
|
+
|
|
23
|
+
/** Whether an id was minted here rather than copied from a provider. */
|
|
24
|
+
let isMinted = (id: string): bool => id->String.startsWith(prefix)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
4
|
+
|
|
5
|
+
let prefix = "u_";
|
|
6
|
+
|
|
7
|
+
function mint() {
|
|
8
|
+
return prefix + Message$ReventlessCore.uuid().replaceAll("-", "");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isMinted(id) {
|
|
12
|
+
return id.startsWith(prefix);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let claim = "domainUserId";
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
claim,
|
|
19
|
+
prefix,
|
|
20
|
+
mint,
|
|
21
|
+
isMinted,
|
|
22
|
+
}
|
|
23
|
+
/* Message-ReventlessCore Not a pure module */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
open JestGlobals
|
|
2
|
+
|
|
3
|
+
// The domain id's two halves, shared by both platforms: a shape a reader can
|
|
4
|
+
// tell from a provider's `sub`, and one claim name a client reads whichever
|
|
5
|
+
// platform signed its token.
|
|
6
|
+
|
|
7
|
+
describe("Auth_UserId", () => {
|
|
8
|
+
testSync("a minted id is not shaped like a UUID", () => {
|
|
9
|
+
let id = Auth_UserId.mint()
|
|
10
|
+
expect(id->String.startsWith("u_"))->toBe(true)
|
|
11
|
+
expect(id->String.includes("-"))->toBe(false)
|
|
12
|
+
expect(Auth_UserId.isMinted(id))->toBe(true)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
testSync("two mints differ", () => expect(Auth_UserId.mint() == Auth_UserId.mint())->toBe(false))
|
|
16
|
+
|
|
17
|
+
// The fallback every older account relies on: a Cognito `sub` must never read
|
|
18
|
+
// as minted, or a reader would treat a provider id as the domain's own.
|
|
19
|
+
testSync("a sub is not minted", () =>
|
|
20
|
+
expect(Auth_UserId.isMinted("c3741234-aaaa-bbbb-cccc-ddddeeee1234"))->toBe(false)
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
testSync("the claim name is stable", () => expect(Auth_UserId.claim)->toBe("domainUserId"))
|
|
24
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Auth_UserId$ReventlessCore from "../src/adapter/Auth/Auth_UserId.res.mjs";
|
|
4
|
+
|
|
5
|
+
globalThis.describe("Auth_UserId", () => {
|
|
6
|
+
globalThis.test("a minted id is not shaped like a UUID", () => {
|
|
7
|
+
let id = Auth_UserId$ReventlessCore.mint();
|
|
8
|
+
globalThis.expect(id.startsWith("u_")).toBe(true);
|
|
9
|
+
globalThis.expect(id.includes("-")).toBe(false);
|
|
10
|
+
globalThis.expect(Auth_UserId$ReventlessCore.isMinted(id)).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
globalThis.test("two mints differ", () => {
|
|
13
|
+
globalThis.expect(Auth_UserId$ReventlessCore.mint() === Auth_UserId$ReventlessCore.mint()).toBe(false);
|
|
14
|
+
});
|
|
15
|
+
globalThis.test("a sub is not minted", () => {
|
|
16
|
+
globalThis.expect(Auth_UserId$ReventlessCore.isMinted("c3741234-aaaa-bbbb-cccc-ddddeeee1234")).toBe(false);
|
|
17
|
+
});
|
|
18
|
+
globalThis.test("the claim name is stable", () => {
|
|
19
|
+
globalThis.expect(Auth_UserId$ReventlessCore.claim).toBe("domainUserId");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/* Not a pure module */
|