@webiny/project 6.6.0-alpha.3 → 6.6.0-alpha.5

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 (88) hide show
  1. package/components/FeatureFlag.js +1 -1
  2. package/components/FeatureFlag.js.map +1 -1
  3. package/createProjectSdkContainer.js +22 -9
  4. package/createProjectSdkContainer.js.map +1 -1
  5. package/extensions/AdminExtension.js +2 -2
  6. package/extensions/AdminExtension.js.map +1 -1
  7. package/extensions/AdminWebsocketsUrl.d.ts +1 -1
  8. package/extensions/AdminWebsocketsUrl.js.map +1 -1
  9. package/extensions/ApiExtension.js +2 -2
  10. package/extensions/ApiExtension.js.map +1 -1
  11. package/extensions/BugReporter.d.ts +6 -0
  12. package/extensions/BugReporter.js +33 -0
  13. package/extensions/BugReporter.js.map +1 -0
  14. package/extensions/FeatureFlags.d.ts +6 -1
  15. package/extensions/FeatureFlags.js +9 -1
  16. package/extensions/FeatureFlags.js.map +1 -1
  17. package/extensions/Project/WcpInjectTelemetryClientAfterBuild.js.map +1 -1
  18. package/extensions/Project/showConfigChangeNotice.d.ts +1 -1
  19. package/extensions/Project/showConfigChangeNotice.js.map +1 -1
  20. package/extensions/hasDefaultExport.d.ts +2 -0
  21. package/extensions/hasDefaultExport.js +17 -0
  22. package/extensions/hasDefaultExport.js.map +1 -0
  23. package/extensions/index.d.ts +14 -3
  24. package/extensions/index.js +3 -1
  25. package/extensions/index.js.map +1 -1
  26. package/features/Serve/Serve.d.ts +1 -1
  27. package/features/Serve/Serve.js.map +1 -1
  28. package/package.json +14 -14
  29. package/services/GetProjectConfigService/ConfigRenderErrorBoundary.d.ts +15 -0
  30. package/services/GetProjectConfigService/ConfigRenderErrorBoundary.js +23 -0
  31. package/services/GetProjectConfigService/ConfigRenderErrorBoundary.js.map +1 -0
  32. package/services/GetProjectConfigService/EnvContext.d.ts +3 -2
  33. package/services/GetProjectConfigService/EnvContext.js +4 -6
  34. package/services/GetProjectConfigService/EnvContext.js.map +1 -1
  35. package/services/GetProjectConfigService/GetProjectConfigService.js +14 -11
  36. package/services/GetProjectConfigService/GetProjectConfigService.js.map +1 -1
  37. package/services/GetProjectConfigService/getRenderCacheKey.d.ts +1 -0
  38. package/services/GetProjectConfigService/getRenderCacheKey.js +13 -0
  39. package/services/GetProjectConfigService/getRenderCacheKey.js.map +1 -0
  40. package/services/GetProjectConfigService/nullRenderer.d.ts +4 -0
  41. package/services/GetProjectConfigService/nullRenderer.js +51 -0
  42. package/services/GetProjectConfigService/nullRenderer.js.map +1 -0
  43. package/services/GetProjectConfigService/renderConfig.d.ts +3 -12
  44. package/services/GetProjectConfigService/renderConfig.js +10 -35
  45. package/services/GetProjectConfigService/renderConfig.js.map +1 -1
  46. package/services/GetProjectConfigService/renderExtensions.d.ts +8 -0
  47. package/services/GetProjectConfigService/renderExtensions.js +52 -0
  48. package/services/GetProjectConfigService/renderExtensions.js.map +1 -0
  49. package/services/InitProjectSdkService/InitProjectSdkService.js +5 -8
  50. package/services/InitProjectSdkService/InitProjectSdkService.js.map +1 -1
  51. package/services/InitProjectSdkService/applyWcpEnvVars.js +27 -9
  52. package/services/InitProjectSdkService/applyWcpEnvVars.js.map +1 -1
  53. package/services/ValidateProjectConfigService/ValidateProjectConfigService.js +10 -7
  54. package/services/ValidateProjectConfigService/ValidateProjectConfigService.js.map +1 -1
  55. package/services/WcpService/GetProjectEnvironment.js +16 -5
  56. package/services/WcpService/GetProjectEnvironment.js.map +1 -1
  57. package/services/WcpService/fetchProjectEnvironmentByApiKey.d.ts +8 -0
  58. package/services/WcpService/fetchProjectEnvironmentByApiKey.js +21 -0
  59. package/services/WcpService/fetchProjectEnvironmentByApiKey.js.map +1 -0
  60. package/utils/apiRuntimeEnv.d.ts +2 -2
  61. package/utils/apiRuntimeEnv.js.map +1 -1
  62. package/utils/index.d.ts +1 -0
  63. package/utils/index.js +1 -0
  64. package/utils/trace/TraceRecorder.d.ts +17 -0
  65. package/utils/trace/TraceRecorder.js +51 -0
  66. package/utils/trace/TraceRecorder.js.map +1 -0
  67. package/utils/trace/formatTraceReport.d.ts +2 -0
  68. package/utils/trace/formatTraceReport.js +53 -0
  69. package/utils/trace/formatTraceReport.js.map +1 -0
  70. package/utils/trace/index.d.ts +6 -0
  71. package/utils/trace/index.js +6 -0
  72. package/utils/trace/isTraceRequested.d.ts +1 -0
  73. package/utils/trace/isTraceRequested.js +12 -0
  74. package/utils/trace/isTraceRequested.js.map +1 -0
  75. package/utils/trace/startTrace.d.ts +1 -0
  76. package/utils/trace/startTrace.js +19 -0
  77. package/utils/trace/startTrace.js.map +1 -0
  78. package/utils/trace/trace.d.ts +1 -0
  79. package/utils/trace/trace.js +13 -0
  80. package/utils/trace/trace.js.map +1 -0
  81. package/utils/trace/traceAsync.d.ts +1 -0
  82. package/utils/trace/traceAsync.js +13 -0
  83. package/utils/trace/traceAsync.js.map +1 -0
  84. package/rslib-runtime.js +0 -14
  85. package/rslib-runtime.js.map +0 -1
  86. package/services/GetProjectConfigService/renderConfigWorker.d.ts +0 -1
  87. package/services/GetProjectConfigService/renderConfigWorker.js +0 -64
  88. package/services/GetProjectConfigService/renderConfigWorker.js.map +0 -1
@@ -36,7 +36,7 @@ function CanUseHcmsFieldPermissions({ children }) {
36
36
  }
37
37
  function CanUseRemoteComponents({ children }) {
38
38
  return /*#__PURE__*/ react.createElement(CanUse, {
39
- name: "remoteComponents"
39
+ name: "aiPowerups.remoteComponents"
40
40
  }, children);
41
41
  }
