Refs.js 1.1 KB

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getRefs = void 0;
  4. const Options_1 = require("./Options.js");
  5. const util_1 = require("./util.js");
  6. const getRefs = (options) => {
  7. const _options = (0, Options_1.getDefaultOptions)(options);
  8. const currentPath = _options.name !== undefined ?
  9. [..._options.basePath, _options.definitionPath, _options.name]
  10. : _options.basePath;
  11. return {
  12. ..._options,
  13. currentPath: currentPath,
  14. propertyPath: undefined,
  15. seenRefs: new Set(),
  16. seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
  17. (0, util_1.zodDef)(def),
  18. {
  19. def: (0, util_1.zodDef)(def),
  20. path: [..._options.basePath, _options.definitionPath, name],
  21. // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
  22. jsonSchema: undefined,
  23. },
  24. ])),
  25. };
  26. };
  27. exports.getRefs = getRefs;
  28. //# sourceMappingURL=Refs.js.map