@ts-ghost/core-api
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -1345,3 +1345,3 @@ 'use strict'; | ||
} | ||
async edit(id, data) { | ||
async edit(id, data, options) { | ||
let updateSchema = this.config.updateSchema; | ||
@@ -1356,2 +1356,3 @@ if (!this.config.updateSchema && this.config.createSchema && isZodObject(this.config.createSchema)) { | ||
const parsedData = updateSchema.parse(data); | ||
const parsedOptions = this.config.createOptionsSchema && options ? this.config.createOptionsSchema.parse(options) : {}; | ||
if (Object.keys(parsedData).length === 0) { | ||
@@ -1365,3 +1366,3 @@ throw new Error("No data to edit"); | ||
}, | ||
{ id: cleanId }, | ||
{ id: cleanId, ...parsedOptions }, | ||
{ method: "PUT", body: parsedData }, | ||
@@ -1386,2 +1387,7 @@ this._api | ||
// src/helpers/fields.ts | ||
var schemaWithPickedFields = (schema, fields) => { | ||
return schema.pick(fields || {}); | ||
}; | ||
exports.APIComposer = APIComposer; | ||
@@ -1393,2 +1399,5 @@ exports.BasicFetcher = BasicFetcher; | ||
exports.ReadFetcher = ReadFetcher; | ||
exports._fetch = _fetch; | ||
exports._fetchRawResponse = _fetchRawResponse; | ||
exports._genHeaders = _genHeaders; | ||
exports.adminAPICredentialsSchema = adminAPICredentialsSchema; | ||
@@ -1408,4 +1417,6 @@ exports.adminAPIEndpointsSchema = adminAPIEndpointsSchema; | ||
exports.baseTiersSchema = baseTiersSchema; | ||
exports.browseParamsSchema = browseParamsSchema; | ||
exports.contentAPICredentialsSchema = contentAPICredentialsSchema; | ||
exports.emailOrIdSchema = emailOrIdSchema; | ||
exports.getJWT = getJWT; | ||
exports.ghostCodeInjectionSchema = ghostCodeInjectionSchema; | ||
@@ -1422,4 +1433,6 @@ exports.ghostExcerptSchema = ghostExcerptSchema; | ||
exports.identitySchema = identitySchema; | ||
exports.parseBrowseParams = parseBrowseParams; | ||
exports.schemaWithPickedFields = schemaWithPickedFields; | ||
exports.slugOrIdSchema = slugOrIdSchema; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map |
@@ -1345,3 +1345,3 @@ 'use strict'; | ||
} | ||
async edit(id, data) { | ||
async edit(id, data, options) { | ||
let updateSchema = this.config.updateSchema; | ||
@@ -1356,2 +1356,3 @@ if (!this.config.updateSchema && this.config.createSchema && isZodObject(this.config.createSchema)) { | ||
const parsedData = updateSchema.parse(data); | ||
const parsedOptions = this.config.createOptionsSchema && options ? this.config.createOptionsSchema.parse(options) : {}; | ||
if (Object.keys(parsedData).length === 0) { | ||
@@ -1365,3 +1366,3 @@ throw new Error("No data to edit"); | ||
}, | ||
{ id: cleanId }, | ||
{ id: cleanId, ...parsedOptions }, | ||
{ method: "PUT", body: parsedData }, | ||
@@ -1386,2 +1387,7 @@ this._api | ||
// src/helpers/fields.ts | ||
var schemaWithPickedFields = (schema, fields) => { | ||
return schema.pick(fields || {}); | ||
}; | ||
exports.APIComposer = APIComposer; | ||
@@ -1393,2 +1399,5 @@ exports.BasicFetcher = BasicFetcher; | ||
exports.ReadFetcher = ReadFetcher; | ||
exports._fetch = _fetch; | ||
exports._fetchRawResponse = _fetchRawResponse; | ||
exports._genHeaders = _genHeaders; | ||
exports.adminAPICredentialsSchema = adminAPICredentialsSchema; | ||
@@ -1408,4 +1417,6 @@ exports.adminAPIEndpointsSchema = adminAPIEndpointsSchema; | ||
exports.baseTiersSchema = baseTiersSchema; | ||
exports.browseParamsSchema = browseParamsSchema; | ||
exports.contentAPICredentialsSchema = contentAPICredentialsSchema; | ||
exports.emailOrIdSchema = emailOrIdSchema; | ||
exports.getJWT = getJWT; | ||
exports.ghostCodeInjectionSchema = ghostCodeInjectionSchema; | ||
@@ -1422,4 +1433,6 @@ exports.ghostExcerptSchema = ghostExcerptSchema; | ||
exports.identitySchema = identitySchema; | ||
exports.parseBrowseParams = parseBrowseParams; | ||
exports.schemaWithPickedFields = schemaWithPickedFields; | ||
exports.slugOrIdSchema = slugOrIdSchema; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map |
@@ -19,3 +19,3 @@ { | ||
}, | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"main": "./dist/index.js", | ||
@@ -29,15 +29,15 @@ "module": "./dist/index.mjs", | ||
"@ts-ghost/tsconfig": "*", | ||
"@types/node": "^18.15.13", | ||
"eslint": "^8.39.0", | ||
"@types/node": "^20.1.0", | ||
"eslint": "^8.40.0", | ||
"tsup": "^6.7.0", | ||
"typescript": "5.0.4", | ||
"vite": "^4.3.1", | ||
"vite": "^4.3.5", | ||
"vite-tsconfig-paths": "^4.0.7", | ||
"vitest": "^0.30.1", | ||
"vitest": "^0.31.0", | ||
"vitest-fetch-mock": "^0.2.2" | ||
}, | ||
"dependencies": { | ||
"@vitest/coverage-c8": "^0.30.1", | ||
"@vitest/coverage-c8": "^0.31.0", | ||
"cross-fetch": "^3.1.5", | ||
"jose": "^4.14.1", | ||
"jose": "^4.14.4", | ||
"zod": "^3.21.4" | ||
@@ -44,0 +44,0 @@ }, |
Sorry, the diff of this file is too big to display
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
483395
7507
+ Added@ampproject/remapping@2.3.0(transitive)
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@vitest/coverage-c8@0.31.4(transitive)
- Removed@vitest/coverage-c8@0.30.1(transitive)
Updated@vitest/coverage-c8@^0.31.0
Updatedjose@^4.14.4