42
42
  function CanUseAiPowerups({ children }) {
@@ -1 +1 @@
1
- {"version":3,"file":"components/FeatureFlag.js","sources":["../../src/components/FeatureFlag.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FeatureFlagName } from \"@webiny/feature-flags\";\nimport { useProjectFeatureFlags } from \"~/services/GetProjectConfigService/FeatureFlagsContext.js\";\n\ninterface CanUseProps {\n name: FeatureFlagName;\n children: React.ReactNode;\n}\n\nfunction CanUse({ name, children }: CanUseProps) {\n const flags = useProjectFeatureFlags();\n return flags.isEnabled(name) ? <>{children}</> : null;\n}\n\nfunction CanUseMultiTenancy({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"multiTenancy\">{children}</CanUse>;\n}\n\nfunction CanUseWorkflows({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedPublishingWorkflow\">{children}</CanUse>;\n}\n\nfunction CanUseTeams({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedAccessControlLayer.teams\">{children}</CanUse>;\n}\n\nfunction CanUsePrivateFiles({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedAccessControlLayer.privateFiles\">{children}</CanUse>;\n}\n\nfunction CanUseFileManagerThreatDetection({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"fileManager.threatDetection\">{children}</CanUse>;\n}\n\nfunction CanUseHcmsFieldPermissions({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedAccessControlLayer.hcmsFieldPermissions\">{children}</CanUse>;\n}\n\nfunction CanUseRemoteComponents({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"remoteComponents\">{children}</CanUse>;\n}\n\nfunction CanUseAiPowerups({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"aiPowerups\">{children}</CanUse>;\n}\n\nexport const FeatureFlag = {\n CanUse,\n CanUseMultiTenancy,\n CanUseWorkflows,\n CanUseTeams,\n CanUsePrivateFiles,\n CanUseFileManagerThreatDetection,\n CanUseHcmsFieldPermissions,\n CanUseRemoteComponents,\n CanUseAiPowerups\n};\n"],"names":["CanUse","name","children","flags","useProjectFeatureFlags","CanUseMultiTenancy","CanUseWorkflows","CanUseTeams","CanUsePrivateFiles","CanUseFileManagerThreatDetection","CanUseHcmsFieldPermissions","CanUseRemoteComponents","CanUseAiPowerups","FeatureFlag"],"mappings":";;AASA,SAASA,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAe;IAC3C,MAAMC,QAAQC;IACd,OAAOD,MAAM,SAAS,CAACF,QAAQ,WAARA,GAAQ,0CAAGC,YAAe;AACrD;AAEA,SAASG,mBAAmB,EAAEH,QAAQ,EAAiC;IACnE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAgBE;AACxC;AAEA,SAASI,gBAAgB,EAAEJ,QAAQ,EAAiC;IAChE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAA8BE;AACtD;AAEA,SAASK,YAAY,EAAEL,QAAQ,EAAiC;IAC5D,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAoCE;AAC5D;AAEA,SAASM,mBAAmB,EAAEN,QAAQ,EAAiC;IACnE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAA2CE;AACnE;AAEA,SAASO,iCAAiC,EAAEP,QAAQ,EAAiC;IACjF,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAA+BE;AACvD;AAEA,SAASQ,2BAA2B,EAAER,QAAQ,EAAiC;IAC3E,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAmDE;AAC3E;AAEA,SAASS,uBAAuB,EAAET,QAAQ,EAAiC;IACvE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAoBE;AAC5C;AAEA,SAASU,iBAAiB,EAAEV,QAAQ,EAAiC;IACjE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAcE;AACtC;AAEO,MAAMW,cAAc;IACvBb,QAAAA;IACAK,oBAAAA;IACAC,iBAAAA;IACAC,aAAAA;IACAC,oBAAAA;IACAC,kCAAAA;IACAC,4BAAAA;IACAC,wBAAAA;IACAC,kBAAAA;AACJ"}
1
+ {"version":3,"file":"components/FeatureFlag.js","sources":["../../src/components/FeatureFlag.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FeatureFlagName } from \"@webiny/feature-flags\";\nimport { useProjectFeatureFlags } from \"~/services/GetProjectConfigService/FeatureFlagsContext.js\";\n\ninterface CanUseProps {\n name: FeatureFlagName;\n children: React.ReactNode;\n}\n\nfunction CanUse({ name, children }: CanUseProps) {\n const flags = useProjectFeatureFlags();\n return flags.isEnabled(name) ? <>{children}</> : null;\n}\n\nfunction CanUseMultiTenancy({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"multiTenancy\">{children}</CanUse>;\n}\n\nfunction CanUseWorkflows({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedPublishingWorkflow\">{children}</CanUse>;\n}\n\nfunction CanUseTeams({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedAccessControlLayer.teams\">{children}</CanUse>;\n}\n\nfunction CanUsePrivateFiles({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedAccessControlLayer.privateFiles\">{children}</CanUse>;\n}\n\nfunction CanUseFileManagerThreatDetection({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"fileManager.threatDetection\">{children}</CanUse>;\n}\n\nfunction CanUseHcmsFieldPermissions({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"advancedAccessControlLayer.hcmsFieldPermissions\">{children}</CanUse>;\n}\n\nfunction CanUseRemoteComponents({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"aiPowerups.remoteComponents\">{children}</CanUse>;\n}\n\nfunction CanUseAiPowerups({ children }: { children: React.ReactNode }) {\n return <CanUse name=\"aiPowerups\">{children}</CanUse>;\n}\n\nexport const FeatureFlag = {\n CanUse,\n CanUseMultiTenancy,\n CanUseWorkflows,\n CanUseTeams,\n CanUsePrivateFiles,\n CanUseFileManagerThreatDetection,\n CanUseHcmsFieldPermissions,\n CanUseRemoteComponents,\n CanUseAiPowerups\n};\n"],"names":["CanUse","name","children","flags","useProjectFeatureFlags","CanUseMultiTenancy","CanUseWorkflows","CanUseTeams","CanUsePrivateFiles","CanUseFileManagerThreatDetection","CanUseHcmsFieldPermissions","CanUseRemoteComponents","CanUseAiPowerups","FeatureFlag"],"mappings":";;AASA,SAASA,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAe;IAC3C,MAAMC,QAAQC;IACd,OAAOD,MAAM,SAAS,CAACF,QAAQ,WAARA,GAAQ,0CAAGC,YAAe;AACrD;AAEA,SAASG,mBAAmB,EAAEH,QAAQ,EAAiC;IACnE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAgBE;AACxC;AAEA,SAASI,gBAAgB,EAAEJ,QAAQ,EAAiC;IAChE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAA8BE;AACtD;AAEA,SAASK,YAAY,EAAEL,QAAQ,EAAiC;IAC5D,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAoCE;AAC5D;AAEA,SAASM,mBAAmB,EAAEN,QAAQ,EAAiC;IACnE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAA2CE;AACnE;AAEA,SAASO,iCAAiC,EAAEP,QAAQ,EAAiC;IACjF,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAA+BE;AACvD;AAEA,SAASQ,2BAA2B,EAAER,QAAQ,EAAiC;IAC3E,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAmDE;AAC3E;AAEA,SAASS,uBAAuB,EAAET,QAAQ,EAAiC;IACvE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAA+BE;AACvD;AAEA,SAASU,iBAAiB,EAAEV,QAAQ,EAAiC;IACjE,OAAO,WAAP,GAAO,oBAACF,QAAMA;QAAC,MAAK;OAAcE;AACtC;AAEO,MAAMW,cAAc;IACvBb,QAAAA;IACAK,oBAAAA;IACAC,iBAAAA;IACAC,aAAAA;IACAC,oBAAAA;IACAC,kCAAAA;IACAC,4BAAAA;IACAC,wBAAAA;IACAC,kBAAAA;AACJ"}
@@ -3,6 +3,9 @@ import { adminAfterBuild, adminBeforeBuild, adminBeforeWatch, afterBuild, apiAft
3
3
  import { buildAppWorkspaceService, buildProjectWorkspaceService, getAppPackagesService, getAppService, getCwdService, getIsCiService, getNpmVersionService, getNpxVersionService, getProjectConfigService, getProjectIdService, getProjectInstallationIdService, getProjectService, getProjectVersionService, getPulumiVersionService, getYarnVersionService, initProjectSdkService, installExtensionService, listPackagesInAppWorkspaceService, listPackagesService, loadEnvVarsService, localStorageService, loggerService, projectInfoService, projectSdkParamsService, setProjectIdService, stackOutputCacheService, stdioService, uiService, validateProjectConfigService, wcpService } from "./services/index.js";
4
4
  import { BuildProjectWorkspaceService, GetProjectConfig, InitProjectSdkService, LoadEnvVarsService, LoggerService, ProjectSdkParamsService, ValidateProjectConfig } from "./abstractions/index.js";
5
5
  import { getFeatureFlagsWithLicense } from "./decorators/index.js";
6
+ import { traceAsync } from "./utils/trace/index.js";
7
+ import { applyEnvVars } from "./services/InitProjectSdkService/applyEnvVars.js";
8
+ import { applyWcpEnvVars } from "./services/InitProjectSdkService/applyWcpEnvVars.js";
6
9
  const createProjectSdkContainer = async (params, register)=>{
7
10
  const container = new Container();
8
11
  container.register(getAppService).inSingletonScope();
@@ -66,17 +69,27 @@ const createProjectSdkContainer = async (params, register)=>{
66
69
  container.registerComposite(coreBeforeWatch);
67
70
  container.resolve(ProjectSdkParamsService).set(params);
68
71
  register?.(container);
69
- await container.resolve(LoadEnvVarsService).execute();
70
- await container.resolve(BuildProjectWorkspaceService).execute();
72
+ const loadEnvVars = container.resolve(LoadEnvVarsService);
73
+ await traceAsync("load env vars", ()=>loadEnvVars.execute());
74
+ const buildProjectWorkspace = container.resolve(BuildProjectWorkspaceService);
75
+ await traceAsync("build project workspace", ()=>buildProjectWorkspace.execute());
71
76
  const logger = container.resolve(LoggerService);
72
77
  logger.log("Initializing Project SDK container...");
73
- const projectExtensions = await container.resolve(GetProjectConfig).execute({
74
- tags: {
75
- runtimeContext: "project"
76
- }
77
- });
78
- await container.resolve(ValidateProjectConfig).execute(projectExtensions);
79
- await container.resolve(InitProjectSdkService).execute(container);
78
+ const projectConfigGetter = container.resolve(GetProjectConfig);
79
+ const getProjectExtensions = ()=>projectConfigGetter.execute({
80
+ tags: {
81
+ runtimeContext: "project"
82
+ }
83
+ });
84
+ const initialProjectExtensions = await traceAsync("read project ID and env vars", ()=>getProjectExtensions());
85
+ applyEnvVars(initialProjectExtensions);
86
+ await traceAsync("apply WCP env vars", ()=>applyWcpEnvVars(container));
87
+ const projectExtensions = await traceAsync("get project extensions", ()=>getProjectExtensions());
88
+ applyEnvVars(projectExtensions);
89
+ const projectConfigValidator = container.resolve(ValidateProjectConfig);
90
+ await traceAsync("validate project extensions", ()=>projectConfigValidator.execute(projectExtensions));
91
+ const initProjectSdk = container.resolve(InitProjectSdkService);
92
+ await traceAsync("register project SDK extensions", ()=>initProjectSdk.execute(container));
80
93
  return container;
81
94
  };
82
95
  export { createProjectSdkContainer };
@@ -1 +1 @@
1
- {"version":3,"file":"createProjectSdkContainer.js","sources":["../src/createProjectSdkContainer.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport {\n beforeBuild,\n afterBuild,\n beforeWatch,\n adminAfterBuild,\n adminBeforeBuild,\n adminBeforeWatch,\n apiAfterBuild,\n apiBeforeBuild,\n apiBeforeWatch,\n coreAfterBuild,\n coreBeforeBuild,\n coreBeforeWatch,\n buildApp,\n getApp,\n getLogger,\n getProductionEnvironments,\n getProject,\n getProjectConfig,\n getProjectInfo,\n getFeatureFlags,\n installExtension,\n isCi,\n isTelemetryEnabled,\n isWcpEnabled,\n isWebinyJsRepo,\n validateProjectConfig,\n watch,\n serve\n} from \"./features/index.js\";\n\nimport {\n getAppService,\n buildAppWorkspaceService,\n buildProjectWorkspaceService,\n getAppPackagesService,\n getCwdService,\n getIsCiService,\n getNpmVersionService,\n getNpxVersionService,\n getProjectConfigService,\n getProjectIdService,\n getProjectInstallationIdService,\n getProjectService,\n getProjectVersionService,\n getPulumiVersionService,\n getYarnVersionService,\n initProjectSdkService,\n installExtensionService,\n listPackagesInAppWorkspaceService,\n listPackagesService,\n loadEnvVarsService,\n localStorageService,\n loggerService,\n projectInfoService,\n projectSdkParamsService,\n setProjectIdService,\n stackOutputCacheService,\n stdioService,\n uiService,\n validateProjectConfigService,\n wcpService\n} from \"./services/index.js\";\n\nimport {\n GetProjectConfig,\n BuildProjectWorkspaceService,\n ProjectSdkParamsService,\n LoadEnvVarsService,\n ValidateProjectConfig,\n LoggerService,\n InitProjectSdkService\n} from \"~/abstractions/index.js\";\nimport { getFeatureFlagsWithLicense } from \"./decorators/index.js\";\n\nexport const createProjectSdkContainer = async (\n params: Partial<ProjectSdkParamsService.Params>,\n register?: (container: Container) => void\n) => {\n const container = new Container();\n\n // Services.\n container.register(getAppService).inSingletonScope();\n container.register(buildAppWorkspaceService).inSingletonScope();\n container.register(buildProjectWorkspaceService).inSingletonScope();\n container.register(getAppPackagesService).inSingletonScope();\n container.register(getCwdService).inSingletonScope();\n container.register(getIsCiService).inSingletonScope();\n container.register(getNpmVersionService).inSingletonScope();\n container.register(getNpxVersionService).inSingletonScope();\n container.register(getProjectConfigService).inSingletonScope();\n container.register(getProjectIdService).inSingletonScope();\n container.register(getProjectInstallationIdService).inSingletonScope();\n container.register(getProjectService).inSingletonScope();\n container.register(getProjectVersionService).inSingletonScope();\n container.register(getPulumiVersionService).inSingletonScope();\n container.register(getYarnVersionService).inSingletonScope();\n container.register(initProjectSdkService).inSingletonScope();\n container.register(installExtensionService).inSingletonScope();\n container.register(listPackagesInAppWorkspaceService).inSingletonScope();\n container.register(listPackagesService).inSingletonScope();\n container.register(loadEnvVarsService).inSingletonScope();\n container.register(localStorageService).inSingletonScope();\n container.register(loggerService).inSingletonScope();\n container.register(projectInfoService).inSingletonScope();\n container.register(projectSdkParamsService).inSingletonScope();\n container.register(setProjectIdService).inSingletonScope();\n container.register(stackOutputCacheService).inSingletonScope();\n container.register(stdioService).inSingletonScope();\n container.register(uiService).inSingletonScope();\n container.register(validateProjectConfigService).inSingletonScope();\n container.register(wcpService).inSingletonScope();\n\n // Features.\n container.register(buildApp).inSingletonScope();\n container.register(getApp).inSingletonScope();\n container.register(getLogger).inSingletonScope();\n container.register(getProductionEnvironments).inSingletonScope();\n container.register(getProject).inSingletonScope();\n container.register(getProjectConfig).inSingletonScope();\n container.register(getProjectInfo).inSingletonScope();\n container.register(installExtension).inSingletonScope();\n container.register(isCi).inSingletonScope();\n container.register(isTelemetryEnabled).inSingletonScope();\n container.register(isWcpEnabled).inSingletonScope();\n container.register(isWebinyJsRepo).inSingletonScope();\n container.register(getFeatureFlags).inSingletonScope();\n container.register(validateProjectConfig).inSingletonScope();\n container.register(watch).inSingletonScope();\n container.register(serve).inSingletonScope();\n container.registerDecorator(getFeatureFlagsWithLicense);\n\n // Hooks (cloud-agnostic: build + watch).\n container.registerComposite(beforeBuild);\n container.registerComposite(afterBuild);\n container.registerComposite(beforeWatch);\n container.registerComposite(apiBeforeBuild);\n container.registerComposite(apiBeforeWatch);\n container.registerComposite(apiAfterBuild);\n container.registerComposite(adminBeforeBuild);\n container.registerComposite(adminBeforeWatch);\n container.registerComposite(adminAfterBuild);\n container.registerComposite(coreBeforeBuild);\n container.registerComposite(coreAfterBuild);\n container.registerComposite(coreBeforeWatch);\n\n // Initialize project SDK.\n container.resolve(ProjectSdkParamsService).set(params);\n\n // Allow hosting-specific registrations (e.g. project-aws, project-server).\n // Must run before workspace services execute so decorators are in place.\n register?.(container);\n\n await container.resolve(LoadEnvVarsService).execute();\n await container.resolve(BuildProjectWorkspaceService).execute();\n\n const logger = container.resolve(LoggerService);\n logger.log(\"Initializing Project SDK container...\");\n\n const projectExtensions = await container.resolve(GetProjectConfig).execute({\n tags: { runtimeContext: \"project\" }\n });\n\n await container.resolve(ValidateProjectConfig).execute(projectExtensions);\n\n // Initialize project SDK extensions (env vars, hooks, pulumi, implementations, decorators).\n await container.resolve(InitProjectSdkService).execute(container);\n\n return container;\n};\n"],"names":["createProjectSdkContainer","params","register","container","Container","getAppService","buildAppWorkspaceService","buildProjectWorkspaceService","getAppPackagesService","getCwdService","getIsCiService","getNpmVersionService","getNpxVersionService","getProjectConfigService","getProjectIdService","getProjectInstallationIdService","getProjectService","getProjectVersionService","getPulumiVersionService","getYarnVersionService","initProjectSdkService","installExtensionService","listPackagesInAppWorkspaceService","listPackagesService","loadEnvVarsService","localStorageService","loggerService","projectInfoService","projectSdkParamsService","setProjectIdService","stackOutputCacheService","stdioService","uiService","validateProjectConfigService","wcpService","buildApp","getApp","getLogger","getProductionEnvironments","getProject","getProjectConfig","getProjectInfo","installExtension","isCi","isTelemetryEnabled","isWcpEnabled","isWebinyJsRepo","getFeatureFlags","validateProjectConfig","watch","serve","getFeatureFlagsWithLicense","beforeBuild","afterBuild","beforeWatch","apiBeforeBuild","apiBeforeWatch","apiAfterBuild","adminBeforeBuild","adminBeforeWatch","adminAfterBuild","coreBeforeBuild","coreAfterBuild","coreBeforeWatch","ProjectSdkParamsService","LoadEnvVarsService","BuildProjectWorkspaceService","logger","LoggerService","projectExtensions","GetProjectConfig","ValidateProjectConfig","InitProjectSdkService"],"mappings":";;;;;AA4EO,MAAMA,4BAA4B,OACrCC,QACAC;IAEA,MAAMC,YAAY,IAAIC;IAGtBD,UAAU,QAAQ,CAACE,eAAe,gBAAgB;IAClDF,UAAU,QAAQ,CAACG,0BAA0B,gBAAgB;IAC7DH,UAAU,QAAQ,CAACI,8BAA8B,gBAAgB;IACjEJ,UAAU,QAAQ,CAACK,uBAAuB,gBAAgB;IAC1DL,UAAU,QAAQ,CAACM,eAAe,gBAAgB;IAClDN,UAAU,QAAQ,CAACO,gBAAgB,gBAAgB;IACnDP,UAAU,QAAQ,CAACQ,sBAAsB,gBAAgB;IACzDR,UAAU,QAAQ,CAACS,sBAAsB,gBAAgB;IACzDT,UAAU,QAAQ,CAACU,yBAAyB,gBAAgB;IAC5DV,UAAU,QAAQ,CAACW,qBAAqB,gBAAgB;IACxDX,UAAU,QAAQ,CAACY,iCAAiC,gBAAgB;IACpEZ,UAAU,QAAQ,CAACa,mBAAmB,gBAAgB;IACtDb,UAAU,QAAQ,CAACc,0BAA0B,gBAAgB;IAC7Dd,UAAU,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U,QAAQ,CAAC0C,cAAc,gBAAgB;IACjD1C,UAAU,QAAQ,CAAC2C,gBAAgB,gBAAgB;IACnD3C,UAAU,QAAQ,CAAC4C,iBAAiB,gBAAgB;IACpD5C,UAAU,QAAQ,CAAC6C,uBAAuB,gBAAgB;IAC1D7C,UAAU,QAAQ,CAAC8C,OAAO,gBAAgB;IAC1C9C,UAAU,QAAQ,CAAC+C,OAAO,gBAAgB;IAC1C/C,UAAU,iBAAiB,CAACgD;IAG5BhD,UAAU,iBAAiB,CAACiD;IAC5BjD,UAAU,iBAAiB,CAACkD;IAC5BlD,UAAU,iBAAiB,CAACmD;IAC5BnD,UAAU,iBAAiB,CAACoD;IAC5BpD,UAAU,iBAAiB,CAACqD;IAC5BrD,UAAU,iBAAiB,CAACsD;IAC5BtD,UAAU,iBAAiB,CAACuD;IAC5BvD,UAAU,iBAAiB,CAACwD;IAC5BxD,UAAU,iBAAiB,CAACyD;IAC5BzD,UAAU,iBAAiB,CAAC0D;IAC5B1D,UAAU,iBAAiB,CAAC2D;IAC5B3D,UAAU,iBAAiB,CAAC4D;IAG5B5D,UAAU,OAAO,CAAC6D,yBAAyB,GAAG,CAAC/D;IAI/CC,WAAWC;IAEX,MAAMA,UAAU,OAAO,CAAC8D,oBAAoB,OAAO;IACnD,MAAM9D,UAAU,OAAO,CAAC+D,8BAA8B,OAAO;IAE7D,MAAMC,SAAShE,UAAU,OAAO,CAACiE;IACjCD,OAAO,GAAG,CAAC;IAEX,MAAME,oBAAoB,MAAMlE,UAAU,OAAO,CAACmE,kBAAkB,OAAO,CAAC;QACxE,MAAM;YAAE,gBAAgB;QAAU;IACtC;IAEA,MAAMnE,UAAU,OAAO,CAACoE,uBAAuB,OAAO,CAACF;IAGvD,MAAMlE,UAAU,OAAO,CAACqE,uBAAuB,OAAO,CAACrE;IAEvD,OAAOA;AACX"}
1
+ {"version":3,"file":"createProjectSdkContainer.js","sources":["../src/createProjectSdkContainer.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport {\n beforeBuild,\n afterBuild,\n beforeWatch,\n adminAfterBuild,\n adminBeforeBuild,\n adminBeforeWatch,\n apiAfterBuild,\n apiBeforeBuild,\n apiBeforeWatch,\n coreAfterBuild,\n coreBeforeBuild,\n coreBeforeWatch,\n buildApp,\n getApp,\n getLogger,\n getProductionEnvironments,\n getProject,\n getProjectConfig,\n getProjectInfo,\n getFeatureFlags,\n installExtension,\n isCi,\n isTelemetryEnabled,\n isWcpEnabled,\n isWebinyJsRepo,\n validateProjectConfig,\n watch,\n serve\n} from \"./features/index.js\";\n\nimport {\n getAppService,\n buildAppWorkspaceService,\n buildProjectWorkspaceService,\n getAppPackagesService,\n getCwdService,\n getIsCiService,\n getNpmVersionService,\n getNpxVersionService,\n getProjectConfigService,\n getProjectIdService,\n getProjectInstallationIdService,\n getProjectService,\n getProjectVersionService,\n getPulumiVersionService,\n getYarnVersionService,\n initProjectSdkService,\n installExtensionService,\n listPackagesInAppWorkspaceService,\n listPackagesService,\n loadEnvVarsService,\n localStorageService,\n loggerService,\n projectInfoService,\n projectSdkParamsService,\n setProjectIdService,\n stackOutputCacheService,\n stdioService,\n uiService,\n validateProjectConfigService,\n wcpService\n} from \"./services/index.js\";\n\nimport {\n GetProjectConfig,\n BuildProjectWorkspaceService,\n ProjectSdkParamsService,\n LoadEnvVarsService,\n ValidateProjectConfig,\n LoggerService,\n InitProjectSdkService\n} from \"~/abstractions/index.js\";\nimport { getFeatureFlagsWithLicense } from \"./decorators/index.js\";\nimport { traceAsync } from \"./utils/trace/index.js\";\nimport { applyEnvVars } from \"./services/InitProjectSdkService/applyEnvVars.js\";\nimport { applyWcpEnvVars } from \"./services/InitProjectSdkService/applyWcpEnvVars.js\";\n\nexport const createProjectSdkContainer = async (\n params: Partial<ProjectSdkParamsService.Params>,\n register?: (container: Container) => void\n) => {\n const container = new Container();\n\n // Services.\n container.register(getAppService).inSingletonScope();\n container.register(buildAppWorkspaceService).inSingletonScope();\n container.register(buildProjectWorkspaceService).inSingletonScope();\n container.register(getAppPackagesService).inSingletonScope();\n container.register(getCwdService).inSingletonScope();\n container.register(getIsCiService).inSingletonScope();\n container.register(getNpmVersionService).inSingletonScope();\n container.register(getNpxVersionService).inSingletonScope();\n container.register(getProjectConfigService).inSingletonScope();\n container.register(getProjectIdService).inSingletonScope();\n container.register(getProjectInstallationIdService).inSingletonScope();\n container.register(getProjectService).inSingletonScope();\n container.register(getProjectVersionService).inSingletonScope();\n container.register(getPulumiVersionService).inSingletonScope();\n container.register(getYarnVersionService).inSingletonScope();\n container.register(initProjectSdkService).inSingletonScope();\n container.register(installExtensionService).inSingletonScope();\n container.register(listPackagesInAppWorkspaceService).inSingletonScope();\n container.register(listPackagesService).inSingletonScope();\n container.register(loadEnvVarsService).inSingletonScope();\n container.register(localStorageService).inSingletonScope();\n container.register(loggerService).inSingletonScope();\n container.register(projectInfoService).inSingletonScope();\n container.register(projectSdkParamsService).inSingletonScope();\n container.register(setProjectIdService).inSingletonScope();\n container.register(stackOutputCacheService).inSingletonScope();\n container.register(stdioService).inSingletonScope();\n container.register(uiService).inSingletonScope();\n container.register(validateProjectConfigService).inSingletonScope();\n container.register(wcpService).inSingletonScope();\n\n // Features.\n container.register(buildApp).inSingletonScope();\n container.register(getApp).inSingletonScope();\n container.register(getLogger).inSingletonScope();\n container.register(getProductionEnvironments).inSingletonScope();\n container.register(getProject).inSingletonScope();\n container.register(getProjectConfig).inSingletonScope();\n container.register(getProjectInfo).inSingletonScope();\n container.register(installExtension).inSingletonScope();\n container.register(isCi).inSingletonScope();\n container.register(isTelemetryEnabled).inSingletonScope();\n container.register(isWcpEnabled).inSingletonScope();\n container.register(isWebinyJsRepo).inSingletonScope();\n container.register(getFeatureFlags).inSingletonScope();\n container.register(validateProjectConfig).inSingletonScope();\n container.register(watch).inSingletonScope();\n container.register(serve).inSingletonScope();\n container.registerDecorator(getFeatureFlagsWithLicense);\n\n // Hooks (cloud-agnostic: build + watch).\n container.registerComposite(beforeBuild);\n container.registerComposite(afterBuild);\n container.registerComposite(beforeWatch);\n container.registerComposite(apiBeforeBuild);\n container.registerComposite(apiBeforeWatch);\n container.registerComposite(apiAfterBuild);\n container.registerComposite(adminBeforeBuild);\n container.registerComposite(adminBeforeWatch);\n container.registerComposite(adminAfterBuild);\n container.registerComposite(coreBeforeBuild);\n container.registerComposite(coreAfterBuild);\n container.registerComposite(coreBeforeWatch);\n\n // Initialize project SDK.\n container.resolve(ProjectSdkParamsService).set(params);\n\n // Allow hosting-specific registrations (e.g. project-aws, project-standalone).\n // Must run before workspace services execute so decorators are in place.\n register?.(container);\n\n const loadEnvVars = container.resolve(LoadEnvVarsService);\n await traceAsync(\"load env vars\", () => loadEnvVars.execute());\n\n const buildProjectWorkspace = container.resolve(BuildProjectWorkspaceService);\n await traceAsync(\"build project workspace\", () => buildProjectWorkspace.execute());\n\n const logger = container.resolve(LoggerService);\n logger.log(\"Initializing Project SDK container...\");\n\n const projectConfigGetter = container.resolve(GetProjectConfig);\n const getProjectExtensions = () => {\n return projectConfigGetter.execute({\n tags: { runtimeContext: \"project\" }\n });\n };\n\n /*\n * The WCP license is an input to the config render: license-gated feature flags decide which\n * extensions the config contains. Fetching the license needs the WCP project ID, though, and\n * unless `WEBINY_PROJECT_ID` is set, the ID comes from the config as well. So the config is read\n * once to learn the project ID and the env vars it sets (a project can supply its WCP API key\n * that way), the WCP env vars and license are fetched, and only then is the config read that\n * every later step uses.\n *\n * The render cache is keyed on the license, so that second read renders again when a license\n * arrived, and is a plain cache hit for a project that isn't linked to WCP.\n */\n const initialProjectExtensions = await traceAsync(\"read project ID and env vars\", () => {\n return getProjectExtensions();\n });\n applyEnvVars(initialProjectExtensions);\n\n await traceAsync(\"apply WCP env vars\", () => applyWcpEnvVars(container));\n\n const projectExtensions = await traceAsync(\"get project extensions\", () => {\n return getProjectExtensions();\n });\n\n // The licensed render can contain extensions the first one didn't, env vars among them.\n // `applyEnvVars` never overwrites a variable that's already set, so running it again is safe.\n applyEnvVars(projectExtensions);\n\n const projectConfigValidator = container.resolve(ValidateProjectConfig);\n await traceAsync(\"validate project extensions\", () => {\n return projectConfigValidator.execute(projectExtensions);\n });\n\n // Initialize project SDK extensions (env vars, hooks, pulumi, implementations, decorators).\n const initProjectSdk = container.resolve(InitProjectSdkService);\n await traceAsync(\"register project SDK extensions\", () => initProjectSdk.execute(container));\n\n return container;\n};\n"],"names":["createProjectSdkContainer","params","register","container","Container","getAppService","buildAppWorkspaceService","buildProjectWorkspaceService","getAppPackagesService","getCwdService","getIsCiService","getNpmVersionService","getNpxVersionService","getProjectConfigService","getProjectIdService","getProjectInstallationIdService","getProjectService","getProjectVersionService","getPulumiVersionService","getYarnVersionService","initProjectSdkService","installExtensionService","listPackagesInAppWorkspaceService","listPackagesService","loadEnvVarsService","localStorageService","loggerService","projectInfoService","projectSdkParamsService","setProjectIdService","stackOutputCacheService","stdioService","uiService","validateProjectConfigService","wcpService","buildApp","getApp","getLogger","getProductionEnvironments","getProject","getProjectConfig","getProjectInfo","installExtension","isCi","isTelemetryEnabled","isWcpEnabled","isWebinyJsRepo","getFeatureFlags","validateProjectConfig","watch","serve","getFeatureFlagsWithLicense","beforeBuild","afterBuild","beforeWatch","apiBeforeBuild","apiBeforeWatch","apiAfterBuild","adminBeforeBuild","adminBeforeWatch","adminAfterBuild","coreBeforeBuild","coreAfterBuild","coreBeforeWatch","ProjectSdkParamsService","loadEnvVars","LoadEnvVarsService","traceAsync","buildProjectWorkspace","BuildProjectWorkspaceService","logger","LoggerService","projectConfigGetter","GetProjectConfig","getProjectExtensions","initialProjectExtensions","applyEnvVars","applyWcpEnvVars","projectExtensions","projectConfigValidator","ValidateProjectConfig","initProjectSdk","InitProjectSdkService"],"mappings":";;;;;;;;AA+EO,MAAMA,4BAA4B,OACrCC,QACAC;IAEA,MAAMC,YAAY,IAAIC;IAGtBD,UAAU,QAAQ,CAACE,eAAe,gBAAgB;IAClDF,UAAU,QAAQ,CAACG,0BAA0B,gBAAgB;IAC7DH,UAAU,QAAQ,C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cAAc9D,UAAU,OAAO,CAAC+D;IACtC,MAAMC,WAAW,iBAAiB,IAAMF,YAAY,OAAO;IAE3D,MAAMG,wBAAwBjE,UAAU,OAAO,CAACkE;IAChD,MAAMF,WAAW,2BAA2B,IAAMC,sBAAsB,OAAO;IAE/E,MAAME,SAASnE,UAAU,OAAO,CAACoE;IACjCD,OAAO,GAAG,CAAC;IAEX,MAAME,sBAAsBrE,UAAU,OAAO,CAACsE;IAC9C,MAAMC,uBAAuB,IAClBF,oBAAoB,OAAO,CAAC;YAC/B,MAAM;gBAAE,gBAAgB;YAAU;QACtC;IAcJ,MAAMG,2BAA2B,MAAMR,WAAW,gCAAgC,IACvEO;IAEXE,aAAaD;IAEb,MAAMR,WAAW,sBAAsB,IAAMU,gBAAgB1E;IAE7D,MAAM2E,oBAAoB,MAAMX,WAAW,0BAA0B,IAC1DO;IAKXE,aAAaE;IAEb,MAAMC,yBAAyB5E,UAAU,OAAO,CAAC6E;IACjD,MAAMb,WAAW,+BAA+B,IACrCY,uBAAuB,OAAO,CAACD;IAI1C,MAAMG,iBAAiB9E,UAAU,OAAO,CAAC+E;IACzC,MAAMf,WAAW,mCAAmC,IAAMc,eAAe,OAAO,CAAC9E;IAEjF,OAAOA;AACX"}
@@ -4,6 +4,7 @@ import { z } from "zod";
4
4
  import path from "path";
5
5
  import { Node, Project } from "ts-morph";
6
6
  import crypto_0 from "crypto";
7
+ import { hasDefaultExport } from "./hasDefaultExport.js";
7
8
  const AdminExtension = defineExtension({
8
9
  type: "Admin/Extension",
9
10
  tags: {
@@ -35,14 +36,13 @@ const AdminExtension = defineExtension({
35
36
  const extensionProject = new Project();
36
37
  extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);
37
38
  const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);
38
- const hasDefaultExport = void 0 !== extensionSource.getDefaultExportSymbol();
39
39
  let index = 1;
40
40
  const importDeclarations = source.getImportDeclarations();
41
41
  if (importDeclarations.length) {
42
42
  const last = importDeclarations[importDeclarations.length - 1];
43
43
  index = last.getChildIndex() + 1;
44
44
  }
45
- if (hasDefaultExport) source.insertImportDeclaration(index, {
45
+ if (hasDefaultExport(extensionSource)) source.insertImportDeclaration(index, {
46
46
  defaultImport: componentName,
47
47
  moduleSpecifier: importPath
48
48
  });
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/AdminExtension.js","sources":["../../src/extensions/AdminExtension.ts"],"sourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"~/index.js\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { type JsxFragment, Node, Project } from \"ts-morph\";\nimport crypto from \"crypto\";\n\nexport const AdminExtension = defineExtension({\n type: \"Admin/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"admin\" },\n description: \"Extend the Admin application with custom functionality.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsxFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"admin\", \"src\", \"Extensions.tsx\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name can be customized or defaults to the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Generate a constant hash-based component name to avoid using timestamps.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const componentName = `AdminExtension_${hash.slice(-10)}`;\n\n const project = new Project();\n\n const importPath = path\n .relative(path.dirname(extensionsTsxFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n project.addSourceFileAtPath(extensionsTsxFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsxFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n // Check if the extension file has a default export or named export.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n const hasDefaultExport = extensionSource.getDefaultExportSymbol() !== undefined;\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Import as default export if available, otherwise import named export.\n if (hasDefaultExport) {\n source.insertImportDeclaration(index, {\n defaultImport: componentName,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: componentName }],\n moduleSpecifier: importPath\n });\n }\n\n const extensionsIdentifier = source.getFirstDescendant(node => {\n if (!Node.isIdentifier(node)) {\n return false;\n }\n\n return node.getText() === \"Extensions\";\n });\n\n if (!extensionsIdentifier) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\". Did you maybe change the name of the component?`\n );\n }\n\n const extensionsArrowFn = extensionsIdentifier.getNextSibling(node =>\n Node.isArrowFunction(node)\n );\n if (!extensionsArrowFn) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\". Did you maybe change its definition? It should be an arrow function.`\n );\n }\n\n const extensionsArrowFnFragment = extensionsArrowFn.getFirstDescendant(node => {\n return Node.isJsxFragment(node);\n }) as JsxFragment;\n\n const extensionsArrowFnFragmentChildrenText = extensionsArrowFnFragment\n .getFullText()\n .replace(\"<>\", \"\")\n .replace(\"</>\", \"\")\n .trim();\n\n extensionsArrowFnFragment.replaceWithText(\n `<><${componentName}/>${extensionsArrowFnFragmentChildrenText}</>`\n );\n\n await source.save();\n }\n});\n"],"names":["AdminExtension","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsxFilePath","extensionFilePath","absoluteExtensionFilePath","ExtensionSrcResolver","extensionFileName","path","exportName","hash","crypto","componentName","Project","importPath","source","existingImportDeclaration","extensionProject","extensionSource","hasDefaultExport","undefined","index","importDeclarations","last","extensionsIdentifier","node","Node","Error","extensionsArrowFn","extensionsArrowFnFragment","extensionsArrowFnFragmentChildrenText"],"mappings":";;;;;;AAOO,MAAMA,iBAAiBC,gBAAgB;IAC1C,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAQ;IACtD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,KAAKC,WAAW;gBAAEF;YAAQ;YAC1B,YAAYC,EAAE,MAAM,GAAG,QAAQ;QACnC;IAEJ,MAAM,OAAME,MAAM,EAAEC,GAAG;QACnB,MAAMC,wBAAwBD,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAC1D,IAAI,CAAC,QAAQ,SAAS,OAAO,kBAC7B,QAAQ;QAEb,MAAM,EAAE,KAAKE,iBAAiB,EAAE,GAAGH;QAGnC,MAAMI,4BAA4BC,qBAAqB,WAAW,CAC9DF,mBACAF,IAAI,OAAO;QAGf,MAAMK,oBAAoBC,KAAK,QAAQ,CAACH;QAGxC,MAAMI,aAAaR,OAAO,UAAU,IAAIO,KAAK,KAAK,CAACD,mBAAmB,IAAI;QAG1E,MAAMG,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACP,mBAAmB,MAAM,CAAC;QAC1E,MAAMQ,gBAAgB,CAAC,eAAe,EAAEF,KAAK,KAAK,CAAC,MAAM;QAEzD,MAAMZ,UAAU,IAAIe;QAEpB,MAAMC,aAAaN,KAAAA,QACN,CAACA,KAAK,OAAO,CAACL,wBAAwBE,2BAC9C,OAAO,CAAC,WAAW;QAExBP,QAAQ,mBAAmB,CAACK;QAE5B,MAAMY,SAASjB,QAAQ,oBAAoB,CAACK;QAE5C,MAAMa,4BAA4BD,OAAO,oBAAoB,CAACD;QAC9D,IAAIE,2BACA;QAIJ,MAA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Mf,OAAO,IAAI;IACrB;AACJ"}
1
+ {"version":3,"file":"extensions/AdminExtension.js","sources":["../../src/extensions/AdminExtension.ts"],"sourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"~/index.js\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { type JsxFragment, Node, Project } from \"ts-morph\";\nimport crypto from \"crypto\";\nimport { hasDefaultExport } from \"./hasDefaultExport.js\";\n\nexport const AdminExtension = defineExtension({\n type: \"Admin/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"admin\" },\n description: \"Extend the Admin application with custom functionality.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsxFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"admin\", \"src\", \"Extensions.tsx\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name can be customized or defaults to the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Generate a constant hash-based component name to avoid using timestamps.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const componentName = `AdminExtension_${hash.slice(-10)}`;\n\n const project = new Project();\n\n const importPath = path\n .relative(path.dirname(extensionsTsxFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n project.addSourceFileAtPath(extensionsTsxFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsxFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n // Check if the extension file has a default export or named export.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Import as default export if available, otherwise import named export.\n if (hasDefaultExport(extensionSource)) {\n source.insertImportDeclaration(index, {\n defaultImport: componentName,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: componentName }],\n moduleSpecifier: importPath\n });\n }\n\n const extensionsIdentifier = source.getFirstDescendant(node => {\n if (!Node.isIdentifier(node)) {\n return false;\n }\n\n return node.getText() === \"Extensions\";\n });\n\n if (!extensionsIdentifier) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\". Did you maybe change the name of the component?`\n );\n }\n\n const extensionsArrowFn = extensionsIdentifier.getNextSibling(node =>\n Node.isArrowFunction(node)\n );\n if (!extensionsArrowFn) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\". Did you maybe change its definition? It should be an arrow function.`\n );\n }\n\n const extensionsArrowFnFragment = extensionsArrowFn.getFirstDescendant(node => {\n return Node.isJsxFragment(node);\n }) as JsxFragment;\n\n const extensionsArrowFnFragmentChildrenText = extensionsArrowFnFragment\n .getFullText()\n .replace(\"<>\", \"\")\n .replace(\"</>\", \"\")\n .trim();\n\n extensionsArrowFnFragment.replaceWithText(\n `<><${componentName}/>${extensionsArrowFnFragmentChildrenText}</>`\n );\n\n await source.save();\n }\n});\n"],"names":["AdminExtension","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsxFilePath","extensionFilePath","absoluteExtensionFilePath","ExtensionSrcResolver","extensionFileName","path","exportName","hash","crypto","componentName","Project","importPath","source","existingImportDeclaration","extensionProject","extensionSource","index","importDeclarations","last","hasDefaultExport","extensionsIdentifier","node","Node","Error","extensionsArrowFn","extensionsArrowFnFragment","extensionsArrowFnFragmentChildrenText"],"mappings":";;;;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AmB,MAAM,EAAE;YAC3B,MAAMC,OAAOD,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE;YAC9DD,QAAQE,KAAK,aAAa,KAAK;QACnC;QAGA,IAAIC,iBAAiBJ,kBACjBH,OAAO,uBAAuB,CAACI,OAAO;YAClC,eAAeP;YACf,iBAAiBE;QACrB;aAEAC,OAAO,uBAAuB,CAACI,OAAO;YAClC,cAAc;gBAAC;oBAAE,MAAMV;oBAAY,OAAOG;gBAAc;aAAE;YAC1D,iBAAiBE;QACrB;QAGJ,MAAMS,uBAAuBR,OAAO,kBAAkB,CAACS,CAAAA;YACnD,IAAI,CAACC,KAAK,YAAY,CAACD,OACnB,OAAO;YAGX,OAAOA,AAAmB,iBAAnBA,KAAK,OAAO;QACvB;QAEA,IAAI,CAACD,sBACD,MAAM,IAAIG,MACN,CAAC,oDAAoD,EAAEvB,sBAAsB,kDAAkD,CAAC;QAIxI,MAAMwB,oBAAoBJ,qBAAqB,cAAc,CAACC,CAAAA,OAC1DC,KAAK,eAAe,CAACD;QAEzB,IAAI,CAACG,mBACD,MAAM,IAAID,MACN,CAAC,oDAAoD,EAAEvB,sBAAsB,uEAAuE,CAAC;QAI7J,MAAMyB,4BAA4BD,kBAAkB,kBAAkB,CAACH,CAAAA,OAC5DC,KAAK,aAAa,CAACD;QAG9B,MAAMK,wCAAwCD,0BACzC,WAAW,GACX,OAAO,CAAC,MAAM,IACd,OAAO,CAAC,OAAO,IACf,IAAI;QAETA,0BAA0B,eAAe,CACrC,CAAC,GAAG,EAAEhB,cAAc,EAAE,EAAEiB,sCAAsC,GAAG,CAAC;QAGtE,MAAMd,OAAO,IAAI;IACrB;AACJ"}
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  /**
3
3
  * Sets a dedicated WebSocket URL for the Admin app, baked into the admin bundle as
4
4
  * `WEBINY_ADMIN_WS_API_URL`. This is optional: when omitted, the admin derives the WebSocket URL
5
- * from the API URL (same origin, http -> ws), which is what the self-hosted server hosting type needs by
5
+ * from the API URL (same origin, http -> ws), which is what the standalone hosting type needs by
6
6
  * default. Set it only when WebSockets are served from a different origin than the API. Because the
7
7
  * config is evaluated at build time, the value can come from any env var the user chooses, e.g.
8
8
  * `<Admin.WebsocketsUrl url={process.env.MY_WS_URL} />`.
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/AdminWebsocketsUrl.js","sources":["../../src/extensions/AdminWebsocketsUrl.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport { EnvVar } from \"./EnvVar.js\";\n\n/**\n * Sets a dedicated WebSocket URL for the Admin app, baked into the admin bundle as\n * `WEBINY_ADMIN_WS_API_URL`. This is optional: when omitted, the admin derives the WebSocket URL\n * from the API URL (same origin, http -> ws), which is what the self-hosted server hosting type needs by\n * default. Set it only when WebSockets are served from a different origin than the API. Because the\n * config is evaluated at build time, the value can come from any env var the user chooses, e.g.\n * `<Admin.WebsocketsUrl url={process.env.MY_WS_URL} />`.\n */\nexport const AdminWebsocketsUrl = defineExtension({\n type: \"Admin/WebsocketsUrl\",\n tags: { runtimeContext: \"project\" },\n description: \"Set a dedicated WebSocket URL for the Admin app.\",\n paramsSchema: z.object({\n url: z\n .string()\n .describe(\"The WebSocket origin, e.g. wss://ws.example.com or ws://localhost:3002\")\n }),\n render: props => {\n return <EnvVar varName=\"WEBINY_ADMIN_WS_API_URL\" value={props.url} />;\n }\n});\n"],"names":["AdminWebsocketsUrl","defineExtension","z","props","EnvVar"],"mappings":";;;;AAaO,MAAMA,qBAAqBC,gBAAgB;IAC9C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,KAAKA,EAAAA,MACM,GACN,QAAQ,CAAC;IAClB;IACA,QAAQC,CAAAA,QACG,WAAP,GAAO,oBAACC,QAAMA;YAAC,SAAQ;YAA0B,OAAOD,MAAM,GAAG;;AAEzE"}
1
+ {"version":3,"file":"extensions/AdminWebsocketsUrl.js","sources":["../../src/extensions/AdminWebsocketsUrl.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport { EnvVar } from \"./EnvVar.js\";\n\n/**\n * Sets a dedicated WebSocket URL for the Admin app, baked into the admin bundle as\n * `WEBINY_ADMIN_WS_API_URL`. This is optional: when omitted, the admin derives the WebSocket URL\n * from the API URL (same origin, http -> ws), which is what the standalone hosting type needs by\n * default. Set it only when WebSockets are served from a different origin than the API. Because the\n * config is evaluated at build time, the value can come from any env var the user chooses, e.g.\n * `<Admin.WebsocketsUrl url={process.env.MY_WS_URL} />`.\n */\nexport const AdminWebsocketsUrl = defineExtension({\n type: \"Admin/WebsocketsUrl\",\n tags: { runtimeContext: \"project\" },\n description: \"Set a dedicated WebSocket URL for the Admin app.\",\n paramsSchema: z.object({\n url: z\n .string()\n .describe(\"The WebSocket origin, e.g. wss://ws.example.com or ws://localhost:3002\")\n }),\n render: props => {\n return <EnvVar varName=\"WEBINY_ADMIN_WS_API_URL\" value={props.url} />;\n }\n});\n"],"names":["AdminWebsocketsUrl","defineExtension","z","props","EnvVar"],"mappings":";;;;AAaO,MAAMA,qBAAqBC,gBAAgB;IAC9C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,KAAKA,EAAAA,MACM,GACN,QAAQ,CAAC;IAClB;IACA,QAAQC,CAAAA,QACG,WAAP,GAAO,oBAACC,QAAMA;YAAC,SAAQ;YAA0B,OAAOD,MAAM,GAAG;;AAEzE"}
@@ -4,6 +4,7 @@ import { z } from "zod";
4
4
  import path from "path";
5
5
  import { Node, Project } from "ts-morph";
6
6
  import crypto_0 from "crypto";
7
+ import { hasDefaultExport } from "./hasDefaultExport.js";
7
8
  const ApiExtension = defineExtension({
8
9
  type: "Api/Extension",
9
10
  tags: {
@@ -41,8 +42,7 @@ const ApiExtension = defineExtension({
41
42
  const extensionProject = new Project();
42
43
  extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);
43
44
  const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);
44
- const hasDefaultExport = void 0 !== extensionSource.getDefaultExportSymbol();
45
- if (hasDefaultExport) source.insertImportDeclaration(index, {
45
+ if (hasDefaultExport(extensionSource)) source.insertImportDeclaration(index, {
46
46
  defaultImport: exportNameAlias,
47
47
  moduleSpecifier: importPath
48
48
  });
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/ApiExtension.js","sources":["../../src/extensions/ApiExtension.ts"],"sourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"~/index.js\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport crypto from \"crypto\";\n\nexport const ApiExtension = defineExtension({\n type: \"Api/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add any API extension.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name is always the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Alias name is \"ApiExtension_\" + hash of the file path. This way we\n // avoid potential naming conflicts and keep the identifier constant.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const exportNameAlias = `ApiExtension_${hash.slice(-10)}`;\n\n // Calculate import path relative to `extensions.ts` file.\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Check if the file has a default export using AST parsing.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n const hasDefaultExport = extensionSource.getDefaultExportSymbol() !== undefined;\n\n // Support both default and named exports.\n if (hasDefaultExport) {\n source.insertImportDeclaration(index, {\n defaultImport: exportNameAlias,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: exportNameAlias }],\n moduleSpecifier: importPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${exportNameAlias});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const registerExtensionPluginImportPath =\n \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n const existingRegisterExtensionPluginImport = source.getImportDeclaration(\n registerExtensionPluginImportPath\n );\n if (!existingRegisterExtensionPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"names":["ApiExtension","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","extensionFilePath","absoluteExtensionFilePath","ExtensionSrcResolver","extensionFileName","path","exportName","hash","crypto","exportNameAlias","importPath","Project","source","existingImportDeclaration","index","importDeclarations","last","extensionProject","extensionSource","hasDefaultExport","undefined","pluginsArray","node","Node","registerExtensionPluginImportPath","existingRegisterExtensionPluginImport"],"mappings":";;;;;;AAOO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,KAAKC,WAAW;gBAAEF;YAAQ;YAC1B,YAAYC,EAAE,MAAM,GAAG,QAAQ;QACnC;IAEJ,MAAM,OAAME,MAAM,EAAEC,GAAG;QACnB,MAAMC,uBAAuBD,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACzD,IAAI,CAAC,QAAQ,OAAO,WAAW,OAAO,iBACtC,QAAQ;QAEb,MAAM,EAAE,KAAKE,iBAAiB,EAAE,GAAGH;QAGnC,MAAMI,4BAA4BC,qBAAqB,WAAW,CAC9DF,mBACAF,IAAI,OAAO;QAGf,MAAMK,oBAAoBC,KAAK,QAAQ,CAACH;QAGxC,MAAMI,aAAaR,OAAO,UAAU,IAAIO,KAAK,KAAK,CAACD,mBAAmB,IAAI;QAI1E,MAAMG,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACP,mBAAmB,MAAM,CAAC;QAC1E,MAAMQ,kBAAkB,CAAC,aAAa,EAAEF,KAAK,KAAK,CAAC,MAAM;QAGzD,MAAMG,aAAaL,KAAAA,QACN,CAACA,KAAK,OAAO,CAACL,uBAAuBE,2BAC7C,OAAO,CAAC,WAAW;QAExB,MAAMP,UAAU,IAAIgB;QACpBhB,QAAQ,mBAAmB,CAACK;QAE5B,MAAMY,SAASjB,QAAQ,oBAAoB,CAACK;QAE5C,MAAMa,4BAA4BD,OA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ourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"~/index.js\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport crypto from \"crypto\";\nimport { hasDefaultExport } from \"./hasDefaultExport.js\";\n\nexport const ApiExtension = defineExtension({\n type: \"Api/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add any API extension.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name is always the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Alias name is \"ApiExtension_\" + hash of the file path. This way we\n // avoid potential naming conflicts and keep the identifier constant.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const exportNameAlias = `ApiExtension_${hash.slice(-10)}`;\n\n // Calculate import path relative to `extensions.ts` file.\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Check if the file has a default export using AST parsing.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n\n // Support both default and named exports.\n if (hasDefaultExport(extensionSource)) {\n source.insertImportDeclaration(index, {\n defaultImport: exportNameAlias,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: exportNameAlias }],\n moduleSpecifier: importPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${exportNameAlias});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const registerExtensionPluginImportPath =\n \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n const existingRegisterExtensionPluginImport = source.getImportDeclaration(\n registerExtensionPluginImportPath\n );\n if (!existingRegisterExtensionPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"names":["ApiExtension","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","extensionFilePath","absoluteExtensionFilePath","ExtensionSrcResolver","extensionFileName","path","exportName","hash","crypto","exportNameAlias","importPath","Project","source","existingImportDeclaration","index","importDeclarations","last","extensionProject","extensionSource","hasDefaultExport","pluginsArray","node","Node","registerExtensionPluginImportPath","existingRegisterExtensionPluginImport"],"mappings":";;;;;;;AAQO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAA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AAuB,CAACE,OAAO;YAClC,eAAeL;YACf,iBAAiBC;QACrB;aAEAE,OAAO,uBAAuB,CAACE,OAAO;YAClC,cAAc;gBAAC;oBAAE,MAAMR;oBAAY,OAAOG;gBAAgB;aAAE;YAC5D,iBAAiBC;QACrB;QAGJ,MAAMU,eAAeR,OAAO,kBAAkB,CAACS,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAGlCD,aAAa,UAAU,CACnB,CAAC,6EAA6E,EAAEX,gBAAgB,MAAM,CAAC;QAG3G;YACI,IAAIK,QAAQ;YAEZ,MAAMC,qBAAqBH,OAAO,qBAAqB;YACvD,IAAIG,mBAAmB,MAAM,EAAE;gBAC3B,MAAMC,OAAOD,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE;gBAC9DD,QAAQE,KAAK,aAAa,KAAK;YACnC;YAEA,MAAMO,oCACF;YACJ,MAAMC,wCAAwCZ,OAAO,oBAAoB,CACrEW;YAEJ,IAAI,CAACC,uCACDZ,OAAO,uBAAuB,CAACE,OAAO;gBAClC,cAAc;oBAAC;iBAAgC;gBAC/C,iBAAiBS;YACrB;QAER;QAEA,MAAMX,OAAO,IAAI;IACrB;AACJ"}
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const BugReporter: import("~/defineExtension/index.js").ExtensionComponent<z.ZodObject<{
3
+ token: z.ZodOptional<z.ZodString>;
4
+ repository: z.ZodOptional<z.ZodString>;
5
+ labels: z.ZodOptional<z.ZodString>;
6
+ }, z.core.$strip>>;
@@ -0,0 +1,33 @@
1
+ import react from "react";
2
+ import { z } from "zod";
3
+ import { BuildParam } from "./ApiBuildParam.js";
4
+ import { AdminBuildParam } from "./AdminBuildParam.js";
5
+ import { defineExtension } from "../defineExtension/index.js";
6
+ const BugReporter = defineExtension({
7
+ type: "Project/BugReporter",
8
+ tags: {
9
+ runtimeContext: "project"
10
+ },
11
+ description: "Point the bug reporter at a GitHub repository, so the API files issues itself.",
12
+ paramsSchema: z.object({
13
+ token: z.string().optional().describe("GitHub PAT with write on BOTH issues and contents. Contents is not optional once anyone pastes a screenshot: issues have no attachment API, so images are committed to a branch. Always pass it through an env var, never a literal, since the value is serialized into the build artifact."),
14
+ repository: z.string().optional().describe("Target repository as `owner/name`. Filing requires this as well as a token; a token on its own leaves the reporter in compose mode."),
15
+ labels: z.string().optional().describe("Comma separated labels applied to every issue. Defaults to `bug`. Every issue also gets `reported-in-app`.")
16
+ }),
17
+ render: ({ token, repository, labels })=>/*#__PURE__*/ react.createElement(react.Fragment, null, token ? /*#__PURE__*/ react.createElement(BuildParam, {
18
+ paramName: "BUG_REPORT_GITHUB_TOKEN",
19
+ value: token
20
+ }) : null, repository ? /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(BuildParam, {
21
+ paramName: "BUG_REPORT_REPOSITORY",
22
+ value: repository
23
+ }), /*#__PURE__*/ react.createElement(AdminBuildParam, {
24
+ paramName: "BUG_REPORT_REPOSITORY",
25
+ value: repository
26
+ })) : null, labels ? /*#__PURE__*/ react.createElement(BuildParam, {
27
+ paramName: "BUG_REPORT_LABELS",
28
+ value: labels
29
+ }) : null)
30
+ });
31
+ export { BugReporter };
32
+
33
+ //# sourceMappingURL=BugReporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions/BugReporter.js","sources":["../../src/extensions/BugReporter.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\n\n/*\n * The bug reporter is enabled in every project through DefaultExtensions, so this extension is not\n * what turns it on. Without it the reporter runs in compose mode: the API writes the report up and\n * returns a prefilled GitHub issues/new URL, which the reporter submits under their own account and\n * which needs no credentials. This is what switches it to filing the issue itself.\n *\n * Lives here rather than in @webiny/bug-reporter because that package already depends on\n * @webiny/project-aws for `Api` and `Admin`, so having the Project namespace reach back into it\n * would close a cycle. Nothing is lost: the render only emits build params, and the API owns every\n * default, so there is one place they live rather than two that can drift.\n */\nexport const BugReporter = defineExtension({\n type: \"Project/BugReporter\",\n tags: { runtimeContext: \"project\" },\n description: \"Point the bug reporter at a GitHub repository, so the API files issues itself.\",\n paramsSchema: z.object({\n token: z\n .string()\n .optional()\n .describe(\n \"GitHub PAT with write on BOTH issues and contents. Contents is not optional once anyone pastes a screenshot: issues have no attachment API, so images are committed to a branch. Always pass it through an env var, never a literal, since the value is serialized into the build artifact.\"\n ),\n repository: z\n .string()\n .optional()\n .describe(\n \"Target repository as `owner/name`. Filing requires this as well as a token; a token on its own leaves the reporter in compose mode.\"\n ),\n labels: z\n .string()\n .optional()\n .describe(\n \"Comma separated labels applied to every issue. Defaults to `bug`. Every issue also gets `reported-in-app`.\"\n )\n }),\n render: ({ token, repository, labels }) => {\n return (\n <>\n {token ? <BuildParam paramName=\"BUG_REPORT_GITHUB_TOKEN\" value={token} /> : null}\n {/*\n * The repository goes to the admin app too, so the dialog can name where a report\n * is headed before the reporter sends it. The token never does: an admin build\n * param is serialized into the browser bundle.\n */}\n {repository ? (\n <>\n <BuildParam paramName=\"BUG_REPORT_REPOSITORY\" value={repository} />\n <AdminBuildParam paramName=\"BUG_REPORT_REPOSITORY\" value={repository} />\n </>\n ) : null}\n {labels ? <BuildParam paramName=\"BUG_REPORT_LABELS\" value={labels} /> : null}\n </>\n );\n }\n});\n"],"names":["BugReporter","defineExtension","z","token","repository","labels","BuildParam","AdminBuildParam"],"mappings":";;;;;AAiBO,MAAMA,cAAcC,gBAAgB;IACvC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,OAAOA,EAAAA,MACI,GACN,QAAQ,GACR,QAAQ,CACL;QAER,YAAYA,EAAAA,MACD,GACN,QAAQ,GACR,QAAQ,CACL;QAER,QAAQA,EAAAA,MACG,GACN,QAAQ,GACR,QAAQ,CACL;IAEZ;IACA,QAAQ,CAAC,EAAEC,KAAK,EAAEC,UAAU,EAAEC,MAAM,EAAE,GAC3B,WAAP,GACI,0CACKF,QAAQ,WAARA,GAAQ,oBAACG,YAAUA;YAAC,WAAU;YAA0B,OAAOH;aAAY,MAM3EC,aAAa,WAAbA,GACG,wDACI,oBAACE,YAAUA;YAAC,WAAU;YAAwB,OAAOF;0BACrD,oBAACG,iBAAeA;YAAC,WAAU;YAAwB,OAAOH;cAE9D,MACHC,SAAS,WAATA,GAAS,oBAACC,YAAUA;YAAC,WAAU;YAAoB,OAAOD;aAAa;AAIxF"}
@@ -23,6 +23,8 @@ export declare const FeatureFlags: import("~/defineExtension/index.js").Extensio
23
23
  imageEnrichment: z.ZodOptional<z.ZodBoolean>;
24
24
  }, z.core.$strip>>;
25
25
  lexicalGeneration: z.ZodOptional<z.ZodBoolean>;
26
+ adminAssistant: z.ZodOptional<z.ZodBoolean>;
27
+ remoteComponents: z.ZodOptional<z.ZodBoolean>;
26
28
  cms: z.ZodOptional<z.ZodObject<{
27
29
  entryGeneration: z.ZodOptional<z.ZodBoolean>;
28
30
  entryComparison: z.ZodOptional<z.ZodBoolean>;
@@ -30,6 +32,9 @@ export declare const FeatureFlags: import("~/defineExtension/index.js").Extensio
30
32
  }, z.core.$strip>>;
31
33
  }, z.core.$strip>]>>;
32
34
  abTesting: z.ZodOptional<z.ZodBoolean>;
33
- remoteComponents: z.ZodOptional<z.ZodBoolean>;
35
+ collaboration: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
36
+ comments: z.ZodOptional<z.ZodBoolean>;
37
+ activityLog: z.ZodOptional<z.ZodBoolean>;
38
+ }, z.core.$strip>]>>;
34
39
  }, z.core.$strip>;
35
40
  }, z.core.$strip>>;
@@ -39,6 +39,8 @@ const FeatureFlags = defineExtension({
39
39
  imageEnrichment: z.boolean().optional()
40
40
  }).optional(),
41
41
  lexicalGeneration: z.boolean().optional(),
42
+ adminAssistant: z.boolean().optional(),
43
+ remoteComponents: z.boolean().optional(),
42
44
  cms: z.object({
43
45
  entryGeneration: z.boolean().optional(),
44
46
  entryComparison: z.boolean().optional(),
@@ -47,7 +49,13 @@ const FeatureFlags = defineExtension({
47
49
  })
48
50
  ]).optional(),
49
51
  abTesting: z.boolean().optional(),
50
- remoteComponents: z.boolean().optional()
52
+ collaboration: z.union([
53
+ z.boolean(),
54
+ z.object({
55
+ comments: z.boolean().optional(),
56
+ activityLog: z.boolean().optional()
57
+ })
58
+ ]).optional()
51
59
  })
