@webiny/project 6.3.0-beta.2 → 6.3.0-beta.3

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 (97) hide show
  1. package/abstractions/features/index.d.ts +0 -1
  2. package/abstractions/features/index.js +0 -1
  3. package/abstractions/features/index.js.map +1 -1
  4. package/defineExtension/models/ExtensionInstanceModel.js +4 -1
  5. package/defineExtension/models/ExtensionInstanceModel.js.map +1 -1
  6. package/exports/infra/admin.d.ts +0 -1
  7. package/exports/infra/admin.js +0 -1
  8. package/exports/infra/admin.js.map +1 -1
  9. package/exports/infra/api.d.ts +0 -1
  10. package/exports/infra/api.js +0 -1
  11. package/exports/infra/api.js.map +1 -1
  12. package/exports/infra/core.d.ts +0 -1
  13. package/exports/infra/core.js +0 -1
  14. package/exports/infra/core.js.map +1 -1
  15. package/extensions/ApiBuildParam.js +1 -1
  16. package/extensions/ApiBuildParam.js.map +1 -1
  17. package/extensions/ApiExtension.js +1 -1
  18. package/extensions/ApiExtension.js.map +1 -1
  19. package/extensions/Project/ValidateEncryptionBeforeDeploy.d.ts +12 -0
  20. package/extensions/Project/ValidateEncryptionBeforeDeploy.js +32 -0
  21. package/extensions/Project/ValidateEncryptionBeforeDeploy.js.map +1 -0
  22. package/extensions/Project.js +2 -0
  23. package/extensions/Project.js.map +1 -1
  24. package/extensions/ProjectId.js +1 -1
  25. package/extensions/ProjectId.js.map +1 -1
  26. package/extensions/index.d.ts +1 -4
  27. package/extensions/index.js +5 -8
  28. package/extensions/index.js.map +1 -1
  29. package/extensions/infra/Env.d.ts +6 -0
  30. package/extensions/infra/Env.js +21 -0
  31. package/extensions/infra/Env.js.map +1 -1
  32. package/extensions/pulumi/ProductionEnvironments.js +16 -1
  33. package/extensions/pulumi/ProductionEnvironments.js.map +1 -1
  34. package/extensions/pulumi/index.d.ts +0 -3
  35. package/extensions/pulumi/index.js +0 -3
  36. package/extensions/pulumi/index.js.map +1 -1
  37. package/features/index.d.ts +0 -1
  38. package/features/index.js +0 -1
  39. package/features/index.js.map +1 -1
  40. package/package.json +17 -17
  41. package/services/GetProjectConfigService/ProductionEnvironmentsContext.d.ts +6 -0
  42. package/services/GetProjectConfigService/ProductionEnvironmentsContext.js +21 -0
  43. package/services/GetProjectConfigService/ProductionEnvironmentsContext.js.map +1 -0
  44. package/services/GetProjectConfigService/renderConfigWorker.js +3 -2
  45. package/services/GetProjectConfigService/renderConfigWorker.js.map +1 -1
  46. package/services/InitProjectSdkService/InitProjectSdkService.js +0 -6
  47. package/services/InitProjectSdkService/InitProjectSdkService.js.map +1 -1
  48. package/services/InitProjectSdkService/registerPulumiExtensions.js +5 -3
  49. package/services/InitProjectSdkService/registerPulumiExtensions.js.map +1 -1
  50. package/services/InstallExtensionService/downloadFolderFromS3.js +33 -42
  51. package/services/InstallExtensionService/downloadFolderFromS3.js.map +1 -1
  52. package/services/ListPackagesService/ListPackagesService.js +1 -1
  53. package/services/ListPackagesService/ListPackagesService.js.map +1 -1
  54. package/services/ProjectInfoService/ProjectInfoService.js +1 -1
  55. package/services/ProjectInfoService/ProjectInfoService.js.map +1 -1
  56. package/abstractions/features/pulumi/AdminPulumi.d.ts +0 -11
  57. package/abstractions/features/pulumi/AdminPulumi.js +0 -7
  58. package/abstractions/features/pulumi/AdminPulumi.js.map +0 -1
  59. package/abstractions/features/pulumi/ApiPulumi.d.ts +0 -11
  60. package/abstractions/features/pulumi/ApiPulumi.js +0 -7
  61. package/abstractions/features/pulumi/ApiPulumi.js.map +0 -1
  62. package/abstractions/features/pulumi/CorePulumi.d.ts +0 -11
  63. package/abstractions/features/pulumi/CorePulumi.js +0 -7
  64. package/abstractions/features/pulumi/CorePulumi.js.map +0 -1
  65. package/abstractions/features/pulumi/index.d.ts +0 -3
  66. package/abstractions/features/pulumi/index.js +0 -5
  67. package/abstractions/features/pulumi/index.js.map +0 -1
  68. package/extensions/pulumi/AdminPulumi.d.ts +0 -4
  69. package/extensions/pulumi/AdminPulumi.js +0 -25
  70. package/extensions/pulumi/AdminPulumi.js.map +0 -1
  71. package/extensions/pulumi/ApiPulumi.d.ts +0 -4
  72. package/extensions/pulumi/ApiPulumi.js +0 -25
  73. package/extensions/pulumi/ApiPulumi.js.map +0 -1
  74. package/extensions/pulumi/CorePulumi.d.ts +0 -4
  75. package/extensions/pulumi/CorePulumi.js +0 -25
  76. package/extensions/pulumi/CorePulumi.js.map +0 -1
  77. package/features/pulumi/AdminPulumi/AdminPulumi.d.ts +0 -7
  78. package/features/pulumi/AdminPulumi/AdminPulumi.js +0 -21
  79. package/features/pulumi/AdminPulumi/AdminPulumi.js.map +0 -1
  80. package/features/pulumi/AdminPulumi/index.d.ts +0 -1
  81. package/features/pulumi/AdminPulumi/index.js +0 -3
  82. package/features/pulumi/AdminPulumi/index.js.map +0 -1
  83. package/features/pulumi/ApiPulumi/ApiPulumi.d.ts +0 -7
  84. package/features/pulumi/ApiPulumi/ApiPulumi.js +0 -21
  85. package/features/pulumi/ApiPulumi/ApiPulumi.js.map +0 -1
  86. package/features/pulumi/ApiPulumi/index.d.ts +0 -1
  87. package/features/pulumi/ApiPulumi/index.js +0 -3
  88. package/features/pulumi/ApiPulumi/index.js.map +0 -1
  89. package/features/pulumi/CorePulumi/CorePulumi.d.ts +0 -7
  90. package/features/pulumi/CorePulumi/CorePulumi.js +0 -21
  91. package/features/pulumi/CorePulumi/CorePulumi.js.map +0 -1
  92. package/features/pulumi/CorePulumi/index.d.ts +0 -1
  93. package/features/pulumi/CorePulumi/index.js +0 -3
  94. package/features/pulumi/CorePulumi/index.js.map +0 -1
  95. package/features/pulumi/index.d.ts +0 -3
  96. package/features/pulumi/index.js +0 -5
  97. package/features/pulumi/index.js.map +0 -1
@@ -1,5 +1,4 @@
1
1
  export * from "./hooks/index.js";
2
- export * from "./pulumi/index.js";
3
2
  export { BuildApp } from "./BuildApp.js";
4
3
  export { BuildExtension } from "./BuildExtension.js";
5
4
  export { DeployApp } from "./DeployApp.js";
@@ -1,5 +1,4 @@
1
1
  export * from "./hooks/index.js";
2
- export * from "./pulumi/index.js";
3
2
  export { BuildApp } from "./BuildApp.js";
4
3
  export { BuildExtension } from "./BuildExtension.js";
5
4
  export { DeployApp } from "./DeployApp.js";
