@backland/schema
Version:
TypeScript schema declaration and validation library with static type inference
30 lines (29 loc) • 759 B
JavaScript
import { lazyCreateGraphTypeInitPayload } from './lazyCreateGraphTypeInitPayload';
// FIXME should fix deep instantiation types and remove `any's`
export function initGraphType(self, args) {
var {
initializer,
idFromArgs
} = 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