@segmentstream/ontology 0.173.0 → 0.174.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/CHANGELOG.md +4 -0
- package/dist/analyze.js +3 -0
- package/dist/runtime/principals.js +8 -3
- package/dist/sign-in.d.ts +1 -1
- package/dist/sign-in.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/analyze.js
CHANGED
|
@@ -1801,6 +1801,9 @@ function signUpOptions(config, signIn, declaredRoles, report) {
|
|
|
1801
1801
|
? 'email is opened by signIn.policy "open" too; declare it in signUp only.'
|
|
1802
1802
|
: `${channel} is opened by signIn.channels too; declare it in signUp only.`);
|
|
1803
1803
|
}
|
|
1804
|
+
if (channel === "segmentstream" && !signIn.browser?.methods.includes("segmentstream")) {
|
|
1805
|
+
report("invalid-sign-in", "signUp.channels", "SegmentStream sign-up requires the segmentstream browser sign-in method.");
|
|
1806
|
+
}
|
|
1804
1807
|
if (SIGN_UP_CHAT_CHANNELS.includes(channel)) {
|
|
1805
1808
|
if (!declaresChatKind(config.chat, channel)) {
|
|
1806
1809
|
report("invalid-sign-in", `signUp.channels`, `Signing up on ${channel} needs a matching chat.${channel} adapter.`);
|
|
@@ -381,8 +381,13 @@ function signIn(ontology, sql, claims) {
|
|
|
381
381
|
yield* recordIdentity(String(invited.id), "invite");
|
|
382
382
|
return userRow(linkedUser);
|
|
383
383
|
}
|
|
384
|
-
//
|
|
385
|
-
|
|
384
|
+
// A verified browser federation account can enroll through its own channel. Older
|
|
385
|
+
// workspaces without that declaration keep their existing email enrollment behavior.
|
|
386
|
+
const cloudRoles = account.provider === OIDC_PROVIDER && email !== undefined
|
|
387
|
+
? signUpRolesOf(ontology.manifest, "segmentstream")
|
|
388
|
+
: undefined;
|
|
389
|
+
const channel = cloudRoles === undefined ? "email" : "segmentstream";
|
|
390
|
+
const signUpRoles = cloudRoles ?? signUpRolesOf(ontology.manifest, "email");
|
|
386
391
|
// @legacy ontology.legacy-channel-admission
|
|
387
392
|
if (signUpRoles === undefined && ontology.signIn.policy !== "open") {
|
|
388
393
|
return yield* new PrincipalRejected({
|
|
@@ -398,7 +403,7 @@ function signIn(ontology, sql, claims) {
|
|
|
398
403
|
identity_subject: claims.identitySubject,
|
|
399
404
|
...signedIn,
|
|
400
405
|
});
|
|
401
|
-
yield* recordUserCreation(sql, String(created.id),
|
|
406
|
+
yield* recordUserCreation(sql, String(created.id), channel, signUpRoles !== undefined);
|
|
402
407
|
if (signUpRoles !== undefined && signUpRoles.length > 0) {
|
|
403
408
|
yield* platformRuntime(ontology, sql, MEMBER_HISTORY_ACTIONS.grantRoles)
|
|
404
409
|
.members.grantRoles({ id: String(created.id), roles: signUpRoles })
|
package/dist/sign-in.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type ChannelProvider = (typeof CHANNEL_PROVIDERS)[number];
|
|
|
17
17
|
* `guest` supersedes; the others are a first private message to the agent, or opening the
|
|
18
18
|
* Telegram Mini App.
|
|
19
19
|
*/
|
|
20
|
-
export declare const SIGN_UP_CHANNELS: readonly ["email", "telegram", "whatsapp", "web"];
|
|
20
|
+
export declare const SIGN_UP_CHANNELS: readonly ["email", "segmentstream", "telegram", "whatsapp", "web"];
|
|
21
21
|
/**
|
|
22
22
|
* The people of a channel the workspace defines in its own code, `channel:<name>`, such as
|
|
23
23
|
* `channel:helpdesk`: the accounts they write from there, which are that channel's alone.
|
package/dist/sign-in.js
CHANGED
|
@@ -16,7 +16,7 @@ export const CHANNEL_PROVIDERS = ["telegram"];
|
|
|
16
16
|
* `guest` supersedes; the others are a first private message to the agent, or opening the
|
|
17
17
|
* Telegram Mini App.
|
|
18
18
|
*/
|
|
19
|
-
export const SIGN_UP_CHANNELS = ["email", "telegram", "whatsapp", "web"];
|
|
19
|
+
export const SIGN_UP_CHANNELS = ["email", "segmentstream", "telegram", "whatsapp", "web"];
|
|
20
20
|
/** The sign-up channels a person reaches through a chat, which need a matching `chat` adapter. */
|
|
21
21
|
export const SIGN_UP_CHAT_CHANNELS = ["telegram", "whatsapp"];
|
|
22
22
|
export function isSignUpChannel(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segmentstream/ontology",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.174.0",
|
|
4
4
|
"description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SegmentStream",
|