@@ -1 +1 @@
1
- {"version":3,"names":["BuildApp","BuildExtension","DeployApp","DestroyApp","ExportStack","GetApp","GetAppOutput","GetAppStackOutput","GetLogger","GetProductionEnvironments","GetProject","GetProjectConfig","GetProjectInfo","GetPulumiResourceNamePrefix","InstallExtension","IsCi","IsTelemetryEnabled","IsWcpEnabled","IsWebinyJsRepo","RefreshApp","RunPulumiCommand","ValidateProjectConfig","Watch","GetFeatureFlags"],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks/index.js\";\nexport * from \"./pulumi/index.js\";\nexport { BuildApp } from \"./BuildApp.js\";\nexport { BuildExtension } from \"./BuildExtension.js\";\nexport { DeployApp } from \"./DeployApp.js\";\nexport { DestroyApp } from \"./DestroyApp.js\";\nexport { ExportStack } from \"./ExportStack.js\";\nexport { GetApp } from \"./GetApp.js\";\nexport { GetAppOutput } from \"./GetAppOutput.js\";\nexport { GetAppStackOutput } from \"./GetAppStackOutput.js\";\nexport { GetLogger } from \"./GetLogger.js\";\nexport { GetProductionEnvironments } from \"./GetProductionEnvironments.js\";\nexport { GetProject } from \"./GetProject.js\";\nexport { GetProjectConfig } from \"./GetProjectConfig.js\";\nexport { GetProjectInfo } from \"./GetProjectInfo.js\";\nexport { GetPulumiResourceNamePrefix } from \"./GetPulumiResourceNamePrefix.js\";\nexport { InstallExtension } from \"./InstallExtension.js\";\nexport { IsCi } from \"./IsCi.js\";\nexport { IsTelemetryEnabled } from \"./IsTelemetryEnabled.js\";\nexport { IsWcpEnabled } from \"./IsWcpEnabled.js\";\nexport { IsWebinyJsRepo } from \"./IsWebinyJsRepo.js\";\nexport { RefreshApp } from \"./RefreshApp.js\";\nexport { RunPulumiCommand } from \"./RunPulumiCommand.js\";\nexport { ValidateProjectConfig } from \"./ValidateProjectConfig.js\";\nexport { Watch } from \"./Watch.js\";\nexport { GetFeatureFlags } from \"./GetFeatureFlags.js\";\n"],"mappings":"AAAA;AACA;AACA,SAASA,QAAQ;AACjB,SAASC,cAAc;AACvB,SAASC,SAAS;AAClB,SAASC,UAAU;AACnB,SAASC,WAAW;AACpB,SAASC,MAAM;AACf,SAASC,YAAY;AACrB,SAASC,iBAAiB;AAC1B,SAASC,SAAS;AAClB,SAASC,yBAAyB;AAClC,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,2BAA2B;AACpC,SAASC,gBAAgB;AACzB,SAASC,IAAI;AACb,SAASC,kBAAkB;AAC3B,SAASC,YAAY;AACrB,SAASC,cAAc;AACvB,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,qBAAqB;AAC9B,SAASC,KAAK;AACd,SAASC,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["BuildApp","BuildExtension","DeployApp","DestroyApp","ExportStack","GetApp","GetAppOutput","GetAppStackOutput","GetLogger","GetProductionEnvironments","GetProject","GetProjectConfig","GetProjectInfo","GetPulumiResourceNamePrefix","InstallExtension","IsCi","IsTelemetryEnabled","IsWcpEnabled","IsWebinyJsRepo","RefreshApp","RunPulumiCommand","ValidateProjectConfig","Watch","GetFeatureFlags"],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks/index.js\";\nexport { BuildApp } from \"./BuildApp.js\";\nexport { BuildExtension } from \"./BuildExtension.js\";\nexport { DeployApp } from \"./DeployApp.js\";\nexport { DestroyApp } from \"./DestroyApp.js\";\nexport { ExportStack } from \"./ExportStack.js\";\nexport { GetApp } from \"./GetApp.js\";\nexport { GetAppOutput } from \"./GetAppOutput.js\";\nexport { GetAppStackOutput } from \"./GetAppStackOutput.js\";\nexport { GetLogger } from \"./GetLogger.js\";\nexport { GetProductionEnvironments } from \"./GetProductionEnvironments.js\";\nexport { GetProject } from \"./GetProject.js\";\nexport { GetProjectConfig } from \"./GetProjectConfig.js\";\nexport { GetProjectInfo } from \"./GetProjectInfo.js\";\nexport { GetPulumiResourceNamePrefix } from \"./GetPulumiResourceNamePrefix.js\";\nexport { InstallExtension } from \"./InstallExtension.js\";\nexport { IsCi } from \"./IsCi.js\";\nexport { IsTelemetryEnabled } from \"./IsTelemetryEnabled.js\";\nexport { IsWcpEnabled } from \"./IsWcpEnabled.js\";\nexport { IsWebinyJsRepo } from \"./IsWebinyJsRepo.js\";\nexport { RefreshApp } from \"./RefreshApp.js\";\nexport { RunPulumiCommand } from \"./RunPulumiCommand.js\";\nexport { ValidateProjectConfig } from \"./ValidateProjectConfig.js\";\nexport { Watch } from \"./Watch.js\";\nexport { GetFeatureFlags } from \"./GetFeatureFlags.js\";\n"],"mappings":"AAAA;AACA,SAASA,QAAQ;AACjB,SAASC,cAAc;AACvB,SAASC,SAAS;AAClB,SAASC,UAAU;AACnB,SAASC,WAAW;AACpB,SAASC,MAAM;AACf,SAASC,YAAY;AACrB,SAASC,iBAAiB;AAC1B,SAASC,SAAS;AAClB,SAASC,yBAAyB;AAClC,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,2BAA2B;AACpC,SAASC,gBAAgB;AACzB,SAASC,IAAI;AACb,SAASC,kBAAkB;AAC3B,SAASC,YAAY;AACrB,SAASC,cAAc;AACvB,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,qBAAqB;AAC9B,SAASC,KAAK;AACd,SAASC,eAAe","ignoreList":[]}
@@ -18,7 +18,10 @@ export class ExtensionInstanceModel {
18
18
  const paramsSchema = typeof this.definition.paramsSchema === "function" ? this.definition.paramsSchema(this.context) : this.definition.paramsSchema;
19
19
  const validationResult = await paramsSchema.safeParseAsync(this.params);
20
20
  if (!validationResult.success) {
21
- const errorMessages = validationResult.error.issues.map(err => err.message).join("; ");
21
+ const errorMessages = validationResult.error.issues.map(err => {
22
+ const field = err.path.length > 0 ? `[${err.path.join(".")}] ` : "";
23
+ return `${field}${err.message}`;
24
+ }).join("; ");
22
25
  throw ProjectError.from(`Validation failed for extension of type %s: ${errorMessages}`, this.definition.type);
23
26
  }
24
27
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ProjectError","ExtensionInstanceModel","constructor","definition","params","context","build","validate","validateParams","paramsSchema","validationResult","safeParseAsync","success","errorMessages","error","issues","map","err","message","join","from","type"],"sources":["ExtensionInstanceModel.ts"],"sourcesContent":["import { type ExtensionDefinitionModel } from \"./ExtensionDefinitionModel.js\";\nimport { type z } from \"zod\";\nimport { type ProjectModel } from \"~/models/index.js\";\nimport { ProjectError } from \"~/ProjectError.js\";\n\nexport interface ExtensionInstanceModelContext {\n [key: string]: any;\n\n project: ProjectModel;\n}\n\nexport class ExtensionInstanceModel<TParamsSchema extends z.ZodTypeAny> {\n constructor(\n public definition: ExtensionDefinitionModel<TParamsSchema>,\n public params: z.infer<TParamsSchema>,\n public context: ExtensionInstanceModelContext\n ) {}\n\n async build() {\n return this.definition.build?.(this.params, this.context);\n }\n\n async validate() {\n return this.definition.validate?.(this.params);\n }\n\n async validateParams() {\n if (!this.definition.paramsSchema) {\n return;\n }\n\n const paramsSchema =\n typeof this.definition.paramsSchema === \"function\"\n ? this.definition.paramsSchema(this.context)\n : this.definition.paramsSchema;\n\n const validationResult = await paramsSchema.safeParseAsync(this.params);\n if (!validationResult.success) {\n const errorMessages = validationResult.error.issues\n .map((err: { message: string }) => err.message)\n .join(\"; \");\n\n throw ProjectError.from(\n `Validation failed for extension of type %s: ${errorMessages}`,\n this.definition.type\n );\n }\n }\n}\n"],"mappings":"AAGA,SAASA,YAAY;AAQrB,OAAO,MAAMC,sBAAsB,CAAqC;EACpEC,WAAWA,CACAC,UAAmD,EACnDC,MAA8B,EAC9BC,OAAsC,EAC/C;IAAA,KAHSF,UAAmD,GAAnDA,UAAmD;IAAA,KACnDC,MAA8B,GAA9BA,MAA8B;IAAA,KAC9BC,OAAsC,GAAtCA,OAAsC;EAC9C;EAEH,MAAMC,KAAKA,CAAA,EAAG;IACV,OAAO,IAAI,CAACH,UAAU,CAACG,KAAK,GAAG,IAAI,CAACF,MAAM,EAAE,IAAI,CAACC,OAAO,CAAC;EAC7D;EAEA,MAAME,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACJ,UAAU,CAACI,QAAQ,GAAG,IAAI,CAACH,MAAM,CAAC;EAClD;EAEA,MAAMI,cAAcA,CAAA,EAAG;IACnB,IAAI,CAAC,IAAI,CAACL,UAAU,CAACM,YAAY,EAAE;MAC/B;IACJ;IAEA,MAAMA,YAAY,GACd,OAAO,IAAI,CAACN,UAAU,CAACM,YAAY,KAAK,UAAU,GAC5C,IAAI,CAACN,UAAU,CAACM,YAAY,CAAC,IAAI,CAACJ,OAAO,CAAC,GAC1C,IAAI,CAACF,UAAU,CAACM,YAAY;IAEtC,MAAMC,gBAAgB,GAAG,MAAMD,YAAY,CAACE,cAAc,CAAC,IAAI,CAACP,MAAM,CAAC;IACvE,IAAI,CAACM,gBAAgB,CAACE,OAAO,EAAE;MAC3B,MAAMC,aAAa,GAAGH,gBAAgB,CAACI,KAAK,CAACC,MAAM,CAC9CC,GAAG,CAAEC,GAAwB,IAAKA,GAAG,CAACC,OAAO,CAAC,CAC9CC,IAAI,CAAC,IAAI,CAAC;MAEf,MAAMnB,YAAY,CAACoB,IAAI,CACnB,+CAA+CP,aAAa,EAAE,EAC9D,IAAI,CAACV,UAAU,CAACkB,IACpB,CAAC;IACL;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["ProjectError","ExtensionInstanceModel","constructor","definition","params","context","build","validate","validateParams","paramsSchema","validationResult","safeParseAsync","success","errorMessages","error","issues","map","err","field","path","length","join","message","from","type"],"sources":["ExtensionInstanceModel.ts"],"sourcesContent":["import { type ExtensionDefinitionModel } from \"./ExtensionDefinitionModel.js\";\nimport { type z } from \"zod\";\nimport { type ProjectModel } from \"~/models/index.js\";\nimport { ProjectError } from \"~/ProjectError.js\";\n\nexport interface ExtensionInstanceModelContext {\n [key: string]: any;\n\n project: ProjectModel;\n}\n\nexport class ExtensionInstanceModel<TParamsSchema extends z.ZodTypeAny> {\n constructor(\n public definition: ExtensionDefinitionModel<TParamsSchema>,\n public params: z.infer<TParamsSchema>,\n public context: ExtensionInstanceModelContext\n ) {}\n\n async build() {\n return this.definition.build?.(this.params, this.context);\n }\n\n async validate() {\n return this.definition.validate?.(this.params);\n }\n\n async validateParams() {\n if (!this.definition.paramsSchema) {\n return;\n }\n\n const paramsSchema =\n typeof this.definition.paramsSchema === \"function\"\n ? this.definition.paramsSchema(this.context)\n : this.definition.paramsSchema;\n\n const validationResult = await paramsSchema.safeParseAsync(this.params);\n if (!validationResult.success) {\n const errorMessages = validationResult.error.issues\n .map((err: { message: string; path: PropertyKey[] }) => {\n const field = err.path.length > 0 ? `[${err.path.join(\".\")}] ` : \"\";\n return `${field}${err.message}`;\n })\n .join(\"; \");\n\n throw ProjectError.from(\n `Validation failed for extension of type %s: ${errorMessages}`,\n this.definition.type\n );\n }\n }\n}\n"],"mappings":"AAGA,SAASA,YAAY;AAQrB,OAAO,MAAMC,sBAAsB,CAAqC;EACpEC,WAAWA,CACAC,UAAmD,EACnDC,MAA8B,EAC9BC,OAAsC,EAC/C;IAAA,KAHSF,UAAmD,GAAnDA,UAAmD;IAAA,KACnDC,MAA8B,GAA9BA,MAA8B;IAAA,KAC9BC,OAAsC,GAAtCA,OAAsC;EAC9C;EAEH,MAAMC,KAAKA,CAAA,EAAG;IACV,OAAO,IAAI,CAACH,UAAU,CAACG,KAAK,GAAG,IAAI,CAACF,MAAM,EAAE,IAAI,CAACC,OAAO,CAAC;EAC7D;EAEA,MAAME,QAAQA,CAAA,EAAG;IACb,OAAO,IAAI,CAACJ,UAAU,CAACI,QAAQ,GAAG,IAAI,CAACH,MAAM,CAAC;EAClD;EAEA,MAAMI,cAAcA,CAAA,EAAG;IACnB,IAAI,CAAC,IAAI,CAACL,UAAU,CAACM,YAAY,EAAE;MAC/B;IACJ;IAEA,MAAMA,YAAY,GACd,OAAO,IAAI,CAACN,UAAU,CAACM,YAAY,KAAK,UAAU,GAC5C,IAAI,CAACN,UAAU,CAACM,YAAY,CAAC,IAAI,CAACJ,OAAO,CAAC,GAC1C,IAAI,CAACF,UAAU,CAACM,YAAY;IAEtC,MAAMC,gBAAgB,GAAG,MAAMD,YAAY,CAACE,cAAc,CAAC,IAAI,CAACP,MAAM,CAAC;IACvE,IAAI,CAACM,gBAAgB,CAACE,OAAO,EAAE;MAC3B,MAAMC,aAAa,GAAGH,gBAAgB,CAACI,KAAK,CAACC,MAAM,CAC9CC,GAAG,CAAEC,GAA6C,IAAK;QACpD,MAAMC,KAAK,GAAGD,GAAG,CAACE,IAAI,CAACC,MAAM,GAAG,CAAC,GAAG,IAAIH,GAAG,CAACE,IAAI,CAACE,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE;QACnE,OAAO,GAAGH,KAAK,GAAGD,GAAG,CAACK,OAAO,EAAE;MACnC,CAAC,CAAC,CACDD,IAAI,CAAC,IAAI,CAAC;MAEf,MAAMrB,YAAY,CAACuB,IAAI,CACnB,+CAA+CV,aAAa,EAAE,EAC9D,IAAI,CAACV,UAAU,CAACqB,IACpB,CAAC;IACL;EACJ;AACJ","ignoreList":[]}
@@ -3,4 +3,3 @@ export { AdminBeforeBuild as AdminBeforeBuildHook } from "../../abstractions/fea
3
3
  export { AdminAfterDeploy as AdminAfterDeployHook } from "../../abstractions/features/hooks/AdminAfterDeploy.js";
4
4
  export { AdminBeforeDeploy as AdminBeforeDeployHook } from "../../abstractions/features/hooks/AdminBeforeDeploy.js";
5
5
  export { AdminBeforeWatch as AdminBeforeWatchHook } from "../../abstractions/features/hooks/AdminBeforeWatch.js";
6
- export { AdminPulumi } from "../../abstractions/features/pulumi/AdminPulumi.js";
@@ -3,6 +3,5 @@ export { AdminBeforeBuild as AdminBeforeBuildHook } from "../../abstractions/fea
3
3
  export { AdminAfterDeploy as AdminAfterDeployHook } from "../../abstractions/features/hooks/AdminAfterDeploy.js";
4
4
  export { AdminBeforeDeploy as AdminBeforeDeployHook } from "../../abstractions/features/hooks/AdminBeforeDeploy.js";
5
5
  export { AdminBeforeWatch as AdminBeforeWatchHook } from "../../abstractions/features/hooks/AdminBeforeWatch.js";
6
- export { AdminPulumi } from "../../abstractions/features/pulumi/AdminPulumi.js";
7
6
 
8
7
  //# sourceMappingURL=admin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AdminAfterBuild","AdminAfterBuildHook","AdminBeforeBuild","AdminBeforeBuildHook","AdminAfterDeploy","AdminAfterDeployHook","AdminBeforeDeploy","AdminBeforeDeployHook","AdminBeforeWatch","AdminBeforeWatchHook","AdminPulumi"],"sources":["admin.ts"],"sourcesContent":["export { AdminAfterBuild as AdminAfterBuildHook } from \"~/abstractions/features/hooks/AdminAfterBuild.js\";\nexport { AdminBeforeBuild as AdminBeforeBuildHook } from \"~/abstractions/features/hooks/AdminBeforeBuild.js\";\nexport { AdminAfterDeploy as AdminAfterDeployHook } from \"~/abstractions/features/hooks/AdminAfterDeploy.js\";\nexport { AdminBeforeDeploy as AdminBeforeDeployHook } from \"~/abstractions/features/hooks/AdminBeforeDeploy.js\";\nexport { AdminBeforeWatch as AdminBeforeWatchHook } from \"~/abstractions/features/hooks/AdminBeforeWatch.js\";\nexport { AdminPulumi } from \"~/abstractions/features/pulumi/AdminPulumi.js\";\n"],"mappings":"AAAA,SAASA,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,gBAAgB,IAAIC,oBAAoB;AACjD,SAASC,gBAAgB,IAAIC,oBAAoB;AACjD,SAASC,iBAAiB,IAAIC,qBAAqB;AACnD,SAASC,gBAAgB,IAAIC,oBAAoB;AACjD,SAASC,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["AdminAfterBuild","AdminAfterBuildHook","AdminBeforeBuild","AdminBeforeBuildHook","AdminAfterDeploy","AdminAfterDeployHook","AdminBeforeDeploy","AdminBeforeDeployHook","AdminBeforeWatch","AdminBeforeWatchHook"],"sources":["admin.ts"],"sourcesContent":["export { AdminAfterBuild as AdminAfterBuildHook } from \"~/abstractions/features/hooks/AdminAfterBuild.js\";\nexport { AdminBeforeBuild as AdminBeforeBuildHook } from \"~/abstractions/features/hooks/AdminBeforeBuild.js\";\nexport { AdminAfterDeploy as AdminAfterDeployHook } from \"~/abstractions/features/hooks/AdminAfterDeploy.js\";\nexport { AdminBeforeDeploy as AdminBeforeDeployHook } from \"~/abstractions/features/hooks/AdminBeforeDeploy.js\";\nexport { AdminBeforeWatch as AdminBeforeWatchHook } from \"~/abstractions/features/hooks/AdminBeforeWatch.js\";\n"],"mappings":"AAAA,SAASA,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,gBAAgB,IAAIC,oBAAoB;AACjD,SAASC,gBAAgB,IAAIC,oBAAoB;AACjD,SAASC,iBAAiB,IAAIC,qBAAqB;AACnD,SAASC,gBAAgB,IAAIC,oBAAoB","ignoreList":[]}
