@pothos/plugin-simple-objects
Advanced tools
Comparing version 3.0.3 to 3.1.0
# Change Log | ||
## 3.1.0 | ||
### Minor Changes | ||
- 6279235f: Update build process to use swc and move type definitions to dts directory | ||
### Patch Changes | ||
- 21a2454e: update dev dependencies | ||
## 3.0.3 | ||
@@ -4,0 +14,0 @@ |
@@ -1,2 +0,2 @@ | ||
export {}; | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ export {}; | ||
//# sourceMappingURL=global-types.js.map |
import './global-types.js'; | ||
import SchemaBuilder, { BasePlugin, InterfaceRef, ObjectRef, } from '@pothos/core'; | ||
import SchemaBuilder, { BasePlugin, InterfaceRef, ObjectRef } from '@pothos/core'; | ||
const pluginName = "simpleObjects"; | ||
@@ -4,0 +4,0 @@ export default pluginName; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
//# sourceMappingURL=global-types.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PothosSimpleObjectsPlugin = void 0; | ||
exports.default = void 0; | ||
require("./global-types"); | ||
const core_1 = __importStar(require("@pothos/core")); | ||
var _core = _interopRequireWildcard(require("@pothos/core")); | ||
function _interopRequireWildcard(obj) { | ||
if (obj && obj.__esModule) { | ||
return obj; | ||
} else { | ||
var newObj = {}; | ||
if (obj != null) { | ||
for(var key in obj){ | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; | ||
if (desc.get || desc.set) { | ||
Object.defineProperty(newObj, key, desc); | ||
} else { | ||
newObj[key] = obj[key]; | ||
} | ||
} | ||
} | ||
} | ||
newObj.default = obj; | ||
return newObj; | ||
} | ||
} | ||
const pluginName = 'simpleObjects'; | ||
exports.default = pluginName; | ||
class PothosSimpleObjectsPlugin extends core_1.BasePlugin { | ||
var _default = pluginName; | ||
exports.default = _default; | ||
class PothosSimpleObjectsPlugin extends _core.BasePlugin { | ||
} | ||
exports.PothosSimpleObjectsPlugin = PothosSimpleObjectsPlugin; | ||
core_1.default.registerPlugin(pluginName, PothosSimpleObjectsPlugin); | ||
const proto = core_1.default.prototype; | ||
_core.default.registerPlugin(pluginName, PothosSimpleObjectsPlugin); | ||
const proto = _core.default.prototype; | ||
proto.simpleObject = function simpleObject(name, options) { | ||
const ref = new core_1.ObjectRef(name); | ||
const ref = new _core.ObjectRef(name); | ||
if (options.fields) { | ||
const originalFields = options.fields; | ||
// eslint-disable-next-line no-param-reassign | ||
options.fields = (t) => { | ||
options.fields = (t)=>{ | ||
const fields = originalFields(t); | ||
Object.keys(fields).forEach((key) => { | ||
this.configStore.onFieldUse(fields[key], (config) => { | ||
Object.keys(fields).forEach((key)=>{ | ||
this.configStore.onFieldUse(fields[key], (config)=>{ | ||
if (config.kind === 'Object') { | ||
// eslint-disable-next-line no-param-reassign | ||
config.resolve = (parent) => parent[key]; | ||
config.resolve = (parent)=>parent[key] | ||
; | ||
} | ||
@@ -54,13 +60,14 @@ }); | ||
proto.simpleInterface = function simpleInterface(name, options) { | ||
const ref = new core_1.InterfaceRef(name); | ||
const ref = new _core.InterfaceRef(name); | ||
if (options.fields) { | ||
const originalFields = options.fields; | ||
// eslint-disable-next-line no-param-reassign | ||
options.fields = (t) => { | ||
options.fields = (t)=>{ | ||
const fields = originalFields(t); | ||
Object.keys(fields).forEach((key) => { | ||
this.configStore.onFieldUse(fields[key], (config) => { | ||
Object.keys(fields).forEach((key)=>{ | ||
this.configStore.onFieldUse(fields[key], (config)=>{ | ||
if (config.kind === 'Interface') { | ||
// eslint-disable-next-line no-param-reassign | ||
config.resolve = (parent) => parent[key]; | ||
config.resolve = (parent)=>parent[key] | ||
; | ||
} | ||
@@ -75,2 +82,3 @@ }); | ||
}; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "@pothos/plugin-simple-objects", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "A Pothos plugin for defining objects and interfaces without ts definitions for those types", | ||
"main": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"types": "./dts/index.d.ts", | ||
"module": "./esm/index.js", | ||
@@ -36,4 +36,4 @@ "exports": { | ||
"devDependencies": { | ||
"@pothos/core": "3.3.1", | ||
"@pothos/test-utils": "1.0.2", | ||
"@pothos/core": "3.5.0", | ||
"@pothos/test-utils": "1.1.0", | ||
"graphql": "16.3.0", | ||
@@ -44,7 +44,9 @@ "graphql-tag": "^2.12.6" | ||
"scripts": { | ||
"type": "tsc --noEmit && tsc --project tests/tsconfig.json", | ||
"build": "pnpm build:cjs && pnpm build:esm", | ||
"build:cjs": "tsc --module commonjs --outDir lib", | ||
"build:esm": "tsc --module es2020 --outDir esm && pnpm esm:extensions", | ||
"esm:extensions": "ts-node --compiler-options \"{\\\"module\\\":\\\"commonjs\\\"}\" ../../.config/esm-transformer.ts", | ||
"type": "tsc --project tsconfig.type.json", | ||
"build": "pnpm build:clean && pnpm build:cjs && pnpm build:esm && pnpm build:dts", | ||
"build:clean": "git clean -dfX esm lib", | ||
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs", | ||
"build:esm": "swc src -d esm --config-file ../../.swcrc -C module.type=es6 && pnpm esm:extensions", | ||
"build:dts": "tsc", | ||
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../.config/esm-transformer.ts", | ||
"test": "pnpm jest --runInBand" | ||
@@ -51,0 +53,0 @@ }, |
{ | ||
"compilerOptions": { | ||
"outDir": "lib", | ||
"noEmit": false, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "dts", | ||
"rootDir": "src" | ||
}, | ||
"exclude": [ | ||
"lib", | ||
"tests" | ||
"include": [ | ||
"src/**/*" | ||
], | ||
"extends": "../../tsconfig.options.json", | ||
"include": [ | ||
"src/**/*", | ||
"types/**/*", | ||
"../../types/**/*" | ||
], | ||
"references": [ | ||
{ | ||
"path": "../test-utils" | ||
} | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114910
30
383