@backland/schema
Version:
TypeScript schema declaration and validation library with static type inference
35 lines (34 loc) • 909 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.initGraphType = initGraphType;
var _lazyCreateGraphTypeInitPayload = require("./lazyCreateGraphTypeInitPayload");
// FIXME should fix deep instantiation types and remove `any's`
function initGraphType(self, args) {
const {
initializer,
idFromArgs
} = (0, _lazyCreateGraphTypeInitPayload.lazyCreateGraphTypeInitPayload)(args, payload => {
self.beforeInitialize.forEach(next => {
payload = next(payload);
});
self.touched = true;
return payload;
});
Object.defineProperty(self, '__lazyGetter', {
get() {
return initializer(self);
}
});
Object.defineProperty(self, 'definition', {
enumerable: true,
get() {
return initializer(self).definition;
}
});
if (idFromArgs) {
self.identify(idFromArgs);
}
}
//# sourceMappingURL=initGraphType.js.map