@house-rules/party 0.0.0-stage → 0.1.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/AGENTS.md +67 -0
- package/LICENSE +21 -0
- package/README.md +142 -2
- package/dist/adapters/memory/party.d.ts +3 -0
- package/dist/adapters/memory/party.js +170 -0
- package/dist/adapters/memory/person.d.ts +3 -0
- package/dist/adapters/memory/person.js +87 -0
- package/dist/adapters/postgres/party.d.ts +4 -0
- package/dist/adapters/postgres/party.js +73 -0
- package/dist/adapters/postgres/person.d.ts +4 -0
- package/dist/adapters/postgres/person.js +63 -0
- package/dist/assignment/assignment.d.ts +13 -0
- package/dist/assignment/assignment.js +9 -0
- package/dist/assignment/holders.d.ts +11 -0
- package/dist/assignment/holders.js +7 -0
- package/dist/contract.d.ts +9 -0
- package/dist/contract.js +9 -0
- package/dist/facade.d.ts +22 -0
- package/dist/facade.js +35 -0
- package/dist/index.d.ts +294 -0
- package/dist/index.js +20 -0
- package/dist/invitation/invitation.d.ts +36 -0
- package/dist/invitation/invitation.js +17 -0
- package/dist/invitation/invitations.d.ts +34 -0
- package/dist/invitation/invitations.js +70 -0
- package/dist/organisation/organisation.d.ts +59 -0
- package/dist/organisation/organisation.js +46 -0
- package/dist/person/bind-party.d.ts +7 -0
- package/dist/person/bind-party.js +42 -0
- package/dist/person/operations.d.ts +306 -0
- package/dist/person/operations.js +92 -0
- package/dist/person/party.d.ts +36 -0
- package/dist/person/party.js +55 -0
- package/dist/person/permissions.d.ts +6 -0
- package/dist/person/permissions.js +5 -0
- package/dist/person/person-store.d.ts +21 -0
- package/dist/person/person-store.js +3 -0
- package/dist/person/person.d.ts +43 -0
- package/dist/person/person.js +25 -0
- package/dist/person/policy.d.ts +1 -0
- package/dist/person/policy.js +6 -0
- package/dist/person/principal-operations.d.ts +110 -0
- package/dist/person/principal-operations.js +77 -0
- package/dist/person/principal.d.ts +126 -0
- package/dist/person/principal.js +49 -0
- package/dist/person/principals.d.ts +102 -0
- package/dist/person/principals.js +73 -0
- package/dist/relationship/relationship.d.ts +30 -0
- package/dist/relationship/relationship.js +12 -0
- package/dist/relationship/removal.d.ts +101 -0
- package/dist/relationship/removal.js +22 -0
- package/dist/role/access.d.ts +171 -0
- package/dist/role/access.js +252 -0
- package/dist/role/operations.d.ts +145 -0
- package/dist/role/operations.js +215 -0
- package/dist/role/people.d.ts +45 -0
- package/dist/role/people.js +57 -0
- package/dist/role/permission-catalogue.d.ts +2 -0
- package/dist/role/permission-catalogue.js +1 -0
- package/dist/role/role.d.ts +31 -0
- package/dist/role/role.js +12 -0
- package/dist/storage.d.ts +38 -0
- package/dist/storage.js +4 -0
- package/migrations/0001_party_person.sql +5 -0
- package/migrations/0002_party_model.sql +27 -0
- package/migrations/0003_party_invitation.sql +11 -0
- package/migrations/0004_publish_staff.sql +4 -0
- package/migrations/0005_principals.sql +18 -0
- package/package.json +57 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { UnitOfWork } from "@house-rules/domain";
|
|
2
|
+
import { Effect, Layer, Schema } from "effect";
|
|
3
|
+
import { SqlClient } from "effect/sql/SqlClient";
|
|
4
|
+
import { Person, PersonStoreUnavailable } from "../../person/person.js";
|
|
5
|
+
import { PersonStore } from "../../storage.js";
|
|
6
|
+
import { legacyPrincipal, Principal } from "../../person/principal.js";
|
|
7
|
+
const decodeRows = Schema.decodeUnknownEffect(Schema.Array(Person));
|
|
8
|
+
const unavailable = (cause) => new PersonStoreUnavailable({ cause });
|
|
9
|
+
export const postgresPersonStore = Layer.effect(PersonStore, Effect.gen(function* postgresPersonStore() {
|
|
10
|
+
const sql = yield* SqlClient;
|
|
11
|
+
const columns = sql.literal(`id, display_name as "displayName", floor(extract(epoch from created_at) * 1000)::float8 as "createdAt"`);
|
|
12
|
+
const read = (query) => query.pipe(Effect.flatMap(decodeRows), Effect.mapError(unavailable));
|
|
13
|
+
const principalColumns = sql.literal(`id, display_name as "displayName", floor(extract(epoch from created_at) * 1000)::float8 as "createdAt",
|
|
14
|
+
kind, handle, created_by as "createdBy", floor(extract(epoch from disabled_at) * 1000)::float8 as "disabledAt"`);
|
|
15
|
+
const readPrincipals = (query) => query.pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.Array(Principal))), Effect.mapError(unavailable));
|
|
16
|
+
const insertPrincipal = Effect.fn("PersonStore.postgres.insertPrincipal")(function* (principal) {
|
|
17
|
+
yield* UnitOfWork.required;
|
|
18
|
+
const rows = yield* sql `insert into party_person (id, display_name, created_at, kind, handle, created_by, disabled_at)
|
|
19
|
+
values (${principal.id}, ${principal.displayName},
|
|
20
|
+
'epoch'::timestamptz + ${principal.createdAt}::bigint * interval '1 millisecond',
|
|
21
|
+
${principal.kind}, ${principal.handle}, ${principal.createdBy},
|
|
22
|
+
'epoch'::timestamptz + ${principal.disabledAt}::bigint * interval '1 millisecond')
|
|
23
|
+
on conflict do nothing returning id`.pipe(Effect.mapError(unavailable));
|
|
24
|
+
return rows.length > 0;
|
|
25
|
+
});
|
|
26
|
+
return PersonStore.of({
|
|
27
|
+
principal: (id) => readPrincipals(sql `select ${principalColumns} from party_person where id = ${id}`).pipe(Effect.map((rows) => rows[0])),
|
|
28
|
+
principalByHandle: (handle) => readPrincipals(sql `select ${principalColumns} from party_person where handle = ${handle}`).pipe(Effect.map((rows) => rows[0])),
|
|
29
|
+
principalsByIds: (ids) => readPrincipals(sql `select ${principalColumns} from party_person where ${sql.in("id", ids)} order by id`),
|
|
30
|
+
insertPrincipal,
|
|
31
|
+
lockPrincipal: Effect.fn("PersonStore.postgres.lockPrincipal")(function* (handle) {
|
|
32
|
+
yield* UnitOfWork.required;
|
|
33
|
+
// FOR KEY SHARE would not block an UPDATE of disabled_at.
|
|
34
|
+
const rows = yield* readPrincipals(sql `select ${principalColumns} from party_person where handle = ${handle} for share`);
|
|
35
|
+
return rows[0];
|
|
36
|
+
}),
|
|
37
|
+
principalForUpdate: Effect.fn("PersonStore.postgres.principalForUpdate")(function* (id) {
|
|
38
|
+
yield* UnitOfWork.required;
|
|
39
|
+
const rows = yield* readPrincipals(sql `select ${principalColumns} from party_person where id = ${id} for no key update`);
|
|
40
|
+
return rows[0];
|
|
41
|
+
}),
|
|
42
|
+
disable: Effect.fn("PersonStore.postgres.disable")(function* (id, disabledAt) {
|
|
43
|
+
yield* UnitOfWork.required;
|
|
44
|
+
const rows = yield* readPrincipals(sql `update party_person
|
|
45
|
+
set disabled_at = coalesce(disabled_at, 'epoch'::timestamptz + ${disabledAt}::bigint * interval '1 millisecond')
|
|
46
|
+
where id = ${id} returning ${principalColumns}`);
|
|
47
|
+
return rows[0];
|
|
48
|
+
}),
|
|
49
|
+
find: (id) => read(sql `select ${columns} from party_person where id = ${id}`).pipe(Effect.map((rows) => rows[0])),
|
|
50
|
+
list: (ids) => read(sql `select ${columns} from party_person where ${ids === null ? sql `true` : sql.in("id", ids)} order by display_name, id`),
|
|
51
|
+
insertIfFree: (person) => insertPrincipal(legacyPrincipal(person)),
|
|
52
|
+
rename: Effect.fn("PersonStore.postgres.rename")(function* (id, displayName) {
|
|
53
|
+
yield* UnitOfWork.required;
|
|
54
|
+
const rows = yield* read(sql `update party_person set display_name = ${displayName}
|
|
55
|
+
where id = ${id} returning ${columns}`);
|
|
56
|
+
return rows[0];
|
|
57
|
+
}),
|
|
58
|
+
erase: Effect.fn("PersonStore.postgres.erase")(function* (id) {
|
|
59
|
+
yield* UnitOfWork.required;
|
|
60
|
+
yield* sql `delete from party_person where id = ${id}`.pipe(Effect.mapError(unavailable));
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { PartyInputInvalid } from "../organisation/organisation.js";
|
|
3
|
+
export declare const Assignment: Schema.Struct<{
|
|
4
|
+
readonly personId: Schema.brand<Schema.NonEmptyString, "ActorId">;
|
|
5
|
+
readonly roleKey: Schema.NonEmptyString;
|
|
6
|
+
readonly organisationId: Schema.NullOr<Schema.NonEmptyString>;
|
|
7
|
+
}>;
|
|
8
|
+
export type Assignment = typeof Assignment.Type;
|
|
9
|
+
export declare const validateAssignment: (input: Assignment) => Effect.Effect<{
|
|
10
|
+
readonly personId: string & import("effect/Brand").Brand<"ActorId">;
|
|
11
|
+
readonly roleKey: string;
|
|
12
|
+
readonly organisationId: string | null;
|
|
13
|
+
}, PartyInputInvalid, never>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActorId } from "@house-rules/domain/contract";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import { PartyInputInvalid } from "../organisation/organisation.js";
|
|
4
|
+
export const Assignment = Schema.Struct({
|
|
5
|
+
personId: ActorId,
|
|
6
|
+
roleKey: Schema.NonEmptyString,
|
|
7
|
+
organisationId: Schema.NullOr(Schema.NonEmptyString),
|
|
8
|
+
});
|
|
9
|
+
export const validateAssignment = (input) => Schema.decodeEffect(Assignment)(input).pipe(Effect.mapError(() => new PartyInputInvalid({ message: "Invalid role assignment." })));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { PartyStore } from "../storage.js";
|
|
3
|
+
export declare const makeHolders: (store: PartyStore["Service"], limit: number) => {
|
|
4
|
+
holdersOf: (input: {
|
|
5
|
+
readonly role: string;
|
|
6
|
+
readonly scope?: string | null;
|
|
7
|
+
}) => Effect.Effect<{
|
|
8
|
+
ids: (string & import("effect/Brand").Brand<"ActorId">)[];
|
|
9
|
+
truncated: boolean;
|
|
10
|
+
}, import("../contract.ts").PartyUnavailable, never>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
export const makeHolders = (store, limit) => ({
|
|
3
|
+
holdersOf: Effect.fn("Party.holdersOf")(function* (input) {
|
|
4
|
+
const ids = yield* store.holderIds(input.role, input.scope ?? null, limit + 1);
|
|
5
|
+
return { ids: ids.slice(0, limit), truncated: ids.length > limit };
|
|
6
|
+
}),
|
|
7
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Invitation, CreatedInvitation, InvitationAcceptance } from "./invitation/invitation.js";
|
|
2
|
+
export { Assignment } from "./assignment/assignment.js";
|
|
3
|
+
export { Organisation, OrganisationId, PartyNotFound, PartyInputInvalid, PartyDenied, PartyConflict, PartyLastAdmin, PartyUnavailable, } from "./organisation/organisation.js";
|
|
4
|
+
export { Relationship, PartyReference } from "./relationship/relationship.js";
|
|
5
|
+
export { Role, RoleKey, RolePermission, type BuiltInRoles, type PartyOptions, } from "./role/role.js";
|
|
6
|
+
export { DisplayName, Person, PersonAlreadyExists, PersonCallerDenied, PersonInputInvalid, PersonNotFound, PersonStoreUnavailable, PersonUpdateRefused, } from "./person/person.js";
|
|
7
|
+
export { type PartyPermission, PartyPermissions } from "./person/permissions.js";
|
|
8
|
+
export { PartyOperations } from "./person/operations.js";
|
|
9
|
+
export { Principal, PrincipalKind, PrincipalHandle, CreatePrincipal, CreatedPrincipal, DisabledPrincipal, PrincipalCreated, PrincipalDisabled, PrincipalKindRefused, PrincipalDisabledRefused, } from "./person/principal.js";
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Invitation, CreatedInvitation, InvitationAcceptance } from "./invitation/invitation.js";
|
|
2
|
+
export { Assignment } from "./assignment/assignment.js";
|
|
3
|
+
export { Organisation, OrganisationId, PartyNotFound, PartyInputInvalid, PartyDenied, PartyConflict, PartyLastAdmin, PartyUnavailable, } from "./organisation/organisation.js";
|
|
4
|
+
export { Relationship, PartyReference } from "./relationship/relationship.js";
|
|
5
|
+
export { Role, RoleKey, RolePermission, } from "./role/role.js";
|
|
6
|
+
export { DisplayName, Person, PersonAlreadyExists, PersonCallerDenied, PersonInputInvalid, PersonNotFound, PersonStoreUnavailable, PersonUpdateRefused, } from "./person/person.js";
|
|
7
|
+
export { PartyPermissions } from "./person/permissions.js";
|
|
8
|
+
export { PartyOperations } from "./person/operations.js";
|
|
9
|
+
export { Principal, PrincipalKind, PrincipalHandle, CreatePrincipal, CreatedPrincipal, DisabledPrincipal, PrincipalCreated, PrincipalDisabled, PrincipalKindRefused, PrincipalDisabledRefused, } from "./person/principal.js";
|
package/dist/facade.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MaySocket } from "@house-rules/application";
|
|
2
|
+
import { Effect, Layer } from "effect";
|
|
3
|
+
import { PartyInputInvalid } from "./organisation/organisation.js";
|
|
4
|
+
import { makeParty } from "./person/party.js";
|
|
5
|
+
import { makePrincipals } from "./person/principals.js";
|
|
6
|
+
import { makeAccess } from "./role/access.js";
|
|
7
|
+
import type { PartyOptions } from "./role/role.js";
|
|
8
|
+
import { PartyStore, PersonStore } from "./storage.js";
|
|
9
|
+
type PartyService = ReturnType<typeof makeParty> & ReturnType<typeof makeAccess> & ReturnType<typeof makePrincipals>;
|
|
10
|
+
export type PartyFailure = Effect.Error<ReturnType<PartyService[keyof PartyService]>>;
|
|
11
|
+
declare const Party_base: import("effect/Context").ServiceClass<Party, "party", PartyService> & {
|
|
12
|
+
readonly id: "party";
|
|
13
|
+
} & {
|
|
14
|
+
readonly make: (options: PartyOptions) => Effect.Effect<PartyService, PartyInputInvalid, PartyStore | PersonStore>;
|
|
15
|
+
readonly layer: (options: PartyOptions) => import("@house-rules/domain").ModuleLayer<Party, PartyInputInvalid, PartyStore | PersonStore>;
|
|
16
|
+
};
|
|
17
|
+
export declare class Party extends Party_base {
|
|
18
|
+
static readonly layerMemory: (options: PartyOptions) => Layer.Layer<Party, PartyInputInvalid, never>;
|
|
19
|
+
static readonly layerPostgres: (options: PartyOptions) => Layer.Layer<Party, PartyInputInvalid, import("effect/sql/SqlClient").SqlClient>;
|
|
20
|
+
static readonly may: (_options?: Record<never, never>) => Effect.Effect<MaySocket<import("./organisation/organisation.js").PartyUnavailable>, never, Party>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
package/dist/facade.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineModule } from "@house-rules/domain";
|
|
2
|
+
import { Effect, Layer, Option, Schema } from "effect";
|
|
3
|
+
import { memoryPersonStore } from "./adapters/memory/person.js";
|
|
4
|
+
import { postgresPersonStore } from "./adapters/postgres/person.js";
|
|
5
|
+
import { memoryPartyStore } from "./adapters/memory/party.js";
|
|
6
|
+
import { postgresPartyStore } from "./adapters/postgres/party.js";
|
|
7
|
+
import { PartyInputInvalid, PartyUnavailable } from "./organisation/organisation.js";
|
|
8
|
+
import { makeParty } from "./person/party.js";
|
|
9
|
+
import { makePrincipals } from "./person/principals.js";
|
|
10
|
+
import { makeAccess } from "./role/access.js";
|
|
11
|
+
import { PermissionCatalogue } from "@house-rules/application";
|
|
12
|
+
import { PartyStore, PersonStore } from "./storage.js";
|
|
13
|
+
export class Party extends defineModule()("party", {
|
|
14
|
+
make: (options) => Effect.gen(function* () {
|
|
15
|
+
const holdersLimit = yield* Schema.decodeEffect(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER - 1)))(options.holdersLimit ?? 1000).pipe(Effect.mapError(() => new PartyInputInvalid({ message: "Invalid holders limit." })));
|
|
16
|
+
const persons = yield* PersonStore;
|
|
17
|
+
const store = yield* PartyStore;
|
|
18
|
+
const catalogue = Option.getOrUndefined(yield* Effect.serviceOption(PermissionCatalogue));
|
|
19
|
+
return {
|
|
20
|
+
...makeParty(persons),
|
|
21
|
+
...makePrincipals(persons, options),
|
|
22
|
+
...makeAccess(store, {
|
|
23
|
+
find: (id) => persons.find(id).pipe(Effect.mapError((cause) => new PartyUnavailable({ cause }))),
|
|
24
|
+
principal: (id) => persons
|
|
25
|
+
.principal(id)
|
|
26
|
+
.pipe(Effect.mapError((cause) => new PartyUnavailable({ cause }))),
|
|
27
|
+
list: (ids) => persons.list(ids).pipe(Effect.mapError((cause) => new PartyUnavailable({ cause }))),
|
|
28
|
+
}, { ...options, holdersLimit }, catalogue),
|
|
29
|
+
};
|
|
30
|
+
}),
|
|
31
|
+
}) {
|
|
32
|
+
static layerMemory = (options) => this.layer(options).pipe(Layer.provide(Layer.merge(memoryPersonStore(), memoryPartyStore())));
|
|
33
|
+
static layerPostgres = (options) => this.layer(options).pipe(Layer.provide(Layer.merge(postgresPersonStore, postgresPartyStore)));
|
|
34
|
+
static may = (_options) => Effect.map(Party, (party) => ({ permissionsOf: party.permissionsOf }));
|
|
35
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
export { Principal, PrincipalKind, PrincipalHandle, CreatePrincipal, CreatedPrincipal, DisabledPrincipal, PrincipalCreated, PrincipalDisabled, PrincipalKindRefused, PrincipalDisabledRefused, } from "./contract.js";
|
|
2
|
+
export { bindParty } from "./person/bind-party.js";
|
|
3
|
+
export { Party, type PartyFailure } from "./facade.js";
|
|
4
|
+
export { PartyStore, PersonStore } from "./storage.js";
|
|
5
|
+
import { Party } from "./facade.js";
|
|
6
|
+
import { bindParty } from "./person/bind-party.js";
|
|
7
|
+
export declare const PartyMount: {
|
|
8
|
+
map: {
|
|
9
|
+
name: string;
|
|
10
|
+
kind: "package";
|
|
11
|
+
package: string;
|
|
12
|
+
};
|
|
13
|
+
service: typeof Party;
|
|
14
|
+
operations: (import("@house-rules/domain").Operation<"Party.acceptInvitation", import("effect/Schema").Struct<{
|
|
15
|
+
readonly code: import("effect/Schema").String;
|
|
16
|
+
}>, import("effect/Schema").Struct<{
|
|
17
|
+
readonly organisationId: import("effect/Schema").String;
|
|
18
|
+
readonly roleKey: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
19
|
+
readonly personId: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
20
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.assignRole", import("effect/Schema").Struct<{
|
|
21
|
+
readonly personId: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
22
|
+
readonly roleKey: import("effect/Schema").NonEmptyString;
|
|
23
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").NonEmptyString>;
|
|
24
|
+
}>, import("effect/Schema").Void, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.canAdminOrganisation", import("effect/Schema").Struct<{
|
|
25
|
+
readonly organisationId: import("effect/Schema").String;
|
|
26
|
+
}>, import("effect/Schema").Boolean, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.createInvitation", import("effect/Schema").Struct<{
|
|
27
|
+
readonly organisationId: import("effect/Schema").String;
|
|
28
|
+
readonly roleKey: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
29
|
+
}>, import("effect/Schema").Struct<{
|
|
30
|
+
readonly invitation: import("effect/Schema").Struct<{
|
|
31
|
+
readonly id: import("effect/Schema").String;
|
|
32
|
+
readonly organisationId: import("effect/Schema").String;
|
|
33
|
+
readonly roleKey: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
34
|
+
readonly createdBy: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
35
|
+
readonly expiresAt: import("effect/Schema").Finite;
|
|
36
|
+
readonly state: import("effect/Schema").Literals<readonly ["pending", "used", "revoked"]>;
|
|
37
|
+
}>;
|
|
38
|
+
readonly code: import("effect/Schema").String;
|
|
39
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.createOrganisation", import("effect/Schema").Struct<{
|
|
40
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
41
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
42
|
+
}>, import("effect/Schema").Struct<{
|
|
43
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
44
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
45
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.createPerson", import("effect/Schema").Struct<{
|
|
46
|
+
readonly displayName: import("effect/Schema").String;
|
|
47
|
+
readonly id: import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
48
|
+
}>, import("effect/Schema").Struct<{
|
|
49
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
50
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
51
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
52
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonAlreadyExists, typeof import("./contract.js").PersonCallerDenied, typeof import("./contract.js").PersonInputInvalid, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.createPrincipal", import("effect/Schema").Struct<{
|
|
53
|
+
readonly id: import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
54
|
+
readonly displayName: import("effect/Schema").String;
|
|
55
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
56
|
+
readonly handle: import("effect/Schema").String;
|
|
57
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
58
|
+
}>, import("effect/Schema").Struct<{
|
|
59
|
+
readonly principal: import("effect/Schema").Struct<{
|
|
60
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
61
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
62
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
63
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
64
|
+
readonly handle: import("effect/Schema").String;
|
|
65
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
66
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
67
|
+
}>;
|
|
68
|
+
readonly fact: import("effect/Schema").Struct<{
|
|
69
|
+
readonly kind: import("effect/Schema").Literal<"principal.created">;
|
|
70
|
+
readonly after: import("effect/Schema").Struct<{
|
|
71
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
72
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
73
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
74
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
75
|
+
readonly handle: import("effect/Schema").String;
|
|
76
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
77
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
78
|
+
}>;
|
|
79
|
+
}>;
|
|
80
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonAlreadyExists, typeof import("./contract.js").PersonCallerDenied, typeof import("./contract.js").PersonInputInvalid, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.defineRole", import("effect/Schema").Struct<{
|
|
81
|
+
readonly key: import("effect/Schema").String;
|
|
82
|
+
readonly name: import("effect/Schema").String;
|
|
83
|
+
readonly permissions: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
84
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
85
|
+
}>, import("effect/Schema").Struct<{
|
|
86
|
+
readonly key: import("effect/Schema").NonEmptyString;
|
|
87
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
88
|
+
readonly permissions: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
89
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").NonEmptyString>;
|
|
90
|
+
readonly builtIn: import("effect/Schema").Boolean;
|
|
91
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.deleteRole", import("effect/Schema").Struct<{
|
|
92
|
+
readonly key: import("effect/Schema").String;
|
|
93
|
+
}>, import("effect/Schema").Void, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, true, true, true> | import("@house-rules/domain").Operation<"Party.disable", import("effect/Schema").Struct<{
|
|
94
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
95
|
+
}>, import("effect/Schema").Struct<{
|
|
96
|
+
readonly principal: import("effect/Schema").Struct<{
|
|
97
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
98
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
99
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
100
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
101
|
+
readonly handle: import("effect/Schema").String;
|
|
102
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
103
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
104
|
+
}>;
|
|
105
|
+
readonly fact: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
106
|
+
readonly kind: import("effect/Schema").Literal<"principal.disabled">;
|
|
107
|
+
readonly before: import("effect/Schema").Struct<{
|
|
108
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
109
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
110
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
111
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
112
|
+
readonly handle: import("effect/Schema").String;
|
|
113
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
114
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
115
|
+
}>;
|
|
116
|
+
readonly after: import("effect/Schema").Struct<{
|
|
117
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
118
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
119
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
120
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
121
|
+
readonly handle: import("effect/Schema").String;
|
|
122
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
123
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
124
|
+
}>;
|
|
125
|
+
}>>;
|
|
126
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonNotFound, typeof import("./contract.js").PersonCallerDenied, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, false, true, true, true> | import("@house-rules/domain").Operation<"Party.findPrincipal", import("effect/Schema").Struct<{
|
|
127
|
+
readonly handle: import("effect/Schema").String;
|
|
128
|
+
}>, import("effect/Schema").Struct<{
|
|
129
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
130
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
131
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
132
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
133
|
+
readonly handle: import("effect/Schema").String;
|
|
134
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
135
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
136
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonNotFound, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.holdersOf", import("effect/Schema").Struct<{
|
|
137
|
+
readonly role: import("effect/Schema").NonEmptyString;
|
|
138
|
+
readonly scope: import("effect/Schema").optionalKey<import("effect/Schema").NullOr<import("effect/Schema").NonEmptyString>>;
|
|
139
|
+
}>, import("effect/Schema").Struct<{
|
|
140
|
+
readonly ids: import("effect/Schema").$Array<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
141
|
+
readonly truncated: import("effect/Schema").Boolean;
|
|
142
|
+
}>, typeof import("./contract.js").PartyUnavailable, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.isRelated", import("effect/Schema").Struct<{
|
|
143
|
+
readonly from: import("effect/Schema").Struct<{
|
|
144
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "organisation"]>;
|
|
145
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
146
|
+
}>;
|
|
147
|
+
readonly to: import("effect/Schema").Struct<{
|
|
148
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "organisation"]>;
|
|
149
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
150
|
+
}>;
|
|
151
|
+
readonly kind: import("effect/Schema").NonEmptyString;
|
|
152
|
+
}>, import("effect/Schema").Boolean, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.listInvitations", import("effect/Schema").Struct<{
|
|
153
|
+
readonly organisationId: import("effect/Schema").String;
|
|
154
|
+
}>, import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
155
|
+
readonly id: import("effect/Schema").String;
|
|
156
|
+
readonly organisationId: import("effect/Schema").String;
|
|
157
|
+
readonly roleKey: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
158
|
+
readonly createdBy: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
159
|
+
readonly expiresAt: import("effect/Schema").Finite;
|
|
160
|
+
readonly state: import("effect/Schema").Literals<readonly ["pending", "used", "revoked"]>;
|
|
161
|
+
}>>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.listMembers", import("effect/Schema").Struct<{
|
|
162
|
+
readonly organisationId: import("effect/Schema").String;
|
|
163
|
+
}>, import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
164
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
165
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
166
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
167
|
+
readonly relation: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
168
|
+
readonly roles: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
169
|
+
readonly roleKey: import("effect/Schema").String;
|
|
170
|
+
readonly roleName: import("effect/Schema").String;
|
|
171
|
+
}>>;
|
|
172
|
+
}>>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.listPeople", import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Never>, import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
173
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
174
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
175
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
176
|
+
readonly assignments: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
177
|
+
readonly roleKey: import("effect/Schema").String;
|
|
178
|
+
readonly roleName: import("effect/Schema").String;
|
|
179
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
180
|
+
readonly organisationName: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
181
|
+
}>>;
|
|
182
|
+
readonly organisations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
183
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
184
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
185
|
+
readonly relation: import("effect/Schema").String;
|
|
186
|
+
}>>;
|
|
187
|
+
}>>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.listRoles", import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Never>, import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
188
|
+
readonly key: import("effect/Schema").NonEmptyString;
|
|
189
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
190
|
+
readonly permissions: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
191
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").NonEmptyString>;
|
|
192
|
+
readonly builtIn: import("effect/Schema").Boolean;
|
|
193
|
+
}>>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.lockActive", import("effect/Schema").Struct<{
|
|
194
|
+
readonly handle: import("effect/Schema").String;
|
|
195
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
196
|
+
}>, import("effect/Schema").Struct<{
|
|
197
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
198
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
199
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
200
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
201
|
+
readonly handle: import("effect/Schema").String;
|
|
202
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
203
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
204
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonNotFound, typeof import("./contract.js").PrincipalKindRefused, typeof import("./contract.js").PrincipalDisabledRefused, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.myAccess", import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Never>, import("effect/Schema").Struct<{
|
|
205
|
+
readonly roles: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
206
|
+
readonly personId: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
207
|
+
readonly roleKey: import("effect/Schema").NonEmptyString;
|
|
208
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").NonEmptyString>;
|
|
209
|
+
}>>;
|
|
210
|
+
readonly permissions: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
211
|
+
readonly catalogue: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
212
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.myOrganisations", import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Never>, import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
213
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
214
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
215
|
+
readonly relation: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
216
|
+
readonly roles: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
217
|
+
readonly roleKey: import("effect/Schema").String;
|
|
218
|
+
readonly roleName: import("effect/Schema").String;
|
|
219
|
+
readonly permissions: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
220
|
+
}>>;
|
|
221
|
+
}>>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.principalsByIds", import("effect/Schema").Struct<{
|
|
222
|
+
readonly ids: import("effect/Schema").$Array<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
223
|
+
}>, import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
224
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
225
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
226
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
227
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "agent"]>;
|
|
228
|
+
readonly handle: import("effect/Schema").String;
|
|
229
|
+
readonly createdBy: import("effect/Schema").NullOr<import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">>;
|
|
230
|
+
readonly disabledAt: import("effect/Schema").NullOr<import("effect/Schema").Int>;
|
|
231
|
+
}>>, typeof import("./contract.js").PersonStoreUnavailable, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.relate", import("effect/Schema").Struct<{
|
|
232
|
+
readonly from: import("effect/Schema").Struct<{
|
|
233
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "organisation"]>;
|
|
234
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
235
|
+
}>;
|
|
236
|
+
readonly to: import("effect/Schema").Struct<{
|
|
237
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "organisation"]>;
|
|
238
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
239
|
+
}>;
|
|
240
|
+
readonly kind: import("effect/Schema").NonEmptyString;
|
|
241
|
+
}>, import("effect/Schema").Void, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.renamePerson", import("effect/Schema").Struct<{
|
|
242
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
243
|
+
readonly displayName: import("effect/Schema").String;
|
|
244
|
+
}>, import("effect/Schema").Struct<{
|
|
245
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
246
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
247
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
248
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonInputInvalid, typeof import("./contract.js").PersonNotFound, typeof import("./contract.js").PersonUpdateRefused, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, false, false, true, false> | import("@house-rules/domain").Operation<"Party.revokeInvitation", import("effect/Schema").Struct<{
|
|
249
|
+
readonly id: import("effect/Schema").String;
|
|
250
|
+
}>, import("effect/Schema").Void, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, true, true, true> | import("@house-rules/domain").Operation<"Party.revokeRole", import("effect/Schema").Struct<{
|
|
251
|
+
readonly personId: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
252
|
+
readonly roleKey: import("effect/Schema").NonEmptyString;
|
|
253
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").NonEmptyString>;
|
|
254
|
+
}>, import("effect/Schema").Void, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, true, true, true> | import("@house-rules/domain").Operation<"Party.rolesOf", import("effect/Schema").Struct<{
|
|
255
|
+
readonly personId: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
256
|
+
}>, import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
257
|
+
readonly personId: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
258
|
+
readonly roleKey: import("effect/Schema").NonEmptyString;
|
|
259
|
+
readonly organisationId: import("effect/Schema").NullOr<import("effect/Schema").NonEmptyString>;
|
|
260
|
+
}>>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.showMe", import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Never>, import("effect/Schema").Struct<{
|
|
261
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
262
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
263
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
264
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonNotFound, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.showOrganisation", import("effect/Schema").Struct<{
|
|
265
|
+
readonly id: import("effect/Schema").String;
|
|
266
|
+
}>, import("effect/Schema").Struct<{
|
|
267
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
268
|
+
readonly name: import("effect/Schema").NonEmptyString;
|
|
269
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.showPerson", import("effect/Schema").Struct<{
|
|
270
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
271
|
+
}>, import("effect/Schema").Struct<{
|
|
272
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").NonEmptyString, "ActorId">;
|
|
273
|
+
readonly displayName: import("effect/Schema").Trim;
|
|
274
|
+
readonly createdAt: import("effect/Schema").Int;
|
|
275
|
+
}>, import("effect/Schema").Union<readonly [typeof import("./contract.js").PersonNotFound, typeof import("./contract.js").PersonStoreUnavailable]>, NoInfer<readonly []>, true, false, false, false> | import("@house-rules/domain").Operation<"Party.unrelate", import("effect/Schema").Struct<{
|
|
276
|
+
readonly from: import("effect/Schema").Struct<{
|
|
277
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "organisation"]>;
|
|
278
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
279
|
+
}>;
|
|
280
|
+
readonly to: import("effect/Schema").Struct<{
|
|
281
|
+
readonly kind: import("effect/Schema").Literals<readonly ["person", "organisation"]>;
|
|
282
|
+
readonly id: import("effect/Schema").NonEmptyString;
|
|
283
|
+
}>;
|
|
284
|
+
readonly kind: import("effect/Schema").NonEmptyString;
|
|
285
|
+
}>, import("effect/Schema").Void, import("effect/Schema").Union<readonly [typeof import("./contract.js").PartyLastAdmin, typeof import("./contract.js").PartyConflict, typeof import("./contract.js").PartyDenied, typeof import("./contract.js").PartyInputInvalid, typeof import("./contract.js").PartyNotFound, typeof import("./contract.js").PartyUnavailable]>, NoInfer<readonly []>, false, true, true, true>)[];
|
|
286
|
+
bind: typeof bindParty;
|
|
287
|
+
};
|
|
288
|
+
export { memoryPartyStore } from "./adapters/memory/party.js";
|
|
289
|
+
export { postgresPartyStore } from "./adapters/postgres/party.js";
|
|
290
|
+
export { Assignment, Organisation, OrganisationId, PartyNotFound, PartyInputInvalid, PartyDenied, PartyConflict, PartyLastAdmin, PartyUnavailable, Relationship, PartyReference, Role, RoleKey, RolePermission, type BuiltInRoles, type PartyOptions, } from "./contract.js";
|
|
291
|
+
export { personPolicy } from "./person/policy.js";
|
|
292
|
+
export { memoryPersonStore } from "./adapters/memory/person.js";
|
|
293
|
+
export { postgresPersonStore } from "./adapters/postgres/person.js";
|
|
294
|
+
export { DisplayName, type PartyPermission, PartyPermissions, Person, PersonAlreadyExists, PersonCallerDenied, PartyOperations, PersonInputInvalid, PersonNotFound, PersonStoreUnavailable, PersonUpdateRefused, } from "./contract.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Principal, PrincipalKind, PrincipalHandle, CreatePrincipal, CreatedPrincipal, DisabledPrincipal, PrincipalCreated, PrincipalDisabled, PrincipalKindRefused, PrincipalDisabledRefused, } from "./contract.js";
|
|
2
|
+
export { bindParty } from "./person/bind-party.js";
|
|
3
|
+
export { Party } from "./facade.js";
|
|
4
|
+
export { PartyStore, PersonStore } from "./storage.js";
|
|
5
|
+
import { Party } from "./facade.js";
|
|
6
|
+
import { PartyOperations } from "./contract.js";
|
|
7
|
+
import { bindParty } from "./person/bind-party.js";
|
|
8
|
+
export const PartyMount = {
|
|
9
|
+
map: { name: "party", kind: "package", package: "@house-rules/party" },
|
|
10
|
+
service: Party,
|
|
11
|
+
operations: Object.values(PartyOperations),
|
|
12
|
+
bind: bindParty,
|
|
13
|
+
};
|
|
14
|
+
export { memoryPartyStore } from "./adapters/memory/party.js";
|
|
15
|
+
export { postgresPartyStore } from "./adapters/postgres/party.js";
|
|
16
|
+
export { Assignment, Organisation, OrganisationId, PartyNotFound, PartyInputInvalid, PartyDenied, PartyConflict, PartyLastAdmin, PartyUnavailable, Relationship, PartyReference, Role, RoleKey, RolePermission, } from "./contract.js";
|
|
17
|
+
export { personPolicy } from "./person/policy.js";
|
|
18
|
+
export { memoryPersonStore } from "./adapters/memory/person.js";
|
|
19
|
+
export { postgresPersonStore } from "./adapters/postgres/person.js";
|
|
20
|
+
export { DisplayName, PartyPermissions, Person, PersonAlreadyExists, PersonCallerDenied, PartyOperations, PersonInputInvalid, PersonNotFound, PersonStoreUnavailable, PersonUpdateRefused, } from "./contract.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const Invitation: Schema.Struct<{
|
|
3
|
+
readonly id: Schema.String;
|
|
4
|
+
readonly organisationId: Schema.String;
|
|
5
|
+
readonly roleKey: Schema.NullOr<Schema.String>;
|
|
6
|
+
readonly createdBy: Schema.brand<Schema.NonEmptyString, "ActorId">;
|
|
7
|
+
readonly expiresAt: Schema.Finite;
|
|
8
|
+
readonly state: Schema.Literals<readonly ["pending", "used", "revoked"]>;
|
|
9
|
+
}>;
|
|
10
|
+
export type Invitation = typeof Invitation.Type;
|
|
11
|
+
export declare const StoredInvitation: Schema.Struct<{
|
|
12
|
+
readonly id: Schema.String;
|
|
13
|
+
readonly organisationId: Schema.String;
|
|
14
|
+
readonly roleKey: Schema.NullOr<Schema.String>;
|
|
15
|
+
readonly createdBy: Schema.brand<Schema.NonEmptyString, "ActorId">;
|
|
16
|
+
readonly expiresAt: Schema.Finite;
|
|
17
|
+
readonly state: Schema.Literals<readonly ["pending", "used", "revoked"]>;
|
|
18
|
+
readonly codeHash: Schema.String;
|
|
19
|
+
}>;
|
|
20
|
+
export type StoredInvitation = typeof StoredInvitation.Type;
|
|
21
|
+
export declare const InvitationAcceptance: Schema.Struct<{
|
|
22
|
+
readonly organisationId: Schema.String;
|
|
23
|
+
readonly roleKey: Schema.NullOr<Schema.String>;
|
|
24
|
+
readonly personId: Schema.brand<Schema.NonEmptyString, "ActorId">;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const CreatedInvitation: Schema.Struct<{
|
|
27
|
+
readonly invitation: Schema.Struct<{
|
|
28
|
+
readonly id: Schema.String;
|
|
29
|
+
readonly organisationId: Schema.String;
|
|
30
|
+
readonly roleKey: Schema.NullOr<Schema.String>;
|
|
31
|
+
readonly createdBy: Schema.brand<Schema.NonEmptyString, "ActorId">;
|
|
32
|
+
readonly expiresAt: Schema.Finite;
|
|
33
|
+
readonly state: Schema.Literals<readonly ["pending", "used", "revoked"]>;
|
|
34
|
+
}>;
|
|
35
|
+
readonly code: Schema.String;
|
|
36
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActorId } from "@house-rules/domain/contract";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export const Invitation = Schema.Struct({
|
|
4
|
+
id: Schema.String,
|
|
5
|
+
organisationId: Schema.String,
|
|
6
|
+
roleKey: Schema.NullOr(Schema.String),
|
|
7
|
+
createdBy: ActorId,
|
|
8
|
+
expiresAt: Schema.Finite,
|
|
9
|
+
state: Schema.Literals(["pending", "used", "revoked"]),
|
|
10
|
+
});
|
|
11
|
+
export const StoredInvitation = Schema.Struct({ ...Invitation.fields, codeHash: Schema.String });
|
|
12
|
+
export const InvitationAcceptance = Schema.Struct({
|
|
13
|
+
organisationId: Schema.String,
|
|
14
|
+
roleKey: Schema.NullOr(Schema.String),
|
|
15
|
+
personId: ActorId,
|
|
16
|
+
});
|
|
17
|
+
export const CreatedInvitation = Schema.Struct({ invitation: Invitation, code: Schema.String });
|