@webiny/project 0.0.0-unstable.df7a8bb475 → 0.0.0-unstable.e2758ee1cf

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 (112) hide show
  1. package/ProjectSdk.d.ts +1 -0
  2. package/ProjectSdk.js +4 -1
  3. package/ProjectSdk.js.map +1 -1
  4. package/abstractions/features/GetFeatureFlags.d.ts +8 -0
  5. package/abstractions/features/GetFeatureFlags.js +4 -0
  6. package/abstractions/features/GetFeatureFlags.js.map +1 -0
  7. package/abstractions/features/index.d.ts +1 -0
  8. package/abstractions/features/index.js +1 -0
  9. package/abstractions/features/index.js.map +1 -1
  10. package/abstractions/services/WatchedLambdaFunctionsService.d.ts +12 -7
  11. package/abstractions/services/WatchedLambdaFunctionsService.js.map +1 -1
  12. package/components/Wcp.d.ts +2 -0
  13. package/components/Wcp.js +8 -1
  14. package/components/Wcp.js.map +1 -1
  15. package/createProjectSdkContainer.js +4 -1
  16. package/createProjectSdkContainer.js.map +1 -1
  17. package/decorators/DeployAppClearWatchedLambdaFunctions.d.ts +3 -2
  18. package/decorators/DeployAppClearWatchedLambdaFunctions.js +11 -5
  19. package/decorators/DeployAppClearWatchedLambdaFunctions.js.map +1 -1
  20. package/decorators/DeployAppWithWatchedLambdaReplacement.d.ts +3 -2
  21. package/decorators/DeployAppWithWatchedLambdaReplacement.js +16 -7
  22. package/decorators/DeployAppWithWatchedLambdaReplacement.js.map +1 -1
  23. package/decorators/GetFeatureFlagsWithLicense.d.ts +13 -0
  24. package/decorators/GetFeatureFlagsWithLicense.js +71 -0
  25. package/decorators/GetFeatureFlagsWithLicense.js.map +1 -0
  26. package/decorators/index.d.ts +1 -0
  27. package/decorators/index.js +1 -0
  28. package/decorators/index.js.map +1 -1
  29. package/defineExtension/createExtensionReactComponent.js +2 -6
  30. package/defineExtension/createExtensionReactComponent.js.map +1 -1
  31. package/defineExtension/index.d.ts +0 -1
  32. package/defineExtension/index.js +0 -1
  33. package/defineExtension/index.js.map +1 -1
  34. package/defineExtension/zodTypes/zodSrcPath.d.ts +1 -0
  35. package/defineExtension/zodTypes/zodSrcPath.js +7 -14
  36. package/defineExtension/zodTypes/zodSrcPath.js.map +1 -1
  37. package/exports/infra/index.d.ts +1 -1
  38. package/exports/infra/index.js +1 -1
  39. package/exports/infra/index.js.map +1 -1
  40. package/extensions/AdminBuildParam.d.ts +11 -0
  41. package/extensions/AdminBuildParam.js +184 -0
  42. package/extensions/AdminBuildParam.js.map +1 -0
  43. package/extensions/AdminExtension.d.ts +11 -0
  44. package/extensions/AdminExtension.js +99 -0
  45. package/extensions/AdminExtension.js.map +1 -0
  46. package/extensions/ApiBuildParam.d.ts +11 -0
  47. package/extensions/ApiBuildParam.js +119 -0
  48. package/extensions/ApiBuildParam.js.map +1 -0
  49. package/extensions/ApiExtension.d.ts +11 -0
  50. package/{defineExtension/defineApiExtension.js → extensions/ApiExtension.js} +14 -22
  51. package/extensions/ApiExtension.js.map +1 -0
  52. package/extensions/FeatureFlags.d.ts +92 -0
  53. package/extensions/FeatureFlags.js +43 -0
  54. package/extensions/FeatureFlags.js.map +1 -0
  55. package/extensions/index.d.ts +109 -0
  56. package/extensions/index.js +12 -2
  57. package/extensions/index.js.map +1 -1
  58. package/features/GetFeatureFlags/GetFeatureFlags.d.ts +10 -0
  59. package/features/GetFeatureFlags/GetFeatureFlags.js +29 -0
  60. package/features/GetFeatureFlags/GetFeatureFlags.js.map +1 -0
  61. package/features/GetFeatureFlags/index.d.ts +1 -0
  62. package/features/GetFeatureFlags/index.js +3 -0
  63. package/features/GetFeatureFlags/index.js.map +1 -0
  64. package/features/Watch/Watch.js +1 -0
  65. package/features/Watch/Watch.js.map +1 -1
  66. package/features/Watch/replaceLambdaFunctions.d.ts +2 -1
  67. package/features/Watch/replaceLambdaFunctions.js +5 -1
  68. package/features/Watch/replaceLambdaFunctions.js.map +1 -1
  69. package/features/index.d.ts +1 -0
  70. package/features/index.js +1 -0
  71. package/features/index.js.map +1 -1
  72. package/index.d.ts +1 -0
  73. package/index.js +1 -0
  74. package/index.js.map +1 -1
  75. package/package.json +17 -16
  76. package/services/GetProjectConfigService/WcpProjectLicenseContext.d.ts +1 -0
  77. package/services/GetProjectConfigService/WcpProjectLicenseContext.js +2 -1
  78. package/services/GetProjectConfigService/WcpProjectLicenseContext.js.map +1 -1
  79. package/services/InitProjectSdkService/registerDecorators.js +2 -2
  80. package/services/InitProjectSdkService/registerDecorators.js.map +1 -1
  81. package/services/InitProjectSdkService/registerHooks.js +2 -2
  82. package/services/InitProjectSdkService/registerHooks.js.map +1 -1
  83. package/services/InitProjectSdkService/registerImplementations.js +2 -2
  84. package/services/InitProjectSdkService/registerImplementations.js.map +1 -1
  85. package/services/InitProjectSdkService/registerPulumiExtensions.js +2 -2
  86. package/services/InitProjectSdkService/registerPulumiExtensions.js.map +1 -1
  87. package/services/InstallExtensionService/InstallExtensionService.d.ts +1 -1
  88. package/services/InstallExtensionService/InstallExtensionService.js +3 -3
  89. package/services/InstallExtensionService/InstallExtensionService.js.map +1 -1
  90. package/services/InstallExtensionService/mergePackageJson.js +4 -4
  91. package/services/InstallExtensionService/mergePackageJson.js.map +1 -1
  92. package/services/ListAppLambdaFunctionsService/ListAppLambdaFunctionsService.js +1 -1
  93. package/services/ListAppLambdaFunctionsService/ListAppLambdaFunctionsService.js.map +1 -1
  94. package/services/SetProjectIdService/SetProjectIdService.js +28 -18
  95. package/services/SetProjectIdService/SetProjectIdService.js.map +1 -1
  96. package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.d.ts +4 -4
  97. package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js +26 -20
  98. package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js.map +1 -1
  99. package/utils/ExtensionSrcResolver.d.ts +33 -0
  100. package/utils/ExtensionSrcResolver.js +119 -0
  101. package/utils/ExtensionSrcResolver.js.map +1 -0
  102. package/utils/index.d.ts +1 -1
  103. package/utils/index.js +1 -1
  104. package/utils/index.js.map +1 -1
  105. package/defineExtension/defineApiExtension.d.ts +0 -17
  106. package/defineExtension/defineApiExtension.js.map +0 -1
  107. package/exports/extensions.d.ts +0 -1
  108. package/exports/extensions.js +0 -3
  109. package/exports/extensions.js.map +0 -1
  110. package/utils/ImplPathResolver.d.ts +0 -10
  111. package/utils/ImplPathResolver.js +0 -27
  112. package/utils/ImplPathResolver.js.map +0 -1
