@forge/cli-shared 2.6.2 → 3.0.0-next.0

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 (50) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/out/auth/index.d.ts +0 -1
  3. package/out/auth/index.d.ts.map +1 -1
  4. package/out/auth/index.js +0 -1
  5. package/out/auth/personal/credential-store.d.ts +51 -0
  6. package/out/auth/personal/credential-store.d.ts.map +1 -0
  7. package/out/auth/personal/credential-store.js +170 -0
  8. package/out/auth/personal/index.d.ts +1 -4
  9. package/out/auth/personal/index.d.ts.map +1 -1
  10. package/out/auth/personal/index.js +1 -4
  11. package/out/auth/personal/login.d.ts +2 -2
  12. package/out/auth/personal/login.d.ts.map +1 -1
  13. package/out/auth/personal/login.js +1 -1
  14. package/out/auth/personal/logout.d.ts +2 -2
  15. package/out/auth/personal/logout.d.ts.map +1 -1
  16. package/out/auth/personal/token-authenticator.d.ts +3 -3
  17. package/out/auth/personal/token-authenticator.d.ts.map +1 -1
  18. package/out/auth/personal/token-authenticator.js +4 -4
  19. package/out/graphql/graphql-types.d.ts +380 -23
  20. package/out/graphql/graphql-types.d.ts.map +1 -1
  21. package/out/graphql/graphql-types.js +31 -1
  22. package/out/graphql/mutation-aware-graphql-client.d.ts +1 -1
  23. package/out/service/feature-flag-service.d.ts +3 -3
  24. package/out/service/feature-flag-service.d.ts.map +1 -1
  25. package/out/service/feature-flag-service.js +3 -3
  26. package/out/shared/product.d.ts +4 -1
  27. package/out/shared/product.d.ts.map +1 -1
  28. package/out/shared/product.js +11 -4
  29. package/out/shared/validate.d.ts +1 -1
  30. package/out/shared/validate.d.ts.map +1 -1
  31. package/out/shared/validate.js +5 -1
  32. package/out/ui/text.d.ts +8 -3
  33. package/out/ui/text.d.ts.map +1 -1
  34. package/out/ui/text.js +26 -9
  35. package/package.json +2 -4
  36. package/out/auth/credentials-store-provider.d.ts +0 -4
  37. package/out/auth/credentials-store-provider.d.ts.map +0 -1
  38. package/out/auth/credentials-store-provider.js +0 -11
  39. package/out/auth/personal/abstract-token-store-getter.d.ts +0 -13
  40. package/out/auth/personal/abstract-token-store-getter.d.ts.map +0 -1
  41. package/out/auth/personal/abstract-token-store-getter.js +0 -31
  42. package/out/auth/personal/token-store-cache.d.ts +0 -12
  43. package/out/auth/personal/token-store-cache.d.ts.map +0 -1
  44. package/out/auth/personal/token-store-cache.js +0 -41
  45. package/out/auth/personal/token-store-keytar.d.ts +0 -23
  46. package/out/auth/personal/token-store-keytar.d.ts.map +0 -1
  47. package/out/auth/personal/token-store-keytar.js +0 -101
  48. package/out/auth/personal/token-store.d.ts +0 -28
  49. package/out/auth/personal/token-store.d.ts.map +0 -1
  50. package/out/auth/personal/token-store.js +0 -21
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-store-keytar.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-store-keytar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAG9B,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAEL,6BAA6B,EAC7B,4BAA4B,EAC5B,+BAA+B,EAEhC,MAAM,eAAe,CAAC;AAKvB,MAAM,WAAW,MAAM;IACrB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AASD,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,GAAG,KAAK,CAOhD;AAED,eAAO,MAAM,SAAS,QAAO,OAO5B,CAAC;AAGF,qBAAa,iCAAkC,SAAQ,oCACrD,YAAW,4BAA4B,EAAE,6BAA6B;IAI1D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM;IAAE,OAAO,CAAC,QAAQ,CAAC,cAAc;IAHtF,OAAO,CAAC,aAAa,CAAS;gBAGC,cAAc,EAAE,MAAM,EAAmB,cAAc,EAAE,MAAM,MAAM;IAKpG,OAAO,CAAC,gBAAgB;IAQX,kBAAkB,IAAI,OAAO,CAAC,+BAA+B,CAAC;IA4BpE,8BAA8B,IAAI,MAAM;IAIxC,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3E,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzC,OAAO,CAAC,eAAe;CAkBxB"}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeytarPersonalApiCredentialsStore = exports.hasKeytar = exports.getKeytar = void 0;
4
- const Either_1 = require("fp-ts/lib/Either");
5
- const shared_1 = require("../../shared");
6
- const ui_1 = require("../../ui");
7
- const os_1 = require("os");
8
- const abstract_token_store_getter_1 = require("./abstract-token-store-getter");
9
- const token_store_1 = require("./token-store");
10
- const KEYTAR_SERVICE = 'Atlassian';
11
- const KEYTAR_ACCOUNT = 'Ecosystem';
12
- function getKeytar(ui) {
13
- try {
14
- return require('keytar');
15
- }
16
- catch (_a) {
17
- const error = new Error(ui_1.Text.error.noKeytar);
18
- return shared_1.exitOnError(ui)(error);
19
- }
20
- }
21
- exports.getKeytar = getKeytar;
22
- exports.hasKeytar = () => {
23
- try {
24
- require('keytar');
25
- return true;
26
- }
27
- catch (_a) {
28
- return false;
29
- }
30
- };
31
- class KeytarPersonalApiCredentialsStore extends abstract_token_store_getter_1.AbstractPersonalApiCredentialsGetter {
32
- constructor(graphqlGateway, keytarProvider) {
33
- super(graphqlGateway);
34
- this.graphqlGateway = graphqlGateway;
35
- this.keytarProvider = keytarProvider;
36
- this.keytarAccount = this.getKeytarAccount(graphqlGateway);
37
- }
38
- getKeytarAccount(graphqlGateway) {
39
- const isStaging = graphqlGateway.includes('.dev.') || graphqlGateway.includes('.stg.');
40
- if (isStaging) {
41
- return `${KEYTAR_ACCOUNT}-staging`;
42
- }
43
- return KEYTAR_ACCOUNT;
44
- }
45
- async getCredentialsImpl() {
46
- let stringifiedPersonalApiCredentials;
47
- try {
48
- stringifiedPersonalApiCredentials = await this.keytarProvider().getPassword(KEYTAR_SERVICE, this.keytarAccount);
49
- }
50
- catch (e) {
51
- this.wrapKeytarError(e);
52
- }
53
- if (!stringifiedPersonalApiCredentials) {
54
- throw new token_store_1.NoTokenInStoreError();
55
- }
56
- let personalApiCredentials;
57
- try {
58
- personalApiCredentials = JSON.parse(stringifiedPersonalApiCredentials);
59
- }
60
- catch (_a) {
61
- throw new token_store_1.NoTokenInStoreError();
62
- }
63
- const decodeResult = token_store_1.personalApiCredentialsValidatedShape.decode(personalApiCredentials);
64
- if (Either_1.isLeft(decodeResult)) {
65
- throw new token_store_1.NoTokenInStoreError();
66
- }
67
- return decodeResult.right;
68
- }
69
- getInstructionsWhenInvalidImpl() {
70
- return ui_1.Text.error.invalidTokenInKeytarOrCache;
71
- }
72
- setCredentials(credentials) {
73
- return this.keytarProvider()
74
- .setPassword(KEYTAR_SERVICE, this.keytarAccount, JSON.stringify(credentials))
75
- .catch((e) => this.wrapKeytarError(e));
76
- }
77
- deleteCredentials() {
78
- return this.keytarProvider()
79
- .deletePassword(KEYTAR_SERVICE, this.keytarAccount)
80
- .catch((e) => this.wrapKeytarError(e));
81
- }
82
- wrapKeytarError(e) {
83
- let error;
84
- const currentPlatform = os_1.platform();
85
- switch (currentPlatform) {
86
- case 'darwin':
87
- error = ui_1.Text.error.keytarAccessError.mac(e.message);
88
- break;
89
- case 'linux':
90
- error = ui_1.Text.error.keytarAccessError.linux(e.message);
91
- break;
92
- case 'win32':
93
- error = ui_1.Text.error.keytarAccessError.windows(e.message);
94
- break;
95
- default:
96
- error = ui_1.Text.error.keytarAccessError.other(e.message);
97
- }
98
- throw new Error(error);
99
- }
100
- }
101
- exports.KeytarPersonalApiCredentialsStore = KeytarPersonalApiCredentialsStore;
@@ -1,28 +0,0 @@
1
- import * as t from 'io-ts';
2
- export declare const personalApiCredentialsShape: t.TypeC<{
3
- email: t.StringC;
4
- token: t.StringC;
5
- }>;
6
- export declare const personalApiCredentialsValidatedShape: t.TypeC<{
7
- email: t.StringC;
8
- token: t.StringC;
9
- accountId: t.StringC;
10
- }>;
11
- export declare type PersonalApiCredentials = t.TypeOf<typeof personalApiCredentialsShape>;
12
- export declare type PersonalApiCredentialsValidated = t.TypeOf<typeof personalApiCredentialsValidatedShape>;
13
- export declare class NoTokenInStoreError extends Error {
14
- constructor();
15
- }
16
- export interface PersonalApiCredentialsGetter {
17
- getCredentials(): Promise<PersonalApiCredentialsValidated>;
18
- getInstructionsWhenInvalid(): string;
19
- }
20
- export interface PersonalApiCredentialsSetter {
21
- setCredentials(credentials: PersonalApiCredentialsValidated): Promise<void>;
22
- }
23
- export interface PersonalApiCredentialsDeleter {
24
- deleteCredentials(): Promise<void>;
25
- }
26
- export interface PersonalApiCredentialsStore extends PersonalApiCredentialsGetter, PersonalApiCredentialsSetter, PersonalApiCredentialsDeleter {
27
- }
28
- //# sourceMappingURL=token-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../src/auth/personal/token-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,OAAO,CAAC;AAG3B,eAAO,MAAM,2BAA2B;;;EAGtC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;EAI/C,CAAC;AAEH,oBAAY,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAClF,oBAAY,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAEpG,qBAAa,mBAAoB,SAAQ,KAAK;;CAI7C;AAED,MAAM,WAAW,4BAA4B;IAC3C,cAAc,IAAI,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAC3D,0BAA0B,IAAI,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,4BAA4B;IAC3C,cAAc,CAAC,WAAW,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E;AAED,MAAM,WAAW,6BAA6B;IAC5C,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,2BACf,SAAQ,4BAA4B,EAClC,4BAA4B,EAC5B,6BAA6B;CAAG"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoTokenInStoreError = exports.personalApiCredentialsValidatedShape = exports.personalApiCredentialsShape = void 0;
4
- const tslib_1 = require("tslib");
5
- const t = tslib_1.__importStar(require("io-ts"));
6
- const ui_1 = require("../../ui");
7
- exports.personalApiCredentialsShape = t.type({
8
- email: t.string,
9
- token: t.string
10
- });
11
- exports.personalApiCredentialsValidatedShape = t.type({
12
- email: t.string,
13
- token: t.string,
14
- accountId: t.string
15
- });
16
- class NoTokenInStoreError extends Error {
17
- constructor() {
18
- super(ui_1.Text.error.noTokenInKeytarOrCache);
19
- }
20
- }
21
- exports.NoTokenInStoreError = NoTokenInStoreError;