@shopify/cli-kit 3.16.3 → 3.18.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.
- package/CHANGELOG.md +26 -0
- package/README.md +1 -1
- package/assets/success.html +1 -1
- package/dist/analytics.d.ts +5 -5
- package/dist/analytics.js +5 -5
- package/dist/analytics.js.map +1 -1
- package/dist/api/common.d.ts +2 -2
- package/dist/api/common.js +2 -2
- package/dist/api/common.js.map +1 -1
- package/dist/api/graphql/index.d.ts +0 -2
- package/dist/api/graphql/index.js +0 -2
- package/dist/api/graphql/index.js.map +1 -1
- package/dist/api/oxygen.d.ts +5 -0
- package/dist/api/oxygen.js +30 -0
- package/dist/api/oxygen.js.map +1 -0
- package/dist/api/partners.d.ts +7 -7
- package/dist/api/partners.js +7 -7
- package/dist/api/partners.js.map +1 -1
- package/dist/api.d.ts +2 -2
- package/dist/api.js +2 -2
- package/dist/api.js.map +1 -1
- package/dist/common/object.d.ts +3 -3
- package/dist/common/object.js +3 -3
- package/dist/common/object.js.map +1 -1
- package/dist/content-tokens.js.map +1 -1
- package/dist/environment/fqdn.d.ts +3 -3
- package/dist/environment/fqdn.js +3 -3
- package/dist/environment/fqdn.js.map +1 -1
- package/dist/environment/local.d.ts +13 -13
- package/dist/environment/local.js +16 -16
- package/dist/environment/local.js.map +1 -1
- package/dist/environment/service.d.ts +1 -0
- package/dist/environment/service.js +3 -0
- package/dist/environment/service.js.map +1 -1
- package/dist/environment/spin.d.ts +12 -12
- package/dist/environment/spin.js +12 -12
- package/dist/environment/spin.js.map +1 -1
- package/dist/environment/utilities.d.ts +0 -2
- package/dist/environment/utilities.js +0 -2
- package/dist/environment/utilities.js.map +1 -1
- package/dist/environment.d.ts +3 -1
- package/dist/environment.js +3 -1
- package/dist/environment.js.map +1 -1
- package/dist/error.d.ts +1 -1
- package/dist/error.js +4 -3
- package/dist/error.js.map +1 -1
- package/dist/file.d.ts +17 -18
- package/dist/file.js +17 -18
- package/dist/file.js.map +1 -1
- package/dist/git.d.ts +1 -1
- package/dist/git.js +5 -2
- package/dist/git.js.map +1 -1
- package/dist/http/fetch.d.ts +2 -2
- package/dist/http/fetch.js +2 -2
- package/dist/http/fetch.js.map +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/http.js +1 -1
- package/dist/http.js.map +1 -1
- package/dist/id.d.ts +1 -1
- package/dist/id.js +1 -1
- package/dist/id.js.map +1 -1
- package/dist/network/service.d.ts +0 -2
- package/dist/network/service.js +0 -1
- package/dist/network/service.js.map +1 -1
- package/dist/node/archiver.d.ts +2 -2
- package/dist/node/archiver.js +2 -2
- package/dist/node/archiver.js.map +1 -1
- package/dist/node/checksum.d.ts +2 -2
- package/dist/node/checksum.js +2 -2
- package/dist/node/checksum.js.map +1 -1
- package/dist/node/cli.d.ts +1 -2
- package/dist/node/cli.js +2 -8
- package/dist/node/cli.js.map +1 -1
- package/dist/node/colors.d.ts +2 -1
- package/dist/node/colors.js +2 -7
- package/dist/node/colors.js.map +1 -1
- package/dist/node/dot-env.d.ts +7 -7
- package/dist/node/dot-env.js +7 -7
- package/dist/node/dot-env.js.map +1 -1
- package/dist/node/framework.d.ts +2 -2
- package/dist/node/framework.js +2 -2
- package/dist/node/framework.js.map +1 -1
- package/dist/node/hooks/prerun.js +6 -6
- package/dist/node/hooks/prerun.js.map +1 -1
- package/dist/node/node-package-manager.d.ts +32 -28
- package/dist/node/node-package-manager.js +29 -29
- package/dist/node/node-package-manager.js.map +1 -1
- package/dist/node/ruby.d.ts +4 -4
- package/dist/node/ruby.js +5 -5
- package/dist/node/ruby.js.map +1 -1
- package/dist/os.d.ts +1 -1
- package/dist/os.js +1 -1
- package/dist/os.js.map +1 -1
- package/dist/output.d.ts +26 -34
- package/dist/output.js +23 -143
- package/dist/output.js.map +1 -1
- package/dist/path.d.ts +4 -4
- package/dist/path.js +4 -4
- package/dist/path.js.map +1 -1
- package/dist/plugins.d.ts +4 -4
- package/dist/plugins.js +4 -4
- package/dist/plugins.js.map +1 -1
- package/dist/port.d.ts +1 -1
- package/dist/port.js +1 -1
- package/dist/port.js.map +1 -1
- package/dist/private/node/ui/alert.d.ts +2 -0
- package/dist/private/node/ui/alert.js +18 -0
- package/dist/private/node/ui/alert.js.map +1 -0
- package/dist/private/node/ui/components/Alert.d.ts +17 -0
- package/dist/private/node/ui/components/Alert.js +21 -0
- package/dist/private/node/ui/components/Alert.js.map +1 -0
- package/dist/private/node/ui/components/Banner.d.ts +7 -0
- package/dist/private/node/ui/components/Banner.js +35 -0
- package/dist/private/node/ui/components/Banner.js.map +1 -0
- package/dist/private/node/ui/components/Command.d.ts +9 -0
- package/dist/private/node/ui/components/Command.js +10 -0
- package/dist/private/node/ui/components/Command.js.map +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +48 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js +98 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
- package/dist/private/node/ui/components/Error.d.ts +8 -0
- package/dist/private/node/ui/components/Error.js +13 -0
- package/dist/private/node/ui/components/Error.js.map +1 -0
- package/dist/private/node/ui/components/FatalError.d.ts +7 -0
- package/dist/private/node/ui/components/FatalError.js +42 -0
- package/dist/private/node/ui/components/FatalError.js.map +1 -0
- package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
- package/dist/private/node/ui/components/FullScreen.js +32 -0
- package/dist/private/node/ui/components/FullScreen.js.map +1 -0
- package/dist/private/node/ui/components/Link.d.ts +10 -0
- package/dist/private/node/ui/components/Link.js +14 -0
- package/dist/private/node/ui/components/Link.js.map +1 -0
- package/dist/private/node/ui/components/List.d.ts +13 -0
- package/dist/private/node/ui/components/List.js +19 -0
- package/dist/private/node/ui/components/List.js.map +1 -0
- package/dist/private/node/ui/components/TextAnimation.d.ts +11 -0
- package/dist/private/node/ui/components/TextAnimation.js +46 -0
- package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.d.ts +21 -0
- package/dist/private/node/ui/components/TokenizedText.js +26 -0
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
- package/dist/private/node/ui/error.d.ts +4 -0
- package/dist/private/node/ui/error.js +12 -0
- package/dist/private/node/ui/error.js.map +1 -0
- package/dist/private/node/ui.d.ts +10 -0
- package/dist/private/node/ui.js +47 -0
- package/dist/private/node/ui.js.map +1 -0
- package/dist/public/common/array.d.ts +4 -4
- package/dist/public/common/array.js +4 -4
- package/dist/public/common/array.js.map +1 -1
- package/dist/public/node/ui.d.ts +155 -0
- package/dist/public/node/ui.js +163 -0
- package/dist/public/node/ui.js.map +1 -0
- package/dist/secure-store.d.ts +4 -4
- package/dist/secure-store.js +4 -4
- package/dist/secure-store.js.map +1 -1
- package/dist/session/device-authorization.d.ts +5 -5
- package/dist/session/device-authorization.js +5 -5
- package/dist/session/device-authorization.js.map +1 -1
- package/dist/session/exchange.d.ts +10 -16
- package/dist/session/exchange.js +10 -16
- package/dist/session/exchange.js.map +1 -1
- package/dist/session/post-auth.js +2 -2
- package/dist/session/post-auth.js.map +1 -1
- package/dist/session/redirect-listener.js +1 -1
- package/dist/session/redirect-listener.js.map +1 -1
- package/dist/session/schema.d.ts +3 -2
- package/dist/session/schema.js +3 -2
- package/dist/session/schema.js.map +1 -1
- package/dist/session/scopes.d.ts +3 -3
- package/dist/session/scopes.js +3 -3
- package/dist/session/scopes.js.map +1 -1
- package/dist/session/store.d.ts +2 -2
- package/dist/session/store.js +2 -2
- package/dist/session/store.js.map +1 -1
- package/dist/session/token.d.ts +1 -1
- package/dist/session/token.js +1 -1
- package/dist/session/token.js.map +1 -1
- package/dist/session/validate.d.ts +4 -4
- package/dist/session/validate.js +4 -7
- package/dist/session/validate.js.map +1 -1
- package/dist/session.d.ts +10 -10
- package/dist/session.js +12 -12
- package/dist/session.js.map +1 -1
- package/dist/string.d.ts +2 -2
- package/dist/string.js +2 -2
- package/dist/string.js.map +1 -1
- package/dist/system.d.ts +6 -9
- package/dist/system.js +23 -23
- package/dist/system.js.map +1 -1
- package/dist/template.d.ts +3 -3
- package/dist/template.js +3 -3
- package/dist/template.js.map +1 -1
- package/dist/testing/fixtures/render-concurrent.d.ts +1 -0
- package/dist/testing/fixtures/render-concurrent.js +28 -0
- package/dist/testing/fixtures/render-concurrent.js.map +1 -0
- package/dist/testing/output.d.ts +1 -0
- package/dist/testing/output.js +1 -0
- package/dist/testing/output.js.map +1 -1
- package/dist/testing/store.d.ts +2 -2
- package/dist/testing/store.js +2 -2
- package/dist/testing/store.js.map +1 -1
- package/dist/testing/ui.d.ts +8 -0
- package/dist/testing/ui.js +17 -0
- package/dist/testing/ui.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/inquirer/input.d.ts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +17 -8
- package/dist/ui.js.map +1 -1
- package/dist/version.d.ts +3 -3
- package/dist/version.js +3 -3
- package/dist/version.js.map +1 -1
- package/package.json +9 -2
- package/dist/api/graphql/functions/compile_module.d.ts +0 -15
- package/dist/api/graphql/functions/compile_module.js +0 -13
- package/dist/api/graphql/functions/compile_module.js.map +0 -1
- package/dist/api/graphql/functions/module_compilation_status.d.ts +0 -15
- package/dist/api/graphql/functions/module_compilation_status.js +0 -13
- package/dist/api/graphql/functions/module_compilation_status.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Error } from './components/Error.js';
|
|
2
|
+
import { FatalError } from './components/FatalError.js';
|
|
3
|
+
import { renderOnce } from '../ui.js';
|
|
4
|
+
import { consoleError } from '../../../output.js';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export function fatalError(error) {
|
|
7
|
+
renderOnce(React.createElement(FatalError, { error: error }), 'error', consoleError);
|
|
8
|
+
}
|
|
9
|
+
export function error({ headline, tryMessage }) {
|
|
10
|
+
renderOnce(React.createElement(Error, { headline: headline, tryMessage: tryMessage }), 'error', consoleError);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../src/private/node/ui/error.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,EAAC,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,UAAU,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;AACjE,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,EAAC,QAAQ,EAAE,UAAU,EAAa;IACtD,UAAU,CAAC,oBAAC,KAAK,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;AAC1F,CAAC","sourcesContent":["import {ErrorProps, Error} from './components/Error.js'\nimport {FatalError} from './components/FatalError.js'\nimport {Fatal} from '../../../error.js'\nimport {renderOnce} from '../ui.js'\nimport {consoleError} from '../../../output.js'\nimport React from 'react'\n\nexport function fatalError(error: Fatal) {\n renderOnce(<FatalError error={error} />, 'error', consoleError)\n}\n\nexport function error({headline, tryMessage}: ErrorProps) {\n renderOnce(<Error headline={headline} tryMessage={tryMessage} />, 'error', consoleError)\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Logger, LogLevel } from '../../output.js';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
export declare function renderOnce(element: JSX.Element, logLevel?: LogLevel, logger?: Logger): void;
|
|
4
|
+
export declare function render(element: JSX.Element): import("ink").Instance;
|
|
5
|
+
interface Instance {
|
|
6
|
+
output: string | undefined;
|
|
7
|
+
unmount: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const renderString: (element: ReactElement) => Instance;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isUnitTest } from '../../environment/local.js';
|
|
2
|
+
import { collectLog, consoleLog, outputWhereAppropriate } from '../../output.js';
|
|
3
|
+
import { render as inkRender } from 'ink';
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
export function renderOnce(element, logLevel = 'info', logger = consoleLog) {
|
|
6
|
+
const { output, unmount } = renderString(element);
|
|
7
|
+
if (output) {
|
|
8
|
+
if (isUnitTest())
|
|
9
|
+
collectLog(logLevel, output);
|
|
10
|
+
outputWhereAppropriate(logLevel, logger, output);
|
|
11
|
+
}
|
|
12
|
+
unmount();
|
|
13
|
+
}
|
|
14
|
+
export function render(element) {
|
|
15
|
+
return inkRender(element);
|
|
16
|
+
}
|
|
17
|
+
const TEST_TERMINAL_WIDTH = 80;
|
|
18
|
+
class OutputStream extends EventEmitter {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
super();
|
|
21
|
+
this.write = (frame) => {
|
|
22
|
+
this._lastFrame = frame;
|
|
23
|
+
};
|
|
24
|
+
this.lastFrame = () => {
|
|
25
|
+
return this._lastFrame;
|
|
26
|
+
};
|
|
27
|
+
this.columns = options.columns;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export const renderString = (element) => {
|
|
31
|
+
const stdout = new OutputStream({ columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stdout.columns });
|
|
32
|
+
const stderr = new OutputStream({ columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stderr.columns });
|
|
33
|
+
const instance = inkRender(element, {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
stdout: stdout,
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
+
stderr: stderr,
|
|
38
|
+
debug: true,
|
|
39
|
+
exitOnCtrlC: false,
|
|
40
|
+
patchConsole: false,
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
output: stdout.lastFrame(),
|
|
44
|
+
unmount: instance.unmount,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/private/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAC,UAAU,EAAE,UAAU,EAAoB,sBAAsB,EAAC,MAAM,iBAAiB,CAAA;AAEhG,OAAO,EAAC,MAAM,IAAI,SAAS,EAAC,MAAM,KAAK,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAEnC,MAAM,UAAU,UAAU,CAAC,OAAoB,EAAE,WAAqB,MAAM,EAAE,SAAiB,UAAU;IACvG,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IAE/C,IAAI,MAAM,EAAE;QACV,IAAI,UAAU,EAAE;YAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC9C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KACjD;IAED,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAoB;IACzC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAA;AAC3B,CAAC;AAOD,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAC9B,MAAM,YAAa,SAAQ,YAAY;IAIrC,YAAY,OAA0B;QACpC,KAAK,EAAE,CAAA;QAIT,UAAK,GAAG,CAAC,KAAa,EAAE,EAAE;YACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACzB,CAAC,CAAA;QAED,cAAS,GAAG,GAAG,EAAE;YACf,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC,CAAA;QATC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAChC,CAAC;CASF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAqB,EAAY,EAAE;IAC9D,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC,CAAA;IACvG,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAC,CAAC,CAAA;IAEvG,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE;QAClC,8DAA8D;QAC9D,MAAM,EAAE,MAAa;QACrB,8DAA8D;QAC9D,MAAM,EAAE,MAAa;QACrB,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAA;IAEF,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE;QAC1B,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAA;AACH,CAAC,CAAA","sourcesContent":["import {isUnitTest} from '../../environment/local.js'\nimport {collectLog, consoleLog, Logger, LogLevel, outputWhereAppropriate} from '../../output.js'\nimport {ReactElement} from 'react'\nimport {render as inkRender} from 'ink'\nimport {EventEmitter} from 'events'\n\nexport function renderOnce(element: JSX.Element, logLevel: LogLevel = 'info', logger: Logger = consoleLog) {\n const {output, unmount} = renderString(element)\n\n if (output) {\n if (isUnitTest()) collectLog(logLevel, output)\n outputWhereAppropriate(logLevel, logger, output)\n }\n\n unmount()\n}\n\nexport function render(element: JSX.Element) {\n return inkRender(element)\n}\n\ninterface Instance {\n output: string | undefined\n unmount: () => void\n}\n\nconst TEST_TERMINAL_WIDTH = 80\nclass OutputStream extends EventEmitter {\n columns: number\n private _lastFrame?: string\n\n constructor(options: {columns: number}) {\n super()\n this.columns = options.columns\n }\n\n write = (frame: string) => {\n this._lastFrame = frame\n }\n\n lastFrame = () => {\n return this._lastFrame\n }\n}\n\nexport const renderString = (element: ReactElement): Instance => {\n const stdout = new OutputStream({columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stdout.columns})\n const stderr = new OutputStream({columns: isUnitTest() ? TEST_TERMINAL_WIDTH : process.stderr.columns})\n\n const instance = inkRender(element, {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stdout: stdout as any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stderr: stderr as any,\n debug: true,\n exitOnCtrlC: false,\n patchConsole: false,\n })\n\n return {\n output: stdout.lastFrame(),\n unmount: instance.unmount,\n }\n}\n"]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Takes a random value from an array.
|
|
3
|
-
* @param array
|
|
3
|
+
* @param array - Array from which we'll select a random item.
|
|
4
4
|
* @returns A random element from the array.
|
|
5
5
|
*/
|
|
6
6
|
export declare function takeRandomFromArray<T>(array: T[]): T | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* Returns a copy of the array deleting the elemements that are undefined.
|
|
9
|
-
* @param array
|
|
10
|
-
* @returns
|
|
9
|
+
* @param array - The array whose undefined will be deleted.
|
|
10
|
+
* @returns A copy of the array with the undefined elements deleted.
|
|
11
11
|
*/
|
|
12
12
|
export declare function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[];
|
|
13
13
|
/**
|
|
14
14
|
* Returns true if an array contains duplicates.
|
|
15
|
-
* @returns
|
|
15
|
+
* @returns True if the array contains duplicates.
|
|
16
16
|
*/
|
|
17
17
|
export declare function getArrayContainsDuplicates<T>(array: T[]): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Takes a random value from an array.
|
|
3
|
-
* @param array
|
|
3
|
+
* @param array - Array from which we'll select a random item.
|
|
4
4
|
* @returns A random element from the array.
|
|
5
5
|
*/
|
|
6
6
|
export function takeRandomFromArray(array) {
|
|
@@ -8,15 +8,15 @@ export function takeRandomFromArray(array) {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Returns a copy of the array deleting the elemements that are undefined.
|
|
11
|
-
* @param array
|
|
12
|
-
* @returns
|
|
11
|
+
* @param array - The array whose undefined will be deleted.
|
|
12
|
+
* @returns A copy of the array with the undefined elements deleted.
|
|
13
13
|
*/
|
|
14
14
|
export function getArrayRejectingUndefined(array) {
|
|
15
15
|
return array.filter((item) => item !== undefined);
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Returns true if an array contains duplicates.
|
|
19
|
-
* @returns
|
|
19
|
+
* @returns True if the array contains duplicates.
|
|
20
20
|
*/
|
|
21
21
|
export function getArrayContainsDuplicates(array) {
|
|
22
22
|
return array.length !== new Set(array).size;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/public/common/array.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAI,KAAU;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAwB;IACpE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAmC,CAAA;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAU;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAA;AAC7C,CAAC","sourcesContent":["/**\n * Takes a random value from an array.\n * @param array
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/public/common/array.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAI,KAAU;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAwB;IACpE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAmC,CAAA;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAI,KAAU;IACtD,OAAO,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAA;AAC7C,CAAC","sourcesContent":["/**\n * Takes a random value from an array.\n * @param array - Array from which we'll select a random item.\n * @returns A random element from the array.\n */\nexport function takeRandomFromArray<T>(array: T[]) {\n return array[Math.floor(Math.random() * array.length)]\n}\n\n/**\n * Returns a copy of the array deleting the elemements that are undefined.\n * @param array - The array whose undefined will be deleted.\n * @returns A copy of the array with the undefined elements deleted.\n */\nexport function getArrayRejectingUndefined<T>(array: (T | undefined)[]): T[] {\n return array.filter((item) => item !== undefined) as Exclude<T, null | undefined>[]\n}\n\n/**\n * Returns true if an array contains duplicates.\n * @returns True if the array contains duplicates.\n */\nexport function getArrayContainsDuplicates<T>(array: T[]) {\n return array.length !== new Set(array).size\n}\n"]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { OutputProcess } from '../../output.js';
|
|
2
|
+
import { Fatal } from '../../error.js';
|
|
3
|
+
import { AlertProps } from '../../private/node/ui/components/Alert.js';
|
|
4
|
+
import { ErrorProps } from '../../private/node/ui/components/Error.js';
|
|
5
|
+
import { AbortController } from 'abort-controller';
|
|
6
|
+
interface RenderConcurrentOptions {
|
|
7
|
+
processes: OutputProcess[];
|
|
8
|
+
abortController?: AbortController;
|
|
9
|
+
showTimestamps?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderConcurrent({ processes, abortController, showTimestamps }: RenderConcurrentOptions): Promise<void>;
|
|
15
|
+
declare type RenderAlertOptions = Omit<AlertProps, 'type'>;
|
|
16
|
+
/**
|
|
17
|
+
* Renders an information banner to the console.
|
|
18
|
+
*
|
|
19
|
+
* Basic:
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* ╭─ info ───────────────────────────────────────────────────╮
|
|
23
|
+
* │ │
|
|
24
|
+
* │ Body │
|
|
25
|
+
* │ │
|
|
26
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Complete:
|
|
30
|
+
* ```
|
|
31
|
+
* ╭─ info ───────────────────────────────────────────────────╮
|
|
32
|
+
* │ │
|
|
33
|
+
* │ Title │
|
|
34
|
+
* │ │
|
|
35
|
+
* │ Body │
|
|
36
|
+
* │ │
|
|
37
|
+
* │ Next steps │
|
|
38
|
+
* │ • Run cd santorini-goods │
|
|
39
|
+
* │ • To preview your project, run npm app dev │
|
|
40
|
+
* │ • To add extensions, run npm generate extension │
|
|
41
|
+
* │ │
|
|
42
|
+
* │ Reference │
|
|
43
|
+
* │ • Run npm shopify help │
|
|
44
|
+
* │ • Press 'return' to open the dev docs: │
|
|
45
|
+
* │ https://shopify.dev │
|
|
46
|
+
* │ │
|
|
47
|
+
* │ Link: https://shopify.com │
|
|
48
|
+
* │ │
|
|
49
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function renderInfo(options: RenderAlertOptions): void;
|
|
53
|
+
/**
|
|
54
|
+
* Renders a success banner to the console.
|
|
55
|
+
*
|
|
56
|
+
* Basic:
|
|
57
|
+
*
|
|
58
|
+
* ```
|
|
59
|
+
* ╭─ success ────────────────────────────────────────────────╮
|
|
60
|
+
* │ │
|
|
61
|
+
* │ Title │
|
|
62
|
+
* │ │
|
|
63
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* Complete:
|
|
67
|
+
* ```
|
|
68
|
+
* ╭─ success ────────────────────────────────────────────────╮
|
|
69
|
+
* │ │
|
|
70
|
+
* │ Title │
|
|
71
|
+
* │ │
|
|
72
|
+
* │ Body │
|
|
73
|
+
* │ │
|
|
74
|
+
* │ Next steps │
|
|
75
|
+
* │ • Run cd santorini-goods │
|
|
76
|
+
* │ • To preview your project, run npm app dev │
|
|
77
|
+
* │ • To add extensions, run npm generate extension │
|
|
78
|
+
* │ │
|
|
79
|
+
* │ Reference │
|
|
80
|
+
* │ • Run npm shopify help │
|
|
81
|
+
* │ • Press 'return' to open the dev docs: │
|
|
82
|
+
* │ https://shopify.dev │
|
|
83
|
+
* │ │
|
|
84
|
+
* │ Link: https://shopify.com │
|
|
85
|
+
* │ │
|
|
86
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function renderSuccess(options: RenderAlertOptions): void;
|
|
90
|
+
/**
|
|
91
|
+
* Renders a warning banner to the console.
|
|
92
|
+
*
|
|
93
|
+
* Basic:
|
|
94
|
+
*
|
|
95
|
+
* ```
|
|
96
|
+
* ╭─ warning ────────────────────────────────────────────────╮
|
|
97
|
+
* │ │
|
|
98
|
+
* │ Title │
|
|
99
|
+
* │ │
|
|
100
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* Complete:
|
|
104
|
+
* ```
|
|
105
|
+
* ╭─ warning ────────────────────────────────────────────────╮
|
|
106
|
+
* │ │
|
|
107
|
+
* │ Title │
|
|
108
|
+
* │ │
|
|
109
|
+
* │ Body │
|
|
110
|
+
* │ │
|
|
111
|
+
* │ Next steps │
|
|
112
|
+
* │ • Run cd santorini-goods │
|
|
113
|
+
* │ • To preview your project, run npm app dev │
|
|
114
|
+
* │ • To add extensions, run npm generate extension │
|
|
115
|
+
* │ │
|
|
116
|
+
* │ Reference │
|
|
117
|
+
* │ • Run npm shopify help │
|
|
118
|
+
* │ • Press 'return' to open the dev docs: │
|
|
119
|
+
* │ https://shopify.dev │
|
|
120
|
+
* │ │
|
|
121
|
+
* │ Link: https://shopify.com │
|
|
122
|
+
* │ │
|
|
123
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare function renderWarning(options: RenderAlertOptions): void;
|
|
127
|
+
/**
|
|
128
|
+
* Renders a Fatal error to the console inside a banner.
|
|
129
|
+
*
|
|
130
|
+
* ```
|
|
131
|
+
* ╭─ error ──────────────────────────────────────────────────╮
|
|
132
|
+
* │ │
|
|
133
|
+
* │ Couldn't connect to the Shopify Partner Dashboard. │
|
|
134
|
+
* │ │
|
|
135
|
+
* │ Check your internet connection and try again. │
|
|
136
|
+
* │ │
|
|
137
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export declare function renderFatalError(error: Fatal): void;
|
|
141
|
+
/**
|
|
142
|
+
* Renders a generic error to the console inside a banner.
|
|
143
|
+
*
|
|
144
|
+
* ```
|
|
145
|
+
* ╭─ error ──────────────────────────────────────────────────╮
|
|
146
|
+
* │ │
|
|
147
|
+
* │ Something went wrong. │
|
|
148
|
+
* │ │
|
|
149
|
+
* │ Check your internet connection. │
|
|
150
|
+
* │ │
|
|
151
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare function renderError(options: ErrorProps): void;
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js';
|
|
2
|
+
import { render } from '../../private/node/ui.js';
|
|
3
|
+
import { alert } from '../../private/node/ui/alert.js';
|
|
4
|
+
import { fatalError, error } from '../../private/node/ui/error.js';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { AbortController } from 'abort-controller';
|
|
7
|
+
/**
|
|
8
|
+
* Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
|
|
9
|
+
*/
|
|
10
|
+
export async function renderConcurrent({ processes, abortController, showTimestamps = true }) {
|
|
11
|
+
const { waitUntilExit } = render(React.createElement(ConcurrentOutput, { processes: processes, abortController: abortController ?? new AbortController(), showTimestamps: showTimestamps }));
|
|
12
|
+
return waitUntilExit();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Renders an information banner to the console.
|
|
16
|
+
*
|
|
17
|
+
* Basic:
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
20
|
+
* ╭─ info ───────────────────────────────────────────────────╮
|
|
21
|
+
* │ │
|
|
22
|
+
* │ Body │
|
|
23
|
+
* │ │
|
|
24
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Complete:
|
|
28
|
+
* ```
|
|
29
|
+
* ╭─ info ───────────────────────────────────────────────────╮
|
|
30
|
+
* │ │
|
|
31
|
+
* │ Title │
|
|
32
|
+
* │ │
|
|
33
|
+
* │ Body │
|
|
34
|
+
* │ │
|
|
35
|
+
* │ Next steps │
|
|
36
|
+
* │ • Run cd santorini-goods │
|
|
37
|
+
* │ • To preview your project, run npm app dev │
|
|
38
|
+
* │ • To add extensions, run npm generate extension │
|
|
39
|
+
* │ │
|
|
40
|
+
* │ Reference │
|
|
41
|
+
* │ • Run npm shopify help │
|
|
42
|
+
* │ • Press 'return' to open the dev docs: │
|
|
43
|
+
* │ https://shopify.dev │
|
|
44
|
+
* │ │
|
|
45
|
+
* │ Link: https://shopify.com │
|
|
46
|
+
* │ │
|
|
47
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export function renderInfo(options) {
|
|
51
|
+
alert({ ...options, type: 'info' });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders a success banner to the console.
|
|
55
|
+
*
|
|
56
|
+
* Basic:
|
|
57
|
+
*
|
|
58
|
+
* ```
|
|
59
|
+
* ╭─ success ────────────────────────────────────────────────╮
|
|
60
|
+
* │ │
|
|
61
|
+
* │ Title │
|
|
62
|
+
* │ │
|
|
63
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* Complete:
|
|
67
|
+
* ```
|
|
68
|
+
* ╭─ success ────────────────────────────────────────────────╮
|
|
69
|
+
* │ │
|
|
70
|
+
* │ Title │
|
|
71
|
+
* │ │
|
|
72
|
+
* │ Body │
|
|
73
|
+
* │ │
|
|
74
|
+
* │ Next steps │
|
|
75
|
+
* │ • Run cd santorini-goods │
|
|
76
|
+
* │ • To preview your project, run npm app dev │
|
|
77
|
+
* │ • To add extensions, run npm generate extension │
|
|
78
|
+
* │ │
|
|
79
|
+
* │ Reference │
|
|
80
|
+
* │ • Run npm shopify help │
|
|
81
|
+
* │ • Press 'return' to open the dev docs: │
|
|
82
|
+
* │ https://shopify.dev │
|
|
83
|
+
* │ │
|
|
84
|
+
* │ Link: https://shopify.com │
|
|
85
|
+
* │ │
|
|
86
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export function renderSuccess(options) {
|
|
90
|
+
alert({ ...options, type: 'success' });
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Renders a warning banner to the console.
|
|
94
|
+
*
|
|
95
|
+
* Basic:
|
|
96
|
+
*
|
|
97
|
+
* ```
|
|
98
|
+
* ╭─ warning ────────────────────────────────────────────────╮
|
|
99
|
+
* │ │
|
|
100
|
+
* │ Title │
|
|
101
|
+
* │ │
|
|
102
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* Complete:
|
|
106
|
+
* ```
|
|
107
|
+
* ╭─ warning ────────────────────────────────────────────────╮
|
|
108
|
+
* │ │
|
|
109
|
+
* │ Title │
|
|
110
|
+
* │ │
|
|
111
|
+
* │ Body │
|
|
112
|
+
* │ │
|
|
113
|
+
* │ Next steps │
|
|
114
|
+
* │ • Run cd santorini-goods │
|
|
115
|
+
* │ • To preview your project, run npm app dev │
|
|
116
|
+
* │ • To add extensions, run npm generate extension │
|
|
117
|
+
* │ │
|
|
118
|
+
* │ Reference │
|
|
119
|
+
* │ • Run npm shopify help │
|
|
120
|
+
* │ • Press 'return' to open the dev docs: │
|
|
121
|
+
* │ https://shopify.dev │
|
|
122
|
+
* │ │
|
|
123
|
+
* │ Link: https://shopify.com │
|
|
124
|
+
* │ │
|
|
125
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export function renderWarning(options) {
|
|
129
|
+
alert({ ...options, type: 'warning' });
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Renders a Fatal error to the console inside a banner.
|
|
133
|
+
*
|
|
134
|
+
* ```
|
|
135
|
+
* ╭─ error ──────────────────────────────────────────────────╮
|
|
136
|
+
* │ │
|
|
137
|
+
* │ Couldn't connect to the Shopify Partner Dashboard. │
|
|
138
|
+
* │ │
|
|
139
|
+
* │ Check your internet connection and try again. │
|
|
140
|
+
* │ │
|
|
141
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export function renderFatalError(error) {
|
|
145
|
+
fatalError(error);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Renders a generic error to the console inside a banner.
|
|
149
|
+
*
|
|
150
|
+
* ```
|
|
151
|
+
* ╭─ error ──────────────────────────────────────────────────╮
|
|
152
|
+
* │ │
|
|
153
|
+
* │ Something went wrong. │
|
|
154
|
+
* │ │
|
|
155
|
+
* │ Check your internet connection. │
|
|
156
|
+
* │ │
|
|
157
|
+
* ╰──────────────────────────────────────────────────────────╯
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export function renderError(options) {
|
|
161
|
+
error(options);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,sDAAsD,CAAA;AAEnF,OAAO,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAA;AAE/C,OAAO,EAAC,KAAK,EAAC,MAAM,gCAAgC,CAAA;AACpD,OAAO,EAAC,UAAU,EAAE,KAAK,EAAC,MAAM,gCAAgC,CAAA;AAGhE,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAA;AAQhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAAC,SAAS,EAAE,eAAe,EAAE,cAAc,GAAG,IAAI,EAA0B;IACjH,MAAM,EAAC,aAAa,EAAC,GAAG,MAAM,CAC5B,oBAAC,gBAAgB,IACf,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,IAAI,IAAI,eAAe,EAAE,EACzD,cAAc,EAAE,cAAc,GAC9B,CACH,CAAA;IAED,OAAO,aAAa,EAAE,CAAA;AACxB,CAAC;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,UAAU,CAAC,OAA2B;IACpD,KAAK,CAAC,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,aAAa,CAAC,OAA2B;IACvD,KAAK,CAAC,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,aAAa,CAAC,OAA2B;IACvD,KAAK,CAAC,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,UAAU,CAAC,KAAK,CAAC,CAAA;AACnB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,OAAmB;IAC7C,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC","sourcesContent":["import ConcurrentOutput from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {OutputProcess} from '../../output.js'\nimport {render} from '../../private/node/ui.js'\nimport {Fatal} from '../../error.js'\nimport {alert} from '../../private/node/ui/alert.js'\nimport {fatalError, error} from '../../private/node/ui/error.js'\nimport {AlertProps} from '../../private/node/ui/components/Alert.js'\nimport {ErrorProps} from '../../private/node/ui/components/Error.js'\nimport React from 'react'\nimport {AbortController} from 'abort-controller'\n\ninterface RenderConcurrentOptions {\n processes: OutputProcess[]\n abortController?: AbortController\n showTimestamps?: boolean\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n */\nexport async function renderConcurrent({processes, abortController, showTimestamps = true}: RenderConcurrentOptions) {\n const {waitUntilExit} = render(\n <ConcurrentOutput\n processes={processes}\n abortController={abortController ?? new AbortController()}\n showTimestamps={showTimestamps}\n />,\n )\n\n return waitUntilExit()\n}\n\ntype RenderAlertOptions = Omit<AlertProps, 'type'>\n\n/**\n * Renders an information banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Body │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run cd santorini-goods │\n * │ • To preview your project, run npm app dev │\n * │ • To add extensions, run npm generate extension │\n * │ │\n * │ Reference │\n * │ • Run npm shopify help │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderInfo(options: RenderAlertOptions) {\n alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run cd santorini-goods │\n * │ • To preview your project, run npm app dev │\n * │ • To add extensions, run npm generate extension │\n * │ │\n * │ Reference │\n * │ • Run npm shopify help │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n *\n * Basic:\n *\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n *\n * Complete:\n * ```\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Title │\n * │ │\n * │ Body │\n * │ │\n * │ Next steps │\n * │ • Run cd santorini-goods │\n * │ • To preview your project, run npm app dev │\n * │ • To add extensions, run npm generate extension │\n * │ │\n * │ Reference │\n * │ • Run npm shopify help │\n * │ • Press 'return' to open the dev docs: │\n * │ https://shopify.dev │\n * │ │\n * │ Link: https://shopify.com │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderWarning(options: RenderAlertOptions) {\n alert({...options, type: 'warning'})\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n *\n * ```\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Couldn't connect to the Shopify Partner Dashboard. │\n * │ │\n * │ Check your internet connection and try again. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderFatalError(error: Fatal) {\n fatalError(error)\n}\n\n/**\n * Renders a generic error to the console inside a banner.\n *\n * ```\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ Check your internet connection. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * ```\n */\nexport function renderError(options: ErrorProps) {\n error(options)\n}\n"]}
|
package/dist/secure-store.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fetches secured content from the system's keychain.
|
|
3
|
-
* @param identifier
|
|
3
|
+
* @param identifier - Identifier to identify the content.
|
|
4
4
|
* @returns A promise that resolves with the content or null if it doesn't exist.
|
|
5
5
|
*/
|
|
6
6
|
export declare function fetch(identifier: string): Promise<string | null>;
|
|
7
7
|
/**
|
|
8
8
|
* Securely stores the content under the given key.
|
|
9
|
-
* @param identifier
|
|
10
|
-
* @param content
|
|
9
|
+
* @param identifier - Identifier to identify the content.
|
|
10
|
+
* @param content - The content to be stored.
|
|
11
11
|
* @returns A promise that resolves when the storing completes.
|
|
12
12
|
*/
|
|
13
13
|
export declare function store(identifier: string, content: string): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Removes the content with the given identifier.
|
|
16
|
-
* @param identifier
|
|
16
|
+
* @param identifier - Identifier to identify the content.
|
|
17
17
|
* @returns A promise that resolves with true if the content was deleted.
|
|
18
18
|
*/
|
|
19
19
|
export declare function remove(identifier: string): Promise<boolean>;
|
package/dist/secure-store.js
CHANGED
|
@@ -3,7 +3,7 @@ import { content as outputContent, debug } from './output.js';
|
|
|
3
3
|
import { Abort } from './error.js';
|
|
4
4
|
/**
|
|
5
5
|
* Fetches secured content from the system's keychain.
|
|
6
|
-
* @param identifier
|
|
6
|
+
* @param identifier - Identifier to identify the content.
|
|
7
7
|
* @returns A promise that resolves with the content or null if it doesn't exist.
|
|
8
8
|
*/
|
|
9
9
|
export async function fetch(identifier) {
|
|
@@ -19,8 +19,8 @@ export async function fetch(identifier) {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Securely stores the content under the given key.
|
|
22
|
-
* @param identifier
|
|
23
|
-
* @param content
|
|
22
|
+
* @param identifier - Identifier to identify the content.
|
|
23
|
+
* @param content - The content to be stored.
|
|
24
24
|
* @returns A promise that resolves when the storing completes.
|
|
25
25
|
*/
|
|
26
26
|
export async function store(identifier, content) {
|
|
@@ -35,7 +35,7 @@ export async function store(identifier, content) {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Removes the content with the given identifier.
|
|
38
|
-
* @param identifier
|
|
38
|
+
* @param identifier - Identifier to identify the content.
|
|
39
39
|
* @returns A promise that resolves with true if the content was deleted.
|
|
40
40
|
*/
|
|
41
41
|
export async function remove(identifier) {
|
package/dist/secure-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure-store.js","sourceRoot":"","sources":["../src/secure-store.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAEhC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,UAAkB;IAC5C,KAAK,CAAC,aAAa,CAAA,WAAW,UAAU,2BAA2B,CAAC,CAAA;IACpE,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAChF,OAAO,OAAO,CAAA;KACf;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,sCAAsC,CAAC,CAAA;KACjE;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,UAAkB,EAAE,OAAe;IAC7D,KAAK,CAAC,aAAa,CAAA,YAAY,UAAU,0CAA0C,CAAC,CAAA;IACpF,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;KAClF;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,mCAAmC,CAAC,CAAA;KAC9D;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,UAAkB;IAC7C,KAAK,CAAC,aAAa,CAAA,YAAY,UAAU,2BAA2B,CAAC,CAAA;IACrE,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAC1F,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,wCAAwC,CAAC,CAAA;KACnE;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,OAAe;IAClD,IAAI,UAAU,GAAG,OAAO,CAAA;IACxB,IAAI,KAAK,GAAuB,EAAE,CAAA;IAClC,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QACjD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;KACpB;IACD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;IACnC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;IACnB,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import constants from './constants.js'\nimport {content as outputContent, debug} from './output.js'\nimport {Abort} from './error.js'\n\n/**\n * Fetches secured content from the system's keychain.\n * @param identifier
|
|
1
|
+
{"version":3,"file":"secure-store.js","sourceRoot":"","sources":["../src/secure-store.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAC,OAAO,IAAI,aAAa,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAEhC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,UAAkB;IAC5C,KAAK,CAAC,aAAa,CAAA,WAAW,UAAU,2BAA2B,CAAC,CAAA;IACpE,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAChF,OAAO,OAAO,CAAA;KACf;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,sCAAsC,CAAC,CAAA;KACjE;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,UAAkB,EAAE,OAAe;IAC7D,KAAK,CAAC,aAAa,CAAA,YAAY,UAAU,0CAA0C,CAAC,CAAA;IACpF,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;KAClF;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,mCAAmC,CAAC,CAAA;KAC9D;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,UAAkB;IAC7C,KAAK,CAAC,aAAa,CAAA,YAAY,UAAU,2BAA2B,CAAC,CAAA;IACrE,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;QACrC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAC1F,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,WAAW,CAAC,KAAK,EAAE,wCAAwC,CAAC,CAAA;KACnE;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,OAAe;IAClD,IAAI,UAAU,GAAG,OAAO,CAAA;IACxB,IAAI,KAAK,GAAuB,EAAE,CAAA;IAClC,IAAI,KAAK,YAAY,KAAK,EAAE;QAC1B,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QACjD,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;KACpB;IACD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;IACnC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;IACnB,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import constants from './constants.js'\nimport {content as outputContent, debug} from './output.js'\nimport {Abort} from './error.js'\n\n/**\n * Fetches secured content from the system's keychain.\n * @param identifier - Identifier to identify the content.\n * @returns A promise that resolves with the content or null if it doesn't exist.\n */\nexport async function fetch(identifier: string): Promise<string | null> {\n debug(outputContent`Reading ${identifier} from the secure store...`)\n try {\n const keytar = await import('keytar')\n const content = await keytar.getPassword(constants.keychain.service, identifier)\n return content\n } catch (error) {\n throw createAbort(error, 'Unable to read from the secure store')\n }\n}\n\n/**\n * Securely stores the content under the given key.\n * @param identifier - Identifier to identify the content.\n * @param content - The content to be stored.\n * @returns A promise that resolves when the storing completes.\n */\nexport async function store(identifier: string, content: string): Promise<void> {\n debug(outputContent`Updating ${identifier} in the secure store with new content...`)\n try {\n const keytar = await import('keytar')\n await keytar.default.setPassword(constants.keychain.service, identifier, content)\n } catch (error) {\n throw createAbort(error, 'Unable to update the secure store')\n }\n}\n\n/**\n * Removes the content with the given identifier.\n * @param identifier - Identifier to identify the content.\n * @returns A promise that resolves with true if the content was deleted.\n */\nexport async function remove(identifier: string): Promise<boolean> {\n debug(outputContent`Removing ${identifier} from the secure store...`)\n try {\n const keytar = await import('keytar')\n const result = await keytar.default.deletePassword(constants.keychain.service, identifier)\n return result\n } catch (error) {\n throw createAbort(error, 'Unable to remove from the secure store')\n }\n}\n\nfunction createAbort(error: unknown, message: string) {\n let newMessage = message\n let stack: string | undefined = ''\n if (error instanceof Error) {\n newMessage = message.concat(`: ${error.message}`)\n stack = error.stack\n }\n const abort = new Abort(newMessage)\n abort.stack = stack\n return abort\n}\n"]}
|
|
@@ -14,8 +14,8 @@ export interface DeviceAuthorizationResponse {
|
|
|
14
14
|
*
|
|
15
15
|
* Also returns a `deviceCode` used for polling the token endpoint in the next step.
|
|
16
16
|
*
|
|
17
|
-
* @param scopes The scopes to request
|
|
18
|
-
* @returns
|
|
17
|
+
* @param scopes - The scopes to request
|
|
18
|
+
* @returns An object with the device authorization response.
|
|
19
19
|
*/
|
|
20
20
|
export declare function requestDeviceAuthorization(scopes: string[]): Promise<DeviceAuthorizationResponse>;
|
|
21
21
|
/**
|
|
@@ -25,8 +25,8 @@ export declare function requestDeviceAuthorization(scopes: string[]): Promise<De
|
|
|
25
25
|
*
|
|
26
26
|
* Timeout for the polling is defined by the server and is around 600 seconds.
|
|
27
27
|
*
|
|
28
|
-
* @param code The device code obtained after starting a device identity flow
|
|
29
|
-
* @param interval The interval to poll the token endpoint
|
|
30
|
-
* @returns
|
|
28
|
+
* @param code - The device code obtained after starting a device identity flow
|
|
29
|
+
* @param interval - The interval to poll the token endpoint
|
|
30
|
+
* @returns The identity token
|
|
31
31
|
*/
|
|
32
32
|
export declare function pollForDeviceAuthorization(code: string, interval?: number): Promise<IdentityToken>;
|
|
@@ -14,8 +14,8 @@ const DeviceAuthError = () => {
|
|
|
14
14
|
*
|
|
15
15
|
* Also returns a `deviceCode` used for polling the token endpoint in the next step.
|
|
16
16
|
*
|
|
17
|
-
* @param scopes The scopes to request
|
|
18
|
-
* @returns
|
|
17
|
+
* @param scopes - The scopes to request
|
|
18
|
+
* @returns An object with the device authorization response.
|
|
19
19
|
*/
|
|
20
20
|
export async function requestDeviceAuthorization(scopes) {
|
|
21
21
|
const fqdn = await identityFqdn();
|
|
@@ -51,9 +51,9 @@ export async function requestDeviceAuthorization(scopes) {
|
|
|
51
51
|
*
|
|
52
52
|
* Timeout for the polling is defined by the server and is around 600 seconds.
|
|
53
53
|
*
|
|
54
|
-
* @param code The device code obtained after starting a device identity flow
|
|
55
|
-
* @param interval The interval to poll the token endpoint
|
|
56
|
-
* @returns
|
|
54
|
+
* @param code - The device code obtained after starting a device identity flow
|
|
55
|
+
* @param interval - The interval to poll the token endpoint
|
|
56
|
+
* @returns The identity token
|
|
57
57
|
*/
|
|
58
58
|
export async function pollForDeviceAuthorization(code, interval = 5) {
|
|
59
59
|
let currentIntervalInSeconds = interval;
|