52
60
  }),
53
61
  render: ({ features = {} })=>{
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/FeatureFlags.js","sources":["../../src/extensions/FeatureFlags.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport { setProjectFeatureFlags } from \"~/services/GetProjectConfigService/FeatureFlagsContext.js\";\n\nexport const FeatureFlags = defineExtension({\n type: \"FeatureFlags\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable or disable features.\",\n paramsSchema: z.object({\n // Follows `IFeatureFlagsDto` from `packages/feature-flags/src/types.ts`.\n features: z.object({\n multiTenancy: z.boolean().optional(),\n advancedPublishingWorkflow: z.boolean().optional(),\n advancedAccessControlLayer: z\n .union([\n z.boolean(),\n z.object({\n teams: z.boolean().optional(),\n privateFiles: z.boolean().optional(),\n folderLevelPermissions: z.boolean().optional(),\n hcmsFieldPermissions: z.boolean().optional()\n })\n ])\n .optional(),\n auditLogs: z.boolean().optional(),\n recordLocking: z.boolean().optional(),\n fileManager: z\n .object({\n threatDetection: z.boolean().optional()\n })\n .optional(),\n aiPowerups: z\n .union([\n z.boolean(),\n z.object({\n websiteBuilder: z\n .object({\n pageGeneration: z.boolean().optional(),\n pageTranslation: z.boolean().optional()\n })\n .optional(),\n fileManager: z\n .object({\n imageEnrichment: z.boolean().optional()\n })\n .optional(),\n lexicalGeneration: z.boolean().optional(),\n cms: z\n .object({\n entryGeneration: z.boolean().optional(),\n entryComparison: z.boolean().optional(),\n entryTranslation: z.boolean().optional()\n })\n .optional()\n })\n ])\n .optional(),\n abTesting: z.boolean().optional(),\n remoteComponents: z.boolean().optional()\n })\n }),\n render: ({ features = {} }) => {\n setProjectFeatureFlags(features);\n return (\n <>\n <BuildParam paramName=\"FeatureFlags\" value={features} />\n <AdminBuildParam paramName=\"FeatureFlags\" value={features} />\n </>\n );\n }\n});\n"],"names":["FeatureFlags","defineExtension","z","features","setProjectFeatureFlags","BuildParam","AdminBuildParam"],"mappings":";;;;;;AAOO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QAEnB,UAAUA,EAAE,MAAM,CAAC;YACf,cAAcA,EAAE,OAAO,GAAG,QAAQ;YAClC,4BAA4BA,EAAE,OAAO,GAAG,QAAQ;YAChD,4BAA4BA,EAAAA,KAClB,CAAC;gBACHA,EAAE,OAAO;gBACTA,EAAE,MAAM,CAAC;oBACL,OAAOA,EAAE,OAAO,GAAG,QAAQ;oBAC3B,cAAcA,EAAE,OAAO,GAAG,QAAQ;oBAClC,wBAAwBA,EAAE,OAAO,GAAG,QAAQ;oBAC5C,sBAAsBA,EAAE,OAAO,GAAG,QAAQ;gBAC9C;aACH,EACA,QAAQ;YACb,WAAWA,EAAE,OAAO,GAAG,QAAQ;YAC/B,eAAeA,EAAE,OAAO,GAAG,QAAQ;YACnC,aAAaA,EAAAA,MACF,CAAC;gBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;YACzC,GACC,QAAQ;YACb,YAAYA,EAAAA,KACF,CAAC;gBACHA,EAAE,OAAO;gBACTA,EAAE,MAAM,CAAC;oBACL,gBAAgBA,EAAAA,MACL,CAAC;wBACJ,gBAAgBA,EAAE,OAAO,GAAG,QAAQ;wBACpC,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;oBACzC,GACC,QAAQ;oBACb,aAAaA,EAAAA,MACF,CAAC;wBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;oBACzC,GACC,QAAQ;oBACb,mBAAmBA,EAAE,OAAO,GAAG,QAAQ;oBACvC,KAAKA,EAAAA,MACM,CAAC;wBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;wBACrC,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;wBACrC,kBAAkBA,EAAE,OAAO,GAAG,QAAQ;oBAC1C,GACC,QAAQ;gBACjB;aACH,EACA,QAAQ;YACb,WAAWA,EAAE,OAAO,GAAG,QAAQ;YAC/B,kBAAkBA,EAAE,OAAO,GAAG,QAAQ;QAC1C;IACJ;IACA,QAAQ,CAAC,EAAEC,WAAW,CAAC,CAAC,EAAE;QACtBC,uBAAuBD;QACvB,OAAO,WAAP,GACI,wDACI,oBAACE,YAAUA;YAAC,WAAU;YAAe,OAAOF;0BAC5C,oBAACG,iBAAeA;YAAC,WAAU;YAAe,OAAOH;;IAG7D;AACJ"}
1
+ {"version":3,"file":"extensions/FeatureFlags.js","sources":["../../src/extensions/FeatureFlags.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport { setProjectFeatureFlags } from \"~/services/GetProjectConfigService/FeatureFlagsContext.js\";\n\nexport const FeatureFlags = defineExtension({\n type: \"FeatureFlags\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable or disable features.\",\n paramsSchema: z.object({\n // Follows `IFeatureFlagsDto` from `packages/feature-flags/src/types.ts`.\n features: z.object({\n multiTenancy: z.boolean().optional(),\n advancedPublishingWorkflow: z.boolean().optional(),\n advancedAccessControlLayer: z\n .union([\n z.boolean(),\n z.object({\n teams: z.boolean().optional(),\n privateFiles: z.boolean().optional(),\n folderLevelPermissions: z.boolean().optional(),\n hcmsFieldPermissions: z.boolean().optional()\n })\n ])\n .optional(),\n auditLogs: z.boolean().optional(),\n recordLocking: z.boolean().optional(),\n fileManager: z\n .object({\n threatDetection: z.boolean().optional()\n })\n .optional(),\n aiPowerups: z\n .union([\n z.boolean(),\n z.object({\n websiteBuilder: z\n .object({\n pageGeneration: z.boolean().optional(),\n pageTranslation: z.boolean().optional()\n })\n .optional(),\n fileManager: z\n .object({\n imageEnrichment: z.boolean().optional()\n })\n .optional(),\n lexicalGeneration: z.boolean().optional(),\n adminAssistant: z.boolean().optional(),\n remoteComponents: z.boolean().optional(),\n cms: z\n .object({\n entryGeneration: z.boolean().optional(),\n entryComparison: z.boolean().optional(),\n entryTranslation: z.boolean().optional()\n })\n .optional()\n })\n ])\n .optional(),\n abTesting: z.boolean().optional(),\n collaboration: z\n .union([\n z.boolean(),\n z.object({\n comments: z.boolean().optional(),\n activityLog: z.boolean().optional()\n })\n ])\n .optional()\n })\n }),\n render: ({ features = {} }) => {\n setProjectFeatureFlags(features);\n return (\n <>\n <BuildParam paramName=\"FeatureFlags\" value={features} />\n <AdminBuildParam paramName=\"FeatureFlags\" value={features} />\n </>\n );\n }\n});\n"],"names":["FeatureFlags","defineExtension","z","features","setProjectFeatureFlags","BuildParam","AdminBuildParam"],"mappings":";;;;;;AAOO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QAEnB,UAAUA,EAAE,MAAM,CAAC;YACf,cAAcA,EAAE,OAAO,GAAG,QAAQ;YAClC,4BAA4BA,EAAE,OAAO,GAAG,QAAQ;YAChD,4BAA4BA,EAAAA,KAClB,CAAC;gBACHA,EAAE,OAAO;gBACTA,EAAE,MAAM,CAAC;oBACL,OAAOA,EAAE,OAAO,GAAG,QAAQ;oBAC3B,cAAcA,EAAE,OAAO,GAAG,QAAQ;oBAClC,wBAAwBA,EAAE,OAAO,GA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YAAe,OAAOF;0BAC5C,oBAACG,iBAAeA;YAAC,WAAU;YAAe,OAAOH;;IAG7D;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project/WcpInjectTelemetryClientAfterBuild.js","sources":["../../../src/extensions/Project/WcpInjectTelemetryClientAfterBuild.ts"],"sourcesContent":["import {\n ApiAfterBuild,\n GetApp,\n GetProjectIdService,\n LoggerService,\n UiService,\n WcpService\n} from \"~/abstractions/index.js\";\nimport fs from \"fs\";\n\nclass WcpInjectTelemetryClientAfterBuildImpl implements ApiAfterBuild.Interface {\n constructor(\n private getProjectIdService: GetProjectIdService.Interface,\n private wcpService: WcpService.Interface,\n private loggerService: LoggerService.Interface,\n private getApp: GetApp.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n if (!projectId) {\n return;\n }\n\n const logger = this.loggerService;\n const ui = this.uiService;\n\n logger.info(\"Injecting WCP telemetry client into the GraphQL API handler...\");\n\n const app = this.getApp.execute(\"api\");\n\n // Only wrap the GraphQL API handler with the telemetry client.\n const handlersPaths = [app.paths.workspaceFolder.join(\"graphql\", \"build\")];\n\n // 1. Download telemetry client code.\n const latestTelemetryClientUrl = this.wcpService\n .getWcpApiUrl()\n .join(\"/clients/latest.mjs\")\n .toString();\n\n try {\n logger.info(`Downloading telemetry client from: ${latestTelemetryClientUrl}`);\n const response = await fetch(latestTelemetryClientUrl);\n if (!response.ok) {\n throw new Error(\n `Failed to download telemetry client: ${response.status} - ${response.statusText}`\n );\n }\n\n const telemetryCodeAsString = await response.text();\n\n // The downloaded wrapper re-exports only `handler`, but the AWS api bundle also exports\n // `streamHandler` — the entry point of the response-streaming Lambda. Without this\n // re-export that function has no handler to load and fails at cold start.\n //\n // Two constraints shape how it's done:\n //\n // 1. UNWRAPPED. `streamHandler` carries the marker `awslambda.streamifyResponse` attaches,\n // and the runtime inspects the exported function for it; routing it through a telemetry\n // wrapper function would strip the marker and silently downgrade the function to\n // buffered responses. Re-exporting the same function object keeps the marker — at the\n // cost of no telemetry for that function, which is the right trade.\n //\n // 2. Via a NAMESPACE import, not `export { streamHandler } from ...`. This injection also\n // runs for the self-hosted api build, whose bundle has no `streamHandler` (streaming is\n // native there, with no Lambda involved), and a named re-export of a missing binding is\n // a hard ESM error that would break the whole handler. A namespace access just yields\n // `undefined`, which nothing on that path reads.\n //\n // BACKLOGGED, not settled. String-appending to an artifact downloaded from another repo\n // means a change to the shape of `clients/latest.mjs` breaks the build on customers'\n // machines. The agreed fix is one line on the WCP side — `export * from \"./_handler.mjs\"`\n // right after that file's own import, which passes through every bundle export unwrapped\n // (the explicit `export { handler }` still shadows the star, and `export *` re-exports\n // nothing on the self-hosted bundle). When that ships, this whole append goes away.\n const wrapperCode =\n telemetryCodeAsString +\n '\\nimport * as _webinyBuiltHandlers from \"./_handler.mjs\";\\n' +\n \"export const streamHandler = _webinyBuiltHandlers.streamHandler;\\n\";\n\n // 2. Wrap the initially built code with the telemetry client code.\n for (let i = 0; i < handlersPaths.length; i++) {\n const current = handlersPaths[i];\n\n // 2.1 Move initially built `handler.mjs` into `_handler.mjs`.\n const builtHandlerPath = current.join(\"handler.mjs\").toString();\n const renamedHandlerPath = current.join(\"_handler.mjs\").toString();\n fs.renameSync(builtHandlerPath, renamedHandlerPath);\n\n // 2.2 Write downloaded telemetry client code as a new `handler.js`.\n fs.writeFileSync(builtHandlerPath, wrapperCode);\n }\n\n logger.info(\"WCP telemetry client injected successfully.\");\n } catch (err) {\n logger.debug({ err }, \"WCP client is unavailable; telemetry was disabled.\");\n ui.warning(`WCP client is unavailable; telemetry was disabled.`);\n }\n }\n}\n\nexport const WcpInjectTelemetryClientAfterBuild = ApiAfterBuild.createImplementation({\n implementation: WcpInjectTelemetryClientAfterBuildImpl,\n dependencies: [GetProjectIdService, WcpService, LoggerService, GetApp, UiService]\n});\n"],"names":["WcpInjectTelemetryClientAfterBuildImpl","getProjectIdService","wcpService","loggerService","getApp","uiService","projectId","logger","ui","app","handlersPaths","latestTelemetryClientUrl","response","fetch","Error","telemetryCodeAsString","wrapperCode","i","current","builtHandlerPath","renamedHandlerPath","fs","err","WcpInjectTelemetryClientAfterBuild","ApiAfterBuild","GetProjectIdService","WcpService","LoggerService","GetApp","UiService"],"mappings":";;AAUA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,UAAgC,EAChCC,aAAsC,EACtCC,MAAwB,EACxBC,SAA8B,CACxC;aALUJ,mBAAmB,GAAnBA;aACAC,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,IAAI,CAACA,WACD;QAGJ,MAAMC,SAAS,IAAI,CAAC,aAAa;QACjC,MAAMC,KAAK,IAAI,CAAC,SAAS;QAEzBD,OAAO,IAAI,CAAC;QAEZ,MAAME,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAGhC,MAAMC,gBAAgB;YAACD,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW;SAAS;QAG1E,MAAME,2BAA2B,IAAI,CAAC,UAAU,CAC3C,YAAY,GACZ,IAAI,CAAC,uBACL,QAAQ;QAEb,IAAI;YACAJ,OAAO,IAAI,CAAC,CAAC,mCAAmC,EAAEI,0BAA0B;YAC5E,MAAMC,WAAW,MAAMC,MAAMF;YAC7B,IAAI,CAACC,SAAS,EAAE,EACZ,MAAM,IAAIE,MACN,CAAC,qCAAqC,EAAEF,SAAS,MAAM,CAAC,GAAG,EAAEA,SAAS,UAAU,EAAE;YAI1F,MAAMG,wBAAwB,MAAMH,SAAS,IAAI;YA0BjD,MAAMI,cACFD,wBAAAA;YAKJ,IAAK,IAAIE,IAAI,GAAGA,IAAIP,cAAc,MAAM,EAAEO,IAAK;gBAC3C,MAAMC,UAAUR,aAAa,CAACO,EAAE;gBAGhC,MAAME,mBAAmBD,QAAQ,IAAI,CAAC,eAAe,QAAQ;gBAC7D,MAAME,qBAAqBF,QAAQ,IAAI,CAAC,gBAAgB,QAAQ;gBAChEG,GAAG,UAAU,CAACF,kBAAkBC;gBAGhCC,GAAG,aAAa,CAACF,kBAAkBH;YACvC;YAEAT,OAAO,IAAI,CAAC;QAChB,EAAE,OAAOe,KAAK;YACVf,OAAO,KAAK,CAAC;gBAAEe;YAAI,GAAG;YACtBd,GAAG,OAAO,CAAC;QACf;IACJ;AACJ;AAEO,MAAMe,qCAAqCC,cAAc,oBAAoB,CAAC;IACjF,gBAAgBxB;IAChB,cAAc;QAACyB;QAAqBC;QAAYC;QAAeC;QAAQC;KAAU;AACrF"}
1
+ {"version":3,"file":"extensions/Project/WcpInjectTelemetryClientAfterBuild.js","sources":["../../../src/extensions/Project/WcpInjectTelemetryClientAfterBuild.ts"],"sourcesContent":["import {\n ApiAfterBuild,\n GetApp,\n GetProjectIdService,\n LoggerService,\n UiService,\n WcpService\n} from \"~/abstractions/index.js\";\nimport fs from \"fs\";\n\nclass WcpInjectTelemetryClientAfterBuildImpl implements ApiAfterBuild.Interface {\n constructor(\n private getProjectIdService: GetProjectIdService.Interface,\n private wcpService: WcpService.Interface,\n private loggerService: LoggerService.Interface,\n private getApp: GetApp.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n if (!projectId) {\n return;\n }\n\n const logger = this.loggerService;\n const ui = this.uiService;\n\n logger.info(\"Injecting WCP telemetry client into the GraphQL API handler...\");\n\n const app = this.getApp.execute(\"api\");\n\n // Only wrap the GraphQL API handler with the telemetry client.\n const handlersPaths = [app.paths.workspaceFolder.join(\"graphql\", \"build\")];\n\n // 1. Download telemetry client code.\n const latestTelemetryClientUrl = this.wcpService\n .getWcpApiUrl()\n .join(\"/clients/latest.mjs\")\n .toString();\n\n try {\n logger.info(`Downloading telemetry client from: ${latestTelemetryClientUrl}`);\n const response = await fetch(latestTelemetryClientUrl);\n if (!response.ok) {\n throw new Error(\n `Failed to download telemetry client: ${response.status} - ${response.statusText}`\n );\n }\n\n const telemetryCodeAsString = await response.text();\n\n // The downloaded wrapper re-exports only `handler`, but the AWS api bundle also exports\n // `streamHandler` — the entry point of the response-streaming Lambda. Without this\n // re-export that function has no handler to load and fails at cold start.\n //\n // Two constraints shape how it's done:\n //\n // 1. UNWRAPPED. `streamHandler` carries the marker `awslambda.streamifyResponse` attaches,\n // and the runtime inspects the exported function for it; routing it through a telemetry\n // wrapper function would strip the marker and silently downgrade the function to\n // buffered responses. Re-exporting the same function object keeps the marker — at the\n // cost of no telemetry for that function, which is the right trade.\n //\n // 2. Via a NAMESPACE import, not `export { streamHandler } from ...`. This injection also\n // runs for the standalone api build, whose bundle has no `streamHandler` (streaming is\n // native there, with no Lambda involved), and a named re-export of a missing binding is\n // a hard ESM error that would break the whole handler. A namespace access just yields\n // `undefined`, which nothing on that path reads.\n //\n // BACKLOGGED, not settled. String-appending to an artifact downloaded from another repo\n // means a change to the shape of `clients/latest.mjs` breaks the build on customers'\n // machines. The agreed fix is one line on the WCP side — `export * from \"./_handler.mjs\"`\n // right after that file's own import, which passes through every bundle export unwrapped\n // (the explicit `export { handler }` still shadows the star, and `export *` re-exports\n // nothing on the standalone bundle). When that ships, this whole append goes away.\n const wrapperCode =\n telemetryCodeAsString +\n '\\nimport * as _webinyBuiltHandlers from \"./_handler.mjs\";\\n' +\n \"export const streamHandler = _webinyBuiltHandlers.streamHandler;\\n\";\n\n // 2. Wrap the initially built code with the telemetry client code.\n for (let i = 0; i < handlersPaths.length; i++) {\n const current = handlersPaths[i];\n\n // 2.1 Move initially built `handler.mjs` into `_handler.mjs`.\n const builtHandlerPath = current.join(\"handler.mjs\").toString();\n const renamedHandlerPath = current.join(\"_handler.mjs\").toString();\n fs.renameSync(builtHandlerPath, renamedHandlerPath);\n\n // 2.2 Write downloaded telemetry client code as a new `handler.js`.\n fs.writeFileSync(builtHandlerPath, wrapperCode);\n }\n\n logger.info(\"WCP telemetry client injected successfully.\");\n } catch (err) {\n logger.debug({ err }, \"WCP client is unavailable; telemetry was disabled.\");\n ui.warning(`WCP client is unavailable; telemetry was disabled.`);\n }\n }\n}\n\nexport const WcpInjectTelemetryClientAfterBuild = ApiAfterBuild.createImplementation({\n implementation: WcpInjectTelemetryClientAfterBuildImpl,\n dependencies: [GetProjectIdService, WcpService, LoggerService, GetApp, UiService]\n});\n"],"names":["WcpInjectTelemetryClientAfterBuildImpl","getProjectIdService","wcpService","loggerService","getApp","uiService","projectId","logger","ui","app","handlersPaths","latestTelemetryClientUrl","response","fetch","Error","telemetryCodeAsString","wrapperCode","i","current","builtHandlerPath","renamedHandlerPath","fs","err","WcpInjectTelemetryClientAfterBuild","ApiAfterBuild","GetProjectIdService","WcpService","LoggerService","GetApp","UiService"],"mappings":";;AAUA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,UAAgC,EAChCC,aAAsC,EACtCC,MAAwB,EACxBC,SAA8B,CACxC;aALUJ,mBAAmB,GAAnBA;aACAC,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,IAAI,CAACA,WACD;QAGJ,MAAMC,SAAS,IAAI,CAAC,aAAa;QACjC,MAAMC,KAAK,IAAI,CAAC,SAAS;QAEzBD,OAAO,IAAI,CAAC;QAEZ,MAAME,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAGhC,MAAMC,gBAAgB;YAACD,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW;SAAS;QAG1E,MAAME,2BAA2B,IAAI,CAAC,UAAU,CAC3C,YAAY,GACZ,IAAI,CAAC,uBACL,QAAQ;QAEb,IAAI;YACAJ,OAAO,IAAI,CAAC,CAAC,mCAAmC,EAAEI,0BAA0B;YAC5E,MAAMC,WAAW,MAAMC,MAAMF;YAC7B,IAAI,CAACC,SAAS,EAAE,EACZ,MAAM,IAAIE,MACN,CAAC,qCAAqC,EAAEF,SAAS,MAAM,CAAC,GAAG,EAAEA,SAAS,UAAU,EAAE;YAI1F,MAAMG,wBAAwB,MAAMH,SAAS,IAAI;YA0BjD,MAAMI,cACFD,wBAAAA;YAKJ,IAAK,IAAIE,IAAI,GAAGA,IAAIP,cAAc,MAAM,EAAEO,IAAK;gBAC3C,MAAMC,UAAUR,aAAa,CAACO,EAAE;gBAGhC,MAAME,mBAAmBD,QAAQ,IAAI,CAAC,eAAe,QAAQ;gBAC7D,MAAME,qBAAqBF,QAAQ,IAAI,CAAC,gBAAgB,QAAQ;gBAChEG,GAAG,UAAU,CAACF,kBAAkBC;gBAGhCC,GAAG,aAAa,CAACF,kBAAkBH;YACvC;YAEAT,OAAO,IAAI,CAAC;QAChB,EAAE,OAAOe,KAAK;YACVf,OAAO,KAAK,CAAC;gBAAEe;YAAI,GAAG;YACtBd,GAAG,OAAO,CAAC;QACf;IACJ;AACJ;AAEO,MAAMe,qCAAqCC,cAAc,oBAAoB,CAAC;IACjF,gBAAgBxB;IAChB,cAAc;QAACyB;QAAqBC;QAAYC;QAAeC;QAAQC;KAAU;AACrF"}
@@ -1,7 +1,7 @@
1
1
  import { type UiService } from "../../abstractions/index.js";
