@webiny/project 6.0.0-rc.1 → 6.0.0-rc.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 (79) 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/exports/extensions.d.ts +1 -0
  35. package/exports/extensions.js +1 -0
  36. package/exports/extensions.js.map +1 -1
  37. package/extensions/AdminBuildParam.d.ts +11 -0
  38. package/extensions/AdminBuildParam.js +184 -0
  39. package/extensions/AdminBuildParam.js.map +1 -0
  40. package/extensions/AdminExtension.d.ts +11 -0
  41. package/extensions/AdminExtension.js +99 -0
  42. package/extensions/AdminExtension.js.map +1 -0
  43. package/extensions/ApiBuildParam.d.ts +11 -0
  44. package/extensions/ApiBuildParam.js +119 -0
  45. package/extensions/ApiBuildParam.js.map +1 -0
  46. package/extensions/ApiExtension.d.ts +11 -0
  47. package/{defineExtension/defineApiExtension.js → extensions/ApiExtension.js} +13 -15
  48. package/extensions/ApiExtension.js.map +1 -0
  49. package/extensions/FeatureFlags.d.ts +92 -0
  50. package/extensions/FeatureFlags.js +43 -0
  51. package/extensions/FeatureFlags.js.map +1 -0
  52. package/extensions/index.d.ts +109 -0
  53. package/extensions/index.js +12 -2
  54. package/extensions/index.js.map +1 -1
  55. package/features/GetFeatureFlags/GetFeatureFlags.d.ts +10 -0
  56. package/features/GetFeatureFlags/GetFeatureFlags.js +29 -0
  57. package/features/GetFeatureFlags/GetFeatureFlags.js.map +1 -0
  58. package/features/GetFeatureFlags/index.d.ts +1 -0
  59. package/features/GetFeatureFlags/index.js +3 -0
  60. package/features/GetFeatureFlags/index.js.map +1 -0
  61. package/features/Watch/Watch.js +1 -0
  62. package/features/Watch/Watch.js.map +1 -1
  63. package/features/Watch/replaceLambdaFunctions.d.ts +2 -1
  64. package/features/Watch/replaceLambdaFunctions.js +5 -1
  65. package/features/Watch/replaceLambdaFunctions.js.map +1 -1
  66. package/features/index.d.ts +1 -0
  67. package/features/index.js +1 -0
  68. package/features/index.js.map +1 -1
  69. package/package.json +14 -13
  70. package/services/GetProjectConfigService/WcpProjectLicenseContext.d.ts +1 -0
  71. package/services/GetProjectConfigService/WcpProjectLicenseContext.js +2 -1
  72. package/services/GetProjectConfigService/WcpProjectLicenseContext.js.map +1 -1
  73. package/services/SetProjectIdService/SetProjectIdService.js +28 -18
  74. package/services/SetProjectIdService/SetProjectIdService.js.map +1 -1
  75. package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.d.ts +4 -4
  76. package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js +26 -20
  77. package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js.map +1 -1
  78. package/defineExtension/defineApiExtension.d.ts +0 -17
  79. package/defineExtension/defineApiExtension.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"names":["z","Node","Project","defineExtension","zodSrcPath","ExtensionSrcResolver","path","crypto","defineApiExtension","params","type","tags","runtimeContext","appName","description","multiple","paramsSchema","project","object","src","abstraction","exportName","string","optional","build","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","contextPluginImportPath","existingContextPluginImport","save"],"sources":["defineApiExtension.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { Abstraction } from \"@webiny/di\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport { zodSrcPath } from \"~/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"~/utils/index.js\";\nimport path from \"path\";\nimport crypto from \"crypto\";\n\nexport type DefineApiExtensionParams = {\n type: string;\n description?: string;\n abstraction?: Abstraction<any>;\n};\n\nexport const defineApiExtension = (params: DefineApiExtensionParams) =>\n defineExtension({\n type: params.type,\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: params.description,\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project, abstraction: params.abstraction }),\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 // 1. Export name is always the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // 2. 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 // 3. 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 =\n 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 `\\ncreateContextPlugin(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 contextPluginImportPath = \"@webiny/api/plugins/ContextPlugin\";\n const existingContextPluginImport =\n source.getImportDeclaration(contextPluginImportPath);\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createContextPlugin\"],\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;AAEhE,SAASC,eAAe;AACxB,SAASC,UAAU;AACnB,SAASC,oBAAoB;AAC7B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,MAAM,MAAM,QAAQ;AAQ3B,OAAO,MAAMC,kBAAkB,GAAIC,MAAgC,IAC/DN,eAAe,CAAC;EACZO,IAAI,EAAED,MAAM,CAACC,IAAI;EACjBC,IAAI,EAAE;IAAEC,cAAc,EAAE,WAAW;IAAEC,OAAO,EAAE;EAAM,CAAC;EACrDC,WAAW,EAAEL,MAAM,CAACK,WAAW;EAC/BC,QAAQ,EAAE,IAAI;EACdC,YAAY,EAAEA,CAAC;IAAEC;EAAQ,CAAC,KAAK;IAC3B,OAAOjB,CAAC,CAACkB,MAAM,CAAC;MACZC,GAAG,EAAEf,UAAU,CAAC;QAAEa,OAAO;QAAEG,WAAW,EAAEX,MAAM,CAACW;MAAY,CAAC,CAAC;MAC7DC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