@orthograph/preset 0.0.0-stage → 0.1.0-next.1
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/LICENSE +202 -0
- package/README.md +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.js +4 -0
- package/dist/modules/app/internal/folder.d.ts +2 -0
- package/dist/modules/app/internal/folder.js +9 -0
- package/dist/modules/app/internal/names.d.ts +6 -0
- package/dist/modules/app/internal/names.js +10 -0
- package/dist/modules/app/service.d.ts +2 -0
- package/dist/modules/app/service.js +38 -0
- package/dist/modules/app/types.d.ts +26 -0
- package/dist/modules/app/types.js +5 -0
- package/dist/modules/starter/internal/project.d.ts +57 -0
- package/dist/modules/starter/internal/project.js +96 -0
- package/dist/modules/starter/service.d.ts +2 -0
- package/dist/modules/starter/service.js +38 -0
- package/dist/modules/starter/types.d.ts +25 -0
- package/dist/modules/starter/types.js +1 -0
- package/files/blueprint/environments/local.ts +8 -0
- package/files/blueprint/environments/production.ts +10 -0
- package/files/blueprint/environments/staging.ts +9 -0
- package/files/blueprint/environments/test.ts +8 -0
- package/files/blueprint/refusals.lock +85 -0
- package/files/blueprint/starting-worlds/founded.ts +11 -0
- package/files/blueprint/starting-worlds/invited.ts +12 -0
- package/files/blueprint/things/api-key/thing.ts +8 -0
- package/files/blueprint/things/api-key/verbs/create.ts +15 -0
- package/files/blueprint/things/invitation/events.ts +7 -0
- package/files/blueprint/things/invitation/machine.ts +13 -0
- package/files/blueprint/things/invitation/roles.ts +5 -0
- package/files/blueprint/things/invitation/thing.ts +8 -0
- package/files/blueprint/things/invitation/verbs/accept.ts +16 -0
- package/files/blueprint/things/invitation/verbs/revoke.ts +14 -0
- package/files/blueprint/things/invitation/verbs/send.ts +14 -0
- package/files/blueprint/things/membership/roles.ts +5 -0
- package/files/blueprint/things/membership/thing.ts +9 -0
- package/files/blueprint/things/membership/verbs/get.ts +11 -0
- package/files/blueprint/things/organization/events.ts +4 -0
- package/files/blueprint/things/organization/machine.ts +9 -0
- package/files/blueprint/things/organization/roles.ts +5 -0
- package/files/blueprint/things/organization/thing.ts +7 -0
- package/files/blueprint/things/organization/verbs/create.ts +14 -0
- package/files/blueprint/things/organization/verbs/get.ts +10 -0
- package/files/blueprint/things/person/errors.ts +3 -0
- package/files/blueprint/things/person/thing.ts +6 -0
- package/files/blueprint/things/person/verbs/sign-up.ts +14 -0
- package/files/blueprint/things/session/errors.ts +3 -0
- package/files/blueprint/things/session/thing.ts +7 -0
- package/files/blueprint/things/session/verbs/show.ts +13 -0
- package/files/blueprint/things/session/verbs/sign-in.ts +15 -0
- package/files/blueprint/things/system/thing.ts +6 -0
- package/files/blueprint/things/system/verbs/health.ts +11 -0
- package/files/blueprint/values/identity.ts +15 -0
- package/files/generated/model/model.json +3658 -0
- package/files/journeys/README.md +112 -0
- package/files/journeys/an-invitation-is-used-once.ts +38 -0
- package/files/journeys/an-owner-makes-an-api-key.ts +50 -0
- package/files/journeys/health-is-up.ts +17 -0
- package/files/journeys/invite-and-accept.ts +103 -0
- package/files/journeys/sign-up-and-sign-in.ts +48 -0
- package/files/src/api-key/create.ts +20 -0
- package/files/src/invitation/accept.ts +24 -0
- package/files/src/invitation/revoke.ts +8 -0
- package/files/src/invitation/send.ts +21 -0
- package/files/src/organization/create.ts +25 -0
- package/files/src/person/sign-up.ts +22 -0
- package/files/src/session/show.ts +14 -0
- package/files/src/session/sign-in.ts +22 -0
- package/files/src/system/health.ts +8 -0
- package/generators.json +9 -0
- package/package.json +34 -3
- package/schema.json +8 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generated": "Generated from blueprint/. Append-only. Do not edit.",
|
|
3
|
+
"lockVersion": 1,
|
|
4
|
+
"refusals": {
|
|
5
|
+
"AR-001": {
|
|
6
|
+
"name": "NotAllowed",
|
|
7
|
+
"owner": "runtime",
|
|
8
|
+
"fields": {},
|
|
9
|
+
"wire": {
|
|
10
|
+
"effect": {
|
|
11
|
+
"tag": "NotAllowed"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"earlier": []
|
|
15
|
+
},
|
|
16
|
+
"AR-002": {
|
|
17
|
+
"name": "IdempotencyConflict",
|
|
18
|
+
"owner": "runtime",
|
|
19
|
+
"fields": {},
|
|
20
|
+
"wire": {
|
|
21
|
+
"effect": {
|
|
22
|
+
"tag": "IdempotencyConflict"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"earlier": []
|
|
26
|
+
},
|
|
27
|
+
"IN-900": {
|
|
28
|
+
"name": "InvitationNotPending",
|
|
29
|
+
"owner": "invitation",
|
|
30
|
+
"fields": {
|
|
31
|
+
"state": {
|
|
32
|
+
"value": "text",
|
|
33
|
+
"max": 64
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"wire": {
|
|
37
|
+
"effect": {
|
|
38
|
+
"tag": "InvitationNotPending"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"earlier": []
|
|
42
|
+
},
|
|
43
|
+
"OR-900": {
|
|
44
|
+
"name": "OrganizationNotActive",
|
|
45
|
+
"owner": "organization",
|
|
46
|
+
"fields": {
|
|
47
|
+
"state": {
|
|
48
|
+
"value": "text",
|
|
49
|
+
"max": 64
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"wire": {
|
|
53
|
+
"effect": {
|
|
54
|
+
"tag": "OrganizationNotActive"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"earlier": []
|
|
58
|
+
},
|
|
59
|
+
"PE-001": {
|
|
60
|
+
"name": "PersonEmailTaken",
|
|
61
|
+
"owner": "person",
|
|
62
|
+
"from": "blueprint/things/person/errors.ts",
|
|
63
|
+
"fields": {},
|
|
64
|
+
"wire": {
|
|
65
|
+
"effect": {
|
|
66
|
+
"tag": "PersonEmailTaken"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"earlier": []
|
|
70
|
+
},
|
|
71
|
+
"SE-001": {
|
|
72
|
+
"name": "SessionCredentialsWrong",
|
|
73
|
+
"owner": "session",
|
|
74
|
+
"from": "blueprint/things/session/errors.ts",
|
|
75
|
+
"fields": {},
|
|
76
|
+
"wire": {
|
|
77
|
+
"effect": {
|
|
78
|
+
"tag": "SessionCredentialsWrong"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"earlier": []
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"retired": {}
|
|
85
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Journey-author file: a starting world is made by declared operations, never by hand (D2 #4).
|
|
2
|
+
import { Blueprint } from "orthograph";
|
|
3
|
+
import { owner } from "../things/organization/roles.ts";
|
|
4
|
+
import create from "../things/organization/verbs/create.ts";
|
|
5
|
+
|
|
6
|
+
/** Ada has founded an organisation called "Acme Demo". She owns it. */
|
|
7
|
+
export default Blueprint.startingWorld("founded", {
|
|
8
|
+
cast: { ada: owner },
|
|
9
|
+
makes: (s) => [s.ada.run(create, { name: "Acme Demo" })],
|
|
10
|
+
gives: (s) => ({ organization: s.last.organization }),
|
|
11
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Journey-author file: a starting world is made by declared operations, never by hand (D2 #4).
|
|
2
|
+
import { Blueprint } from "orthograph";
|
|
3
|
+
import { owner } from "../things/organization/roles.ts";
|
|
4
|
+
import send from "../things/invitation/verbs/send.ts";
|
|
5
|
+
|
|
6
|
+
/** From founded: ada, who owns the organisation, has invited olga by her email. The invitation is pending. */
|
|
7
|
+
export default Blueprint.startingWorld("invited", {
|
|
8
|
+
from: "founded",
|
|
9
|
+
cast: { ada: owner, olga: Blueprint.signedIn },
|
|
10
|
+
makes: (s) => [s.ada.run(send, { organization: s.world.organization, email: s.olga.email })],
|
|
11
|
+
gives: (s) => ({ organization: s.world.organization, invitation: s.last.invitation }),
|
|
12
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Organization } from "../organization/thing.ts";
|
|
3
|
+
import { Person } from "../person/thing.ts";
|
|
4
|
+
|
|
5
|
+
export const ApiKey = Blueprint.thing({
|
|
6
|
+
description: "A key an agent or a service calls with, on behalf of whoever created it. Better Auth keeps its hash.",
|
|
7
|
+
fields: { id: Blueprint.id("key"), organization: Organization.fields.id, name: Blueprint.text(), createdBy: Person.fields.id },
|
|
8
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Blueprint, Via } from "orthograph";
|
|
2
|
+
import { ApiKey } from "../thing.ts";
|
|
3
|
+
import { owner } from "../../organization/roles.ts";
|
|
4
|
+
import { Secret } from "../../../values/identity.ts";
|
|
5
|
+
|
|
6
|
+
export default Blueprint.operation(ApiKey, {
|
|
7
|
+
description: "Create an API key in an organisation. The key itself is shown once.",
|
|
8
|
+
payload: { organization: ApiKey.fields.organization, name: ApiKey.fields.name },
|
|
9
|
+
// The key is handed to its caller once, in this answer, and nowhere else.
|
|
10
|
+
answer: { apiKey: ApiKey.fields.id, key: Blueprint.issued(Secret) },
|
|
11
|
+
// A key is made in person, never by a key or by an agent: a credential cannot mint its own kin (M2.03, `.via` narrows the entry).
|
|
12
|
+
allowed: [owner.of("organization").via(Via.session, Via.device)],
|
|
13
|
+
steps: { issue: Blueprint.step.database(), insert: Blueprint.step.database() },
|
|
14
|
+
budget: { p95: "250 millis" },
|
|
15
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Invitation } from "./thing.ts";
|
|
3
|
+
import { Membership } from "../membership/thing.ts";
|
|
4
|
+
|
|
5
|
+
export const InvitationSent = Blueprint.event({ invitation: Invitation.fields.id, email: Invitation.fields.email });
|
|
6
|
+
export const InvitationAccepted = Blueprint.event({ invitation: Invitation.fields.id, membership: Membership.fields.id });
|
|
7
|
+
export const InvitationRevoked = Blueprint.event({ invitation: Invitation.fields.id });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Invitation } from "./thing.ts";
|
|
3
|
+
import * as Events from "./events.ts";
|
|
4
|
+
|
|
5
|
+
export const machine = Blueprint.machine(Invitation, {
|
|
6
|
+
states: ["pending", "accepted", "revoked"],
|
|
7
|
+
moves: {
|
|
8
|
+
send: { from: [], to: "pending", emits: Events.InvitationSent },
|
|
9
|
+
accept: { from: ["pending"], to: "accepted", emits: Events.InvitationAccepted },
|
|
10
|
+
revoke: { from: ["pending"], to: "revoked", emits: Events.InvitationRevoked },
|
|
11
|
+
},
|
|
12
|
+
notFrom: { exit: 40 }, // generates InvitationNotPending
|
|
13
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Invitation } from "./thing.ts";
|
|
3
|
+
|
|
4
|
+
// Whoever signed in with the address the invitation was sent to.
|
|
5
|
+
export const invitee = Blueprint.role(Invitation, { rule: (invitation, principal) => invitation.email === principal.email });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Organization } from "../organization/thing.ts";
|
|
3
|
+
import { Person } from "../person/thing.ts";
|
|
4
|
+
|
|
5
|
+
export const Invitation = Blueprint.thing({
|
|
6
|
+
description: "An offer to join an organisation, sent to an email address.",
|
|
7
|
+
fields: { id: Blueprint.id("inv"), organization: Organization.fields.id, email: Person.fields.email, invitedBy: Person.fields.id },
|
|
8
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Blueprint, Via } from "orthograph";
|
|
2
|
+
import { Invitation } from "../thing.ts";
|
|
3
|
+
import { machine } from "../machine.ts";
|
|
4
|
+
import { invitee } from "../roles.ts";
|
|
5
|
+
import { Membership } from "../../membership/thing.ts";
|
|
6
|
+
|
|
7
|
+
export default Blueprint.operation(Invitation, {
|
|
8
|
+
description: "Accept an invitation and become a member of its organisation.",
|
|
9
|
+
payload: { invitation: Invitation.fields.id },
|
|
10
|
+
answer: { organization: Invitation.fields.organization, membership: Membership.fields.id },
|
|
11
|
+
move: machine.moves.accept,
|
|
12
|
+
// An agent cannot consent for a person (M2.03, `.notVia` keeps session, key and device).
|
|
13
|
+
allowed: [invitee.notVia(Via.agent)],
|
|
14
|
+
steps: { join: Blueprint.step.database() },
|
|
15
|
+
budget: { p95: "200 millis" },
|
|
16
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Invitation } from "../thing.ts";
|
|
3
|
+
import { machine } from "../machine.ts";
|
|
4
|
+
import { owner } from "../../organization/roles.ts";
|
|
5
|
+
|
|
6
|
+
export default Blueprint.operation(Invitation, {
|
|
7
|
+
description: "Withdraw an invitation that hasn't been accepted.",
|
|
8
|
+
payload: { invitation: Invitation.fields.id },
|
|
9
|
+
answer: {},
|
|
10
|
+
move: machine.moves.revoke,
|
|
11
|
+
allowed: [owner.of("invitation.organization")],
|
|
12
|
+
steps: { update: Blueprint.step.database() },
|
|
13
|
+
budget: { p95: "150 millis" },
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Invitation } from "../thing.ts";
|
|
3
|
+
import { machine } from "../machine.ts";
|
|
4
|
+
import { owner } from "../../organization/roles.ts";
|
|
5
|
+
|
|
6
|
+
export default Blueprint.operation(Invitation, {
|
|
7
|
+
description: "Invite someone to an organisation by email.",
|
|
8
|
+
payload: { organization: Invitation.fields.organization, email: Invitation.fields.email },
|
|
9
|
+
answer: { invitation: Invitation.fields.id },
|
|
10
|
+
move: machine.moves.send,
|
|
11
|
+
allowed: [owner.of("organization")],
|
|
12
|
+
steps: { insert: Blueprint.step.database() },
|
|
13
|
+
budget: { p95: "200 millis" },
|
|
14
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Organization } from "../organization/thing.ts";
|
|
3
|
+
import { Person } from "../person/thing.ts";
|
|
4
|
+
import { Role } from "../../values/identity.ts";
|
|
5
|
+
|
|
6
|
+
export const Membership = Blueprint.thing({
|
|
7
|
+
description: "A person's place in an organisation.",
|
|
8
|
+
fields: { id: Blueprint.id("mem"), organization: Organization.fields.id, person: Person.fields.id, role: Role },
|
|
9
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Membership } from "../thing.ts";
|
|
3
|
+
import { holder } from "../roles.ts";
|
|
4
|
+
import { owner } from "../../organization/roles.ts";
|
|
5
|
+
|
|
6
|
+
export default Blueprint.read(Membership, {
|
|
7
|
+
by: "id",
|
|
8
|
+
fields: ["organization", "person", "role"],
|
|
9
|
+
allowed: [holder, owner.of("membership.organization")],
|
|
10
|
+
budget: { p95: "50 millis" },
|
|
11
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Organization } from "./thing.ts";
|
|
3
|
+
import * as Events from "./events.ts";
|
|
4
|
+
|
|
5
|
+
export const machine = Blueprint.machine(Organization, {
|
|
6
|
+
states: ["active"],
|
|
7
|
+
moves: { create: { from: [], to: "active", emits: Events.OrganizationCreated } },
|
|
8
|
+
notFrom: { exit: 20 },
|
|
9
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Person } from "../person/thing.ts";
|
|
3
|
+
|
|
4
|
+
export const Organization = Blueprint.thing({
|
|
5
|
+
description: "A company or team that people belong to.",
|
|
6
|
+
fields: { id: Blueprint.id("org"), name: Blueprint.text(), owner: Person.fields.id },
|
|
7
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Organization } from "../thing.ts";
|
|
3
|
+
import { machine } from "../machine.ts";
|
|
4
|
+
|
|
5
|
+
export default Blueprint.operation(Organization, {
|
|
6
|
+
description: "Found an organisation. Whoever founds it owns it, and is its first member.",
|
|
7
|
+
payload: { name: Organization.fields.name },
|
|
8
|
+
answer: { organization: Organization.fields.id },
|
|
9
|
+
move: machine.moves.create,
|
|
10
|
+
allowed: [Blueprint.signedIn],
|
|
11
|
+
steps: { insert: Blueprint.step.database(), owner: Blueprint.step.database() },
|
|
12
|
+
idempotent: "request",
|
|
13
|
+
budget: { p95: "250 millis" },
|
|
14
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Organization } from "../thing.ts";
|
|
3
|
+
import { owner } from "../roles.ts";
|
|
4
|
+
|
|
5
|
+
export default Blueprint.read(Organization, {
|
|
6
|
+
by: "id",
|
|
7
|
+
fields: ["name", "owner", "state"],
|
|
8
|
+
allowed: [owner],
|
|
9
|
+
budget: { p95: "50 millis" },
|
|
10
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
|
|
3
|
+
export const Person = Blueprint.thing({
|
|
4
|
+
description: "Someone who signs in. Better Auth keeps people; the project refers to them by id.",
|
|
5
|
+
fields: { id: Blueprint.id("per"), email: Blueprint.email(), name: Blueprint.text() },
|
|
6
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Person } from "../thing.ts";
|
|
3
|
+
import { PersonEmailTaken } from "../errors.ts";
|
|
4
|
+
import { Password } from "../../../values/identity.ts";
|
|
5
|
+
|
|
6
|
+
export default Blueprint.operation(Person, {
|
|
7
|
+
description: "Sign up with an email address and a password.",
|
|
8
|
+
payload: { email: Person.fields.email, password: Password, name: Person.fields.name },
|
|
9
|
+
answer: { person: Person.fields.id },
|
|
10
|
+
errors: [PersonEmailTaken],
|
|
11
|
+
allowed: [Blueprint.anyone],
|
|
12
|
+
steps: { create: Blueprint.step.database() },
|
|
13
|
+
budget: { p95: "400 millis" },
|
|
14
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Person } from "../person/thing.ts";
|
|
3
|
+
|
|
4
|
+
export const Session = Blueprint.thing({
|
|
5
|
+
description: "A person's signed-in session, issued by Better Auth.",
|
|
6
|
+
fields: { id: Blueprint.id("ses"), person: Person.fields.id },
|
|
7
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Session } from "../thing.ts";
|
|
3
|
+
import { Person } from "../../person/thing.ts";
|
|
4
|
+
import { Way } from "../../../values/identity.ts";
|
|
5
|
+
|
|
6
|
+
export default Blueprint.operation(Session, {
|
|
7
|
+
description: "Who is signed in.",
|
|
8
|
+
payload: {},
|
|
9
|
+
// `via` is how this call got in: the one thing a principal journey can read that no other operation answers (M2.03).
|
|
10
|
+
answer: { person: Person.fields.id, email: Person.fields.email, via: Way },
|
|
11
|
+
allowed: [Blueprint.signedIn],
|
|
12
|
+
budget: { p95: "100 millis" },
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { Session } from "../thing.ts";
|
|
3
|
+
import { SessionCredentialsWrong } from "../errors.ts";
|
|
4
|
+
import { Person } from "../../person/thing.ts";
|
|
5
|
+
import { Password, Secret } from "../../../values/identity.ts";
|
|
6
|
+
|
|
7
|
+
export default Blueprint.operation(Session, {
|
|
8
|
+
description: "Sign in with email and password. The token is the bearer for every later call.",
|
|
9
|
+
payload: { email: Person.fields.email, password: Password },
|
|
10
|
+
answer: { session: Blueprint.issued(Blueprint.visibility.secret(Session.fields.id)), token: Blueprint.issued(Secret) },
|
|
11
|
+
errors: [SessionCredentialsWrong],
|
|
12
|
+
allowed: [Blueprint.anyone],
|
|
13
|
+
steps: { verify: Blueprint.step.database() },
|
|
14
|
+
budget: { p95: "400 millis" },
|
|
15
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Blueprint } from "orthograph";
|
|
2
|
+
import { System } from "../thing.ts";
|
|
3
|
+
import { Ok } from "../../../values/identity.ts";
|
|
4
|
+
|
|
5
|
+
export default Blueprint.operation(System, {
|
|
6
|
+
description: "Is the application up?",
|
|
7
|
+
payload: {},
|
|
8
|
+
answer: { status: Ok },
|
|
9
|
+
allowed: [Blueprint.anyone],
|
|
10
|
+
budget: { p95: "50 millis" },
|
|
11
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Blueprint, Schema } from "orthograph";
|
|
2
|
+
|
|
3
|
+
/** What a person signs in with. Never stored by the project: Better Auth keeps only its hash. Secret: never in telemetry. */
|
|
4
|
+
export const Password = Blueprint.visibility.secret(Blueprint.text({ max: 128 }));
|
|
5
|
+
/** A secret shown once: a session's bearer token, or an API key. Secret: never in telemetry. */
|
|
6
|
+
export const Secret = Blueprint.visibility.secret(Blueprint.text({ max: 512 }));
|
|
7
|
+
/** A place in an organisation. */
|
|
8
|
+
export const Role = Blueprint.value(Schema.Literals(["owner", "member"]));
|
|
9
|
+
/** The application answered. */
|
|
10
|
+
export const Ok = Blueprint.value(Schema.Literal("ok"));
|
|
11
|
+
/**
|
|
12
|
+
* How a call got in, as `session.show` answers it (M2.03, `design/decisions/M2-auth.md`): `Way` in `orthograph` is the same four
|
|
13
|
+
* words as a TypeScript type, and the declaration here is the value a field is made of.
|
|
14
|
+
*/
|
|
15
|
+
export const Way = Blueprint.value(Schema.Literals(["session", "key", "device", "agent"]));
|