2
2
  /**
3
3
  * The "restart the watch command" notice is wired per app (`ApiBeforeWatch` + `AdminBeforeWatch`), but a
4
- * single `webiny watch` can now cover several apps in one process — self-hosted watches api and admin
4
+ * single `webiny watch` can now cover several apps in one process — standalone watches api and admin
5
5
  * together. The message is identical either way, so print it once per process instead of once per app.
6
6
  */
7
7
  export declare const showConfigChangeNotice: (ui: UiService.Interface) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project/showConfigChangeNotice.js","sources":["../../../src/extensions/Project/showConfigChangeNotice.ts"],"sourcesContent":["import { type UiService } from \"~/abstractions/index.js\";\n\nlet shown = false;\n\n/**\n * The \"restart the watch command\" notice is wired per app (`ApiBeforeWatch` + `AdminBeforeWatch`), but a\n * single `webiny watch` can now cover several apps in one process — self-hosted watches api and admin\n * together. The message is identical either way, so print it once per process instead of once per app.\n */\nexport const showConfigChangeNotice = (ui: UiService.Interface) => {\n if (shown) {\n return;\n }\n\n shown = true;\n\n ui.info(\n [\n \"Changes done in %s are not reloaded automatically.\",\n \"You'll have to restart the watch command in order for your changes to take effect.\"\n ].join(\" \"),\n \"webiny.config.tsx\"\n );\n};\n"],"names":["shown","showConfigChangeNotice","ui"],"mappings":"AAEA,IAAIA,QAAQ;AAOL,MAAMC,yBAAyB,CAACC;IACnC,IAAIF,OACA;IAGJA,QAAQ;IAERE,GAAG,IAAI,CACH,yIAIA;AAER"}
