How to use the @loopback/metadata.MetadataInspector.getAllMethodMetadata function in @loopback/metadata

To help you get started, we’ve selected a few @loopback/metadata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-next / packages / context / src / inject.ts View on Github external
export function describeInjectedArguments(
  target: Object,
  method?: string,
): Readonly[] {
  method = method ?? '';

  // Try to read from cache
  const cache =
    MetadataInspector.getAllMethodMetadata[]>(
      METHODS_KEY,
      target,
      {
        ownMetadataOnly: true,
      },
    ) ?? {};
  let meta: Readonly[] = cache[method];
  if (meta) return meta;

  // Build the description
  const options: InspectionOptions = {};
  if (method === '') {
    if (shouldSkipBaseConstructorInjection(target)) {
      options.ownMetadataOnly = true;
    }
  } else if (Object.prototype.hasOwnProperty.call(target, method)) {