@segmentstream/ontology 0.95.0 → 0.96.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/dist/sign-in.d.ts CHANGED
@@ -7,9 +7,34 @@ export declare const SIGN_IN_POLICIES: readonly ["invited", "open"];
7
7
  export type SignInPolicy = (typeof SIGN_IN_POLICIES)[number];
8
8
  /** An internal app is closed by default: a person enters by invitation. */
9
9
  export declare const DEFAULT_SIGN_IN_POLICY: SignInPolicy;
10
- /** Channels this SDK can enforce at admission. */
10
+ /** Channels `signIn.channels` can open; `signUp` replaces it. */
11
11
  export declare const CHANNEL_PROVIDERS: readonly ["telegram"];
12
12
  export type ChannelProvider = (typeof CHANNEL_PROVIDERS)[number];
13
+ /**
14
+ * The channels a stranger may sign up through. `email` is sign-in by email code in the app; the
15
+ * others are a first private message to the agent, or opening the Telegram Mini App.
16
+ */
17
+ export declare const SIGN_UP_CHANNELS: readonly ["email", "telegram", "whatsapp"];
18
+ export type SignUpChannel = (typeof SIGN_UP_CHANNELS)[number];
19
+ /** The sign-up channels a person reaches through a chat, which need a matching `chat` adapter. */
20
+ export declare const SIGN_UP_CHAT_CHANNELS: ReadonlyArray<SignUpChannel>;
21
+ export declare function isSignUpChannel(value: unknown): value is SignUpChannel;
22
+ /**
23
+ * Where a stranger may become a user, and the roles they are given. A channel not listed admits
24
+ * only invited or paired people. A user created by sign-up holds exactly these roles, granted like
25
+ * any other and revocable one person at a time, and never the `member` baseline of invited people.
26
+ */
27
+ export interface SignUpOptions<R = unknown> {
28
+ readonly channels: ReadonlyArray<SignUpChannel>;
29
+ /** Declared roles, as role objects or names; an empty list gives nothing beyond explicit grants. */
30
+ readonly roles: ReadonlyArray<R>;
31
+ /** Roles for a listed channel that differs from `roles`. */
32
+ readonly byChannel?: Readonly<Partial<Record<SignUpChannel, ReadonlyArray<R>>>>;
33
+ }
34
+ /** Sign-up as the manifest carries it: the wire names of the roles each open channel grants. */
35
+ export interface ResolvedSignUp {
36
+ readonly channels: Readonly<Partial<Record<SignUpChannel, ReadonlyArray<string>>>>;
37
+ }
13
38
  /** How people become members of the app. Email and channel admission are independent. */
14
39
  export interface SignInOptions {
15
40
  readonly policy: SignInPolicy;
@@ -25,6 +50,12 @@ export interface SignInOptions {
25
50
  */
26
51
  readonly codeLink?: boolean;
27
52
  }
53
+ /** The sign-in options of a checked ontology, with the sign-up its definition declares. */
54
+ export interface ResolvedSignInOptions extends SignInOptions {
55
+ readonly signUp?: ResolvedSignUp;
56
+ /** Wire name of the idempotent, input-free action run as each user created by sign-up. */
57
+ readonly onSignUp?: string;
58
+ }
28
59
  /**
29
60
  * How a person signs in with an address. `code`: a six-digit code, for a member who has signed in
30
61
  * with Neon Auth before, so their Neon Auth account exists. `link`: an emailed sign-in link, for
package/dist/sign-in.js CHANGED
@@ -6,8 +6,19 @@
6
6
  export const SIGN_IN_POLICIES = ["invited", "open"];
7
7
  /** An internal app is closed by default: a person enters by invitation. */
8
8
  export const DEFAULT_SIGN_IN_POLICY = "invited";
9
- /** Channels this SDK can enforce at admission. */
9
+ // @legacy ontology.legacy-channel-admission
10
+ /** Channels `signIn.channels` can open; `signUp` replaces it. */
10
11
  export const CHANNEL_PROVIDERS = ["telegram"];
12
+ /**
13
+ * The channels a stranger may sign up through. `email` is sign-in by email code in the app; the
14
+ * others are a first private message to the agent, or opening the Telegram Mini App.
15
+ */
16
+ export const SIGN_UP_CHANNELS = ["email", "telegram", "whatsapp"];
17
+ /** The sign-up channels a person reaches through a chat, which need a matching `chat` adapter. */
18
+ export const SIGN_UP_CHAT_CHANNELS = ["telegram", "whatsapp"];
19
+ export function isSignUpChannel(value) {
20
+ return SIGN_UP_CHANNELS.includes(value);
21
+ }
11
22
  /**
12
23
  * How a person signs in with an address. `code`: a six-digit code, for a member who has signed in
13
24
  * with Neon Auth before, so their Neon Auth account exists. `link`: an emailed sign-in link, for
@@ -27,7 +27,7 @@ export declare const UserIdentity: import("./entity.js").DraftEntity<"user_ident
27
27
  readonly subject: import("./property.js").Property<string, false, false>;
28
28
  readonly username: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
29
29
  readonly display: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
30
- readonly origin: import("./property.js").Property<"link" | "invite" | "attach" | "sign_in" | "pairing" | "channel", false, false>;
30
+ readonly origin: import("./property.js").Property<"link" | "invite" | "attach" | "sign_in" | "channel" | "pairing", false, false>;
31
31
  readonly revokedAt: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, false>>;
32
32
  readonly accountKey: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, true>>;
33
33
  readonly memberKey: import("effect/Schema").optionalKey<import("./property.js").Property<string, false, true>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.95.0",
3
+ "version": "0.96.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",