@squide/firefly 15.0.5 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/AppRouter.js.map +1 -1
  3. package/dist/AppRouterContext.js.map +1 -1
  4. package/dist/AppRouterReducer.d.ts +3 -4
  5. package/dist/AppRouterReducer.js +51 -82
  6. package/dist/AppRouterReducer.js.map +1 -1
  7. package/dist/AppRouterStore.js.map +1 -1
  8. package/dist/FireflyPlugin.d.ts +6 -0
  9. package/dist/FireflyPlugin.js +6 -0
  10. package/dist/FireflyPlugin.js.map +1 -0
  11. package/dist/FireflyProvider.js.map +1 -1
  12. package/dist/FireflyRuntime.d.ts +9 -7
  13. package/dist/FireflyRuntime.js +20 -28
  14. package/dist/FireflyRuntime.js.map +1 -1
  15. package/dist/GlobalDataQueriesError.js.map +1 -1
  16. package/dist/RootRoute.js.map +1 -1
  17. package/dist/honeycomb/activeSpan.js.map +1 -1
  18. package/dist/honeycomb/createTraceContextId.js.map +1 -1
  19. package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
  20. package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +8 -0
  21. package/dist/honeycomb/registerHoneycombInstrumentation.js +19 -136
  22. package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
  23. package/dist/honeycomb/tracer.js.map +1 -1
  24. package/dist/honeycomb/utils.js.map +1 -1
  25. package/dist/index.d.ts +2 -3
  26. package/dist/index.js +4 -5
  27. package/dist/index.js.map +1 -1
  28. package/dist/initializeFirefly.d.ts +6 -6
  29. package/dist/initializeFirefly.js +26 -35
  30. package/dist/initializeFirefly.js.map +1 -1
  31. package/dist/internal.d.ts +6 -0
  32. package/dist/internal.js +26 -0
  33. package/dist/internal.js.map +1 -0
  34. package/dist/useAppRouterStore.js.map +1 -1
  35. package/dist/useCanFetchProtectedData.js.map +1 -1
  36. package/dist/useCanFetchPublicData.js.map +1 -1
  37. package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
  38. package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
  39. package/dist/useDeferredRegistrations.d.ts +1 -5
  40. package/dist/useDeferredRegistrations.js +2 -5
  41. package/dist/useDeferredRegistrations.js.map +1 -1
  42. package/dist/useExecuteOnce.js.map +1 -1
  43. package/dist/useIsActiveRouteProtected.js.map +1 -1
  44. package/dist/useIsBootstrapping.js.map +1 -1
  45. package/dist/useNavigationItems.js.map +1 -1
  46. package/dist/useProtectedDataHandler.js.map +1 -1
  47. package/dist/useProtectedDataQueries.js.map +1 -1
  48. package/dist/usePublicDataHandler.js.map +1 -1
  49. package/dist/usePublicDataQueries.js.map +1 -1
  50. package/dist/useRegisterDeferredRegistrations.d.ts +1 -4
  51. package/dist/useRegisterDeferredRegistrations.js +1 -5
  52. package/dist/useRegisterDeferredRegistrations.js.map +1 -1
  53. package/dist/useStrictRegistrationMode.js +10 -17
  54. package/dist/useStrictRegistrationMode.js.map +1 -1
  55. package/dist/useUpdateDeferredRegistrations.d.ts +3 -4
  56. package/dist/useUpdateDeferredRegistrations.js +6 -6
  57. package/dist/useUpdateDeferredRegistrations.js.map +1 -1
  58. package/package.json +27 -23
  59. package/src/AppRouterReducer.ts +51 -89
  60. package/src/FireflyPlugin.ts +11 -0
  61. package/src/FireflyRuntime.tsx +31 -34
  62. package/src/honeycomb/registerHoneycombInstrumentation.ts +30 -169
  63. package/src/index.ts +14 -3
  64. package/src/initializeFirefly.ts +51 -48
  65. package/src/internal.ts +22 -0
  66. package/src/useDeferredRegistrations.ts +3 -12
  67. package/src/useRegisterDeferredRegistrations.ts +1 -2
  68. package/src/useStrictRegistrationMode.ts +10 -15
  69. package/src/useUpdateDeferredRegistrations.ts +8 -2
