@nest-boot/auth 8.0.8-beta.0 → 8.0.9-beta.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/README.md +74 -34
- package/dist/auth.middleware.d.ts +0 -4
- package/dist/auth.middleware.js +17 -21
- package/dist/auth.middleware.js.map +1 -1
- package/dist/auth.module.js +5 -5
- package/dist/auth.module.js.map +1 -1
- package/dist/connections/index.d.ts +1 -1
- package/dist/connections/index.js +1 -1
- package/dist/connections/index.js.map +1 -1
- package/dist/connections/member-api-key.connection-definition.d.ts +13 -0
- package/dist/connections/{workspace-api-key.connection-definition.js → member-api-key.connection-definition.js} +11 -11
- package/dist/connections/member-api-key.connection-definition.js.map +1 -0
- package/dist/connections/member.connection-definition.js +1 -0
- package/dist/connections/member.connection-definition.js.map +1 -1
- package/dist/entities/auth-entity-map.d.ts +2 -2
- package/dist/entities/auth-entity-map.js +2 -2
- package/dist/entities/auth-entity-map.js.map +1 -1
- package/dist/entities/index.d.ts +3 -3
- package/dist/entities/index.js +3 -3
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/{workspace-api-key.entity.d.ts → member-api-key.entity.d.ts} +7 -5
- package/dist/entities/{workspace-api-key.entity.js → member-api-key.entity.js} +37 -28
- package/dist/entities/member-api-key.entity.js.map +1 -0
- package/dist/entities/member.entity.d.ts +6 -2
- package/dist/entities/member.entity.js +15 -2
- package/dist/entities/member.entity.js.map +1 -1
- package/dist/enums/index.d.ts +2 -1
- package/dist/enums/index.js +2 -1
- package/dist/enums/index.js.map +1 -1
- package/dist/enums/{workspace-api-key-permission.enum.d.ts → member-api-key-permission.enum.d.ts} +2 -2
- package/dist/enums/{workspace-api-key-permission.enum.js → member-api-key-permission.enum.js} +4 -4
- package/dist/enums/member-api-key-permission.enum.js.map +1 -0
- package/dist/enums/member-type.enum.d.ts +7 -0
- package/dist/enums/member-type.enum.js +11 -0
- package/dist/enums/member-type.enum.js.map +1 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/api-key-authentication.service.js +25 -8
- package/dist/infrastructure/api-key-authentication.service.js.map +1 -1
- package/dist/infrastructure/auth-ability.factory.js +17 -2
- package/dist/infrastructure/auth-ability.factory.js.map +1 -1
- package/dist/infrastructure/auth-enum-registry.js +3 -3
- package/dist/infrastructure/auth-enum-registry.js.map +1 -1
- package/dist/infrastructure/create-auth-instance.js +2 -2
- package/dist/infrastructure/create-auth-instance.js.map +1 -1
- package/dist/infrastructure/request-identity.d.ts +2 -0
- package/dist/infrastructure/request-identity.js +26 -10
- package/dist/infrastructure/request-identity.js.map +1 -1
- package/dist/inputs/add-member.input.d.ts +13 -2
- package/dist/inputs/add-member.input.js +34 -3
- package/dist/inputs/add-member.input.js.map +1 -1
- package/dist/inputs/{create-workspace-api-key.input.d.ts → create-member-api-key.input.d.ts} +6 -4
- package/dist/inputs/{create-workspace-api-key.input.js → create-member-api-key.input.js} +20 -13
- package/dist/inputs/create-member-api-key.input.js.map +1 -0
- package/dist/inputs/create-user-api-key.input.d.ts +1 -1
- package/dist/inputs/create-user-api-key.input.js +1 -1
- package/dist/inputs/create-user-api-key.input.js.map +1 -1
- package/dist/inputs/{update-workspace-api-key.input.d.ts → update-member-api-key.input.d.ts} +3 -3
- package/dist/inputs/{update-workspace-api-key.input.js → update-member-api-key.input.js} +11 -11
- package/dist/inputs/update-member-api-key.input.js.map +1 -0
- package/dist/interfaces/ability-context.interface.d.ts +3 -3
- package/dist/interfaces/add-member-options.interface.d.ts +1 -1
- package/dist/interfaces/auth-module-api-key-options.interface.d.ts +2 -2
- package/dist/interfaces/auth-module-api-key-scope-options.interface.d.ts +2 -2
- package/dist/interfaces/create-api-key-options.interface.d.ts +1 -1
- package/dist/interfaces/create-member-api-key-options.interface.d.ts +7 -0
- package/dist/interfaces/create-member-api-key-options.interface.js +2 -0
- package/dist/interfaces/create-member-api-key-options.interface.js.map +1 -0
- package/dist/interfaces/member-api-key-validation.interface.d.ts +17 -0
- package/dist/interfaces/member-api-key-validation.interface.js +2 -0
- package/dist/interfaces/member-api-key-validation.interface.js.map +1 -0
- package/dist/interfaces/request-permissions.interface.d.ts +1 -1
- package/dist/objects/{create-workspace-api-key-result.object.d.ts → create-member-api-key-result.object.d.ts} +3 -3
- package/dist/objects/{create-workspace-api-key-result.object.js → create-member-api-key-result.object.js} +10 -10
- package/dist/objects/create-member-api-key-result.object.js.map +1 -0
- package/dist/objects/member-api-key-permission-option.object.d.ts +10 -0
- package/dist/objects/{workspace-api-key-permission-option.object.js → member-api-key-permission-option.object.js} +12 -12
- package/dist/objects/member-api-key-permission-option.object.js.map +1 -0
- package/dist/resolvers/member-api-key.resolver.d.ts +25 -0
- package/dist/resolvers/{workspace-api-key.resolver.js → member-api-key.resolver.js} +38 -34
- package/dist/resolvers/member-api-key.resolver.js.map +1 -0
- package/dist/resolvers/member.resolver.js +11 -1
- package/dist/resolvers/member.resolver.js.map +1 -1
- package/dist/resolvers/workspace.resolver.d.ts +6 -6
- package/dist/resolvers/workspace.resolver.js +9 -9
- package/dist/resolvers/workspace.resolver.js.map +1 -1
- package/dist/services/member-api-key.service.d.ts +43 -0
- package/dist/services/{workspace-api-key.service.js → member-api-key.service.js} +82 -52
- package/dist/services/member-api-key.service.js.map +1 -0
- package/dist/services/member.service.d.ts +4 -2
- package/dist/services/member.service.js +46 -17
- package/dist/services/member.service.js.map +1 -1
- package/dist/services/user-api-key.service.js +3 -1
- package/dist/services/user-api-key.service.js.map +1 -1
- package/dist/services/workspace.service.d.ts +0 -2
- package/dist/services/workspace.service.js +1 -11
- package/dist/services/workspace.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api-key-validation.type.d.ts +2 -2
- package/dist/types/api-key.type.d.ts +3 -3
- package/dist/utils/api-key-permissions.util.d.ts +2 -2
- package/dist/utils/api-key-permissions.util.js +1 -1
- package/dist/utils/api-key-permissions.util.js.map +1 -1
- package/dist/utils/build-request-ability.util.js +6 -16
- package/dist/utils/build-request-ability.util.js.map +1 -1
- package/dist/utils/permission-grants.util.js +2 -0
- package/dist/utils/permission-grants.util.js.map +1 -1
- package/dist/utils/resolve-effective-permissions.util.d.ts +1 -1
- package/dist/utils/resolve-effective-permissions.util.js +1 -1
- package/dist/utils/resolve-effective-permissions.util.js.map +1 -1
- package/dist/utils/resolve-request-member.util.d.ts +3 -0
- package/dist/utils/resolve-request-member.util.js +23 -0
- package/dist/utils/resolve-request-member.util.js.map +1 -0
- package/dist/utils/resolve-request-permissions.util.js +11 -16
- package/dist/utils/resolve-request-permissions.util.js.map +1 -1
- package/dist/workspace.constants.d.ts +3 -3
- package/dist/workspace.constants.js +6 -2
- package/dist/workspace.constants.js.map +1 -1
- package/package.json +17 -17
- package/dist/connections/workspace-api-key.connection-definition.d.ts +0 -13
- package/dist/connections/workspace-api-key.connection-definition.js.map +0 -1
- package/dist/entities/workspace-api-key.entity.js.map +0 -1
- package/dist/enums/workspace-api-key-permission.enum.js.map +0 -1
- package/dist/inputs/create-workspace-api-key.input.js.map +0 -1
- package/dist/inputs/update-workspace-api-key.input.js.map +0 -1
- package/dist/interfaces/workspace-api-key-validation.interface.d.ts +0 -11
- package/dist/interfaces/workspace-api-key-validation.interface.js +0 -2
- package/dist/interfaces/workspace-api-key-validation.interface.js.map +0 -1
- package/dist/objects/create-workspace-api-key-result.object.js.map +0 -1
- package/dist/objects/workspace-api-key-permission-option.object.d.ts +0 -10
- package/dist/objects/workspace-api-key-permission-option.object.js.map +0 -1
- package/dist/resolvers/workspace-api-key.resolver.d.ts +0 -25
- package/dist/resolvers/workspace-api-key.resolver.js.map +0 -1
- package/dist/services/workspace-api-key.service.d.ts +0 -41
- package/dist/services/workspace-api-key.service.js.map +0 -1
|
@@ -9,11 +9,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Field, InputType } from "@nest-boot/graphql";
|
|
11
11
|
import { ZodField } from "@nest-boot/validator";
|
|
12
|
-
import {
|
|
12
|
+
import { MemberApiKeyPermission } from "../enums/member-api-key-permission.enum.js";
|
|
13
13
|
/**
|
|
14
14
|
* Input for updating an API key.
|
|
15
15
|
*/
|
|
16
|
-
let
|
|
16
|
+
let UpdateMemberApiKeyInput = class UpdateMemberApiKeyInput {
|
|
17
17
|
/** New API key display name. */
|
|
18
18
|
name;
|
|
19
19
|
/** Whether the API key can authenticate requests. */
|
|
@@ -27,24 +27,24 @@ __decorate([
|
|
|
27
27
|
ZodField((z) => z.string().trim().min(1).max(255).optional()),
|
|
28
28
|
Field(() => String, { nullable: true }),
|
|
29
29
|
__metadata("design:type", String)
|
|
30
|
-
],
|
|
30
|
+
], UpdateMemberApiKeyInput.prototype, "name", void 0);
|
|
31
31
|
__decorate([
|
|
32
32
|
ZodField((z) => z.boolean().optional()),
|
|
33
33
|
Field(() => Boolean, { nullable: true }),
|
|
34
34
|
__metadata("design:type", Boolean)
|
|
35
|
-
],
|
|
35
|
+
], UpdateMemberApiKeyInput.prototype, "enabled", void 0);
|
|
36
36
|
__decorate([
|
|
37
37
|
ZodField((z) => z.date().nullish()),
|
|
38
38
|
Field(() => Date, { nullable: true }),
|
|
39
39
|
__metadata("design:type", Object)
|
|
40
|
-
],
|
|
40
|
+
], UpdateMemberApiKeyInput.prototype, "expiresAt", void 0);
|
|
41
41
|
__decorate([
|
|
42
42
|
ZodField((z) => z.array(z.string()).nullish()),
|
|
43
|
-
Field(() => [
|
|
43
|
+
Field(() => [MemberApiKeyPermission], { nullable: true }),
|
|
44
44
|
__metadata("design:type", Object)
|
|
45
|
-
],
|
|
46
|
-
|
|
45
|
+
], UpdateMemberApiKeyInput.prototype, "permissions", void 0);
|
|
46
|
+
UpdateMemberApiKeyInput = __decorate([
|
|
47
47
|
InputType()
|
|
48
|
-
],
|
|
49
|
-
export {
|
|
50
|
-
//# sourceMappingURL=update-
|
|
48
|
+
], UpdateMemberApiKeyInput);
|
|
49
|
+
export { UpdateMemberApiKeyInput };
|
|
50
|
+
//# sourceMappingURL=update-member-api-key.input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-member-api-key.input.js","sourceRoot":"","sources":["../../src/inputs/update-member-api-key.input.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF;;GAEG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,gCAAgC;IAGhC,IAAI,CAAU;IAEd,qDAAqD;IAGrD,OAAO,CAAW;IAElB,4DAA4D;IAG5D,SAAS,CAAe;IAExB,2BAA2B;IAG3B,WAAW,CAAmC;CAC/C,CAAA;AAhBC;IAFC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7D,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDAC1B;AAKd;IAFC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;IACvC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACvB;AAKlB;IAFC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IACnC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACd;AAKxB;IAFC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC9C,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,sBAAsB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4DACZ;AAnBnC,uBAAuB;IADnC,SAAS,EAAE;GACC,uBAAuB,CAoBnC"}
|
|
@@ -3,11 +3,11 @@ import type { User } from "../entities/user.entity.js";
|
|
|
3
3
|
import type { Workspace } from "../entities/workspace.entity.js";
|
|
4
4
|
/** Identity and credential-limited grants used to configure one request ability. */
|
|
5
5
|
export interface AbilityContext<UserPermission extends string = string, WorkspacePermission extends string = string> {
|
|
6
|
-
/** Authenticated user; absent for anonymous and
|
|
6
|
+
/** Authenticated user; absent for anonymous and member API-key requests. */
|
|
7
7
|
readonly user: User | null;
|
|
8
|
-
/** Selected workspace with
|
|
8
|
+
/** Selected workspace with an active membership matching the credential owner. */
|
|
9
9
|
readonly workspace: Workspace | null;
|
|
10
|
-
/** Active membership; absent outside
|
|
10
|
+
/** Active user or service-account membership; absent outside an authorized workspace. */
|
|
11
11
|
readonly member: Member | null;
|
|
12
12
|
/** Effective user grants after applying the authenticating credential's ceiling. */
|
|
13
13
|
readonly userPermissions: readonly UserPermission[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Input accepted when adding a workspace member. */
|
|
2
2
|
export interface AddMemberOptions {
|
|
3
|
-
/** Member roles. Defaults to `workspace.defaultRole`. */
|
|
3
|
+
/** Member roles. Defaults to `workspace.defaultRole`; service accounts may use `[]`. */
|
|
4
4
|
roles?: string[];
|
|
5
5
|
/** Additional permissions from the configured workspace permission catalog. */
|
|
6
6
|
permissions?: string[];
|
|
@@ -3,6 +3,6 @@ import type { AuthModuleApiKeyScopeOptions } from "./auth-module-api-key-scope-o
|
|
|
3
3
|
export interface AuthModuleApiKeyOptions<UserPermission extends string = string, WorkspacePermission extends string = string> {
|
|
4
4
|
/** User keys may carry both user and workspace permissions, limited again by their owner's grants at use time. */
|
|
5
5
|
user?: AuthModuleApiKeyScopeOptions<UserPermission | WorkspacePermission>;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/** Member keys only carry workspace permissions; creating an invitation additionally requires a user identity. */
|
|
7
|
+
member?: AuthModuleApiKeyScopeOptions<WorkspacePermission>;
|
|
8
8
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** Credential defaults and grant limits for one API-key owner type. */
|
|
2
2
|
export interface AuthModuleApiKeyScopeOptions<Permission extends string = string> {
|
|
3
|
-
/** Literal prefix, including separators. Falls back to API_KEY_PREFIX, then user_ for user keys or ws_ for
|
|
3
|
+
/** Literal prefix, including separators. Falls back to API_KEY_PREFIX, then user_ for user keys or ws_ for member keys. */
|
|
4
4
|
defaultPrefix?: string;
|
|
5
5
|
/** Permissions used only when creation omits permissions. Defaults to an empty list. */
|
|
6
6
|
defaultPermissions?: readonly Permission[];
|
|
7
|
-
/**
|
|
7
|
+
/** Ceiling for explicit permission selections; empty key permissions inherit the owner's full permissions. */
|
|
8
8
|
allowedPermissions?: readonly Permission[];
|
|
9
9
|
}
|
|
@@ -6,7 +6,7 @@ export interface CreateApiKeyOptions {
|
|
|
6
6
|
expiresAt?: Date | null;
|
|
7
7
|
/**
|
|
8
8
|
* Operations granted to the key. Omission uses the configured defaults;
|
|
9
|
-
* `null` or an empty list
|
|
9
|
+
* `null` or an empty list inherits all owner permissions.
|
|
10
10
|
*/
|
|
11
11
|
permissions?: string[] | null;
|
|
12
12
|
/** 1–32 lowercase letters, digits, underscores, or hyphens, starting with a letter. Overrides the owner scope’s default prefix; separators are included verbatim. */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Member } from "../entities/member.entity.js";
|
|
2
|
+
import type { CreateApiKeyOptions } from "./create-api-key-options.interface.js";
|
|
3
|
+
/** Creates a workspace-scoped key for a member. */
|
|
4
|
+
export interface CreateMemberApiKeyOptions extends CreateApiKeyOptions {
|
|
5
|
+
/** Owner entity or ID. Only self or a service account is allowed; omission uses the current member. */
|
|
6
|
+
member?: Member | string;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-member-api-key-options.interface.js","sourceRoot":"","sources":["../../src/interfaces/create-member-api-key-options.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Member } from "../entities/member.entity.js";
|
|
2
|
+
import type { MemberApiKey } from "../entities/member-api-key.entity.js";
|
|
3
|
+
import type { User } from "../entities/user.entity.js";
|
|
4
|
+
import type { Workspace } from "../entities/workspace.entity.js";
|
|
5
|
+
/** Successful authentication for a member-owned, workspace-scoped API key. */
|
|
6
|
+
export interface MemberApiKeyValidation {
|
|
7
|
+
/** Validated API-key entity. */
|
|
8
|
+
apiKey: MemberApiKey;
|
|
9
|
+
/** Identifies the owner branch. */
|
|
10
|
+
ownerType: "member";
|
|
11
|
+
/** Member represented by the key. */
|
|
12
|
+
member: Member;
|
|
13
|
+
/** Login user when the owner is a user member. */
|
|
14
|
+
user: User | null;
|
|
15
|
+
/** Workspace represented by the key. */
|
|
16
|
+
workspace: Workspace;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-api-key-validation.interface.js","sourceRoot":"","sources":["../../src/interfaces/member-api-key-validation.interface.ts"],"names":[],"mappings":""}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
export interface RequestPermissions {
|
|
3
3
|
readonly user: readonly string[];
|
|
4
4
|
readonly workspace: readonly string[];
|
|
5
|
-
/** Null means
|
|
5
|
+
/** Null means no credential ceiling: a session or an API key inheriting owner permissions. */
|
|
6
6
|
readonly apiKey: readonly string[] | null;
|
|
7
7
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MemberApiKey } from "../entities/member-api-key.entity.js";
|
|
2
2
|
/**
|
|
3
3
|
* Result returned to the client after creating an API key.
|
|
4
4
|
*/
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class CreateMemberApiKeyResult {
|
|
6
6
|
/** Created API key entity. */
|
|
7
|
-
entity:
|
|
7
|
+
entity: MemberApiKey;
|
|
8
8
|
/** Plaintext API key, returned only once at creation. */
|
|
9
9
|
apiKey: string;
|
|
10
10
|
}
|
|
@@ -8,26 +8,26 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { Field, ObjectType } from "@nest-boot/graphql";
|
|
11
|
-
import {
|
|
11
|
+
import { MemberApiKey } from "../entities/member-api-key.entity.js";
|
|
12
12
|
/**
|
|
13
13
|
* Result returned to the client after creating an API key.
|
|
14
14
|
*/
|
|
15
|
-
let
|
|
15
|
+
let CreateMemberApiKeyResult = class CreateMemberApiKeyResult {
|
|
16
16
|
/** Created API key entity. */
|
|
17
17
|
entity;
|
|
18
18
|
/** Plaintext API key, returned only once at creation. */
|
|
19
19
|
apiKey;
|
|
20
20
|
};
|
|
21
21
|
__decorate([
|
|
22
|
-
Field(() =>
|
|
23
|
-
__metadata("design:type",
|
|
24
|
-
],
|
|
22
|
+
Field(() => MemberApiKey),
|
|
23
|
+
__metadata("design:type", MemberApiKey)
|
|
24
|
+
], CreateMemberApiKeyResult.prototype, "entity", void 0);
|
|
25
25
|
__decorate([
|
|
26
26
|
Field(() => String),
|
|
27
27
|
__metadata("design:type", String)
|
|
28
|
-
],
|
|
29
|
-
|
|
28
|
+
], CreateMemberApiKeyResult.prototype, "apiKey", void 0);
|
|
29
|
+
CreateMemberApiKeyResult = __decorate([
|
|
30
30
|
ObjectType()
|
|
31
|
-
],
|
|
32
|
-
export {
|
|
33
|
-
//# sourceMappingURL=create-
|
|
31
|
+
], CreateMemberApiKeyResult);
|
|
32
|
+
export { CreateMemberApiKeyResult };
|
|
33
|
+
//# sourceMappingURL=create-member-api-key-result.object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-member-api-key-result.object.js","sourceRoot":"","sources":["../../src/objects/create-member-api-key-result.object.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE;;GAEG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,8BAA8B;IAG9B,MAAM,CAAgB;IAEtB,yDAAyD;IAEzD,MAAM,CAAU;CACjB,CAAA;AALC;IADC,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC;8BACjB,YAAY;wDAAC;AAItB;IADC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;wDACJ;AARL,wBAAwB;IADpC,UAAU,EAAE;GACA,wBAAwB,CASpC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MemberApiKeyPermission } from "../enums/member-api-key-permission.enum.js";
|
|
2
|
+
/** A member API-key permission and whether the caller may grant it. */
|
|
3
|
+
export declare class MemberApiKeyPermissionOption {
|
|
4
|
+
/** Permission from the complete member API-key catalog. */
|
|
5
|
+
permission: MemberApiKeyPermission;
|
|
6
|
+
/** Includes configuration limits, user-identity requirements and the caller's grant ceiling. */
|
|
7
|
+
grantable: boolean;
|
|
8
|
+
/** Whether configuration selects this permission by default, independently of grantability. */
|
|
9
|
+
default: boolean;
|
|
10
|
+
}
|
|
@@ -8,10 +8,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { Field, ObjectType } from "@nest-boot/graphql";
|
|
11
|
-
import {
|
|
12
|
-
/** A
|
|
13
|
-
let
|
|
14
|
-
/** Permission from the complete
|
|
11
|
+
import { MemberApiKeyPermission } from "../enums/member-api-key-permission.enum.js";
|
|
12
|
+
/** A member API-key permission and whether the caller may grant it. */
|
|
13
|
+
let MemberApiKeyPermissionOption = class MemberApiKeyPermissionOption {
|
|
14
|
+
/** Permission from the complete member API-key catalog. */
|
|
15
15
|
permission;
|
|
16
16
|
/** Includes configuration limits, user-identity requirements and the caller's grant ceiling. */
|
|
17
17
|
grantable;
|
|
@@ -19,19 +19,19 @@ let WorkspaceApiKeyPermissionOption = class WorkspaceApiKeyPermissionOption {
|
|
|
19
19
|
default;
|
|
20
20
|
};
|
|
21
21
|
__decorate([
|
|
22
|
-
Field(() =>
|
|
22
|
+
Field(() => MemberApiKeyPermission),
|
|
23
23
|
__metadata("design:type", String)
|
|
24
|
-
],
|
|
24
|
+
], MemberApiKeyPermissionOption.prototype, "permission", void 0);
|
|
25
25
|
__decorate([
|
|
26
26
|
Field(() => Boolean),
|
|
27
27
|
__metadata("design:type", Boolean)
|
|
28
|
-
],
|
|
28
|
+
], MemberApiKeyPermissionOption.prototype, "grantable", void 0);
|
|
29
29
|
__decorate([
|
|
30
30
|
Field(() => Boolean),
|
|
31
31
|
__metadata("design:type", Boolean)
|
|
32
|
-
],
|
|
33
|
-
|
|
32
|
+
], MemberApiKeyPermissionOption.prototype, "default", void 0);
|
|
33
|
+
MemberApiKeyPermissionOption = __decorate([
|
|
34
34
|
ObjectType()
|
|
35
|
-
],
|
|
36
|
-
export {
|
|
37
|
-
//# sourceMappingURL=
|
|
35
|
+
], MemberApiKeyPermissionOption);
|
|
36
|
+
export { MemberApiKeyPermissionOption };
|
|
37
|
+
//# sourceMappingURL=member-api-key-permission-option.object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-api-key-permission-option.object.js","sourceRoot":"","sources":["../../src/objects/member-api-key-permission-option.object.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,uEAAuE;AAEhE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,2DAA2D;IAE3D,UAAU,CAA0B;IAEpC,gGAAgG;IAEhG,SAAS,CAAW;IAEpB,+FAA+F;IAE/F,OAAO,CAAW;CACnB,CAAA;AATC;IADC,KAAK,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC;;gEACA;AAIpC;IADC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;;+DACD;AAIpB;IADC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC;;6DACH;AAXP,4BAA4B;IADxC,UAAU,EAAE;GACA,4BAA4B,CAYxC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MemberApiKey } from "../entities/member-api-key.entity.js";
|
|
2
|
+
import { Workspace } from "../entities/workspace.entity.js";
|
|
3
|
+
import { CreateMemberApiKeyInput } from "../inputs/create-member-api-key.input.js";
|
|
4
|
+
import { UpdateMemberApiKeyInput } from "../inputs/update-member-api-key.input.js";
|
|
5
|
+
import { CreateMemberApiKeyResult } from "../objects/create-member-api-key-result.object.js";
|
|
6
|
+
import { MemberApiKeyPermissionOption } from "../objects/member-api-key-permission-option.object.js";
|
|
7
|
+
import { MemberApiKeyService } from "../services/member-api-key.service.js";
|
|
8
|
+
import type { ApiKeyMetadata } from "../types/api-key-metadata.type.js";
|
|
9
|
+
/** GraphQL mutations for member-owned, workspace-scoped API keys. */
|
|
10
|
+
export declare class MemberApiKeyResolver {
|
|
11
|
+
/** Member API-key domain service. */
|
|
12
|
+
readonly apiKeyService: MemberApiKeyService;
|
|
13
|
+
/** Creates the member API-key resolver. */
|
|
14
|
+
constructor(
|
|
15
|
+
/** Member API-key domain service. */
|
|
16
|
+
apiKeyService: MemberApiKeyService);
|
|
17
|
+
/** Lists permission choices for keys owned by the selected workspace. */
|
|
18
|
+
memberApiKeyPermissions(workspace: Workspace): MemberApiKeyPermissionOption[];
|
|
19
|
+
/** Creates a credential and returns its plaintext once. */
|
|
20
|
+
createMemberApiKey(input: CreateMemberApiKeyInput, workspace: Workspace): Promise<CreateMemberApiKeyResult>;
|
|
21
|
+
/** Updates a credential owned by the current workspace. */
|
|
22
|
+
updateMemberApiKey(id: string, input: UpdateMemberApiKeyInput): Promise<ApiKeyMetadata<MemberApiKey>>;
|
|
23
|
+
/** Deletes a credential owned by the current workspace. */
|
|
24
|
+
deleteMemberApiKey(id: string): Promise<ApiKeyMetadata<MemberApiKey>>;
|
|
25
|
+
}
|
|
@@ -12,73 +12,77 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
import { Args, ID, Mutation, Query, Resolver } from "@nest-boot/graphql";
|
|
14
14
|
import { CurrentWorkspace } from "../decorators/current-workspace.decorator.js";
|
|
15
|
+
import { MemberApiKey } from "../entities/member-api-key.entity.js";
|
|
15
16
|
import { Workspace } from "../entities/workspace.entity.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
let WorkspaceApiKeyResolver = class WorkspaceApiKeyResolver {
|
|
17
|
+
import { CreateMemberApiKeyInput } from "../inputs/create-member-api-key.input.js";
|
|
18
|
+
import { UpdateMemberApiKeyInput } from "../inputs/update-member-api-key.input.js";
|
|
19
|
+
import { CreateMemberApiKeyResult } from "../objects/create-member-api-key-result.object.js";
|
|
20
|
+
import { MemberApiKeyPermissionOption } from "../objects/member-api-key-permission-option.object.js";
|
|
21
|
+
import { MemberApiKeyService } from "../services/member-api-key.service.js";
|
|
22
|
+
/** GraphQL mutations for member-owned, workspace-scoped API keys. */
|
|
23
|
+
let MemberApiKeyResolver = class MemberApiKeyResolver {
|
|
24
24
|
apiKeyService;
|
|
25
|
-
/** Creates the
|
|
25
|
+
/** Creates the member API-key resolver. */
|
|
26
26
|
constructor(
|
|
27
|
-
/**
|
|
27
|
+
/** Member API-key domain service. */
|
|
28
28
|
apiKeyService) {
|
|
29
29
|
this.apiKeyService = apiKeyService;
|
|
30
30
|
}
|
|
31
31
|
/** Lists permission choices for keys owned by the selected workspace. */
|
|
32
|
-
|
|
33
|
-
return this.apiKeyService.
|
|
32
|
+
memberApiKeyPermissions(workspace) {
|
|
33
|
+
return this.apiKeyService.getMemberApiKeyPermissions(workspace);
|
|
34
34
|
}
|
|
35
35
|
/** Creates a credential and returns its plaintext once. */
|
|
36
|
-
async
|
|
37
|
-
|
|
36
|
+
async createMemberApiKey(input, workspace) {
|
|
37
|
+
const { memberId, ...options } = input;
|
|
38
|
+
return await this.apiKeyService.createMemberApiKey(workspace, {
|
|
39
|
+
...options,
|
|
40
|
+
...(memberId ? { member: memberId } : {}),
|
|
41
|
+
});
|
|
38
42
|
}
|
|
39
43
|
/** Updates a credential owned by the current workspace. */
|
|
40
|
-
async
|
|
41
|
-
return await this.apiKeyService.
|
|
44
|
+
async updateMemberApiKey(id, input) {
|
|
45
|
+
return await this.apiKeyService.updateMemberApiKey(id, input);
|
|
42
46
|
}
|
|
43
47
|
/** Deletes a credential owned by the current workspace. */
|
|
44
|
-
async
|
|
45
|
-
return await this.apiKeyService.
|
|
48
|
+
async deleteMemberApiKey(id) {
|
|
49
|
+
return await this.apiKeyService.deleteMemberApiKey(id);
|
|
46
50
|
}
|
|
47
51
|
};
|
|
48
52
|
__decorate([
|
|
49
|
-
Query(() => [
|
|
53
|
+
Query(() => [MemberApiKeyPermissionOption]),
|
|
50
54
|
__param(0, CurrentWorkspace()),
|
|
51
55
|
__metadata("design:type", Function),
|
|
52
56
|
__metadata("design:paramtypes", [Workspace]),
|
|
53
57
|
__metadata("design:returntype", Array)
|
|
54
|
-
],
|
|
58
|
+
], MemberApiKeyResolver.prototype, "memberApiKeyPermissions", null);
|
|
55
59
|
__decorate([
|
|
56
|
-
Mutation(() =>
|
|
60
|
+
Mutation(() => CreateMemberApiKeyResult),
|
|
57
61
|
__param(0, Args("input")),
|
|
58
62
|
__param(1, CurrentWorkspace()),
|
|
59
63
|
__metadata("design:type", Function),
|
|
60
|
-
__metadata("design:paramtypes", [
|
|
64
|
+
__metadata("design:paramtypes", [CreateMemberApiKeyInput,
|
|
61
65
|
Workspace]),
|
|
62
66
|
__metadata("design:returntype", Promise)
|
|
63
|
-
],
|
|
67
|
+
], MemberApiKeyResolver.prototype, "createMemberApiKey", null);
|
|
64
68
|
__decorate([
|
|
65
|
-
Mutation(() =>
|
|
69
|
+
Mutation(() => MemberApiKey),
|
|
66
70
|
__param(0, Args("id", { type: () => ID })),
|
|
67
71
|
__param(1, Args("input")),
|
|
68
72
|
__metadata("design:type", Function),
|
|
69
|
-
__metadata("design:paramtypes", [String,
|
|
73
|
+
__metadata("design:paramtypes", [String, UpdateMemberApiKeyInput]),
|
|
70
74
|
__metadata("design:returntype", Promise)
|
|
71
|
-
],
|
|
75
|
+
], MemberApiKeyResolver.prototype, "updateMemberApiKey", null);
|
|
72
76
|
__decorate([
|
|
73
|
-
Mutation(() =>
|
|
77
|
+
Mutation(() => MemberApiKey),
|
|
74
78
|
__param(0, Args("id", { type: () => ID })),
|
|
75
79
|
__metadata("design:type", Function),
|
|
76
80
|
__metadata("design:paramtypes", [String]),
|
|
77
81
|
__metadata("design:returntype", Promise)
|
|
78
|
-
],
|
|
79
|
-
|
|
80
|
-
Resolver(() =>
|
|
81
|
-
__metadata("design:paramtypes", [
|
|
82
|
-
],
|
|
83
|
-
export {
|
|
84
|
-
//# sourceMappingURL=
|
|
82
|
+
], MemberApiKeyResolver.prototype, "deleteMemberApiKey", null);
|
|
83
|
+
MemberApiKeyResolver = __decorate([
|
|
84
|
+
Resolver(() => MemberApiKey),
|
|
85
|
+
__metadata("design:paramtypes", [MemberApiKeyService])
|
|
86
|
+
], MemberApiKeyResolver);
|
|
87
|
+
export { MemberApiKeyResolver };
|
|
88
|
+
//# sourceMappingURL=member-api-key.resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-api-key.resolver.js","sourceRoot":"","sources":["../../src/resolvers/member-api-key.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAG5E,qEAAqE;AAE9D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAIpB;IAHX,2CAA2C;IAC3C;IACE,qCAAqC;IAC5B,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IAC1C,CAAC;IAEJ,yEAAyE;IAEzE,uBAAuB,CACD,SAAoB;QAExC,OAAO,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;IAED,2DAA2D;IAErD,AAAN,KAAK,CAAC,kBAAkB,CACP,KAA8B,EACzB,SAAoB;QAExC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC;QACvC,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,SAAS,EAAE;YAC5D,GAAG,OAAO;YACV,GAAG,CAAC,QAAQ,CAAC,CAAC,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@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
13
|
import { Args, ID, Mutation, Parent, Query, ResolveField, Resolver, } from "@nest-boot/graphql";
|
|
14
|
+
import { BadRequestException } from "@nestjs/common";
|
|
14
15
|
import { CurrentWorkspace } from "../decorators/current-workspace.decorator.js";
|
|
15
16
|
import { Member } from "../entities/member.entity.js";
|
|
16
17
|
import { User } from "../entities/user.entity.js";
|
|
17
18
|
import { Workspace } from "../entities/workspace.entity.js";
|
|
19
|
+
import { MemberType } from "../enums/member-type.enum.js";
|
|
18
20
|
import { AddMemberInput } from "../inputs/add-member.input.js";
|
|
19
21
|
import { SetMemberPermissionsInput } from "../inputs/set-member-permissions.input.js";
|
|
20
22
|
import { SetMemberRolesInput } from "../inputs/set-member-roles.input.js";
|
|
@@ -76,7 +78,15 @@ let MemberResolver = class MemberResolver {
|
|
|
76
78
|
* @returns Newly created member identifier.
|
|
77
79
|
*/
|
|
78
80
|
async addMember(workspace, input) {
|
|
79
|
-
|
|
81
|
+
if (input.type === MemberType.SERVICE_ACCOUNT) {
|
|
82
|
+
if (!input.name || input.email !== undefined)
|
|
83
|
+
throw new BadRequestException("Service accounts require a name and cannot link a login email");
|
|
84
|
+
const member = await this.memberService.addServiceAccount(workspace, input.name, { roles: input.roles, permissions: input.permissions });
|
|
85
|
+
return { id: member.id };
|
|
86
|
+
}
|
|
87
|
+
if (!input.email)
|
|
88
|
+
throw new BadRequestException("User members require an email");
|
|
89
|
+
const member = await this.memberService.addMemberByEmail(workspace, input.email, { roles: input.roles, permissions: input.permissions });
|
|
80
90
|
return { id: member.id };
|
|
81
91
|
}
|
|
82
92
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member.resolver.js","sourceRoot":"","sources":["../../src/resolvers/member.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,IAAI,EACJ,EAAE,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,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC;IAEnC,WAAA,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;IAC9B,WAAA,IAAI,CAAC,OAAO,CAAC,CAAA;;6CAAQ,mBAAmB;;oDAI1C;AAIK;IADL,QAAQ,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC;IAEzC,WAAA,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;IAC9B,WAAA,IAAI,CAAC,OAAO,CAAC,CAAA;;6CAAQ,yBAAyB;;0DAOhD;AASK;IADL,QAAQ,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC;IAEjC,WAAA,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;;;;kDAIhC;AAxIU,cAAc;IAD1B,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;qCAQK,aAAa;GAP5B,cAAc,CAyI1B"}
|
|
@@ -2,9 +2,9 @@ import type { ConnectionArgsInterface } from "@nest-boot/graphql-connection";
|
|
|
2
2
|
import type { GraphQLResolveInfo } from "graphql";
|
|
3
3
|
import { type Invitation } from "../entities/invitation.entity.js";
|
|
4
4
|
import { Member } from "../entities/member.entity.js";
|
|
5
|
+
import { MemberApiKey } from "../entities/member-api-key.entity.js";
|
|
5
6
|
import { User } from "../entities/user.entity.js";
|
|
6
7
|
import { Workspace } from "../entities/workspace.entity.js";
|
|
7
|
-
import { WorkspaceApiKey } from "../entities/workspace-api-key.entity.js";
|
|
8
8
|
import { InvitationService } from "../features/invitations/invitation.service.js";
|
|
9
9
|
import { CreateWorkspaceInput } from "../inputs/create-workspace.input.js";
|
|
10
10
|
import { UpdateWorkspaceInput } from "../inputs/update-workspace.input.js";
|
|
@@ -13,15 +13,15 @@ import { DeleteWorkspacePayload } from "../objects/delete-workspace-payload.obje
|
|
|
13
13
|
import { LeaveWorkspacePayload } from "../objects/leave-workspace-payload.object.js";
|
|
14
14
|
import { UpdateWorkspacePayload } from "../objects/update-workspace-payload.object.js";
|
|
15
15
|
import { MemberService } from "../services/member.service.js";
|
|
16
|
+
import { MemberApiKeyService } from "../services/member-api-key.service.js";
|
|
16
17
|
import { WorkspaceService } from "../services/workspace.service.js";
|
|
17
|
-
import { WorkspaceApiKeyService } from "../services/workspace-api-key.service.js";
|
|
18
18
|
import type { ApiKeyMetadata } from "../types/api-key-metadata.type.js";
|
|
19
19
|
/**
|
|
20
20
|
* GraphQL operations for querying, creating, updating, and deleting workspaces.
|
|
21
21
|
*/
|
|
22
22
|
export declare class WorkspaceResolver {
|
|
23
23
|
readonly workspaceService: WorkspaceService;
|
|
24
|
-
readonly apiKeyService:
|
|
24
|
+
readonly apiKeyService: MemberApiKeyService;
|
|
25
25
|
readonly memberService: MemberService;
|
|
26
26
|
readonly invitationService: InvitationService;
|
|
27
27
|
/**
|
|
@@ -32,13 +32,13 @@ export declare class WorkspaceResolver {
|
|
|
32
32
|
* @param memberService - Workspace member domain service.
|
|
33
33
|
* @param invitationService - Workspace invitation domain service.
|
|
34
34
|
*/
|
|
35
|
-
constructor(workspaceService: WorkspaceService, apiKeyService:
|
|
35
|
+
constructor(workspaceService: WorkspaceService, apiKeyService: MemberApiKeyService, memberService: MemberService, invitationService: InvitationService);
|
|
36
36
|
/** Paginates members of the parent workspace. */
|
|
37
37
|
members(workspace: Workspace, args: ConnectionArgsInterface<Member>, info?: GraphQLResolveInfo): Promise<import("@nest-boot/graphql-connection").ConnectionResult<Member>>;
|
|
38
38
|
/** Returns an accessible API key owned by the parent workspace. */
|
|
39
|
-
apiKey(workspace: Workspace, id: string): Promise<ApiKeyMetadata<
|
|
39
|
+
apiKey(workspace: Workspace, id: string): Promise<ApiKeyMetadata<MemberApiKey> | null>;
|
|
40
40
|
/** Paginates API keys owned by the parent workspace. */
|
|
41
|
-
apiKeys(workspace: Workspace, args: ConnectionArgsInterface<
|
|
41
|
+
apiKeys(workspace: Workspace, args: ConnectionArgsInterface<MemberApiKey>, info?: GraphQLResolveInfo): Promise<import("@nest-boot/graphql-connection").ConnectionResult<Omit<MemberApiKey, "key">>>;
|
|
42
42
|
/** Paginates workspace invitations with authorization and querying handled by the service. */
|
|
43
43
|
invitations(workspace: Workspace, args: ConnectionArgsInterface<Invitation>, info?: GraphQLResolveInfo): Promise<import("@nest-boot/graphql-connection").ConnectionResult<Invitation>>;
|
|
44
44
|
/**
|
|
@@ -12,13 +12,13 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
import { Args, ID, Info, Mutation, Parent, Query, ResolveField, Resolver, } from "@nest-boot/graphql";
|
|
14
14
|
import { MemberConnection, MemberConnectionArgs, } from "../connections/member.connection-definition.js";
|
|
15
|
-
import {
|
|
15
|
+
import { MemberApiKeyConnection, MemberApiKeyConnectionArgs, } from "../connections/member-api-key.connection-definition.js";
|
|
16
16
|
import { CurrentMember } from "../decorators/current-member.decorator.js";
|
|
17
17
|
import { CurrentUser } from "../decorators/current-user.decorator.js";
|
|
18
18
|
import { Member } from "../entities/member.entity.js";
|
|
19
|
+
import { MemberApiKey } from "../entities/member-api-key.entity.js";
|
|
19
20
|
import { User } from "../entities/user.entity.js";
|
|
20
21
|
import { Workspace } from "../entities/workspace.entity.js";
|
|
21
|
-
import { WorkspaceApiKey } from "../entities/workspace-api-key.entity.js";
|
|
22
22
|
import { InvitationConnection, InvitationConnectionArgs, } from "../features/invitations/invitation.connection-definition.js";
|
|
23
23
|
import { InvitationService } from "../features/invitations/invitation.service.js";
|
|
24
24
|
import { CreateWorkspaceInput } from "../inputs/create-workspace.input.js";
|
|
@@ -28,8 +28,8 @@ import { DeleteWorkspacePayload } from "../objects/delete-workspace-payload.obje
|
|
|
28
28
|
import { LeaveWorkspacePayload } from "../objects/leave-workspace-payload.object.js";
|
|
29
29
|
import { UpdateWorkspacePayload } from "../objects/update-workspace-payload.object.js";
|
|
30
30
|
import { MemberService } from "../services/member.service.js";
|
|
31
|
+
import { MemberApiKeyService } from "../services/member-api-key.service.js";
|
|
31
32
|
import { WorkspaceService } from "../services/workspace.service.js";
|
|
32
|
-
import { WorkspaceApiKeyService } from "../services/workspace-api-key.service.js";
|
|
33
33
|
/**
|
|
34
34
|
* GraphQL operations for querying, creating, updating, and deleting workspaces.
|
|
35
35
|
*/
|
|
@@ -58,11 +58,11 @@ let WorkspaceResolver = class WorkspaceResolver {
|
|
|
58
58
|
}
|
|
59
59
|
/** Returns an accessible API key owned by the parent workspace. */
|
|
60
60
|
async apiKey(workspace, id) {
|
|
61
|
-
return await this.apiKeyService.
|
|
61
|
+
return await this.apiKeyService.getMemberApiKey(id, workspace);
|
|
62
62
|
}
|
|
63
63
|
/** Paginates API keys owned by the parent workspace. */
|
|
64
64
|
async apiKeys(workspace, args, info) {
|
|
65
|
-
return await this.apiKeyService.
|
|
65
|
+
return await this.apiKeyService.getMemberApiKeyConnection(workspace, args, info);
|
|
66
66
|
}
|
|
67
67
|
/** Paginates workspace invitations with authorization and querying handled by the service. */
|
|
68
68
|
async invitations(workspace, args, info) {
|
|
@@ -133,7 +133,7 @@ __decorate([
|
|
|
133
133
|
__metadata("design:returntype", Promise)
|
|
134
134
|
], WorkspaceResolver.prototype, "members", null);
|
|
135
135
|
__decorate([
|
|
136
|
-
ResolveField(() =>
|
|
136
|
+
ResolveField(() => MemberApiKey, { nullable: true }),
|
|
137
137
|
__param(0, Parent()),
|
|
138
138
|
__param(1, Args("id", { type: () => ID })),
|
|
139
139
|
__metadata("design:type", Function),
|
|
@@ -141,9 +141,9 @@ __decorate([
|
|
|
141
141
|
__metadata("design:returntype", Promise)
|
|
142
142
|
], WorkspaceResolver.prototype, "apiKey", null);
|
|
143
143
|
__decorate([
|
|
144
|
-
ResolveField(() =>
|
|
144
|
+
ResolveField(() => MemberApiKeyConnection),
|
|
145
145
|
__param(0, Parent()),
|
|
146
|
-
__param(1, Args({ type: () =>
|
|
146
|
+
__param(1, Args({ type: () => MemberApiKeyConnectionArgs })),
|
|
147
147
|
__param(2, Info()),
|
|
148
148
|
__metadata("design:type", Function),
|
|
149
149
|
__metadata("design:paramtypes", [Workspace, Object, Object]),
|
|
@@ -206,7 +206,7 @@ __decorate([
|
|
|
206
206
|
WorkspaceResolver = __decorate([
|
|
207
207
|
Resolver(() => Workspace),
|
|
208
208
|
__metadata("design:paramtypes", [WorkspaceService,
|
|
209
|
-
|
|
209
|
+
MemberApiKeyService,
|
|
210
210
|
MemberService,
|
|
211
211
|
InvitationService])
|
|
212
212
|
], WorkspaceResolver);
|