@interfere/types 9.0.3-canary.3 → 9.0.3-canary.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const API_KEY_PREFIXES=[`interfere_secret_us_`,`interfere_secret_eu_`,`interfere_ak_`],DASHBOARD_KEYS_URL=`https://interfere.com/settings/api-keys`,API_KEY_PREFIX_HINT=API_KEY_PREFIXES.map(prefix=>`\`${prefix}\``).join(` or `);function formatApiKeyPreview(apiKey){let preview=apiKey.slice(0,12);return apiKey.length>12?`${preview}...`:preview}function isInterfereApiKey(apiKey){return API_KEY_PREFIXES.some(prefix=>apiKey.startsWith(prefix))}const CATALOG={API_KEY_WRONG_PREFIX:(ctx,input)=>({code:`API_KEY_WRONG_PREFIX`,severity:`fatal`,title:`INTERFERE_API_KEY has wrong prefix`,details:[`Expected a key starting with ${API_KEY_PREFIX_HINT} but got \`${formatApiKeyPreview(input.apiKey??``)}\`.`,`If you set a publishable key (\`interfere_pub_us_*\`, \`interfere_pub_eu_*\`, or legacy \`interfere_pk_*\`), put it in \`${ctx.publicKeyEnvVar}\` instead.`,`Generate a new API key at ${DASHBOARD_KEYS_URL}.`]}),API_KEY_UNREADABLE:ctx=>({code:`API_KEY_UNREADABLE`,severity:`fatal`,title:`API key could not be read`,details:[`INTERFERE_API_KEY was sent but the server could not read it.`,`Expected a key starting with ${API_KEY_PREFIX_HINT}.`,`If you set a publishable key (\`interfere_pub_us_*\`, \`interfere_pub_eu_*\`, or legacy \`interfere_pk_*\`), put it in \`${ctx.publicKeyEnvVar}\` instead.`,`Generate a new API key at ${DASHBOARD_KEYS_URL}.`]}),API_KEY_REJECTED:()=>({code:`API_KEY_REJECTED`,severity:`fatal`,title:`API key rejected by server`,details:[`INTERFERE_API_KEY was sent but the server did not recognize it.`,`Verify it matches an active key at ${DASHBOARD_KEYS_URL}.`,`If you recently rotated keys, restart your build with the new value.`]}),API_KEY_SCOPE_MISMATCH:()=>({code:`API_KEY_SCOPE_MISMATCH`,severity:`fatal`,title:`API key missing release scope`,details:[`INTERFERE_API_KEY was recognized but cannot publish release metadata.`,`Create or update the key with \`release:write\` scope at ${DASHBOARD_KEYS_URL}.`,`If you recently changed key scopes, restart your build with the new value.`]}),RELEASE_PIPELINE_FAILED:(_ctx,input)=>({code:`RELEASE_PIPELINE_FAILED`,severity:`warn`,title:`Skipping release pipeline`,details:[`Interfere failed to process this release.`,`Events from this release will be ingested, but ignored as finding when generating insights.`,`Please check https://status.interfere.com for any outages, or contact support@interfere.com if the problem persists.`,`Error: ${input.errorMessage??`<unknown>`}`]})};function diagnoseRelease(code,ctx,input={}){return CATALOG[code](ctx,input)}const COLLECTOR_CODE_TO_DIAGNOSTIC={COLLECTOR_AUTH_MISSING:`API_KEY_UNREADABLE`,COLLECTOR_AUTH_AK_INVALID:`API_KEY_REJECTED`,COLLECTOR_AUTH_AK_SCOPE_MISMATCH:`API_KEY_SCOPE_MISMATCH`};function classifyReleasePipelineError(error){if(typeof error!=`object`||!error)return`RELEASE_PIPELINE_FAILED`;let{code}=error;return typeof code==`string`?COLLECTOR_CODE_TO_DIAGNOSTIC[code]??`RELEASE_PIPELINE_FAILED`:`RELEASE_PIPELINE_FAILED`}exports.API_KEY_PREFIXES=API_KEY_PREFIXES,exports.classifyReleasePipelineError=classifyReleasePipelineError,exports.diagnoseRelease=diagnoseRelease,exports.formatApiKeyPreview=formatApiKeyPreview,exports.isInterfereApiKey=isInterfereApiKey;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/sdk/build-diagnostics.d.ts
|
|
2
|
-
declare const
|
|
2
|
+
declare const API_KEY_PREFIXES: readonly ["interfere_secret_us_", "interfere_secret_eu_", "interfere_ak_"];
|
|
3
3
|
type ReleaseDiagnosticSeverity = "fatal" | "warn";
|
|
4
4
|
type ReleaseDiagnosticCode = "API_KEY_WRONG_PREFIX" | "API_KEY_UNREADABLE" | "API_KEY_REJECTED" | "API_KEY_SCOPE_MISMATCH" | "RELEASE_PIPELINE_FAILED";
|
|
5
5
|
interface ReleaseDiagnostic {
|
|
@@ -16,7 +16,8 @@ interface ReleaseDiagnosticInput {
|
|
|
16
16
|
readonly errorMessage?: string;
|
|
17
17
|
}
|
|
18
18
|
declare function formatApiKeyPreview(apiKey: string): string;
|
|
19
|
+
declare function isInterfereApiKey(apiKey: string): boolean;
|
|
19
20
|
declare function diagnoseRelease(code: ReleaseDiagnosticCode, ctx: ReleaseDiagnosticContext, input?: ReleaseDiagnosticInput): ReleaseDiagnostic;
|
|
20
21
|
declare function classifyReleasePipelineError(error: unknown): ReleaseDiagnosticCode;
|
|
21
22
|
//#endregion
|
|
22
|
-
export {
|
|
23
|
+
export { API_KEY_PREFIXES, ReleaseDiagnostic, ReleaseDiagnosticCode, ReleaseDiagnosticContext, ReleaseDiagnosticInput, ReleaseDiagnosticSeverity, classifyReleasePipelineError, diagnoseRelease, formatApiKeyPreview, isInterfereApiKey };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/sdk/build-diagnostics.d.ts
|
|
2
|
-
declare const
|
|
2
|
+
declare const API_KEY_PREFIXES: readonly ["interfere_secret_us_", "interfere_secret_eu_", "interfere_ak_"];
|
|
3
3
|
type ReleaseDiagnosticSeverity = "fatal" | "warn";
|
|
4
4
|
type ReleaseDiagnosticCode = "API_KEY_WRONG_PREFIX" | "API_KEY_UNREADABLE" | "API_KEY_REJECTED" | "API_KEY_SCOPE_MISMATCH" | "RELEASE_PIPELINE_FAILED";
|
|
5
5
|
interface ReleaseDiagnostic {
|
|
@@ -16,7 +16,8 @@ interface ReleaseDiagnosticInput {
|
|
|
16
16
|
readonly errorMessage?: string;
|
|
17
17
|
}
|
|
18
18
|
declare function formatApiKeyPreview(apiKey: string): string;
|
|
19
|
+
declare function isInterfereApiKey(apiKey: string): boolean;
|
|
19
20
|
declare function diagnoseRelease(code: ReleaseDiagnosticCode, ctx: ReleaseDiagnosticContext, input?: ReleaseDiagnosticInput): ReleaseDiagnostic;
|
|
20
21
|
declare function classifyReleasePipelineError(error: unknown): ReleaseDiagnosticCode;
|
|
21
22
|
//#endregion
|
|
22
|
-
export {
|
|
23
|
+
export { API_KEY_PREFIXES, ReleaseDiagnostic, ReleaseDiagnosticCode, ReleaseDiagnosticContext, ReleaseDiagnosticInput, ReleaseDiagnosticSeverity, classifyReleasePipelineError, diagnoseRelease, formatApiKeyPreview, isInterfereApiKey };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const API_KEY_PREFIXES=[`interfere_secret_us_`,`interfere_secret_eu_`,`interfere_ak_`],DASHBOARD_KEYS_URL=`https://interfere.com/settings/api-keys`,API_KEY_PREFIX_HINT=API_KEY_PREFIXES.map(prefix=>`\`${prefix}\``).join(` or `);function formatApiKeyPreview(apiKey){let preview=apiKey.slice(0,12);return apiKey.length>12?`${preview}...`:preview}function isInterfereApiKey(apiKey){return API_KEY_PREFIXES.some(prefix=>apiKey.startsWith(prefix))}const CATALOG={API_KEY_WRONG_PREFIX:(ctx,input)=>({code:`API_KEY_WRONG_PREFIX`,severity:`fatal`,title:`INTERFERE_API_KEY has wrong prefix`,details:[`Expected a key starting with ${API_KEY_PREFIX_HINT} but got \`${formatApiKeyPreview(input.apiKey??``)}\`.`,`If you set a publishable key (\`interfere_pub_us_*\`, \`interfere_pub_eu_*\`, or legacy \`interfere_pk_*\`), put it in \`${ctx.publicKeyEnvVar}\` instead.`,`Generate a new API key at ${DASHBOARD_KEYS_URL}.`]}),API_KEY_UNREADABLE:ctx=>({code:`API_KEY_UNREADABLE`,severity:`fatal`,title:`API key could not be read`,details:[`INTERFERE_API_KEY was sent but the server could not read it.`,`Expected a key starting with ${API_KEY_PREFIX_HINT}.`,`If you set a publishable key (\`interfere_pub_us_*\`, \`interfere_pub_eu_*\`, or legacy \`interfere_pk_*\`), put it in \`${ctx.publicKeyEnvVar}\` instead.`,`Generate a new API key at ${DASHBOARD_KEYS_URL}.`]}),API_KEY_REJECTED:()=>({code:`API_KEY_REJECTED`,severity:`fatal`,title:`API key rejected by server`,details:[`INTERFERE_API_KEY was sent but the server did not recognize it.`,`Verify it matches an active key at ${DASHBOARD_KEYS_URL}.`,`If you recently rotated keys, restart your build with the new value.`]}),API_KEY_SCOPE_MISMATCH:()=>({code:`API_KEY_SCOPE_MISMATCH`,severity:`fatal`,title:`API key missing release scope`,details:[`INTERFERE_API_KEY was recognized but cannot publish release metadata.`,`Create or update the key with \`release:write\` scope at ${DASHBOARD_KEYS_URL}.`,`If you recently changed key scopes, restart your build with the new value.`]}),RELEASE_PIPELINE_FAILED:(_ctx,input)=>({code:`RELEASE_PIPELINE_FAILED`,severity:`warn`,title:`Skipping release pipeline`,details:[`Interfere failed to process this release.`,`Events from this release will be ingested, but ignored as finding when generating insights.`,`Please check https://status.interfere.com for any outages, or contact support@interfere.com if the problem persists.`,`Error: ${input.errorMessage??`<unknown>`}`]})};function diagnoseRelease(code,ctx,input={}){return CATALOG[code](ctx,input)}const COLLECTOR_CODE_TO_DIAGNOSTIC={COLLECTOR_AUTH_MISSING:`API_KEY_UNREADABLE`,COLLECTOR_AUTH_AK_INVALID:`API_KEY_REJECTED`,COLLECTOR_AUTH_AK_SCOPE_MISMATCH:`API_KEY_SCOPE_MISMATCH`};function classifyReleasePipelineError(error){if(typeof error!=`object`||!error)return`RELEASE_PIPELINE_FAILED`;let{code}=error;return typeof code==`string`?COLLECTOR_CODE_TO_DIAGNOSTIC[code]??`RELEASE_PIPELINE_FAILED`:`RELEASE_PIPELINE_FAILED`}export{API_KEY_PREFIXES,classifyReleasePipelineError,diagnoseRelease,formatApiKeyPreview,isInterfereApiKey};
|