1
+ {"version":3,"file":"extensions/Project/showConfigChangeNotice.js","sources":["../../../src/extensions/Project/showConfigChangeNotice.ts"],"sourcesContent":["import { type UiService } from \"~/abstractions/index.js\";\n\nlet shown = false;\n\n/**\n * The \"restart the watch command\" notice is wired per app (`ApiBeforeWatch` + `AdminBeforeWatch`), but a\n * single `webiny watch` can now cover several apps in one process — standalone watches api and admin\n * together. The message is identical either way, so print it once per process instead of once per app.\n */\nexport const showConfigChangeNotice = (ui: UiService.Interface) => {\n if (shown) {\n return;\n }\n\n shown = true;\n\n ui.info(\n [\n \"Changes done in %s are not reloaded automatically.\",\n \"You'll have to restart the watch command in order for your changes to take effect.\"\n ].join(\" \"),\n \"webiny.config.tsx\"\n );\n};\n"],"names":["shown","showConfigChangeNotice","ui"],"mappings":"AAEA,IAAIA,QAAQ;AAOL,MAAMC,yBAAyB,CAACC;IACnC,IAAIF,OACA;IAGJA,QAAQ;IAERE,GAAG,IAAI,CACH,yIAIA;AAER"}
@@ -0,0 +1,2 @@
1
+ import { type SourceFile } from "ts-morph";
2
+ export declare const hasDefaultExport: (source: SourceFile) => boolean;
@@ -0,0 +1,17 @@
1
+ import { Node, SyntaxKind } from "ts-morph";
2
+ const hasDefaultExport = (source)=>source.getStatements().some((statement)=>{
3
+ if (Node.isExportAssignment(statement)) return !statement.isExportEquals();
4
+ if (Node.isModifierable(statement)) return statement.hasModifier(SyntaxKind.DefaultKeyword);
5
+ if (Node.isExportDeclaration(statement)) return statement.getNamedExports().some((namedExport)=>{
6
+ const exportedAs = namedExport.getAliasNode() ?? namedExport.getNameNode();
7
+ return "default" === getExportedName(exportedAs);
8
+ });
9
+ return false;
10
+ });
11
+ const getExportedName = (node)=>{
12
+ if (Node.isStringLiteral(node)) return node.getLiteralValue();
13
+ return node.getText();
14
+ };
15
+ export { hasDefaultExport };
16
+
17
+ //# sourceMappingURL=hasDefaultExport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions/hasDefaultExport.js","sources":["../../src/extensions/hasDefaultExport.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { SyntaxKind } from \"ts-morph\";\nimport { type SourceFile } from \"ts-morph\";\n\n/*\n * Tells whether a file has a default export by reading its syntax alone.\n *\n * ts-morph's `getDefaultExportSymbol()` gives the same answer, but it asks the type checker, and the\n * checker first loads the TypeScript lib files and every module the file imports. For an admin\n * extension that means React and the admin app's types, so each call took between 0.1s and 2.5s.\n * `webiny watch` makes one call per extension, one after another, which added up to 17s of the\n * startup on a project with 39 extensions.\n *\n * The checker isn't needed here. A default export is always written out in the file itself, as one\n * of the forms below, since `export * from` never re-exports `default`.\n */\nexport const hasDefaultExport = (source: SourceFile): boolean => {\n return source.getStatements().some(statement => {\n // export default something;\n if (Node.isExportAssignment(statement)) {\n return !statement.isExportEquals();\n }\n\n // export default function Extension() {} and export default class Extension {}\n if (Node.isModifierable(statement)) {\n return statement.hasModifier(SyntaxKind.DefaultKeyword);\n }\n\n // export { Extension as default } and export { default } from \"./Extension.js\"\n if (Node.isExportDeclaration(statement)) {\n return statement.getNamedExports().some(namedExport => {\n const exportedAs = namedExport.getAliasNode() ?? namedExport.getNameNode();\n return getExportedName(exportedAs) === \"default\";\n });\n }\n\n return false;\n });\n};\n\n/*\n * An exported name can also be written as a string, as in `export { Extension as \"default\" }`.\n * Its text then includes the quotes, so strings are compared by their value instead.\n */\nconst getExportedName = (node: Node): string => {\n if (Node.isStringLiteral(node)) {\n return node.getLiteralValue();\n }\n\n return node.getText();\n};\n"],"names":["hasDefaultExport","source","statement","Node","SyntaxKind","namedExport","exportedAs","getExportedName","node"],"mappings":";AAgBO,MAAMA,mBAAmB,CAACC,SACtBA,OAAO,aAAa,GAAG,IAAI,CAACC,CAAAA;QAE/B,IAAIC,KAAK,kBAAkB,CAACD,YACxB,OAAO,CAACA,UAAU,cAAc;QAIpC,IAAIC,KAAK,cAAc,CAACD,YACpB,OAAOA,UAAU,WAAW,CAACE,WAAW,cAAc;QAI1D,IAAID,KAAK,mBAAmB,CAACD,YACzB,OAAOA,UAAU,eAAe,GAAG,IAAI,CAACG,CAAAA;YACpC,MAAMC,aAAaD,YAAY,YAAY,MAAMA,YAAY,WAAW;YACxE,OAAOE,AAAgC,cAAhCA,gBAAgBD;QAC3B;QAGJ,OAAO;IACX;AAOJ,MAAMC,kBAAkB,CAACC;IACrB,IAAIL,KAAK,eAAe,CAACK,OACrB,OAAOA,KAAK,eAAe;IAG/B,OAAOA,KAAK,OAAO;AACvB"}
@@ -6,6 +6,7 @@ import { Telemetry } from "./Telemetry.js";
6
6
  import { EnvVar } from "./EnvVar.js";