@@ -3,4 +3,3 @@ export { ApiBeforeBuild as ApiBeforeBuildHook } from "../../abstractions/feature
3
3
  export { ApiAfterDeploy as ApiAfterDeployHook } from "../../abstractions/features/hooks/ApiAfterDeploy.js";
4
4
  export { ApiBeforeDeploy as ApiBeforeDeployHook } from "../../abstractions/features/hooks/ApiBeforeDeploy.js";
5
5
  export { ApiBeforeWatch as ApiBeforeWatchHook } from "../../abstractions/features/hooks/ApiBeforeWatch.js";
6
- export { ApiPulumi } from "../../abstractions/features/pulumi/ApiPulumi.js";
@@ -3,6 +3,5 @@ export { ApiBeforeBuild as ApiBeforeBuildHook } from "../../abstractions/feature
3
3
  export { ApiAfterDeploy as ApiAfterDeployHook } from "../../abstractions/features/hooks/ApiAfterDeploy.js";
4
4
  export { ApiBeforeDeploy as ApiBeforeDeployHook } from "../../abstractions/features/hooks/ApiBeforeDeploy.js";
5
5
  export { ApiBeforeWatch as ApiBeforeWatchHook } from "../../abstractions/features/hooks/ApiBeforeWatch.js";
6
- export { ApiPulumi } from "../../abstractions/features/pulumi/ApiPulumi.js";
7
6
 
8
7
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ApiAfterBuild","ApiAfterBuildHook","ApiBeforeBuild","ApiBeforeBuildHook","ApiAfterDeploy","ApiAfterDeployHook","ApiBeforeDeploy","ApiBeforeDeployHook","ApiBeforeWatch","ApiBeforeWatchHook","ApiPulumi"],"sources":["api.ts"],"sourcesContent":["export { ApiAfterBuild as ApiAfterBuildHook } from \"~/abstractions/features/hooks/ApiAfterBuild.js\";\nexport { ApiBeforeBuild as ApiBeforeBuildHook } from \"~/abstractions/features/hooks/ApiBeforeBuild.js\";\nexport { ApiAfterDeploy as ApiAfterDeployHook } from \"~/abstractions/features/hooks/ApiAfterDeploy.js\";\nexport { ApiBeforeDeploy as ApiBeforeDeployHook } from \"~/abstractions/features/hooks/ApiBeforeDeploy.js\";\nexport { ApiBeforeWatch as ApiBeforeWatchHook } from \"~/abstractions/features/hooks/ApiBeforeWatch.js\";\nexport { ApiPulumi } from \"~/abstractions/features/pulumi/ApiPulumi.js\";\n"],"mappings":"AAAA,SAASA,aAAa,IAAIC,iBAAiB;AAC3C,SAASC,cAAc,IAAIC,kBAAkB;AAC7C,SAASC,cAAc,IAAIC,kBAAkB;AAC7C,SAASC,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,cAAc,IAAIC,kBAAkB;AAC7C,SAASC,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["ApiAfterBuild","ApiAfterBuildHook","ApiBeforeBuild","ApiBeforeBuildHook","ApiAfterDeploy","ApiAfterDeployHook","ApiBeforeDeploy","ApiBeforeDeployHook","ApiBeforeWatch","ApiBeforeWatchHook"],"sources":["api.ts"],"sourcesContent":["export { ApiAfterBuild as ApiAfterBuildHook } from \"~/abstractions/features/hooks/ApiAfterBuild.js\";\nexport { ApiBeforeBuild as ApiBeforeBuildHook } from \"~/abstractions/features/hooks/ApiBeforeBuild.js\";\nexport { ApiAfterDeploy as ApiAfterDeployHook } from \"~/abstractions/features/hooks/ApiAfterDeploy.js\";\nexport { ApiBeforeDeploy as ApiBeforeDeployHook } from \"~/abstractions/features/hooks/ApiBeforeDeploy.js\";\nexport { ApiBeforeWatch as ApiBeforeWatchHook } from \"~/abstractions/features/hooks/ApiBeforeWatch.js\";\n"],"mappings":"AAAA,SAASA,aAAa,IAAIC,iBAAiB;AAC3C,SAASC,cAAc,IAAIC,kBAAkB;AAC7C,SAASC,cAAc,IAAIC,kBAAkB;AAC7C,SAASC,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,cAAc,IAAIC,kBAAkB","ignoreList":[]}
@@ -2,4 +2,3 @@ export { CoreAfterBuild as CoreAfterBuildHook } from "../../abstractions/feature
2
2
  export { CoreBeforeBuild as CoreBeforeBuildHook } from "../../abstractions/features/hooks/CoreBeforeBuild.js";
3
3
  export { CoreAfterDeploy as CoreAfterDeployHook } from "../../abstractions/features/hooks/CoreAfterDeploy.js";
4
4
  export { CoreBeforeDeploy as CoreBeforeDeployHook } from "../../abstractions/features/hooks/CoreBeforeDeploy.js";
5
- export { CorePulumi } from "../../abstractions/features/pulumi/CorePulumi.js";
@@ -2,6 +2,5 @@ export { CoreAfterBuild as CoreAfterBuildHook } from "../../abstractions/feature
2
2
  export { CoreBeforeBuild as CoreBeforeBuildHook } from "../../abstractions/features/hooks/CoreBeforeBuild.js";
3
3
  export { CoreAfterDeploy as CoreAfterDeployHook } from "../../abstractions/features/hooks/CoreAfterDeploy.js";
4
4
  export { CoreBeforeDeploy as CoreBeforeDeployHook } from "../../abstractions/features/hooks/CoreBeforeDeploy.js";
5
- export { CorePulumi } from "../../abstractions/features/pulumi/CorePulumi.js";
6
5
 
7
6
  //# sourceMappingURL=core.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CoreAfterBuild","CoreAfterBuildHook","CoreBeforeBuild","CoreBeforeBuildHook","CoreAfterDeploy","CoreAfterDeployHook","CoreBeforeDeploy","CoreBeforeDeployHook","CorePulumi"],"sources":["core.ts"],"sourcesContent":["export { CoreAfterBuild as CoreAfterBuildHook } from \"~/abstractions/features/hooks/CoreAfterBuild.js\";\nexport { CoreBeforeBuild as CoreBeforeBuildHook } from \"~/abstractions/features/hooks/CoreBeforeBuild.js\";\nexport { CoreAfterDeploy as CoreAfterDeployHook } from \"~/abstractions/features/hooks/CoreAfterDeploy.js\";\nexport { CoreBeforeDeploy as CoreBeforeDeployHook } from \"~/abstractions/features/hooks/CoreBeforeDeploy.js\";\nexport { CorePulumi } from \"~/abstractions/features/pulumi/CorePulumi.js\";\n"],"mappings":"AAAA,SAASA,cAAc,IAAIC,kBAAkB;AAC7C,SAASC,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,gBAAgB,IAAIC,oBAAoB;AACjD,SAASC,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["CoreAfterBuild","CoreAfterBuildHook","CoreBeforeBuild","CoreBeforeBuildHook","CoreAfterDeploy","CoreAfterDeployHook","CoreBeforeDeploy","CoreBeforeDeployHook"],"sources":["core.ts"],"sourcesContent":["export { CoreAfterBuild as CoreAfterBuildHook } from \"~/abstractions/features/hooks/CoreAfterBuild.js\";\nexport { CoreBeforeBuild as CoreBeforeBuildHook } from \"~/abstractions/features/hooks/CoreBeforeBuild.js\";\nexport { CoreAfterDeploy as CoreAfterDeployHook } from \"~/abstractions/features/hooks/CoreAfterDeploy.js\";\nexport { CoreBeforeDeploy as CoreBeforeDeployHook } from \"~/abstractions/features/hooks/CoreBeforeDeploy.js\";\n"],"mappings":"AAAA,SAASA,cAAc,IAAIC,kBAAkB;AAC7C,SAASC,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,eAAe,IAAIC,mBAAmB;AAC/C,SAASC,gBAAgB,IAAIC,oBAAoB","ignoreList":[]}