@@ -1 +1 @@
1
- {"version":3,"file":"FireflyRuntime.js","sources":["webpack://@squide/firefly/./src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from \"@squide/core\";\nimport { MswPlugin, MswPluginName } from \"@squide/msw\";\nimport { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from \"@squide/react-router\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport type { Logger } from \"@workleap/logging\";\nimport type { RequestHandler } from \"msw\";\nimport { getAreModulesRegistered } from \"./AppRouterReducer.ts\";\nimport { type AppRouterStore, createAppRouterStore } from \"./AppRouterStore.ts\";\n\nexport interface FireflyRuntimeOptions extends RuntimeOptions {\n useMsw?: boolean;\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n}\n\nexport interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {}\n\nexport interface IFireflyRuntime extends IReactRouterRuntime {\n registerRequestHandlers: (handlers: RequestHandler[]) => void;\n get requestHandlers(): RequestHandler[];\n get appRouterStore(): AppRouterStore;\n get isMswEnabled(): boolean;\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;\n}\n\nexport class FireflyRuntime extends ReactRouterRuntime implements IFireflyRuntime {\n protected _appRouterStore: AppRouterStore;\n protected _useMsw: boolean;\n protected _honeycombInstrumentationClient: HoneycombInstrumentationPartialClient | undefined;\n\n constructor({ plugins, useMsw, honeycombInstrumentationClient, ...options }: FireflyRuntimeOptions = {}) {\n if (useMsw) {\n super({\n plugins: [\n ...(plugins ?? []),\n runtime => new MswPlugin(runtime)\n ],\n ...options\n });\n\n this._useMsw = true;\n } else {\n super({\n plugins,\n ...options\n });\n\n this._useMsw = false;\n }\n\n this._appRouterStore = createAppRouterStore(this._logger);\n this._honeycombInstrumentationClient = honeycombInstrumentationClient;\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n const logger = this._getLogger(options);\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n mswPlugin.registerRequestHandlers(handlers, {\n logger\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n return mswPlugin.requestHandlers;\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get appRouterStore() {\n return this._appRouterStore;\n }\n\n get isMswEnabled() {\n return this._useMsw;\n }\n\n get honeycombInstrumentationClient() {\n return this._honeycombInstrumentationClient;\n }\n\n startScope(logger: Logger): FireflyRuntime {\n return (new FireflyRuntimeScope(this, logger) as unknown) as FireflyRuntime;\n }\n}\n\nexport class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntime> extends ReactRouterRuntimeScope<TRuntime> implements IFireflyRuntime {\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n this._runtime.registerRequestHandlers(handlers, {\n ...options,\n logger: this._getLogger(options)\n });\n }\n\n get requestHandlers(): RequestHandler[] {\n return this._runtime.requestHandlers;\n }\n\n get appRouterStore() {\n return this._runtime.appRouterStore;\n }\n\n get isMswEnabled() {\n return this._runtime.isMswEnabled;\n }\n\n get honeycombInstrumentationClient() {\n return this._runtime.honeycombInstrumentationClient;\n }\n}\n"],"names":["MswPlugin","MswPluginName","ReactRouterRuntime","ReactRouterRuntimeScope","getAreModulesRegistered","createAppRouterStore","FireflyRuntime","plugins","useMsw","honeycombInstrumentationClient","options","runtime","handlers","logger","mswPlugin","Error","route","FireflyRuntimeScope"],"mappings":";;;;;;;;;;;;;;AACuD;AACkE;AAIzD;AACgB;AAiBzE,MAAMM,uBAAuBJ,kBAAkBA;IACxC,gBAAgC;IAChC,QAAiB;IACjB,gCAAmF;IAE7F,YAAY,EAAEK,OAAO,EAAEC,MAAM,EAAEC,8BAA8B,EAAE,GAAGC,SAAgC,GAAG,CAAC,CAAC,CAAE;QACrG,IAAIF,QAAQ;YACR,KAAK,CAAC;gBACF,SAAS;uBACDD,WAAW,EAAE;oBACjBI,CAAAA,UAAW,IAAIX,SAASA,CAACW;iBAC5B;gBACD,GAAGD,OAAO;YACd;YAEA,IAAI,CAAC,OAAO,GAAG;QACnB,OAAO;YACH,KAAK,CAAC;gBACFH;gBACA,GAAGG,OAAO;YACd;YAEA,IAAI,CAAC,OAAO,GAAG;QACnB;QAEA,IAAI,CAAC,eAAe,GAAGL,oBAAoBA,CAAC,IAAI,CAAC,OAAO;QACxD,IAAI,CAAC,+BAA+B,GAAGI;IAC3C;IAEA,wBAAwBG,QAA0B,EAAEF,UAA0C,CAAC,CAAC,EAAE;QAC9F,MAAMG,SAAS,IAAI,CAAC,UAAU,CAACH;QAC/B,MAAMI,YAAY,IAAI,CAAC,SAAS,CAACb,aAAaA;QAE9C,IAAI,CAACa,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAIX,uBAAuBA,IAAI;YAC3B,MAAM,IAAIW,MAAM;QACpB;QAEAD,UAAU,uBAAuB,CAACF,UAAU;YACxCC;QACJ;IACJ;IAEA,8HAA8H;IAC9H,IAAI,kBAAoC;QACpC,MAAMC,YAAY,IAAI,CAAC,SAAS,CAACb,aAAaA;QAE9C,IAAI,CAACa,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOD,UAAU,eAAe;IACpC;IAEA,cAAcE,KAAY,EAAEN,UAAgC,CAAC,CAAC,EAAE;QAC5D,IAAIN,uBAAuBA,IAAI;YAC3B,MAAM,IAAIW,MAAM;QACpB;QAEA,KAAK,CAAC,cAAcC,OAAON;IAC/B;IAEA,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,eAAe;IAC/B;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,IAAI,iCAAiC;QACjC,OAAO,IAAI,CAAC,+BAA+B;IAC/C;IAEA,WAAWG,MAAc,EAAkB;QACvC,OAAQ,IAAII,oBAAoB,IAAI,EAAEJ;IAC1C;AACJ;AAEO,MAAMI,4BAA8Ed,uBAAuBA;IAC9G,wBAAwBS,QAA0B,EAAEF,UAA0C,CAAC,CAAC,EAAE;QAC9F,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAACE,UAAU;YAC5C,GAAGF,OAAO;YACV,QAAQ,IAAI,CAAC,UAAU,CAACA;QAC5B;IACJ;IAEA,IAAI,kBAAoC;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe;IACxC;IAEA,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc;IACvC;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY;IACrC;IAEA,IAAI,iCAAiC;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,8BAA8B;IACvD;AACJ"}
1
+ {"version":3,"file":"FireflyRuntime.js","sources":["../src/FireflyRuntime.tsx"],"sourcesContent":["import type { RegisterRouteOptions, RuntimeMethodOptions, RuntimeOptions } from \"@squide/core\";\nimport { MswPlugin, MswPluginName, MswState } from \"@squide/msw\";\nimport { type IReactRouterRuntime, ReactRouterRuntime, ReactRouterRuntimeScope, type Route } from \"@squide/react-router\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport type { Logger } from \"@workleap/logging\";\nimport type { RequestHandler } from \"msw\";\nimport { type AppRouterStore, createAppRouterStore } from \"./AppRouterStore.ts\";\n\nexport interface FireflyRuntimeOptions<TRuntime extends FireflyRuntime = FireflyRuntime> extends RuntimeOptions<TRuntime> {\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n}\n\nexport interface RegisterRequestHandlersOptions extends RuntimeMethodOptions {}\n\nexport interface IFireflyRuntime extends IReactRouterRuntime {\n getMswState(): MswState;\n registerRequestHandlers: (handlers: RequestHandler[]) => void;\n get requestHandlers(): RequestHandler[];\n get appRouterStore(): AppRouterStore;\n get isMswEnabled(): boolean;\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class FireflyRuntime<TRuntime extends FireflyRuntime = any> extends ReactRouterRuntime<TRuntime> implements IFireflyRuntime {\n protected _appRouterStore: AppRouterStore;\n protected _honeycombInstrumentationClient: HoneycombInstrumentationPartialClient | undefined;\n\n constructor({ honeycombInstrumentationClient, ...options }: FireflyRuntimeOptions = {}) {\n super(options);\n\n this._appRouterStore = createAppRouterStore(this._logger);\n this._honeycombInstrumentationClient = honeycombInstrumentationClient;\n }\n\n getMswState() {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n return mswPlugin.mswState;\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n const logger = this._getLogger(options);\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot register the provided MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n if (this.moduleManager.getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register an MSW request handlers once the modules are registered. Are you trying to register an MSW request handler in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n mswPlugin.registerRequestHandlers(handlers, {\n logger\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n const mswPlugin = this.getPlugin(MswPluginName) as MswPlugin;\n\n if (!mswPlugin) {\n throw new Error(\"[squide] Cannot retrieve MSW request handlers because the runtime hasn't been initialized with MSW. Did you instanciate the FireflyRuntime with the \\\"useMsw\\\" option?\");\n }\n\n return mswPlugin.requestHandlers;\n }\n\n registerRoute(route: Route, options: RegisterRouteOptions = {}) {\n if (this.moduleManager.getAreModulesRegistered()) {\n throw new Error(\"[squide] Cannot register a route once the modules are registered. Are you trying to register a route in a deferred registration function? Only navigation items can be registered in a deferred registration function.\");\n }\n\n super.registerRoute(route, options);\n }\n\n get appRouterStore() {\n return this._appRouterStore;\n }\n\n get isMswEnabled() {\n return this._plugins.some(x => x.name === MswPluginName);\n }\n\n get honeycombInstrumentationClient() {\n return this._honeycombInstrumentationClient;\n }\n\n startScope(logger: Logger): TRuntime {\n return (new FireflyRuntimeScope(this, logger) as unknown) as TRuntime;\n }\n}\n\nexport class FireflyRuntimeScope<TRuntime extends FireflyRuntime = FireflyRuntime> extends ReactRouterRuntimeScope<TRuntime> implements IFireflyRuntime {\n getMswState() {\n return this._runtime.getMswState();\n }\n\n registerRequestHandlers(handlers: RequestHandler[], options: RegisterRequestHandlersOptions = {}) {\n this._runtime.registerRequestHandlers(handlers, {\n ...options,\n logger: this._getLogger(options)\n });\n }\n\n // Must define a return type otherwise we get an \"error TS2742: The inferred type of 'requestHandlers' cannot be named\" error.\n get requestHandlers(): RequestHandler[] {\n return this._runtime.requestHandlers;\n }\n\n get appRouterStore(): AppRouterStore {\n throw new Error(\"[squide] Cannot retrieve the app router store from a runtime scope instance.\");\n }\n\n get isMswEnabled() {\n return this._runtime.isMswEnabled;\n }\n\n get honeycombInstrumentationClient(): HoneycombInstrumentationPartialClient {\n throw new Error(\"[squide] Cannot retrieve the Honeycomb instrumentation client from a runtime scope instance.\");\n }\n}\n"],"names":["MswPluginName","ReactRouterRuntime","ReactRouterRuntimeScope","createAppRouterStore","FireflyRuntime","honeycombInstrumentationClient","options","mswPlugin","Error","handlers","logger","route","x","FireflyRuntimeScope"],"mappings":";;;;;;;;;;;AACiE;AACwD;AAIzC;AAiBhF,8DAA8D;AACvD,MAAMI,uBAA8DH,kBAAkBA;IAC/E,gBAAgC;IAChC,gCAAmF;IAE7F,YAAY,EAAEI,8BAA8B,EAAE,GAAGC,SAAgC,GAAG,CAAC,CAAC,CAAE;QACpF,KAAK,CAACA;QAEN,IAAI,CAAC,eAAe,GAAGH,oBAAoBA,CAAC,IAAI,CAAC,OAAO;QACxD,IAAI,CAAC,+BAA+B,GAAGE;IAC3C;IAEA,cAAc;QACV,MAAME,YAAY,IAAI,CAAC,SAAS,CAACP,aAAaA;QAE9C,IAAI,CAACO,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOD,UAAU,QAAQ;IAC7B;IAEA,wBAAwBE,QAA0B,EAAEH,UAA0C,CAAC,CAAC,EAAE;QAC9F,MAAMI,SAAS,IAAI,CAAC,UAAU,CAACJ;QAC/B,MAAMC,YAAY,IAAI,CAAC,SAAS,CAACP,aAAaA;QAE9C,IAAI,CAACO,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAI,IAAI,CAAC,aAAa,CAAC,uBAAuB,IAAI;YAC9C,MAAM,IAAIA,MAAM;QACpB;QAEAD,UAAU,uBAAuB,CAACE,UAAU;YACxCC;QACJ;IACJ;IAEA,8HAA8H;IAC9H,IAAI,kBAAoC;QACpC,MAAMH,YAAY,IAAI,CAAC,SAAS,CAACP,aAAaA;QAE9C,IAAI,CAACO,WAAW;YACZ,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOD,UAAU,eAAe;IACpC;IAEA,cAAcI,KAAY,EAAEL,UAAgC,CAAC,CAAC,EAAE;QAC5D,IAAI,IAAI,CAAC,aAAa,CAAC,uBAAuB,IAAI;YAC9C,MAAM,IAAIE,MAAM;QACpB;QAEA,KAAK,CAAC,cAAcG,OAAOL;IAC/B;IAEA,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,eAAe;IAC/B;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAACM,CAAAA,IAAKA,EAAE,IAAI,KAAKZ,aAAaA;IAC3D;IAEA,IAAI,iCAAiC;QACjC,OAAO,IAAI,CAAC,+BAA+B;IAC/C;IAEA,WAAWU,MAAc,EAAY;QACjC,OAAQ,IAAIG,oBAAoB,IAAI,EAAEH;IAC1C;AACJ;AAEO,MAAMG,4BAA8EX,uBAAuBA;IAC9G,cAAc;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW;IACpC;IAEA,wBAAwBO,QAA0B,EAAEH,UAA0C,CAAC,CAAC,EAAE;QAC9F,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAACG,UAAU;YAC5C,GAAGH,OAAO;YACV,QAAQ,IAAI,CAAC,UAAU,CAACA;QAC5B;IACJ;IAEA,8HAA8H;IAC9H,IAAI,kBAAoC;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe;IACxC;IAEA,IAAI,iBAAiC;QACjC,MAAM,IAAIE,MAAM;IACpB;IAEA,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY;IACrC;IAEA,IAAI,iCAAwE;QACxE,MAAM,IAAIA,MAAM;IACpB;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalDataQueriesError.js","sources":["webpack://@squide/firefly/./src/GlobalDataQueriesError.ts"],"sourcesContent":["export class GlobalDataQueriesError extends Error {\n readonly #errors: Error[];\n\n constructor(message: string, errors: Error[]) {\n super(message);\n\n this.#errors = errors;\n }\n\n get errors() {\n return this.#errors;\n }\n}\n\nexport function isGlobalDataQueriesError(error?: unknown): error is GlobalDataQueriesError {\n return error !== undefined && error !== null && error instanceof GlobalDataQueriesError;\n}\n"],"names":["GlobalDataQueriesError","Error","message","errors","isGlobalDataQueriesError","error","undefined"],"mappings":";;AAAO,MAAMA,+BAA+BC;IAC/B,OAAO,CAAU;IAE1B,YAAYC,OAAe,EAAEC,MAAe,CAAE;QAC1C,KAAK,CAACD;QAEN,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,OAAO;IACvB;AACJ;AAEO,SAASC,yBAAyBC,KAAe;IACpD,OAAOA,UAAUC,aAAaD,UAAU,QAAQA,iBAAiBL;AACrE"}
1
+ {"version":3,"file":"GlobalDataQueriesError.js","sources":["../src/GlobalDataQueriesError.ts"],"sourcesContent":["export class GlobalDataQueriesError extends Error {\n readonly #errors: Error[];\n\n constructor(message: string, errors: Error[]) {\n super(message);\n\n this.#errors = errors;\n }\n\n get errors() {\n return this.#errors;\n }\n}\n\nexport function isGlobalDataQueriesError(error?: unknown): error is GlobalDataQueriesError {\n return error !== undefined && error !== null && error instanceof GlobalDataQueriesError;\n}\n"],"names":["GlobalDataQueriesError","Error","message","errors","isGlobalDataQueriesError","error","undefined"],"mappings":";;AAAO,MAAMA,+BAA+BC;IAC/B,OAAO,CAAU;IAE1B,YAAYC,OAAe,EAAEC,MAAe,CAAE;QAC1C,KAAK,CAACD;QAEN,IAAI,CAAC,OAAO,GAAGC;IACnB;IAEA,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,OAAO;IACvB;AACJ;AAEO,SAASC,yBAAyBC,KAAe;IACpD,OAAOA,UAAUC,aAAaD,UAAU,QAAQA,iBAAiBL;AACrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"RootRoute.js","sources":["webpack://@squide/firefly/./src/RootRoute.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { useIsActiveRouteProtected } from \"./useIsActiveRouteProtected.ts\";\n\nexport function RootRoute() {\n const state = useAppRouterState();\n const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);\n\n const dispatch = useAppRouterDispatcher();\n\n useEffect(() => {\n // Dispatching the active route visibility must be done in a route because React Router's useLocation\n // hook throws if it's not called from a child of the router component.\n if (isActiveRouteProtected) {\n dispatch({ type: \"active-route-is-protected\" });\n } else {\n dispatch({ type: \"active-route-is-public\" });\n }\n }, [isActiveRouteProtected, dispatch]);\n\n return (\n <Outlet />\n );\n}\n"],"names":["useEffect","Outlet","useAppRouterDispatcher","useAppRouterState","useIsActiveRouteProtected","RootRoute","state","isActiveRouteProtected","dispatch"],"mappings":";;;;;;;;;;;;;;;;;;AAAkC;AACI;AAC4C;AACP;AAEpE,SAASK;IACZ,MAAMC,QAAQH,iBAAiBA;IAC/B,MAAMI,yBAAyBH,yBAAyBA,CAACE,MAAM,eAAe;IAE9E,MAAME,WAAWN,sBAAsBA;IAEvCF,SAASA,CAAC;QACN,qGAAqG;QACrG,uEAAuE;QACvE,IAAIO,wBAAwB;YACxBC,SAAS;gBAAE,MAAM;YAA4B;QACjD,OAAO;YACHA,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACD;QAAwBC;KAAS;IAErC,qBACI,IAACP,MAAMA;AAEf"}
1
+ {"version":3,"file":"RootRoute.js","sources":["../src/RootRoute.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { Outlet } from \"react-router\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { useIsActiveRouteProtected } from \"./useIsActiveRouteProtected.ts\";\n\nexport function RootRoute() {\n const state = useAppRouterState();\n const isActiveRouteProtected = useIsActiveRouteProtected(state.areModulesReady);\n\n const dispatch = useAppRouterDispatcher();\n\n useEffect(() => {\n // Dispatching the active route visibility must be done in a route because React Router's useLocation\n // hook throws if it's not called from a child of the router component.\n if (isActiveRouteProtected) {\n dispatch({ type: \"active-route-is-protected\" });\n } else {\n dispatch({ type: \"active-route-is-public\" });\n }\n }, [isActiveRouteProtected, dispatch]);\n\n return (\n <Outlet />\n );\n}\n"],"names":["useEffect","Outlet","useAppRouterDispatcher","useAppRouterState","useIsActiveRouteProtected","RootRoute","state","isActiveRouteProtected","dispatch"],"mappings":";;;;;;;;;;;;;;;;;;AAAkC;AACI;AAC4C;AACP;AAEpE,SAASK;IACZ,MAAMC,QAAQH,iBAAiBA;IAC/B,MAAMI,yBAAyBH,yBAAyBA,CAACE,MAAM,eAAe;IAE9E,MAAME,WAAWN,sBAAsBA;IAEvCF,SAASA,CAAC;QACN,qGAAqG;QACrG,uEAAuE;QACvE,IAAIO,wBAAwB;YACxBC,SAAS;gBAAE,MAAM;YAA4B;QACjD,OAAO;YACHA,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACD;QAAwBC;KAAS;IAErC,qBACI,IAACP,MAAMA;AAEf"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/activeSpan.js","sources":["webpack://@squide/firefly/./src/honeycomb/activeSpan.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport { isPlainObject } from \"@squide/core\";\nimport type { Logger } from \"@workleap/logging\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { createTraceContextId } from \"./createTraceContextId.ts\";\n\nexport type ActiveSpanId = string;\n\nexport interface ActiveSpan {\n id: ActiveSpanId;\n name: string;\n instance: Span;\n}\n\n// Using a stack because we want a Last In First Out implementation for this.\n// https://github.com/open-telemetry/opentelemetry-js/issues/5084\n// https://github.com/open-telemetry/opentelemetry-js/issues/3558#issuecomment-1760680244\nclass ActiveSpanStack {\n readonly #stack: ActiveSpan[] = [];\n\n push(span: ActiveSpan) {\n this.#stack.push(span);\n }\n\n pop(span: ActiveSpan) {\n const head = this.#stack.pop();\n\n if (!head) {\n throw new Error(\"[squide] Unexpected pop, the active Honeycomb span stack is empty.\");\n }\n\n if (head.id !== span.id) {\n throw new Error(`[squide] The active Honeycomb span is not the expected span. Expected to pop span with name and id \"${span.name} / ${span.id}\" but found \"${head.name} / ${head.id}\". Did you forget to end an active span?`);\n }\n\n return head;\n }\n\n peek() {\n if (this.#stack.length === 0) {\n return undefined;\n }\n\n return this.#stack[this.#stack.length - 1];\n }\n}\n\nconst GlobalActiveSpanStackVariableName = \"__SQUIDE_HONEYCOMB_ACTIVE_SPAN_STACK__\";\n\nexport function registerActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (globalThis[GlobalActiveSpanStackVariableName]) {\n throw new Error(`[squide] An ActiveSpanStack instance has already been registered to globalThis.${GlobalActiveSpanStackVariableName}. Did you register the Honeycomb instrumentation twice?`);\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[GlobalActiveSpanStackVariableName] = new ActiveSpanStack();\n}\n\nfunction getActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis[GlobalActiveSpanStackVariableName] as ActiveSpanStack;\n}\n\nfunction getActiveSpan() {\n const stack = getActiveSpanStack();\n\n if (stack) {\n return stack.peek();\n }\n}\n\nexport function setActiveSpan(name: string, span: Span) {\n const activeSpan: ActiveSpan = {\n id: uuidv4(),\n name: name,\n instance: span\n };\n\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.push(activeSpan);\n }\n\n return activeSpan;\n}\n\nexport function popActiveSpan(span: ActiveSpan) {\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.pop(span);\n }\n}\n\nexport function createOverrideFetchRequestSpanWithActiveSpanContext(logger: Logger) {\n return (span: Span, request: Request | RequestInit) => {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const activeSpanContext = activeSpan.instance.spanContext();\n const requestSpanContext = span.spanContext();\n\n if (activeSpanContext) {\n logger\n .withText(\"[squide] Found a Honeycomb active context to apply to the following fetch request:\")\n .withLineChange()\n .withText(\"Request span context:\")\n .withObject(requestSpanContext)\n .withLineChange()\n .withText(\"Active span context:\")\n .withObject(activeSpanContext)\n .withLineChange()\n .withText(\"Request:\")\n .withObject(request)\n .debug();\n\n span.setAttribute(\"trace.trace_id\", activeSpanContext.traceId);\n span.setAttribute(\"trace.parent_id\", activeSpanContext.spanId);\n\n const traceParent = createTraceContextId(activeSpanContext.traceId, requestSpanContext.spanId, requestSpanContext.traceFlags);\n\n if (request instanceof Request) {\n request.headers.set(\"traceparent\", traceParent);\n } else if (isPlainObject(request.headers)) {\n request.headers[\"traceparent\"] = traceParent;\n }\n\n // Indicates to not propagate the requests to the subsequent hooks.\n return true;\n }\n }\n };\n}\n"],"names":["isPlainObject","v4","uuidv4","createTraceContextId","ActiveSpanStack","span","head","Error","undefined","GlobalActiveSpanStackVariableName","registerActiveSpanStack","globalThis","getActiveSpanStack","getActiveSpan","stack","setActiveSpan","name","activeSpan","popActiveSpan","createOverrideFetchRequestSpanWithActiveSpanContext","logger","request","activeSpanContext","requestSpanContext","traceParent","Request"],"mappings":";;;;;;;;;;;AAC6C;AAET;AAC6B;AAUjE,6EAA6E;AAC7E,iEAAiE;AACjE,yFAAyF;AACzF,MAAMI;IACO,MAAM,GAAiB,EAAE,CAAC;IAEnC,KAAKC,IAAgB,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAACA;IACrB;IAEA,IAAIA,IAAgB,EAAE;QAClB,MAAMC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG;QAE5B,IAAI,CAACA,MAAM;YACP,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAID,KAAK,EAAE,KAAKD,KAAK,EAAE,EAAE;YACrB,MAAM,IAAIE,MAAM,CAAC,oGAAoG,EAAEF,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,aAAa,EAAEC,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,wCAAwC,CAAC;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AAU,CAACD,mBACX,cAAc,GACd,QAAQ,CAAC,YACT,UAAU,CAACD,SACX,KAAK;gBAEVhB,KAAK,YAAY,CAAC,kBAAkBiB,kBAAkB,OAAO;gBAC7DjB,KAAK,YAAY,CAAC,mBAAmBiB,kBAAkB,MAAM;gBAE7D,MAAME,cAAcrB,oBAAoBA,CAACmB,kBAAkB,OAAO,EAAEC,mBAAmB,MAAM,EAAEA,mBAAmB,UAAU;gBAE5H,IAAIF,mBAAmBI,SAAS;oBAC5BJ,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAeG;gBACvC,OAAO,IAAIxB,aAAaA,CAACqB,QAAQ,OAAO,GAAG;oBACvCA,QAAQ,OAAO,CAAC,cAAc,GAAGG;gBACrC;gBAEA,mEAAmE;gBACnE,OAAO;YACX;QACJ;IACJ;AACJ"}
1
+ {"version":3,"file":"honeycomb/activeSpan.js","sources":["../../src/honeycomb/activeSpan.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport { isPlainObject } from \"@squide/core\";\nimport type { Logger } from \"@workleap/logging\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { createTraceContextId } from \"./createTraceContextId.ts\";\n\nexport type ActiveSpanId = string;\n\nexport interface ActiveSpan {\n id: ActiveSpanId;\n name: string;\n instance: Span;\n}\n\n// Using a stack because we want a Last In First Out implementation for this.\n// https://github.com/open-telemetry/opentelemetry-js/issues/5084\n// https://github.com/open-telemetry/opentelemetry-js/issues/3558#issuecomment-1760680244\nclass ActiveSpanStack {\n readonly #stack: ActiveSpan[] = [];\n\n push(span: ActiveSpan) {\n this.#stack.push(span);\n }\n\n pop(span: ActiveSpan) {\n const head = this.#stack.pop();\n\n if (!head) {\n throw new Error(\"[squide] Unexpected pop, the active Honeycomb span stack is empty.\");\n }\n\n if (head.id !== span.id) {\n throw new Error(`[squide] The active Honeycomb span is not the expected span. Expected to pop span with name and id \"${span.name} / ${span.id}\" but found \"${head.name} / ${head.id}\". Did you forget to end an active span?`);\n }\n\n return head;\n }\n\n peek() {\n if (this.#stack.length === 0) {\n return undefined;\n }\n\n return this.#stack[this.#stack.length - 1];\n }\n}\n\nconst GlobalActiveSpanStackVariableName = \"__SQUIDE_HONEYCOMB_ACTIVE_SPAN_STACK__\";\n\nexport function registerActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (globalThis[GlobalActiveSpanStackVariableName]) {\n throw new Error(`[squide] An ActiveSpanStack instance has already been registered to globalThis.${GlobalActiveSpanStackVariableName}. Did you register the Honeycomb instrumentation twice?`);\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n globalThis[GlobalActiveSpanStackVariableName] = new ActiveSpanStack();\n}\n\nfunction getActiveSpanStack() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis[GlobalActiveSpanStackVariableName] as ActiveSpanStack;\n}\n\nfunction getActiveSpan() {\n const stack = getActiveSpanStack();\n\n if (stack) {\n return stack.peek();\n }\n}\n\nexport function setActiveSpan(name: string, span: Span) {\n const activeSpan: ActiveSpan = {\n id: uuidv4(),\n name: name,\n instance: span\n };\n\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.push(activeSpan);\n }\n\n return activeSpan;\n}\n\nexport function popActiveSpan(span: ActiveSpan) {\n const stack = getActiveSpanStack();\n\n if (stack) {\n stack.pop(span);\n }\n}\n\nexport function createOverrideFetchRequestSpanWithActiveSpanContext(logger: Logger) {\n return (span: Span, request: Request | RequestInit) => {\n const activeSpan = getActiveSpan();\n\n if (activeSpan) {\n const activeSpanContext = activeSpan.instance.spanContext();\n const requestSpanContext = span.spanContext();\n\n if (activeSpanContext) {\n logger\n .withText(\"[squide] Found a Honeycomb active context to apply to the following fetch request:\")\n .withLineChange()\n .withText(\"Request span context:\")\n .withObject(requestSpanContext)\n .withLineChange()\n .withText(\"Active span context:\")\n .withObject(activeSpanContext)\n .withLineChange()\n .withText(\"Request:\")\n .withObject(request)\n .debug();\n\n span.setAttribute(\"trace.trace_id\", activeSpanContext.traceId);\n span.setAttribute(\"trace.parent_id\", activeSpanContext.spanId);\n\n const traceParent = createTraceContextId(activeSpanContext.traceId, requestSpanContext.spanId, requestSpanContext.traceFlags);\n\n if (request instanceof Request) {\n request.headers.set(\"traceparent\", traceParent);\n } else if (isPlainObject(request.headers)) {\n request.headers[\"traceparent\"] = traceParent;\n }\n\n // Indicates to not propagate the requests to the subsequent hooks.\n return true;\n }\n }\n };\n}\n"],"names":["isPlainObject","v4","uuidv4","createTraceContextId","ActiveSpanStack","span","head","Error","undefined","GlobalActiveSpanStackVariableName","registerActiveSpanStack","globalThis","getActiveSpanStack","getActiveSpan","stack","setActiveSpan","name","activeSpan","popActiveSpan","createOverrideFetchRequestSpanWithActiveSpanContext","logger","request","activeSpanContext","requestSpanContext","traceParent","Request"],"mappings":";;;;;;;;;;;AAC6C;AAET;AAC6B;AAUjE,6EAA6E;AAC7E,iEAAiE;AACjE,yFAAyF;AACzF,MAAMI;IACO,MAAM,GAAiB,EAAE,CAAC;IAEnC,KAAKC,IAAgB,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAACA;IACrB;IAEA,IAAIA,IAAgB,EAAE;QAClB,MAAMC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG;QAE5B,IAAI,CAACA,MAAM;YACP,MAAM,IAAIC,MAAM;QACpB;QAEA,IAAID,KAAK,EAAE,KAAKD,KAAK,EAAE,EAAE;YACrB,MAAM,IAAIE,MAAM,CAAC,oGAAoG,EAAEF,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,aAAa,EAAEC,KAAK,IAAI,CAAC,GAAG,EAAEA,KAAK,EAAE,CAAC,wCAAwC,CAAC;QACjO;QAEA,OAAOA;IACX;IAEA,OAAO;QACH,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,GAAG;YAC1B,OAAOE;QACX;QAEA,OAAO,IAAI,CAAC,MAAM,CAAC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,CAAC,mBAAmBiB,kBAAkB,MAAM;gBAE7D,MAAME,cAAcrB,oBAAoBA,CAACmB,kBAAkB,OAAO,EAAEC,mBAAmB,MAAM,EAAEA,mBAAmB,UAAU;gBAE5H,IAAIF,mBAAmBI,SAAS;oBAC5BJ,QAAQ,OAAO,CAAC,GAAG,CAAC,eAAeG;gBACvC,OAAO,IAAIxB,aAAaA,CAACqB,QAAQ,OAAO,GAAG;oBACvCA,QAAQ,OAAO,CAAC,cAAc,GAAGG;gBACrC;gBAEA,mEAAmE;gBACnE,OAAO;YACX;QACJ;IACJ;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/createTraceContextId.js","sources":["webpack://@squide/firefly/./src/honeycomb/createTraceContextId.ts"],"sourcesContent":["// Creates the trace context id based on the following opentelemetry-js implementation: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/src/trace/W3CTraceContextPropagator.ts\n\nconst VERSION = \"00\";\n\nenum TraceFlags {\n NONE = 0x0,\n SAMPLED = 0x1 << 0\n}\n\nexport function createTraceContextId(traceId: string, spanId: string, traceFlags: number) {\n return `${VERSION}-${traceId}-${spanId}-0${Number(traceFlags || TraceFlags.NONE).toString(16)}`;\n}\n"],"names":["VERSION","TraceFlags","createTraceContextId","traceId","spanId","traceFlags","Number"],"mappings":";;AAAA,uNAAuN;AAEvN,MAAMA,UAAU;AAEhB,IAAKC,+BAAUA,iBAAVA,gDAAAA,SAAAA;;;WAAAA;EAAAA,+BAAUA,OAAVA,EAAAA;AAKE,SAASC,qBAAqBC,OAAe,EAAEC,MAAc,EAAEC,UAAkB;IACpF,OAAO,GAAGL,QAAQ,CAAC,EAAEG,QAAQ,CAAC,EAAEC,OAAO,EAAE,EAAEE,OAAOD,iBAA+B,QAAQ,CAAC,KAAK;AACnG"}
1
+ {"version":3,"file":"honeycomb/createTraceContextId.js","sources":["../../src/honeycomb/createTraceContextId.ts"],"sourcesContent":["// Creates the trace context id based on the following opentelemetry-js implementation: https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/src/trace/W3CTraceContextPropagator.ts\n\nconst VERSION = \"00\";\n\nenum TraceFlags {\n NONE = 0x0,\n SAMPLED = 0x1 << 0\n}\n\nexport function createTraceContextId(traceId: string, spanId: string, traceFlags: number) {\n return `${VERSION}-${traceId}-${spanId}-0${Number(traceFlags || TraceFlags.NONE).toString(16)}`;\n}\n"],"names":["VERSION","TraceFlags","createTraceContextId","traceId","spanId","traceFlags","Number"],"mappings":";;AAAA,uNAAuN;AAEvN,MAAMA,UAAU;AAEhB,IAAKC,+BAAUA,iBAAVA,gDAAAA,SAAAA;;;WAAAA;EAAAA,+BAAUA,OAAVA,EAAAA;AAKE,SAASC,qBAAqBC,OAAe,EAAEC,MAAc,EAAEC,UAAkB;IACpF,OAAO,GAAGL,QAAQ,CAAC,EAAEG,QAAQ,CAAC,EAAEC,OAAO,EAAE,EAAEE,OAAOD,iBAA+B,QAAQ,CAAC,KAAK;AACnG"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (runtime.honeycombInstrumentationClient) {\n try {\n // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries\n // if Honeycomb instrumentation is not registered by the hosting application.\n const mod = await import(\"./registerHoneycombInstrumentation.ts\");\n\n mod.registerHoneycombInstrumentation(runtime);\n } catch (error: unknown) {\n runtime.logger.error(\"[squide] Failed to register Honeycomb instrumentation. The \\\"./registerHoneycombInstrumentation.ts\\\" file cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.information(\"[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.\");\n }\n}\n"],"names":["initializeHoneycomb","runtime","mod","error"],"mappings":";;AAEO,eAAeA,oBAAoBC,OAAuB;IAC7D,IAAIA,QAAQ,8BAA8B,EAAE;QACxC,IAAI;YACA,kGAAkG;YAClG,6EAA6E;YAC7E,MAAMC,MAAM,MAAM,+CAA+C;YAEjEA,IAAI,gCAAgC,CAACD;QACzC,EAAE,OAAOE,OAAgB;YACrBF,QAAQ,MAAM,CAAC,KAAK,CAAC;YAErB,MAAME;QACV;IACJ,OAAO;QACHF,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B;AACJ"}
1
+ {"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["../../src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (runtime.honeycombInstrumentationClient) {\n try {\n // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries\n // if Honeycomb instrumentation is not registered by the hosting application.\n const mod = await import(\"./registerHoneycombInstrumentation.ts\");\n\n mod.registerHoneycombInstrumentation(runtime);\n } catch (error: unknown) {\n runtime.logger.error(\"[squide] Failed to register Honeycomb instrumentation. The \\\"./registerHoneycombInstrumentation.ts\\\" file cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.information(\"[squide] Cannot register Honeycomb instrumentation because the host application hasn't provided a client.\");\n }\n}\n"],"names":["initializeHoneycomb","runtime","mod","error"],"mappings":";;AAEO,eAAeA,oBAAoBC,OAAuB;IAC7D,IAAIA,QAAQ,8BAA8B,EAAE;QACxC,IAAI;YACA,kGAAkG;YAClG,6EAA6E;YAC7E,MAAMC,MAAM,MAAM,+CAA+C;YAEjEA,IAAI,gCAAgC,CAACD;QACzC,EAAE,OAAOE,OAAgB;YACrBF,QAAQ,MAAM,CAAC,KAAK,CAAC;YAErB,MAAME;QACV;IACJ,OAAO;QACHF,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B;AACJ"}
@@ -1,3 +1,11 @@
1
+ import type { Span } from "@opentelemetry/api";
2
+ import { type AddListenerOptions, type EventCallbackFunction, type EventName } from "@squide/core";
1
3
  import type { FireflyRuntime } from "../FireflyRuntime.tsx";
4
+ export interface AddProtectedListenerOptions extends AddListenerOptions {
5
+ onError?: (error: unknown) => void;
6
+ }
7
+ export declare function addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions): void;
8
+ export type GetSpanFunction = () => Span;
9
+ export type HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => void;
2
10
  export declare function reduceDataFetchEvents(runtime: FireflyRuntime, onDataFetchStarted: () => void, onDataReady: () => void, onPublicDataFetchStarted: () => void, onPublicDataReady: () => void, onProtectedDataFetchStarted: () => void, onProtectedDataReady: () => void, onDataFetchFailed: (queriesErrors: Error[]) => void, onUnmanagedError: (error: unknown) => void): void;
3
11
  export declare function registerHoneycombInstrumentation(runtime: FireflyRuntime): void;
@@ -1,17 +1,15 @@
1
1
  import { LocalModuleDeferredRegistrationFailedEvent, LocalModuleDeferredRegistrationUpdateFailedEvent, LocalModuleRegistrationFailedEvent, LocalModulesDeferredRegistrationCompletedEvent, LocalModulesDeferredRegistrationStartedEvent, LocalModulesDeferredRegistrationsUpdateCompletedEvent, LocalModulesDeferredRegistrationsUpdateStartedEvent, LocalModulesRegistrationCompletedEvent, LocalModulesRegistrationStartedEvent } from "@squide/core";
2
- import { DeferredRegistrationsUpdateCompletedEvent, DeferredRegistrationsUpdateStartedEvent, RemoteModuleDeferredRegistrationFailedEvent, RemoteModuleDeferredRegistrationUpdateFailedEvent, RemoteModuleRegistrationFailedEvent, RemoteModulesDeferredRegistrationCompletedEvent, RemoteModulesDeferredRegistrationStartedEvent, RemoteModulesDeferredRegistrationsUpdateCompletedEvent, RemoteModulesDeferredRegistrationsUpdateStartedEvent, RemoteModulesRegistrationCompletedEvent, RemoteModulesRegistrationStartedEvent } from "@squide/module-federation";
3
2
  import { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from "../AppRouterReducer.js";
4
3
  import { ApplicationBootstrappingStartedEvent } from "../initializeFirefly.js";
5
4
  import { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from "../useProtectedDataQueries.js";
6
5
  import { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from "../usePublicDataQueries.js";
6
+ import { DeferredRegistrationsUpdateCompletedEvent, DeferredRegistrationsUpdateStartedEvent } from "../useUpdateDeferredRegistrations.js";
7
7
  import { createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from "./activeSpan.js";
8
8
  import { getTracer } from "./tracer.js";
9
9
  import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from "./utils.js";
10
10
 
11
11
  ;// CONCATENATED MODULE: external "@squide/core"
12
12
 
13
- ;// CONCATENATED MODULE: external "@squide/module-federation"
14
-
15
13
  ;// CONCATENATED MODULE: external "../AppRouterReducer.js"
16
14
 
17
15
  ;// CONCATENATED MODULE: external "../initializeFirefly.js"
@@ -20,6 +18,8 @@ import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceEr
20
18
 
21
19
  ;// CONCATENATED MODULE: external "../usePublicDataQueries.js"
22
20
 
21
+ ;// CONCATENATED MODULE: external "../useUpdateDeferredRegistrations.js"
22
+
23
23
  ;// CONCATENATED MODULE: external "./activeSpan.js"
24
24
 
25
25
  ;// CONCATENATED MODULE: external "./tracer.js"
@@ -122,12 +122,10 @@ function registerTrackingListeners(runtime) {
122
122
  let bootstrappingSpanHasEnded = false;
123
123
  let localModuleRegistrationSpan;
124
124
  let localModuleDeferredRegistrationSpan;
125
- let remoteModuleRegistrationSpan;
126
- let remoteModuleDeferredRegistrationSpan;
127
125
  let dataFetchSpan;
128
126
  let deferredRegistrationsUpdateSpan;
129
127
  let localModuleDeferredRegistrationsUpdateSpan;
130
- let remoteModuleDeferredRegistrationsUpdateSpan;
128
+ const pluginsUnmanagedErrorHandlers = [];
131
129
  const handleUnmanagedError = (error)=>{
132
130
  if (bootstrappingSpan && !bootstrappingSpanHasEnded) {
133
131
  traceError(bootstrappingSpan, error);
@@ -140,12 +138,6 @@ function registerTrackingListeners(runtime) {
140
138
  if (localModuleDeferredRegistrationSpan) {
141
139
  localModuleDeferredRegistrationSpan.end();
142
140
  }
143
- if (remoteModuleRegistrationSpan) {
144
- remoteModuleRegistrationSpan.end();
145
- }
146
- if (remoteModuleDeferredRegistrationSpan) {
147
- remoteModuleDeferredRegistrationSpan.end();
148
- }
149
141
  if (dataFetchSpan) {
150
142
  dataFetchSpan.instance.end();
151
143
  }
@@ -155,9 +147,9 @@ function registerTrackingListeners(runtime) {
155
147
  if (localModuleDeferredRegistrationsUpdateSpan) {
156
148
  localModuleDeferredRegistrationsUpdateSpan.instance.end();
157
149
  }
158
- if (remoteModuleDeferredRegistrationsUpdateSpan) {
159
- remoteModuleDeferredRegistrationsUpdateSpan.instance.end();
160
- }
150
+ pluginsUnmanagedErrorHandlers.forEach((x)=>{
151
+ x(error);
152
+ });
161
153
  };
162
154
  addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, ()=>{
163
155
  bootstrappingSpan = startSpan((options, context)=>getTracer().startSpan("squide-bootstrapping", options, context));
@@ -260,84 +252,6 @@ function registerTrackingListeners(runtime) {
260
252
  }, {
261
253
  onError: handleUnmanagedError
262
254
  });
263
- addProtectedListener(runtime, RemoteModulesRegistrationStartedEvent, (payload)=>{
264
- const attributes = {
265
- "app.squide.remote_count": payload.remoteCount
266
- };
267
- if (bootstrappingSpan) {
268
- bootstrappingSpan.addEvent("remote-module-registration-started", attributes);
269
- }
270
- remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context)=>{
271
- return getTracer().startSpan("remote-module-registration", {
272
- ...options,
273
- attributes
274
- }, context);
275
- });
276
- }, {
277
- once: true,
278
- onError: handleUnmanagedError
279
- });
280
- addProtectedListener(runtime, RemoteModulesRegistrationCompletedEvent, (payload)=>{
281
- if (bootstrappingSpan) {
282
- bootstrappingSpan.addEvent("remote-module-registration-completed", {
283
- "app.squide.remote_count": payload.remoteCount
284
- });
285
- }
286
- if (remoteModuleRegistrationSpan) {
287
- remoteModuleRegistrationSpan.end();
288
- }
289
- }, {
290
- once: true,
291
- onError: handleUnmanagedError
292
- });
293
- // Can occur multiple times.
294
- addProtectedListener(runtime, RemoteModuleRegistrationFailedEvent, (payload)=>{
295
- const registrationError = payload;
296
- if (remoteModuleRegistrationSpan) {
297
- traceError(remoteModuleRegistrationSpan, registrationError);
298
- }
299
- }, {
300
- onError: handleUnmanagedError
301
- });
302
- addProtectedListener(runtime, RemoteModulesDeferredRegistrationStartedEvent, (payload)=>{
303
- const attributes = {
304
- "app.squide.registration_count": payload.registrationCount
305
- };
306
- if (bootstrappingSpan) {
307
- bootstrappingSpan.addEvent("remote-module-deferred-registration-started", attributes);
308
- }
309
- remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context)=>{
310
- return getTracer().startSpan("remote-module-deferred-registration", {
311
- ...options,
312
- attributes
313
- }, context);
314
- });
315
- }, {
316
- once: true,
317
- onError: handleUnmanagedError
318
- });
319
- addProtectedListener(runtime, RemoteModulesDeferredRegistrationCompletedEvent, (payload)=>{
320
- if (bootstrappingSpan) {
321
- bootstrappingSpan.addEvent("remote-module-deferred-registration-completed", {
322
- "app.squide.registration_count": payload.registrationCount
323
- });
324
- }
325
- if (remoteModuleDeferredRegistrationSpan) {
326
- remoteModuleDeferredRegistrationSpan.end();
327
- }
328
- }, {
329
- once: true,
330
- onError: handleUnmanagedError
331
- });
332
- // Can occur multiple times.
333
- addProtectedListener(runtime, RemoteModuleDeferredRegistrationFailedEvent, (payload)=>{
334
- const registrationError = payload;
335
- if (remoteModuleDeferredRegistrationSpan) {
336
- traceError(remoteModuleDeferredRegistrationSpan, registrationError);
337
- }
338
- }, {
339
- onError: handleUnmanagedError
340
- });
341
255
  const handleFetchDataStarted = ()=>{
342
256
  dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context)=>{
343
257
  const name = "data-fetch";
@@ -462,49 +376,18 @@ function registerTrackingListeners(runtime) {
462
376
  }, {
463
377
  onError: handleUnmanagedError
464
378
  });
465
- // Can occur multiple times.
466
- addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
467
- const attributes = {
468
- "app.squide.registration_count": payload.registrationCount
469
- };
470
- if (deferredRegistrationsUpdateSpan) {
471
- deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-started", attributes);
472
- }
473
- remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context)=>{
474
- const name = "remote-module-deferred-registrations-update";
475
- const span = getTracer().startSpan(name, {
476
- attributes,
477
- ...options
478
- }, context);
479
- return {
480
- name,
481
- span
482
- };
483
- });
484
- }, {
485
- onError: handleUnmanagedError
486
- });
487
- // Can occur multiple times.
488
- addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
489
- if (deferredRegistrationsUpdateSpan) {
490
- deferredRegistrationsUpdateSpan.addEvent("remote-module-deferred-registrations-update-completed", {
491
- "app.squide.registration_count": payload.registrationCount
492
- });
493
- }
494
- if (remoteModuleDeferredRegistrationsUpdateSpan) {
495
- endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);
496
- }
497
- }, {
498
- onError: handleUnmanagedError
499
- });
500
- // Can occur multiple times.
501
- addProtectedListener(runtime, RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
502
- const registrationError = payload;
503
- if (remoteModuleDeferredRegistrationsUpdateSpan) {
504
- traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);
379
+ const getBootstrappingSpan = ()=>bootstrappingSpan;
380
+ const getDeferredRegistrationsUpdateSpan = ()=>deferredRegistrationsUpdateSpan;
381
+ const handlePluginUnmanagedError = (error)=>{
382
+ handleUnmanagedError(error);
383
+ };
384
+ // Register plugins specific handlers for Honeycomb telemetry.
385
+ runtime.plugins.forEach((x)=>{
386
+ const plugin = x;
387
+ if (plugin.registerHoneycombTrackingListeners) {
388
+ const unmanagedErrorHandler = plugin.registerHoneycombTrackingListeners(getBootstrappingSpan, getDeferredRegistrationsUpdateSpan, handlePluginUnmanagedError);
389
+ pluginsUnmanagedErrorHandlers.push(unmanagedErrorHandler);
505
390
  }
506
- }, {
507
- onError: handleUnmanagedError
508
391
  });
509
392
  }
510
393
  function registerHoneycombInstrumentation(runtime) {
@@ -520,6 +403,6 @@ function registerHoneycombInstrumentation(runtime) {
520
403
  }
521
404
  }
522
405
 
523
- export { reduceDataFetchEvents, registerHoneycombInstrumentation };
406
+ export { addProtectedListener, reduceDataFetchEvents, registerHoneycombInstrumentation };
524
407
 
525
408
  //# sourceMappingURL=registerHoneycombInstrumentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n type AddListenerOptions,\n type EventCallbackFunction,\n type EventName,\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport {\n DeferredRegistrationsUpdateCompletedEvent,\n DeferredRegistrationsUpdateStartedEvent,\n RemoteModuleDeferredRegistrationFailedEvent,\n RemoteModuleDeferredRegistrationUpdateFailedEvent,\n type RemoteModuleRegistrationError,\n RemoteModuleRegistrationFailedEvent,\n RemoteModulesDeferredRegistrationCompletedEvent,\n type RemoteModulesDeferredRegistrationCompletedEventPayload,\n RemoteModulesDeferredRegistrationStartedEvent,\n type RemoteModulesDeferredRegistrationStartedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateCompletedEvent,\n type RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateStartedEvent,\n type RemoteModulesDeferredRegistrationsUpdateStartedEventPayload,\n RemoteModulesRegistrationCompletedEvent,\n type RemoteModulesRegistrationCompletedEventPayload,\n RemoteModulesRegistrationStartedEvent,\n type RemoteModulesRegistrationStartedEventPayload\n} from \"@squide/module-federation\";\nimport { ApplicationBoostrappedEvent, type AppRouterWaitState, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter: \"root.name = squide-bootstrapping\".\n\ninterface AddProtectedListenerOptions extends AddListenerOptions {\n onError?: (error: unknown) => void;\n}\n\nfunction addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions) {\n const protectedCallback = (...args: unknown[]) => {\n try {\n callback(...args);\n } catch (error: unknown) {\n runtime.logger\n .withText(`[squide] An unmanaged error occurred while handling event \"${eventName.toString()}\" for Honeycomb instrumentation:`)\n .withError(error as Error)\n .error();\n }\n };\n\n runtime.eventBus.addListener(eventName, protectedCallback, options);\n}\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void,\n onUnmanagedError: (error: unknown) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n const handleDataFetchFailed = (payload: unknown) => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload as Error[]);\n }\n };\n\n addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let bootstrappingSpanHasEnded: boolean = false;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let remoteModuleRegistrationSpan: Span;\n let remoteModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n const handleUnmanagedError = (error: unknown) => {\n if (bootstrappingSpan && !bootstrappingSpanHasEnded) {\n traceError(bootstrappingSpan, error as Error);\n\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n\n if (dataFetchSpan) {\n dataFetchSpan.instance.end();\n }\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n localModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n remoteModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n };\n\n addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-started\", attributes);\n }\n\n remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-completed\", {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount\n });\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed,\n handleUnmanagedError\n );\n\n addProtectedListener(runtime, ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"remote-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n registerActiveSpanStack();\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));\n\n registerTrackingListeners(runtime);\n\n runtime.logger.information(\"[squide] Honeycomb instrumentation is registered.\");\n } catch (error: unknown) {\n runtime.logger\n .withText(\"[squide] An error occurred while registering Honeycomb instrumentation:\")\n .withError(error as Error)\n .error();\n }\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","RemoteModuleDeferredRegistrationFailedEvent","RemoteModuleDeferredRegistrationUpdateFailedEvent","RemoteModuleRegistrationFailedEvent","RemoteModulesDeferredRegistrationCompletedEvent","RemoteModulesDeferredRegistrationStartedEvent","RemoteModulesDeferredRegistrationsUpdateCompletedEvent","RemoteModulesDeferredRegistrationsUpdateStartedEvent","RemoteModulesRegistrationCompletedEvent","RemoteModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","addProtectedListener","runtime","eventName","callback","options","protectedCallback","args","error","reduceDataFetchEvents","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","onUnmanagedError","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","bootstrappingSpanHasEnded","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","handleUnmanagedError","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","x","registerHoneycombInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBsB;AAoBa;AACoK;AAExH;AAC+B;AACT;AAC2B;AACxF;AACgE;AASxG,SAASuC,qBAAqBC,OAAuB,EAAEC,SAAoB,EAAEC,QAA+B,EAAEC,OAAqC;IAC/I,MAAMC,oBAAoB,CAAC,GAAGC;QAC1B,IAAI;YACAH,YAAYG;QAChB,EAAE,OAAOC,OAAgB;YACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,CAAC,2DAA2D,EAAEC,UAAU,QAAQ,GAAG,gCAAgC,CAAC,EAC7H,SAAS,CAACK,OACV,KAAK;QACd;IACJ;IAEAN,QAAQ,QAAQ,CAAC,WAAW,CAACC,WAAWG,mBAAmBD;AAC/D;AAIO,SAASI,sBACZP,OAAuB,EACvBQ,kBAA8B,EAC9BC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC,EAChCC,iBAAmD,EACnDC,gBAA0C;IAE1C,IAAIC,iBAAiC;IAErCjB,qBAAqBC,SAASV,2BAA2BA,EAAE;QACvD,IAAI0B,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBR;QACJ;QAEAE;IACJ,GAAG;QACC,MAAM;QACN,SAASK;IACb;IAEAhB,qBAAqBC,SAASf,oBAAoBA,EAAEgC,CAAAA;QAChDN;QAEA,IAAIK,mBAAmB,iBAAiB;YACpC,IAAIC,WAAW,CAAEA,QAA+B,oBAAoB,EAAE;gBAClED,i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QACAR,uBAAuBA;QAEvB,+EAA+E;QAC/E,gEAAgE;QAChEQ,QAAQ,8BAA8B,EAAE,yBAAyBT,mDAAmDA,CAACS,QAAQ,MAAM;QAEnImB,0BAA0BnB;QAE1BA,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B,EAAE,OAAOM,OAAgB;QACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
1
+ {"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["../../src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n type AddListenerOptions,\n type EventCallbackFunction,\n type EventName,\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport { ApplicationBoostrappedEvent, type AppRouterWaitState, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport { FireflyPlugin } from \"../FireflyPlugin.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { DeferredRegistrationsUpdateCompletedEvent, DeferredRegistrationsUpdateStartedEvent } from \"../useUpdateDeferredRegistrations.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter:\n// \"root.name = squide-bootstrapping\" and\n// \"root.name = squide-deferred-registrations-update\".\n\nexport interface AddProtectedListenerOptions extends AddListenerOptions {\n onError?: (error: unknown) => void;\n}\n\nexport function addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions) {\n const protectedCallback = (...args: unknown[]) => {\n try {\n callback(...args);\n } catch (error: unknown) {\n runtime.logger\n .withText(`[squide] An unmanaged error occurred while handling event \"${eventName.toString()}\" for Honeycomb instrumentation:`)\n .withError(error as Error)\n .error();\n }\n };\n\n runtime.eventBus.addListener(eventName, protectedCallback, options);\n}\n\nexport type GetSpanFunction = () => Span;\nexport type HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => void;\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void,\n onUnmanagedError: (error: unknown) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n const handleDataFetchFailed = (payload: unknown) => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload as Error[]);\n }\n };\n\n addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let bootstrappingSpanHasEnded: boolean = false;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n const pluginsUnmanagedErrorHandlers: HoneycombTrackingUnmanagedErrorHandler[] = [];\n\n const handleUnmanagedError = (error: unknown) => {\n if (bootstrappingSpan && !bootstrappingSpanHasEnded) {\n traceError(bootstrappingSpan, error as Error);\n\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n\n if (dataFetchSpan) {\n dataFetchSpan.instance.end();\n }\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n localModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n\n pluginsUnmanagedErrorHandlers.forEach(x => {\n x(error);\n });\n };\n\n addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed,\n handleUnmanagedError\n );\n\n addProtectedListener(runtime, ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const getBootstrappingSpan: GetSpanFunction = () => bootstrappingSpan;\n const getDeferredRegistrationsUpdateSpan: GetSpanFunction = () => deferredRegistrationsUpdateSpan;\n\n const handlePluginUnmanagedError: HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => {\n handleUnmanagedError(error);\n };\n\n // Register plugins specific handlers for Honeycomb telemetry.\n runtime.plugins.forEach(x => {\n const plugin = x as FireflyPlugin;\n\n if (plugin.registerHoneycombTrackingListeners) {\n const unmanagedErrorHandler = plugin.registerHoneycombTrackingListeners(\n getBootstrappingSpan,\n getDeferredRegistrationsUpdateSpan,\n handlePluginUnmanagedError\n );\n\n pluginsUnmanagedErrorHandlers.push(unmanagedErrorHandler);\n }\n });\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n registerActiveSpanStack();\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));\n\n registerTrackingListeners(runtime);\n\n runtime.logger.information(\"[squide] Honeycomb instrumentation is registered.\");\n } catch (error: unknown) {\n runtime.logger\n .withText(\"[squide] An error occurred while registering Honeycomb instrumentation:\")\n .withError(error as Error)\n .error();\n }\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","addProtectedListener","runtime","eventName","callback","options","protectedCallback","args","error","reduceDataFetchEvents","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","onUnmanagedError","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","bootstrappingSpanHasEnded","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","pluginsUnmanagedErrorHandlers","handleUnmanagedError","x","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","getBootstrappingSpan","getDeferredRegistrationsUpdateSpan","handlePluginUnmanagedError","plugin","unmanagedErrorHandler","registerHoneycombInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBsB;AACiL;AAGxH;AAC+B;AACT;AACqC;AACV;AACxF;AACgE;AAWjG,SAAS8B,qBAAqBC,OAAuB,EAAEC,SAAoB,EAAEC,QAA+B,EAAEC,OAAqC;IACtJ,MAAMC,oBAAoB,CAAC,GAAGC;QAC1B,IAAI;YACAH,YAAYG;QAChB,EAAE,OAAOC,OAAgB;YACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,CAAC,2DAA2D,EAAEC,UAAU,QAAQ,GAAG,gCAAgC,CAAC,EAC7H,SAAS,CAACK,OACV,KAAK;QACd;IACJ;IAEAN,QA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AAIQ,iCAAiC;YACjCA,gCAAgC,QAAQ,CAAC,wDAAwD;gBAC7F,iCAAkCR,QAAyE,iBAAiB;YAChI;QACJ;QAEA,IAAIS,4CAA4C;YAC5ChC,aAAaA,CAACgC;QAClB;IACJ,GAAG;QACC,SAASE;IACb;IAEA,4BAA4B;IAC5B7B,qBAAqBC,SAAS9B,gDAAgDA,EAAE,CAAC+C;QAC7E,MAAMe,oBAAoBf;QAE1B,IAAIS,4CAA4C;YAC5C5B,UAAUA,CAAC4B,2CAA2C,QAAQ,EAAEM;QACpE;IACJ,GAAG;QACC,SAASJ;IACb;IAEA,MAAMc,uBAAwC,IAAMtB;IACpD,MAAMuB,qCAAsD,IAAMlB;IAElE,MAAMmB,6BAAqE,CAACtC;QACxEsB,qBAAqBtB;IACzB;IAEA,8DAA8D;IAC9DN,QAAQ,OAAO,CAAC,OAAO,CAAC6B,CAAAA;QACpB,MAAMgB,SAAShB;QAEf,IAAIgB,OAAO,kCAAkC,EAAE;YAC3C,MAAMC,wBAAwBD,OAAO,kCAAkC,CACnEH,sBACAC,oCACAC;YAGJjB,8BAA8B,IAAI,CAACmB;QACvC;IACJ;AACJ;AAEO,SAASC,iCAAiC/C,OAAuB;IACpE,IAAI;QACAR,uBAAuBA;QAEvB,+EAA+E;QAC/E,gEAAgE;QAChEQ,QAAQ,8BAA8B,EAAE,yBAAyBT,mDAAmDA,CAACS,QAAQ,MAAM;QAEnImB,0BAA0BnB;QAE1BA,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B,EAAE,OAAOM,OAAgB;QACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/tracer.js","sources":["webpack://@squide/firefly/./src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":";;;;;AAA2C;AAEpC,SAASC;IACZ,2DAA2D;IAC3D,OAAOD,eAAe,CAAC;AAC3B"}
1
+ {"version":3,"file":"honeycomb/tracer.js","sources":["../../src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":";;;;;AAA2C;AAEpC,SAASC;IACZ,2DAA2D;IAC3D,OAAOD,eAAe,CAAC;AAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/utils.js","sources":["webpack://@squide/firefly/./src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":";;;;;;;;AAAqL;AACrG;AAIzE,SAASQ,UAAUC,OAAyB;IAC/C,OAAOA,QAAQ;QAAE,MAAML,eAAe;IAAC;AAC3C;AAIO,SAASM,eAAeC,MAAY,EAAEF,OAA8B;IACvE,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,OAAOF,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;AAC9C;AASO,SAASY,gBAAgBH,OAA+B;IAC3D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC;IAEvD,OAAOG,aAAaA,CAACM,MAAMC;AAC/B;AASO,SAASC,qBAAqBJ,MAAY,EAAEF,OAAoC;IACnF,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,MAAM,EAAEE,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;IAE1D,OAAOO,aAAaA,CAACM,MAAMC;AAC/B;AAEO,SAASE,cAAcF,IAAgB;IAC1CA,KAAK,QAAQ,CAAC,GAAG;IAEjBR,aAAaA,CAACQ;AAClB;AAMO,SAASG,WAAWH,IAAU,EAAEI,KAAgB,EAAEC,UAA6B,CAAC,CAAC;IACpF,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjBL,KAAK,eAAe,CAACI,OAAOE;IAE5BN,KAAK,SAAS,CAAC;QACX,MAAMT,oBAAoB;IAC9B;AACJ"}
1
+ {"version":3,"file":"honeycomb/utils.js","sources":["../../src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":";;;;;;;;AAAqL;AACrG;AAIzE,SAASQ,UAAUC,OAAyB;IAC/C,OAAOA,QAAQ;QAAE,MAAML,eAAe;IAAC;AAC3C;AAIO,SAASM,eAAeC,MAAY,EAAEF,OAA8B;IACvE,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,OAAOF,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;AAC9C;AASO,SAASY,gBAAgBH,OAA+B;IAC3D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC;IAEvD,OAAOG,aAAaA,CAACM,MAAMC;AAC/B;AASO,SAASC,qBAAqBJ,MAAY,EAAEF,OAAoC;IACnF,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,MAAM,EAAEE,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;IAE1D,OAAOO,aAAaA,CAACM,MAAMC;AAC/B;AAEO,SAASE,cAAcF,IAAgB;IAC1CA,KAAK,QAAQ,CAAC,GAAG;IAEjBR,aAAaA,CAACQ;AAClB;AAMO,SAASG,WAAWH,IAAU,EAAEI,KAAgB,EAAEC,UAA6B,CAAC,CAAC;IACpF,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjBL,KAAK,eAAe,CAACI,OAAOE;IAE5BN,KAAK,SAAS,CAAC;QACX,MAAMT,oBAAoB;IAC9B;AACJ"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  export * from "@squide/core";
2
- export * from "@squide/module-federation";
3
2
  export * from "@squide/msw";
4
3
  export * from "@squide/react-router";
4
+ export type { FireflyPlugin } from "./FireflyPlugin.ts";
5
5
  export * from "./FireflyProvider.tsx";
6
6
  export * from "./FireflyRuntime.tsx";
7
7
  export * from "./AppRouter.tsx";
8
- export * from "./AppRouterContext.ts";
9
- export * from "./AppRouterReducer.ts";
8
+ export { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.ts";
10
9
  export * from "./AppRouterStore.ts";
11
10
  export * from "./GlobalDataQueriesError.ts";
12
11
  export * from "./useCanFetchProtectedData.ts";
package/dist/index.js CHANGED
@@ -1,12 +1,10 @@
1
+ import { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.js";
1
2
  export * from "@squide/core";
2
- export * from "@squide/module-federation";
3
3
  export * from "@squide/msw";
4
4
  export * from "@squide/react-router";
5
5
  export * from "./FireflyProvider.js";
6
6
  export * from "./FireflyRuntime.js";
7
7
  export * from "./AppRouter.js";
8
- export * from "./AppRouterContext.js";
9
- export * from "./AppRouterReducer.js";
10
8
  export * from "./AppRouterStore.js";
11
9
  export * from "./GlobalDataQueriesError.js";
12
10
  export * from "./useCanFetchProtectedData.js";
@@ -26,9 +24,9 @@ export * from "./useStrictRegistrationMode.js";
26
24
  export * from "./useUpdateDeferredRegistrations.js";
27
25
  export * from "./initializeFirefly.js";
28
26
 
29
- ;// CONCATENATED MODULE: ./src/index.ts
30
-
27
+ ;// CONCATENATED MODULE: external "./AppRouterReducer.js"
31
28
 
29
+ ;// CONCATENATED MODULE: ./src/index.ts
32
30
 
33
31
 
34
32
 
@@ -55,5 +53,6 @@ export * from "./initializeFirefly.js";
55
53
 
56
54
 
57
55
 
56
+ export { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent };
58
57
 
59
58
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["webpack://@squide/firefly/./src/index.ts"],"sourcesContent":["export * from \"@squide/core\";\nexport * from \"@squide/module-federation\";\nexport * from \"@squide/msw\";\nexport * from \"@squide/react-router\";\n\nexport * from \"./FireflyProvider.tsx\";\nexport * from \"./FireflyRuntime.tsx\";\n\nexport * from \"./AppRouter.tsx\";\nexport * from \"./AppRouterContext.ts\";\nexport * from \"./AppRouterReducer.ts\";\n\nexport * from \"./AppRouterStore.ts\";\nexport * from \"./GlobalDataQueriesError.ts\";\nexport * from \"./useCanFetchProtectedData.ts\";\nexport * from \"./useCanFetchPublicData.ts\";\nexport * from \"./useCanRegisterDeferredRegistrations.ts\";\nexport * from \"./useCanUpdateDeferredRegistrations.ts\";\nexport * from \"./useDeferredRegistrations.ts\";\nexport * from \"./useIsActiveRouteProtected.ts\";\nexport * from \"./useIsBootstrapping.ts\";\nexport * from \"./useNavigationItems.ts\";\nexport * from \"./useProtectedDataHandler.ts\";\nexport * from \"./useProtectedDataQueries.ts\";\nexport * from \"./usePublicDataHandler.ts\";\nexport * from \"./usePublicDataQueries.ts\";\nexport * from \"./useRegisterDeferredRegistrations.ts\";\nexport * from \"./useStrictRegistrationMode.ts\";\nexport * from \"./useUpdateDeferredRegistrations.ts\";\n\nexport * from \"./initializeFirefly.ts\";\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA6B;AACa;AACd;AACS;AAEC;AACD;AAEL;AACM;AACA;AAEF;AACQ;AACE;AACH;AACc;AACF;AACT;AACC;AACP;AACA;AACK;AACA;AACH;AACA;AACY;AACP;AACK;AAEb"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"@squide/core\";\nexport * from \"@squide/msw\";\nexport * from \"@squide/react-router\";\n\nexport type { FireflyPlugin } from \"./FireflyPlugin.ts\";\nexport * from \"./FireflyProvider.tsx\";\nexport * from \"./FireflyRuntime.tsx\";\n\nexport * from \"./AppRouter.tsx\";\nexport {\n ActiveRouteIsProtectedEvent,\n ActiveRouteIsPublicEvent,\n ApplicationBoostrappedEvent,\n DeferredRegistrationsUpdatedEvent,\n ModulesReadyEvent,\n ModulesRegisteredEvent,\n MswReadyEvent,\n ProtectedDataReadyEvent,\n ProtectedDataUpdatedEvent,\n PublicDataReadyEvent,\n PublicDataUpdatedEvent\n} from \"./AppRouterReducer.ts\";\n\nexport * from \"./AppRouterStore.ts\";\nexport * from \"./GlobalDataQueriesError.ts\";\nexport * from \"./useCanFetchProtectedData.ts\";\nexport * from \"./useCanFetchPublicData.ts\";\nexport * from \"./useCanRegisterDeferredRegistrations.ts\";\nexport * from \"./useCanUpdateDeferredRegistrations.ts\";\nexport * from \"./useDeferredRegistrations.ts\";\nexport * from \"./useIsActiveRouteProtected.ts\";\nexport * from \"./useIsBootstrapping.ts\";\nexport * from \"./useNavigationItems.ts\";\nexport * from \"./useProtectedDataHandler.ts\";\nexport * from \"./useProtectedDataQueries.ts\";\nexport * from \"./usePublicDataHandler.ts\";\nexport * from \"./usePublicDataQueries.ts\";\nexport * from \"./useRegisterDeferredRegistrations.ts\";\nexport * from \"./useStrictRegistrationMode.ts\";\nexport * from \"./useUpdateDeferredRegistrations.ts\";\n\nexport * from \"./initializeFirefly.ts\";\n\n"],"names":["ActiveRouteIsProtectedEvent","ActiveRouteIsPublicEvent","ApplicationBoostrappedEvent","DeferredRegistrationsUpdatedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","ProtectedDataUpdatedEvent","PublicDataReadyEvent","PublicDataUpdatedEvent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA6B;AACD;AACS;AAGC;AACD;AAEL;AAaD;AAEK;AACQ;AACE;AACH;AACc;AACF;AACT;AACC;AACP;AACA;AACK;AACA;AACH;AACA;AACY;AACP;AACK;AAEb"}