7
7
  import { DatabaseSetup } from "./DatabaseSetup.js";
8
8
  import { FeatureFlags } from "./FeatureFlags.js";
9
+ import { BugReporter } from "./BugReporter.js";
9
10
  import { BuildParam } from "./ApiBuildParam.js";
10
11
  import { AdminBuildParam } from "./AdminBuildParam.js";
11
12
  import { AdminApiUrl } from "./AdminApiUrl.js";
@@ -24,6 +25,7 @@ export { ProjectImplementation };
24
25
  export { ExtensionDefinitions };
25
26
  export { EnvVar };
26
27
  export { FeatureFlags };
28
+ export { BugReporter };
27
29
  export { DatabaseSetup };
28
30
  export { BuildParam };
29
31
  export { AdminBuildParam };
@@ -95,6 +97,8 @@ export declare const definitions: (import("./index.js").ExtensionDefinitionModel
95
97
  imageEnrichment: import("zod").ZodOptional<import("zod").ZodBoolean>;
96
98
  }, import("zod/v4/core").$strip>>;
97
99
  lexicalGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
100
+ adminAssistant: import("zod").ZodOptional<import("zod").ZodBoolean>;
101
+ remoteComponents: import("zod").ZodOptional<import("zod").ZodBoolean>;
98
102
  cms: import("zod").ZodOptional<import("zod").ZodObject<{
99
103
  entryGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
100
104
  entryComparison: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -102,17 +106,22 @@ export declare const definitions: (import("./index.js").ExtensionDefinitionModel
102
106
  }, import("zod/v4/core").$strip>>;
103
107
  }, import("zod/v4/core").$strip>]>>;
