@happyvertical/directory 0.74.8
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/AGENT.md +34 -0
- package/LICENSE +7 -0
- package/dist/adapters/aws.d.ts +39 -0
- package/dist/adapters/aws.d.ts.map +1 -0
- package/dist/adapters/kanidm.d.ts +41 -0
- package/dist/adapters/kanidm.d.ts.map +1 -0
- package/dist/adapters/postgres.d.ts +73 -0
- package/dist/adapters/postgres.d.ts.map +1 -0
- package/dist/adapters/stalwart.d.ts +39 -0
- package/dist/adapters/stalwart.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1942 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/errors.d.ts +33 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/factory.d.ts +36 -0
- package/dist/shared/factory.d.ts.map +1 -0
- package/dist/shared/types.d.ts +321 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/metadata.json +32 -0
- package/package.json +70 -0
package/AGENT.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @happyvertical/directory
|
|
2
|
+
|
|
3
|
+
<!-- BEGIN AGENT:GENERATED -->
|
|
4
|
+
## Purpose
|
|
5
|
+
Unified directory services with adapter-based architecture (Kanidm, Stalwart, PostgreSQL, AWS)
|
|
6
|
+
|
|
7
|
+
## Package Map
|
|
8
|
+
- Package: `@happyvertical/directory`
|
|
9
|
+
- Hierarchy path: `@happyvertical/sdk > packages > directory`
|
|
10
|
+
- Workspace position: `7 of 30` local packages
|
|
11
|
+
- Internal dependencies: `@happyvertical/utils`
|
|
12
|
+
- Internal dependents: none
|
|
13
|
+
- Knowledge graph files: `AGENT.md`, `metadata.json`, `ecosystem-manifest.json`
|
|
14
|
+
|
|
15
|
+
## Build & Test
|
|
16
|
+
```bash
|
|
17
|
+
pnpm --filter @happyvertical/directory build
|
|
18
|
+
pnpm --filter @happyvertical/directory test
|
|
19
|
+
pnpm --filter @happyvertical/directory typecheck
|
|
20
|
+
pnpm --filter @happyvertical/directory clean
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Agent Correction Loops
|
|
24
|
+
- If module resolution or export errors mention a workspace dependency, build the dependency first (`pnpm --filter @happyvertical/utils build`) and then rerun `pnpm --filter @happyvertical/directory build`.
|
|
25
|
+
- If tests or exports fail after API, type, or bundle changes, run `pnpm --filter @happyvertical/directory clean` followed by `pnpm --filter @happyvertical/directory build` and `pnpm --filter @happyvertical/directory test`.
|
|
26
|
+
- If failures span multiple packages or Turborepo ordering looks wrong, run `pnpm build` and `pnpm typecheck` from the repo root before retrying package-scoped commands.
|
|
27
|
+
|
|
28
|
+
## Ecosystem Relationships
|
|
29
|
+
- Provides: Unified directory services with adapter-based architecture (Kanidm, Stalwart, PostgreSQL, AWS)
|
|
30
|
+
- Implements: none
|
|
31
|
+
- Requires: @happyvertical/utils, @aws-sdk/client-iam, @aws-sdk/client-organizations, pg
|
|
32
|
+
- Stability: stable (Primary package surface is described as implemented and production-oriented.)
|
|
33
|
+
<!-- END AGENT:GENERATED -->
|
|
34
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright <2025> <Happy Vertical Corporation>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AwsAccessKey, AwsAccount, AwsAccountCreationStatus, AwsDirectoryAdapter, AwsIamUser, AwsOptions, AwsOrganizationalUnit, CreateAwsAccountInput, CreateAwsIamUserInput, CreateAwsOuInput, CreateGroupInput, CreateUserInput, DirectoryGroup, DirectoryUser, UpdateGroupInput, UpdateUserInput } from '../shared/types.js';
|
|
2
|
+
export declare class AwsAdapter implements AwsDirectoryAdapter {
|
|
3
|
+
readonly options: AwsOptions;
|
|
4
|
+
private readonly orgs;
|
|
5
|
+
private readonly iam;
|
|
6
|
+
constructor(options: AwsOptions);
|
|
7
|
+
testConnection(): Promise<boolean>;
|
|
8
|
+
disconnect(): Promise<void>;
|
|
9
|
+
createUser(input: CreateUserInput): Promise<DirectoryUser>;
|
|
10
|
+
getUser(id: string): Promise<DirectoryUser>;
|
|
11
|
+
updateUser(id: string, _input: UpdateUserInput): Promise<DirectoryUser>;
|
|
12
|
+
deleteUser(id: string): Promise<void>;
|
|
13
|
+
listUsers(): Promise<DirectoryUser[]>;
|
|
14
|
+
createGroup(input: CreateGroupInput): Promise<DirectoryGroup>;
|
|
15
|
+
getGroup(id: string): Promise<DirectoryGroup>;
|
|
16
|
+
updateGroup(id: string, _input: UpdateGroupInput): Promise<DirectoryGroup>;
|
|
17
|
+
deleteGroup(id: string): Promise<void>;
|
|
18
|
+
listGroups(): Promise<DirectoryGroup[]>;
|
|
19
|
+
addUserToGroup(userId: string, groupId: string): Promise<void>;
|
|
20
|
+
removeUserFromGroup(userId: string, groupId: string): Promise<void>;
|
|
21
|
+
getGroupMembers(groupId: string): Promise<DirectoryUser[]>;
|
|
22
|
+
getUserGroups(userId: string): Promise<DirectoryGroup[]>;
|
|
23
|
+
createOrganizationalUnit(input: CreateAwsOuInput): Promise<AwsOrganizationalUnit>;
|
|
24
|
+
getOrganizationalUnit(id: string): Promise<AwsOrganizationalUnit>;
|
|
25
|
+
listOrganizationalUnits(parentId: string): Promise<AwsOrganizationalUnit[]>;
|
|
26
|
+
createAccount(input: CreateAwsAccountInput): Promise<AwsAccountCreationStatus>;
|
|
27
|
+
getAccountCreationStatus(id: string): Promise<AwsAccountCreationStatus>;
|
|
28
|
+
listAccounts(): Promise<AwsAccount[]>;
|
|
29
|
+
moveAccount(accountId: string, sourceParentId: string, destParentId: string): Promise<void>;
|
|
30
|
+
createIamUser(input: CreateAwsIamUserInput): Promise<AwsIamUser>;
|
|
31
|
+
getIamUser(username: string): Promise<AwsIamUser>;
|
|
32
|
+
deleteIamUser(username: string): Promise<void>;
|
|
33
|
+
listIamUsers(): Promise<AwsIamUser[]>;
|
|
34
|
+
attachUserPolicy(username: string, policyArn: string): Promise<void>;
|
|
35
|
+
detachUserPolicy(username: string, policyArn: string): Promise<void>;
|
|
36
|
+
createAccessKey(username: string): Promise<AwsAccessKey>;
|
|
37
|
+
deleteAccessKey(username: string, accessKeyId: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=aws.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws.d.ts","sourceRoot":"","sources":["../../src/adapters/aws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAsCH,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AA2G5B,qBAAa,UAAW,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|
+
import { CreateGroupInput, CreateOAuth2ClientInput, CreateUserInput, CredentialResetIntent, DirectoryGroup, DirectoryUser, KanidmDirectoryAdapter, KanidmOptions, OAuth2Client, UpdateGroupInput, UpdateOAuth2ClientInput, UpdateUserInput } from '../shared/types.js';
|
|
2
|
+
export declare class KanidmAdapter implements KanidmDirectoryAdapter {
|
|
3
|
+
private readonly options;
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
private readonly timeout;
|
|
6
|
+
private adminToken;
|
|
7
|
+
private adminTokenExpiry;
|
|
8
|
+
constructor(options: KanidmOptions);
|
|
9
|
+
private getAdminToken;
|
|
10
|
+
private request;
|
|
11
|
+
private mapPersonToUser;
|
|
12
|
+
private mapGroupToDirectoryGroup;
|
|
13
|
+
private mapOAuth2Client;
|
|
14
|
+
private attrFirst;
|
|
15
|
+
testConnection(): Promise<boolean>;
|
|
16
|
+
disconnect(): Promise<void>;
|
|
17
|
+
createUser(input: CreateUserInput): Promise<DirectoryUser>;
|
|
18
|
+
getUser(id: string): Promise<DirectoryUser>;
|
|
19
|
+
updateUser(id: string, input: UpdateUserInput): Promise<DirectoryUser>;
|
|
20
|
+
deleteUser(id: string): Promise<void>;
|
|
21
|
+
listUsers(): Promise<DirectoryUser[]>;
|
|
22
|
+
createGroup(input: CreateGroupInput): Promise<DirectoryGroup>;
|
|
23
|
+
getGroup(id: string): Promise<DirectoryGroup>;
|
|
24
|
+
updateGroup(id: string, input: UpdateGroupInput): Promise<DirectoryGroup>;
|
|
25
|
+
deleteGroup(id: string): Promise<void>;
|
|
26
|
+
listGroups(): Promise<DirectoryGroup[]>;
|
|
27
|
+
addUserToGroup(userId: string, groupId: string): Promise<void>;
|
|
28
|
+
removeUserFromGroup(userId: string, groupId: string): Promise<void>;
|
|
29
|
+
getGroupMembers(groupId: string): Promise<DirectoryUser[]>;
|
|
30
|
+
getUserGroups(userId: string): Promise<DirectoryGroup[]>;
|
|
31
|
+
createOAuth2Client(input: CreateOAuth2ClientInput): Promise<OAuth2Client>;
|
|
32
|
+
getOAuth2Client(id: string): Promise<OAuth2Client>;
|
|
33
|
+
updateOAuth2Client(id: string, input: UpdateOAuth2ClientInput): Promise<OAuth2Client>;
|
|
34
|
+
deleteOAuth2Client(id: string): Promise<void>;
|
|
35
|
+
listOAuth2Clients(): Promise<OAuth2Client[]>;
|
|
36
|
+
getOAuth2ClientSecret(id: string): Promise<string>;
|
|
37
|
+
createCredentialResetIntent(userId: string, options?: {
|
|
38
|
+
ttl?: number;
|
|
39
|
+
}): Promise<CredentialResetIntent>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=kanidm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kanidm.d.ts","sourceRoot":"","sources":["../../src/adapters/kanidm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAmB5B,qBAAa,aAAc,YAAW,sBAAsB;IAM9C,OAAO,CAAC,QAAQ,CAAC,OAAO;IALpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,gBAAgB,CAAK;gBAEA,OAAO,EAAE,aAAa;YAkBrC,aAAa;YAwFb,OAAO;IAmErB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,SAAS;IAYX,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASlC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,C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C,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,iBAAiB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAS5C,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYlD,2BAA2B,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GACzB,OAAO,CAAC,qBAAqB,CAAC;CAYlC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CreateGroupInput, CreatePgDatabaseInput, CreatePgRoleInput, CreateUserInput, DirectoryGroup, DirectoryUser, PgDatabase, PgRole, PostgresDirectoryAdapter, PostgresOptions, UpdateGroupInput, UpdateUserInput } from '../shared/types.js';
|
|
2
|
+
export declare class PostgresAdapter implements PostgresDirectoryAdapter {
|
|
3
|
+
private options;
|
|
4
|
+
private client;
|
|
5
|
+
constructor(options: PostgresOptions);
|
|
6
|
+
/**
|
|
7
|
+
* Escape a SQL identifier by wrapping in double quotes and escaping
|
|
8
|
+
* any embedded double quotes. Used for DDL statements where
|
|
9
|
+
* parameterized queries are not supported.
|
|
10
|
+
*/
|
|
11
|
+
private escapeIdentifier;
|
|
12
|
+
/**
|
|
13
|
+
* Escape a SQL string literal by wrapping in single quotes and escaping
|
|
14
|
+
* any embedded single quotes. Used for DDL statements (e.g., passwords)
|
|
15
|
+
* where parameterized queries are not supported.
|
|
16
|
+
*/
|
|
17
|
+
private escapeLiteral;
|
|
18
|
+
/**
|
|
19
|
+
* Get or create the pg.Client instance. Connects lazily on first use.
|
|
20
|
+
*/
|
|
21
|
+
private getClient;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a role name is a system role that should be excluded from lists.
|
|
24
|
+
*/
|
|
25
|
+
private isSystemRole;
|
|
26
|
+
/**
|
|
27
|
+
* Map a pg_roles row to a DirectoryUser.
|
|
28
|
+
*/
|
|
29
|
+
private rowToUser;
|
|
30
|
+
/**
|
|
31
|
+
* Map a pg_roles row to a DirectoryGroup.
|
|
32
|
+
*/
|
|
33
|
+
private rowToGroup;
|
|
34
|
+
/**
|
|
35
|
+
* Map a pg_roles row to a PgRole.
|
|
36
|
+
*/
|
|
37
|
+
private rowToPgRole;
|
|
38
|
+
/**
|
|
39
|
+
* Map a pg_database row to a PgDatabase.
|
|
40
|
+
*/
|
|
41
|
+
private rowToDatabase;
|
|
42
|
+
/**
|
|
43
|
+
* Map PostgreSQL errors to directory error classes.
|
|
44
|
+
*/
|
|
45
|
+
private mapError;
|
|
46
|
+
testConnection(): Promise<boolean>;
|
|
47
|
+
disconnect(): Promise<void>;
|
|
48
|
+
createUser(input: CreateUserInput): Promise<DirectoryUser>;
|
|
49
|
+
getUser(id: string): Promise<DirectoryUser>;
|
|
50
|
+
updateUser(id: string, input: UpdateUserInput): Promise<DirectoryUser>;
|
|
51
|
+
deleteUser(id: string): Promise<void>;
|
|
52
|
+
listUsers(): Promise<DirectoryUser[]>;
|
|
53
|
+
createGroup(input: CreateGroupInput): Promise<DirectoryGroup>;
|
|
54
|
+
getGroup(id: string): Promise<DirectoryGroup>;
|
|
55
|
+
updateGroup(id: string, _input: UpdateGroupInput): Promise<DirectoryGroup>;
|
|
56
|
+
deleteGroup(id: string): Promise<void>;
|
|
57
|
+
listGroups(): Promise<DirectoryGroup[]>;
|
|
58
|
+
addUserToGroup(userId: string, groupId: string): Promise<void>;
|
|
59
|
+
removeUserFromGroup(userId: string, groupId: string): Promise<void>;
|
|
60
|
+
getGroupMembers(groupId: string): Promise<DirectoryUser[]>;
|
|
61
|
+
getUserGroups(userId: string): Promise<DirectoryGroup[]>;
|
|
62
|
+
createDatabase(input: CreatePgDatabaseInput): Promise<PgDatabase>;
|
|
63
|
+
getDatabase(name: string): Promise<PgDatabase>;
|
|
64
|
+
dropDatabase(name: string): Promise<void>;
|
|
65
|
+
listDatabases(): Promise<PgDatabase[]>;
|
|
66
|
+
createRole(input: CreatePgRoleInput): Promise<PgRole>;
|
|
67
|
+
getRole(name: string): Promise<PgRole>;
|
|
68
|
+
dropRole(name: string): Promise<void>;
|
|
69
|
+
listRoles(): Promise<PgRole[]>;
|
|
70
|
+
grantAccess(roleName: string, databaseName: string): Promise<void>;
|
|
71
|
+
revokeAccess(roleName: string, databaseName: string): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=postgres.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/adapters/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,UAAU,EACV,MAAM,EACN,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAkB5B,qBAAa,eAAgB,YAAW,wBAAwB;IAC9D,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,MAAM,CAA0B;gBAE5B,OAAO,EAAE,eAAe;IAQpC;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;YACW,SAAS;IA2BvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,SAAS;IAajB;;OAEG;IACH,OAAO,CAAC,UAAU;IAYlB;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;IACH,OAAO,CAAC,QAAQ;IA4DV,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAUlC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAkB1D,OAAO,CAAC,EAAE,EAAE,M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G,OAAO,CAAC,MAAM,CAAC;IAuCrD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqBtC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAyB9B,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAW1E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CreateDkimKeyInput, CreateGroupInput, CreateMailboxInput, CreateMailDomainInput, CreateUserInput, DirectoryGroup, DirectoryUser, DkimKey, DnsRecord, Mailbox, MailDomain, StalwartDirectoryAdapter, StalwartOptions, UpdateGroupInput, UpdateMailboxInput, UpdateUserInput } from '../shared/types.js';
|
|
2
|
+
export declare class StalwartAdapter implements StalwartDirectoryAdapter {
|
|
3
|
+
private readonly options;
|
|
4
|
+
private readonly authHeader;
|
|
5
|
+
constructor(options: StalwartOptions);
|
|
6
|
+
private get timeout();
|
|
7
|
+
private request;
|
|
8
|
+
testConnection(): Promise<boolean>;
|
|
9
|
+
disconnect(): Promise<void>;
|
|
10
|
+
createUser(input: CreateUserInput): Promise<DirectoryUser>;
|
|
11
|
+
getUser(id: string): Promise<DirectoryUser>;
|
|
12
|
+
updateUser(id: string, input: UpdateUserInput): Promise<DirectoryUser>;
|
|
13
|
+
deleteUser(id: string): Promise<void>;
|
|
14
|
+
listUsers(): Promise<DirectoryUser[]>;
|
|
15
|
+
createGroup(input: CreateGroupInput): Promise<DirectoryGroup>;
|
|
16
|
+
getGroup(id: string): Promise<DirectoryGroup>;
|
|
17
|
+
updateGroup(id: string, input: UpdateGroupInput): Promise<DirectoryGroup>;
|
|
18
|
+
deleteGroup(id: string): Promise<void>;
|
|
19
|
+
listGroups(): Promise<DirectoryGroup[]>;
|
|
20
|
+
addUserToGroup(userId: string, groupId: string): Promise<void>;
|
|
21
|
+
removeUserFromGroup(userId: string, groupId: string): Promise<void>;
|
|
22
|
+
getGroupMembers(groupId: string): Promise<DirectoryUser[]>;
|
|
23
|
+
getUserGroups(userId: string): Promise<DirectoryGroup[]>;
|
|
24
|
+
createDomain(input: CreateMailDomainInput): Promise<MailDomain>;
|
|
25
|
+
getDomain(id: string): Promise<MailDomain>;
|
|
26
|
+
deleteDomain(id: string): Promise<void>;
|
|
27
|
+
listDomains(): Promise<MailDomain[]>;
|
|
28
|
+
createDkimKey(input: CreateDkimKeyInput): Promise<DkimKey>;
|
|
29
|
+
getDnsRecords(domain: string): Promise<DnsRecord[]>;
|
|
30
|
+
createMailbox(input: CreateMailboxInput): Promise<Mailbox>;
|
|
31
|
+
getMailbox(id: string): Promise<Mailbox>;
|
|
32
|
+
updateMailbox(id: string, input: UpdateMailboxInput): Promise<Mailbox>;
|
|
33
|
+
deleteMailbox(id: string): Promise<void>;
|
|
34
|
+
listMailboxes(): Promise<Mailbox[]>;
|
|
35
|
+
private principalToUser;
|
|
36
|
+
private principalToGroup;
|
|
37
|
+
private principalToMailbox;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=stalwart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stalwart.d.ts","sourceRoot":"","sources":["../../src/adapters/stalwart.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,aAAa,EACb,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EACV,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAkB5B,qBAAa,eAAgB,YAAW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MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAgBxD,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;IAU/D,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAY1C,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,WAAW,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAepC,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAqB1D,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAYnD,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB1D,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQxC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IActE,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,aAAa,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAezC,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,kBAAkB;CAS3B"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @happyvertical/directory
|
|
3
|
+
*
|
|
4
|
+
* Unified directory services with adapter-based architecture.
|
|
5
|
+
* Supports Kanidm (identity), Stalwart (mail), PostgreSQL (database), and AWS (cloud).
|
|
6
|
+
*/
|
|
7
|
+
export { AwsAdapter } from './adapters/aws.js';
|
|
8
|
+
export { KanidmAdapter } from './adapters/kanidm.js';
|
|
9
|
+
export { PostgresAdapter } from './adapters/postgres.js';
|
|
10
|
+
export { StalwartAdapter } from './adapters/stalwart.js';
|
|
11
|
+
export { AuthenticationError, ConflictError, ConnectionError, DirectoryError, NotFoundError, RateLimitError, ValidationError, } from './shared/errors.js';
|
|
12
|
+
export { getAwsAdapter, getDirectoryAdapter, getKanidmAdapter, getPostgresAdapter, getStalwartAdapter, isAwsOptions, isKanidmOptions, isPostgresOptions, isStalwartOptions, } from './shared/factory.js';
|
|
13
|
+
export type { AwsAccessKey, AwsAccount, AwsAccountCreationStatus, AwsDirectoryAdapter, AwsIamUser, AwsOptions, AwsOrganizationalUnit, CreateAwsAccountInput, CreateAwsIamUserInput, CreateAwsOuInput, CreateDkimKeyInput, CreateGroupInput, CreateMailboxInput, CreateMailDomainInput, CreateOAuth2ClientInput, CreatePgDatabaseInput, CreatePgRoleInput, CreateUserInput, CredentialResetIntent, DirectoryAdapter, DirectoryAdapterType, DirectoryGroup, DirectoryOrchestrator, DirectoryUser, DkimKey, DnsRecord, GetDirectoryAdapterOptions, KanidmDirectoryAdapter, KanidmOptions, Mailbox, MailDomain, OAuth2Client, PgDatabase, PgRole, PostgresDirectoryAdapter, PostgresOptions, StalwartDirectoryAdapter, StalwartOptions, TenantProvisioningInput, TenantProvisioningResult, UpdateGroupInput, UpdateMailboxInput, UpdateOAuth2ClientInput, UpdateUserInput, } from './shared/types.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,OAAO,EACP,SAAS,EACT,0BAA0B,EAC1B,sBAAsB,EACtB,aAAa,EACb,OAAO,EACP,UAAU,EACV,YAAY,EACZ,UAAU,EACV,MAAM,EACN,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
|