@@ -103,7 +103,7 @@ export default BuildParam.createImplementation({
103
103
  const last = importDeclarations[importDeclarations.length - 1];
104
104
  index = last.getChildIndex() + 1;
105
105
  }
106
- const contextPluginImportPath = "@webiny/handler/plugins/RegisterExtensionPlugin";
106
+ const contextPluginImportPath = "@webiny/handler/plugins/RegisterExtensionPlugin.js";
107
107
  const existingContextPluginImport = source.getImportDeclaration(contextPluginImportPath);
108
108
  if (!existingContextPluginImport) {
109
109
  source.insertImportDeclaration(index, {
@@ -1 +1 @@
1
- {"version":3,"names":["z","Node","Project","defineExtension","crypto","path","fs","BuildParam","type","tags","runtimeContext","appName","description","multiple","paramsSchema","object","paramName","string","value","union","record","any","array","number","boolean","build","params","ctx","extensionsTsFilePath","project","paths","workspaceFolder","join","toString","buildParamsDir","valueStr","JSON","stringify","hash","createHash","update","digest","className","slice","fileName","filePath","existsSync","mkdirSync","recursive","fileContent","writeFileSync","addSourceFileAtPath","source","getSourceFileOrThrow","importPath","relative","dirname","replace","startsWith","existingImportDeclaration","getImportDeclaration","index","importDeclarations","getImportDeclarations","length","last","getChildIndex","insertImportDeclaration","defaultImport","moduleSpecifier","pluginsArray","getFirstDescendant","node","isArrayLiteralExpression","addElement","contextPluginImportPath","existingContextPluginImport","namedImports","save"],"sources":["ApiBuildParam.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport crypto from \"crypto\";\nimport path from \"path\";\nimport fs from \"fs\";\n\nexport const BuildParam = defineExtension({\n type: \"Api/BuildParam\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add build-time parameter to API app.\",\n multiple: true,\n paramsSchema: () => {\n return z.object({\n paramName: z.string(),\n value: z.union([\n z.string(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n z.number(),\n z.boolean()\n ])\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const buildParamsDir = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"buildParams\")\n .toString();\n\n const { paramName, value } = params;\n\n // Serialize value to a TypeScript literal.\n const valueStr = JSON.stringify(value, null, 4);\n\n // Generate a unique class name based on the paramName.\n const hash = crypto.createHash(\"sha256\").update(paramName).digest(\"hex\");\n const className = `BuildParam_${hash.slice(-10)}`;\n const fileName = `${className}.ts`;\n const filePath = path.join(buildParamsDir, fileName);\n\n // Ensure buildParams directory exists.\n if (!fs.existsSync(buildParamsDir)) {\n fs.mkdirSync(buildParamsDir, { recursive: true });\n }\n\n // Check if file already exists.\n if (fs.existsSync(filePath)) {\n // File exists, just ensure it's imported in extensions.ts\n } else {\n // Create the BuildParam implementation file.\n const fileContent = `import { BuildParam } from \"webiny/api/build-params\";\n\nclass ${className} implements BuildParam.Interface {\n key = \"${paramName}\";\n value = ${valueStr};\n}\n\nexport default BuildParam.createImplementation({\n implementation: ${className},\n dependencies: []\n});\n`;\n fs.writeFileSync(filePath, fileContent, \"utf8\");\n }\n\n // Now update extensions.ts to import and register this BuildParam.\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Calculate import path relative to extensions.ts.\n let importPath = path\n .relative(path.dirname(extensionsTsFilePath), filePath)\n .replace(/\\.tsx?$/, \".js\");\n\n // Ensure the path starts with ./\n if (!importPath.startsWith(\".\")) {\n importPath = \"./\" + importPath;\n }\n\n // Check if import already exists.\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Add import for the BuildParam implementation.\n source.insertImportDeclaration(index, {\n defaultImport: className,\n moduleSpecifier: importPath\n });\n\n // Add the registration to the plugins array.\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${className});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const contextPluginImportPath = \"@webiny/handler/plugins/RegisterExtensionPlugin\";\n const existingContextPluginImport =\n source.getImportDeclaration(contextPluginImportPath);\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: contextPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,IAAI,EAAEC,OAAO,QAAgC,UAAU;AAChE,SAASC,eAAe;AACxB,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AAEnB,OAAO,MAAMC,UAAU,GAAGJ,eAAe,CAAC;EACtCK,IAAI,EAAE,gBAAgB;EACtBC,IAAI,EAAE;IAAEC,cAAc,EAAE,WAAW;IAAEC,OAAO,EAAE;EAAM,CAAC;EACrDC,WAAW,EAAE,sCAAsC;EACnDC,QAAQ,EAAE,IAAI;EACdC,YAAY,EAAEA,CAAA,KAAM;IAChB,OAAOd,CAAC,CAACe,MAAM,CAAC;MACZC,SAAS,EAAEhB,CAAC,CAACiB,MAAM,CAAC,CAAC;MACrBC,KAAK,EAAElB,CAAC,CAACmB,KAAK,CAAC,CACXnB,CAAC,CAACiB,MAAM,CAAC,CAAC,EACVjB,CAAC,CAACoB,MAAM,CAACpB,CAAC,CAACiB,MAAM,CAAC,CAAC,EAAEjB,CAAC,CAACqB,GAAG,CAAC,CAAC,CAAC,EAC7BrB,CAAC,CAACsB,KAAK,CAACtB,CAAC,CAACqB,GAAG,CAAC,CAAC,CAAC,EAChBrB,CAAC,CAACuB,MAAM,CAAC,CAAC,EACVvB,CAAC,CAACwB,OA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ACmB,kBAAkB,CAACC,IAAI,IAC/CvE,IAAI,CAACwE,wBAAwB,CAACD,IAAI,CACtC,CAA2B;IAE3BF,YAAY,CAACI,UAAU,CACnB,gFAAgFhC,SAAS,QAC7F,CAAC;IAED;MACI,IAAImB,KAAK,GAAG,CAAC;MAEb,MAAMC,kBAAkB,GAAGV,MAAM,CAACW,qBAAqB,CAAC,CAAC;MACzD,IAAID,kBAAkB,CAACE,MAAM,EAAE;QAC3B,MAAMC,IAAI,GAAGH,kBAAkB,CAACA,kBAAkB,CAACE,MAAM,GAAG,CAAC,CAAC;QAC9DH,KAAK,GAAGI,IAAI,CAACC,aAAa,CAAC,CAAC,GAAG,CAAC;MACpC;MAEA,MAAMS,uBAAuB,GAAG,iDAAiD;MACjF,MAAMC,2BAA2B,GAC7BxB,MAAM,CAACQ,oBAAoB,CAACe,uBAAuB,CAAC;MACxD,IAAI,CAACC,2BAA2B,EAAE;QAC9BxB,MAAM,CAACe,uBAAuB,CAACN,KAAK,EAAE;UAClCgB,YAAY,EAAE,CAAC,+BAA+B,CAAC;UAC/CR,eAAe,EAAEM;QACrB,CAAC,CAAC;MACN;IACJ;IAEA,MAAMvB,MAAM,CAAC0B,IAAI,CAAC,CAAC;EACvB;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["z","Node","Project","defineExtension","crypto","path","fs","BuildParam","type","tags","runtimeContext","appName","description","multiple","paramsSchema","object","paramName","string","value","union","record","any","array","number","boolean","build","params","ctx","extensionsTsFilePath","project","paths","workspaceFolder","join","toString","buildParamsDir","valueStr","JSON","stringify","hash","createHash","update","digest","className","slice","fileName","filePath","existsSync","mkdirSync","recursive","fileContent","writeFileSync","addSourceFileAtPath","source","getSourceFileOrThrow","importPath","relative","dirname","replace","startsWith","existingImportDeclaration","getImportDeclaration","index","importDeclarations","getImportDeclarations","length","last","getChildIndex","insertImportDeclaration","defaultImport","moduleSpecifier","pluginsArray","getFirstDescendant","node","isArrayLiteralExpression","addElement","contextPluginImportPath","existingContextPluginImport","namedImports","save"],"sources":["ApiBuildParam.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport crypto from \"crypto\";\nimport path from \"path\";\nimport fs from \"fs\";\n\nexport const BuildParam = defineExtension({\n type: \"Api/BuildParam\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add build-time parameter to API app.\",\n multiple: true,\n paramsSchema: () => {\n return z.object({\n paramName: z.string(),\n value: z.union([\n z.string(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n z.number(),\n z.boolean()\n ])\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const buildParamsDir = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"buildParams\")\n .toString();\n\n const { paramName, value } = params;\n\n // Serialize value to a TypeScript literal.\n const valueStr = JSON.stringify(value, null, 4);\n\n // Generate a unique class name based on the paramName.\n const hash = crypto.createHash(\"sha256\").update(paramName).digest(\"hex\");\n const className = `BuildParam_${hash.slice(-10)}`;\n const fileName = `${className}.ts`;\n const filePath = path.join(buildParamsDir, fileName);\n\n // Ensure buildParams directory exists.\n if (!fs.existsSync(buildParamsDir)) {\n fs.mkdirSync(buildParamsDir, { recursive: true });\n }\n\n // Check if file already exists.\n if (fs.existsSync(filePath)) {\n // File exists, just ensure it's imported in extensions.ts\n } else {\n // Create the BuildParam implementation file.\n const fileContent = `import { BuildParam } from \"webiny/api/build-params\";\n\nclass ${className} implements BuildParam.Interface {\n key = \"${paramName}\";\n value = ${valueStr};\n}\n\nexport default BuildParam.createImplementation({\n implementation: ${className},\n dependencies: []\n});\n`;\n fs.writeFileSync(filePath, fileContent, \"utf8\");\n }\n\n // Now update extensions.ts to import and register this BuildParam.\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Calculate import path relative to extensions.ts.\n let importPath = path\n .relative(path.dirname(extensionsTsFilePath), filePath)\n .replace(/\\.tsx?$/, \".js\");\n\n // Ensure the path starts with ./\n if (!importPath.startsWith(\".\")) {\n importPath = \"./\" + importPath;\n }\n\n // Check if import already exists.\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Add import for the BuildParam implementation.\n source.insertImportDeclaration(index, {\n defaultImport: className,\n moduleSpecifier: importPath\n });\n\n // Add the registration to the plugins array.\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${className});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const contextPluginImportPath = \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n const existingContextPluginImport =\n source.getImportDeclaration(contextPluginImportPath);\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: contextPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,IAAI,EAAEC,OAAO,QAAgC,UAAU;AAChE,SAASC,eAAe;AACxB,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AAEnB,OAAO,MAAMC,UAAU,GAAGJ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AK,EAAE;UAClCgB,YAAY,EAAE,CAAC,+BAA+B,CAAC;UAC/CR,eAAe,EAAEM;QACrB,CAAC,CAAC;MACN;IACJ;IAEA,MAAMvB,MAAM,CAAC0B,IAAI,CAAC,CAAC;EACvB;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -86,7 +86,7 @@ export const ApiExtension = defineExtension({
86
86
  const last = importDeclarations[importDeclarations.length - 1];
87
87
  index = last.getChildIndex() + 1;
88
88
  }
89
- const registerExtensionPluginImportPath = "@webiny/handler/plugins/RegisterExtensionPlugin";
89
+ const registerExtensionPluginImportPath = "@webiny/handler/plugins/RegisterExtensionPlugin.js";
90
90
  const existingContextPluginImport = source.getImportDeclaration(registerExtensionPluginImportPath);
91
91
  if (!existingContextPluginImport) {
92
92
  source.insertImportDeclaration(index, {
@@ -1 +1 @@
1
- {"version":3,"names":["defineExtension","zodSrcPath","ExtensionSrcResolver","z","path","Node","Project","crypto","ApiExtension","type","tags","runtimeContext","appName","description","multiple","paramsSchema","project","object","src","exportName","string","optional","build","params","ctx","extensionsTsFilePath","paths","workspaceFolder","join","toString","extensionFilePath","absoluteExtensionFilePath","resolvePath","extensionFileName","basename","parse","name","hash","createHash","update","digest","exportNameAlias","slice","importPath","relative","dirname","replace","addSourceFileAtPath","source","getSourceFileOrThrow","existingImportDeclaration","getImportDeclaration","index","importDeclarations","getImportDeclarations","length","last","getChildIndex","extensionProject","extensionSource","hasDefaultExport","getDefaultExportSymbol","undefined","insertImportDeclaration","defaultImport","moduleSpecifier","namedImports","alias","pluginsArray","getFirstDescendant","node","isArrayLiteralExpression","addElement","registerExtensionPluginImportPath","existingContextPluginImport","save"],"sources":["ApiExtension.ts"],"sourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport crypto from \"crypto\";\n\nexport const ApiExtension = defineExtension({\n type: \"Api/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add any API extension.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name is always the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Alias name is \"ApiExtension_\" + hash of the file path. This way we\n // avoid potential naming conflicts and keep the identifier constant.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const exportNameAlias = `ApiExtension_${hash.slice(-10)}`;\n\n // Calculate import path relative to `extensions.ts` file.\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Check if the file has a default export using AST parsing.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n const hasDefaultExport = extensionSource.getDefaultExportSymbol() !== undefined;\n\n // Support both default and named exports.\n if (hasDefaultExport) {\n source.insertImportDeclaration(index, {\n defaultImport: exportNameAlias,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: exportNameAlias }],\n moduleSpecifier: importPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${exportNameAlias});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const registerExtensionPluginImportPath =\n \"@webiny/handler/plugins/RegisterExtensionPlugin\";\n const existingContextPluginImport = source.getImportDeclaration(\n registerExtensionPluginImportPath\n );\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU;AACpC,SAASC,oBAAoB,QAAQ,iBAAiB;AACtD,SAASC,CAAC,QAAQ,KAAK;AACvB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,IAAI,EAAEC,OAAO,QAAgC,UAAU;AAChE,OAAOC,MAAM,MAAM,QAAQ;AAE3B,OAAO,MAAMC,YAAY,GAAGR,eAAe,CAAC;EACxCS,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE;IAAEC,cAAc,EAAE,WAAW;IAAEC,OAAO,EAAE;EAAM,CAAC;EACrDC,WAAW,EAAE,wBAAwB;EACrCC,QAAQ,EAAE,IAAI;EACdC,YAAY,EAAEA,CAAC;IAAEC;EAAQ,CAAC,KAAK;IAC3B,OAAOb,CAAC,CAACc,MAAM,CAAC;MACZC,GAAG,EAAEjB,UAAU,CAAC;QAAEe;MAAQ,CAAC,CAAC;MAC5BG,UAAU,EAAEhB,CAAC,CAACiB,MAAM,CAAC,C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AAM,CAACM,qBAAqB,CAAC,CAAC;MACzD,IAAID,kBAAkB,CAACE,MAAM,EAAE;QAC3B,MAAMC,IAAI,GAAGH,kBAAkB,CAACA,kBAAkB,CAACE,MAAM,GAAG,CAAC,CAAC;QAC9DH,KAAK,GAAGI,IAAI,CAACC,aAAa,CAAC,CAAC,GAAG,CAAC;MACpC;MAEA,MAAMgB,iCAAiC,GACnC,iDAAiD;MACrD,MAAMC,2BAA2B,GAAG1B,MAAM,CAACG,oBAAoB,CAC3DsB,iCACJ,CAAC;MACD,IAAI,CAACC,2BAA2B,EAAE;QAC9B1B,MAAM,CAACe,uBAAuB,CAACX,KAAK,EAAE;UAClCc,YAAY,EAAE,CAAC,+BAA+B,CAAC;UAC/CD,eAAe,EAAEQ;QACrB,CAAC,CAAC;MACN;IACJ;IAEA,MAAMzB,MAAM,CAAC2B,IAAI,CAAC,CAAC;EACvB;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["defineExtension","zodSrcPath","ExtensionSrcResolver","z","path","Node","Project","crypto","ApiExtension","type","tags","runtimeContext","appName","description","multiple","paramsSchema","project","object","src","exportName","string","optional","build","params","ctx","extensionsTsFilePath","paths","workspaceFolder","join","toString","extensionFilePath","absoluteExtensionFilePath","resolvePath","extensionFileName","basename","parse","name","hash","createHash","update","digest","exportNameAlias","slice","importPath","relative","dirname","replace","addSourceFileAtPath","source","getSourceFileOrThrow","existingImportDeclaration","getImportDeclaration","index","importDeclarations","getImportDeclarations","length","last","getChildIndex","extensionProject","extensionSource","hasDefaultExport","getDefaultExportSymbol","undefined","insertImportDeclaration","defaultImport","moduleSpecifier","namedImports","alias","pluginsArray","getFirstDescendant","node","isArrayLiteralExpression","addElement","registerExtensionPluginImportPath","existingContextPluginImport","save"],"sources":["ApiExtension.ts"],"sourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport crypto from \"crypto\";\n\nexport const ApiExtension = defineExtension({\n type: \"Api/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add any API extension.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name is always the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Alias name is \"ApiExtension_\" + hash of the file path. This way we\n // avoid potential naming conflicts and keep the identifier constant.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const exportNameAlias = `ApiExtension_${hash.slice(-10)}`;\n\n // Calculate import path relative to `extensions.ts` file.\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Check if the file has a default export using AST parsing.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n const hasDefaultExport = extensionSource.getDefaultExportSymbol() !== undefined;\n\n // Support both default and named exports.\n if (hasDefaultExport) {\n source.insertImportDeclaration(index, {\n defaultImport: exportNameAlias,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: exportNameAlias }],\n moduleSpecifier: importPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${exportNameAlias});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const registerExtensionPluginImportPath =\n \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n const existingContextPluginImport = source.getImportDeclaration(\n registerExtensionPluginImportPath\n );\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU;AACpC,SAASC,oBAAoB,QAAQ,iBAAiB;AACtD,SAASC,CAAC,QAAQ,KAAK;AACvB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,IAAI,EAAEC,OAAO,QAAgC,UAAU;AAChE,OAAOC,MAAM,MAAM,QAAQ;AAE3B,OAAO,MAAMC,YAAY,GAAGR,eAAe,CAAC;EACxCS,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE;IAAEC,cAAc,EAAE,WAAW;IAAEC,OAAO,EAAE;EAAM,CAAC;EACrDC,WAAW,EAAE,wBAAwB;EACrCC,QAAQ,EAAE,IAAI;EACdC,YAAY,EAAEA,CAAC;IAAEC;EAAQ,CAAC,KAAK;IAC3B,OAAOb,CAAC,CAACc,MAAM,CAAC;MACZC,GAAG,EAAEjB,UAAU,CAAC;QAA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,CAAC;IAED;MACI,IAAIW,KAAK,GAAG,CAAC;MAEb,MAAMC,kBAAkB,GAAGL,MAAM,CAACM,qBAAqB,CAAC,CAAC;MACzD,IAAID,kBAAkB,CAACE,MAAM,EAAE;QAC3B,MAAMC,IAAI,GAAGH,kBAAkB,CAACA,kBAAkB,CAACE,MAAM,GAAG,CAAC,CAAC;QAC9DH,KAAK,GAAGI,IAAI,CAACC,aAAa,CAAC,CAAC,GAAG,CAAC;MACpC;MAEA,MAAMgB,iCAAiC,GACnC,oDAAoD;MACxD,MAAMC,2BAA2B,GAAG1B,MAAM,CAACG,oBAAoB,CAC3DsB,iCACJ,CAAC;MACD,IAAI,CAACC,2BAA2B,EAAE;QAC9B1B,MAAM,CAACe,uBAAuB,CAACX,KAAK,EAAE;UAClCc,YAAY,EAAE,CAAC,+BAA+B,CAAC;UAC/CD,eAAe,EAAEQ;QACrB,CAAC,CAAC;MACN;IACJ;IAEA,MAAMzB,MAAM,CAAC2B,IAAI,CAAC,CAAC;EACvB;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ import { BeforeDeploy, GetProductionEnvironments, GetProjectConfig, ProjectSdkParamsService } from "../../abstractions/index.js";
2
+ declare class ValidateEncryptionBeforeDeployImpl implements BeforeDeploy.Interface {
3
+ private getProductionEnvironments;
4
+ private projectSdkParamsService;
5
+ private getProjectConfig;
6
+ constructor(getProductionEnvironments: GetProductionEnvironments.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface, getProjectConfig: GetProjectConfig.Interface);
7
+ execute(): Promise<void>;
8
+ }
9
+ export declare const ValidateEncryptionBeforeDeploy: typeof ValidateEncryptionBeforeDeployImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").IBeforeDeploy>;
11
+ };
12
+ export {};
@@ -0,0 +1,32 @@
1
+ import { BeforeDeploy, GetProductionEnvironments, GetProjectConfig, ProjectSdkParamsService } from "../../abstractions/index.js";
2
+ import { GracefulError } from "@webiny/project";
3
+ class ValidateEncryptionBeforeDeployImpl {
4
+ constructor(getProductionEnvironments, projectSdkParamsService, getProjectConfig) {
5
+ this.getProductionEnvironments = getProductionEnvironments;
6
+ this.projectSdkParamsService = projectSdkParamsService;
7
+ this.getProjectConfig = getProjectConfig;
8
+ }
9
+ async execute() {
10
+ const {
11
+ env
12
+ } = this.projectSdkParamsService.get();
13
+ const prodEnvs = await this.getProductionEnvironments.execute();
14
+ if (!prodEnvs.includes(env)) {
15
+ return;
16
+ }
17
+ const projectConfig = await this.getProjectConfig.execute();
18
+ const [encryption] = projectConfig.extensionsByType("Infra/Encryption");
19
+ if (encryption) {
20
+ return;
21
+ }
22
+ const error = new Error("Encryption is not configured for production environment.");
23
+ const message = ["Deploying to a production environment requires encryption to be configured.", "Set the %s environment variable and add %s to your project config.", "Learn more: https://webiny.link/encryption"].join(" ");
24
+ throw GracefulError.from(error, message, "WEBINY_ENCRYPTION_PASSPHRASE", "<Infra.Encryption>");
25
+ }
26
+ }
27
+ export const ValidateEncryptionBeforeDeploy = BeforeDeploy.createImplementation({
28
+ implementation: ValidateEncryptionBeforeDeployImpl,
29
+ dependencies: [GetProductionEnvironments, ProjectSdkParamsService, GetProjectConfig]
30
+ });
31
+
32
+ //# sourceMappingURL=ValidateEncryptionBeforeDeploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BeforeDeploy","GetProductionEnvironments","GetProjectConfig","ProjectSdkParamsService","GracefulError","ValidateEncryptionBeforeDeployImpl","constructor","getProductionEnvironments","projectSdkParamsService","getProjectConfig","execute","env","get","prodEnvs","includes","projectConfig","encryption","extensionsByType","error","Error","message","join","from","ValidateEncryptionBeforeDeploy","createImplementation","implementation","dependencies"],"sources":["ValidateEncryptionBeforeDeploy.ts"],"sourcesContent":["import {\n BeforeDeploy,\n GetProductionEnvironments,\n GetProjectConfig,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\n\nclass ValidateEncryptionBeforeDeployImpl implements BeforeDeploy.Interface {\n constructor(\n private getProductionEnvironments: GetProductionEnvironments.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface,\n private getProjectConfig: GetProjectConfig.Interface\n ) {}\n\n async execute() {\n const { env } = this.projectSdkParamsService.get();\n const prodEnvs = await this.getProductionEnvironments.execute();\n\n if (!prodEnvs.includes(env)) {\n return;\n }\n\n const projectConfig = await this.getProjectConfig.execute();\n const [encryption] = projectConfig.extensionsByType(\"Infra/Encryption\");\n\n if (encryption) {\n return;\n }\n\n const error = new Error(\"Encryption is not configured for production environment.\");\n\n const message = [\n \"Deploying to a production environment requires encryption to be configured.\",\n \"Set the %s environment variable and add %s to your project config.\",\n \"Learn more: https://webiny.link/encryption\"\n ].join(\" \");\n\n throw GracefulError.from(\n error,\n message,\n \"WEBINY_ENCRYPTION_PASSPHRASE\",\n \"<Infra.Encryption>\"\n );\n }\n}\n\nexport const ValidateEncryptionBeforeDeploy = BeforeDeploy.createImplementation({\n implementation: ValidateEncryptionBeforeDeployImpl,\n dependencies: [GetProductionEnvironments, ProjectSdkParamsService, GetProjectConfig]\n});\n"],"mappings":"AAAA,SACIA,YAAY,EACZC,yBAAyB,EACzBC,gBAAgB,EAChBC,uBAAuB;AAE3B,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,MAAMC,kCAAkC,CAAmC;EACvEC,WAAWA,CACCC,yBAA8D,EAC9DC,uBAA0D,EAC1DC,gBAA4C,EACtD;IAAA,KAHUF,yBAA8D,GAA9DA,yBAA8D;IAAA,KAC9DC,uBAA0D,GAA1DA,uBAA0D;IAAA,KAC1DC,gBAA4C,GAA5CA,gBAA4C;EACrD;EAEH,MAAMC,OAAOA,CAAA,EAAG;IACZ,MAAM;MAAEC;IAAI,CAAC,GAAG,IAAI,CAACH,uBAAuB,CAACI,GAAG,CAAC,CAAC;IAClD,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACN,yBAAyB,CAACG,OAAO,CAAC,CAAC;IAE/D,IAAI,CAACG,QAAQ,CAACC,QAAQ,CAACH,GAAG,CAAC,EAAE;MACzB;IACJ;IAEA,MAAMI,aAAa,GAAG,MAAM,IAAI,CAACN,gBAAgB,CAACC,OAAO,CAAC,CAAC;IAC3D,MAAM,CAACM,UAAU,CAAC,GAAGD,aAAa,CAACE,gBAAgB,CAAC,kBAAkB,CAAC;IAEvE,IAAID,UAAU,EAAE;MACZ;IACJ;IAEA,MAAME,KAAK,GAAG,IAAIC,KAAK,CAAC,0DAA0D,CAAC;IAEnF,MAAMC,OAAO,GAAG,CACZ,6EAA6E,EAC7E,oEAAoE,EACpE,4CAA4C,CAC/C,CAACC,IAAI,CAAC,GAAG,CAAC;IAEX,MAAMjB,aAAa,CAACkB,IAAI,CACpBJ,KAAK,EACLE,OAAO,EACP,8BAA8B,EAC9B,oBACJ,CAAC;EACL;AACJ;AAEA,OAAO,MAAMG,8BAA8B,GAAGvB,YAAY,CAACwB,oBAAoB,CAAC;EAC5EC,cAAc,EAAEpB,kCAAkC;EAClDqB,YAAY,EAAE,CAACzB,yBAAyB,EAAEE,uBAAuB,EAAED,gBAAgB;AACvF,CAAC,CAAC","ignoreList":[]}
@@ -25,6 +25,8 @@ export const Project = () => {
25
25
  src: p("TelemetryNoLongerNewUser.js")
26
26
  }), /*#__PURE__*/React.createElement(BeforeDeploy, {
27
27
  src: p("EnsureTelemetryEnabledForOss.js")
28
+ }), /*#__PURE__*/React.createElement(BeforeDeploy, {
29
+ src: p("ValidateEncryptionBeforeDeploy.js")
28
30
  }), /*#__PURE__*/React.createElement(CoreBeforeDeploy, {
29
31
  src: p("ValidateProductionPulumiState.js")
30
32
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["React","createPathResolver","AdminAfterDeploy","AdminBeforeBuild","AdminBeforeWatch","ApiAfterBuild","ApiBeforeDeploy","ApiBeforeWatch","BeforeDeploy","CoreBeforeDeploy","p","import","meta","dirname","Project","createElement","Fragment","src"],"sources":["Project.tsx"],"sourcesContent":["import React from \"react\";\nimport { createPathResolver } from \"~/utils/createPathResolver.js\";\nimport {\n AdminAfterDeploy,\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiAfterBuild,\n ApiBeforeDeploy,\n ApiBeforeWatch,\n BeforeDeploy,\n CoreBeforeDeploy\n} from \"~/extensions/index.js\";\n\nconst p = createPathResolver(import.meta.dirname, \"Project\");\n\nexport const Project = () => {\n return (\n <>\n <AdminBeforeBuild src={p(\"SetAdminAppEnvVarsBeforeBuild.js\")} />\n <AdminBeforeWatch src={p(\"SetAdminAppEnvVarsBeforeWatch.js\")} />\n <AdminBeforeWatch src={p(\"ShowConfigChangeInfoBeforeAdminWatch.js\")} />\n <ApiAfterBuild src={p(\"WcpInjectTelemetryClientAfterBuild.js\")} />\n <ApiBeforeDeploy src={p(\"EnsureCoreDeployedBeforeApiDeploy.js\")} />\n <ApiBeforeWatch src={p(\"EnsureApiDeployedBeforeWatch.js\")} />\n <ApiBeforeWatch src={p(\"ShowConfigChangeInfoBeforeApiWatch.js\")} />\n <AdminBeforeBuild src={p(\"EnsureApiDeployedBeforeAdminBuild.js\")} />\n <AdminBeforeWatch src={p(\"EnsureApiDeployedBeforeAdminWatch.js\")} />\n <AdminAfterDeploy src={p(\"TelemetryNoLongerNewUser.js\")} />\n <BeforeDeploy src={p(\"EnsureTelemetryEnabledForOss.js\")} />\n <CoreBeforeDeploy src={p(\"ValidateProductionPulumiState.js\")} />\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,kBAAkB;AAC3B,SACIC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,YAAY,EACZC,gBAAgB;AAGpB,MAAMC,CAAC,GAAGT,kBAAkB,CAACU,MAAM,CAACC,IAAI,CAACC,OAAO,EAAE,SAAS,CAAC;AAE5D,OAAO,MAAMC,OAAO,GAAGA,CAAA,KAAM;EACzB,oBACId,KAAA,CAAAe,aAAA,CAAAf,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
+ {"version":3,"names":["React","createPathResolver","AdminAfterDeploy","AdminBeforeBuild","AdminBeforeWatch","ApiAfterBuild","ApiBeforeDeploy","ApiBeforeWatch","BeforeDeploy","CoreBeforeDeploy","p","import","meta","dirname","Project","createElement","Fragment","src"],"sources":["Project.tsx"],"sourcesContent":["import React from \"react\";\nimport { createPathResolver } from \"~/utils/createPathResolver.js\";\nimport {\n AdminAfterDeploy,\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiAfterBuild,\n ApiBeforeDeploy,\n ApiBeforeWatch,\n BeforeDeploy,\n CoreBeforeDeploy\n} from \"~/extensions/index.js\";\n\nconst p = createPathResolver(import.meta.dirname, \"Project\");\n\nexport const Project = () => {\n return (\n <>\n <AdminBeforeBuild src={p(\"SetAdminAppEnvVarsBeforeBuild.js\")} />\n <AdminBeforeWatch src={p(\"SetAdminAppEnvVarsBeforeWatch.js\")} />\n <AdminBeforeWatch src={p(\"ShowConfigChangeInfoBeforeAdminWatch.js\")} />\n <ApiAfterBuild src={p(\"WcpInjectTelemetryClientAfterBuild.js\")} />\n <ApiBeforeDeploy src={p(\"EnsureCoreDeployedBeforeApiDeploy.js\")} />\n <ApiBeforeWatch src={p(\"EnsureApiDeployedBeforeWatch.js\")} />\n <ApiBeforeWatch src={p(\"ShowConfigChangeInfoBeforeApiWatch.js\")} />\n <AdminBeforeBuild src={p(\"EnsureApiDeployedBeforeAdminBuild.js\")} />\n <AdminBeforeWatch src={p(\"EnsureApiDeployedBeforeAdminWatch.js\")} />\n <AdminAfterDeploy src={p(\"TelemetryNoLongerNewUser.js\")} />\n <BeforeDeploy src={p(\"EnsureTelemetryEnabledForOss.js\")} />\n <BeforeDeploy src={p(\"ValidateEncryptionBeforeDeploy.js\")} />\n <CoreBeforeDeploy src={p(\"ValidateProductionPulumiState.js\")} />\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,kBAAkB;AAC3B,SACIC,gBAAgB,EAChBC,gBAAgB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BAA6B;EAAE,CAAE,CAAC,eAC3DV,KAAA,CAAAe,aAAA,CAACP,YAAY;IAACS,GAAG,EAAEP,CAAC,CAAC,iCAAiC;EAAE,CAAE,CAAC,eAC3DV,KAAA,CAAAe,aAAA,CAACP,YAAY;IAACS,GAAG,EAAEP,CAAC,CAAC,mCAAmC;EAAE,CAAE,CAAC,eAC7DV,KAAA,CAAAe,aAAA,CAACN,gBAAgB;IAACQ,GAAG,EAAEP,CAAC,CAAC,kCAAkC;EAAE,CAAE,CACjE,CAAC;AAEX,CAAC","ignoreList":[]}
@@ -9,7 +9,7 @@ export const ProjectId = defineExtension({
9
9
  paramsSchema: z.object({
10
10
  id: z.string().refine(value => {
11
11
  // Allow only alphanumeric characters, dashes, underscores, no spaces, and forward slashes.
12
- return /^[a-zA-Z0-9-_\/]+$/.test(value);
12
+ return /^[a-zA-Z0-9-_/]+$/.test(value);
13
13
  }, {
14
14
  message: "Project ID can only contain alphanumeric characters, dashes, underscores, and forward slashes."
15
15
  })
@@ -1 +1 @@
1
- {"version":3,"names":["z","defineExtension","ProjectId","type","tags","runtimeContext","description","paramsSchema","object","id","string","refine","value","test","message"],"sources":["ProjectId.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"../defineExtension/index.js\";\n\nexport const ProjectId = defineExtension({\n type: \"Project/ProjectId\",\n tags: { runtimeContext: \"project\" },\n description: \"An extension for defining the project ID.\",\n paramsSchema: z.object({\n id: z.string().refine(\n value => {\n // Allow only alphanumeric characters, dashes, underscores, no spaces, and forward slashes.\n return /^[a-zA-Z0-9-_\\/]+$/.test(value);\n },\n {\n message:\n \"Project ID can only contain alphanumeric characters, dashes, underscores, and forward slashes.\"\n }\n )\n })\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,eAAe;AAExB,OAAO,MAAMC,SAAS,GAAGD,eAAe,CAAC;EACrCE,IAAI,EAAE,mBAAmB;EACzBC,IAAI,EAAE;IAAEC,cAAc,EAAE;EAAU,CAAC;EACnCC,WAAW,EAAE,2CAA2C;EACxDC,YAAY,EAAEP,CAAC,CAACQ,MAAM,CAAC;IACnBC,EAAE,EAAET,CAAC,CAACU,MAAM,CAAC,CAAC,CAACC,MAAM,CACjBC,KAAK,IAAI;MACL;MACA,OAAO,oBAAoB,CAACC,IAAI,CAACD,KAAK,CAAC;IAC3C,CAAC,EACD;MACIE,OAAO,EACH;IACR,CACJ;EACJ,CAAC;AACL,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["z","defineExtension","ProjectId","type","tags","runtimeContext","description","paramsSchema","object","id","string","refine","value","test","message"],"sources":["ProjectId.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"../defineExtension/index.js\";\n\nexport const ProjectId = defineExtension({\n type: \"Project/ProjectId\",\n tags: { runtimeContext: \"project\" },\n description: \"An extension for defining the project ID.\",\n paramsSchema: z.object({\n id: z.string().refine(\n value => {\n // Allow only alphanumeric characters, dashes, underscores, no spaces, and forward slashes.\n return /^[a-zA-Z0-9-_/]+$/.test(value);\n },\n {\n message:\n \"Project ID can only contain alphanumeric characters, dashes, underscores, and forward slashes.\"\n }\n )\n })\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,eAAe;AAExB,OAAO,MAAMC,SAAS,GAAGD,eAAe,CAAC;EACrCE,IAAI,EAAE,mBAAmB;EACzBC,IAAI,EAAE;IAAEC,cAAc,EAAE;EAAU,CAAC;EACnCC,WAAW,EAAE,2CAA2C;EACxDC,YAAY,EAAEP,CAAC,CAACQ,MAAM,CAAC;IACnBC,EAAE,EAAET,CAAC,CAACU,MAAM,CAAC,CAAC,CAACC,MAAM,CACjBC,KAAK,IAAI;MACL;MACA,OAAO,mBAAmB,CAACC,IAAI,CAACD,KAAK,CAAC;IAC1C,CAAC,EACD;MACIE,OAAO,EACH;IACR,CACJ;EACJ,CAAC;AACL,CAAC,CAAC","ignoreList":[]}
@@ -11,7 +11,7 @@ import { AdminBuildParam } from "./AdminBuildParam.js";
11
11
  import { AdminExtension } from "./AdminExtension.js";
12
12
  import { ApiExtension } from "./ApiExtension.js";
13
13
  import { AdminAfterBuild, AdminAfterDeploy, AdminBeforeBuild, AdminBeforeDeploy, AdminBeforeWatch, AfterBuild, AfterDeploy, BeforeDeploy, BeforeWatch, ApiAfterBuild, ApiAfterDeploy, ApiBeforeBuild, ApiBeforeDeploy, ApiBeforeWatch, BeforeBuild, CoreAfterBuild, CoreAfterDeploy, CoreBeforeBuild, CoreBeforeDeploy, CoreBeforeWatch } from "./hooks/index.js";
14
- import { AdminPulumi, ApiPulumi, CorePulumi, ProductionEnvironments, PulumiResourceNamePrefix, CoreStackOutputValue, ApiStackOutputValue, AdminStackOutputValue } from "./pulumi/index.js";
14
+ import { ProductionEnvironments, PulumiResourceNamePrefix, CoreStackOutputValue, ApiStackOutputValue, AdminStackOutputValue } from "./pulumi/index.js";
15
15
  export { Telemetry };
16
16
  export { ProjectId };
17
17
  export { ProjectDecorator };
@@ -44,9 +44,6 @@ export { CoreBeforeDeploy };
44
44
  export { CoreBeforeWatch };
45
45
  export { CoreAfterBuild };
46
46
  export { CoreAfterDeploy };
47
- export { CorePulumi };
48
- export { AdminPulumi };
49
- export { ApiPulumi };
50
47
  export { PulumiResourceNamePrefix };
51
48
  export { ProductionEnvironments };
52
49
  export { CoreStackOutputValue };
@@ -14,8 +14,8 @@ import { ApiExtension } from "./ApiExtension.js";
14
14
  // Hooks.
15
15
  import { AdminAfterBuild, AdminAfterDeploy, AdminBeforeBuild, AdminBeforeDeploy, AdminBeforeWatch, AfterBuild, AfterDeploy, BeforeDeploy, BeforeWatch, ApiAfterBuild, ApiAfterDeploy, ApiBeforeBuild, ApiBeforeDeploy, ApiBeforeWatch, BeforeBuild, CoreAfterBuild, CoreAfterDeploy, CoreBeforeBuild, CoreBeforeDeploy, CoreBeforeWatch } from "./hooks/index.js";
16
16
 
17
- // Pulumi.
18
- import { AdminPulumi, ApiPulumi, CorePulumi, ProductionEnvironments, PulumiResourceNamePrefix, CoreStackOutputValue, ApiStackOutputValue, AdminStackOutputValue } from "./pulumi/index.js";
17
+ // Pulumi (non-app-specific).
18
+ import { ProductionEnvironments, PulumiResourceNamePrefix, CoreStackOutputValue, ApiStackOutputValue, AdminStackOutputValue } from "./pulumi/index.js";
19
19
 
20
20
  // Exports.
21
21
  export { Telemetry };
@@ -53,10 +53,7 @@ export { CoreBeforeWatch };
53
53
  export { CoreAfterBuild };
54
54
  export { CoreAfterDeploy };
55
55
 
56
- // Pulumi.
57
- export { CorePulumi };
58
- export { AdminPulumi };
59
- export { ApiPulumi };
56
+ // Pulumi (non-app-specific).
60
57
  export { PulumiResourceNamePrefix };
61
58
  export { ProductionEnvironments };
62
59
  export { CoreStackOutputValue };
@@ -67,8 +64,8 @@ export { AdminStackOutputValue };
67
64
  export const definitions = [Telemetry.def, ProjectId.def, ProjectDecorator.def, ProjectImplementation.def, ExtensionDefinitions.def, EnvVar.def, FeatureFlags.def,
68
65
  // Hooks.
69
66
  AdminAfterBuild.def, AdminAfterDeploy.def, BeforeBuild.def, BeforeDeploy.def, BeforeWatch.def, AfterBuild.def, AfterDeploy.def, AdminBeforeBuild.def, AdminBeforeDeploy.def, AdminBeforeWatch.def, ApiAfterBuild.def, ApiAfterDeploy.def, ApiBeforeBuild.def, ApiBeforeDeploy.def, ApiBeforeWatch.def, CoreAfterBuild.def, CoreAfterDeploy.def, CoreBeforeBuild.def, CoreBeforeDeploy.def, CoreBeforeWatch.def,
70
- // Pulumi.
71
- AdminPulumi.def, ApiPulumi.def, CorePulumi.def, PulumiResourceNamePrefix.def, ProductionEnvironments.def, CoreStackOutputValue.def, ApiStackOutputValue.def, AdminStackOutputValue.def, DatabaseSetup.def, BuildParam.def, AdminBuildParam.def, AdminExtension.def, ApiExtension.def];
67
+ // Pulumi (non-app-specific).
68
+ PulumiResourceNamePrefix.def, ProductionEnvironments.def, CoreStackOutputValue.def, ApiStackOutputValue.def, AdminStackOutputValue.def, DatabaseSetup.def, BuildParam.def, AdminBuildParam.def, AdminExtension.def, ApiExtension.def];
72
69
  export { Project } from "./Project.js";
73
70
  export * from "../defineExtension/index.js";
74
71
 
@@ -1 +1 @@
1
- {"version":3,"names":["ExtensionDefinitions","ProjectDecorator","ProjectImplementation","ProjectId","Telemetry","EnvVar","DatabaseSetup","FeatureFlags","BuildParam","AdminBuildParam","AdminExtension","ApiExtension","AdminAfterBuild","AdminAfterDeploy","AdminBeforeBuild","AdminBeforeDeploy","AdminBeforeWatch","AfterBuild","AfterDeploy","BeforeDeploy","BeforeWatch","ApiAfterBuild","ApiAfterDeploy","ApiBeforeBuild","ApiBeforeDeploy","ApiBeforeWatch","BeforeBuild","CoreAfterBuild","CoreAfterDeploy","CoreBeforeBuild","CoreBeforeDeploy","CoreBeforeWatch","AdminPulumi","ApiPulumi","CorePulumi","ProductionEnvironments","PulumiResourceNamePrefix","CoreStackOutputValue","ApiStackOutputValue","AdminStackOutputValue","definitions","def","Project"],"sources":["index.ts"],"sourcesContent":["import { ExtensionDefinitions } from \"./ExtensionDefinitions.js\";\nimport { ProjectDecorator } from \"./ProjectDecorator.js\";\nimport { ProjectImplementation } from \"./ProjectImplementation.js\";\nimport { ProjectId } from \"./ProjectId.js\";\nimport { Telemetry } from \"./Telemetry.js\";\nimport { EnvVar } from \"./EnvVar.js\";\nimport { DatabaseSetup } from \"./DatabaseSetup.js\";\nimport { FeatureFlags } from \"./FeatureFlags.js\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { AdminExtension } from \"./AdminExtension.js\";\nimport { ApiExtension } from \"./ApiExtension.js\";\n\n// Hooks.\nimport {\n AdminAfterBuild,\n AdminAfterDeploy,\n AdminBeforeBuild,\n AdminBeforeDeploy,\n AdminBeforeWatch,\n AfterBuild,\n AfterDeploy,\n BeforeDeploy,\n BeforeWatch,\n ApiAfterBuild,\n ApiAfterDeploy,\n ApiBeforeBuild,\n ApiBeforeDeploy,\n ApiBeforeWatch,\n BeforeBuild,\n CoreAfterBuild,\n CoreAfterDeploy,\n CoreBeforeBuild,\n CoreBeforeDeploy,\n CoreBeforeWatch\n} from \"./hooks/index.js\";\n\n// Pulumi.\nimport {\n AdminPulumi,\n ApiPulumi,\n CorePulumi,\n ProductionEnvironments,\n PulumiResourceNamePrefix,\n CoreStackOutputValue,\n ApiStackOutputValue,\n AdminStackOutputValue\n} from \"./pulumi/index.js\";\n\n// Exports.\nexport { Telemetry };\nexport { ProjectId };\nexport { ProjectDecorator };\nexport { ProjectImplementation };\nexport { ExtensionDefinitions };\nexport { EnvVar };\nexport { FeatureFlags };\nexport { DatabaseSetup };\nexport { BuildParam };\nexport { AdminBuildParam };\nexport { AdminExtension };\nexport { ApiExtension };\n\n// Hooks.\nexport { BeforeBuild };\nexport { BeforeDeploy };\nexport { BeforeWatch };\nexport { AfterBuild };\nexport { AfterDeploy };\nexport { AdminBeforeBuild };\nexport { AdminBeforeDeploy };\nexport { AdminBeforeWatch };\nexport { AdminAfterBuild };\nexport { AdminAfterDeploy };\nexport { ApiBeforeBuild };\nexport { ApiBeforeDeploy };\nexport { ApiBeforeWatch };\nexport { ApiAfterBuild };\nexport { ApiAfterDeploy };\nexport { CoreBeforeBuild };\nexport { CoreBeforeDeploy };\nexport { CoreBeforeWatch };\nexport { CoreAfterBuild };\nexport { CoreAfterDeploy };\n\n// Pulumi.\nexport { CorePulumi };\nexport { AdminPulumi };\nexport { ApiPulumi };\nexport { PulumiResourceNamePrefix };\nexport { ProductionEnvironments };\nexport { CoreStackOutputValue };\nexport { ApiStackOutputValue };\nexport { AdminStackOutputValue };\n\n// Definitions (used internally). 👇\nexport const definitions = [\n Telemetry.def,\n ProjectId.def,\n ProjectDecorator.def,\n ProjectImplementation.def,\n ExtensionDefinitions.def,\n EnvVar.def,\n FeatureFlags.def,\n\n // Hooks.\n AdminAfterBuild.def,\n AdminAfterDeploy.def,\n BeforeBuild.def,\n BeforeDeploy.def,\n BeforeWatch.def,\n AfterBuild.def,\n AfterDeploy.def,\n AdminBeforeBuild.def,\n AdminBeforeDeploy.def,\n AdminBeforeWatch.def,\n ApiAfterBuild.def,\n ApiAfterDeploy.def,\n ApiBeforeBuild.def,\n ApiBeforeDeploy.def,\n ApiBeforeWatch.def,\n CoreAfterBuild.def,\n CoreAfterDeploy.def,\n CoreBeforeBuild.def,\n CoreBeforeDeploy.def,\n CoreBeforeWatch.def,\n\n // Pulumi.\n AdminPulumi.def,\n ApiPulumi.def,\n CorePulumi.def,\n PulumiResourceNamePrefix.def,\n ProductionEnvironments.def,\n CoreStackOutputValue.def,\n ApiStackOutputValue.def,\n AdminStackOutputValue.def,\n DatabaseSetup.def,\n BuildParam.def,\n AdminBuildParam.def,\n AdminExtension.def,\n ApiExtension.def\n];\n\nexport { Project } from \"./Project.js\";\n\nexport * from \"../defineExtension/index.js\";\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,qBAAqB;AAC9B,SAASC,SAAS;AAClB,SAASC,SAAS;AAClB,SAASC,MAAM;AACf,SAASC,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,UAAU;AACnB,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,SAASC,YAAY;;AAErB;AACA,SACIC,eAAe,EACfC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,eAAe;;AAGnB;AACA,SACIC,WAAW,EACXC,SAAS,EACTC,UAAU,EACVC,sBAAsB,EACtBC,wBAAwB,EACxBC,oBAAoB,EACpBC,mBAAmB,EACnBC,qBAAqB;;AAGzB;AACA,SAASnC,SAAS;AAClB,SAASD,SAAS;AAClB,SA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B,gBAAgB,CAACyB,GAAG,EACpBpB,aAAa,CAACoB,GAAG,EACjBnB,cAAc,CAACmB,GAAG,EAClBlB,cAAc,CAACkB,GAAG,EAClBjB,eAAe,CAACiB,GAAG,EACnBhB,cAAc,CAACgB,GAAG,EAClBd,cAAc,CAACc,GAAG,EAClBb,eAAe,CAACa,GAAG,EACnBZ,eAAe,CAACY,GAAG,EACnBX,gBAAgB,CAACW,GAAG,EACpBV,eAAe,CAACU,GAAG;AAEnB;AACAT,WAAW,CAACS,GAAG,EACfR,SAAS,CAACQ,GAAG,EACbP,UAAU,CAACO,GAAG,EACdL,wBAAwB,CAACK,GAAG,EAC5BN,sBAAsB,CAACM,GAAG,EAC1BJ,oBAAoB,CAACI,GAAG,EACxBH,mBAAmB,CAACG,GAAG,EACvBF,qBAAqB,CAACE,GAAG,EACzBnC,aAAa,CAACmC,GAAG,EACjBjC,UAAU,CAACiC,GAAG,EACdhC,eAAe,CAACgC,GAAG,EACnB/B,cAAc,CAAC+B,GAAG,EAClB9B,YAAY,CAAC8B,GAAG,CACnB;AAED,SAASC,OAAO;AAEhB","ignoreList":[]}
1
+ {"version":3,"names":["ExtensionDefinitions","ProjectDecorator","ProjectImplementation","ProjectId","Telemetry","EnvVar","DatabaseSetup","FeatureFlags","BuildParam","AdminBuildParam","AdminExtension","ApiExtension","AdminAfterBuild","AdminAfterDeploy","AdminBeforeBuild","AdminBeforeDeploy","AdminBeforeWatch","AfterBuild","AfterDeploy","BeforeDeploy","BeforeWatch","ApiAfterBuild","ApiAfterDeploy","ApiBeforeBuild","ApiBeforeDeploy","ApiBeforeWatch","BeforeBuild","CoreAfterBuild","CoreAfterDeploy","CoreBeforeBuild","CoreBeforeDeploy","CoreBeforeWatch","ProductionEnvironments","PulumiResourceNamePrefix","CoreStackOutputValue","ApiStackOutputValue","AdminStackOutputValue","definitions","def","Project"],"sources":["index.ts"],"sourcesContent":["import { ExtensionDefinitions } from \"./ExtensionDefinitions.js\";\nimport { ProjectDecorator } from \"./ProjectDecorator.js\";\nimport { ProjectImplementation } from \"./ProjectImplementation.js\";\nimport { ProjectId } from \"./ProjectId.js\";\nimport { Telemetry } from \"./Telemetry.js\";\nimport { EnvVar } from \"./EnvVar.js\";\nimport { DatabaseSetup } from \"./DatabaseSetup.js\";\nimport { FeatureFlags } from \"./FeatureFlags.js\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { AdminExtension } from \"./AdminExtension.js\";\nimport { ApiExtension } from \"./ApiExtension.js\";\n\n// Hooks.\nimport {\n AdminAfterBuild,\n AdminAfterDeploy,\n AdminBeforeBuild,\n AdminBeforeDeploy,\n AdminBeforeWatch,\n AfterBuild,\n AfterDeploy,\n BeforeDeploy,\n BeforeWatch,\n ApiAfterBuild,\n ApiAfterDeploy,\n ApiBeforeBuild,\n ApiBeforeDeploy,\n ApiBeforeWatch,\n BeforeBuild,\n CoreAfterBuild,\n CoreAfterDeploy,\n CoreBeforeBuild,\n CoreBeforeDeploy,\n CoreBeforeWatch\n} from \"./hooks/index.js\";\n\n// Pulumi (non-app-specific).\nimport {\n ProductionEnvironments,\n PulumiResourceNamePrefix,\n CoreStackOutputValue,\n ApiStackOutputValue,\n AdminStackOutputValue\n} from \"./pulumi/index.js\";\n\n// Exports.\nexport { Telemetry };\nexport { ProjectId };\nexport { ProjectDecorator };\nexport { ProjectImplementation };\nexport { ExtensionDefinitions };\nexport { EnvVar };\nexport { FeatureFlags };\nexport { DatabaseSetup };\nexport { BuildParam };\nexport { AdminBuildParam };\nexport { AdminExtension };\nexport { ApiExtension };\n\n// Hooks.\nexport { BeforeBuild };\nexport { BeforeDeploy };\nexport { BeforeWatch };\nexport { AfterBuild };\nexport { AfterDeploy };\nexport { AdminBeforeBuild };\nexport { AdminBeforeDeploy };\nexport { AdminBeforeWatch };\nexport { AdminAfterBuild };\nexport { AdminAfterDeploy };\nexport { ApiBeforeBuild };\nexport { ApiBeforeDeploy };\nexport { ApiBeforeWatch };\nexport { ApiAfterBuild };\nexport { ApiAfterDeploy };\nexport { CoreBeforeBuild };\nexport { CoreBeforeDeploy };\nexport { CoreBeforeWatch };\nexport { CoreAfterBuild };\nexport { CoreAfterDeploy };\n\n// Pulumi (non-app-specific).\nexport { PulumiResourceNamePrefix };\nexport { ProductionEnvironments };\nexport { CoreStackOutputValue };\nexport { ApiStackOutputValue };\nexport { AdminStackOutputValue };\n\n// Definitions (used internally). 👇\nexport const definitions = [\n Telemetry.def,\n ProjectId.def,\n ProjectDecorator.def,\n ProjectImplementation.def,\n ExtensionDefinitions.def,\n EnvVar.def,\n FeatureFlags.def,\n\n // Hooks.\n AdminAfterBuild.def,\n AdminAfterDeploy.def,\n BeforeBuild.def,\n BeforeDeploy.def,\n BeforeWatch.def,\n AfterBuild.def,\n AfterDeploy.def,\n AdminBeforeBuild.def,\n AdminBeforeDeploy.def,\n AdminBeforeWatch.def,\n ApiAfterBuild.def,\n ApiAfterDeploy.def,\n ApiBeforeBuild.def,\n ApiBeforeDeploy.def,\n ApiBeforeWatch.def,\n CoreAfterBuild.def,\n CoreAfterDeploy.def,\n CoreBeforeBuild.def,\n CoreBeforeDeploy.def,\n CoreBeforeWatch.def,\n\n // Pulumi (non-app-specific).\n PulumiResourceNamePrefix.def,\n ProductionEnvironments.def,\n CoreStackOutputValue.def,\n ApiStackOutputValue.def,\n AdminStackOutputValue.def,\n DatabaseSetup.def,\n BuildParam.def,\n AdminBuildParam.def,\n AdminExtension.def,\n ApiExtension.def\n];\n\nexport { Project } from \"./Project.js\";\n\nexport * from \"../defineExtension/index.js\";\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,qBAAqB;AAC9B,SAASC,SAAS;AAClB,SAASC,SAAS;AAClB,SAASC,MAAM;AACf,SAASC,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,UAAU;AACnB,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,SAASC,YAAY;;AAErB;AAC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,EACzBtC,oBAAoB,CAACsC,GAAG,EACxBjC,MAAM,CAACiC,GAAG,EACV/B,YAAY,CAAC+B,GAAG;AAEhB;AACA1B,eAAe,CAAC0B,GAAG,EACnBzB,gBAAgB,CAACyB,GAAG,EACpBZ,WAAW,CAACY,GAAG,EACfnB,YAAY,CAACmB,GAAG,EAChBlB,WAAW,CAACkB,GAAG,EACfrB,UAAU,CAACqB,GAAG,EACdpB,WAAW,CAACoB,GAAG,EACfxB,gBAAgB,CAACwB,GAAG,EACpBvB,iBAAiB,CAACuB,GAAG,EACrBtB,gBAAgB,CAACsB,GAAG,EACpBjB,aAAa,CAACiB,GAAG,EACjBhB,cAAc,CAACgB,GAAG,EAClBf,cAAc,CAACe,GAAG,EAClBd,eAAe,CAACc,GAAG,EACnBb,cAAc,CAACa,GAAG,EAClBX,cAAc,CAACW,GAAG,EAClBV,eAAe,CAACU,GAAG,EACnBT,eAAe,CAACS,GAAG,EACnBR,gBAAgB,CAACQ,GAAG,EACpBP,eAAe,CAACO,GAAG;AAEnB;AACAL,wBAAwB,CAACK,GAAG,EAC5BN,sBAAsB,CAACM,GAAG,EAC1BJ,oBAAoB,CAACI,GAAG,EACxBH,mBAAmB,CAACG,GAAG,EACvBF,qBAAqB,CAACE,GAAG,EACzBhC,aAAa,CAACgC,GAAG,EACjB9B,UAAU,CAAC8B,GAAG,EACd7B,eAAe,CAAC6B,GAAG,EACnB5B,cAAc,CAAC4B,GAAG,EAClB3B,YAAY,CAAC2B,GAAG,CACnB;AAED,SAASC,OAAO;AAEhB","ignoreList":[]}
@@ -16,4 +16,10 @@ export declare const EnvIs: React.FC<EnvIsProps>;
16
16
  * Multiple conditions are AND-ed together (renders when NONE of the conditions match).
17
17
  */
18
18
  export declare const EnvIsNot: React.FC<EnvIsProps>;
19
+ export declare const EnvIsProd: React.FC<{
20
+ children: React.ReactNode;
21
+ }>;
22
+ export declare const EnvIsNotProd: React.FC<{
23
+ children: React.ReactNode;
24
+ }>;
19
25
  export { useEnv, useVariant, useRegion, useEnvContext };
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { useEnv, useVariant, useRegion, useEnvContext } from "../../services/GetProjectConfigService/EnvContext.js";
3
+ import { useProductionEnvironments } from "../../services/GetProjectConfigService/ProductionEnvironmentsContext.js";
3
4
  /**
4
5
  * Helper function to check if a value matches any of the allowed values
5
6
  */
@@ -72,6 +73,26 @@ export const EnvIsNot = ({
72
73
  }
73
74
  return /*#__PURE__*/React.createElement(React.Fragment, null, children);
74
75
  };
76
+ export const EnvIsProd = ({
77
+ children
78
+ }) => {
79
+ const env = useEnv();
80
+ const prodEnvs = useProductionEnvironments();
81
+ if (!prodEnvs.includes(env)) {
82
+ return null;
83
+ }
84
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
85
+ };
86
+ export const EnvIsNotProd = ({
87
+ children
88
+ }) => {
89
+ const env = useEnv();
90
+ const prodEnvs = useProductionEnvironments();
91
+ if (prodEnvs.includes(env)) {
92
+ return null;
93
+ }
94
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
95
+ };
75
96
 
76
97
  // Export hooks for direct use
77
98
  export { useEnv, useVariant, useRegion, useEnvContext };
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEnv","useVariant","useRegion","useEnvContext","matchesValue","current","allowed","allowedArray","Array","isArray","includes","EnvIs","env","variant","region","children","currentEnv","currentVariant","currentRegion","undefined","createElement","Fragment","EnvIsNot"],"sources":["Env.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n useEnv,\n useVariant,\n useRegion,\n useEnvContext\n} from \"~/services/GetProjectConfigService/EnvContext.js\";\n\nexport interface EnvIsProps {\n env?: string | string[];\n variant?: string | string[];\n region?: string | string[];\n children: React.ReactNode;\n}\n\n/**\n * Helper function to check if a value matches any of the allowed values\n */\nconst matchesValue = (current: string | undefined, allowed: string | string[]): boolean => {\n if (!current) {\n return false;\n }\n const allowedArray = Array.isArray(allowed) ? allowed : [allowed];\n return allowedArray.includes(current);\n};\n\n/**\n * Conditionally renders children based on the current environment, variant, or region.\n * Multiple conditions are AND-ed together.\n */\nexport const EnvIs: React.FC<EnvIsProps> = ({ env, variant, region, children }) => {\n const currentEnv = useEnv();\n const currentVariant = useVariant();\n const currentRegion = useRegion();\n\n // Check if env matches\n if (env !== undefined && !matchesValue(currentEnv, env)) {\n return null;\n }\n\n // Check if variant matches\n if (variant !== undefined && !matchesValue(currentVariant, variant)) {\n return null;\n }\n\n // Check if region matches\n if (region !== undefined && !matchesValue(currentRegion, region)) {\n return null;\n }\n\n return <>{children}</>;\n};\n\n/**\n * Conditionally renders children when the current environment, variant, or region does NOT match.\n * Multiple conditions are AND-ed together (renders when NONE of the conditions match).\n */\nexport const EnvIsNot: React.FC<EnvIsProps> = ({ env, variant, region, children }) => {\n const currentEnv = useEnv();\n const currentVariant = useVariant();\n const currentRegion = useRegion();\n\n // Check if env does NOT match\n if (env !== undefined && matchesValue(currentEnv, env)) {\n return null;\n }\n\n // Check if variant does NOT match\n if (variant !== undefined && matchesValue(currentVariant, variant)) {\n return null;\n }\n\n // Check if region does NOT match\n if (region !== undefined && matchesValue(currentRegion, region)) {\n return null;\n }\n\n return <>{children}</>;\n};\n\n// Export hooks for direct use\nexport { useEnv, useVariant, useRegion, useEnvContext };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACIC,MAAM,EACNC,UAAU,EACVC,SAAS,EACTC,aAAa;AAUjB;AACA;AACA;AACA,MAAMC,YAAY,GAAGA,CAACC,OAA2B,EAAEC,OAA0B,KAAc;EACvF,IAAI,CAACD,OAAO,EAAE;IACV,OAAO,KAAK;EAChB;EACA,MAAME,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACH,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC;EACjE,OAAOC,YAAY,CAACG,QAAQ,CAACL,OAAO,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMM,KAA2B,GAAGA,CAAC;EAAEC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E;IAC7D,OAAO,IAAI;EACf;EAEA,oBAAOf,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,QAAGN,QAAW,CAAC;AAC1B,CAAC;;AAED;AACA,SAASf,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAEC,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["React","useEnv","useVariant","useRegion","useEnvContext","useProductionEnvironments","matchesValue","current","allowed","allowedArray","Array","isArray","includes","EnvIs","env","variant","region","children","currentEnv","currentVariant","currentRegion","undefined","createElement","Fragment","EnvIsNot","EnvIsProd","prodEnvs","EnvIsNotProd"],"sources":["Env.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n useEnv,\n useVariant,\n useRegion,\n useEnvContext\n} from \"~/services/GetProjectConfigService/EnvContext.js\";\nimport { useProductionEnvironments } from \"~/services/GetProjectConfigService/ProductionEnvironmentsContext.js\";\n\nexport interface EnvIsProps {\n env?: string | string[];\n variant?: string | string[];\n region?: string | string[];\n children: React.ReactNode;\n}\n\n/**\n * Helper function to check if a value matches any of the allowed values\n */\nconst matchesValue = (current: string | undefined, allowed: string | string[]): boolean => {\n if (!current) {\n return false;\n }\n const allowedArray = Array.isArray(allowed) ? allowed : [allowed];\n return allowedArray.includes(current);\n};\n\n/**\n * Conditionally renders children based on the current environment, variant, or region.\n * Multiple conditions are AND-ed together.\n */\nexport const EnvIs: React.FC<EnvIsProps> = ({ env, variant, region, children }) => {\n const currentEnv = useEnv();\n const currentVariant = useVariant();\n const currentRegion = useRegion();\n\n // Check if env matches\n if (env !== undefined && !matchesValue(currentEnv, env)) {\n return null;\n }\n\n // Check if variant matches\n if (variant !== undefined && !matchesValue(currentVariant, variant)) {\n return null;\n }\n\n // Check if region matches\n if (region !== undefined && !matchesValue(currentRegion, region)) {\n return null;\n }\n\n return <>{children}</>;\n};\n\n/**\n * Conditionally renders children when the current environment, variant, or region does NOT match.\n * Multiple conditions are AND-ed together (renders when NONE of the conditions match).\n */\nexport const EnvIsNot: React.FC<EnvIsProps> = ({ env, variant, region, children }) => {\n const currentEnv = useEnv();\n const currentVariant = useVariant();\n const currentRegion = useRegion();\n\n // Check if env does NOT match\n if (env !== undefined && matchesValue(currentEnv, env)) {\n return null;\n }\n\n // Check if variant does NOT match\n if (variant !== undefined && matchesValue(currentVariant, variant)) {\n return null;\n }\n\n // Check if region does NOT match\n if (region !== undefined && matchesValue(currentRegion, region)) {\n return null;\n }\n\n return <>{children}</>;\n};\n\nexport const EnvIsProd: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const env = useEnv();\n const prodEnvs = useProductionEnvironments();\n if (!prodEnvs.includes(env)) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport const EnvIsNotProd: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const env = useEnv();\n const prodEnvs = useProductionEnvironments();\n if (prodEnvs.includes(env)) {\n return null;\n }\n return <>{children}</>;\n};\n\n// Export hooks for direct use\nexport { useEnv, useVariant, useRegion, useEnvContext };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACIC,MAAM,EACNC,UAAU,EACVC,SAAS,EACTC,aAAa;AAEjB,SAASC,yBAAyB;AASlC;AACA;AACA;AACA,MAAMC,YAAY,GAAGA,CAACC,OAA2B,EAAEC,OAA0B,KAAc;EACvF,IAAI,CAACD,OAAO,EAAE;IACV,OAAO,KAAK;EAChB;EACA,MAAME,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACH,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC;EACjE,OAAOC,YAAY,CAACG,QAAQ,CAACL,OAAO,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMM,KAA2B,GAAGA,CAAC;EAAEC,GAAG;EAAEC,OAAO;EAAEC,MAAM;EAAEC;AAAS,CAAC,KAAK;EAC/E,MAAMC,UAAU,GAAGjB,MAAM,CAAC,CAAC;EAC3B,MAAMkB,cAAc,GAAGjB,UAAU,CAAC,CAA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,GAAGA,CAAC;EAAER;AAAS,CAAC,KAAK;EAChF,MAAMH,GAAG,GAAGb,MAAM,CAAC,CAAC;EACpB,MAAMyB,QAAQ,GAAGrB,yBAAyB,CAAC,CAAC;EAC5C,IAAI,CAACqB,QAAQ,CAACd,QAAQ,CAACE,GAAG,CAAC,EAAE;IACzB,OAAO,IAAI;EACf;EACA,oBAAOd,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAuB,QAAA,QAAGN,QAAW,CAAC;AAC1B,CAAC;AAED,OAAO,MAAMU,YAAqD,GAAGA,CAAC;EAAEV;AAAS,CAAC,KAAK;EACnF,MAAMH,GAAG,GAAGb,MAAM,CAAC,CAAC;EACpB,MAAMyB,QAAQ,GAAGrB,yBAAyB,CAAC,CAAC;EAC5C,IAAIqB,QAAQ,CAACd,QAAQ,CAACE,GAAG,CAAC,EAAE;IACxB,OAAO,IAAI;EACf;EACA,oBAAOd,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAuB,QAAA,QAAGN,QAAW,CAAC;AAC1B,CAAC;;AAED;AACA,SAAShB,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAEC,aAAa","ignoreList":[]}
@@ -1,12 +1,24 @@
1
+ import React, { useEffect } from "react";
1
2
  import { z } from "zod";
2
3
  import { defineExtension } from "../../defineExtension/index.js";
4
+ import { useRegisterProductionEnvironments } from "../../services/GetProjectConfigService/ProductionEnvironmentsContext.js";
5
+ const Registrar = ({
6
+ environments
7
+ }) => {
8
+ const setProdEnvs = useRegisterProductionEnvironments();
9
+ useEffect(() => {
10
+ if (setProdEnvs) {
11
+ setProdEnvs(environments);
12
+ }
13
+ }, []);
14
+ return null;
15
+ };
3
16
  export const ProductionEnvironments = defineExtension({
4
17
  type: "Infra/ProductionEnvironments",
5
18
  tags: {
6
19
  runtimeContext: "project"
7
20
  },
8
21
  description: "Provide names for environments that are considered production environments.",
9
- multiple: true,
10
22
  paramsSchema: z.object({
11
23
  environments: z.array(z.string().superRefine((value, ctx) => {
12
24
  if (!value) {
@@ -25,6 +37,9 @@ export const ProductionEnvironments = defineExtension({
25
37
  });
26
38
  }
27
39
  }))
40
+ }),
41
+ render: props => /*#__PURE__*/React.createElement(Registrar, {
42
+ environments: props.environments
28
43
  })
29
44
  });
30
45