104
108
  abTesting: import("zod").ZodOptional<import("zod").ZodBoolean>;
105
- remoteComponents: import("zod").ZodOptional<import("zod").ZodBoolean>;
109
+ collaboration: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodObject<{
110
+ comments: import("zod").ZodOptional<import("zod").ZodBoolean>;
111
+ activityLog: import("zod").ZodOptional<import("zod").ZodBoolean>;
112
+ }, import("zod/v4/core").$strip>]>>;
106
113
  }, import("zod/v4/core").$strip>;
107
114
  }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
108
115
  id: import("zod").ZodString;
109
116
  }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
110
117
  src: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
111
- }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
112
- url: import("zod").ZodString;
113
118
  }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
114
119
  varName: import("zod").ZodString;
115
120
  value: import("zod").ZodString;
121
+ }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
122
+ token: import("zod").ZodOptional<import("zod").ZodString>;
123
+ repository: import("zod").ZodOptional<import("zod").ZodString>;
124
+ labels: import("zod").ZodOptional<import("zod").ZodString>;
116
125
  }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
117
126
  size: import("zod").ZodNumber;
118
127
  }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
@@ -123,6 +132,8 @@ export declare const definitions: (import("./index.js").ExtensionDefinitionModel
123
132
  "ddb+es": "ddb+es";
124
133
  "ddb+os": "ddb+os";
125
134
  }>;
