@shopify/cli-kit 3.49.7 → 3.50.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/assets/cli-ruby/lib/project_types/theme/commands/console.rb +3 -1
- package/assets/cli-ruby/lib/shopify_cli/theme/file.rb +2 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_dev_server.rb +2 -4
- package/assets/cli-ruby/lib/shopify_cli/theme/repl/remote_evaluator.rb +3 -0
- package/assets/cli-ruby/lib/shopify_cli/theme/repl.rb +4 -3
- package/dist/private/node/constants.d.ts +2 -0
- package/dist/private/node/constants.js +2 -0
- package/dist/private/node/constants.js.map +1 -1
- package/dist/private/node/context/utilities.js +2 -3
- package/dist/private/node/context/utilities.js.map +1 -1
- package/dist/private/node/otel-metrics.d.ts +32 -0
- package/dist/private/node/otel-metrics.js +131 -0
- package/dist/private/node/otel-metrics.js.map +1 -0
- package/dist/private/node/session/authorize.js +8 -5
- package/dist/private/node/session/authorize.js.map +1 -1
- package/dist/private/node/testing/ui.d.ts +4 -2
- package/dist/private/node/testing/ui.js +10 -3
- package/dist/private/node/testing/ui.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.js +6 -2
- package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
- package/dist/private/node/ui/components/AutocompletePrompt.test.js +5 -3
- package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js +12 -6
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.js.map +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js +1 -1
- package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Prompts/GitDiff.test.js +18 -11
- package/dist/private/node/ui/components/Prompts/GitDiff.test.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.js +8 -4
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
- package/dist/private/node/ui/components/SelectPrompt.test.js +5 -3
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
- package/dist/private/node/ui/components/Tasks.js +8 -1
- package/dist/private/node/ui/components/Tasks.js.map +1 -1
- package/dist/private/node/ui/components/TextPrompt.js +7 -3
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.d.ts +10 -1
- package/dist/private/node/ui/components/TokenizedText.js +18 -0
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -1
- package/dist/private/node/ui/components/TokenizedText.test.js +10 -1
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
- package/dist/private/node/ui/utilities.d.ts +1 -1
- package/dist/public/common/version.d.ts +1 -1
- package/dist/public/common/version.js +1 -1
- package/dist/public/common/version.js.map +1 -1
- package/dist/public/node/analytics.d.ts +2 -0
- package/dist/public/node/analytics.js +48 -10
- package/dist/public/node/analytics.js.map +1 -1
- package/dist/public/node/api/graphql.js +8 -5
- package/dist/public/node/api/graphql.js.map +1 -1
- package/dist/public/node/base-command.js +4 -3
- package/dist/public/node/base-command.js.map +1 -1
- package/dist/public/node/cli.js +28 -2
- package/dist/public/node/cli.js.map +1 -1
- package/dist/public/node/context/local.d.ts +16 -0
- package/dist/public/node/context/local.js +23 -0
- package/dist/public/node/context/local.js.map +1 -1
- package/dist/public/node/error-handler.d.ts +4 -1
- package/dist/public/node/error-handler.js +26 -18
- package/dist/public/node/error-handler.js.map +1 -1
- package/dist/public/node/error.d.ts +1 -1
- package/dist/public/node/error.js +1 -1
- package/dist/public/node/error.js.map +1 -1
- package/dist/public/node/hooks/postrun.js +1 -1
- package/dist/public/node/hooks/postrun.js.map +1 -1
- package/dist/public/node/http.js +27 -22
- package/dist/public/node/http.js.map +1 -1
- package/dist/public/node/metadata.d.ts +12 -4
- package/dist/public/node/metadata.js +52 -4
- package/dist/public/node/metadata.js.map +1 -1
- package/dist/public/node/monorail.d.ts +8 -1
- package/dist/public/node/monorail.js +1 -1
- package/dist/public/node/monorail.js.map +1 -1
- package/dist/public/node/node-package-manager.d.ts +6 -0
- package/dist/public/node/node-package-manager.js +16 -2
- package/dist/public/node/node-package-manager.js.map +1 -1
- package/dist/public/node/testing/ui.d.ts +1 -1
- package/dist/public/node/testing/ui.js +1 -1
- package/dist/public/node/testing/ui.js.map +1 -1
- package/dist/public/node/ui.d.ts +1 -1
- package/dist/public/node/ui.js +63 -56
- package/dist/public/node/ui.js.map +1 -1
- package/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.d.ts +18 -0
- package/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.js +36 -0
- package/dist/public/node/vendor/otel-js/export/InstantaneousMetricReader.js.map +1 -0
- package/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.d.ts +46 -0
- package/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.js +112 -0
- package/dist/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.js.map +1 -0
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.d.ts +13 -0
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.js +36 -0
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.js.map +1 -0
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.d.ts +24 -0
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.js +33 -0
- package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.js.map +1 -0
- package/dist/public/node/vendor/otel-js/service/types.d.ts +43 -0
- package/dist/public/node/vendor/otel-js/service/types.js +7 -0
- package/dist/public/node/vendor/otel-js/service/types.js.map +1 -0
- package/dist/public/node/vendor/otel-js/utils/throttle.d.ts +7 -0
- package/dist/public/node/vendor/otel-js/utils/throttle.js +42 -0
- package/dist/public/node/vendor/otel-js/utils/throttle.js.map +1 -0
- package/dist/public/node/vendor/otel-js/utils/validators.d.ts +1 -0
- package/dist/public/node/vendor/otel-js/utils/validators.js +11 -0
- package/dist/public/node/vendor/otel-js/utils/validators.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -17
- package/assets/cli-ruby/RELEASING.md +0 -72
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAuB,cAAc,EAAC,MAAM,YAAY,CAAA;AAC5F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EAGV,aAAa,EACb,WAAW,EACX,WAAW,EACX,sBAAsB,GACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,uBAAuB,EAAC,MAAM,aAAa,CAAA;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAC,gBAAgB,EAAwB,MAAM,sDAAsD,CAAA;AAC5G,OAAO,EAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAC,KAAK,EAAe,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAC,UAAU,EAAC,MAAM,gDAAgD,CAAA;AAEzE,OAAO,EAAC,KAAK,EAA0B,MAAM,iDAAiD,CAAA;AAC9F,OAAO,EACL,iBAAiB,GAKlB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EACL,2BAA2B,GAE5B,MAAM,iEAAiE,CAAA;AACxE,OAAO,EAAC,YAAY,EAAoB,MAAM,kDAAkD,CAAA;AAChG,OAAO,EAAC,KAAK,EAAO,MAAM,2CAA2C,CAAA;AACrE,OAAO,EAAC,UAAU,EAAkB,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAA0B,kBAAkB,EAAC,MAAM,wDAAwD,C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YAAY,GAAG;;EAErB,aAAa,CAAA,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK;;2IAEqF,CAAA;IACzI,MAAM,IAAI,UAAU,CAClB,YAAY,EACZ,mIAAmI,CACpI,CAAA;AACH,CAAC;AAID,OAAO,EAAoF,MAAM,EAAE,WAAW,EAAC,CAAA","sourcesContent":["/* eslint-disable tsdoc/syntax */\nimport {AbortError, AbortSilentError, FatalError as Fatal, FatalErrorType} from './error.js'\nimport {\n collectLog,\n consoleError,\n consoleLog,\n Logger,\n LogLevel,\n outputContent,\n outputDebug,\n outputToken,\n outputWhereAppropriate,\n} from './output.js'\nimport {isUnitTest} from './context/local.js'\nimport {terminalSupportsRawMode} from './system.js'\nimport {AbortController} from './abort.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {handleCtrlC, render, renderOnce} from '../../private/node/ui.js'\nimport {alert, AlertOptions} from '../../private/node/ui/alert.js'\nimport {CustomSection} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport {Table, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {\n tokenItemToString,\n InlineToken,\n LinkToken,\n ListToken,\n TokenItem,\n} from '../../private/node/ui/components/TokenizedText.js'\nimport {\n DangerousConfirmationPrompt,\n DangerousConfirmationPromptProps,\n} from '../../private/node/ui/components/DangerousConfirmationPrompt.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InfoTableSection} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {recordUIEvent, resetRecordedSleep} from '../../private/node/demo-recorder.js'\nimport {InfoMessageProps} from '../../private/node/ui/components/Prompts/InfoMessage.js'\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n * @example\n * 00:00:00 │ backend │ first backend message\n * 00:00:00 │ backend │ second backend message\n * 00:00:00 │ backend │ third backend message\n * 00:00:00 │ frontend │ first frontend message\n * 00:00:00 │ frontend │ second frontend message\n * 00:00:00 │ frontend │ third frontend message\n *\n */\nexport async function renderConcurrent({renderOptions, ...props}: RenderConcurrentOptions) {\n const abortSignal = props.abortSignal ?? new AbortController().signal\n\n if (terminalSupportsRawMode(renderOptions?.stdin)) {\n return render(<ConcurrentOutput {...props} abortSignal={abortSignal} />, renderOptions)\n } else {\n return Promise.all(\n props.processes.map(async (concurrentProcess) => {\n await concurrentProcess.action(process.stdout, process.stderr, abortSignal)\n }),\n )\n }\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertOptions, 'type'>\n\n/**\n * Renders an information banner to the console.\n * @example Basic\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ CLI update available. │\n * │ │\n * │ Run `npm run shopify upgrade`. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ my-app initialized and ready to build. │\n * │ │\n * │ Next steps │\n * │ • Run `cd verification-app` │\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 * │ • Dev docs [1] │\n * │ │\n * │ Custom section │\n * │ • Item 1 [2] │\n * │ • Item 2 │\n * │ • Item 3 [3] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev\n * [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s\n * 9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo\n * 35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j\n * 69i60.2711j0j7&sourceid=chrome&ie=UTF-8\n * [3] https://shopify.com\n *\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n * @example Basic\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ CLI updated. │\n * │ │\n * │ You are now running version 3.47. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Deployment successful. │\n * │ │\n * │ Your extensions have been uploaded to your Shopify │\n * │ Partners Dashboard. │\n * │ │\n * │ Next steps │\n * │ • See your deployment and set it live [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/1797046/apps/4523695/deploy\n * ments\n *\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n * @example Basic\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ You have reached your limit of checkout extensions for │\n * │ this app. │\n * │ │\n * │ You can free up space for a new one by deleting an │\n * │ existing one. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Required access scope update. │\n * │ │\n * │ The deadline for re-selecting your app scopes is May │\n * │ 1, 2022. │\n * │ │\n * │ Reference │\n * │ • Dev docs [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev/app/scopes\n *\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders an error banner to the console.\n * @example\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Version couldn't be released. │\n * │ │\n * │ This version needs to be submitted for review and │\n * │ approved by Shopify before it can be released. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderError(options: RenderAlertOptions) {\n return alert({...options, type: 'error'})\n}\n\ninterface RenderFatalErrorOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n * @example Basic\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ To investigate the issue, examine this stack trace: │\n * │ at _compile (internal/modules/cjs/loader.js:1137) │\n * │ at js (internal/modules/cjs/loader.js:1157) │\n * │ at load (internal/modules/cjs/loader.js:985) │\n * │ at _load (internal/modules/cjs/loader.js:878) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ No Organization found │\n * │ │\n * │ Next steps │\n * │ • Have you created a Shopify Partners organization │\n * │ [1]? │\n * │ • Have you confirmed your accounts from the emails │\n * │ you received? │\n * │ • Need to connect to a different App or │\n * │ organization? Run the command again with `--reset` │\n * │ │\n * │ amortizable-marketplace-ext │\n * │ • Some other error │\n * │ Validation errors │\n * │ • Missing expected key(s). │\n * │ │\n * │ amortizable-marketplace-ext-2 │\n * │ • Something was not found │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/signup\n *\n */\n// eslint-disable-next-line max-params\nexport function renderFatalError(error: Fatal, {renderOptions}: RenderFatalErrorOptions = {}) {\n recordUIEvent({\n type: 'fatalError',\n properties: {...error, errorType: error.type === FatalErrorType.Bug ? 'bug' : 'abort'},\n })\n\n return renderOnce(<FatalError error={error} />, {logLevel: 'error', logger: consoleError, renderOptions})\n}\n\nexport interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>, 'onSubmit'> {\n isConfirmationPrompt?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a select prompt to the console.\n * @example\n * ? Associate your project with the org Castile Ventures?\n *\n * ┃ Add\n * ┃ • new-ext\n * ┃\n * ┃ Remove\n * ┃ • integrated-demand-ext\n * ┃ • order-discount\n *\n * Automations\n * > fifth\n * sixth\n *\n * Merchant Admin\n * eighth\n * ninth\n *\n * Other\n * first\n * second\n * third (limit reached)\n * fourth\n * seventh\n * tenth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\nexport async function renderSelectPrompt<T>({\n renderOptions,\n isConfirmationPrompt,\n ...props\n}: RenderSelectPromptOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n if (!isConfirmationPrompt) {\n recordUIEvent({type: 'selectPrompt', properties: {renderOptions, ...props}})\n }\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\nexport interface RenderConfirmationPromptOptions\n extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'infoMessage' | 'gitDiff' | 'abortSignal'> {\n confirmationMessage?: string\n cancellationMessage?: string\n renderOptions?: RenderOptions\n defaultValue?: boolean\n}\n\n/**\n * Renders a confirmation prompt to the console.\n * @example\n * ? Delete the following themes from the store?\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n * ┃\n * ┃ • first theme (#1)\n * ┃ • second theme (#2)\n *\n * > (y) Yes, confirm changes\n * (n) Cancel\n *\n * Press ↑↓ arrows to select, enter or a shortcut to\n * confirm.\n *\n */\nexport async function renderConfirmationPrompt({\n message,\n infoTable,\n gitDiff,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n renderOptions,\n defaultValue = true,\n abortSignal,\n infoMessage,\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'confirmationPrompt', properties: arguments[0]})\n\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n gitDiff,\n renderOptions,\n defaultValue,\n isConfirmationPrompt: true,\n abortSignal,\n infoMessage,\n })\n}\n\nexport interface RenderAutocompleteOptions<T>\n extends PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * @example\n * ? Select a template: Type to search...\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n *\n * > first\n * second\n * third\n * fourth\n * fifth\n * sixth\n * seventh\n * eighth\n * ninth\n * tenth\n * eleventh\n * twelfth\n * thirteenth\n * fourteenth\n * fifteenth\n * sixteenth\n * seventeenth\n * eighteenth\n * nineteenth (disabled)\n * twentieth\n * twenty-first\n * twenty-second\n * twenty-third\n * twenty-fourth\n * twenty-fifth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\nexport async function renderAutocompletePrompt<T>({renderOptions, ...props}: RenderAutocompleteOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'autocompletePrompt', properties: arguments[0]})\n\n const newProps = {\n search(term: string) {\n const lowerTerm = term.toLowerCase()\n return Promise.resolve({\n data: props.choices.filter((item) => {\n return (\n item.label.toLowerCase().includes(lowerTerm) || (item.group && item.group.toLowerCase().includes(lowerTerm))\n )\n }),\n })\n },\n ...props,\n }\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\ninterface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a table to the console.\n * @example\n * ID Name email\n * ── ────────── ─────────────\n * 1 John Doe jon@doe.com\n * 2 Jane Doe jane@doe.com\n * 3 John Smith jon@smith.com\n */\nexport function renderTable<T extends ScalarDict>({renderOptions, ...props}: RenderTableOptions<T>) {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'table', properties: arguments[0]})\n\n return renderOnce(<Table {...props} />, {renderOptions})\n}\n\ninterface RenderTasksOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n * @example\n * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n * Installing dependencies ...\n */\n// eslint-disable-next-line max-params\nexport async function renderTasks<TContext>(tasks: Task<TContext>[], {renderOptions}: RenderTasksOptions = {}) {\n recordUIEvent({\n type: 'taskbar',\n properties: {\n // Rather than timing exactly, pretend each step takes 2 seconds. This\n // should be easy to tweak manually.\n steps: tasks.map((task) => {\n return {title: task.title, duration: 2}\n }),\n },\n })\n\n // eslint-disable-next-line max-params\n return new Promise<TContext>((resolve, reject) => {\n render(<Tasks tasks={tasks} onComplete={resolve} />, renderOptions)\n .then(() => resetRecordedSleep())\n .catch(reject)\n })\n}\n\nexport interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a text prompt to the console.\n * @example\n * ? App project name (can be changed later):\n * > expansive commerce app\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport async function renderTextPrompt({renderOptions, ...props}: RenderTextPromptOptions): Promise<string> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'textPrompt', properties: arguments[0]})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\nexport interface RenderDangerousConfirmationPromptOptions extends Omit<DangerousConfirmationPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a dangerous confirmation prompt to the console, forcing the user to\n * type a confirmation string to proceed.\n * @example\n * ? Release a new version of nightly-app-2023-06-19?\n *\n * ┃ Includes:\n * ┃ + web-px (new)\n * ┃ + sub-ui-ext\n * ┃ + theme-app-ext\n * ┃ + paymentify (from Partner Dashboard)\n * ┃\n * ┃ Removes:\n * ┃ - prod-discount-fun\n * ┃\n * ┃ This can permanently delete app user data.\n *\n * Type nightly-app-2023-06-19 to confirm, or press Escape\n * to cancel.\n * > █\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport async function renderDangerousConfirmationPrompt({\n renderOptions,\n ...props\n}: RenderDangerousConfirmationPromptOptions): Promise<boolean> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'dangerousConfirmationPrompt', properties: arguments[0]})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<DangerousConfirmationPrompt {...props} onSubmit={(value: boolean) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\ninterface RenderTextOptions {\n text: string\n logLevel?: LogLevel\n logger?: Logger\n}\n\n/** Renders a text string to the console.\n * Using this function makes sure that correct spacing is applied among the various components.\n * @example\n * Hello world!\n *\n */\nexport function renderText({text, logLevel = 'info', logger = consoleLog}: RenderTextOptions) {\n let textWithLineReturn = text\n if (!text.endsWith('\\n')) textWithLineReturn += '\\n'\n\n if (isUnitTest()) collectLog(logLevel, textWithLineReturn)\n outputWhereAppropriate(logLevel, logger, textWithLineReturn)\n return textWithLineReturn\n}\n\n/** Waits for any key to be pressed except Ctrl+C which will terminate the process. */\nexport const keypress = async () => {\n throwInNonTTY({message: 'Press any key'})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n}\n\ninterface ThrowInNonTTYOptions {\n message: TokenItem\n stdin?: NodeJS.ReadStream\n}\n\nfunction throwInNonTTY({message, stdin = undefined}: ThrowInNonTTYOptions) {\n if (stdin || terminalSupportsRawMode()) return\n\n const promptText = tokenItemToString(message)\n const errorMessage = `Failed to prompt:\n\n${outputContent`${outputToken.cyan(promptText)}`.value}\n\nThis usually happens when running a command non-interactively, for example in a CI environment, or when piping input from another process.`\n throw new AbortError(\n errorMessage,\n 'To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.',\n )\n}\n\nexport type Key = InkKey\nexport type InfoMessage = InfoMessageProps['message']\nexport {Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken, render, handleCtrlC}\n"]}
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAC,UAA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AA;IACzI,MAAM,IAAI,UAAU,CAClB,YAAY,EACZ,mIAAmI,CACpI,CAAA;AACH,CAAC;AAID,OAAO,EAAoF,MAAM,EAAE,WAAW,EAAC,CAAA","sourcesContent":["/* eslint-disable tsdoc/syntax */\nimport {AbortError, AbortSilentError, FatalError as Fatal, FatalErrorType} from './error.js'\nimport {\n collectLog,\n consoleError,\n consoleLog,\n Logger,\n LogLevel,\n outputContent,\n outputDebug,\n outputToken,\n outputWhereAppropriate,\n} from './output.js'\nimport {isUnitTest} from './context/local.js'\nimport {terminalSupportsRawMode} from './system.js'\nimport {AbortController} from './abort.js'\nimport {runWithTimer} from './metadata.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {handleCtrlC, render, renderOnce} from '../../private/node/ui.js'\nimport {alert, AlertOptions} from '../../private/node/ui/alert.js'\nimport {CustomSection} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport {Table, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {\n tokenItemToString,\n InlineToken,\n LinkToken,\n ListToken,\n TokenItem,\n} from '../../private/node/ui/components/TokenizedText.js'\nimport {\n DangerousConfirmationPrompt,\n DangerousConfirmationPromptProps,\n} from '../../private/node/ui/components/DangerousConfirmationPrompt.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InfoTableSection} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {recordUIEvent, resetRecordedSleep} from '../../private/node/demo-recorder.js'\nimport {InfoMessageProps} from '../../private/node/ui/components/Prompts/InfoMessage.js'\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n * @example\n * 00:00:00 │ backend │ first backend message\n * 00:00:00 │ backend │ second backend message\n * 00:00:00 │ backend │ third backend message\n * 00:00:00 │ frontend │ first frontend message\n * 00:00:00 │ frontend │ second frontend message\n * 00:00:00 │ frontend │ third frontend message\n *\n */\nexport async function renderConcurrent({renderOptions, ...props}: RenderConcurrentOptions) {\n const abortSignal = props.abortSignal ?? new AbortController().signal\n\n return render(<ConcurrentOutput {...props} abortSignal={abortSignal} />, renderOptions)\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertOptions, 'type'>\n\n/**\n * Renders an information banner to the console.\n * @example Basic\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ CLI update available. │\n * │ │\n * │ Run `npm run shopify upgrade`. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ my-app initialized and ready to build. │\n * │ │\n * │ Next steps │\n * │ • Run `cd verification-app` │\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 * │ • Dev docs [1] │\n * │ │\n * │ Custom section │\n * │ • Item 1 [2] │\n * │ • Item 2 │\n * │ • Item 3 [3] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev\n * [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s\n * 9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo\n * 35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j\n * 69i60.2711j0j7&sourceid=chrome&ie=UTF-8\n * [3] https://shopify.com\n *\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n * @example Basic\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ CLI updated. │\n * │ │\n * │ You are now running version 3.47. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Deployment successful. │\n * │ │\n * │ Your extensions have been uploaded to your Shopify │\n * │ Partners Dashboard. │\n * │ │\n * │ Next steps │\n * │ • See your deployment and set it live [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/1797046/apps/4523695/deploy\n * ments\n *\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n * @example Basic\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ You have reached your limit of checkout extensions for │\n * │ this app. │\n * │ │\n * │ You can free up space for a new one by deleting an │\n * │ existing one. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Required access scope update. │\n * │ │\n * │ The deadline for re-selecting your app scopes is May │\n * │ 1, 2022. │\n * │ │\n * │ Reference │\n * │ • Dev docs [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev/app/scopes\n *\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders an error banner to the console.\n * @example\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Version couldn't be released. │\n * │ │\n * │ This version needs to be submitted for review and │\n * │ approved by Shopify before it can be released. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderError(options: RenderAlertOptions) {\n return alert({...options, type: 'error'})\n}\n\ninterface RenderFatalErrorOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n * @example Basic\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ To investigate the issue, examine this stack trace: │\n * │ at _compile (internal/modules/cjs/loader.js:1137) │\n * │ at js (internal/modules/cjs/loader.js:1157) │\n * │ at load (internal/modules/cjs/loader.js:985) │\n * │ at _load (internal/modules/cjs/loader.js:878) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ No Organization found │\n * │ │\n * │ Next steps │\n * │ • Have you created a Shopify Partners organization │\n * │ [1]? │\n * │ • Have you confirmed your accounts from the emails │\n * │ you received? │\n * │ • Need to connect to a different App or │\n * │ organization? Run the command again with `--reset` │\n * │ │\n * │ amortizable-marketplace-ext │\n * │ • Some other error │\n * │ Validation errors │\n * │ • Missing expected key(s). │\n * │ │\n * │ amortizable-marketplace-ext-2 │\n * │ • Something was not found │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/signup\n *\n */\n// eslint-disable-next-line max-params\nexport function renderFatalError(error: Fatal, {renderOptions}: RenderFatalErrorOptions = {}) {\n recordUIEvent({\n type: 'fatalError',\n properties: {...error, errorType: error.type === FatalErrorType.Bug ? 'bug' : 'abort'},\n })\n\n return renderOnce(<FatalError error={error} />, {logLevel: 'error', logger: consoleError, renderOptions})\n}\n\nexport interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>, 'onSubmit'> {\n isConfirmationPrompt?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a select prompt to the console.\n * @example\n * ? Associate your project with the org Castile Ventures?\n *\n * ┃ Add\n * ┃ • new-ext\n * ┃\n * ┃ Remove\n * ┃ • integrated-demand-ext\n * ┃ • order-discount\n *\n * Automations\n * > fifth\n * sixth\n *\n * Merchant Admin\n * eighth\n * ninth\n *\n * Other\n * first\n * second\n * third (limit reached)\n * fourth\n * seventh\n * tenth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\nexport async function renderSelectPrompt<T>({\n renderOptions,\n isConfirmationPrompt,\n ...props\n}: RenderSelectPromptOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n if (!isConfirmationPrompt) {\n recordUIEvent({type: 'selectPrompt', properties: {renderOptions, ...props}})\n }\n\n return runWithTimer('cmd_all_timing_prompts_ms')(() => {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n })\n}\n\nexport interface RenderConfirmationPromptOptions\n extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'infoMessage' | 'gitDiff' | 'abortSignal'> {\n confirmationMessage?: string\n cancellationMessage?: string\n renderOptions?: RenderOptions\n defaultValue?: boolean\n}\n\n/**\n * Renders a confirmation prompt to the console.\n * @example\n * ? Delete the following themes from the store?\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n * ┃\n * ┃ • first theme (#1)\n * ┃ • second theme (#2)\n *\n * > (y) Yes, confirm changes\n * (n) Cancel\n *\n * Press ↑↓ arrows to select, enter or a shortcut to\n * confirm.\n *\n */\nexport async function renderConfirmationPrompt({\n message,\n infoTable,\n gitDiff,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n renderOptions,\n defaultValue = true,\n abortSignal,\n infoMessage,\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'confirmationPrompt', properties: arguments[0]})\n\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n gitDiff,\n renderOptions,\n defaultValue,\n isConfirmationPrompt: true,\n abortSignal,\n infoMessage,\n })\n}\n\nexport interface RenderAutocompleteOptions<T>\n extends PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * @example\n * ? Select a template: Type to search...\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n *\n * > first\n * second\n * third\n * fourth\n * fifth\n * sixth\n * seventh\n * eighth\n * ninth\n * tenth\n * eleventh\n * twelfth\n * thirteenth\n * fourteenth\n * fifteenth\n * sixteenth\n * seventeenth\n * eighteenth\n * nineteenth (disabled)\n * twentieth\n * twenty-first\n * twenty-second\n * twenty-third\n * twenty-fourth\n * twenty-fifth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\nexport async function renderAutocompletePrompt<T>({renderOptions, ...props}: RenderAutocompleteOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'autocompletePrompt', properties: arguments[0]})\n\n const newProps = {\n search(term: string) {\n const lowerTerm = term.toLowerCase()\n return Promise.resolve({\n data: props.choices.filter((item) => {\n return (\n item.label.toLowerCase().includes(lowerTerm) || (item.group && item.group.toLowerCase().includes(lowerTerm))\n )\n }),\n })\n },\n ...props,\n }\n\n return runWithTimer('cmd_all_timing_prompts_ms')(() => {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n })\n}\n\ninterface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a table to the console.\n * @example\n * ID Name email\n * ── ────────── ─────────────\n * 1 John Doe jon@doe.com\n * 2 Jane Doe jane@doe.com\n * 3 John Smith jon@smith.com\n */\nexport function renderTable<T extends ScalarDict>({renderOptions, ...props}: RenderTableOptions<T>) {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'table', properties: arguments[0]})\n\n return renderOnce(<Table {...props} />, {renderOptions})\n}\n\ninterface RenderTasksOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n * @example\n * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n * Installing dependencies ...\n */\n// eslint-disable-next-line max-params\nexport async function renderTasks<TContext>(tasks: Task<TContext>[], {renderOptions}: RenderTasksOptions = {}) {\n recordUIEvent({\n type: 'taskbar',\n properties: {\n // Rather than timing exactly, pretend each step takes 2 seconds. This\n // should be easy to tweak manually.\n steps: tasks.map((task) => {\n return {title: task.title, duration: 2}\n }),\n },\n })\n\n // eslint-disable-next-line max-params\n return new Promise<TContext>((resolve, reject) => {\n render(<Tasks tasks={tasks} onComplete={resolve} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .then(() => resetRecordedSleep())\n .catch(reject)\n })\n}\n\nexport interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a text prompt to the console.\n * @example\n * ? App project name (can be changed later):\n * > expansive commerce app\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport async function renderTextPrompt({renderOptions, ...props}: RenderTextPromptOptions): Promise<string> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'textPrompt', properties: arguments[0]})\n\n return runWithTimer('cmd_all_timing_prompts_ms')(() => {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n })\n}\n\nexport interface RenderDangerousConfirmationPromptOptions extends Omit<DangerousConfirmationPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a dangerous confirmation prompt to the console, forcing the user to\n * type a confirmation string to proceed.\n * @example\n * ? Release a new version of nightly-app-2023-06-19?\n *\n * ┃ Includes:\n * ┃ + web-px (new)\n * ┃ + sub-ui-ext\n * ┃ + theme-app-ext\n * ┃ + paymentify (from Partner Dashboard)\n * ┃\n * ┃ Removes:\n * ┃ - prod-discount-fun\n * ┃\n * ┃ This can permanently delete app user data.\n *\n * Type nightly-app-2023-06-19 to confirm, or press Escape\n * to cancel.\n * > █\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport async function renderDangerousConfirmationPrompt({\n renderOptions,\n ...props\n}: RenderDangerousConfirmationPromptOptions): Promise<boolean> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'dangerousConfirmationPrompt', properties: arguments[0]})\n\n return runWithTimer('cmd_all_timing_prompts_ms')(() => {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<DangerousConfirmationPrompt {...props} onSubmit={(value: boolean) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n })\n}\n\ninterface RenderTextOptions {\n text: string\n logLevel?: LogLevel\n logger?: Logger\n}\n\n/** Renders a text string to the console.\n * Using this function makes sure that correct spacing is applied among the various components.\n * @example\n * Hello world!\n *\n */\nexport function renderText({text, logLevel = 'info', logger = consoleLog}: RenderTextOptions) {\n let textWithLineReturn = text\n if (!text.endsWith('\\n')) textWithLineReturn += '\\n'\n\n if (isUnitTest()) collectLog(logLevel, textWithLineReturn)\n outputWhereAppropriate(logLevel, logger, textWithLineReturn)\n return textWithLineReturn\n}\n\n/** Waits for any key to be pressed except Ctrl+C which will terminate the process. */\nexport const keypress = async () => {\n throwInNonTTY({message: 'Press any key'})\n\n return runWithTimer('cmd_all_timing_prompts_ms')(() => {\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n })\n}\n\ninterface ThrowInNonTTYOptions {\n message: TokenItem\n stdin?: NodeJS.ReadStream\n}\n\nfunction throwInNonTTY({message, stdin = undefined}: ThrowInNonTTYOptions) {\n if (stdin || terminalSupportsRawMode()) return\n\n const promptText = tokenItemToString(message)\n const errorMessage = `Failed to prompt:\n\n${outputContent`${outputToken.cyan(promptText)}`.value}\n\nThis usually happens when running a command non-interactively, for example in a CI environment, or when piping input from another process.`\n throw new AbortError(\n errorMessage,\n 'To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.',\n )\n}\n\nexport type Key = InkKey\nexport type InfoMessage = InfoMessageProps['message']\nexport {Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken, render, handleCtrlC}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PushMetricExporter } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { MetricReader } from '@opentelemetry/sdk-metrics';
|
|
3
|
+
export interface InstantaneousMetricReaderOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The backing exporter for the metric reader.
|
|
6
|
+
*/
|
|
7
|
+
exporter: PushMetricExporter;
|
|
8
|
+
/**
|
|
9
|
+
* How much the export should be throttled in milliseconds.
|
|
10
|
+
*/
|
|
11
|
+
throttleLimit: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class InstantaneousMetricReader extends MetricReader {
|
|
14
|
+
private readonly _exporter;
|
|
15
|
+
constructor({ exporter, throttleLimit }: InstantaneousMetricReaderOptions);
|
|
16
|
+
protected onForceFlush(): Promise<void>;
|
|
17
|
+
protected onShutdown(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MetricReader } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { ExportResultCode } from '@opentelemetry/core';
|
|
3
|
+
import { diag } from '@opentelemetry/api';
|
|
4
|
+
import { throttle } from '../utils/throttle.js';
|
|
5
|
+
export class InstantaneousMetricReader extends MetricReader {
|
|
6
|
+
constructor({ exporter, throttleLimit }) {
|
|
7
|
+
super({
|
|
8
|
+
aggregationSelector: exporter.selectAggregation?.bind(exporter),
|
|
9
|
+
aggregationTemporalitySelector: exporter.selectAggregationTemporality?.bind(exporter),
|
|
10
|
+
});
|
|
11
|
+
this._exporter = exporter;
|
|
12
|
+
this.onForceFlush = throttle(
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
14
|
+
this.onForceFlush, throttleLimit);
|
|
15
|
+
}
|
|
16
|
+
async onForceFlush() {
|
|
17
|
+
const { resourceMetrics, errors } = await this.collect({});
|
|
18
|
+
if (errors.length > 0) {
|
|
19
|
+
diag.error('PeriodicExportingMetricReader: metrics collection errors', ...errors);
|
|
20
|
+
}
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
this._exporter.export(resourceMetrics, (result) => {
|
|
23
|
+
if (result.code === ExportResultCode.SUCCESS) {
|
|
24
|
+
resolve();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
reject(result.error ?? new Error(`InstantaneousMetricReader: metrics export failed (error ${result.error})`));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async onShutdown() {
|
|
33
|
+
await this._exporter.shutdown();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=InstantaneousMetricReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstantaneousMetricReader.js","sourceRoot":"","sources":["../../../../../../src/public/node/vendor/otel-js/export/InstantaneousMetricReader.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAA;AAc7C,MAAM,OAAO,yBAA0B,SAAQ,YAAY;IAGzD,YAAY,EAAC,QAAQ,EAAE,aAAa,EAAmC;QACrE,KAAK,CAAC;YACJ,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC;YAC/D,8BAA8B,EAAE,QAAQ,CAAC,4BAA4B,EAAE,IAAI,CAAC,QAAQ,CAAC;SACtF,CAAC,CAAA;QACF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QAEzB,IAAI,CAAC,YAAY,GAAG,QAAQ;QAC1B,6DAA6D;QAC7D,IAAI,CAAC,YAAY,EACjB,aAAa,CACd,CAAA;IACH,CAAC;IAES,KAAK,CAAC,YAAY;QAC1B,MAAM,EAAC,eAAe,EAAE,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAExD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,0DAA0D,EAAE,GAAG,MAAM,CAAC,CAAA;SAClF;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE;gBAChD,IAAI,MAAM,CAAC,IAAI,KAAK,gBAAgB,CAAC,OAAO,EAAE;oBAC5C,OAAO,EAAE,CAAA;iBACV;qBAAM;oBACL,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,2DAA2D,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;iBAC9G;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAES,KAAK,CAAC,UAAU;QACxB,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAA;IACjC,CAAC;CACF","sourcesContent":["import type {PushMetricExporter} from '@opentelemetry/sdk-metrics'\nimport {MetricReader} from '@opentelemetry/sdk-metrics'\nimport {ExportResultCode} from '@opentelemetry/core'\nimport {diag} from '@opentelemetry/api'\n\nimport {throttle} from '../utils/throttle.js'\n\nexport interface InstantaneousMetricReaderOptions {\n /**\n * The backing exporter for the metric reader.\n */\n exporter: PushMetricExporter\n\n /**\n * How much the export should be throttled in milliseconds.\n */\n throttleLimit: number\n}\n\nexport class InstantaneousMetricReader extends MetricReader {\n private readonly _exporter: PushMetricExporter\n\n constructor({exporter, throttleLimit}: InstantaneousMetricReaderOptions) {\n super({\n aggregationSelector: exporter.selectAggregation?.bind(exporter),\n aggregationTemporalitySelector: exporter.selectAggregationTemporality?.bind(exporter),\n })\n this._exporter = exporter\n\n this.onForceFlush = throttle(\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.onForceFlush,\n throttleLimit,\n )\n }\n\n protected async onForceFlush(): Promise<void> {\n const {resourceMetrics, errors} = await this.collect({})\n\n if (errors.length > 0) {\n diag.error('PeriodicExportingMetricReader: metrics collection errors', ...errors)\n }\n\n return new Promise((resolve, reject) => {\n this._exporter.export(resourceMetrics, (result) => {\n if (result.code === ExportResultCode.SUCCESS) {\n resolve()\n } else {\n reject(result.error ?? new Error(`InstantaneousMetricReader: metrics export failed (error ${result.error})`))\n }\n })\n })\n }\n\n protected async onShutdown(): Promise<void> {\n await this._exporter.shutdown()\n }\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { MetricAttributes } from '@opentelemetry/api';
|
|
2
|
+
import type { MeterProvider, ViewOptions } from '@opentelemetry/sdk-metrics';
|
|
3
|
+
import type { MetricDescriptor, MetricRecording, MetricsConfig, OnRecordCallback, OtelService, RecordMetricFunction } from '../types.js';
|
|
4
|
+
export interface BaseOtelServiceOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Service name is a unique name for an application/service.
|
|
7
|
+
*/
|
|
8
|
+
serviceName: string;
|
|
9
|
+
/**
|
|
10
|
+
* If this is set to true then the service name is prefixed to every metric.
|
|
11
|
+
*/
|
|
12
|
+
prefixMetric?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Metrics to register on startup.
|
|
15
|
+
*/
|
|
16
|
+
metrics?: MetricsConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Called when a metric is recorded. `addOnRecord` can also be used to add
|
|
19
|
+
* listeners anytime.
|
|
20
|
+
*/
|
|
21
|
+
onRecord?: OnRecordCallback;
|
|
22
|
+
/**
|
|
23
|
+
* Override the default meter provider.
|
|
24
|
+
*/
|
|
25
|
+
meterProvider?: MeterProvider;
|
|
26
|
+
}
|
|
27
|
+
export declare class BaseOtelService implements OtelService {
|
|
28
|
+
readonly serviceName: string;
|
|
29
|
+
readonly prefixMetric: boolean;
|
|
30
|
+
protected readonly meterProvider: MeterProvider;
|
|
31
|
+
protected readonly metrics: Map<string, RecordMetricFunction>;
|
|
32
|
+
protected readonly recordListeners: Set<OnRecordCallback>;
|
|
33
|
+
/**
|
|
34
|
+
* Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.
|
|
35
|
+
*/
|
|
36
|
+
constructor({ serviceName, prefixMetric, metrics, onRecord, meterProvider }: BaseOtelServiceOptions);
|
|
37
|
+
getMeterProvider(): MeterProvider;
|
|
38
|
+
addView(viewOptions: ViewOptions): void;
|
|
39
|
+
record(metricName: string, value: number, labels?: MetricAttributes): void;
|
|
40
|
+
registerMetric(metricName: string, { type, ...options }: MetricDescriptor): void;
|
|
41
|
+
register(metrics: MetricsConfig): void;
|
|
42
|
+
addOnRecord(onRecord: OnRecordCallback): () => void;
|
|
43
|
+
removeOnRecord(onRecord: OnRecordCallback): void;
|
|
44
|
+
shutdown(): Promise<void>;
|
|
45
|
+
protected notifyRecordListeners(metricName: string, initialValue: number, initialLabels: MetricAttributes): MetricRecording;
|
|
46
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ExplicitBucketHistogramAggregation, View } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
import { MetricInstrumentType } from '../types.js';
|
|
3
|
+
import { isValidMetricName } from '../../utils/validators.js';
|
|
4
|
+
const instrumentationScope = 'opentelemetry-js-shopify-web';
|
|
5
|
+
export class BaseOtelService {
|
|
6
|
+
/**
|
|
7
|
+
* Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.
|
|
8
|
+
*/
|
|
9
|
+
constructor({ serviceName, prefixMetric = false, metrics = {}, onRecord, meterProvider }) {
|
|
10
|
+
this.metrics = new Map();
|
|
11
|
+
this.recordListeners = new Set();
|
|
12
|
+
if (!serviceName) {
|
|
13
|
+
throw new Error('Service name is required.');
|
|
14
|
+
}
|
|
15
|
+
this.serviceName = serviceName;
|
|
16
|
+
this.prefixMetric = prefixMetric;
|
|
17
|
+
if (onRecord)
|
|
18
|
+
this.addOnRecord(onRecord);
|
|
19
|
+
if (!meterProvider) {
|
|
20
|
+
throw new Error('MeterProvider is required.');
|
|
21
|
+
}
|
|
22
|
+
this.meterProvider = meterProvider;
|
|
23
|
+
this.register(metrics);
|
|
24
|
+
}
|
|
25
|
+
getMeterProvider() {
|
|
26
|
+
return this.meterProvider;
|
|
27
|
+
}
|
|
28
|
+
addView(viewOptions) {
|
|
29
|
+
// The API to register view is not yet exposed. We need to use the private
|
|
30
|
+
// property to register a new view after the initial instantiation.
|
|
31
|
+
;
|
|
32
|
+
this.meterProvider._sharedState?.viewRegistry?.addView?.(new View(viewOptions));
|
|
33
|
+
}
|
|
34
|
+
record(metricName, value, labels) {
|
|
35
|
+
const recordMetric = this.metrics.get(metricName);
|
|
36
|
+
if (!recordMetric) {
|
|
37
|
+
throw new Error(`Service ${this.serviceName} has no metrics registered for name: ${metricName}. Can't record value for unknown metric.`);
|
|
38
|
+
}
|
|
39
|
+
recordMetric(value, labels);
|
|
40
|
+
}
|
|
41
|
+
registerMetric(metricName, { type, ...options }) {
|
|
42
|
+
if (this.metrics.has(metricName)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const meter = this.meterProvider.getMeter(instrumentationScope);
|
|
46
|
+
const name = this.prefixMetric ? `${this.serviceName}_${metricName}` : metricName;
|
|
47
|
+
if (!isValidMetricName(name)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const createInstrument = () => {
|
|
51
|
+
switch (type) {
|
|
52
|
+
case MetricInstrumentType.Counter:
|
|
53
|
+
return meter.createCounter(name, options);
|
|
54
|
+
case MetricInstrumentType.UpDownCounter:
|
|
55
|
+
return meter.createUpDownCounter(name, options);
|
|
56
|
+
case MetricInstrumentType.Histogram: {
|
|
57
|
+
if ('boundaries' in options) {
|
|
58
|
+
this.addView({
|
|
59
|
+
instrumentName: name,
|
|
60
|
+
aggregation: new ExplicitBucketHistogramAggregation(options.boundaries, true),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return meter.createHistogram(name, options);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
// Lazy instantiate the instrument so we don't create it if we don't need to
|
|
68
|
+
this.metrics.set(metricName, (firstValue, firstLabels) => {
|
|
69
|
+
const instrument = createInstrument();
|
|
70
|
+
const record = (value, labels) => {
|
|
71
|
+
const [finalValue, finalLabels] = this.notifyRecordListeners(metricName, value,
|
|
72
|
+
// ensures an new object is created so we don't mutate the original
|
|
73
|
+
{ ...labels });
|
|
74
|
+
if ('record' in instrument) {
|
|
75
|
+
instrument.record(finalValue, finalLabels);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
instrument.add(finalValue, finalLabels);
|
|
79
|
+
}
|
|
80
|
+
// We flush metrics after every record - we do not await as we fire & forget.
|
|
81
|
+
this.meterProvider.forceFlush({});
|
|
82
|
+
};
|
|
83
|
+
record(firstValue, firstLabels);
|
|
84
|
+
this.metrics.set(metricName, record);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
register(metrics) {
|
|
88
|
+
Object.entries(metrics).forEach(([metricName, options]) => {
|
|
89
|
+
this.registerMetric(metricName, options);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
addOnRecord(onRecord) {
|
|
93
|
+
this.recordListeners.add(onRecord);
|
|
94
|
+
return () => {
|
|
95
|
+
this.recordListeners.delete(onRecord);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
removeOnRecord(onRecord) {
|
|
99
|
+
this.recordListeners.delete(onRecord);
|
|
100
|
+
}
|
|
101
|
+
shutdown() {
|
|
102
|
+
this.metrics.clear();
|
|
103
|
+
this.recordListeners.clear();
|
|
104
|
+
return this.meterProvider.shutdown();
|
|
105
|
+
}
|
|
106
|
+
notifyRecordListeners(metricName, initialValue, initialLabels) {
|
|
107
|
+
return Array.from(this.recordListeners).reduce((recordArgs, listener) => {
|
|
108
|
+
return listener(metricName, ...recordArgs) || recordArgs;
|
|
109
|
+
}, [initialValue, initialLabels]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=BaseOtelService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseOtelService.js","sourceRoot":"","sources":["../../../../../../../src/public/node/vendor/otel-js/service/BaseOtelService/BaseOtelService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kCAAkC,EAAE,IAAI,EAAC,MAAM,4BAA4B,CAAA;AAUnF,OAAO,EAAC,oBAAoB,EAAC,MAAM,aAAa,CAAA;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAA;AAE3D,MAAM,oBAAoB,GAAG,8BAA8B,CAAA;AA8B3D,MAAM,OAAO,eAAe;IAQ1B;;OAEG;IACH,YAAY,EAAC,WAAW,EAAE,YAAY,GAAG,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAyB;QAN3F,YAAO,GAAsC,IAAI,GAAG,EAAE,CAAA;QACtD,oBAAe,GAAG,IAAI,GAAG,EAAoB,CAAA;QAM9D,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;SAC7C;QACD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAE9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,QAAQ;YAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QAExC,IAAI,CAAC,aAAa,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC9C;QACD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAElC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAED,OAAO,CAAC,WAAwB;QAC9B,0EAA0E;QAC1E,mEAAmE;QACnE,CAAC;QAAC,IAAI,CAAC,aAAqB,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,E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AAC,QAA0B;QACpC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAClC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACvC,CAAC,CAAA;IACH,CAAC;IAED,cAAc,CAAC,QAA0B;QACvC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACvC,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;QACpB,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;QAC5B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAA;IACtC,CAAC;IAES,qBAAqB,CAAC,UAAkB,EAAE,YAAoB,EAAE,aAA+B;QACvG,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,CAC5C,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;YACvB,OAAO,QAAQ,CAAC,UAAU,EAAE,GAAG,UAAU,CAAC,IAAI,UAAU,CAAA;QAC1D,CAAC,EACD,CAAC,YAAY,EAAE,aAAa,CAAC,CAC9B,CAAA;IACH,CAAC;CACF","sourcesContent":["import type {MetricAttributes} from '@opentelemetry/api'\nimport type {MeterProvider, ViewOptions} from '@opentelemetry/sdk-metrics'\nimport {ExplicitBucketHistogramAggregation, View} from '@opentelemetry/sdk-metrics'\n\nimport type {\n MetricDescriptor,\n MetricRecording,\n MetricsConfig,\n OnRecordCallback,\n OtelService,\n RecordMetricFunction,\n} from '../types.js'\nimport {MetricInstrumentType} from '../types.js'\nimport {isValidMetricName} from '../../utils/validators.js'\n\nconst instrumentationScope = 'opentelemetry-js-shopify-web'\n\nexport interface BaseOtelServiceOptions {\n /**\n * Service name is a unique name for an application/service.\n */\n serviceName: string\n\n /**\n * If this is set to true then the service name is prefixed to every metric.\n */\n prefixMetric?: boolean\n\n /**\n * Metrics to register on startup.\n */\n metrics?: MetricsConfig\n\n /**\n * Called when a metric is recorded. `addOnRecord` can also be used to add\n * listeners anytime.\n */\n onRecord?: OnRecordCallback\n\n /**\n * Override the default meter provider.\n */\n meterProvider?: MeterProvider\n}\n\nexport class BaseOtelService implements OtelService {\n readonly serviceName: string\n readonly prefixMetric: boolean\n\n protected readonly meterProvider: MeterProvider\n protected readonly metrics: Map<string, RecordMetricFunction> = new Map()\n protected readonly recordListeners = new Set<OnRecordCallback>()\n\n /**\n * Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.\n */\n constructor({serviceName, prefixMetric = false, metrics = {}, onRecord, meterProvider}: BaseOtelServiceOptions) {\n if (!serviceName) {\n throw new Error('Service name is required.')\n }\n this.serviceName = serviceName\n\n this.prefixMetric = prefixMetric\n if (onRecord) this.addOnRecord(onRecord)\n\n if (!meterProvider) {\n throw new Error('MeterProvider is required.')\n }\n this.meterProvider = meterProvider\n\n this.register(metrics)\n }\n\n getMeterProvider(): MeterProvider {\n return this.meterProvider\n }\n\n addView(viewOptions: ViewOptions) {\n // The API to register view is not yet exposed. We need to use the private\n // property to register a new view after the initial instantiation.\n ;(this.meterProvider as any)._sharedState?.viewRegistry?.addView?.(new View(viewOptions))\n }\n\n record(metricName: string, value: number, labels?: MetricAttributes): void {\n const recordMetric = this.metrics.get(metricName)\n if (!recordMetric) {\n throw new Error(\n `Service ${this.serviceName} has no metrics registered for name: ${metricName}. Can't record value for unknown metric.`,\n )\n }\n recordMetric(value, labels)\n }\n\n registerMetric(metricName: string, {type, ...options}: MetricDescriptor): void {\n if (this.metrics.has(metricName)) {\n return\n }\n const meter = this.meterProvider.getMeter(instrumentationScope)\n const name = this.prefixMetric ? `${this.serviceName}_${metricName}` : metricName\n\n if (!isValidMetricName(name)) {\n return\n }\n\n const createInstrument = () => {\n switch (type) {\n case MetricInstrumentType.Counter:\n return meter.createCounter(name, options)\n case MetricInstrumentType.UpDownCounter:\n return meter.createUpDownCounter(name, options)\n case MetricInstrumentType.Histogram: {\n if ('boundaries' in options) {\n this.addView({\n instrumentName: name,\n aggregation: new ExplicitBucketHistogramAggregation(options.boundaries, true),\n })\n }\n return meter.createHistogram(name, options)\n }\n }\n }\n\n // Lazy instantiate the instrument so we don't create it if we don't need to\n this.metrics.set(metricName, (firstValue: number, firstLabels?: MetricAttributes) => {\n const instrument = createInstrument()\n const record = (value: number, labels?: MetricAttributes) => {\n const [finalValue, finalLabels] = this.notifyRecordListeners(\n metricName,\n value,\n // ensures an new object is created so we don't mutate the original\n {...labels},\n )\n if ('record' in instrument) {\n instrument.record(finalValue, finalLabels)\n } else {\n instrument.add(finalValue, finalLabels)\n }\n // We flush metrics after every record - we do not await as we fire & forget.\n this.meterProvider.forceFlush({})\n }\n record(firstValue, firstLabels)\n this.metrics.set(metricName, record)\n })\n }\n\n register(metrics: MetricsConfig) {\n Object.entries(metrics).forEach(([metricName, options]) => {\n this.registerMetric(metricName, options)\n })\n }\n\n addOnRecord(onRecord: OnRecordCallback): () => void {\n this.recordListeners.add(onRecord)\n return () => {\n this.recordListeners.delete(onRecord)\n }\n }\n\n removeOnRecord(onRecord: OnRecordCallback): void {\n this.recordListeners.delete(onRecord)\n }\n\n shutdown(): Promise<void> {\n this.metrics.clear()\n this.recordListeners.clear()\n return this.meterProvider.shutdown()\n }\n\n protected notifyRecordListeners(metricName: string, initialValue: number, initialLabels: MetricAttributes) {\n return Array.from(this.recordListeners).reduce<MetricRecording>(\n (recordArgs, listener) => {\n return listener(metricName, ...recordArgs) || recordArgs\n },\n [initialValue, initialLabels],\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MeterProvider } from '@opentelemetry/sdk-metrics';
|
|
2
|
+
export type Environment = 'production' | 'staging' | 'local';
|
|
3
|
+
interface DefaultMeterProviderOptions {
|
|
4
|
+
serviceName: string;
|
|
5
|
+
env: string;
|
|
6
|
+
throttleLimit: number;
|
|
7
|
+
useXhr: boolean;
|
|
8
|
+
otelEndpoint: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class DefaultMeterProvider extends MeterProvider {
|
|
11
|
+
constructor({ serviceName, env, throttleLimit, useXhr, otelEndpoint }: DefaultMeterProviderOptions);
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InstantaneousMetricReader } from '../../export/InstantaneousMetricReader.js';
|
|
2
|
+
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
3
|
+
import { Resource } from '@opentelemetry/resources';
|
|
4
|
+
import { AggregationTemporality, ConsoleMetricExporter, MeterProvider } from '@opentelemetry/sdk-metrics';
|
|
5
|
+
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
|
6
|
+
export class DefaultMeterProvider extends MeterProvider {
|
|
7
|
+
constructor({ serviceName, env, throttleLimit, useXhr, otelEndpoint }) {
|
|
8
|
+
super({
|
|
9
|
+
resource: new Resource({
|
|
10
|
+
[SemanticResourceAttributes.SERVICE_NAME]: serviceName,
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
const opts = {
|
|
14
|
+
// url: OTEL_ENDPOINTS[env as Environment] || OTEL_ENDPOINTS.local,
|
|
15
|
+
// CLI addition
|
|
16
|
+
url: otelEndpoint,
|
|
17
|
+
temporalityPreference: AggregationTemporality.DELTA,
|
|
18
|
+
};
|
|
19
|
+
if (useXhr) {
|
|
20
|
+
opts.headers = {};
|
|
21
|
+
}
|
|
22
|
+
const exporter = new OTLPMetricExporter(opts);
|
|
23
|
+
this.addMetricReader(new InstantaneousMetricReader({
|
|
24
|
+
exporter,
|
|
25
|
+
throttleLimit,
|
|
26
|
+
}));
|
|
27
|
+
// Add a console exporter to see what we are sending in dev environments
|
|
28
|
+
if (env === 'dev') {
|
|
29
|
+
this.addMetricReader(new InstantaneousMetricReader({
|
|
30
|
+
exporter: new ConsoleMetricExporter(),
|
|
31
|
+
throttleLimit,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=DefaultMeterProvider.js.map
|
package/dist/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultMeterProvider.js","sourceRoot":"","sources":["../../../../../../../src/public/node/vendor/otel-js/service/DefaultOtelService/DefaultMeterProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAC,MAAM,2CAA2C,CAAA;AACnF,OAAO,EAAC,kBAAkB,EAA4B,MAAM,2CAA2C,CAAA;AACvG,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAE,aAAa,EAAC,MAAM,4BAA4B,CAAA;AACvG,OAAO,EAAC,0BAA0B,EAAC,MAAM,qCAAqC,CAAA;AAa9E,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IACrD,YAAY,EAAC,WAAW,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAA8B;QAC9F,KAAK,CAAC;YACJ,QAAQ,EAAE,IAAI,QAAQ,CAAC;gBACrB,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,WAAW;aACvD,CAAC;SACH,CAAC,CAAA;QAEF,MAAM,IAAI,GAA8B;YACtC,mEAAmE;YACnE,eAAe;YACf,GAAG,EAAE,YAAY;YACjB,qBAAqB,EAAE,sBAAsB,CAAC,KAAK;SACpD,CAAA;QAED,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;SAClB;QAED,MAAM,QAAQ,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAE7C,IAAI,CAAC,eAAe,CAClB,IAAI,yBAAyB,CAAC;YAC5B,QAAQ;YACR,aAAa;SACd,CAAC,CACH,CAAA;QAED,wEAAwE;QACxE,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,IAAI,CAAC,eAAe,CAClB,IAAI,yBAAyB,CAAC;gBAC5B,QAAQ,EAAE,IAAI,qBAAqB,EAAE;gBACrC,aAAa;aACd,CAAC,CACH,CAAA;SACF;IACH,CAAC;CACF","sourcesContent":["import {InstantaneousMetricReader} from '../../export/InstantaneousMetricReader.js'\nimport {OTLPMetricExporter, OTLPMetricExporterOptions} from '@opentelemetry/exporter-metrics-otlp-http'\nimport {Resource} from '@opentelemetry/resources'\nimport {AggregationTemporality, ConsoleMetricExporter, MeterProvider} from '@opentelemetry/sdk-metrics'\nimport {SemanticResourceAttributes} from '@opentelemetry/semantic-conventions'\n\nexport type Environment = 'production' | 'staging' | 'local'\n\ninterface DefaultMeterProviderOptions {\n serviceName: string\n env: string\n throttleLimit: number\n useXhr: boolean\n // CLI addition\n otelEndpoint: string\n}\n\nexport class DefaultMeterProvider extends MeterProvider {\n constructor({serviceName, env, throttleLimit, useXhr, otelEndpoint}: DefaultMeterProviderOptions) {\n super({\n resource: new Resource({\n [SemanticResourceAttributes.SERVICE_NAME]: serviceName,\n }),\n })\n\n const opts: OTLPMetricExporterOptions = {\n // url: OTEL_ENDPOINTS[env as Environment] || OTEL_ENDPOINTS.local,\n // CLI addition\n url: otelEndpoint,\n temporalityPreference: AggregationTemporality.DELTA,\n }\n\n if (useXhr) {\n opts.headers = {}\n }\n\n const exporter = new OTLPMetricExporter(opts)\n\n this.addMetricReader(\n new InstantaneousMetricReader({\n exporter,\n throttleLimit,\n }),\n )\n\n // Add a console exporter to see what we are sending in dev environments\n if (env === 'dev') {\n this.addMetricReader(\n new InstantaneousMetricReader({\n exporter: new ConsoleMetricExporter(),\n throttleLimit,\n }),\n )\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseOtelService } from '../BaseOtelService/BaseOtelService.js';
|
|
2
|
+
import type { BaseOtelServiceOptions } from '../BaseOtelService/BaseOtelService.js';
|
|
3
|
+
export interface DefaultOtelServiceOptions extends BaseOtelServiceOptions {
|
|
4
|
+
/**
|
|
5
|
+
* What environment is being deployed (production, staging)
|
|
6
|
+
*/
|
|
7
|
+
env?: string;
|
|
8
|
+
/**
|
|
9
|
+
* How much the export should be throttled in milliseconds.
|
|
10
|
+
*/
|
|
11
|
+
throttleLimit?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Determines whether to send metrics via XHR or beacon. Defaults to false.
|
|
14
|
+
*/
|
|
15
|
+
useXhr?: boolean;
|
|
16
|
+
otelEndpoint: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class DefaultOtelService extends BaseOtelService {
|
|
19
|
+
/**
|
|
20
|
+
* Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.
|
|
21
|
+
*/
|
|
22
|
+
constructor({ throttleLimit, env, serviceName, prefixMetric, metrics, onRecord, meterProvider, useXhr, otelEndpoint, }: DefaultOtelServiceOptions);
|
|
23
|
+
shutdown(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DefaultMeterProvider } from './DefaultMeterProvider.js';
|
|
2
|
+
import { BaseOtelService } from '../BaseOtelService/BaseOtelService.js';
|
|
3
|
+
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';
|
|
4
|
+
export class DefaultOtelService extends BaseOtelService {
|
|
5
|
+
/**
|
|
6
|
+
* Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.
|
|
7
|
+
*/
|
|
8
|
+
constructor({ throttleLimit = 5000, env = 'local', serviceName, prefixMetric = false, metrics = {}, onRecord, meterProvider, useXhr = false,
|
|
9
|
+
// CLI addition
|
|
10
|
+
otelEndpoint, }) {
|
|
11
|
+
diag.setLogger(new DiagConsoleLogger(), ['production', 'staging'].includes(env) ? DiagLogLevel.ERROR : DiagLogLevel.INFO);
|
|
12
|
+
super({
|
|
13
|
+
serviceName,
|
|
14
|
+
meterProvider: meterProvider ??
|
|
15
|
+
new DefaultMeterProvider({
|
|
16
|
+
serviceName,
|
|
17
|
+
env,
|
|
18
|
+
throttleLimit,
|
|
19
|
+
useXhr,
|
|
20
|
+
// CLI addition
|
|
21
|
+
otelEndpoint,
|
|
22
|
+
}),
|
|
23
|
+
prefixMetric,
|
|
24
|
+
metrics,
|
|
25
|
+
onRecord,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
shutdown() {
|
|
29
|
+
diag.disable();
|
|
30
|
+
return super.shutdown();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=DefaultOtelService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultOtelService.js","sourceRoot":"","sources":["../../../../../../../src/public/node/vendor/otel-js/service/DefaultOtelService/DefaultOtelService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,uCAAuC,CAAA;AACrE,OAAO,EAAC,IAAI,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAsBxE,MAAM,OAAO,kBAAmB,SAAQ,eAAe;IACrD;;OAEG;IACH,YAAY,EACV,aAAa,GAAG,IAAI,EACpB,GAAG,GAAG,OAAO,EACb,WAAW,EACX,YAAY,GAAG,KAAK,EACpB,OAAO,GAAG,EAAE,EACZ,QAAQ,EACR,aAAa,EACb,MAAM,GAAG,KAAK;IACd,eAAe;IACf,YAAY,GACc;QAC1B,IAAI,CAAC,SAAS,CACZ,IAAI,iBAAiB,EAAE,EACvB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CACjF,CAAA;QAED,KAAK,CAAC;YACJ,WAAW;YACX,aAAa,EACX,aAAa;gBACb,IAAI,oBAAoB,CAAC;oBACvB,WAAW;oBACX,GAAG;oBACH,aAAa;oBACb,MAAM;oBACN,eAAe;oBACf,YAAY;iBACb,CAAC;YACJ,YAAY;YACZ,OAAO;YACP,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAEQ,QAAQ;QACf,IAAI,CAAC,OAAO,EAAE,CAAA;QACd,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;IACzB,CAAC;CACF","sourcesContent":["import {DefaultMeterProvider} from './DefaultMeterProvider.js'\nimport {BaseOtelService} from '../BaseOtelService/BaseOtelService.js'\nimport {diag, DiagConsoleLogger, DiagLogLevel} from '@opentelemetry/api'\n\nimport type {BaseOtelServiceOptions} from '../BaseOtelService/BaseOtelService.js'\n\nexport interface DefaultOtelServiceOptions extends BaseOtelServiceOptions {\n /**\n * What environment is being deployed (production, staging)\n */\n env?: string\n /**\n * How much the export should be throttled in milliseconds.\n */\n throttleLimit?: number\n /**\n * Determines whether to send metrics via XHR or beacon. Defaults to false.\n */\n useXhr?: boolean\n\n // CLI addition\n otelEndpoint: string\n}\n\nexport class DefaultOtelService extends BaseOtelService {\n /**\n * Bootstraps an Otel exporter which can send Otel metrics to a dedicated Shopify supported collector endpoint.\n */\n constructor({\n throttleLimit = 5000,\n env = 'local',\n serviceName,\n prefixMetric = false,\n metrics = {},\n onRecord,\n meterProvider,\n useXhr = false,\n // CLI addition\n otelEndpoint,\n }: DefaultOtelServiceOptions) {\n diag.setLogger(\n new DiagConsoleLogger(),\n ['production', 'staging'].includes(env) ? DiagLogLevel.ERROR : DiagLogLevel.INFO,\n )\n\n super({\n serviceName,\n meterProvider:\n meterProvider ??\n new DefaultMeterProvider({\n serviceName,\n env,\n throttleLimit,\n useXhr,\n // CLI addition\n otelEndpoint,\n }),\n prefixMetric,\n metrics,\n onRecord,\n })\n }\n\n override shutdown(): Promise<void> {\n diag.disable()\n return super.shutdown()\n }\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Counter, Histogram, MeterProvider, MetricAttributes, MetricOptions, UpDownCounter } from '@opentelemetry/api';
|
|
2
|
+
import type { ViewOptions } from '@opentelemetry/sdk-metrics';
|
|
3
|
+
export type CustomMetricLabels<TLabels extends {
|
|
4
|
+
[key in TKeys]: MetricAttributes;
|
|
5
|
+
}, TKeys extends string = keyof TLabels & string> = {
|
|
6
|
+
[P in TKeys]: TLabels[P] extends MetricAttributes ? TLabels[P] : never;
|
|
7
|
+
};
|
|
8
|
+
export type MetricRecording<TAttributes extends MetricAttributes = any> = [value: number, labels?: TAttributes];
|
|
9
|
+
export type RecordMetricFunction<TAttributes extends MetricAttributes = any> = (...args: MetricRecording<TAttributes>) => void;
|
|
10
|
+
export type OnRecordCallback<TAttributes extends MetricAttributes = any> = (metricName: string, ...args: MetricRecording<TAttributes>) => MetricRecording<TAttributes> | void;
|
|
11
|
+
export type MetricInstrument = Histogram | Counter | UpDownCounter;
|
|
12
|
+
export declare enum MetricInstrumentType {
|
|
13
|
+
Histogram = "Histogram",
|
|
14
|
+
Counter = "Counter",
|
|
15
|
+
UpDownCounter = "UpDownCounter"
|
|
16
|
+
}
|
|
17
|
+
export type MetricDescriptor = MetricOptions & ({
|
|
18
|
+
type: MetricInstrumentType.Histogram;
|
|
19
|
+
/**
|
|
20
|
+
* Boundaries are required for Histograms.
|
|
21
|
+
*/
|
|
22
|
+
boundaries: number[];
|
|
23
|
+
} | {
|
|
24
|
+
type: MetricInstrumentType.Counter | MetricInstrumentType.UpDownCounter;
|
|
25
|
+
});
|
|
26
|
+
export interface MetricsConfig {
|
|
27
|
+
[key: string]: MetricDescriptor;
|
|
28
|
+
}
|
|
29
|
+
export interface OtelService {
|
|
30
|
+
readonly serviceName: string;
|
|
31
|
+
getMeterProvider(): MeterProvider;
|
|
32
|
+
addView(viewOptions: ViewOptions): void;
|
|
33
|
+
record<TAttributes extends MetricAttributes = any>(...args: Parameters<OnRecordCallback<TAttributes>>): void;
|
|
34
|
+
/**
|
|
35
|
+
* `onRecord` callback is called when a metric is recorded.
|
|
36
|
+
* Returns a function to unsubscribe.
|
|
37
|
+
*/
|
|
38
|
+
addOnRecord(onRecord: OnRecordCallback): () => void;
|
|
39
|
+
removeOnRecord(onRecord: OnRecordCallback): void;
|
|
40
|
+
registerMetric(metricName: string, options: MetricDescriptor): void;
|
|
41
|
+
register(metrics: MetricsConfig): void;
|
|
42
|
+
shutdown(): Promise<void>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var MetricInstrumentType;
|
|
2
|
+
(function (MetricInstrumentType) {
|
|
3
|
+
MetricInstrumentType["Histogram"] = "Histogram";
|
|
4
|
+
MetricInstrumentType["Counter"] = "Counter";
|
|
5
|
+
MetricInstrumentType["UpDownCounter"] = "UpDownCounter";
|
|
6
|
+
})(MetricInstrumentType || (MetricInstrumentType = {}));
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/public/node/vendor/otel-js/service/types.ts"],"names":[],"mappings":"AA8BA,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,+CAAuB,CAAA;IACvB,2CAAmB,CAAA;IACnB,uDAA+B,CAAA;AACjC,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B","sourcesContent":["import type {\n Counter,\n Histogram,\n MeterProvider,\n MetricAttributes,\n MetricOptions,\n UpDownCounter,\n} from '@opentelemetry/api'\nimport type {ViewOptions} from '@opentelemetry/sdk-metrics'\n\nexport type CustomMetricLabels<\n TLabels extends {[key in TKeys]: MetricAttributes},\n TKeys extends string = keyof TLabels & string,\n> = {\n [P in TKeys]: TLabels[P] extends MetricAttributes ? TLabels[P] : never\n}\n\nexport type MetricRecording<TAttributes extends MetricAttributes = any> = [value: number, labels?: TAttributes]\n\nexport type RecordMetricFunction<TAttributes extends MetricAttributes = any> = (\n ...args: MetricRecording<TAttributes>\n) => void\n\nexport type OnRecordCallback<TAttributes extends MetricAttributes = any> = (\n metricName: string,\n ...args: MetricRecording<TAttributes>\n) => MetricRecording<TAttributes> | void\n\nexport type MetricInstrument = Histogram | Counter | UpDownCounter\n\nexport enum MetricInstrumentType {\n Histogram = 'Histogram',\n Counter = 'Counter',\n UpDownCounter = 'UpDownCounter',\n}\n\nexport type MetricDescriptor = MetricOptions &\n (\n | {\n type: MetricInstrumentType.Histogram\n /**\n * Boundaries are required for Histograms.\n */\n boundaries: number[]\n }\n | {\n type: MetricInstrumentType.Counter | MetricInstrumentType.UpDownCounter\n }\n )\n\nexport interface MetricsConfig {\n [key: string]: MetricDescriptor\n}\n\nexport interface OtelService {\n readonly serviceName: string\n\n getMeterProvider(): MeterProvider\n\n addView(viewOptions: ViewOptions): void\n\n record<TAttributes extends MetricAttributes = any>(...args: Parameters<OnRecordCallback<TAttributes>>): void\n\n /**\n * `onRecord` callback is called when a metric is recorded.\n * Returns a function to unsubscribe.\n */\n addOnRecord(onRecord: OnRecordCallback): () => void\n\n removeOnRecord(onRecord: OnRecordCallback): void\n\n registerMetric(metricName: string, options: MetricDescriptor): void\n\n register(metrics: MetricsConfig): void\n\n shutdown(): Promise<void>\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type ThrottledFunction<T extends (...args: any) => any> = (...args: Parameters<T>) => ReturnType<T>;
|
|
2
|
+
interface ThrottleOptions {
|
|
3
|
+
leading?: boolean;
|
|
4
|
+
trailing?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function throttle<T extends (...args: any) => any>(func: T, wait: number, { leading, trailing }?: ThrottleOptions): ThrottledFunction<T>;
|
|
7
|
+
export {};
|