@noldova/git.github 0.0.0-stage → 0.0.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/module.json +16 -0
  4. package/package.json +48 -4
  5. package/settings.json +4 -0
  6. package/src/api/index.d.ts +73 -0
  7. package/src/api/index.js +8 -0
  8. package/src/api/window.d.ts +19 -0
  9. package/src/api/window.js +8 -0
  10. package/src/exceptions/github.exception.js +13 -0
  11. package/src/exceptions/sign-in-answer-unreadable.exception.js +15 -0
  12. package/src/exceptions/sign-in-denied.exception.js +14 -0
  13. package/src/exceptions/sign-in-error.exception.js +16 -0
  14. package/src/exceptions/sign-in-expired.exception.js +14 -0
  15. package/src/exceptions/sign-in-expiry-invalid.exception.js +16 -0
  16. package/src/exceptions/sign-in-not-kept.exception.js +15 -0
  17. package/src/exceptions/sign-in-refused.exception.js +13 -0
  18. package/src/exceptions/sign-in-request-refused.exception.js +18 -0
  19. package/src/exceptions/sign-in-token-refused.exception.js +14 -0
  20. package/src/exceptions/sign-in-unreachable.exception.js +17 -0
  21. package/src/interfaces/i-github-token.js +8 -0
  22. package/src/models/account-read.js +15 -0
  23. package/src/models/cached-answer.js +20 -0
  24. package/src/models/device-grant.js +19 -0
  25. package/src/models/device-poll.js +26 -0
  26. package/src/models/github-repository.js +26 -0
  27. package/src/models/kept-sign-in.js +26 -0
  28. package/src/resources.js +294 -0
  29. package/src/runtime-part.js +87 -0
  30. package/src/services/github-access.js +28 -0
  31. package/src/services/github-api.js +167 -0
  32. package/src/services/github-avatars.js +115 -0
  33. package/src/services/github-device-flow.js +144 -0
  34. package/src/services/github-reads.js +149 -0
  35. package/src/services/github-sign-in.js +280 -0
  36. package/src/tools/bound-repository.js +58 -0
  37. package/src/tools/github-pr-checks-tool.js +47 -0
  38. package/src/tools/github-pr-create-tool.js +97 -0
  39. package/src/tools/github-read-tool.js +62 -0
  40. package/src/tools/github-tool-failures.js +46 -0
  41. package/src/tools/github-tools.js +25 -0
  42. package/src/types/fetcher.js +8 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Noldova
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @noldova/git.github
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The GitHub module for apps on Noldova Desktop: the sign-in to GitHub, a branch's pull request and its checks, and agent tools that use GitHub through permission requests.
4
+ It holds the module's `module.json` and `settings.json`, and its runtime part, which signs in through GitHub's device flow and reads GitHub for the other parts.
5
+
6
+ It exports `./runtime`, the runtime part, and `./window`, which re-exports the published API of the window part, [`@noldova/git.github.window`](https://github.com/noldova-com/git/tree/main/src/noldova.git.github.window).
7
+ It depends on the Git module, [`@noldova/git`](https://github.com/noldova-com/git/tree/main/src/noldova.git), and pins its own window part and [`@noldova/git.github.protocol`](https://github.com/noldova-com/git/tree/main/src/noldova.git.github.protocol) at its own version.
8
+
9
+ An app installs it pinned exactly beside `@noldova/git` and lists both in `desktop.modules`, as the [README](https://github.com/noldova-com/git#readme) says.
10
+ [documents/ARCHITECTURE.md](https://github.com/noldova-com/git/blob/main/documents/ARCHITECTURE.md) says how it is built.
11
+ It is licensed under the [MIT License](https://github.com/noldova-com/git/blob/main/LICENSE).
package/module.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "id": "git-github",
3
+ "version": "0.0.1",
4
+ "displayName": "GitHub",
5
+ "description": "Signs in to GitHub, shows its issues, pull requests and checks, and opens pull requests, and lets AI agents do the same through permission requests.",
6
+ "parts": ["runtime", "window"],
7
+ "dependencies": { "git": "0.0.1" },
8
+ "noldovaDesktop": ">=0.0.1 <0.1.0",
9
+ "contributes": {
10
+ "methods": ["git-github.readSignIn", "git-github.startSignIn", "git-github.cancelSignIn", "git-github.signOut", "git-github.readReference",
11
+ "git-github.readBranchPullRequest", "git-github.createPullRequest"],
12
+ "events": ["git-github.signInChanged"],
13
+ "settingsPages": ["git-github.account"],
14
+ "tools": ["git_github_read", "git_github_pr_checks", "git_github_pr_create"]
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@noldova/git.github",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "description": "The GitHub module for apps on Noldova Desktop: the sign-in to GitHub, its issues, pull requests and checks, and agent tools that use GitHub through permission requests.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/noldova-com/git.git",
10
+ "directory": "src/noldova.git.github"
11
+ },
12
+ "homepage": "https://github.com/noldova-com/git#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/noldova-com/git/issues"
15
+ },
16
+ "exports": {
17
+ "./runtime": {
18
+ "types": "./src/api/index.d.ts",
19
+ "default": "./src/api/index.js"
20
+ },
21
+ "./window": {
22
+ "types": "./src/api/window.d.ts",
23
+ "default": "./src/api/window.js"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "module.json",
29
+ "settings.json",
30
+ "src/**/*.js",
31
+ "src/**/*.d.ts"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "registry": "https://registry.npmjs.org/"
36
+ },
37
+ "dependencies": {
38
+ "@noldova/git.github.protocol": "0.0.1",
39
+ "@noldova/git.protocol": "0.0.1",
40
+ "@noldova/git.github.window": "0.0.1",
41
+ "@noldova/git.hosting.protocol": "0.0.1"
42
+ },
43
+ "peerDependencies": {
44
+ "@noldova/desktop.protocol": ">=0.0.1 <0.1.0",
45
+ "@noldova/desktop.runtime": ">=0.0.1 <0.1.0",
46
+ "@noldova/context.exceptions": ">=0.0.7 <0.1.0",
47
+ "@noldova/context.json": ">=0.0.7 <0.1.0"
48
+ },
49
+ "gitHead": "9edb99d8feb37b29af7995d8b4717514fb242e5c"
50
+ }
package/settings.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "settings": [],
3
+ "pages": [{ "name": "git-github.account", "title": "GitHub" }]
4
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ import type { IRuntimePart, IRuntimePartContext } from "@noldova/desktop.runtime";
10
+
11
+ /** The service the runtime part publishes as `git-github.access`, as `@noldova/git.github.protocol` declares it. */
12
+ export type { IGitHubAccess } from "@noldova/git.github.protocol";
13
+
14
+ /**
15
+ * The GitHub module's runtime part, which Noldova Desktop activates in the app's main process.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { RuntimePart } from "@noldova/git.github/runtime";
20
+ *
21
+ * const part = new RuntimePart();
22
+ * console.log(part.isActive);
23
+ * ```
24
+ */
25
+ export declare class RuntimePart implements IRuntimePart {
26
+ /**
27
+ * Whether Noldova Desktop has activated the part and not yet deactivated it.
28
+ */
29
+ public get isActive(): boolean;
30
+
31
+ /**
32
+ * Activates the part: it declares the `git-github.signInChanged` event, registers the sign-in's methods `git-github.readSignIn`,
33
+ * `git-github.startSignIn`, `git-github.cancelSignIn` and `git-github.signOut`, and the methods `git-github.readReference`,
34
+ * `git-github.readBranchPullRequest` and `git-github.createPullRequest`, publishes the `git-github.access` service, restores the sign-in kept
35
+ * on this computer and then registers the agent tools `git_github_read`, `git_github_pr_checks` and `git_github_pr_create`.
36
+ *
37
+ * @param context The runtime's context for this part, which the part keeps until it deactivates.
38
+ * @returns A promise that resolves once the part is active and its tools are registered.
39
+ * @throws The failure itself, as a rejection, when reading the kept sign-in fails other than as the secrets' own `MethodFailureException`;
40
+ * the part's methods, event and service stay registered, and its tools aren't.
41
+ * @example
42
+ * ```ts
43
+ * import type { IRuntimePartContext } from "@noldova/desktop.runtime";
44
+ * import { RuntimePart } from "@noldova/git.github/runtime";
45
+ *
46
+ * export async function activateAsync(context: IRuntimePartContext): Promise<RuntimePart> {
47
+ * const part = new RuntimePart();
48
+ * await part.activateAsync(context);
49
+ * return part;
50
+ * }
51
+ * ```
52
+ */
53
+ public activateAsync(context: IRuntimePartContext): Promise<void>;
54
+
55
+ /**
56
+ * Deactivates the part and lets go of its context.
57
+ *
58
+ * @returns A promise that resolves once the part is inactive; it never rejects.
59
+ * Calling it again, or before {@link RuntimePart.activateAsync}, does nothing.
60
+ * @example
61
+ * ```ts
62
+ * import type { IRuntimePartContext } from "@noldova/desktop.runtime";
63
+ * import { RuntimePart } from "@noldova/git.github/runtime";
64
+ *
65
+ * export async function activateAndStopAsync(context: IRuntimePartContext): Promise<void> {
66
+ * const part = new RuntimePart();
67
+ * await part.activateAsync(context);
68
+ * await part.deactivateAsync();
69
+ * }
70
+ * ```
71
+ */
72
+ public deactivateAsync(): Promise<void>;
73
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export { RuntimePart } from "../runtime-part.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * The GitHub module's window part, which comes from its own package, `@noldova/git.github.window`, that this package pins exactly.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { windowPart } from "@noldova/git.github/window";
15
+ *
16
+ * console.log(windowPart.moduleId);
17
+ * ```
18
+ */
19
+ export { windowPart } from "@noldova/git.github.window";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export { windowPart } from "@noldova/git.github.window";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Exception } from "@noldova/context.exceptions";
9
+ export class GitHubException extends Exception {
10
+ constructor(message, options) {
11
+ super(message, options);
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { ExceptionOptions } from "@noldova/context.exceptions";
9
+ import { Resources } from "../resources.js";
10
+ import { SignInRefusedException } from "./sign-in-refused.exception.js";
11
+ export class SignInAnswerUnreadableException extends SignInRefusedException {
12
+ constructor(cause) {
13
+ super(Resources.signInAnswerUnreadableMessage, new ExceptionOptions(cause));
14
+ }
15
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ import { GitHubException } from "./github.exception.js";
10
+ export class SignInDeniedException extends GitHubException {
11
+ constructor() {
12
+ super(Resources.signInDeniedMessage);
13
+ }
14
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ import { SignInRefusedException } from "./sign-in-refused.exception.js";
10
+ export class SignInErrorException extends SignInRefusedException {
11
+ error;
12
+ constructor(error) {
13
+ super(Resources.formatSignInError(error));
14
+ this.error = error;
15
+ }
16
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ import { GitHubException } from "./github.exception.js";
10
+ export class SignInExpiredException extends GitHubException {
11
+ constructor() {
12
+ super(Resources.signInExpiredMessage);
13
+ }
14
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ import { SignInRefusedException } from "./sign-in-refused.exception.js";
10
+ export class SignInExpiryInvalidException extends SignInRefusedException {
11
+ seconds;
12
+ constructor(seconds) {
13
+ super(Resources.formatSignInExpiryInvalid(seconds));
14
+ this.seconds = seconds;
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { ExceptionOptions } from "@noldova/context.exceptions";
9
+ import { Resources } from "../resources.js";
10
+ import { GitHubException } from "./github.exception.js";
11
+ export class SignInNotKeptException extends GitHubException {
12
+ constructor(cause) {
13
+ super(Resources.signInNotKeptMessage, new ExceptionOptions(cause));
14
+ }
15
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { GitHubException } from "./github.exception.js";
9
+ export class SignInRefusedException extends GitHubException {
10
+ constructor(message, options) {
11
+ super(message, options);
12
+ }
13
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ import { SignInRefusedException } from "./sign-in-refused.exception.js";
10
+ export class SignInRequestRefusedException extends SignInRefusedException {
11
+ url;
12
+ status;
13
+ constructor(url, status) {
14
+ super(Resources.formatSignInRequestRefused(url, status));
15
+ this.url = url;
16
+ this.status = status;
17
+ }
18
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ import { SignInRefusedException } from "./sign-in-refused.exception.js";
10
+ export class SignInTokenRefusedException extends SignInRefusedException {
11
+ constructor() {
12
+ super(Resources.signInTokenRefusedMessage);
13
+ }
14
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { ExceptionOptions } from "@noldova/context.exceptions";
9
+ import { Resources } from "../resources.js";
10
+ import { GitHubException } from "./github.exception.js";
11
+ export class SignInUnreachableException extends GitHubException {
12
+ url;
13
+ constructor(url, cause) {
14
+ super(Resources.formatSignInUnreachable(url), new ExceptionOptions(cause));
15
+ this.url = url;
16
+ }
17
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class AccountRead {
9
+ account;
10
+ avatarUrl;
11
+ constructor(account, avatarUrl) {
12
+ this.account = account;
13
+ this.avatarUrl = avatarUrl;
14
+ }
15
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class CachedAnswer {
9
+ tag;
10
+ body;
11
+ readAt;
12
+ constructor(tag, body, readAt) {
13
+ this.tag = tag;
14
+ this.body = body;
15
+ this.readAt = readAt;
16
+ }
17
+ readAgainAt(readAt) {
18
+ return new CachedAnswer(this.tag, this.body, readAt);
19
+ }
20
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class DeviceGrant {
9
+ deviceCode;
10
+ code;
11
+ expiresIn;
12
+ interval;
13
+ constructor(deviceCode, code, expiresIn, interval) {
14
+ this.deviceCode = deviceCode;
15
+ this.code = code;
16
+ this.expiresIn = expiresIn;
17
+ this.interval = interval;
18
+ }
19
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class DevicePoll {
9
+ token;
10
+ slowDown;
11
+ interval;
12
+ constructor(token, slowDown, interval) {
13
+ this.token = token;
14
+ this.slowDown = slowDown;
15
+ this.interval = interval;
16
+ }
17
+ static pending() {
18
+ return new DevicePoll(null, false, null);
19
+ }
20
+ static slowedDown(interval) {
21
+ return new DevicePoll(null, true, interval);
22
+ }
23
+ static granted(token) {
24
+ return new DevicePoll(token, false, null);
25
+ }
26
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { Resources } from "../resources.js";
9
+ export class GitHubRepository {
10
+ owner;
11
+ name;
12
+ constructor(owner, name) {
13
+ this.owner = owner;
14
+ this.name = name;
15
+ }
16
+ static parse(path) {
17
+ const trimmed = path.endsWith(Resources.gitSuffix) ? path.slice(0, -Resources.gitSuffix.length) : path;
18
+ if (!Resources.repositoryPathPattern.test(trimmed))
19
+ return null;
20
+ const slash = trimmed.indexOf(Resources.repositoryPathSeparator);
21
+ return new GitHubRepository(trimmed.slice(0, slash), trimmed.slice(slash + 1));
22
+ }
23
+ pathOf(rest) {
24
+ return Resources.formatRepositoryPath(encodeURIComponent(this.owner), encodeURIComponent(this.name), rest);
25
+ }
26
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import { JsonReader } from "@noldova/context.json";
9
+ import { HostAccount } from "@noldova/git.hosting.protocol";
10
+ import { Resources } from "../resources.js";
11
+ export class KeptSignIn {
12
+ token;
13
+ account;
14
+ constructor(token, account) {
15
+ this.token = token;
16
+ this.account = account;
17
+ }
18
+ static fromJson(value) {
19
+ const reader = JsonReader.fromValue(value);
20
+ const account = reader.readObject(Resources.accountField);
21
+ return new KeptSignIn(reader.readNonBlankString(Resources.tokenField), new HostAccount(account.readNonBlankString(Resources.loginField), account.readNullableString(Resources.nameField), null, account.readStringArray(Resources.scopesField)));
22
+ }
23
+ toJson() {
24
+ return { [Resources.tokenField]: this.token, [Resources.accountField]: this.account.toJson() };
25
+ }
26
+ }