@wavemaker/angular-codegen 12.0.0-next.140535 → 12.0.0-next.141131

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 (27) hide show
  1. angular-codegen/angular-app/angular.json +2 -0
  2. angular-codegen/angular-app/package-lock.json +8449 -3742
  3. angular-codegen/angular-app/package.json +12 -8
  4. angular-codegen/angular-app/src/framework/services/customwidget-config-provider.service.ts +13 -0
  5. angular-codegen/angular-app/src/framework/util/page-util.ts +3 -1
  6. angular-codegen/angular-app/src/setup-jest.js +0 -1
  7. angular-codegen/angular-app/tsconfig.json +3 -0
  8. angular-codegen/dependencies/custom-widgets-bundle.cjs.js +390 -0
  9. angular-codegen/dependencies/expression-parser.cjs.js +40 -1
  10. angular-codegen/dependencies/pipe-provider.cjs.js +300 -12060
  11. angular-codegen/dependencies/transpilation-mobile.cjs.js +602 -1180
  12. angular-codegen/dependencies/transpilation-web.cjs.js +602 -6425
  13. angular-codegen/package.json +1 -1
  14. angular-codegen/src/codegen.js +1 -1
  15. angular-codegen/src/gen-components.js +1 -1
  16. angular-codegen/src/gen-customwidget-config.js +1 -0
  17. angular-codegen/src/gen-index-html.js +1 -1
  18. angular-codegen/src/handlebar-helpers.js +1 -1
  19. angular-codegen/src/pages-util.js +1 -1
  20. angular-codegen/src/update-angular-json.js +1 -1
  21. angular-codegen/templates/app.module.ts.hbs +5 -1
  22. angular-codegen/templates/component.config.ts.hbs +1 -0
  23. angular-codegen/templates/customwidget/customwidget-config.ts.hbs +6 -0
  24. angular-codegen/templates/customwidget/customwidget.component.script.js.hbs +3 -0
  25. angular-codegen/templates/customwidget/customwidget.component.ts.hbs +42 -0
  26. angular-codegen/templates/page/page.module.ts.hbs +11 -0
  27. angular-codegen/angular-app/build-scripts/update-version.js +0 -24
@@ -4975,6 +4975,45 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
4975
4975
  this.visitAllObjects(param => ctx.print(null, param.name), params, ctx, ',');
4976
4976
  }
4977
4977
  }
4978
+
4979
+ /**
4980
+ * @fileoverview
4981
+ * A module to facilitate use of a Trusted Types policy within the JIT
4982
+ * compiler. It lazily constructs the Trusted Types policy, providing helper
4983
+ * utilities for promoting strings to Trusted Types. When Trusted Types are not
4984
+ * available, strings are used as a fallback.
4985
+ * @security All use of this module is security-sensitive and should go through
4986
+ * security review.
4987
+ */
4988
+ /**
4989
+ * The Trusted Types policy, or null if Trusted Types are not
4990
+ * enabled/supported, or undefined if the policy has not been created yet.
4991
+ */
4992
+ let policy;
4993
+ /**
4994
+ * Returns the Trusted Types policy, or null if Trusted Types are not
4995
+ * enabled/supported. The first call to this function will create the policy.
4996
+ */
4997
+ function getPolicy() {
4998
+ if (policy === undefined) {
4999
+ const trustedTypes = _global['trustedTypes'];
5000
+ policy = null;
5001
+ if (trustedTypes) {
5002
+ try {
5003
+ policy = trustedTypes.createPolicy('angular#unsafe-jit', {
5004
+ createScript: (s) => s,
5005
+ });
5006
+ }
5007
+ catch {
5008
+ // trustedTypes.createPolicy throws if called with a name that is
5009
+ // already registered, even in report-only mode. Until the API changes,
5010
+ // catch the error not to break the applications functionally. In such
5011
+ // cases, the code will fall back to using strings.
5012
+ }
5013
+ }
5014
+ }
5015
+ return policy;
5016
+ }
4978
5017
  /**
4979
5018
  * Unsafely promote a string to a TrustedScript, falling back to strings when
4980
5019
  * Trusted Types are not available.
@@ -4983,7 +5022,7 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
4983
5022
  * interpreted and executed as a script by a browser, e.g. when calling eval.
4984
5023
  */
4985
5024
  function trustedScriptFromString(script) {
4986
- return script;
5025
+ return getPolicy()?.createScript(script) || script;
4987
5026
  }
4988
5027
  /**
4989
5028
  * Unsafely call the Function constructor with the given string arguments.