@@ -24,7 +24,8 @@ export const WcpProjectLicenseProvider = ({
24
24
  canUseTeams: () => license?.canUseTeams() ?? false,
25
25
  canUsePrivateFiles: () => license?.canUsePrivateFiles() ?? false,
26
26
  canUseFileManagerThreatDetection: () => license?.canUseFileManagerThreatDetection() ?? false,
27
- canUseWorkflows: () => license?.canUseWorkflows() ?? false
27
+ canUseWorkflows: () => license?.canUseWorkflows() ?? false,
28
+ canUseHcmsFieldPermissions: () => license?.canUseHcmsFieldPermissions() ?? false
28
29
  };
29
30
  return /*#__PURE__*/React.createElement(WcpProjectLicenseContext.Provider, {
30
31
  value: value
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","useContext","useMemo","License","WcpProjectLicenseContext","WcpProjectLicenseProvider","children","license","licenseEnv","process","env","WCP_PROJECT_LICENSE","licenseDto","JSON","parse","fromLicenseDto","e","console","warn","hasLicense","value","canUseMultiTenancy","canUseTeams","canUsePrivateFiles","canUseFileManagerThreatDetection","canUseWorkflows","createElement","Provider","useWcpProjectLicense","context","Error"],"sources":["WcpProjectLicenseContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo } from \"react\";\nimport { License } from \"@webiny/wcp\";\nimport type { DecryptedWcpProjectLicense } from \"@webiny/wcp/types.js\";\n\nexport interface WcpProjectLicenseContextValue {\n hasLicense: boolean;\n canUseMultiTenancy: () => boolean;\n canUseTeams: () => boolean;\n canUsePrivateFiles: () => boolean;\n canUseFileManagerThreatDetection: () => boolean;\n canUseWorkflows: () => boolean;\n}\n\nconst WcpProjectLicenseContext = createContext<WcpProjectLicenseContextValue | null>(null);\n\nexport const WcpProjectLicenseProvider: React.FC<{ children: React.ReactNode }> = ({\n children\n}) => {\n const license = useMemo(() => {\n const licenseEnv = process.env.WCP_PROJECT_LICENSE;\n if (!licenseEnv) {\n return null;\n }\n\n try {\n const licenseDto = JSON.parse(licenseEnv) as DecryptedWcpProjectLicense;\n return License.fromLicenseDto(licenseDto);\n } catch (e) {\n console.warn(\n \"Failed to parse WCP_PROJECT_LICENSE environment variable. Expected valid JSON with DecryptedWcpProjectLicense format:\",\n e\n );\n return null;\n }\n }, []);\n\n const hasLicense = !!license;\n\n const value: WcpProjectLicenseContextValue = {\n hasLicense,\n canUseMultiTenancy: () => hasLicense,\n canUseTeams: () => license?.canUseTeams() ?? false,\n canUsePrivateFiles: () => license?.canUsePrivateFiles() ?? false,\n canUseFileManagerThreatDetection: () =>\n license?.canUseFileManagerThreatDetection() ?? false,\n canUseWorkflows: () => license?.canUseWorkflows() ?? false\n };\n\n return (\n <WcpProjectLicenseContext.Provider value={value}>\n {children}\n </WcpProjectLicenseContext.Provider>\n );\n};\n\nexport const useWcpProjectLicense = () => {\n const context = useContext(WcpProjectLicenseContext);\n if (!context) {\n throw new Error(\"useWcpProjectLicense must be used within a WcpProjectLicenseProvider\");\n }\n return context;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AACjE,SAASC,OAAO,QAAQ,aAAa;AAYrC,MAAMC,wBAAwB,gBAAGJ,aAAa,CAAuC,IAAI,CAAC;AAE1F,OAAO,MAAMK,yBAAkE,GAAGA,CAAC;EAC/EC;AACJ,CAAC,KAAK;EACF,MAAMC,OAAO,GAAGL,OAAO,CAAC,MAAM;IAC1B,MAAMM,UAAU,GAAGC,OAAO,CAACC,GAAG,CAACC,mBAAmB;IAClD,IAAI,CAACH,UAAU,EAAE;MACb,OAAO,IAAI;IACf;IAEA,IAAI;MACA,MAAMI,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACN,UAAU,CAA+B;MACvE,OAAOL,OAAO,CAACY,cAAc,CAACH,UAAU,CAAC;IAC7C,CAAC,CAAC,OAAOI,CAAC,EAAE;MACRC,OAAO,CAACC,IAAI,CACR,uHAAuH,EACvHF,CACJ,CAAC;MACD,OAAO,IAAI;IACf;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMG,UAAU,GAAG,CAAC,CAACZ,OAAO;EAE5B,MAAMa,KAAoC,GAAG;IACzCD,UAAU;IACVE,kBAAkB,EAAEA,CAAA,KAAMF,UAAU;IACpCG,WAAW,EAAEA,CAAA,KAAMf,OAAO,EAAEe,WAAW,CAAC,CAAC,IAAI,KAAK;IAClDC,kBAAkB,EAAEA,CAAA,KAAMhB,OAAO,EAAEgB,kBAAkB,CAAC,CAAC,IAAI,KAAK;IAChEC,gCAAgC,EAAEA,CAAA,KAC9BjB,OAAO,EAAEiB,gCAAgC,CAAC,CAAC,IAAI,KAAK;IACxDC,eAAe,EAAEA,CAAA,KAAMlB,OAAO,EAAEkB,eAAe,CAAC,CAAC,IAAI;EACzD,CAAC;EAED,oBACI1B,KAAA,CAAA2B,aAAA,CAACtB,wBAAwB,CAACuB,QAAQ;IAACP,KAAK,EAAEA;EAAM,GAC3Cd,QAC8B,CAAC;AAE5C,CAAC;AAED,OAAO,MAAMsB,oBAAoB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAG5B,UAAU,CAACG,wBAAwB,CAAC;EACpD,IAAI,CAACyB,OAAO,EAAE;IACV,MAAM,IAAIC,KAAK,CAAC,sEAAsE,CAAC;EAC3F;EACA,OAAOD,OAAO;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","useContext","useMemo","License","WcpProjectLicenseContext","WcpProjectLicenseProvider","children","license","licenseEnv","process","env","WCP_PROJECT_LICENSE","licenseDto","JSON","parse","fromLicenseDto","e","console","warn","hasLicense","value","canUseMultiTenancy","canUseTeams","canUsePrivateFiles","canUseFileManagerThreatDetection","canUseWorkflows","canUseHcmsFieldPermissions","createElement","Provider","useWcpProjectLicense","context","Error"],"sources":["WcpProjectLicenseContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo } from \"react\";\nimport { License } from \"@webiny/wcp\";\nimport type { DecryptedWcpProjectLicense } from \"@webiny/wcp/types.js\";\n\nexport interface WcpProjectLicenseContextValue {\n hasLicense: boolean;\n canUseMultiTenancy: () => boolean;\n canUseTeams: () => boolean;\n canUsePrivateFiles: () => boolean;\n canUseFileManagerThreatDetection: () => boolean;\n canUseWorkflows: () => boolean;\n canUseHcmsFieldPermissions: () => boolean;\n}\n\nconst WcpProjectLicenseContext = createContext<WcpProjectLicenseContextValue | null>(null);\n\nexport const WcpProjectLicenseProvider: React.FC<{ children: React.ReactNode }> = ({\n children\n}) => {\n const license = useMemo(() => {\n const licenseEnv = process.env.WCP_PROJECT_LICENSE;\n if (!licenseEnv) {\n return null;\n }\n\n try {\n const licenseDto = JSON.parse(licenseEnv) as DecryptedWcpProjectLicense;\n return License.fromLicenseDto(licenseDto);\n } catch (e) {\n console.warn(\n \"Failed to parse WCP_PROJECT_LICENSE environment variable. Expected valid JSON with DecryptedWcpProjectLicense format:\",\n e\n );\n return null;\n }\n }, []);\n\n const hasLicense = !!license;\n\n const value: WcpProjectLicenseContextValue = {\n hasLicense,\n canUseMultiTenancy: () => hasLicense,\n canUseTeams: () => license?.canUseTeams() ?? false,\n canUsePrivateFiles: () => license?.canUsePrivateFiles() ?? false,\n canUseFileManagerThreatDetection: () =>\n license?.canUseFileManagerThreatDetection() ?? false,\n canUseWorkflows: () => license?.canUseWorkflows() ?? false,\n canUseHcmsFieldPermissions: () => license?.canUseHcmsFieldPermissions() ?? false\n };\n\n return (\n <WcpProjectLicenseContext.Provider value={value}>\n {children}\n </WcpProjectLicenseContext.Provider>\n );\n};\n\nexport const useWcpProjectLicense = () => {\n const context = useContext(WcpProjectLicenseContext);\n if (!context) {\n throw new Error(\"useWcpProjectLicense must be used within a WcpProjectL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C;EAED,oBACI3B,KAAA,CAAA4B,aAAA,CAACvB,wBAAwB,CAACwB,QAAQ;IAACR,KAAK,EAAEA;EAAM,GAC3Cd,QAC8B,CAAC;AAE5C,CAAC;AAED,OAAO,MAAMuB,oBAAoB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAG7B,UAAU,CAACG,wBAAwB,CAAC;EACpD,IAAI,CAAC0B,OAAO,EAAE;IACV,MAAM,IAAIC,KAAK,CAAC,sEAAsE,CAAC;EAC3F;EACA,OAAOD,OAAO;AAClB,CAAC","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import { ImplPathResolver } from "../../utils/index.js";
1
+ import { ExtensionSrcResolver } from "../../utils/index.js";
2
2
  import { ProjectDecorator as ProjectDecoratorExt } from "../../extensions/ProjectDecorator.js";
3
3
  export const registerDecorators = async (container, projectExtensions, project) => {
4
4
  const projectDecorators = [...projectExtensions.extensionsByType(ProjectDecoratorExt)];
5
5
  for (const projectDecorator of projectDecorators) {
6
- const projectDecoratorImpl = await ImplPathResolver.importFromPath(projectDecorator.params.src, project);
6
+ const projectDecoratorImpl = await ExtensionSrcResolver.importFromPath(projectDecorator.params.src, project);
7
7
  container.registerDecorator(projectDecoratorImpl);
8
8
  }
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"names":["ImplPathResolver","ProjectDecorator","ProjectDecoratorExt","registerDecorators","container","projectExtensions","project","projectDecorators","extensionsByType","projectDecorator","projectDecoratorImpl","importFromPath","params","src","registerDecorator"],"sources":["registerDecorators.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ImplPathResolver } from \"~/utils/index.js\";\nimport { ProjectDecorator as ProjectDecoratorExt } from \"~/extensions/ProjectDecorator.js\";\n\nexport const registerDecorators = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const projectDecorators = [...projectExtensions.extensionsByType(ProjectDecoratorExt)];\n\n for (const projectDecorator of projectDecorators) {\n const projectDecoratorImpl = await ImplPathResolver.importFromPath(\n projectDecorator.params.src,\n project\n );\n container.registerDecorator(projectDecoratorImpl);\n }\n};\n"],"mappings":"AAGA,SAASA,gBAAgB;AACzB,SAASC,gBAAgB,IAAIC,mBAAmB;AAEhD,OAAO,MAAMC,kBAAkB,GAAG,MAAAA,CAC9BC,SAAoB,EACpBC,iBAAsC,EACtCC,OAAsB,KACrB;EACD,MAAMC,iBAAiB,GAAG,CAAC,GAAGF,iBAAiB,CAACG,gBAAgB,CAACN,mBAAmB,CAAC,CAAC;EAEtF,KAAK,MAAMO,gBAAgB,IAAIF,iBAAiB,EAAE;IAC9C,MAAMG,oBAAoB,GAAG,MAAMV,gBAAgB,CAACW,cAAc,CAC9DF,gBAAgB,CAACG,MAAM,CAACC,GAAG,EAC3BP,OACJ,CAAC;IACDF,SAAS,CAACU,iBAAiB,CAACJ,oBAAoB,CAAC;EACrD;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ExtensionSrcResolver","ProjectDecorator","ProjectDecoratorExt","registerDecorators","container","projectExtensions","project","projectDecorators","extensionsByType","projectDecorator","projectDecoratorImpl","importFromPath","params","src","registerDecorator"],"sources":["registerDecorators.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ExtensionSrcResolver } from \"~/utils/index.js\";\nimport { ProjectDecorator as ProjectDecoratorExt } from \"~/extensions/ProjectDecorator.js\";\n\nexport const registerDecorators = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const projectDecorators = [...projectExtensions.extensionsByType(ProjectDecoratorExt)];\n\n for (const projectDecorator of projectDecorators) {\n const projectDecoratorImpl = await ExtensionSrcResolver.importFromPath(\n projectDecorator.params.src,\n project\n );\n container.registerDecorator(projectDecoratorImpl);\n }\n};\n"],"mappings":"AAGA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB,IAAIC,mBAAmB;AAEhD,OAAO,MAAMC,kBAAkB,GAAG,MAAAA,CAC9BC,SAAoB,EACpBC,iBAAsC,EACtCC,OAAsB,KACrB;EACD,MAAMC,iBAAiB,GAAG,CAAC,GAAGF,iBAAiB,CAACG,gBAAgB,CAACN,mBAAmB,CAAC,CAAC;EAEtF,KAAK,MAAMO,gBAAgB,IAAIF,iBAAiB,EAAE;IAC9C,MAAMG,oBAAoB,GAAG,MAAMV,oBAAoB,CAACW,cAAc,CAClEF,gBAAgB,CAACG,MAAM,CAACC,GAAG,EAC3BP,OACJ,CAAC;IACDF,SAAS,CAACU,iBAAiB,CAACJ,oBAAoB,CAAC;EACrD;AACJ,CAAC","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import { ImplPathResolver } from "../../utils/index.js";
1
+ import { ExtensionSrcResolver } from "../../utils/index.js";
2
2
  import { AdminAfterBuild as AdminAfterBuildExt, AdminAfterDeploy as AdminAfterDeployExt, AdminBeforeBuild as AdminBeforeBuildExt, AdminBeforeDeploy as AdminBeforeDeployExt, AdminBeforeWatch as AdminBeforeWatchExt, AfterBuild as AfterBuildExt, BeforeWatch as BeforeWatchExt, ApiAfterBuild as ApiAfterBuildExt, ApiAfterDeploy as ApiAfterDeployExt, ApiBeforeBuild as ApiBeforeBuildExt, ApiBeforeDeploy as ApiBeforeDeployExt, ApiBeforeWatch as ApiBeforeWatchExt, BeforeBuild as BeforeBuildExt, BeforeDeploy as BeforeDeployExt, AfterDeploy as AfterDeployExt, CoreAfterBuild as CoreAfterBuildExt, CoreAfterDeploy as CoreAfterDeployExt, CoreBeforeBuild as CoreBeforeBuildExt, CoreBeforeDeploy as CoreBeforeDeployExt, CoreBeforeWatch as CoreBeforeWatchExt } from "../../extensions/hooks/index.js";
3
3
  export const registerHooks = async (container, projectExtensions, project) => {
4
4
  const hooksExtensions = [...projectExtensions.extensionsByType(AdminAfterBuildExt), ...projectExtensions.extensionsByType(BeforeBuildExt), ...projectExtensions.extensionsByType(BeforeWatchExt), ...projectExtensions.extensionsByType(AfterBuildExt), ...projectExtensions.extensionsByType(BeforeDeployExt), ...projectExtensions.extensionsByType(AfterDeployExt), ...projectExtensions.extensionsByType(AdminBeforeBuildExt), ...projectExtensions.extensionsByType(AdminBeforeDeployExt), ...projectExtensions.extensionsByType(AdminBeforeWatchExt), ...projectExtensions.extensionsByType(AdminAfterBuildExt), ...projectExtensions.extensionsByType(AdminAfterDeployExt), ...projectExtensions.extensionsByType(ApiBeforeBuildExt), ...projectExtensions.extensionsByType(ApiBeforeDeployExt), ...projectExtensions.extensionsByType(ApiBeforeWatchExt), ...projectExtensions.extensionsByType(ApiAfterBuildExt), ...projectExtensions.extensionsByType(ApiAfterDeployExt), ...projectExtensions.extensionsByType(CoreBeforeBuildExt), ...projectExtensions.extensionsByType(CoreBeforeDeployExt), ...projectExtensions.extensionsByType(CoreBeforeWatchExt), ...projectExtensions.extensionsByType(CoreAfterBuildExt), ...projectExtensions.extensionsByType(CoreAfterDeployExt)];
5
5
  for (const hookExtension of hooksExtensions) {
6
- const hookImpl = await ImplPathResolver.importFromPath(hookExtension.params.src, project);
6
+ const hookImpl = await ExtensionSrcResolver.importFromPath(hookExtension.params.src, project);
7
7
  container.register(hookImpl).inSingletonScope();
8
8
  }
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"names":["ImplPathResolver","AdminAfterBuild","AdminAfterBuildExt","AdminAfterDeploy","AdminAfterDeployExt","AdminBeforeBuild","AdminBeforeBuildExt","AdminBeforeDeploy","AdminBeforeDeployExt","AdminBeforeWatch","AdminBeforeWatchExt","AfterBuild","AfterBuildExt","BeforeWatch","BeforeWatchExt","ApiAfterBuild","ApiAfterBuildExt","ApiAfterDeploy","ApiAfterDeployExt","ApiBeforeBuild","ApiBeforeBuildExt","ApiBeforeDeploy","ApiBeforeDeployExt","ApiBeforeWatch","ApiBeforeWatchExt","BeforeBuild","BeforeBuildExt","BeforeDeploy","BeforeDeployExt","AfterDeploy","AfterDeployExt","CoreAfterBuild","CoreAfterBuildExt","CoreAfterDeploy","CoreAfterDeployExt","CoreBeforeBuild","CoreBeforeBuildExt","CoreBeforeDeploy","CoreBeforeDeployExt","CoreBeforeWatch","CoreBeforeWatchExt","registerHooks","container","projectExtensions","project","hooksExtensions","extensionsByType","hookExtension","hookImpl","importFromPath","params","src","register","inSingletonScope"],"sources":["registerHooks.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ImplPathResolver } from \"~/utils/index.js\";\nimport {\n AdminAfterBuild as AdminAfterBuildExt,\n AdminAfterDeploy as AdminAfterDeployExt,\n AdminBeforeBuild as AdminBeforeBuildExt,\n AdminBeforeDeploy as AdminBeforeDeployExt,\n AdminBeforeWatch as AdminBeforeWatchExt,\n AfterBuild as AfterBuildExt,\n BeforeWatch as BeforeWatchExt,\n ApiAfterBuild as ApiAfterBuildExt,\n ApiAfterDeploy as ApiAfterDeployExt,\n ApiBeforeBuild as ApiBeforeBuildExt,\n ApiBeforeDeploy as ApiBeforeDeployExt,\n ApiBeforeWatch as ApiBeforeWatchExt,\n BeforeBuild as BeforeBuildExt,\n BeforeDeploy as BeforeDeployExt,\n AfterDeploy as AfterDeployExt,\n CoreAfterBuild as CoreAfterBuildExt,\n CoreAfterDeploy as CoreAfterDeployExt,\n CoreBeforeBuild as CoreBeforeBuildExt,\n CoreBeforeDeploy as CoreBeforeDeployExt,\n CoreBeforeWatch as CoreBeforeWatchExt\n} from \"~/extensions/hooks/index.js\";\n\nexport const registerHooks = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const hooksExtensions = [\n ...projectExtensions.extensionsByType(AdminAfterBuildExt),\n ...projectExtensions.extensionsByType(BeforeBuildExt),\n ...projectExtensions.extensionsByType(BeforeWatchExt),\n ...projectExtensions.extensionsByType(AfterBuildExt),\n ...projectExtensions.extensionsByType(BeforeDeployExt),\n ...projectExtensions.extensionsByType(AfterDeployExt),\n ...projectExtensions.extensionsByType(AdminBeforeBuildExt),\n ...projectExtensions.extensionsByType(AdminBeforeDeployExt),\n ...projectExtensions.extensionsByType(AdminBeforeWatchExt),\n ...projectExtensions.extensionsByType(AdminAfterBuildExt),\n ...projectExtensions.extensionsByType(AdminAfterDeployExt),\n ...projectExtensions.extensionsByType(ApiBeforeBuildExt),\n ...projectExtensions.extensionsByType(ApiBeforeDeployExt),\n ...projectExtensions.extensionsByType(ApiBeforeWatchExt),\n ...projectExtensions.extensionsByType(ApiAfterBuildExt),\n ...projectExtensions.extensionsByType(ApiAfterDeployExt),\n ...projectExtensions.extensionsByType(CoreBeforeBuildExt),\n ...projectExtensions.extensionsByType(CoreBeforeDeployExt),\n ...projectExtensions.extensionsByType(CoreBeforeWatchExt),\n ...projectExtensions.extensionsByType(CoreAfterBuildExt),\n ...projectExtensions.extensionsByType(CoreAfterDeployExt)\n ];\n\n for (const hookExtension of hooksExtensions) {\n const hookImpl = await ImplPathResolver.importFromPath(hookExtension.params.src, project);\n container.register(hookImpl).inSingletonScope();\n }\n};\n"],"mappings":"AAGA,SAASA,gBAAgB;AACzB,SACIC,eAAe,IAAIC,kBAAkB,EACrCC,gBAAgB,IAAIC,mBAAmB,EACvCC,gBAAgB,IAAIC,mBAAmB,EACvCC,iBAAiB,IAAIC,oBAAoB,EACzCC,gBAAgB,IAAIC,mBAAmB,EACvCC,UAAU,IAAIC,aAAa,EAC3BC,WAAW,IAAIC,cAAc,EAC7BC,aAAa,IAAIC,gBAAgB,EACjCC,cAAc,IAAIC,iBAAiB,EACnCC,cAAc,IAAIC,iBAAiB,EACnCC,eAAe,IAAIC,kBAAkB,EACrCC,cAAc,IAAIC,iBAAiB,EACnCC,WAAW,IAAIC,cAAc,EAC7BC,YAAY,IAAIC,eAAe,EAC/BC,WAAW,IAAIC,cAAc,EAC7BC,cAAc,I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AAkB,CAAC,EACzD,GAAGO,iBAAiB,CAACG,gBAAgB,CAACR,mBAAmB,CAAC,EAC1D,GAAGK,iBAAiB,CAACG,gBAAgB,CAACN,kBAAkB,CAAC,EACzD,GAAGG,iBAAiB,CAACG,gBAAgB,CAACd,iBAAiB,CAAC,EACxD,GAAGW,iBAAiB,CAACG,gBAAgB,CAACZ,kBAAkB,CAAC,CAC5D;EAED,KAAK,MAAMa,aAAa,IAAIF,eAAe,EAAE;IACzC,MAAMG,QAAQ,GAAG,MAAMhD,gBAAgB,CAACiD,cAAc,CAACF,aAAa,CAACG,MAAM,CAACC,GAAG,EAAEP,OAAO,CAAC;IACzFF,SAAS,CAACU,QAAQ,CAACJ,QAAQ,CAAC,CAACK,gBAAgB,CAAC,CAAC;EACnD;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ExtensionSrcResolver","AdminAfterBuild","AdminAfterBuildExt","AdminAfterDeploy","AdminAfterDeployExt","AdminBeforeBuild","AdminBeforeBuildExt","AdminBeforeDeploy","AdminBeforeDeployExt","AdminBeforeWatch","AdminBeforeWatchExt","AfterBuild","AfterBuildExt","BeforeWatch","BeforeWatchExt","ApiAfterBuild","ApiAfterBuildExt","ApiAfterDeploy","ApiAfterDeployExt","ApiBeforeBuild","ApiBeforeBuildExt","ApiBeforeDeploy","ApiBeforeDeployExt","ApiBeforeWatch","ApiBeforeWatchExt","BeforeBuild","BeforeBuildExt","BeforeDeploy","BeforeDeployExt","AfterDeploy","AfterDeployExt","CoreAfterBuild","CoreAfterBuildExt","CoreAfterDeploy","CoreAfterDeployExt","CoreBeforeBuild","CoreBeforeBuildExt","CoreBeforeDeploy","CoreBeforeDeployExt","CoreBeforeWatch","CoreBeforeWatchExt","registerHooks","container","projectExtensions","project","hooksExtensions","extensionsByType","hookExtension","hookImpl","importFromPath","params","src","register","inSingletonScope"],"sources":["registerHooks.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ExtensionSrcResolver } from \"~/utils/index.js\";\nimport {\n AdminAfterBuild as AdminAfterBuildExt,\n AdminAfterDeploy as AdminAfterDeployExt,\n AdminBeforeBuild as AdminBeforeBuildExt,\n AdminBeforeDeploy as AdminBeforeDeployExt,\n AdminBeforeWatch as AdminBeforeWatchExt,\n AfterBuild as AfterBuildExt,\n BeforeWatch as BeforeWatchExt,\n ApiAfterBuild as ApiAfterBuildExt,\n ApiAfterDeploy as ApiAfterDeployExt,\n ApiBeforeBuild as ApiBeforeBuildExt,\n ApiBeforeDeploy as ApiBeforeDeployExt,\n ApiBeforeWatch as ApiBeforeWatchExt,\n BeforeBuild as BeforeBuildExt,\n BeforeDeploy as BeforeDeployExt,\n AfterDeploy as AfterDeployExt,\n CoreAfterBuild as CoreAfterBuildExt,\n CoreAfterDeploy as CoreAfterDeployExt,\n CoreBeforeBuild as CoreBeforeBuildExt,\n CoreBeforeDeploy as CoreBeforeDeployExt,\n CoreBeforeWatch as CoreBeforeWatchExt\n} from \"~/extensions/hooks/index.js\";\n\nexport const registerHooks = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const hooksExtensions = [\n ...projectExtensions.extensionsByType(AdminAfterBuildExt),\n ...projectExtensions.extensionsByType(BeforeBuildExt),\n ...projectExtensions.extensionsByType(BeforeWatchExt),\n ...projectExtensions.extensionsByType(AfterBuildExt),\n ...projectExtensions.extensionsByType(BeforeDeployExt),\n ...projectExtensions.extensionsByType(AfterDeployExt),\n ...projectExtensions.extensionsByType(AdminBeforeBuildExt),\n ...projectExtensions.extensionsByType(AdminBeforeDeployExt),\n ...projectExtensions.extensionsByType(AdminBeforeWatchExt),\n ...projectExtensions.extensionsByType(AdminAfterBuildExt),\n ...projectExtensions.extensionsByType(AdminAfterDeployExt),\n ...projectExtensions.extensionsByType(ApiBeforeBuildExt),\n ...projectExtensions.extensionsByType(ApiBeforeDeployExt),\n ...projectExtensions.extensionsByType(ApiBeforeWatchExt),\n ...projectExtensions.extensionsByType(ApiAfterBuildExt),\n ...projectExtensions.extensionsByType(ApiAfterDeployExt),\n ...projectExtensions.extensionsByType(CoreBeforeBuildExt),\n ...projectExtensions.extensionsByType(CoreBeforeDeployExt),\n ...projectExtensions.extensionsByType(CoreBeforeWatchExt),\n ...projectExtensions.extensionsByType(CoreAfterBuildExt),\n ...projectExtensions.extensionsByType(CoreAfterDeployExt)\n ];\n\n for (const hookExtension of hooksExtensions) {\n const hookImpl = await ExtensionSrcResolver.importFromPath(\n hookExtension.params.src,\n project\n );\n container.register(hookImpl).inSingletonScope();\n }\n};\n"],"mappings":"AAGA,SAASA,oBAAoB;AAC7B,SACIC,eAAe,IAAIC,kBAAkB,EACrCC,gBAAgB,IAAIC,mBAAmB,EACvCC,gBAAgB,IAAIC,mBAAmB,EACvCC,iBAAiB,IAAIC,oBAAoB,EACzCC,gBAAgB,IAAIC,mBAAmB,EACvCC,UAAU,IAAIC,aAAa,EAC3BC,WAAW,IAAIC,cAAc,EAC7BC,aAAa,IAAIC,gBAAgB,EACjCC,cAAc,IAAIC,iBAAiB,EACnCC,cAAc,IAAIC,iBAAiB,EACnCC,eAAe,IAAIC,kBAAkB,EACrCC,cAAc,IAAIC,iBAAiB,EACnCC,WAAW,IAAIC,cAAc,EAC7BC,YAAY,IAAIC,eAAe,EAC/BC,WAAW,IAAIC,cAAc,EAC7BC,cAAc,IAAIC,iBAAiB,EACnCC,eAAe,IAAIC,kBAAkB,EACrCC,eAAe,IAAIC,kBAAkB,EACrCC,gBAAgB,IAAIC,mBAAmB,EACvCC,eAAe,IAAIC,kBAAkB;AAGzC,OAAO,MAAMC,aAAa,GAAG,MAAAA,CACzBC,SAAoB,EACpBC,iBAAsC,EACtCC,OAAsB,KACrB;EACD,MAAMC,eAAe,GAAG,CACpB,GAAGF,iBAAiB,CAACG,gBAAgB,CAAC5C,kBAAkB,CAAC,EACzD,GAAGyC,iBAAiB,CAACG,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CAACiD,cAAc,CACtDF,aAAa,CAACG,MAAM,CAACC,GAAG,EACxBP,OACJ,CAAC;IACDF,SAAS,CAACU,QAAQ,CAACJ,QAAQ,CAAC,CAACK,gBAAgB,CAAC,CAAC;EACnD;AACJ,CAAC","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import { ImplPathResolver } from "../../utils/index.js";
1
+ import { ExtensionSrcResolver } from "../../utils/index.js";
2
2
  import { ProjectImplementation as ProjectImplementationExt } from "../../extensions/ProjectImplementation.js";
3
3
  export const registerImplementations = async (container, projectExtensions, project) => {
4
4
  const projectImplementations = [...projectExtensions.extensionsByType(ProjectImplementationExt)];
5
5
  for (const projectImplementation of projectImplementations) {
6
- const projectImplementationImpl = await ImplPathResolver.importFromPath(projectImplementation.params.src, project);
6
+ const projectImplementationImpl = await ExtensionSrcResolver.importFromPath(projectImplementation.params.src, project);
7
7
  const binding = container.register(projectImplementationImpl);
8
8
 
9
9
  // Apply singleton scope if specified (defaults to true)
@@ -1 +1 @@
1
- {"version":3,"names":["ImplPathResolver","ProjectImplementation","ProjectImplementationExt","registerImplementations","container","projectExtensions","project","projectImplementations","extensionsByType","projectImplementation","projectImplementationImpl","importFromPath","params","src","binding","register","singleton","inSingletonScope"],"sources":["registerImplementations.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ImplPathResolver } from \"~/utils/index.js\";\nimport { ProjectImplementation as ProjectImplementationExt } from \"~/extensions/ProjectImplementation.js\";\n\nexport const registerImplementations = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const projectImplementations = [\n ...projectExtensions.extensionsByType(ProjectImplementationExt)\n ];\n\n for (const projectImplementation of projectImplementations) {\n const projectImplementationImpl = await ImplPathResolver.importFromPath(\n projectImplementation.params.src,\n project\n );\n const binding = container.register(projectImplementationImpl);\n\n // Apply singleton scope if specified (defaults to true)\n if (projectImplementation.params.singleton) {\n binding.inSingletonScope();\n }\n }\n};\n"],"mappings":"AAGA,SAASA,gBAAgB;AACzB,SAASC,qBAAqB,IAAIC,wBAAwB;AAE1D,OAAO,MAAMC,uBAAuB,GAAG,MAAAA,CACnCC,SAAoB,EACpBC,iBAAsC,EACtCC,OAAsB,KACrB;EACD,MAAMC,sBAAsB,GAAG,CAC3B,GAAGF,iBAAiB,CAACG,gBAAgB,CAACN,wBAAwB,CAAC,CAClE;EAED,KAAK,MAAMO,qBAAqB,IAAIF,sBAAsB,EAAE;IACxD,MAAMG,yBAAyB,GAAG,MAAMV,gBAAgB,CAACW,cAAc,CACnEF,qBAAqB,CAACG,MAAM,CAACC,GAAG,EAChCP,OACJ,CAAC;IACD,MAAMQ,OAAO,GAAGV,SAAS,CAACW,QAAQ,CAACL,yBAAyB,CAAC;;IAE7D;IACA,IAAID,qBAAqB,CAACG,MAAM,CAACI,SAAS,EAAE;MACxCF,OAAO,CAACG,gBAAgB,CAAC,CAAC;IAC9B;EACJ;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ExtensionSrcResolver","ProjectImplementation","ProjectImplementationExt","registerImplementations","container","projectExtensions","project","projectImplementations","extensionsByType","projectImplementation","projectImplementationImpl","importFromPath","params","src","binding","register","singleton","inSingletonScope"],"sources":["registerImplementations.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ExtensionSrcResolver } from \"~/utils/index.js\";\nimport { ProjectImplementation as ProjectImplementationExt } from \"~/extensions/ProjectImplementation.js\";\n\nexport const registerImplementations = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const projectImplementations = [\n ...projectExtensions.extensionsByType(ProjectImplementationExt)\n ];\n\n for (const projectImplementation of projectImplementations) {\n const projectImplementationImpl = await ExtensionSrcResolver.importFromPath(\n projectImplementation.params.src,\n project\n );\n const binding = container.register(projectImplementationImpl);\n\n // Apply singleton scope if specified (defaults to true)\n if (projectImplementation.params.singleton) {\n binding.inSingletonScope();\n }\n }\n};\n"],"mappings":"AAGA,SAASA,oBAAoB;AAC7B,SAASC,qBAAqB,IAAIC,wBAAwB;AAE1D,OAAO,MAAMC,uBAAuB,GAAG,MAAAA,CACnCC,SAAoB,EACpBC,iBAAsC,EACtCC,OAAsB,KACrB;EACD,MAAMC,sBAAsB,GAAG,CAC3B,GAAGF,iBAAiB,CAACG,gBAAgB,CAACN,wBAAwB,CAAC,CAClE;EAED,KAAK,MAAMO,qBAAqB,IAAIF,sBAAsB,EAAE;IACxD,MAAMG,yBAAyB,GAAG,MAAMV,oBAAoB,CAACW,cAAc,CACvEF,qBAAqB,CAACG,MAAM,CAACC,GAAG,EAChCP,OACJ,CAAC;IACD,MAAMQ,OAAO,GAAGV,SAAS,CAACW,QAAQ,CAACL,yBAAyB,CAAC;;IAE7D;IACA,IAAID,qBAAqB,CAACG,MAAM,CAACI,SAAS,EAAE;MACxCF,OAAO,CAACG,gBAAgB,CAAC,CAAC;IAC9B;EACJ;AACJ,CAAC","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import { ImplPathResolver } from "../../utils/index.js";
1
+ import { ExtensionSrcResolver } from "../../utils/index.js";
2
2
  import { CorePulumi as CorePulumiExt, ApiPulumi as ApiPulumiExt, AdminPulumi as AdminPulumiExt } from "../../extensions/pulumi/index.js";
3
3
  export const registerPulumiExtensions = async (container, projectExtensions, project) => {
4
4
  const pulumiExtensions = [...projectExtensions.extensionsByType(CorePulumiExt), ...projectExtensions.extensionsByType(ApiPulumiExt), ...projectExtensions.extensionsByType(AdminPulumiExt)];
5
5
  for (const pulumiExtension of pulumiExtensions) {
6
- const pulumiImpl = await ImplPathResolver.importFromPath(pulumiExtension.params.src, project);
6
+ const pulumiImpl = await ExtensionSrcResolver.importFromPath(pulumiExtension.params.src, project);
7
7
  container.register(pulumiImpl).inSingletonScope();
8
8
  }
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"names":["ImplPathResolver","CorePulumi","CorePulumiExt","ApiPulumi","ApiPulumiExt","AdminPulumi","AdminPulumiExt","registerPulumiExtensions","container","projectExtensions","project","pulumiExtensions","extensionsByType","pulumiExtension","pulumiImpl","importFromPath","params","src","register","inSingletonScope"],"sources":["registerPulumiExtensions.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ImplPathResolver } from \"~/utils/index.js\";\nimport {\n CorePulumi as CorePulumiExt,\n ApiPulumi as ApiPulumiExt,\n AdminPulumi as AdminPulumiExt\n} from \"~/extensions/pulumi/index.js\";\n\nexport const registerPulumiExtensions = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const pulumiExtensions = [\n ...projectExtensions.extensionsByType(CorePulumiExt),\n ...projectExtensions.extensionsByType(ApiPulumiExt),\n ...projectExtensions.extensionsByType(AdminPulumiExt)\n ];\n\n for (const pulumiExtension of pulumiExtensions) {\n const pulumiImpl = await ImplPathResolver.importFromPath(\n pulumiExtension.params.src,\n project\n );\n container.register(pulumiImpl).inSingletonScope();\n }\n};\n"],"mappings":"AAGA,SAASA,gBAAgB;AACzB,SACIC,UAAU,IAAIC,aAAa,EAC3BC,SAAS,IAAIC,YAAY,EACzBC,WAAW,IAAIC,cAAc;AAGjC,OAAO,MAAMC,wBAAwB,GAAG,MAAAA,CACpCC,SAAoB,EACpBC,iBAAsC,EACtCC,OAAsB,KACrB;EACD,MAAMC,gBAAgB,GAAG,CACrB,GAAGF,iBAAiB,CAACG,gBAAgB,CAACV,aAAa,CAAC,EACpD,GAAGO,iBAAiB,CAACG,gBAAgB,CAACR,YAAY,CAAC,EACnD,GAAGK,iBAAiB,CAACG,gBAAgB,CAACN,cAAc,CAAC,CACxD;EAED,KAAK,MAAMO,eAAe,IAAIF,gBAAgB,EAAE;IAC5C,MAAMG,UAAU,GAAG,MAAMd,gBAAgB,CAACe,cAAc,CACpDF,eAAe,CAACG,MAAM,CAACC,GAAG,EAC1BP,OACJ,CAAC;IACDF,SAAS,CAACU,QAAQ,CAACJ,UAAU,CAAC,CAACK,gBAAgB,CAAC,CAAC;EACrD;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ExtensionSrcResolver","CorePulumi","CorePulumiExt","ApiPulumi","ApiPulumiExt","AdminPulumi","AdminPulumiExt","registerPulumiExtensions","container","projectExtensions","project","pulumiExtensions","extensionsByType","pulumiExtension","pulumiImpl","importFromPath","params","src","register","inSingletonScope"],"sources":["registerPulumiExtensions.ts"],"sourcesContent":["import { type IProjectModel } from \"~/abstractions/models/index.js\";\nimport { type IProjectConfigModel } from \"~/abstractions/models/index.js\";\nimport { Container } from \"@webiny/di\";\nimport { ExtensionSrcResolver } from \"~/utils/index.js\";\nimport {\n CorePulumi as CorePulumiExt,\n ApiPulumi as ApiPulumiExt,\n AdminPulumi as AdminPulumiExt\n} from \"~/extensions/pulumi/index.js\";\n\nexport const registerPulumiExtensions = async (\n container: Container,\n projectExtensions: IProjectConfigModel,\n project: IProjectModel\n) => {\n const pulumiExtensions = [\n ...projectExtensions.extensionsByType(CorePulumiExt),\n ...projectExtensions.extensionsByType(ApiPulumiExt),\n ...projectExtensions.extensionsByType(AdminPulumiExt)\n ];\n\n for (const pulumiExtension of pulumiExtensions) {\n const pulumiImpl = await ExtensionSrcResolver.importFromPath(\n pulumiExtension.params.src,\n project\n );\n container.register(pulumiImpl).inSingletonScope();\n }\n};\n"],"mappings":"AAGA,SAASA,oBAAoB;AAC7B,SACIC,UAAU,IAAIC,aAAa,EAC3BC,SAAS,IAAIC,YAAY,EACzBC,WAAW,IAAIC,cAAc;AAGjC,OAAO,MAAMC,wBAAwB,GAAG,MAAAA,CACpCC,SAAoB,EACpBC,iBAAsC,EACtCC,OAAsB,KACrB;EACD,MAAMC,gBAAgB,GAAG,CACrB,GAAGF,iBAAiB,CAACG,gBAAgB,CAACV,aAAa,CAAC,EACpD,GAAGO,iBAAiB,CAACG,gBAAgB,CAACR,YAAY,CAAC,EACnD,GAAGK,iBAAiB,CAACG,gBAAgB,CAACN,cAAc,CAAC,CACxD;EAED,KAAK,MAAMO,eAAe,IAAIF,gBAAgB,EAAE;IAC5C,MAAMG,UAAU,GAAG,MAAMd,oBAAoB,CAACe,cAAc,CACxDF,eAAe,CAACG,MAAM,CAACC,GAAG,EAC1BP,OACJ,CAAC;IACDF,SAAS,CAACU,QAAQ,CAACJ,UAAU,CAAC,CAACK,gBAAgB,CAAC,CAAC;EACrD;AACJ,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { InstallExtensionService, GetProjectVersionService, GetProjectService } from "../../abstractions/index.js";
1
+ import { GetProjectService, GetProjectVersionService, InstallExtensionService } from "../../abstractions/index.js";
2
2
  declare class DefaultInstallExtensionService implements InstallExtensionService.Interface {
3
3
  private getProjectVersion;
4
4
  private getProject;
@@ -2,9 +2,9 @@ import os from "os";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
4
  import fsAsync from "fs/promises";
5
- import loadJsonFile from "load-json-file";
5
+ import { loadJsonFileSync } from "load-json-file";
6
6
  import { createImplementation } from "@webiny/di";
7
- import { InstallExtensionService, GetProjectVersionService, GetProjectService } from "../../abstractions/index.js";
7
+ import { GetProjectService, GetProjectVersionService, InstallExtensionService } from "../../abstractions/index.js";
8
8
  import { downloadFolderFromS3 } from "./downloadFolderFromS3.js";
9
9
  import { mergePackageJson } from "./mergePackageJson.js";
10
10
  import { updateWebinyConfig } from "./updateWebinyConfig.js";
@@ -85,7 +85,7 @@ class DefaultInstallExtensionService {
85
85
 
86
86
  // Read and parse extension.json.
87
87
  const extensionJsonExists = fs.existsSync(extensionJsonPath);
88
- const extensionJson = extensionJsonExists ? await loadJsonFile(extensionJsonPath) : {
88
+ const extensionJson = extensionJsonExists ? loadJsonFileSync(extensionJsonPath) : {
89
89
  name: "unknown",
90
90
  type: "admin"
91
91
  };
@@ -1 +1 @@
1
- {"version":3,"names":["os","path","fs","fsAsync","loadJsonFile","createImplementation","InstallExtensionService","GetProjectVersionService","GetProjectService","downloadFolderFromS3","mergePackageJson","updateWebinyConfig","EXTENSIONS_ROOT_FOLDER","S3_BUCKET_NAME","S3_BUCKET_REGION","FOLDER_NAME_IS_VERSION_REGEX","WEBINY_DEV_VERSION","getVersionFromVersionFolders","versionFoldersList","currentWebinyVersion","availableVersions","filter","v","match","map","replace","sort","versionToUse","startsWith","length","availableVersion","DefaultInstallExtensionService","constructor","getProjectVersion","getProject","execute","source","project","projectRoot","paths","rootFolder","toString","randomId","String","Date","now","downloadFolderPath","join","tmpdir","isLocalPath","resolvedPath","isAbsolute","resolve","cp","recursive","bucketName","bucketRegion","bucketFolderKey","extensionsFolderToCopyPath","extensionJsonPath","extensionsFolderExistsInRoot","existsSync","versionedExtension","versionFolders","readdir","subExtensionJsonPath","extensionJsonExists","extensionJson","name","type","targetExtensionsFolder","mkdirSync","extensionsFolderNames","extensionPaths","packageJson","Object","keys","extensionPackageJson","webinyConfigTsx","nextSteps","messages","additionalNotes","extensionName","installExtensionService","abstraction","implementation","dependencies"],"sources":["InstallExtensionService.ts"],"sourcesContent":["import os from \"os\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport fsAsync from \"fs/promises\";\nimport loadJsonFile from \"load-json-file\";\nimport { createImplementation } from \"@webiny/di\";\nimport {\n InstallExtensionService,\n GetProjectVersionService,\n GetProjectService\n} from \"~/abstractions/index.js\";\nimport { downloadFolderFromS3 } from \"./downloadFolderFromS3.js\";\nimport { mergePackageJson } from \"./mergePackageJson.js\";\nimport { updateWebinyConfig } from \"./updateWebinyConfig.js\";\nimport type { ExtensionJson } from \"./types.js\";\n\nconst EXTENSIONS_ROOT_FOLDER = \"extensions\";\nconst S3_BUCKET_NAME = \"webiny-examples\";\nconst S3_BUCKET_REGION = \"us-east-1\";\nconst FOLDER_NAME_IS_VERSION_REGEX = /^\\d+\\.\\d+\\.x$/;\nconst WEBINY_DEV_VERSION = \"0.0.0\";\n\nconst getVersionFromVersionFolders = async (\n versionFoldersList: string[],\n currentWebinyVersion: string\n) => {\n const availableVersions = versionFoldersList\n .filter(v => v.match(FOLDER_NAME_IS_VERSION_REGEX))\n .map(v => v.replace(/\\.x$/, \".0\"))\n .sort();\n\n let versionToUse = \"\";\n\n // When developing Webiny, we want to use the latest version.\n if (currentWebinyVersion.startsWith(WEBINY_DEV_VERSION)) {\n versionToUse = availableVersions[availableVersions.length - 1];\n } else {\n for (const availableVersion of availableVersions) {\n if (currentWebinyVersion >= availableVersion) {\n versionToUse = availableVersion;\n } else {\n break;\n }\n }\n }\n\n return versionToUse.replace(/\\.0$/, \".x\");\n};\n\nclass DefaultInstallExtensionService implements InstallExtensionService.Interface {\n constructor(\n private getProjectVersion: GetProjectVersionService.Interface,\n private getProject: GetProjectService.Interface\n ) {}\n\n async execute(source: string): Promise<InstallExtensionService.Result> {\n const currentWebinyVersion = this.getProjectVersion.execute();\n const project = this.getProject.execute();\n const projectRoot = project.paths.rootFolder.toString();\n\n const randomId = String(Date.now());\n const downloadFolderPath = path.join(os.tmpdir(), `wby-ext-${randomId}`);\n\n // Check if source is a local path\n const isLocalPath =\n source.startsWith(\"../\") || source.startsWith(\"./\") || source.startsWith(\"/\");\n\n if (isLocalPath) {\n // Resolve the local path relative to the project root\n const resolvedPath = path.isAbsolute(source)\n ? source\n : path.resolve(projectRoot, source);\n\n // Copy the local directory to the temporary download folder\n await fsAsync.cp(resolvedPath, downloadFolderPath, {\n recursive: true\n });\n } else {\n // Download from S3\n await downloadFolderFromS3({\n bucketName: S3_BUCKET_NAME,\n bucketRegion: S3_BUCKET_REGION,\n bucketFolderKey: source,\n downloadFolderPath\n });\n }\n\n let extensionsFolderToCopyPath = path.join(downloadFolderPath, \"extensions\");\n let extensionJsonPath = path.join(downloadFolderPath, \"extension.json\");\n\n // If we have `extensions` folder in the root of the downloaded extension,\n // it means the extension is not versioned, and we can just copy it.\n const extensionsFolderExistsInRoot = fs.existsSync(extensionsFolderToCopyPath);\n const versionedExtension = !extensionsFolderExistsInRoot;\n\n if (versionedExtension) {\n // If we have `x.x.x` folders in the root of the downloaded\n // extension, we need to find the right version to use.\n\n // This can be `5.40.x`, `6.0.x`, etc.\n const versionFolders = await fsAsync.readdir(downloadFolderPath);\n\n const versionToUse = await getVersionFromVersionFolders(\n versionFolders,\n currentWebinyVersion\n );\n\n extensionsFolderToCopyPath = path.join(downloadFolderPath, versionToUse, \"extensions\");\n const subExtensionJsonPath = path.join(\n downloadFolderPath,\n versionToUse,\n \"extension.json\"\n );\n if (fs.existsSync(subExtensionJsonPath)) {\n extensionJsonPath = subExtensionJsonPath;\n }\n }\n\n // Read and parse extension.json.\n const extensionJsonExists = fs.existsSync(extensionJsonPath);\n const extensionJson: ExtensionJson = extensionJsonExists\n ? await loadJsonFile(extensionJsonPath)\n : { name: \"unknown\", type: \"admin\" };\n\n // Ensure the extensions root folder exists.\n const targetExtensionsFolder = path.join(projectRoot, EXTENSIONS_ROOT_FOLDER);\n if (!fs.existsSync(targetExtensionsFolder)) {\n fs.mkdirSync(targetExtensionsFolder, { recursive: true });\n }\n\n // Copy the extensions folder contents.\n await fsAsync.cp(extensionsFolderToCopyPath, targetExtensionsFolder, {\n recursive: true\n });\n\n // Get the list of extensions that were copied.\n const extensionsFolderNames = await fsAsync.readdir(extensionsFolderToCopyPath);\n const extensionPaths = extensionsFolderNames.map(name =>\n path.join(EXTENSIONS_ROOT_FOLDER, name)\n );\n\n // Merge package.json if provided.\n if (extensionJson.packageJson && Object.keys(extensionJson.packageJson).length > 0) {\n await mergePackageJson({\n projectRoot,\n extensionPackageJson: extensionJson.packageJson\n });\n }\n\n // Update webiny.config.tsx if provided.\n if (extensionJson.webinyConfigTsx) {\n await updateWebinyConfig({\n projectRoot,\n webinyConfigTsx: extensionJson.webinyConfigTsx\n });\n }\n\n // Extract next steps and additional notes.\n const nextSteps = extensionJson.nextSteps?.messages || [];\n const additionalNotes = extensionJson.additionalNotes?.messages || [];\n\n return {\n extensionName: extensionJson.name,\n extensionPaths,\n nextSteps,\n additionalNotes\n };\n }\n}\n\nexport const installExtensionService = createImplementation({\n abstraction: InstallExtensionService,\n implementation: DefaultInstallExtensionService,\n dependencies: [GetProjectVersionService, GetProjectService]\n});\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,OAAO,MAAM,aAAa;AACjC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SACIC,uBAAuB,EACvBC,wBAAwB,EACxBC,iBAAiB;AAErB,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,kBAAkB;AAG3B,MAAMC,sBAAsB,GAAG,YAAY;AAC3C,MAAMC,cAAc,GAAG,iBAAiB;AACxC,MAAMC,gBAAgB,GAAG,WAAW;AACpC,MAAMC,4BAA4B,GAAG,eAAe;AACpD,MAAMC,kBAAkB,GAAG,OAAO;AAElC,MAAMC,4BAA4B,GAAG,MAAAA,CACjCC,kBAA4B,EAC5BC,oBAA4B,KAC3B;EACD,MAAMC,iBAAiB,GAAGF,kBAAkB,CACvCG,MAAM,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAACR,4BAA4B,CAAC,CAAC,CAClDS,GAAG,CAACF,CAAC,IAAIA,CAAC,CAACG,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CACjCC,IAAI,CAAC,CAAC;EAEX,IAAIC,YAAY,GAAG,EAAE;;EAErB;EACA,IAAIR,oBAAoB,CAACS,UAAU,CAACZ,kBAAkB,CAAC,EAAE;IACrDW,YAAY,GAAGP,iBAAiB,CAACA,iBAAiB,CAACS,MAAM,GAAG,CAAC,CAAC;EAClE,CAAC,MAAM;IACH,KAAK,MAAMC,gBAAgB,IAAIV,iBAAiB,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WAAW,EAAE9E,uBAAuB;EACpC+E,cAAc,EAAEtD,8BAA8B;EAC9CuD,YAAY,EAAE,CAAC/E,wBAAwB,EAAEC,iBAAiB;AAC9D,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["os","path","fs","fsAsync","loadJsonFileSync","createImplementation","GetProjectService","GetProjectVersionService","InstallExtensionService","downloadFolderFromS3","mergePackageJson","updateWebinyConfig","EXTENSIONS_ROOT_FOLDER","S3_BUCKET_NAME","S3_BUCKET_REGION","FOLDER_NAME_IS_VERSION_REGEX","WEBINY_DEV_VERSION","getVersionFromVersionFolders","versionFoldersList","currentWebinyVersion","availableVersions","filter","v","match","map","replace","sort","versionToUse","startsWith","length","availableVersion","DefaultInstallExtensionService","constructor","getProjectVersion","getProject","execute","source","project","projectRoot","paths","rootFolder","toString","randomId","String","Date","now","downloadFolderPath","join","tmpdir","isLocalPath","resolvedPath","isAbsolute","resolve","cp","recursive","bucketName","bucketRegion","bucketFolderKey","extensionsFolderToCopyPath","extensionJsonPath","extensionsFolderExistsInRoot","existsSync","versionedExtension","versionFolders","readdir","subExtensionJsonPath","extensionJsonExists","extensionJson","name","type","targetExtensionsFolder","mkdirSync","extensionsFolderNames","extensionPaths","packageJson","Object","keys","extensionPackageJson","webinyConfigTsx","nextSteps","messages","additionalNotes","extensionName","installExtensionService","abstraction","implementation","dependencies"],"sources":["InstallExtensionService.ts"],"sourcesContent":["import os from \"os\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport fsAsync from \"fs/promises\";\nimport { loadJsonFileSync } from \"load-json-file\";\nimport { createImplementation } from \"@webiny/di\";\nimport {\n GetProjectService,\n GetProjectVersionService,\n InstallExtensionService\n} from \"~/abstractions/index.js\";\nimport { downloadFolderFromS3 } from \"./downloadFolderFromS3.js\";\nimport { mergePackageJson } from \"./mergePackageJson.js\";\nimport { updateWebinyConfig } from \"./updateWebinyConfig.js\";\nimport type { ExtensionJson } from \"./types.js\";\n\nconst EXTENSIONS_ROOT_FOLDER = \"extensions\";\nconst S3_BUCKET_NAME = \"webiny-examples\";\nconst S3_BUCKET_REGION = \"us-east-1\";\nconst FOLDER_NAME_IS_VERSION_REGEX = /^\\d+\\.\\d+\\.x$/;\nconst WEBINY_DEV_VERSION = \"0.0.0\";\n\nconst getVersionFromVersionFolders = async (\n versionFoldersList: string[],\n currentWebinyVersion: string\n) => {\n const availableVersions = versionFoldersList\n .filter(v => v.match(FOLDER_NAME_IS_VERSION_REGEX))\n .map(v => v.replace(/\\.x$/, \".0\"))\n .sort();\n\n let versionToUse = \"\";\n\n // When developing Webiny, we want to use the latest version.\n if (currentWebinyVersion.startsWith(WEBINY_DEV_VERSION)) {\n versionToUse = availableVersions[availableVersions.length - 1];\n } else {\n for (const availableVersion of availableVersions) {\n if (currentWebinyVersion >= availableVersion) {\n versionToUse = availableVersion;\n } else {\n break;\n }\n }\n }\n\n return versionToUse.replace(/\\.0$/, \".x\");\n};\n\nclass DefaultInstallExtensionService implements InstallExtensionService.Interface {\n constructor(\n private getProjectVersion: GetProjectVersionService.Interface,\n private getProject: GetProjectService.Interface\n ) {}\n\n async execute(source: string): Promise<InstallExtensionService.Result> {\n const currentWebinyVersion = this.getProjectVersion.execute();\n const project = this.getProject.execute();\n const projectRoot = project.paths.rootFolder.toString();\n\n const randomId = String(Date.now());\n const downloadFolderPath = path.join(os.tmpdir(), `wby-ext-${randomId}`);\n\n // Check if source is a local path\n const isLocalPath =\n source.startsWith(\"../\") || source.startsWith(\"./\") || source.startsWith(\"/\");\n\n if (isLocalPath) {\n // Resolve the local path relative to the project root\n const resolvedPath = path.isAbsolute(source)\n ? source\n : path.resolve(projectRoot, source);\n\n // Copy the local directory to the temporary download folder\n await fsAsync.cp(resolvedPath, downloadFolderPath, {\n recursive: true\n });\n } else {\n // Download from S3\n await downloadFolderFromS3({\n bucketName: S3_BUCKET_NAME,\n bucketRegion: S3_BUCKET_REGION,\n bucketFolderKey: source,\n downloadFolderPath\n });\n }\n\n let extensionsFolderToCopyPath = path.join(downloadFolderPath, \"extensions\");\n let extensionJsonPath = path.join(downloadFolderPath, \"extension.json\");\n\n // If we have `extensions` folder in the root of the downloaded extension,\n // it means the extension is not versioned, and we can just copy it.\n const extensionsFolderExistsInRoot = fs.existsSync(extensionsFolderToCopyPath);\n const versionedExtension = !extensionsFolderExistsInRoot;\n\n if (versionedExtension) {\n // If we have `x.x.x` folders in the root of the downloaded\n // extension, we need to find the right version to use.\n\n // This can be `5.40.x`, `6.0.x`, etc.\n const versionFolders = await fsAsync.readdir(downloadFolderPath);\n\n const versionToUse = await getVersionFromVersionFolders(\n versionFolders,\n currentWebinyVersion\n );\n\n extensionsFolderToCopyPath = path.join(downloadFolderPath, versionToUse, \"extensions\");\n const subExtensionJsonPath = path.join(\n downloadFolderPath,\n versionToUse,\n \"extension.json\"\n );\n if (fs.existsSync(subExtensionJsonPath)) {\n extensionJsonPath = subExtensionJsonPath;\n }\n }\n\n // Read and parse extension.json.\n const extensionJsonExists = fs.existsSync(extensionJsonPath);\n const extensionJson: ExtensionJson = extensionJsonExists\n ? loadJsonFileSync(extensionJsonPath)\n : { name: \"unknown\", type: \"admin\" };\n\n // Ensure the extensions root folder exists.\n const targetExtensionsFolder = path.join(projectRoot, EXTENSIONS_ROOT_FOLDER);\n if (!fs.existsSync(targetExtensionsFolder)) {\n fs.mkdirSync(targetExtensionsFolder, { recursive: true });\n }\n\n // Copy the extensions folder contents.\n await fsAsync.cp(extensionsFolderToCopyPath, targetExtensionsFolder, {\n recursive: true\n });\n\n // Get the list of extensions that were copied.\n const extensionsFolderNames = await fsAsync.readdir(extensionsFolderToCopyPath);\n const extensionPaths = extensionsFolderNames.map(name =>\n path.join(EXTENSIONS_ROOT_FOLDER, name)\n );\n\n // Merge package.json if provided.\n if (extensionJson.packageJson && Object.keys(extensionJson.packageJson).length > 0) {\n await mergePackageJson({\n projectRoot,\n extensionPackageJson: extensionJson.packageJson\n });\n }\n\n // Update webiny.config.tsx if provided.\n if (extensionJson.webinyConfigTsx) {\n await updateWebinyConfig({\n projectRoot,\n webinyConfigTsx: extensionJson.webinyConfigTsx\n });\n }\n\n // Extract next steps and additional notes.\n const nextSteps = extensionJson.nextSteps?.messages || [];\n const additionalNotes = extensionJson.additionalNotes?.messages || [];\n\n return {\n extensionName: extensionJson.name,\n extensionPaths,\n nextSteps,\n additionalNotes\n };\n }\n}\n\nexport const installExtensionService = createImplementation({\n abstraction: InstallExtensionService,\n implementation: DefaultInstallExtensionService,\n dependencies: [GetProjectVersionService, GetProjectService]\n});\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,OAAO,MAAM,aAAa;AACjC,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SACIC,iBAAiB,EACjBC,wBAAwB,EACxBC,uBAAuB;AAE3B,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,kBAAkB;AAG3B,MAAMC,sBAAsB,GAAG,YAAY;AAC3C,MAAMC,cAAc,GAAG,iBAAiB;AACxC,MAAMC,gBAAgB,GAAG,WAAW;AACpC,MAAMC,4BAA4B,GAAG,eAAe;AACpD,MAAMC,kBAAkB,GAAG,OAAO;AAElC,MAAMC,4BAA4B,GAAG,MAAAA,CACjCC,kBAA4B,EAC5BC,oBAA4B,KAC3B;EACD,MAAMC,iBAAiB,GAAGF,kBAAkB,CACvCG,MAAM,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAACR,4BAA4B,CAAC,CAAC,CAClDS,GAAG,CAACF,CAAC,IAAIA,CAAC,CAACG,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CACjCC,IAAI,CAAC,CAAC;EAEX,IAAIC,YAAY,GAAG,EAAE;;EAErB;EACA,IAAIR,oBAAoB,CAACS,UAAU,CAACZ,kBAAkB,CAAC,EAAE;IACrDW,YAAY,GAAGP,iB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K,cAAc;MACdM,SAAS;MACTE;IACJ,CAAC;EACL;AACJ;AAEA,OAAO,MAAME,uBAAuB,GAAG9E,oBAAoB,CAAC;EACxD+E,WAAW,EAAE5E,uBAAuB;EACpC6E,cAAc,EAAEtD,8BAA8B;EAC9CuD,YAAY,EAAE,CAAC/E,wBAAwB,EAAED,iBAAiB;AAC9D,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import loadJson from "load-json-file";
2
- import writeJson from "write-json-file";
1
+ import { loadJsonFileSync } from "load-json-file";
2
+ import { writeJsonFileSync } from "write-json-file";
3
3
  import deepmerge from "deepmerge";
4
4
  /**
5
5
  * Merge extension package.json properties into the project's root package.json.
@@ -12,7 +12,7 @@ export const mergePackageJson = async params => {
12
12
  const packageJsonPath = `${projectRoot}/package.json`;
13
13
 
14
14
  // Load the current package.json
15
- const currentPackageJson = await loadJson(packageJsonPath);
15
+ const currentPackageJson = await loadJsonFileSync(packageJsonPath);
16
16
 
17
17
  // Merge the extension's package.json into the current one
18
18
  // Use deepmerge to combine arrays and objects properly
@@ -25,7 +25,7 @@ export const mergePackageJson = async params => {
25
25
  });
26
26
 
27
27
  // Write the merged package.json back
28
- await writeJson(packageJsonPath, mergedPackageJson);
28
+ return writeJsonFileSync(packageJsonPath, mergedPackageJson);
29
29
  };
30
30
 
31
31
  //# sourceMappingURL=mergePackageJson.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["loadJson","writeJson","deepmerge","mergePackageJson","params","projectRoot","extensionPackageJson","packageJsonPath","currentPackageJson","mergedPackageJson","arrayMerge","target","source","combined","Array","from","Set"],"sources":["mergePackageJson.ts"],"sourcesContent":["import loadJson from \"load-json-file\";\nimport writeJson from \"write-json-file\";\nimport deepmerge from \"deepmerge\";\n\ninterface MergePackageJsonParams {\n projectRoot: string;\n extensionPackageJson: Record<string, any>;\n}\n\n/**\n * Merge extension package.json properties into the project's root package.json.\n */\nexport const mergePackageJson = async (params: MergePackageJsonParams): Promise<void> => {\n const { projectRoot, extensionPackageJson } = params;\n\n const packageJsonPath = `${projectRoot}/package.json`;\n\n // Load the current package.json\n const currentPackageJson = await loadJson<Record<string, any>>(packageJsonPath);\n\n // Merge the extension's package.json into the current one\n // Use deepmerge to combine arrays and objects properly\n const mergedPackageJson = deepmerge(currentPackageJson, extensionPackageJson, {\n // For arrays, concatenate and remove duplicates\n arrayMerge: (target, source) => {\n const combined = [...target, ...source];\n return Array.from(new Set(combined));\n }\n });\n\n // Write the merged package.json back\n await writeJson(packageJsonPath, mergedPackageJson);\n};\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,gBAAgB;AACrC,OAAOC,SAAS,MAAM,iBAAiB;AACvC,OAAOC,SAAS,MAAM,WAAW;AAOjC;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAOC,MAA8B,IAAoB;EACrF,MAAM;IAAEC,WAAW;IAAEC;EAAqB,CAAC,GAAGF,MAAM;EAEpD,MAAMG,eAAe,GAAG,GAAGF,WAAW,eAAe;;EAErD;EACA,MAAMG,kBAAkB,GAAG,MAAMR,QAAQ,CAAsBO,eAAe,CAAC;;EAE/E;EACA;EACA,MAAME,iBAAiB,GAAGP,SAAS,CAACM,kBAAkB,EAAEF,oBAAoB,EAAE;IAC1E;IACAI,UAAU,EAAEA,CAACC,MAAM,EAAEC,MAAM,KAAK;MAC5B,MAAMC,QAAQ,GAAG,CAAC,GAAGF,MAAM,EAAE,GAAGC,MAAM,CAAC;MACvC,OAAOE,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAACH,QAAQ,CAAC,CAAC;IACxC;EACJ,CAAC,CAAC;;EAEF;EACA,MAAMZ,SAAS,CAACM,eAAe,EAAEE,iBAAiB,CAAC;AACvD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["loadJsonFileSync","writeJsonFileSync","deepmerge","mergePackageJson","params","projectRoot","extensionPackageJson","packageJsonPath","currentPackageJson","mergedPackageJson","arrayMerge","target","source","combined","Array","from","Set"],"sources":["mergePackageJson.ts"],"sourcesContent":["import { loadJsonFileSync } from \"load-json-file\";\nimport { writeJsonFileSync } from \"write-json-file\";\nimport deepmerge from \"deepmerge\";\n\ninterface MergePackageJsonParams {\n projectRoot: string;\n extensionPackageJson: Record<string, any>;\n}\n\n/**\n * Merge extension package.json properties into the project's root package.json.\n */\nexport const mergePackageJson = async (params: MergePackageJsonParams): Promise<void> => {\n const { projectRoot, extensionPackageJson } = params;\n\n const packageJsonPath = `${projectRoot}/package.json`;\n\n // Load the current package.json\n const currentPackageJson = await loadJsonFileSync<Record<string, any>>(packageJsonPath);\n\n // Merge the extension's package.json into the current one\n // Use deepmerge to combine arrays and objects properly\n const mergedPackageJson = deepmerge(currentPackageJson, extensionPackageJson, {\n // For arrays, concatenate and remove duplicates\n arrayMerge: (target, source) => {\n const combined = [...target, ...source];\n return Array.from(new Set(combined));\n }\n });\n\n // Write the merged package.json back\n return writeJsonFileSync(packageJsonPath, mergedPackageJson);\n};\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,OAAOC,SAAS,MAAM,WAAW;AAOjC;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAOC,MAA8B,IAAoB;EACrF,MAAM;IAAEC,WAAW;IAAEC;EAAqB,CAAC,GAAGF,MAAM;EAEpD,MAAMG,eAAe,GAAG,GAAGF,WAAW,eAAe;;EAErD;EACA,MAAMG,kBAAkB,GAAG,MAAMR,gBAAgB,CAAsBO,eAAe,CAAC;;EAEvF;EACA;EACA,MAAME,iBAAiB,GAAGP,SAAS,CAACM,kBAAkB,EAAEF,oBAAoB,EAAE;IAC1E;IACAI,UAAU,EAAEA,CAACC,MAAM,EAAEC,MAAM,KAAK;MAC5B,MAAMC,QAAQ,GAAG,CAAC,GAAGF,MAAM,EAAE,GAAGC,MAAM,CAAC;MACvC,OAAOE,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAACH,QAAQ,CAAC,CAAC;IACxC;EACJ,CAAC,CAAC;;EAEF;EACA,OAAOZ,iBAAiB,CAACM,eAAe,EAAEE,iBAAiB,CAAC;AAChE,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { createImplementation } from "@webiny/di";
2
2
  import { ListAppLambdaFunctionsService, PulumiExportService, LoggerService } from "../../abstractions/index.js";
3
3
  import path from "path";
4
- import minimatch from "minimatch";
4
+ import { minimatch } from "minimatch";
5
5
  export class DefaultListAppLambdaFunctionsService {
6
6
  constructor(pulumiExportService, loggerService) {
7
7
  this.pulumiExportService = pulumiExportService;
@@ -1 +1 @@
1
- {"version":3,"names":["createImplementation","ListAppLambdaFunctionsService","PulumiExportService","LoggerService","path","minimatch","DefaultListAppLambdaFunctionsService","constructor","pulumiExportService","loggerService","execute","app","params","stackExport","list","meta","count","totalCount","resources","deployment","allFunctionsList","filter","r","type","resource","isAuthorizerFunction","inputs","name","includes","filteredFunctionsList","code","assets","map","fnName","handlerBuildFolderPath","handlerPath","join","whitelist","length","functionNamesToMatch","Array","isArray","fn","some","pattern","listAppLambdaFunctionsService","abstraction","implementation","dependencies"],"sources":["ListAppLambdaFunctionsService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport {\n ListAppLambdaFunctionsService,\n PulumiExportService,\n LoggerService\n} from \"~/abstractions/index.js\";\nimport { type AppModel } from \"~/models/index.js\";\nimport path from \"path\";\nimport minimatch from \"minimatch\";\n\ninterface ExpectedStackExport {\n deployment: {\n resources: Array<{\n type: string;\n inputs: {\n name: string;\n code: {\n assets: Record<string, { path: string }>;\n };\n };\n }>;\n };\n}\n\nexport class DefaultListAppLambdaFunctionsService\n implements ListAppLambdaFunctionsService.Interface\n{\n constructor(\n private pulumiExportService: PulumiExportService.Interface,\n private loggerService: LoggerService.Interface\n ) {}\n\n async execute(app: AppModel, params?: ListAppLambdaFunctionsService.Params) {\n const stackExport = await this.pulumiExportService.execute<ExpectedStackExport>(app);\n\n if (!stackExport) {\n // If no stack export is found, return an empty array. This is a valid scenario.\n // For example, watching the Admin app locally, but not deploying it.\n return {\n list: [],\n meta: {\n count: 0,\n totalCount: 0\n }\n };\n }\n\n // If an app is not deployed, resources will not exist.\n const resources = stackExport.deployment?.resources ?? [];\n\n const allFunctionsList = resources\n .filter(r => r.type === \"aws:lambda/function:Function\")\n // We don't need to watch the authorizer function.\n .filter(resource => {\n const isAuthorizerFunction = resource.inputs.name.includes(\n \"watch-command-iot-authorizer\"\n );\n return !isAuthorizerFunction;\n });\n\n let filteredFunctionsList = allFunctionsList\n // First, this filter ensures that Lambda@Edge functions are excluded. Second,\n // it also ensures a function is filtered out if a `pulumi refresh` was called.\n // This is because, when called, the paths in Pulumi state file disappear, and\n // we can't determine the path to the handler. Probably needs revisiting. 🤦‍♂️\n .filter(resource => {\n return \".\" in resource.inputs.code.assets;\n })\n .map(resource => {\n const fnName = resource.inputs.name;\n const handlerBuildFolderPath = resource.inputs.code.assets[\".\"].path;\n\n const handlerPath = path.join(handlerBuildFolderPath, \"handler.mjs\");\n return {\n name: fnName,\n path: handlerPath\n };\n });\n\n if (params?.whitelist?.length) {\n const functionNamesToMatch = Array.isArray(params.whitelist)\n ? params.whitelist\n : [params.whitelist];\n\n // `functionNamesToWatch` is an array of glob patterns, which denote which functions to watch.\n filteredFunctionsList = filteredFunctionsList.filter(fn => {\n return functionNamesToMatch.some(pattern => {\n if (pattern.includes(\"*\")) {\n return minimatch(fn.name, pattern);\n }\n\n return fn.name.includes(pattern);\n });\n });\n } else {\n // We've hardcoded this filtering here just because of lack of time.\n // With v5, these \"presets\" were located within `webiny.application.ts` files.\n if (app.name === \"api\") {\n filteredFunctionsList = filteredFunctionsList.filter(fn => {\n return fn.name.includes(\"graphql\");\n });\n }\n }\n\n return {\n list: filteredFunctionsList,\n meta: { count: filteredFunctionsList.length, totalCount: allFunctionsList.length }\n };\n }\n}\n\nexport const listAppLambdaFunctionsService = createImplementation({\n abstraction: ListAppLambdaFunctionsService,\n implementation: DefaultListAppLambdaFunctionsService,\n dependencies: [PulumiExportService, LoggerService]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SACIC,6BAA6B,EAC7BC,mBAAmB,EACnBC,aAAa;AAGjB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,SAAS,MAAM,WAAW;AAgBjC,OAAO,MAAMC,oCAAoC,CAEjD;EACIC,WAAWA,CACCC,mBAAkD,EAClDC,aAAsC,EAChD;IAAA,KAFUD,mBAAkD,GAAlDA,mBAAkD;IAAA,KAClDC,aAAsC,GAAtCA,aAAsC;EAC/C;EAEH,MAAMC,OAAOA,CAACC,GAAa,EAAEC,MAA6C,EAAE;IACxE,MAAMC,WAAW,GAAG,MAAM,IAAI,CAACL,mBAAmB,CAACE,OAAO,CAAsBC,GAAG,CAAC;IAEpF,IAAI,CAACE,WAAW,EAAE;MACd;MACA;MACA,OAAO;QACHC,IAAI,EAAE,EAAE;QACRC,IAAI,EAAE;UACFC,KAAK,EAAE,CAAC;UACRC,UAAU,EAAE;QAChB;MACJ,CAAC;IACL;;IAEA;IACA,MAAMC,SAAS,GAAGL,WAAW,CAACM,UAAU,EAAED,SAAS,IAAI,EAAE;IAEzD,MAAME,gBAAgB,GAAGF,SAAS,CAC7BG,MAAM,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,KAAK,8BAA8B;IACtD;IAAA,CACCF,MAAM,CAACG,QAAQ,IAAI;MAChB,MAAMC,oBAAoB,GAAGD,QAAQ,CAACE,MAAM,CAACC,IAAI,CAACC,QAAQ,CACtD,8BACJ,CAAC;MACD,OAAO,CAACH,oBAAoB;IAChC,CAAC,CAAC;IAEN,IAAII,qBAAqB,GAAGT;IACxB;IACA;IACA;IACA;IAAA,CACCC,MAAM,CAACG,QAAQ,IAAI;MAChB,OAAO,GAAG,IAAIA,QAAQ,CAACE,MAAM,CAACI,IAAI,CAACC,MAAM;IAC7C,CAAC,CAAC,CACDC,GAAG,CAACR,QAAQ,IAAI;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EG,gBAAgB,CAACkB;MAAO;IACrF,CAAC;EACL;AACJ;AAEA,OAAO,MAAMO,6BAA6B,GAAG7C,oBAAoB,CAAC;EAC9D8C,WAAW,EAAE7C,6BAA6B;EAC1C8C,cAAc,EAAEzC,oCAAoC;EACpD0C,YAAY,EAAE,CAAC9C,mBAAmB,EAAEC,aAAa;AACrD,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createImplementation","ListAppLambdaFunctionsService","PulumiExportService","LoggerService","path","minimatch","DefaultListAppLambdaFunctionsService","constructor","pulumiExportService","loggerService","execute","app","params","stackExport","list","meta","count","totalCount","resources","deployment","allFunctionsList","filter","r","type","resource","isAuthorizerFunction","inputs","name","includes","filteredFunctionsList","code","assets","map","fnName","handlerBuildFolderPath","handlerPath","join","whitelist","length","functionNamesToMatch","Array","isArray","fn","some","pattern","listAppLambdaFunctionsService","abstraction","implementation","dependencies"],"sources":["ListAppLambdaFunctionsService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport {\n ListAppLambdaFunctionsService,\n PulumiExportService,\n LoggerService\n} from \"~/abstractions/index.js\";\nimport { type AppModel } from \"~/models/index.js\";\nimport path from \"path\";\nimport { minimatch } from \"minimatch\";\n\ninterface ExpectedStackExport {\n deployment: {\n resources: Array<{\n type: string;\n inputs: {\n name: string;\n code: {\n assets: Record<string, { path: string }>;\n };\n };\n }>;\n };\n}\n\nexport class DefaultListAppLambdaFunctionsService\n implements ListAppLambdaFunctionsService.Interface\n{\n constructor(\n private pulumiExportService: PulumiExportService.Interface,\n private loggerService: LoggerService.Interface\n ) {}\n\n async execute(app: AppModel, params?: ListAppLambdaFunctionsService.Params) {\n const stackExport = await this.pulumiExportService.execute<ExpectedStackExport>(app);\n\n if (!stackExport) {\n // If no stack export is found, return an empty array. This is a valid scenario.\n // For example, watching the Admin app locally, but not deploying it.\n return {\n list: [],\n meta: {\n count: 0,\n totalCount: 0\n }\n };\n }\n\n // If an app is not deployed, resources will not exist.\n const resources = stackExport.deployment?.resources ?? [];\n\n const allFunctionsList = resources\n .filter(r => r.type === \"aws:lambda/function:Function\")\n // We don't need to watch the authorizer function.\n .filter(resource => {\n const isAuthorizerFunction = resource.inputs.name.includes(\n \"watch-command-iot-authorizer\"\n );\n return !isAuthorizerFunction;\n });\n\n let filteredFunctionsList = allFunctionsList\n // First, this filter ensures that Lambda@Edge functions are excluded. Second,\n // it also ensures a function is filtered out if a `pulumi refresh` was called.\n // This is because, when called, the paths in Pulumi state file disappear, and\n // we can't determine the path to the handler. Probably needs revisiting. 🤦‍♂️\n .filter(resource => {\n return \".\" in resource.inputs.code.assets;\n })\n .map(resource => {\n const fnName = resource.inputs.name;\n const handlerBuildFolderPath = resource.inputs.code.assets[\".\"].path;\n\n const handlerPath = path.join(handlerBuildFolderPath, \"handler.mjs\");\n return {\n name: fnName,\n path: handlerPath\n };\n });\n\n if (params?.whitelist?.length) {\n const functionNamesToMatch = Array.isArray(params.whitelist)\n ? params.whitelist\n : [params.whitelist];\n\n // `functionNamesToWatch` is an array of glob patterns, which denote which functions to watch.\n filteredFunctionsList = filteredFunctionsList.filter(fn => {\n return functionNamesToMatch.some(pattern => {\n if (pattern.includes(\"*\")) {\n return minimatch(fn.name, pattern);\n }\n\n return fn.name.includes(pattern);\n });\n });\n } else {\n // We've hardcoded this filtering here just because of lack of time.\n // With v5, these \"presets\" were located within `webiny.application.ts` files.\n if (app.name === \"api\") {\n filteredFunctionsList = filteredFunctionsList.filter(fn => {\n return fn.name.includes(\"graphql\");\n });\n }\n }\n\n return {\n list: filteredFunctionsList,\n meta: { count: filteredFunctionsList.length, totalCount: allFunctionsList.length }\n };\n }\n}\n\nexport const listAppLambdaFunctionsService = createImplementation({\n abstraction: ListAppLambdaFunctionsService,\n implementation: DefaultListAppLambdaFunctionsService,\n dependencies: [PulumiExportService, LoggerService]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SACIC,6BAA6B,EAC7BC,mBAAmB,EACnBC,aA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AAc,EAAEzC,oCAAoC;EACpD0C,YAAY,EAAE,CAAC9C,mBAAmB,EAAEC,aAAa;AACrD,CAAC,CAAC","ignoreList":[]}
@@ -11,7 +11,7 @@ class DefaultSetProjectIdService {
11
11
  const tsMorphProject = new TsMorphProject();
12
12
  const sourceFile = tsMorphProject.addSourceFileAtPath(webinyConfigFileTsx);
13
13
 
14
- // Ensure import { Project } from "webiny/extensions";
14
+ // Ensure import { Project } from "webiny/extensions".
15
15
  const hasProjectImport = sourceFile.getImportDeclarations().some(decl => decl.getModuleSpecifierValue() === "webiny/extensions" && decl.getNamedImports().some(imp => imp.getName() === "Project"));
16
16
  if (!hasProjectImport) {
17
17
  sourceFile.insertImportDeclaration(0, {
@@ -19,31 +19,41 @@ class DefaultSetProjectIdService {
19
19
  moduleSpecifier: "webiny/extensions"
20
20
  });
21
21
  }
22
-
23
- // Find <Webiny />
24
22
  const jsxElements = sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement);
25
- const webinyEl = jsxElements.find(el => el.getTagNameNode().getText() === "Webiny");
26
- if (!webinyEl) {
27
- throw new Error(`Could not find <Webiny /> in ${webinyConfigFileTsx}`);
28
- }
29
23
 
30
- // Check for <Project.Id />
31
- const hasProjectId = jsxElements.some(el => el.getTagNameNode().getText() === "Project.Id");
32
- if (hasProjectId) {
24
+ // Check for existing <Project.Id />.
25
+ const existingProjectIdEl = jsxElements.find(el => el.getTagNameNode().getText() === "Project.Id");
26
+ if (existingProjectIdEl) {
33
27
  if (options.force !== true) {
34
28
  throw new Error("Project.Id already exists in the file.");
29
+ }
30
+ // Update the id attribute in-place.
31
+ const idAttr = existingProjectIdEl.getAttributes().find(attr => attr.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === "id");
32
+ if (idAttr) {
33
+ idAttr.replaceWithText(`id={"${id}"}`);
35
34
  } else {
36
- // Remove existing <Project.Id />
37
- const projectIdEl = jsxElements.find(el => el.getTagNameNode().getText() === "Project.Id");
38
- if (projectIdEl) {
39
- projectIdEl.replaceWithText("");
40
- }
35
+ existingProjectIdEl.replaceWithText(`<Project.Id id={"${id}"} />`);
41
36
  }
37
+ await sourceFile.save();
38
+ return;
42
39
  }
43
40
 
44
- // Insert after <Webiny />
45
- const insertPos = webinyEl.getEnd();
46
- sourceFile.insertText(insertPos, `\n <Project.Id id={"${id}"} />`);
41
+ /* Determine the insertion point — after the last <Project.*> element that is a
42
+ direct child of the outermost JSX fragment (i.e. not inside a conditional expression).
43
+ Fall back to inserting after the opening tag of the outermost JSX fragment. */
44
+ const fragment = sourceFile.getFirstDescendantByKind(SyntaxKind.JsxFragment);
45
+ const projectEls = jsxElements.filter(el => el.getTagNameNode().getText().startsWith("Project.") && el.getParent()?.getParent() === fragment);
46
+ if (projectEls.length > 0) {
47
+ const lastProjectEl = projectEls[projectEls.length - 1];
48
+ sourceFile.insertText(lastProjectEl.getEnd(), `\n <Project.Id id={"${id}"} />`);
49
+ } else {
50
+ // Fallback: insert as first child of the outermost JSX fragment.
51
+ if (!fragment) {
52
+ throw new Error(`Could not find a JSX fragment or <Project.*> element to anchor <Project.Id /> in ${webinyConfigFileTsx}`);
53
+ }
54
+ const openingFragment = fragment.getOpeningFragment();
55
+ sourceFile.insertText(openingFragment.getEnd(), `\n <Project.Id id={"${id}"} />`);
56
+ }
47
57
  await sourceFile.save();
48
58
  }
49
59
  }
@@ -1 +1 @@
1
- {"version":3,"names":["createImplementation","GetProjectService","SetProjectIdService","Project","TsMorphProject","SyntaxKind","DefaultSetProjectIdService","constructor","getProjectService","execute","id","options","project","webinyConfigFileTsx","paths","webinyConfigFile","toString","tsMorphProject","sourceFile","addSourceFileAtPath","hasProjectImport","getImportDeclarations","some","decl","getModuleSpecifierValue","getNamedImports","imp","getName","insertImportDeclaration","namedImports","moduleSpecifier","jsxElements","getDescendantsOfKind","JsxSelfClosingElement","webinyEl","find","el","getTagNameNode","getText","Error","hasProjectId","force","projectIdEl","replaceWithText","insertPos","getEnd","insertText","save","setProjectIdService","abstraction","implementation","dependencies"],"sources":["SetProjectIdService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GetProjectService, SetProjectIdService } from \"~/abstractions/index.js\";\nimport { Project as TsMorphProject, SyntaxKind } from \"ts-morph\";\n\nclass DefaultSetProjectIdService implements SetProjectIdService.Interface {\n constructor(private getProjectService: GetProjectService.Interface) {}\n\n async execute(id: string, options: SetProjectIdService.Options = {}) {\n const project = this.getProjectService.execute();\n const webinyConfigFileTsx = project.paths.webinyConfigFile.toString();\n\n const tsMorphProject = new TsMorphProject();\n const sourceFile = tsMorphProject.addSourceFileAtPath(webinyConfigFileTsx);\n\n // Ensure import { Project } from \"webiny/extensions\";\n const hasProjectImport = sourceFile\n .getImportDeclarations()\n .some(\n decl =>\n decl.getModuleSpecifierValue() === \"webiny/extensions\" &&\n decl.getNamedImports().some(imp => imp.getName() === \"Project\")\n );\n if (!hasProjectImport) {\n sourceFile.insertImportDeclaration(0, {\n namedImports: [\"Project\"],\n moduleSpecifier: \"webiny/extensions\"\n });\n }\n\n // Find <Webiny />\n const jsxElements = sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement);\n const webinyEl = jsxElements.find(el => el.getTagNameNode().getText() === \"Webiny\");\n if (!webinyEl) {\n throw new Error(`Could not find <Webiny /> in ${webinyConfigFileTsx}`);\n }\n\n // Check for <Project.Id />\n const hasProjectId = jsxElements.some(el => el.getTagNameNode().getText() === \"Project.Id\");\n if (hasProjectId) {\n if (options.force !== true) {\n throw new Error(\"Project.Id already exists in the file.\");\n } else {\n // Remove existing <Project.Id />\n const projectIdEl = jsxElements.find(\n el => el.getTagNameNode().getText() === \"Project.Id\"\n );\n if (projectIdEl) {\n projectIdEl.replaceWithText(\"\");\n }\n }\n }\n\n // Insert after <Webiny />\n const insertPos = webinyEl.getEnd();\n sourceFile.insertText(insertPos, `\\n <Project.Id id={\"${id}\"} />`);\n\n await sourceFile.save();\n }\n}\n\nexport const setProjectIdService = createImplementation({\n abstraction: SetProjectI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AAE,CAACC,cAAc,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,KAAK,QAAQ,CAAC;IACnF,IAAI,CAACJ,QAAQ,EAAE;MACX,MAAM,IAAIK,KAAK,CAAC,gCAAgC1B,mBAAmB,EAAE,CAAC;IAC1E;;IAEA;IACA,MAAM2B,YAAY,GAAGT,WAAW,CAACT,IAAI,CAACc,EAAE,IAAIA,EAAE,CAACC,cAAc,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,KAAK,YAAY,CAAC;IAC3F,IAAIE,YAAY,EAAE;MACd,IAAI7B,OAAO,CAAC8B,KAAK,KAAK,IAAI,EAAE;QACxB,MAAM,IAAIF,KAAK,CAAC,wCAAwC,CAAC;MAC7D,CAAC,MAAM;QACH;QACA,MAAMG,WAAW,GAAGX,WAAW,CAACI,IAAI,CAChCC,EAAE,IAAIA,EAAE,CAACC,cAAc,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC,KAAK,YAC5C,CAAC;QACD,IAAII,WAAW,EAAE;UACbA,WAAW,CAACC,eAAe,CAAC,EAAE,CAAC;QACnC;MACJ;IACJ;;IAEA;IACA,MAAMC,SAAS,GAAGV,QAAQ,CAACW,MAAM,CAAC,CAAC;IACnC3B,UAAU,CAAC4B,UAAU,CAACF,SAAS,EAAE,kCAAkClC,EAAE,OAAO,CAAC;IAE7E,MAAMQ,UAAU,CAAC6B,IAAI,CAAC,CAAC;EAC3B;AACJ;AAEA,OAAO,MAAMC,mBAAmB,GAAGhD,oBAAoB,CAAC;EACpDiD,WAAW,EAAE/C,mBAAmB;EAChCgD,cAAc,EAAE5C,0BAA0B;EAC1C6C,YAAY,EAAE,CAAClD,iBAAiB;AACpC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createImplementation","GetProjectService","SetProjectIdService","Project","TsMorphProject","SyntaxKind","DefaultSetProjectIdService","constructor","getProjectService","execute","id","options","project","webinyConfigFileTsx","paths","webinyConfigFile","toString","tsMorphProject","sourceFile","addSourceFileAtPath","hasProjectImport","getImportDeclarations","some","decl","getModuleSpecifierValue","getNamedImports","imp","getName","insertImportDeclaration","namedImports","moduleSpecifier","jsxElements","getDescendantsOfKind","JsxSelfClosingElement","existingProjectIdEl","find","el","getTagNameNode","getText","force","Error","idAttr","getAttributes","attr","getFirstChildByKind","Identifier","replaceWithText","save","fragment","getFirstDescendantByKind","JsxFragment","projectEls","filter","startsWith","getParent","length","lastProjectEl","insertText","getEnd","openingFragment","getOpeningFragment","setProjectIdService","abstraction","implementation","dependencies"],"sources":["SetProjectIdService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GetProjectService, SetProjectIdService } from \"~/abstractions/index.js\";\nimport { Project as TsMorphProject, SyntaxKind } from \"ts-morph\";\n\nclass DefaultSetProjectIdService implements SetProjectIdService.Interface {\n constructor(private getProjectService: GetProjectService.Interface) {}\n\n async execute(id: string, options: SetProjectIdService.Options = {}) {\n const project = this.getProjectService.execute();\n const webinyConfigFileTsx = project.paths.webinyConfigFile.toString();\n\n const tsMorphProject = new TsMorphProject();\n const sourceFile = tsMorphProject.addSourceFileAtPath(webinyConfigFileTsx);\n\n // Ensure import { Project } from \"webiny/extensions\".\n const hasProjectImport = sourceFile\n .getImportDeclarations()\n .some(\n decl =>\n decl.getModuleSpecifierValue() === \"webiny/extensions\" &&\n decl.getNamedImports().some(imp => imp.getName() === \"Project\")\n );\n if (!hasProjectImport) {\n sourceFile.insertImportDeclaration(0, {\n namedImports: [\"Project\"],\n moduleSpecifier: \"webiny/extensions\"\n });\n }\n\n const jsxElements = sourceFile.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement);\n\n // Check for existing <Project.Id />.\n const existingProjectIdEl = jsxElements.find(\n el => el.getTagNameNode().getText() === \"Project.Id\"\n );\n if (existingProjectIdEl) {\n if (options.force !== true) {\n throw new Error(\"Project.Id already exists in the file.\");\n }\n // Update the id attribute in-place.\n const idAttr = existingProjectIdEl\n .getAttributes()\n .find(attr => attr.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === \"id\");\n if (idAttr) {\n idAttr.replaceWithText(`id={\"${id}\"}`);\n } else {\n existingProjectIdEl.replaceWithText(`<Project.Id id={\"${id}\"} />`);\n }\n await sourceFile.save();\n return;\n }\n\n /* Determine the insertion point — after the last <Project.*> element that is a\n direct child of the outermost JSX fragment (i.e. not inside a conditional expression).\n Fall back to inserting after the opening tag of the outermost JSX fragment. */\n const fragment = sourceFile.getFirstDescendantByKind(SyntaxKind.JsxFragment);\n const projectEls = jsxElements.filter(\n el =>\n el.getTagNameNode().getText().startsWith(\"Project.\") &&\n el.getParent()?.getParent() === fragment\n );\n\n if (projectEls.length > 0) {\n const lastProjectEl = projectEls[projectEls.length - 1];\n sourceFile.insertText(\n lastProjectEl.getEnd(),\n `\\n <Project.Id id={\"${id}\"} />`\n );\n } else {\n // Fallback: insert as first child of the outermost JSX fragment.\n if (!fragment) {\n throw new Error(\n `Could not find a JSX fragment or <Project.*> element to anchor <Project.Id /> in ${webinyConfigFileTsx}`\n );\n }\n const openingFragment = fragment.getOpeningFragment();\n sourceFile.insertText(\n openingFragment.getEnd(),\n `\\n <Project.Id id={\"${id}\"} />`\n );\n }\n\n await sourceFile.save();\n }\n}\n\nexport const setProjectIdService = createImplementation({\n abstraction: SetProjectIdService,\n implementation: DefaultSetProjectIdService,\n dependencies: [GetProjectService]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,iBAAiB,EAAEC,mBAAmB;AAC/C,SAASC,OAAO,IAAIC,cAAc,EAAEC,UAAU,QAAQ,UAAU;AAEhE,MAAMC,0BAA0B,CAA0C;EACtEC,WAAWA,CAASC,iBAA8C,EAAE;IAAA,KAAhDA,iBAA8C,GAA9CA,iBAA8C;EAAG;EAErE,MAAMC,OAAOA,CAACC,EAAU,EAAEC,OAAoC,GAAG,CAAC,CAAC,EAAE;IACjE,MAAMC,OAAO,GAAG,IAAI,CAACJ,iBAAiB,CAACC,OAAO,CAAC,CAAC;IACh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iBAAiB;AACpC,CAAC,CAAC","ignoreList":[]}
@@ -1,12 +1,12 @@
1
1
  import { WatchedLambdaFunctionsService, LocalStorageService } from "../../abstractions/index.js";
2
- import { type AppName } from "../../abstractions/types.js";
3
2
  export declare class DefaultWatchedLambdaFunctionsService implements WatchedLambdaFunctionsService.Interface {
4
3
  private localStorageService;
5
4
  constructor(localStorageService: LocalStorageService.Interface);
6
- markDirty(app: AppName, functionUrns: string[]): void;
7
- getDirty(app: AppName): string[];
8
- clearDirty(app: AppName): void;
5
+ markDirty(params: WatchedLambdaFunctionsService.Params, functionUrns: string[]): void;
6
+ getDirty(params: WatchedLambdaFunctionsService.Params): string[];
7
+ clearDirty(params: WatchedLambdaFunctionsService.Params): void;
9
8
  clearAll(): void;
9
+ private getCacheKey;
10
10
  private getData;
11
11
  private setData;
12
12
  }
@@ -5,34 +5,40 @@ export class DefaultWatchedLambdaFunctionsService {
5
5
  constructor(localStorageService) {
6
6
  this.localStorageService = localStorageService;
7
7
  }
8
- markDirty(app, functionUrns) {
9
- const data = this.getData();
10
- if (!data[app]) {
11
- data[app] = [];
8
+ markDirty(params, functionUrns) {
9
+ const key = this.getCacheKey(params);
10
+ const data = this.getData(key);
11
+ if (!data[params.name]) {
12
+ data[params.name] = [];
12
13
  }
13
14
 
14
- // Add new URNs, avoiding duplicates
15
+ // Add new URNs, avoiding duplicates.
15
16
  for (const urn of functionUrns) {
16
- if (!data[app].includes(urn)) {
17
- data[app].push(urn);
17
+ if (!data[params.name].includes(urn)) {
18
+ data[params.name].push(urn);
18
19
  }
19
20
  }
20
- this.setData(data);
21
+ this.setData(key, data);
21
22
  }
22
- getDirty(app) {
23
- const data = this.getData();
24
- return data[app] || [];
23
+ getDirty(params) {
24
+ const key = this.getCacheKey(params);
25
+ const data = this.getData(key);
26
+ return data[params.name] || [];
25
27
  }
26
- clearDirty(app) {
27
- const data = this.getData();
28
- delete data[app];
29
- this.setData(data);
28
+ clearDirty(params) {
29
+ const key = this.getCacheKey(params);
30
+ const data = this.getData(key);
31
+ delete data[params.name];
32
+ this.setData(key, data);
30
33
  }
31
34
  clearAll() {
32
- this.setData({});
35
+ this.setData(WATCHED_LAMBDA_FUNCTIONS_KEY, {});
33
36
  }
34
- getData() {
35
- const data = this.localStorageService.get(WATCHED_LAMBDA_FUNCTIONS_KEY);
37
+ getCacheKey(params) {
38
+ return params.deploymentId ? `${WATCHED_LAMBDA_FUNCTIONS_KEY}-${params.deploymentId}` : WATCHED_LAMBDA_FUNCTIONS_KEY;
39
+ }
40
+ getData(key) {
41
+ const data = this.localStorageService.get(key);
36
42
  if (!data) {
37
43
  return {};
38
44
  }
@@ -42,8 +48,8 @@ export class DefaultWatchedLambdaFunctionsService {
42
48
  return {};
43
49
  }
44
50
  }
45
- setData(data) {
46
- this.localStorageService.set(WATCHED_LAMBDA_FUNCTIONS_KEY, data);
51
+ setData(key, data) {
52
+ this.localStorageService.set(key, data);
47
53
  }
48
54
  }
49
55
  export const watchedLambdaFunctionsService = createImplementation({
@@ -1 +1 @@
1
- {"version":3,"names":["createImplementation","WatchedLambdaFunctionsService","LocalStorageService","WATCHED_LAMBDA_FUNCTIONS_KEY","DefaultWatchedLambdaFunctionsService","constructor","localStorageService","markDirty","app","functionUrns","data","getData","urn","includes","push","setData","getDirty","clearDirty","clearAll","get","JSON","parse","set","watchedLambdaFunctionsService","abstraction","implementation","dependencies"],"sources":["WatchedLambdaFunctionsService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { WatchedLambdaFunctionsService, LocalStorageService } from \"~/abstractions/index.js\";\nimport { type AppName } from \"~/abstractions/types.js\";\n\nconst WATCHED_LAMBDA_FUNCTIONS_KEY = \"watchedLambdaFunctions\";\n\ninterface WatchedLambdaFunctionsData {\n [app: string]: string[]; // app name -> array of Lambda URNs\n}\n\nexport class DefaultWatchedLambdaFunctionsService\n implements WatchedLambdaFunctionsService.Interface\n{\n constructor(private localStorageService: LocalStorageService.Interface) {}\n\n markDirty(app: AppName, functionUrns: string[]): void {\n const data = this.getData();\n\n if (!data[app]) {\n data[app] = [];\n }\n\n // Add new URNs, avoiding duplicates\n for (const urn of functionUrns) {\n if (!data[app].includes(urn)) {\n data[app].push(urn);\n }\n }\n\n this.setData(data);\n }\n\n getDirty(app: AppName): string[] {\n const data = this.getData();\n return data[app] || [];\n }\n\n clearDirty(app: AppName): void {\n const data = this.getData();\n delete data[app];\n this.setData(data);\n }\n\n clearAll(): void {\n this.setData({});\n }\n\n private getData(): WatchedLambdaFunctionsData {\n const data = this.localStorageService.get(WATCHED_LAMBDA_FUNCTIONS_KEY);\n if (!data) {\n return {};\n }\n\n try {\n return typeof data === \"string\" ? JSON.parse(data) : data;\n } catch {\n return {};\n }\n }\n\n private setData(data: WatchedLambdaFunctionsData): void {\n this.localStorageService.set(WATCHED_LAMBDA_FUNCTIONS_KEY, data);\n }\n}\n\nexport const watchedLambdaFunctionsService = createImplementation({\n abstraction: WatchedLambdaFunctionsService,\n implementation: DefaultWatchedLambdaFunctionsService,\n dependencies: [LocalStorageService]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,6BAA6B,EAAEC,mBAAmB;AAG3D,MAAMC,4BAA4B,GAAG,wBAAwB;AAM7D,OAAO,MAAMC,oCAAoC,CAEjD;EACIC,WAAWA,CAASC,mBAAkD,EAAE;IAAA,KAApDA,mBAAkD,GAAlDA,mBAAkD;EAAG;EAEzEC,SAASA,CAACC,GAAY,EAAEC,YAAsB,EAAQ;IAClD,MAAMC,IAAI,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;IAE3B,IAAI,CAACD,IAAI,CAACF,GAAG,CAAC,EAAE;MACZE,IAAI,CAACF,GAAG,CAAC,GAAG,EAAE;IAClB;;IAEA;IACA,KAAK,MAAMI,GAAG,IAAIH,YAAY,EAAE;MAC5B,IAAI,CAACC,IAAI,CAACF,GAAG,CAAC,CAACK,QAAQ,CAACD,GAAG,CAAC,EAAE;QAC1BF,IAAI,CAACF,GAAG,CAAC,CAACM,IAAI,CAACF,GAAG,CAAC;MACvB;IACJ;IAEA,IAAI,CAACG,OAAO,CAACL,IAAI,CAAC;EACtB;EAEAM,QAAQA,CAACR,GAAY,EAAY;IAC7B,MAAME,IAAI,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;IAC3B,OAAOD,IAAI,CAACF,GAAG,CAAC,IAAI,EAAE;EAC1B;EAEAS,UAAUA,CAACT,GAAY,EAAQ;IAC3B,MAAME,IAAI,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;IAC3B,OAAOD,IAAI,CAACF,GAAG,CAAC;IAChB,IAAI,CAACO,OAAO,CAACL,IAAI,CAAC;EACtB;EAEAQ,QAAQA,CAAA,EAAS;IACb,IAAI,CAACH,OAAO,CAAC,CAAC,CAAC,CAAC;EACpB;EAEQJ,OAAOA,CAAA,EAA+B;IAC1C,MAAMD,IAAI,GAAG,IAAI,CAACJ,mBAAmB,CAACa,GAAG,CAAChB,4BAA4B,CAAC;IACvE,IAAI,CAACO,IAAI,EAAE;MACP,OAAO,CAAC,CAAC;IACb;IAEA,IAAI;MACA,OAAO,OAAOA,IAAI,KAAK,QAAQ,GAAGU,IAAI,CAACC,KAAK,CAACX,IAAI,CAAC,GAAGA,IAAI;IAC7D,CAAC,CAAC,MAAM;MACJ,OAAO,CAAC,CAAC;IACb;EACJ;EAEQK,OAAOA,CAACL,IAAgC,EAAQ;IACpD,IAAI,CAACJ,mBAAmB,CAACgB,GAAG,CAACnB,4BAA4B,EAAEO,IAAI,CAAC;EACpE;AACJ;AAEA,OAAO,MAAMa,6BAA6B,GAAGvB,oBAAoB,CAAC;EAC9DwB,WAAW,EAAEvB,6BAA6B;EAC1CwB,cAAc,EAAErB,oCAAoC;EACpDsB,YAAY,EAAE,CAACxB,mBAAmB;AACtC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createImplementation","WatchedLambdaFunctionsService","LocalStorageService","WATCHED_LAMBDA_FUNCTIONS_KEY","DefaultWatchedLambdaFunctionsService","constructor","localStorageService","markDirty","params","functionUrns","key","getCacheKey","data","getData","name","urn","includes","push","setData","getDirty","clearDirty","clearAll","deploymentId","get","JSON","parse","set","watchedLambdaFunctionsService","abstraction","implementation","dependencies"],"sources":["WatchedLambdaFunctionsService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { WatchedLambdaFunctionsService, LocalStorageService } from \"~/abstractions/index.js\";\n\nconst WATCHED_LAMBDA_FUNCTIONS_KEY = \"watchedLambdaFunctions\";\n\ninterface WatchedLambdaFunctionsData {\n [app: string]: string[]; // app name -> array of Lambda URNs\n}\n\nexport class DefaultWatchedLambdaFunctionsService\n implements WatchedLambdaFunctionsService.Interface\n{\n constructor(private localStorageService: LocalStorageService.Interface) {}\n\n markDirty(params: WatchedLambdaFunctionsService.Params, functionUrns: string[]): void {\n const key = this.getCacheKey(params);\n const data = this.getData(key);\n\n if (!data[params.name]) {\n data[params.name] = [];\n }\n\n // Add new URNs, avoiding duplicates.\n for (const urn of functionUrns) {\n if (!data[params.name].includes(urn)) {\n data[params.name].push(urn);\n }\n }\n\n this.setData(key, data);\n }\n\n getDirty(params: WatchedLambdaFunctionsService.Params): string[] {\n const key = this.getCacheKey(params);\n const data = this.getData(key);\n return data[params.name] || [];\n }\n\n clearDirty(params: WatchedLambdaFunctionsService.Params): void {\n const key = this.getCacheKey(params);\n const data = this.getData(key);\n delete data[params.name];\n this.setData(key, data);\n }\n\n clearAll(): void {\n this.setData(WATCHED_LAMBDA_FUNCTIONS_KEY, {});\n }\n\n private getCacheKey(params: WatchedLambdaFunctionsService.Params): string {\n return params.deploymentId\n ? `${WATCHED_LAMBDA_FUNCTIONS_KEY}-${params.deploymentId}`\n : WATCHED_LAMBDA_FUNCTIONS_KEY;\n }\n\n private getData(key: string): WatchedLambdaFunctionsData {\n const data = this.localStorageService.get(key);\n if (!data) {\n return {};\n }\n\n try {\n return typeof data === \"string\" ? JSON.parse(data) : data;\n } catch {\n return {};\n }\n }\n\n private setData(key: string, data: WatchedLambdaFunctionsData): void {\n this.localStorageService.set(key, data);\n }\n}\n\nexport const watchedLambdaFunctionsService = createImplementation({\n abstraction: WatchedLambdaFunctionsService,\n implementation: DefaultWatchedLambdaFunctionsService,\n dependencies: [LocalStorageService]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,6BAA6B,EAAEC,mBAAmB;AAE3D,MAAMC,4BAA4B,GAAG,wBAAwB;AAM7D,OAAO,MAAMC,oCAAoC,CAEjD;EACIC,WAAWA,CAASC,mBAAkD,EAAE;IAAA,KAApDA,mBAAkD,GAAlDA,mBAAkD;EAAG;EAEzEC,SAASA,CAACC,MAA4C,EAAEC,YAAsB,EAAQ;IAClF,MAAMC,GAAG,GAAG,IAAI,CAACC,WAAW,CAACH,MAAM,CAAC;IACpC,MAAMI,IAAI,GAAG,IAAI,CAACC,OAAO,CAACH,GAAG,CAAC;IAE9B,IAAI,CAACE,IAAI,CAACJ,MAAM,CAACM,IAAI,CAAC,EAAE;MACpBF,IAAI,CAACJ,MAAM,CAACM,IAAI,CAAC,GAAG,EAAE;IAC1B;;IAEA;IACA,KAAK,MAAMC,GAAG,IAAIN,YAAY,EAAE;MAC5B,IAAI,CAACG,IAAI,CAACJ,MAAM,CAACM,IAAI,CAAC,CAACE,QAAQ,CAACD,GAAG,CAAC,EAAE;QAClCH,IAAI,CAACJ,MAAM,CAACM,IAAI,CAAC,CAACG,IAAI,CAACF,GAAG,CAAC;MAC/B;IACJ;IAEA,IAAI,CAACG,OAAO,CAACR,GAAG,EAAEE,IAAI,CAAC;EAC3B;EAEAO,QAAQA,CAACX,MAA4C,EAAY;IAC7D,MAAME,GAAG,GAAG,IAAI,CAACC,WAAW,CAACH,MAAM,CAAC;IACpC,MAAMI,IAAI,GAAG,IAAI,CAACC,OAAO,CAACH,GAAG,CAAC;IAC9B,OAAOE,IAAI,CAACJ,MAAM,CAACM,IAAI,CAAC,IAAI,EAAE;EAClC;EAEAM,U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