135
+ }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
136
+ url: import("zod").ZodString;
126
137
  }, import("zod/v4/core").$strip>> | import("./index.js").ExtensionDefinitionModel<import("zod").ZodObject<{
127
138
  passphrase: import("zod").ZodString;
128
139
  salt: import("zod").ZodOptional<import("zod").ZodString>;
@@ -6,6 +6,7 @@ import { Telemetry } from "./Telemetry.js";
6
6
  import { EnvVar } from "./EnvVar.js";
7
7
  import { DatabaseSetup } from "./DatabaseSetup.js";
8
8
  import { FeatureFlags } from "./FeatureFlags.js";
9
+ import { BugReporter } from "./BugReporter.js";
9
10
  import { BuildParam } from "./ApiBuildParam.js";
10
11
  import { AdminBuildParam } from "./AdminBuildParam.js";
11
12
  import { AdminApiUrl } from "./AdminApiUrl.js";
@@ -26,6 +27,7 @@ const definitions = [
26
27
  ExtensionDefinitions.def,
27
28
  EnvVar.def,
28
29
  FeatureFlags.def,
30
+ BugReporter.def,
29
31
  AdminAfterBuild.def,
30
32
  AdminAfterDeploy.def,
31
33
  BeforeBuild.def,
@@ -63,6 +65,6 @@ const definitions = [
63
65
  Hashing.def
64
66
  ];
65
67
  export { Project } from "./Project.js";
66
- export { AdminAfterBuild, AdminAfterDeploy, AdminApiUrl, AdminBeforeBuild, AdminBeforeDeploy, AdminBeforeWatch, AdminBuildParam, AdminExtension, AdminStackOutputValue, AdminWebsocketsUrl, AfterBuild, AfterDeploy, ApiAfterBuild, ApiAfterDeploy, ApiBeforeBuild, ApiBeforeDeploy, ApiBeforeWatch, ApiExtension, ApiMaxBundleSize, ApiStackOutputValue, BeforeBuild, BeforeDeploy, BeforeWatch, BuildParam, CoreAfterBuild, CoreAfterDeploy, CoreBeforeBuild, CoreBeforeDeploy, CoreBeforeWatch, CoreStackOutputValue, DatabaseSetup, Encryption, EnvVar, ExtensionDefinitions, FeatureFlags, Hashing, ProductionEnvironments, ProjectDecorator, ProjectId, ProjectImplementation, PulumiResourceNamePrefix, Telemetry, definitions };
68
+ export { AdminAfterBuild, AdminAfterDeploy, AdminApiUrl, AdminBeforeBuild, AdminBeforeDeploy, AdminBeforeWatch, AdminBuildParam, AdminExtension, AdminStackOutputValue, AdminWebsocketsUrl, AfterBuild, AfterDeploy, ApiAfterBuild, ApiAfterDeploy, ApiBeforeBuild, ApiBeforeDeploy, ApiBeforeWatch, ApiExtension, ApiMaxBundleSize, ApiStackOutputValue, BeforeBuild, BeforeDeploy, BeforeWatch, BugReporter, BuildParam, CoreAfterBuild, CoreAfterDeploy, CoreBeforeBuild, CoreBeforeDeploy, CoreBeforeWatch, CoreStackOutputValue, DatabaseSetup, Encryption, EnvVar, ExtensionDefinitions, FeatureFlags, Hashing, ProductionEnvironments, ProjectDecorator, ProjectId, ProjectImplementation, PulumiResourceNamePrefix, Telemetry, definitions };
67
69
 
68
70
  //# sourceMappingURL=index.js.map