New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ts-ghost/core-api

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-ghost/core-api - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

980

./dist/index.js

@@ -1,85 +0,23 @@

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
'use strict';
// src/index.ts
var src_exports = {};
__export(src_exports, {
BasicFetcher: () => BasicFetcher,
BrowseFetcher: () => BrowseFetcher,
QueryBuilder: () => QueryBuilder,
ReadFetcher: () => ReadFetcher,
adminAPICredentialsSchema: () => adminAPICredentialsSchema,
adminAPIEndpointsSchema: () => adminAPIEndpointsSchema,
apiVersionsSchema: () => apiVersionsSchema,
baseAuthorsSchema: () => baseAuthorsSchema,
baseEmailSchema: () => baseEmailSchema,
baseMembersSchema: () => baseMembersSchema,
baseNewsletterSchema: () => baseNewsletterSchema,
baseOffersSchema: () => baseOffersSchema,
basePagesSchema: () => basePagesSchema,
basePostsSchema: () => basePostsSchema,
baseSettingsSchema: () => baseSettingsSchema,
baseSiteSchema: () => baseSiteSchema,
baseTagsSchema: () => baseTagsSchema,
baseTiersSchema: () => baseTiersSchema,
browseParamsSchema: () => browseParamsSchema,
contentAPICredentialsSchema: () => contentAPICredentialsSchema,
ghostCodeInjectionSchema: () => ghostCodeInjectionSchema,
ghostExcerptSchema: () => ghostExcerptSchema,
ghostFacebookSchema: () => ghostFacebookSchema,
ghostIdentityInputSchema: () => ghostIdentityInputSchema,
ghostIdentitySchema: () => ghostIdentitySchema,
ghostMetaSchema: () => ghostMetaSchema,
ghostMetadataSchema: () => ghostMetadataSchema,
ghostSocialMediaSchema: () => ghostSocialMediaSchema,
ghostTwitterSchema: () => ghostTwitterSchema,
ghostVisibilitySchema: () => ghostVisibilitySchema,
parseBrowseParams: () => parseBrowseParams,
queryIdentitySchema: () => queryIdentitySchema,
schemaWithPickedFields: () => schemaWithPickedFields
});
module.exports = __toCommonJS(src_exports);
var zod = require('zod');
var fetch = require('cross-fetch');
var jose = require('jose');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var fetch__default = /*#__PURE__*/_interopDefault(fetch);
// src/schemas/authors.ts
var import_zod2 = require("zod");
// src/schemas/shared.ts
var import_zod = require("zod");
var ghostIdentitySchema = import_zod.z.object({
slug: import_zod.z.string(),
id: import_zod.z.string()
var ghostIdentitySchema = zod.z.object({
slug: zod.z.string(),
id: zod.z.string()
});
var ghostIdentityInputSchema = import_zod.z.object({
slug: import_zod.z.string().optional(),
id: import_zod.z.string().optional()
var ghostIdentityInputSchema = zod.z.object({
slug: zod.z.string().optional(),
id: zod.z.string().optional()
});
var queryIdentitySchema = import_zod.z.object({
slug: import_zod.z.string().optional(),
id: import_zod.z.string().optional()
var queryIdentitySchema = zod.z.object({
slug: zod.z.string().optional(),
id: zod.z.string().optional()
}).refine(

@@ -100,172 +38,172 @@ (data) => {

);
var ghostMetaSchema = import_zod.z.object({
pagination: import_zod.z.object({
pages: import_zod.z.number(),
page: import_zod.z.number(),
limit: import_zod.z.number(),
total: import_zod.z.number(),
prev: import_zod.z.number().nullable(),
next: import_zod.z.number().nullable()
var ghostMetaSchema = zod.z.object({
pagination: zod.z.object({
pages: zod.z.number(),
page: zod.z.number(),
limit: zod.z.number(),
total: zod.z.number(),
prev: zod.z.number().nullable(),
next: zod.z.number().nullable()
})
});
var ghostExcerptSchema = import_zod.z.object({
excerpt: import_zod.z.string().optional(),
custom_excerpt: import_zod.z.string().optional()
var ghostExcerptSchema = zod.z.object({
excerpt: zod.z.string().optional(),
custom_excerpt: zod.z.string().optional()
});
var ghostCodeInjectionSchema = import_zod.z.object({
codeinjection_head: import_zod.z.string().nullable(),
codeinjection_foot: import_zod.z.string().nullable()
var ghostCodeInjectionSchema = zod.z.object({
codeinjection_head: zod.z.string().nullable(),
codeinjection_foot: zod.z.string().nullable()
});
var ghostFacebookSchema = import_zod.z.object({
og_image: import_zod.z.string().nullable(),
og_title: import_zod.z.string().nullable(),
og_description: import_zod.z.string().nullable()
var ghostFacebookSchema = zod.z.object({
og_image: zod.z.string().nullable(),
og_title: zod.z.string().nullable(),
og_description: zod.z.string().nullable()
});
var ghostTwitterSchema = import_zod.z.object({
twitter_image: import_zod.z.string().nullable(),
twitter_title: import_zod.z.string().nullable(),
twitter_description: import_zod.z.string().nullable()
var ghostTwitterSchema = zod.z.object({
twitter_image: zod.z.string().nullable(),
twitter_title: zod.z.string().nullable(),
twitter_description: zod.z.string().nullable()
});
var ghostSocialMediaSchema = import_zod.z.object({
var ghostSocialMediaSchema = zod.z.object({
...ghostFacebookSchema.shape,
...ghostTwitterSchema.shape
});
var ghostMetadataSchema = import_zod.z.object({
meta_title: import_zod.z.string().nullable(),
meta_description: import_zod.z.string().nullable()
var ghostMetadataSchema = zod.z.object({
meta_title: zod.z.string().nullable(),
meta_description: zod.z.string().nullable()
});
var ghostVisibilitySchema = import_zod.z.union([
import_zod.z.literal("public"),
import_zod.z.literal("members"),
import_zod.z.literal("none"),
import_zod.z.literal("internal"),
import_zod.z.literal("paid")
var ghostVisibilitySchema = zod.z.union([
zod.z.literal("public"),
zod.z.literal("members"),
zod.z.literal("none"),
zod.z.literal("internal"),
zod.z.literal("paid")
]);
var apiVersionsSchema = import_zod.z.enum(["v5.0", "v2", "v3", "v4", "canary"]).default("v5.0");
var contentAPICredentialsSchema = import_zod.z.discriminatedUnion("resource", [
import_zod.z.object({
resource: import_zod.z.literal("authors"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
var apiVersionsSchema = zod.z.enum(["v5.0", "v2", "v3", "v4", "canary"]).default("v5.0");
var contentAPICredentialsSchema = zod.z.discriminatedUnion("resource", [
zod.z.object({
resource: zod.z.literal("authors"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("tiers"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("tiers"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("pages"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("pages"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("posts"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("posts"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("tags"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("tags"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("settings"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("settings"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
})
]);
var adminAPIEndpointsSchema = import_zod.z.union([import_zod.z.literal("posts"), import_zod.z.literal("pages")]);
var adminAPICredentialsSchema = import_zod.z.discriminatedUnion("resource", [
import_zod.z.object({
resource: import_zod.z.literal("pages"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
var adminAPIEndpointsSchema = zod.z.union([zod.z.literal("posts"), zod.z.literal("pages")]);
var adminAPICredentialsSchema = zod.z.discriminatedUnion("resource", [
zod.z.object({
resource: zod.z.literal("pages"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("posts"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("posts"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("members"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("members"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("tiers"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("tiers"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("newsletters"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("newsletters"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("offers"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("offers"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("tags"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("tags"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("users"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("users"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("site"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("site"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
})

@@ -275,25 +213,19 @@ ]);

// src/schemas/authors.ts
var baseAuthorsSchema = import_zod2.z.object({
var baseAuthorsSchema = zod.z.object({
...ghostIdentitySchema.shape,
...ghostMetadataSchema.shape,
name: import_zod2.z.string(),
profile_image: import_zod2.z.string().nullable(),
cover_image: import_zod2.z.string().nullable(),
bio: import_zod2.z.string().nullable(),
website: import_zod2.z.string().nullable(),
location: import_zod2.z.string().nullable(),
facebook: import_zod2.z.string().nullable(),
twitter: import_zod2.z.string().nullable(),
count: import_zod2.z.object({
posts: import_zod2.z.number()
name: zod.z.string(),
profile_image: zod.z.string().nullable(),
cover_image: zod.z.string().nullable(),
bio: zod.z.string().nullable(),
website: zod.z.string().nullable(),
location: zod.z.string().nullable(),
facebook: zod.z.string().nullable(),
twitter: zod.z.string().nullable(),
count: zod.z.object({
posts: zod.z.number()
}).optional(),
url: import_zod2.z.string()
url: zod.z.string()
});
// src/schemas/pages.ts
var import_zod4 = require("zod");
// src/schemas/tags.ts
var import_zod3 = require("zod");
var baseTagsSchema = import_zod3.z.object({
var baseTagsSchema = zod.z.object({
...ghostIdentitySchema.shape,

@@ -303,13 +235,13 @@ ...ghostMetadataSchema.shape,

...ghostSocialMediaSchema.shape,
name: import_zod3.z.string(),
description: import_zod3.z.string().nullable(),
feature_image: import_zod3.z.string().nullable(),
name: zod.z.string(),
description: zod.z.string().nullable(),
feature_image: zod.z.string().nullable(),
visibility: ghostVisibilitySchema,
canonical_url: import_zod3.z.string().nullable(),
accent_color: import_zod3.z.string().nullable(),
url: import_zod3.z.string(),
created_at: import_zod3.z.string().nullish(),
updated_at: import_zod3.z.string().nullish(),
count: import_zod3.z.object({
posts: import_zod3.z.number()
canonical_url: zod.z.string().nullable(),
accent_color: zod.z.string().nullable(),
url: zod.z.string(),
created_at: zod.z.string().nullish(),
updated_at: zod.z.string().nullish(),
count: zod.z.object({
posts: zod.z.number()
}).optional()

@@ -320,165 +252,150 @@ });

var postsAuthorSchema = baseAuthorsSchema.extend({
url: import_zod4.z.string().nullish()
url: zod.z.string().nullish()
});
var basePagesSchema = import_zod4.z.object({
var basePagesSchema = zod.z.object({
...ghostIdentitySchema.shape,
...ghostMetadataSchema.shape,
title: import_zod4.z.string(),
html: import_zod4.z.string().nullish(),
plaintext: import_zod4.z.string().nullish(),
comment_id: import_zod4.z.string().nullable(),
feature_image: import_zod4.z.string().nullable(),
feature_image_alt: import_zod4.z.string().nullable(),
feature_image_caption: import_zod4.z.string().nullable(),
featured: import_zod4.z.boolean(),
custom_excerpt: import_zod4.z.string().nullable(),
title: zod.z.string(),
html: zod.z.string().nullish(),
plaintext: zod.z.string().nullish(),
comment_id: zod.z.string().nullable(),
feature_image: zod.z.string().nullable(),
feature_image_alt: zod.z.string().nullable(),
feature_image_caption: zod.z.string().nullable(),
featured: zod.z.boolean(),
custom_excerpt: zod.z.string().nullable(),
...ghostCodeInjectionSchema.shape,
...ghostSocialMediaSchema.shape,
visibility: ghostVisibilitySchema,
custom_template: import_zod4.z.string().nullable(),
canonical_url: import_zod4.z.string().nullable(),
authors: import_zod4.z.array(postsAuthorSchema).optional(),
tags: import_zod4.z.array(baseTagsSchema).optional(),
custom_template: zod.z.string().nullable(),
canonical_url: zod.z.string().nullable(),
authors: zod.z.array(postsAuthorSchema).optional(),
tags: zod.z.array(baseTagsSchema).optional(),
primary_author: postsAuthorSchema.nullish(),
primary_tag: baseTagsSchema.nullish(),
url: import_zod4.z.string(),
excerpt: import_zod4.z.string().nullish(),
reading_time: import_zod4.z.number().optional().default(0),
created_at: import_zod4.z.string(),
updated_at: import_zod4.z.string().nullish(),
published_at: import_zod4.z.string().nullable(),
email_subject: import_zod4.z.string().nullish(),
is_page: import_zod4.z.boolean().default(true)
url: zod.z.string(),
excerpt: zod.z.string().nullish(),
reading_time: zod.z.number().optional().default(0),
created_at: zod.z.string(),
updated_at: zod.z.string().nullish(),
published_at: zod.z.string().nullable(),
email_subject: zod.z.string().nullish(),
is_page: zod.z.boolean().default(true)
});
// src/schemas/posts.ts
var import_zod5 = require("zod");
var postsAuthorSchema2 = baseAuthorsSchema.extend({
url: import_zod5.z.string().nullish()
url: zod.z.string().nullish()
});
var basePostsSchema = import_zod5.z.object({
var basePostsSchema = zod.z.object({
...ghostIdentitySchema.shape,
...ghostMetadataSchema.shape,
title: import_zod5.z.string(),
html: import_zod5.z.string().nullish(),
plaintext: import_zod5.z.string().nullish(),
comment_id: import_zod5.z.string().nullable(),
feature_image: import_zod5.z.string().nullable(),
feature_image_alt: import_zod5.z.string().nullable(),
feature_image_caption: import_zod5.z.string().nullable(),
featured: import_zod5.z.boolean(),
custom_excerpt: import_zod5.z.string().nullable(),
title: zod.z.string(),
html: zod.z.string().nullish(),
plaintext: zod.z.string().nullish(),
comment_id: zod.z.string().nullable(),
feature_image: zod.z.string().nullable(),
feature_image_alt: zod.z.string().nullable(),
feature_image_caption: zod.z.string().nullable(),
featured: zod.z.boolean(),
custom_excerpt: zod.z.string().nullable(),
...ghostCodeInjectionSchema.shape,
...ghostSocialMediaSchema.shape,
visibility: ghostVisibilitySchema,
custom_template: import_zod5.z.string().nullable(),
canonical_url: import_zod5.z.string().nullable(),
authors: import_zod5.z.array(postsAuthorSchema2).optional(),
tags: import_zod5.z.array(baseTagsSchema).optional(),
custom_template: zod.z.string().nullable(),
canonical_url: zod.z.string().nullable(),
authors: zod.z.array(postsAuthorSchema2).optional(),
tags: zod.z.array(baseTagsSchema).optional(),
primary_author: postsAuthorSchema2.nullish(),
primary_tag: baseTagsSchema.nullish(),
url: import_zod5.z.string(),
excerpt: import_zod5.z.string().nullable(),
reading_time: import_zod5.z.number().optional().default(0),
created_at: import_zod5.z.string(),
updated_at: import_zod5.z.string().nullish(),
published_at: import_zod5.z.string().nullable(),
email_subject: import_zod5.z.string().nullish(),
is_page: import_zod5.z.boolean().default(false)
url: zod.z.string(),
excerpt: zod.z.string().nullable(),
reading_time: zod.z.number().optional().default(0),
created_at: zod.z.string(),
updated_at: zod.z.string().nullish(),
published_at: zod.z.string().nullable(),
email_subject: zod.z.string().nullish(),
is_page: zod.z.boolean().default(false)
});
// src/schemas/settings.ts
var import_zod6 = require("zod");
var baseSettingsSchema = import_zod6.z.object({
title: import_zod6.z.string(),
description: import_zod6.z.string(),
logo: import_zod6.z.string().nullable(),
icon: import_zod6.z.string().nullable(),
accent_color: import_zod6.z.string().nullable(),
cover_image: import_zod6.z.string().nullable(),
facebook: import_zod6.z.string().nullable(),
twitter: import_zod6.z.string().nullable(),
lang: import_zod6.z.string(),
timezone: import_zod6.z.string(),
codeinjection_head: import_zod6.z.string().nullable(),
codeinjection_foot: import_zod6.z.string().nullable(),
navigation: import_zod6.z.array(
import_zod6.z.object({
label: import_zod6.z.string(),
url: import_zod6.z.string()
var baseSettingsSchema = zod.z.object({
title: zod.z.string(),
description: zod.z.string(),
logo: zod.z.string().nullable(),
icon: zod.z.string().nullable(),
accent_color: zod.z.string().nullable(),
cover_image: zod.z.string().nullable(),
facebook: zod.z.string().nullable(),
twitter: zod.z.string().nullable(),
lang: zod.z.string(),
timezone: zod.z.string(),
codeinjection_head: zod.z.string().nullable(),
codeinjection_foot: zod.z.string().nullable(),
navigation: zod.z.array(
zod.z.object({
label: zod.z.string(),
url: zod.z.string()
})
),
secondary_navigation: import_zod6.z.array(
import_zod6.z.object({
label: import_zod6.z.string(),
url: import_zod6.z.string()
secondary_navigation: zod.z.array(
zod.z.object({
label: zod.z.string(),
url: zod.z.string()
})
),
meta_title: import_zod6.z.string().nullable(),
meta_description: import_zod6.z.string().nullable(),
og_image: import_zod6.z.string().nullable(),
og_title: import_zod6.z.string().nullable(),
og_description: import_zod6.z.string().nullable(),
twitter_image: import_zod6.z.string().nullable(),
twitter_title: import_zod6.z.string().nullable(),
twitter_description: import_zod6.z.string().nullable(),
members_support_address: import_zod6.z.string(),
url: import_zod6.z.string()
meta_title: zod.z.string().nullable(),
meta_description: zod.z.string().nullable(),
og_image: zod.z.string().nullable(),
og_title: zod.z.string().nullable(),
og_description: zod.z.string().nullable(),
twitter_image: zod.z.string().nullable(),
twitter_title: zod.z.string().nullable(),
twitter_description: zod.z.string().nullable(),
members_support_address: zod.z.string(),
url: zod.z.string()
});
// src/schemas/tiers.ts
var import_zod7 = require("zod");
var baseTiersSchema = import_zod7.z.object({
var baseTiersSchema = zod.z.object({
...ghostIdentitySchema.shape,
name: import_zod7.z.string(),
description: import_zod7.z.string().nullable(),
active: import_zod7.z.boolean(),
type: import_zod7.z.union([import_zod7.z.literal("free"), import_zod7.z.literal("paid")]),
welcome_page_url: import_zod7.z.string().nullable(),
created_at: import_zod7.z.string(),
updated_at: import_zod7.z.string().nullable(),
stripe_prices: import_zod7.z.array(import_zod7.z.number()).optional().transform((v) => v?.length ? v : []),
monthly_price: import_zod7.z.number().nullable().optional().transform((v) => v ? v : null),
yearly_price: import_zod7.z.number().nullable().optional().transform((v) => v ? v : null),
benefits: import_zod7.z.array(import_zod7.z.string()).optional(),
name: zod.z.string(),
description: zod.z.string().nullable(),
active: zod.z.boolean(),
type: zod.z.union([zod.z.literal("free"), zod.z.literal("paid")]),
welcome_page_url: zod.z.string().nullable(),
created_at: zod.z.string(),
updated_at: zod.z.string().nullable(),
stripe_prices: zod.z.array(zod.z.number()).optional().transform((v) => v?.length ? v : []),
monthly_price: zod.z.number().nullable().optional().transform((v) => v ? v : null),
yearly_price: zod.z.number().nullable().optional().transform((v) => v ? v : null),
benefits: zod.z.array(zod.z.string()).optional(),
visibility: ghostVisibilitySchema,
currency: import_zod7.z.string().nullish(),
trial_days: import_zod7.z.number().default(0)
currency: zod.z.string().nullish(),
trial_days: zod.z.number().default(0)
});
// src/schemas/email.ts
var import_zod8 = require("zod");
var baseEmailSchema = import_zod8.z.object({
id: import_zod8.z.string(),
uuid: import_zod8.z.string(),
status: import_zod8.z.string(),
recipient_filter: import_zod8.z.string(),
error: import_zod8.z.string().nullish(),
error_data: import_zod8.z.any().nullable(),
email_count: import_zod8.z.number(),
delivered_count: import_zod8.z.number(),
opened_count: import_zod8.z.number(),
failed_count: import_zod8.z.number(),
subject: import_zod8.z.string(),
from: import_zod8.z.string(),
reply_to: import_zod8.z.string(),
html: import_zod8.z.string(),
plaintext: import_zod8.z.string(),
track_opens: import_zod8.z.boolean(),
submitted_at: import_zod8.z.string(),
created_at: import_zod8.z.string(),
updated_at: import_zod8.z.string()
var baseEmailSchema = zod.z.object({
id: zod.z.string(),
uuid: zod.z.string(),
status: zod.z.string(),
recipient_filter: zod.z.string(),
error: zod.z.string().nullish(),
error_data: zod.z.any().nullable(),
email_count: zod.z.number(),
delivered_count: zod.z.number(),
opened_count: zod.z.number(),
failed_count: zod.z.number(),
subject: zod.z.string(),
from: zod.z.string(),
reply_to: zod.z.string(),
html: zod.z.string(),
plaintext: zod.z.string(),
track_opens: zod.z.boolean(),
submitted_at: zod.z.string(),
created_at: zod.z.string(),
updated_at: zod.z.string()
});
// src/schemas/offers.ts
var import_zod9 = require("zod");
var baseOffersSchema = import_zod9.z.object({
id: import_zod9.z.string(),
name: import_zod9.z.string({ description: "Internal name for an offer, must be unique" }),
code: import_zod9.z.string({ description: "Shortcode for the offer, for example: https://yoursite.com/black-friday" }),
display_title: import_zod9.z.string({ description: "Name displayed in the offer window" }),
display_description: import_zod9.z.string({ description: "Text displayed in the offer window" }),
type: import_zod9.z.union([import_zod9.z.literal("percent"), import_zod9.z.literal("fixed"), import_zod9.z.literal("trial")]),
cadence: import_zod9.z.union([import_zod9.z.literal("month"), import_zod9.z.literal("year")]),
amount: import_zod9.z.number({
var baseOffersSchema = zod.z.object({
id: zod.z.string(),
name: zod.z.string({ description: "Internal name for an offer, must be unique" }),
code: zod.z.string({ description: "Shortcode for the offer, for example: https://yoursite.com/black-friday" }),
display_title: zod.z.string({ description: "Name displayed in the offer window" }),
display_description: zod.z.string({ description: "Text displayed in the offer window" }),
type: zod.z.union([zod.z.literal("percent"), zod.z.literal("fixed"), zod.z.literal("trial")]),
cadence: zod.z.union([zod.z.literal("month"), zod.z.literal("year")]),
amount: zod.z.number({
description: `Offer discount amount, as a percentage or fixed value as set in type.

@@ -488,18 +405,18 @@ Amount is always denoted by the smallest currency unit

}),
duration: import_zod9.z.union([import_zod9.z.literal("once"), import_zod9.z.literal("forever"), import_zod9.z.literal("repeating"), import_zod9.z.literal("trial")], {
duration: zod.z.union([zod.z.literal("once"), zod.z.literal("forever"), zod.z.literal("repeating"), zod.z.literal("trial")], {
description: "once/forever/repeating. repeating duration is only available when cadence is month"
}),
duration_in_months: import_zod9.z.number({ description: "Number of months offer should be repeated when duration is repeating" }).nullable(),
currency_restriction: import_zod9.z.boolean({
duration_in_months: zod.z.number({ description: "Number of months offer should be repeated when duration is repeating" }).nullable(),
currency_restriction: zod.z.boolean({
description: "Denotes whether the offer `currency` is restricted. If so, changing the currency invalidates the offer"
}),
currency: import_zod9.z.string({ description: "fixed type offers only - specifies tier's currency as three letter ISO currency code" }).nullable(),
status: import_zod9.z.union([import_zod9.z.literal("active"), import_zod9.z.literal("archived")], {
currency: zod.z.string({ description: "fixed type offers only - specifies tier's currency as three letter ISO currency code" }).nullable(),
status: zod.z.union([zod.z.literal("active"), zod.z.literal("archived")], {
description: "active or archived - denotes if the offer is active or archived"
}),
redemption_count: import_zod9.z.number({ description: "Number of times the offer has been redeemed" }),
tier: import_zod9.z.object(
redemption_count: zod.z.number({ description: "Number of times the offer has been redeemed" }),
tier: zod.z.object(
{
id: import_zod9.z.string(),
name: import_zod9.z.string()
id: zod.z.string(),
name: zod.z.string()
},

@@ -509,74 +426,65 @@ { description: "Tier on which offer is applied" }

});
// src/schemas/members.ts
var import_zod12 = require("zod");
// src/schemas/newsletter.ts
var import_zod10 = require("zod");
var baseNewsletterSchema = import_zod10.z.object({
var baseNewsletterSchema = zod.z.object({
...ghostIdentitySchema.shape,
name: import_zod10.z.string({ description: "Public name for the newsletter" }),
description: import_zod10.z.string({ description: "(nullable) Public description of the newsletter" }).nullish(),
sender_name: import_zod10.z.string({ description: "(nullable) The sender name of the emails" }).nullish(),
sender_email: import_zod10.z.string({ description: "(nullable) The email from which to send emails. Requires validation." }).nullish(),
sender_reply_to: import_zod10.z.string({
name: zod.z.string({ description: "Public name for the newsletter" }),
description: zod.z.string({ description: "(nullable) Public description of the newsletter" }).nullish(),
sender_name: zod.z.string({ description: "(nullable) The sender name of the emails" }).nullish(),
sender_email: zod.z.string({ description: "(nullable) The email from which to send emails. Requires validation." }).nullish(),
sender_reply_to: zod.z.string({
description: "The reply-to email address for sent emails. Can be either newsletter (= use sender_email) or support (use support email from Portal settings)."
}),
status: import_zod10.z.union([import_zod10.z.literal("active"), import_zod10.z.literal("archived")], {
status: zod.z.union([zod.z.literal("active"), zod.z.literal("archived")], {
description: "active or archived - denotes if the newsletter is active or archived"
}),
visibility: import_zod10.z.union([import_zod10.z.literal("public"), import_zod10.z.literal("members")]),
subscribe_on_signup: import_zod10.z.boolean({
visibility: zod.z.union([zod.z.literal("public"), zod.z.literal("members")]),
subscribe_on_signup: zod.z.boolean({
description: "true/false. Whether members should automatically subscribe to this newsletter on signup"
}),
sort_order: import_zod10.z.number({ description: "The order in which newsletters are displayed in the Portal" }),
header_image: import_zod10.z.string({ description: "(nullable) Path to an image to show at the top of emails. Recommended size 1200x600" }).nullish(),
show_header_icon: import_zod10.z.boolean({ description: "true/false. Show the site icon in emails" }),
show_header_title: import_zod10.z.boolean({ description: "true/false. Show the site name in emails" }),
title_font_category: import_zod10.z.union([import_zod10.z.literal("serif"), import_zod10.z.literal("sans_serif")], {
sort_order: zod.z.number({ description: "The order in which newsletters are displayed in the Portal" }),
header_image: zod.z.string({ description: "(nullable) Path to an image to show at the top of emails. Recommended size 1200x600" }).nullish(),
show_header_icon: zod.z.boolean({ description: "true/false. Show the site icon in emails" }),
show_header_title: zod.z.boolean({ description: "true/false. Show the site name in emails" }),
title_font_category: zod.z.union([zod.z.literal("serif"), zod.z.literal("sans_serif")], {
description: "Title font style. Either serif or sans_serif"
}),
title_alignment: import_zod10.z.string().nullish(),
show_feature_image: import_zod10.z.boolean({ description: "true/false. Show the post's feature image in emails" }),
body_font_category: import_zod10.z.union([import_zod10.z.literal("serif"), import_zod10.z.literal("sans_serif")], {
title_alignment: zod.z.string().nullish(),
show_feature_image: zod.z.boolean({ description: "true/false. Show the post's feature image in emails" }),
body_font_category: zod.z.union([zod.z.literal("serif"), zod.z.literal("sans_serif")], {
description: "Body font style. Either serif or sans_serif"
}),
footer_content: import_zod10.z.string({
footer_content: zod.z.string({
description: "(nullable) Extra information or legal text to show in the footer of emails. Should contain valid HTML."
}).nullish(),
show_badge: import_zod10.z.boolean({
show_badge: zod.z.boolean({
description: "true/false. Show you\u2019re a part of the indie publishing movement by adding a small Ghost badge in the footer"
}),
created_at: import_zod10.z.string(),
updated_at: import_zod10.z.string().nullish(),
show_header_name: import_zod10.z.boolean({ description: "true/false. Show the newsletter name in emails" }),
uuid: import_zod10.z.string()
created_at: zod.z.string(),
updated_at: zod.z.string().nullish(),
show_header_name: zod.z.boolean({ description: "true/false. Show the newsletter name in emails" }),
uuid: zod.z.string()
});
// src/schemas/subscriptions.ts
var import_zod11 = require("zod");
var baseSubscriptionsSchema = import_zod11.z.object({
id: import_zod11.z.string({ description: "Stripe subscription ID sub_XXXX" }),
customer: import_zod11.z.object(
var baseSubscriptionsSchema = zod.z.object({
id: zod.z.string({ description: "Stripe subscription ID sub_XXXX" }),
customer: zod.z.object(
{
id: import_zod11.z.string(),
name: import_zod11.z.string().nullable(),
email: import_zod11.z.string()
id: zod.z.string(),
name: zod.z.string().nullable(),
email: zod.z.string()
},
{ description: "Stripe customer attached to the subscription" }
),
status: import_zod11.z.string({ description: "Subscription status" }),
start_date: import_zod11.z.string({ description: "Subscription start date" }),
default_payment_card_last4: import_zod11.z.string({ description: "Last 4 digits of the card" }).nullable(),
cancel_at_period_end: import_zod11.z.boolean({ description: "If the subscription should be canceled or renewed at period end" }),
cancellation_reason: import_zod11.z.string({ description: "Reason for subscription cancellation" }).nullable(),
current_period_end: import_zod11.z.string({ description: "Subscription end date" }),
price: import_zod11.z.object({
id: import_zod11.z.string({ description: "Stripe price ID" }),
price_id: import_zod11.z.string({ description: "Ghost price ID" }),
nickname: import_zod11.z.string({ description: "Price nickname" }),
amount: import_zod11.z.number({ description: "Price amount" }),
interval: import_zod11.z.string({ description: "Price interval" }),
type: import_zod11.z.string({ description: "Price type" }),
currency: import_zod11.z.string({ description: "Price currency" })
status: zod.z.string({ description: "Subscription status" }),
start_date: zod.z.string({ description: "Subscription start date" }),
default_payment_card_last4: zod.z.string({ description: "Last 4 digits of the card" }).nullable(),
cancel_at_period_end: zod.z.boolean({ description: "If the subscription should be canceled or renewed at period end" }),
cancellation_reason: zod.z.string({ description: "Reason for subscription cancellation" }).nullable(),
current_period_end: zod.z.string({ description: "Subscription end date" }),
price: zod.z.object({
id: zod.z.string({ description: "Stripe price ID" }),
price_id: zod.z.string({ description: "Ghost price ID" }),
nickname: zod.z.string({ description: "Price nickname" }),
amount: zod.z.number({ description: "Price amount" }),
interval: zod.z.string({ description: "Price interval" }),
type: zod.z.string({ description: "Price type" }),
currency: zod.z.string({ description: "Price currency" })
}),

@@ -588,51 +496,45 @@ tier: baseTiersSchema.nullish(),

// src/schemas/members.ts
var baseMembersSchema = import_zod12.z.object({
id: import_zod12.z.string(),
email: import_zod12.z.string({ description: "The email address of the member" }),
name: import_zod12.z.string({ description: "The name of the member" }).nullable(),
note: import_zod12.z.string({ description: "(nullable) A note about the member" }).nullish(),
geolocation: import_zod12.z.string({ description: "(nullable) The geolocation of the member" }).nullish(),
created_at: import_zod12.z.string({ description: "The date and time the member was created" }),
updated_at: import_zod12.z.string({ description: "(nullable) The date and time the member was last updated" }).nullish(),
labels: import_zod12.z.array(
import_zod12.z.object({
id: import_zod12.z.string({ description: "The ID of the label" }),
name: import_zod12.z.string({ description: "The name of the label" }),
slug: import_zod12.z.string({ description: "The slug of the label" }),
created_at: import_zod12.z.string({ description: "The date and time the label was created" }),
updated_at: import_zod12.z.string({ description: "(nullable) The date and time the label was last updated" }).nullish()
var baseMembersSchema = zod.z.object({
id: zod.z.string(),
email: zod.z.string({ description: "The email address of the member" }),
name: zod.z.string({ description: "The name of the member" }).nullable(),
note: zod.z.string({ description: "(nullable) A note about the member" }).nullish(),
geolocation: zod.z.string({ description: "(nullable) The geolocation of the member" }).nullish(),
created_at: zod.z.string({ description: "The date and time the member was created" }),
updated_at: zod.z.string({ description: "(nullable) The date and time the member was last updated" }).nullish(),
labels: zod.z.array(
zod.z.object({
id: zod.z.string({ description: "The ID of the label" }),
name: zod.z.string({ description: "The name of the label" }),
slug: zod.z.string({ description: "The slug of the label" }),
created_at: zod.z.string({ description: "The date and time the label was created" }),
updated_at: zod.z.string({ description: "(nullable) The date and time the label was last updated" }).nullish()
}),
{ description: "The labels associated with the member" }
),
subscriptions: import_zod12.z.array(baseSubscriptionsSchema, { description: "The subscriptions associated with the member" }),
avatar_image: import_zod12.z.string({ description: "The URL of the member's avatar image" }),
email_count: import_zod12.z.number({ description: "The number of emails sent to the member" }),
email_opened_count: import_zod12.z.number({ description: "The number of emails opened by the member" }),
email_open_rate: import_zod12.z.number({ description: "(nullable) The open rate of the member" }).nullish(),
status: import_zod12.z.string({ description: "The status of the member" }),
last_seen_at: import_zod12.z.string({ description: "(nullable) The date and time the member was last seen" }).nullish(),
newsletters: import_zod12.z.array(baseNewsletterSchema)
subscriptions: zod.z.array(baseSubscriptionsSchema, { description: "The subscriptions associated with the member" }),
avatar_image: zod.z.string({ description: "The URL of the member's avatar image" }),
email_count: zod.z.number({ description: "The number of emails sent to the member" }),
email_opened_count: zod.z.number({ description: "The number of emails opened by the member" }),
email_open_rate: zod.z.number({ description: "(nullable) The open rate of the member" }).nullish(),
status: zod.z.string({ description: "The status of the member" }),
last_seen_at: zod.z.string({ description: "(nullable) The date and time the member was last seen" }).nullish(),
newsletters: zod.z.array(baseNewsletterSchema)
});
// src/schemas/site.ts
var import_zod13 = require("zod");
var baseSiteSchema = import_zod13.z.object({
title: import_zod13.z.string(),
description: import_zod13.z.string(),
logo: import_zod13.z.string().nullable(),
version: import_zod13.z.string(),
url: import_zod13.z.string()
var baseSiteSchema = zod.z.object({
title: zod.z.string(),
description: zod.z.string(),
logo: zod.z.string().nullable(),
version: zod.z.string(),
url: zod.z.string()
});
// src/query-builder/browse-params.ts
var import_zod14 = require("zod");
var browseParamsSchema = import_zod14.z.object({
order: import_zod14.z.string().optional(),
limit: import_zod14.z.number().refine((n) => n && n > 0 && n <= 15, {
var browseParamsSchema = zod.z.object({
order: zod.z.string().optional(),
limit: zod.z.number().refine((n) => n && n > 0 && n <= 15, {
message: "Limit must be between 1 and 15"
}).optional(),
page: import_zod14.z.number().refine((n) => n && n >= 1, {
page: zod.z.number().refine((n) => n && n >= 1, {
message: "Page must be greater than 1"
}).optional(),
filter: import_zod14.z.string().optional()
filter: zod.z.string().optional()
});

@@ -645,4 +547,4 @@ var parseBrowseParams = (args, schema, includeSchema) => {

const augmentedSchema = browseParamsSchema.merge(
import_zod14.z.object({
order: import_zod14.z.string().superRefine((val, ctx) => {
zod.z.object({
order: zod.z.string().superRefine((val, ctx) => {
const orderPredicates = val.split(",");

@@ -653,3 +555,3 @@ for (const orderPredicate of orderPredicates) {

ctx.addIssue({
code: import_zod14.z.ZodIssueCode.custom,
code: zod.z.ZodIssueCode.custom,
message: `Field "${field}" is not a valid field`,

@@ -661,3 +563,3 @@ fatal: true

ctx.addIssue({
code: import_zod14.z.ZodIssueCode.custom,
code: zod.z.ZodIssueCode.custom,
message: "Order direction must be ASC or DESC",

@@ -669,3 +571,3 @@ fatal: true

}).optional(),
filter: import_zod14.z.string().superRefine((val, ctx) => {
filter: zod.z.string().superRefine((val, ctx) => {
const filterPredicates = val.split(/[+(,]+/);

@@ -676,3 +578,3 @@ for (const filterPredicate of filterPredicates) {

ctx.addIssue({
code: import_zod14.z.ZodIssueCode.custom,
code: zod.z.ZodIssueCode.custom,
message: `Field "${field}" is not a valid field`,

@@ -693,17 +595,5 @@ fatal: true

};
// src/fetchers/browse-fetcher.ts
var import_zod15 = require("zod");
// src/fetchers/helpers.ts
var import_cross_fetch = __toESM(require("cross-fetch"));
var import_jsonwebtoken = __toESM(require("jsonwebtoken"));
function getJWT(key) {
const [id, secret] = key.split(":");
return import_jsonwebtoken.default.sign({}, Buffer.from(secret, "hex"), {
keyid: id,
algorithm: "HS256",
expiresIn: "5m",
audience: "/admin/"
});
async function getJWT(key) {
const [id, _secret] = key.split(":");
return new jose.SignJWT({}).setProtectedHeader({ kid: id, alg: "HS256" }).setExpirationTime("5m").setIssuedAt().setAudience("/admin/").sign(Uint8Array.from(_secret.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))));
}

@@ -719,6 +609,7 @@ async function _fetch(URL2, api) {

if (api.endpoint === "admin") {
headers["Authorization"] = `Ghost ${getJWT(api.key)}`;
const jwt = await getJWT(api.key);
headers["Authorization"] = `Ghost ${jwt}`;
}
try {
result = await (await (0, import_cross_fetch.default)(URL2.toString(), {
result = await (await fetch__default.default(URL2.toString(), {
headers

@@ -881,14 +772,14 @@ })).json();

_getResultSchema() {
return import_zod15.z.discriminatedUnion("status", [
import_zod15.z.object({
status: import_zod15.z.literal("success"),
return zod.z.discriminatedUnion("status", [
zod.z.object({
status: zod.z.literal("success"),
meta: ghostMetaSchema,
data: import_zod15.z.array(this.config.output)
data: zod.z.array(this.config.output)
}),
import_zod15.z.object({
status: import_zod15.z.literal("error"),
errors: import_zod15.z.array(
import_zod15.z.object({
type: import_zod15.z.string(),
message: import_zod15.z.string()
zod.z.object({
status: zod.z.literal("error"),
errors: zod.z.array(
zod.z.object({
type: zod.z.string(),
message: zod.z.string()
})

@@ -975,5 +866,2 @@ )

};
// src/fetchers/read-fetcher.ts
var import_zod16 = require("zod");
var ReadFetcher = class {

@@ -1104,13 +992,13 @@ constructor(config, _params, _api) {

async fetch() {
const res = import_zod16.z.discriminatedUnion("status", [
import_zod16.z.object({
status: import_zod16.z.literal("success"),
const res = zod.z.discriminatedUnion("status", [
zod.z.object({
status: zod.z.literal("success"),
data: this.config.output
}),
import_zod16.z.object({
status: import_zod16.z.literal("error"),
errors: import_zod16.z.array(
import_zod16.z.object({
type: import_zod16.z.string(),
message: import_zod16.z.string()
zod.z.object({
status: zod.z.literal("error"),
errors: zod.z.array(
zod.z.object({
type: zod.z.string(),
message: zod.z.string()
})

@@ -1176,5 +1064,2 @@ )

};
// src/fetchers/basic-fetcher.ts
var import_zod17 = require("zod");
var BasicFetcher = class {

@@ -1212,13 +1097,13 @@ constructor(config, _api) {

async fetch() {
const res = import_zod17.z.discriminatedUnion("status", [
import_zod17.z.object({
status: import_zod17.z.literal("success"),
const res = zod.z.discriminatedUnion("status", [
zod.z.object({
status: zod.z.literal("success"),
data: this.config.output
}),
import_zod17.z.object({
status: import_zod17.z.literal("error"),
errors: import_zod17.z.array(
import_zod17.z.object({
type: import_zod17.z.string(),
message: import_zod17.z.string()
zod.z.object({
status: zod.z.literal("error"),
errors: zod.z.array(
zod.z.object({
type: zod.z.string(),
message: zod.z.string()
})

@@ -1242,38 +1127,37 @@ )

};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BasicFetcher,
BrowseFetcher,
QueryBuilder,
ReadFetcher,
adminAPICredentialsSchema,
adminAPIEndpointsSchema,
apiVersionsSchema,
baseAuthorsSchema,
baseEmailSchema,
baseMembersSchema,
baseNewsletterSchema,
baseOffersSchema,
basePagesSchema,
basePostsSchema,
baseSettingsSchema,
baseSiteSchema,
baseTagsSchema,
baseTiersSchema,
browseParamsSchema,
contentAPICredentialsSchema,
ghostCodeInjectionSchema,
ghostExcerptSchema,
ghostFacebookSchema,
ghostIdentityInputSchema,
ghostIdentitySchema,
ghostMetaSchema,
ghostMetadataSchema,
ghostSocialMediaSchema,
ghostTwitterSchema,
ghostVisibilitySchema,
parseBrowseParams,
queryIdentitySchema,
schemaWithPickedFields
});
exports.BasicFetcher = BasicFetcher;
exports.BrowseFetcher = BrowseFetcher;
exports.QueryBuilder = QueryBuilder;
exports.ReadFetcher = ReadFetcher;
exports.adminAPICredentialsSchema = adminAPICredentialsSchema;
exports.adminAPIEndpointsSchema = adminAPIEndpointsSchema;
exports.apiVersionsSchema = apiVersionsSchema;
exports.baseAuthorsSchema = baseAuthorsSchema;
exports.baseEmailSchema = baseEmailSchema;
exports.baseMembersSchema = baseMembersSchema;
exports.baseNewsletterSchema = baseNewsletterSchema;
exports.baseOffersSchema = baseOffersSchema;
exports.basePagesSchema = basePagesSchema;
exports.basePostsSchema = basePostsSchema;
exports.baseSettingsSchema = baseSettingsSchema;
exports.baseSiteSchema = baseSiteSchema;
exports.baseTagsSchema = baseTagsSchema;
exports.baseTiersSchema = baseTiersSchema;
exports.browseParamsSchema = browseParamsSchema;
exports.contentAPICredentialsSchema = contentAPICredentialsSchema;
exports.ghostCodeInjectionSchema = ghostCodeInjectionSchema;
exports.ghostExcerptSchema = ghostExcerptSchema;
exports.ghostFacebookSchema = ghostFacebookSchema;
exports.ghostIdentityInputSchema = ghostIdentityInputSchema;
exports.ghostIdentitySchema = ghostIdentitySchema;
exports.ghostMetaSchema = ghostMetaSchema;
exports.ghostMetadataSchema = ghostMetadataSchema;
exports.ghostSocialMediaSchema = ghostSocialMediaSchema;
exports.ghostTwitterSchema = ghostTwitterSchema;
exports.ghostVisibilitySchema = ghostVisibilitySchema;
exports.parseBrowseParams = parseBrowseParams;
exports.queryIdentitySchema = queryIdentitySchema;
exports.schemaWithPickedFields = schemaWithPickedFields;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map

@@ -1,85 +0,23 @@

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
'use strict';
// src/index.ts
var src_exports = {};
__export(src_exports, {
BasicFetcher: () => BasicFetcher,
BrowseFetcher: () => BrowseFetcher,
QueryBuilder: () => QueryBuilder,
ReadFetcher: () => ReadFetcher,
adminAPICredentialsSchema: () => adminAPICredentialsSchema,
adminAPIEndpointsSchema: () => adminAPIEndpointsSchema,
apiVersionsSchema: () => apiVersionsSchema,
baseAuthorsSchema: () => baseAuthorsSchema,
baseEmailSchema: () => baseEmailSchema,
baseMembersSchema: () => baseMembersSchema,
baseNewsletterSchema: () => baseNewsletterSchema,
baseOffersSchema: () => baseOffersSchema,
basePagesSchema: () => basePagesSchema,
basePostsSchema: () => basePostsSchema,
baseSettingsSchema: () => baseSettingsSchema,
baseSiteSchema: () => baseSiteSchema,
baseTagsSchema: () => baseTagsSchema,
baseTiersSchema: () => baseTiersSchema,
browseParamsSchema: () => browseParamsSchema,
contentAPICredentialsSchema: () => contentAPICredentialsSchema,
ghostCodeInjectionSchema: () => ghostCodeInjectionSchema,
ghostExcerptSchema: () => ghostExcerptSchema,
ghostFacebookSchema: () => ghostFacebookSchema,
ghostIdentityInputSchema: () => ghostIdentityInputSchema,
ghostIdentitySchema: () => ghostIdentitySchema,
ghostMetaSchema: () => ghostMetaSchema,
ghostMetadataSchema: () => ghostMetadataSchema,
ghostSocialMediaSchema: () => ghostSocialMediaSchema,
ghostTwitterSchema: () => ghostTwitterSchema,
ghostVisibilitySchema: () => ghostVisibilitySchema,
parseBrowseParams: () => parseBrowseParams,
queryIdentitySchema: () => queryIdentitySchema,
schemaWithPickedFields: () => schemaWithPickedFields
});
module.exports = __toCommonJS(src_exports);
var zod = require('zod');
var fetch = require('cross-fetch');
var jose = require('jose');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var fetch__default = /*#__PURE__*/_interopDefault(fetch);
// src/schemas/authors.ts
var import_zod2 = require("zod");
// src/schemas/shared.ts
var import_zod = require("zod");
var ghostIdentitySchema = import_zod.z.object({
slug: import_zod.z.string(),
id: import_zod.z.string()
var ghostIdentitySchema = zod.z.object({
slug: zod.z.string(),
id: zod.z.string()
});
var ghostIdentityInputSchema = import_zod.z.object({
slug: import_zod.z.string().optional(),
id: import_zod.z.string().optional()
var ghostIdentityInputSchema = zod.z.object({
slug: zod.z.string().optional(),
id: zod.z.string().optional()
});
var queryIdentitySchema = import_zod.z.object({
slug: import_zod.z.string().optional(),
id: import_zod.z.string().optional()
var queryIdentitySchema = zod.z.object({
slug: zod.z.string().optional(),
id: zod.z.string().optional()
}).refine(

@@ -100,172 +38,172 @@ (data) => {

);
var ghostMetaSchema = import_zod.z.object({
pagination: import_zod.z.object({
pages: import_zod.z.number(),
page: import_zod.z.number(),
limit: import_zod.z.number(),
total: import_zod.z.number(),
prev: import_zod.z.number().nullable(),
next: import_zod.z.number().nullable()
var ghostMetaSchema = zod.z.object({
pagination: zod.z.object({
pages: zod.z.number(),
page: zod.z.number(),
limit: zod.z.number(),
total: zod.z.number(),
prev: zod.z.number().nullable(),
next: zod.z.number().nullable()
})
});
var ghostExcerptSchema = import_zod.z.object({
excerpt: import_zod.z.string().optional(),
custom_excerpt: import_zod.z.string().optional()
var ghostExcerptSchema = zod.z.object({
excerpt: zod.z.string().optional(),
custom_excerpt: zod.z.string().optional()
});
var ghostCodeInjectionSchema = import_zod.z.object({
codeinjection_head: import_zod.z.string().nullable(),
codeinjection_foot: import_zod.z.string().nullable()
var ghostCodeInjectionSchema = zod.z.object({
codeinjection_head: zod.z.string().nullable(),
codeinjection_foot: zod.z.string().nullable()
});
var ghostFacebookSchema = import_zod.z.object({
og_image: import_zod.z.string().nullable(),
og_title: import_zod.z.string().nullable(),
og_description: import_zod.z.string().nullable()
var ghostFacebookSchema = zod.z.object({
og_image: zod.z.string().nullable(),
og_title: zod.z.string().nullable(),
og_description: zod.z.string().nullable()
});
var ghostTwitterSchema = import_zod.z.object({
twitter_image: import_zod.z.string().nullable(),
twitter_title: import_zod.z.string().nullable(),
twitter_description: import_zod.z.string().nullable()
var ghostTwitterSchema = zod.z.object({
twitter_image: zod.z.string().nullable(),
twitter_title: zod.z.string().nullable(),
twitter_description: zod.z.string().nullable()
});
var ghostSocialMediaSchema = import_zod.z.object({
var ghostSocialMediaSchema = zod.z.object({
...ghostFacebookSchema.shape,
...ghostTwitterSchema.shape
});
var ghostMetadataSchema = import_zod.z.object({
meta_title: import_zod.z.string().nullable(),
meta_description: import_zod.z.string().nullable()
var ghostMetadataSchema = zod.z.object({
meta_title: zod.z.string().nullable(),
meta_description: zod.z.string().nullable()
});
var ghostVisibilitySchema = import_zod.z.union([
import_zod.z.literal("public"),
import_zod.z.literal("members"),
import_zod.z.literal("none"),
import_zod.z.literal("internal"),
import_zod.z.literal("paid")
var ghostVisibilitySchema = zod.z.union([
zod.z.literal("public"),
zod.z.literal("members"),
zod.z.literal("none"),
zod.z.literal("internal"),
zod.z.literal("paid")
]);
var apiVersionsSchema = import_zod.z.enum(["v5.0", "v2", "v3", "v4", "canary"]).default("v5.0");
var contentAPICredentialsSchema = import_zod.z.discriminatedUnion("resource", [
import_zod.z.object({
resource: import_zod.z.literal("authors"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
var apiVersionsSchema = zod.z.enum(["v5.0", "v2", "v3", "v4", "canary"]).default("v5.0");
var contentAPICredentialsSchema = zod.z.discriminatedUnion("resource", [
zod.z.object({
resource: zod.z.literal("authors"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("tiers"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("tiers"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("pages"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("pages"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("posts"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("posts"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("tags"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("tags"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
}),
import_zod.z.object({
resource: import_zod.z.literal("settings"),
key: import_zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
zod.z.object({
resource: zod.z.literal("settings"),
key: zod.z.string().regex(/[0-9a-f]{26}/, { message: "'key' must have 26 hex characters" }),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("content")
url: zod.z.string().url(),
endpoint: zod.z.literal("content")
})
]);
var adminAPIEndpointsSchema = import_zod.z.union([import_zod.z.literal("posts"), import_zod.z.literal("pages")]);
var adminAPICredentialsSchema = import_zod.z.discriminatedUnion("resource", [
import_zod.z.object({
resource: import_zod.z.literal("pages"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
var adminAPIEndpointsSchema = zod.z.union([zod.z.literal("posts"), zod.z.literal("pages")]);
var adminAPICredentialsSchema = zod.z.discriminatedUnion("resource", [
zod.z.object({
resource: zod.z.literal("pages"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("posts"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("posts"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("members"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("members"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("tiers"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("tiers"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("newsletters"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("newsletters"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("offers"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("offers"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("tags"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("tags"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("users"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("users"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
}),
import_zod.z.object({
resource: import_zod.z.literal("site"),
key: import_zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
zod.z.object({
resource: zod.z.literal("site"),
key: zod.z.string().regex(/[0-9a-f]{24}:[0-9a-f]{64}/, {
message: "'key' must have the following format {A}:{B}, where A is 24 hex characters and B is 64 hex characters"
}),
version: apiVersionsSchema,
url: import_zod.z.string().url(),
endpoint: import_zod.z.literal("admin")
url: zod.z.string().url(),
endpoint: zod.z.literal("admin")
})

@@ -275,25 +213,19 @@ ]);

// src/schemas/authors.ts
var baseAuthorsSchema = import_zod2.z.object({
var baseAuthorsSchema = zod.z.object({
...ghostIdentitySchema.shape,
...ghostMetadataSchema.shape,
name: import_zod2.z.string(),
profile_image: import_zod2.z.string().nullable(),
cover_image: import_zod2.z.string().nullable(),
bio: import_zod2.z.string().nullable(),
website: import_zod2.z.string().nullable(),
location: import_zod2.z.string().nullable(),
facebook: import_zod2.z.string().nullable(),
twitter: import_zod2.z.string().nullable(),
count: import_zod2.z.object({
posts: import_zod2.z.number()
name: zod.z.string(),
profile_image: zod.z.string().nullable(),
cover_image: zod.z.string().nullable(),
bio: zod.z.string().nullable(),
website: zod.z.string().nullable(),
location: zod.z.string().nullable(),
facebook: zod.z.string().nullable(),
twitter: zod.z.string().nullable(),
count: zod.z.object({
posts: zod.z.number()
}).optional(),
url: import_zod2.z.string()
url: zod.z.string()
});
// src/schemas/pages.ts
var import_zod4 = require("zod");
// src/schemas/tags.ts
var import_zod3 = require("zod");
var baseTagsSchema = import_zod3.z.object({
var baseTagsSchema = zod.z.object({
...ghostIdentitySchema.shape,

@@ -303,13 +235,13 @@ ...ghostMetadataSchema.shape,

...ghostSocialMediaSchema.shape,
name: import_zod3.z.string(),
description: import_zod3.z.string().nullable(),
feature_image: import_zod3.z.string().nullable(),
name: zod.z.string(),
description: zod.z.string().nullable(),
feature_image: zod.z.string().nullable(),
visibility: ghostVisibilitySchema,
canonical_url: import_zod3.z.string().nullable(),
accent_color: import_zod3.z.string().nullable(),
url: import_zod3.z.string(),
created_at: import_zod3.z.string().nullish(),
updated_at: import_zod3.z.string().nullish(),
count: import_zod3.z.object({
posts: import_zod3.z.number()
canonical_url: zod.z.string().nullable(),
accent_color: zod.z.string().nullable(),
url: zod.z.string(),
created_at: zod.z.string().nullish(),
updated_at: zod.z.string().nullish(),
count: zod.z.object({
posts: zod.z.number()
}).optional()

@@ -320,165 +252,150 @@ });

var postsAuthorSchema = baseAuthorsSchema.extend({
url: import_zod4.z.string().nullish()
url: zod.z.string().nullish()
});
var basePagesSchema = import_zod4.z.object({
var basePagesSchema = zod.z.object({
...ghostIdentitySchema.shape,
...ghostMetadataSchema.shape,
title: import_zod4.z.string(),
html: import_zod4.z.string().nullish(),
plaintext: import_zod4.z.string().nullish(),
comment_id: import_zod4.z.string().nullable(),
feature_image: import_zod4.z.string().nullable(),
feature_image_alt: import_zod4.z.string().nullable(),
feature_image_caption: import_zod4.z.string().nullable(),
featured: import_zod4.z.boolean(),
custom_excerpt: import_zod4.z.string().nullable(),
title: zod.z.string(),
html: zod.z.string().nullish(),
plaintext: zod.z.string().nullish(),
comment_id: zod.z.string().nullable(),
feature_image: zod.z.string().nullable(),
feature_image_alt: zod.z.string().nullable(),
feature_image_caption: zod.z.string().nullable(),
featured: zod.z.boolean(),
custom_excerpt: zod.z.string().nullable(),
...ghostCodeInjectionSchema.shape,
...ghostSocialMediaSchema.shape,
visibility: ghostVisibilitySchema,
custom_template: import_zod4.z.string().nullable(),
canonical_url: import_zod4.z.string().nullable(),
authors: import_zod4.z.array(postsAuthorSchema).optional(),
tags: import_zod4.z.array(baseTagsSchema).optional(),
custom_template: zod.z.string().nullable(),
canonical_url: zod.z.string().nullable(),
authors: zod.z.array(postsAuthorSchema).optional(),
tags: zod.z.array(baseTagsSchema).optional(),
primary_author: postsAuthorSchema.nullish(),
primary_tag: baseTagsSchema.nullish(),
url: import_zod4.z.string(),
excerpt: import_zod4.z.string().nullish(),
reading_time: import_zod4.z.number().optional().default(0),
created_at: import_zod4.z.string(),
updated_at: import_zod4.z.string().nullish(),
published_at: import_zod4.z.string().nullable(),
email_subject: import_zod4.z.string().nullish(),
is_page: import_zod4.z.boolean().default(true)
url: zod.z.string(),
excerpt: zod.z.string().nullish(),
reading_time: zod.z.number().optional().default(0),
created_at: zod.z.string(),
updated_at: zod.z.string().nullish(),
published_at: zod.z.string().nullable(),
email_subject: zod.z.string().nullish(),
is_page: zod.z.boolean().default(true)
});
// src/schemas/posts.ts
var import_zod5 = require("zod");
var postsAuthorSchema2 = baseAuthorsSchema.extend({
url: import_zod5.z.string().nullish()
url: zod.z.string().nullish()
});
var basePostsSchema = import_zod5.z.object({
var basePostsSchema = zod.z.object({
...ghostIdentitySchema.shape,
...ghostMetadataSchema.shape,
title: import_zod5.z.string(),
html: import_zod5.z.string().nullish(),
plaintext: import_zod5.z.string().nullish(),
comment_id: import_zod5.z.string().nullable(),
feature_image: import_zod5.z.string().nullable(),
feature_image_alt: import_zod5.z.string().nullable(),
feature_image_caption: import_zod5.z.string().nullable(),
featured: import_zod5.z.boolean(),
custom_excerpt: import_zod5.z.string().nullable(),
title: zod.z.string(),
html: zod.z.string().nullish(),
plaintext: zod.z.string().nullish(),
comment_id: zod.z.string().nullable(),
feature_image: zod.z.string().nullable(),
feature_image_alt: zod.z.string().nullable(),
feature_image_caption: zod.z.string().nullable(),
featured: zod.z.boolean(),
custom_excerpt: zod.z.string().nullable(),
...ghostCodeInjectionSchema.shape,
...ghostSocialMediaSchema.shape,
visibility: ghostVisibilitySchema,
custom_template: import_zod5.z.string().nullable(),
canonical_url: import_zod5.z.string().nullable(),
authors: import_zod5.z.array(postsAuthorSchema2).optional(),
tags: import_zod5.z.array(baseTagsSchema).optional(),
custom_template: zod.z.string().nullable(),
canonical_url: zod.z.string().nullable(),
authors: zod.z.array(postsAuthorSchema2).optional(),
tags: zod.z.array(baseTagsSchema).optional(),
primary_author: postsAuthorSchema2.nullish(),
primary_tag: baseTagsSchema.nullish(),
url: import_zod5.z.string(),
excerpt: import_zod5.z.string().nullable(),
reading_time: import_zod5.z.number().optional().default(0),
created_at: import_zod5.z.string(),
updated_at: import_zod5.z.string().nullish(),
published_at: import_zod5.z.string().nullable(),
email_subject: import_zod5.z.string().nullish(),
is_page: import_zod5.z.boolean().default(false)
url: zod.z.string(),
excerpt: zod.z.string().nullable(),
reading_time: zod.z.number().optional().default(0),
created_at: zod.z.string(),
updated_at: zod.z.string().nullish(),
published_at: zod.z.string().nullable(),
email_subject: zod.z.string().nullish(),
is_page: zod.z.boolean().default(false)
});
// src/schemas/settings.ts
var import_zod6 = require("zod");
var baseSettingsSchema = import_zod6.z.object({
title: import_zod6.z.string(),
description: import_zod6.z.string(),
logo: import_zod6.z.string().nullable(),
icon: import_zod6.z.string().nullable(),
accent_color: import_zod6.z.string().nullable(),
cover_image: import_zod6.z.string().nullable(),
facebook: import_zod6.z.string().nullable(),
twitter: import_zod6.z.string().nullable(),
lang: import_zod6.z.string(),
timezone: import_zod6.z.string(),
codeinjection_head: import_zod6.z.string().nullable(),
codeinjection_foot: import_zod6.z.string().nullable(),
navigation: import_zod6.z.array(
import_zod6.z.object({
label: import_zod6.z.string(),
url: import_zod6.z.string()
var baseSettingsSchema = zod.z.object({
title: zod.z.string(),
description: zod.z.string(),
logo: zod.z.string().nullable(),
icon: zod.z.string().nullable(),
accent_color: zod.z.string().nullable(),
cover_image: zod.z.string().nullable(),
facebook: zod.z.string().nullable(),
twitter: zod.z.string().nullable(),
lang: zod.z.string(),
timezone: zod.z.string(),
codeinjection_head: zod.z.string().nullable(),
codeinjection_foot: zod.z.string().nullable(),
navigation: zod.z.array(
zod.z.object({
label: zod.z.string(),
url: zod.z.string()
})
),
secondary_navigation: import_zod6.z.array(
import_zod6.z.object({
label: import_zod6.z.string(),
url: import_zod6.z.string()
secondary_navigation: zod.z.array(
zod.z.object({
label: zod.z.string(),
url: zod.z.string()
})
),
meta_title: import_zod6.z.string().nullable(),
meta_description: import_zod6.z.string().nullable(),
og_image: import_zod6.z.string().nullable(),
og_title: import_zod6.z.string().nullable(),
og_description: import_zod6.z.string().nullable(),
twitter_image: import_zod6.z.string().nullable(),
twitter_title: import_zod6.z.string().nullable(),
twitter_description: import_zod6.z.string().nullable(),
members_support_address: import_zod6.z.string(),
url: import_zod6.z.string()
meta_title: zod.z.string().nullable(),
meta_description: zod.z.string().nullable(),
og_image: zod.z.string().nullable(),
og_title: zod.z.string().nullable(),
og_description: zod.z.string().nullable(),
twitter_image: zod.z.string().nullable(),
twitter_title: zod.z.string().nullable(),
twitter_description: zod.z.string().nullable(),
members_support_address: zod.z.string(),
url: zod.z.string()
});
// src/schemas/tiers.ts
var import_zod7 = require("zod");
var baseTiersSchema = import_zod7.z.object({
var baseTiersSchema = zod.z.object({
...ghostIdentitySchema.shape,
name: import_zod7.z.string(),
description: import_zod7.z.string().nullable(),
active: import_zod7.z.boolean(),
type: import_zod7.z.union([import_zod7.z.literal("free"), import_zod7.z.literal("paid")]),
welcome_page_url: import_zod7.z.string().nullable(),
created_at: import_zod7.z.string(),
updated_at: import_zod7.z.string().nullable(),
stripe_prices: import_zod7.z.array(import_zod7.z.number()).optional().transform((v) => v?.length ? v : []),
monthly_price: import_zod7.z.number().nullable().optional().transform((v) => v ? v : null),
yearly_price: import_zod7.z.number().nullable().optional().transform((v) => v ? v : null),
benefits: import_zod7.z.array(import_zod7.z.string()).optional(),
name: zod.z.string(),
description: zod.z.string().nullable(),
active: zod.z.boolean(),
type: zod.z.union([zod.z.literal("free"), zod.z.literal("paid")]),
welcome_page_url: zod.z.string().nullable(),
created_at: zod.z.string(),
updated_at: zod.z.string().nullable(),
stripe_prices: zod.z.array(zod.z.number()).optional().transform((v) => v?.length ? v : []),
monthly_price: zod.z.number().nullable().optional().transform((v) => v ? v : null),
yearly_price: zod.z.number().nullable().optional().transform((v) => v ? v : null),
benefits: zod.z.array(zod.z.string()).optional(),
visibility: ghostVisibilitySchema,
currency: import_zod7.z.string().nullish(),
trial_days: import_zod7.z.number().default(0)
currency: zod.z.string().nullish(),
trial_days: zod.z.number().default(0)
});
// src/schemas/email.ts
var import_zod8 = require("zod");
var baseEmailSchema = import_zod8.z.object({
id: import_zod8.z.string(),
uuid: import_zod8.z.string(),
status: import_zod8.z.string(),
recipient_filter: import_zod8.z.string(),
error: import_zod8.z.string().nullish(),
error_data: import_zod8.z.any().nullable(),
email_count: import_zod8.z.number(),
delivered_count: import_zod8.z.number(),
opened_count: import_zod8.z.number(),
failed_count: import_zod8.z.number(),
subject: import_zod8.z.string(),
from: import_zod8.z.string(),
reply_to: import_zod8.z.string(),
html: import_zod8.z.string(),
plaintext: import_zod8.z.string(),
track_opens: import_zod8.z.boolean(),
submitted_at: import_zod8.z.string(),
created_at: import_zod8.z.string(),
updated_at: import_zod8.z.string()
var baseEmailSchema = zod.z.object({
id: zod.z.string(),
uuid: zod.z.string(),
status: zod.z.string(),
recipient_filter: zod.z.string(),
error: zod.z.string().nullish(),
error_data: zod.z.any().nullable(),
email_count: zod.z.number(),
delivered_count: zod.z.number(),
opened_count: zod.z.number(),
failed_count: zod.z.number(),
subject: zod.z.string(),
from: zod.z.string(),
reply_to: zod.z.string(),
html: zod.z.string(),
plaintext: zod.z.string(),
track_opens: zod.z.boolean(),
submitted_at: zod.z.string(),
created_at: zod.z.string(),
updated_at: zod.z.string()
});
// src/schemas/offers.ts
var import_zod9 = require("zod");
var baseOffersSchema = import_zod9.z.object({
id: import_zod9.z.string(),
name: import_zod9.z.string({ description: "Internal name for an offer, must be unique" }),
code: import_zod9.z.string({ description: "Shortcode for the offer, for example: https://yoursite.com/black-friday" }),
display_title: import_zod9.z.string({ description: "Name displayed in the offer window" }),
display_description: import_zod9.z.string({ description: "Text displayed in the offer window" }),
type: import_zod9.z.union([import_zod9.z.literal("percent"), import_zod9.z.literal("fixed"), import_zod9.z.literal("trial")]),
cadence: import_zod9.z.union([import_zod9.z.literal("month"), import_zod9.z.literal("year")]),
amount: import_zod9.z.number({
var baseOffersSchema = zod.z.object({
id: zod.z.string(),
name: zod.z.string({ description: "Internal name for an offer, must be unique" }),
code: zod.z.string({ description: "Shortcode for the offer, for example: https://yoursite.com/black-friday" }),
display_title: zod.z.string({ description: "Name displayed in the offer window" }),
display_description: zod.z.string({ description: "Text displayed in the offer window" }),
type: zod.z.union([zod.z.literal("percent"), zod.z.literal("fixed"), zod.z.literal("trial")]),
cadence: zod.z.union([zod.z.literal("month"), zod.z.literal("year")]),
amount: zod.z.number({
description: `Offer discount amount, as a percentage or fixed value as set in type.

@@ -488,18 +405,18 @@ Amount is always denoted by the smallest currency unit

}),
duration: import_zod9.z.union([import_zod9.z.literal("once"), import_zod9.z.literal("forever"), import_zod9.z.literal("repeating"), import_zod9.z.literal("trial")], {
duration: zod.z.union([zod.z.literal("once"), zod.z.literal("forever"), zod.z.literal("repeating"), zod.z.literal("trial")], {
description: "once/forever/repeating. repeating duration is only available when cadence is month"
}),
duration_in_months: import_zod9.z.number({ description: "Number of months offer should be repeated when duration is repeating" }).nullable(),
currency_restriction: import_zod9.z.boolean({
duration_in_months: zod.z.number({ description: "Number of months offer should be repeated when duration is repeating" }).nullable(),
currency_restriction: zod.z.boolean({
description: "Denotes whether the offer `currency` is restricted. If so, changing the currency invalidates the offer"
}),
currency: import_zod9.z.string({ description: "fixed type offers only - specifies tier's currency as three letter ISO currency code" }).nullable(),
status: import_zod9.z.union([import_zod9.z.literal("active"), import_zod9.z.literal("archived")], {
currency: zod.z.string({ description: "fixed type offers only - specifies tier's currency as three letter ISO currency code" }).nullable(),
status: zod.z.union([zod.z.literal("active"), zod.z.literal("archived")], {
description: "active or archived - denotes if the offer is active or archived"
}),
redemption_count: import_zod9.z.number({ description: "Number of times the offer has been redeemed" }),
tier: import_zod9.z.object(
redemption_count: zod.z.number({ description: "Number of times the offer has been redeemed" }),
tier: zod.z.object(
{
id: import_zod9.z.string(),
name: import_zod9.z.string()
id: zod.z.string(),
name: zod.z.string()
},

@@ -509,74 +426,65 @@ { description: "Tier on which offer is applied" }

});
// src/schemas/members.ts
var import_zod12 = require("zod");
// src/schemas/newsletter.ts
var import_zod10 = require("zod");
var baseNewsletterSchema = import_zod10.z.object({
var baseNewsletterSchema = zod.z.object({
...ghostIdentitySchema.shape,
name: import_zod10.z.string({ description: "Public name for the newsletter" }),
description: import_zod10.z.string({ description: "(nullable) Public description of the newsletter" }).nullish(),
sender_name: import_zod10.z.string({ description: "(nullable) The sender name of the emails" }).nullish(),
sender_email: import_zod10.z.string({ description: "(nullable) The email from which to send emails. Requires validation." }).nullish(),
sender_reply_to: import_zod10.z.string({
name: zod.z.string({ description: "Public name for the newsletter" }),
description: zod.z.string({ description: "(nullable) Public description of the newsletter" }).nullish(),
sender_name: zod.z.string({ description: "(nullable) The sender name of the emails" }).nullish(),
sender_email: zod.z.string({ description: "(nullable) The email from which to send emails. Requires validation." }).nullish(),
sender_reply_to: zod.z.string({
description: "The reply-to email address for sent emails. Can be either newsletter (= use sender_email) or support (use support email from Portal settings)."
}),
status: import_zod10.z.union([import_zod10.z.literal("active"), import_zod10.z.literal("archived")], {
status: zod.z.union([zod.z.literal("active"), zod.z.literal("archived")], {
description: "active or archived - denotes if the newsletter is active or archived"
}),
visibility: import_zod10.z.union([import_zod10.z.literal("public"), import_zod10.z.literal("members")]),
subscribe_on_signup: import_zod10.z.boolean({
visibility: zod.z.union([zod.z.literal("public"), zod.z.literal("members")]),
subscribe_on_signup: zod.z.boolean({
description: "true/false. Whether members should automatically subscribe to this newsletter on signup"
}),
sort_order: import_zod10.z.number({ description: "The order in which newsletters are displayed in the Portal" }),
header_image: import_zod10.z.string({ description: "(nullable) Path to an image to show at the top of emails. Recommended size 1200x600" }).nullish(),
show_header_icon: import_zod10.z.boolean({ description: "true/false. Show the site icon in emails" }),
show_header_title: import_zod10.z.boolean({ description: "true/false. Show the site name in emails" }),
title_font_category: import_zod10.z.union([import_zod10.z.literal("serif"), import_zod10.z.literal("sans_serif")], {
sort_order: zod.z.number({ description: "The order in which newsletters are displayed in the Portal" }),
header_image: zod.z.string({ description: "(nullable) Path to an image to show at the top of emails. Recommended size 1200x600" }).nullish(),
show_header_icon: zod.z.boolean({ description: "true/false. Show the site icon in emails" }),
show_header_title: zod.z.boolean({ description: "true/false. Show the site name in emails" }),
title_font_category: zod.z.union([zod.z.literal("serif"), zod.z.literal("sans_serif")], {
description: "Title font style. Either serif or sans_serif"
}),
title_alignment: import_zod10.z.string().nullish(),
show_feature_image: import_zod10.z.boolean({ description: "true/false. Show the post's feature image in emails" }),
body_font_category: import_zod10.z.union([import_zod10.z.literal("serif"), import_zod10.z.literal("sans_serif")], {
title_alignment: zod.z.string().nullish(),
show_feature_image: zod.z.boolean({ description: "true/false. Show the post's feature image in emails" }),
body_font_category: zod.z.union([zod.z.literal("serif"), zod.z.literal("sans_serif")], {
description: "Body font style. Either serif or sans_serif"
}),
footer_content: import_zod10.z.string({
footer_content: zod.z.string({
description: "(nullable) Extra information or legal text to show in the footer of emails. Should contain valid HTML."
}).nullish(),
show_badge: import_zod10.z.boolean({
show_badge: zod.z.boolean({
description: "true/false. Show you\u2019re a part of the indie publishing movement by adding a small Ghost badge in the footer"
}),
created_at: import_zod10.z.string(),
updated_at: import_zod10.z.string().nullish(),
show_header_name: import_zod10.z.boolean({ description: "true/false. Show the newsletter name in emails" }),
uuid: import_zod10.z.string()
created_at: zod.z.string(),
updated_at: zod.z.string().nullish(),
show_header_name: zod.z.boolean({ description: "true/false. Show the newsletter name in emails" }),
uuid: zod.z.string()
});
// src/schemas/subscriptions.ts
var import_zod11 = require("zod");
var baseSubscriptionsSchema = import_zod11.z.object({
id: import_zod11.z.string({ description: "Stripe subscription ID sub_XXXX" }),
customer: import_zod11.z.object(
var baseSubscriptionsSchema = zod.z.object({
id: zod.z.string({ description: "Stripe subscription ID sub_XXXX" }),
customer: zod.z.object(
{
id: import_zod11.z.string(),
name: import_zod11.z.string().nullable(),
email: import_zod11.z.string()
id: zod.z.string(),
name: zod.z.string().nullable(),
email: zod.z.string()
},
{ description: "Stripe customer attached to the subscription" }
),
status: import_zod11.z.string({ description: "Subscription status" }),
start_date: import_zod11.z.string({ description: "Subscription start date" }),
default_payment_card_last4: import_zod11.z.string({ description: "Last 4 digits of the card" }).nullable(),
cancel_at_period_end: import_zod11.z.boolean({ description: "If the subscription should be canceled or renewed at period end" }),
cancellation_reason: import_zod11.z.string({ description: "Reason for subscription cancellation" }).nullable(),
current_period_end: import_zod11.z.string({ description: "Subscription end date" }),
price: import_zod11.z.object({
id: import_zod11.z.string({ description: "Stripe price ID" }),
price_id: import_zod11.z.string({ description: "Ghost price ID" }),
nickname: import_zod11.z.string({ description: "Price nickname" }),
amount: import_zod11.z.number({ description: "Price amount" }),
interval: import_zod11.z.string({ description: "Price interval" }),
type: import_zod11.z.string({ description: "Price type" }),
currency: import_zod11.z.string({ description: "Price currency" })
status: zod.z.string({ description: "Subscription status" }),
start_date: zod.z.string({ description: "Subscription start date" }),
default_payment_card_last4: zod.z.string({ description: "Last 4 digits of the card" }).nullable(),
cancel_at_period_end: zod.z.boolean({ description: "If the subscription should be canceled or renewed at period end" }),
cancellation_reason: zod.z.string({ description: "Reason for subscription cancellation" }).nullable(),
current_period_end: zod.z.string({ description: "Subscription end date" }),
price: zod.z.object({
id: zod.z.string({ description: "Stripe price ID" }),
price_id: zod.z.string({ description: "Ghost price ID" }),
nickname: zod.z.string({ description: "Price nickname" }),
amount: zod.z.number({ description: "Price amount" }),
interval: zod.z.string({ description: "Price interval" }),
type: zod.z.string({ description: "Price type" }),
currency: zod.z.string({ description: "Price currency" })
}),

@@ -588,51 +496,45 @@ tier: baseTiersSchema.nullish(),

// src/schemas/members.ts
var baseMembersSchema = import_zod12.z.object({
id: import_zod12.z.string(),
email: import_zod12.z.string({ description: "The email address of the member" }),
name: import_zod12.z.string({ description: "The name of the member" }).nullable(),
note: import_zod12.z.string({ description: "(nullable) A note about the member" }).nullish(),
geolocation: import_zod12.z.string({ description: "(nullable) The geolocation of the member" }).nullish(),
created_at: import_zod12.z.string({ description: "The date and time the member was created" }),
updated_at: import_zod12.z.string({ description: "(nullable) The date and time the member was last updated" }).nullish(),
labels: import_zod12.z.array(
import_zod12.z.object({
id: import_zod12.z.string({ description: "The ID of the label" }),
name: import_zod12.z.string({ description: "The name of the label" }),
slug: import_zod12.z.string({ description: "The slug of the label" }),
created_at: import_zod12.z.string({ description: "The date and time the label was created" }),
updated_at: import_zod12.z.string({ description: "(nullable) The date and time the label was last updated" }).nullish()
var baseMembersSchema = zod.z.object({
id: zod.z.string(),
email: zod.z.string({ description: "The email address of the member" }),
name: zod.z.string({ description: "The name of the member" }).nullable(),
note: zod.z.string({ description: "(nullable) A note about the member" }).nullish(),
geolocation: zod.z.string({ description: "(nullable) The geolocation of the member" }).nullish(),
created_at: zod.z.string({ description: "The date and time the member was created" }),
updated_at: zod.z.string({ description: "(nullable) The date and time the member was last updated" }).nullish(),
labels: zod.z.array(
zod.z.object({
id: zod.z.string({ description: "The ID of the label" }),
name: zod.z.string({ description: "The name of the label" }),
slug: zod.z.string({ description: "The slug of the label" }),
created_at: zod.z.string({ description: "The date and time the label was created" }),
updated_at: zod.z.string({ description: "(nullable) The date and time the label was last updated" }).nullish()
}),
{ description: "The labels associated with the member" }
),
subscriptions: import_zod12.z.array(baseSubscriptionsSchema, { description: "The subscriptions associated with the member" }),
avatar_image: import_zod12.z.string({ description: "The URL of the member's avatar image" }),
email_count: import_zod12.z.number({ description: "The number of emails sent to the member" }),
email_opened_count: import_zod12.z.number({ description: "The number of emails opened by the member" }),
email_open_rate: import_zod12.z.number({ description: "(nullable) The open rate of the member" }).nullish(),
status: import_zod12.z.string({ description: "The status of the member" }),
last_seen_at: import_zod12.z.string({ description: "(nullable) The date and time the member was last seen" }).nullish(),
newsletters: import_zod12.z.array(baseNewsletterSchema)
subscriptions: zod.z.array(baseSubscriptionsSchema, { description: "The subscriptions associated with the member" }),
avatar_image: zod.z.string({ description: "The URL of the member's avatar image" }),
email_count: zod.z.number({ description: "The number of emails sent to the member" }),
email_opened_count: zod.z.number({ description: "The number of emails opened by the member" }),
email_open_rate: zod.z.number({ description: "(nullable) The open rate of the member" }).nullish(),
status: zod.z.string({ description: "The status of the member" }),
last_seen_at: zod.z.string({ description: "(nullable) The date and time the member was last seen" }).nullish(),
newsletters: zod.z.array(baseNewsletterSchema)
});
// src/schemas/site.ts
var import_zod13 = require("zod");
var baseSiteSchema = import_zod13.z.object({
title: import_zod13.z.string(),
description: import_zod13.z.string(),
logo: import_zod13.z.string().nullable(),
version: import_zod13.z.string(),
url: import_zod13.z.string()
var baseSiteSchema = zod.z.object({
title: zod.z.string(),
description: zod.z.string(),
logo: zod.z.string().nullable(),
version: zod.z.string(),
url: zod.z.string()
});
// src/query-builder/browse-params.ts
var import_zod14 = require("zod");
var browseParamsSchema = import_zod14.z.object({
order: import_zod14.z.string().optional(),
limit: import_zod14.z.number().refine((n) => n && n > 0 && n <= 15, {
var browseParamsSchema = zod.z.object({
order: zod.z.string().optional(),
limit: zod.z.number().refine((n) => n && n > 0 && n <= 15, {
message: "Limit must be between 1 and 15"
}).optional(),
page: import_zod14.z.number().refine((n) => n && n >= 1, {
page: zod.z.number().refine((n) => n && n >= 1, {
message: "Page must be greater than 1"
}).optional(),
filter: import_zod14.z.string().optional()
filter: zod.z.string().optional()
});

@@ -645,4 +547,4 @@ var parseBrowseParams = (args, schema, includeSchema) => {

const augmentedSchema = browseParamsSchema.merge(
import_zod14.z.object({
order: import_zod14.z.string().superRefine((val, ctx) => {
zod.z.object({
order: zod.z.string().superRefine((val, ctx) => {
const orderPredicates = val.split(",");

@@ -653,3 +555,3 @@ for (const orderPredicate of orderPredicates) {

ctx.addIssue({
code: import_zod14.z.ZodIssueCode.custom,
code: zod.z.ZodIssueCode.custom,
message: `Field "${field}" is not a valid field`,

@@ -661,3 +563,3 @@ fatal: true

ctx.addIssue({
code: import_zod14.z.ZodIssueCode.custom,
code: zod.z.ZodIssueCode.custom,
message: "Order direction must be ASC or DESC",

@@ -669,3 +571,3 @@ fatal: true

}).optional(),
filter: import_zod14.z.string().superRefine((val, ctx) => {
filter: zod.z.string().superRefine((val, ctx) => {
const filterPredicates = val.split(/[+(,]+/);

@@ -676,3 +578,3 @@ for (const filterPredicate of filterPredicates) {

ctx.addIssue({
code: import_zod14.z.ZodIssueCode.custom,
code: zod.z.ZodIssueCode.custom,
message: `Field "${field}" is not a valid field`,

@@ -693,17 +595,5 @@ fatal: true

};
// src/fetchers/browse-fetcher.ts
var import_zod15 = require("zod");
// src/fetchers/helpers.ts
var import_cross_fetch = __toESM(require("cross-fetch"));
var import_jsonwebtoken = __toESM(require("jsonwebtoken"));
function getJWT(key) {
const [id, secret] = key.split(":");
return import_jsonwebtoken.default.sign({}, Buffer.from(secret, "hex"), {
keyid: id,
algorithm: "HS256",
expiresIn: "5m",
audience: "/admin/"
});
async function getJWT(key) {
const [id, _secret] = key.split(":");
return new jose.SignJWT({}).setProtectedHeader({ kid: id, alg: "HS256" }).setExpirationTime("5m").setIssuedAt().setAudience("/admin/").sign(Uint8Array.from(_secret.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))));
}

@@ -719,6 +609,7 @@ async function _fetch(URL2, api) {

if (api.endpoint === "admin") {
headers["Authorization"] = `Ghost ${getJWT(api.key)}`;
const jwt = await getJWT(api.key);
headers["Authorization"] = `Ghost ${jwt}`;
}
try {
result = await (await (0, import_cross_fetch.default)(URL2.toString(), {
result = await (await fetch__default.default(URL2.toString(), {
headers

@@ -881,14 +772,14 @@ })).json();

_getResultSchema() {
return import_zod15.z.discriminatedUnion("status", [
import_zod15.z.object({
status: import_zod15.z.literal("success"),
return zod.z.discriminatedUnion("status", [
zod.z.object({
status: zod.z.literal("success"),
meta: ghostMetaSchema,
data: import_zod15.z.array(this.config.output)
data: zod.z.array(this.config.output)
}),
import_zod15.z.object({
status: import_zod15.z.literal("error"),
errors: import_zod15.z.array(
import_zod15.z.object({
type: import_zod15.z.string(),
message: import_zod15.z.string()
zod.z.object({
status: zod.z.literal("error"),
errors: zod.z.array(
zod.z.object({
type: zod.z.string(),
message: zod.z.string()
})

@@ -975,5 +866,2 @@ )

};
// src/fetchers/read-fetcher.ts
var import_zod16 = require("zod");
var ReadFetcher = class {

@@ -1104,13 +992,13 @@ constructor(config, _params, _api) {

async fetch() {
const res = import_zod16.z.discriminatedUnion("status", [
import_zod16.z.object({
status: import_zod16.z.literal("success"),
const res = zod.z.discriminatedUnion("status", [
zod.z.object({
status: zod.z.literal("success"),
data: this.config.output
}),
import_zod16.z.object({
status: import_zod16.z.literal("error"),
errors: import_zod16.z.array(
import_zod16.z.object({
type: import_zod16.z.string(),
message: import_zod16.z.string()
zod.z.object({
status: zod.z.literal("error"),
errors: zod.z.array(
zod.z.object({
type: zod.z.string(),
message: zod.z.string()
})

@@ -1176,5 +1064,2 @@ )

};
// src/fetchers/basic-fetcher.ts
var import_zod17 = require("zod");
var BasicFetcher = class {

@@ -1212,13 +1097,13 @@ constructor(config, _api) {

async fetch() {
const res = import_zod17.z.discriminatedUnion("status", [
import_zod17.z.object({
status: import_zod17.z.literal("success"),
const res = zod.z.discriminatedUnion("status", [
zod.z.object({
status: zod.z.literal("success"),
data: this.config.output
}),
import_zod17.z.object({
status: import_zod17.z.literal("error"),
errors: import_zod17.z.array(
import_zod17.z.object({
type: import_zod17.z.string(),
message: import_zod17.z.string()
zod.z.object({
status: zod.z.literal("error"),
errors: zod.z.array(
zod.z.object({
type: zod.z.string(),
message: zod.z.string()
})

@@ -1242,38 +1127,37 @@ )

};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BasicFetcher,
BrowseFetcher,
QueryBuilder,
ReadFetcher,
adminAPICredentialsSchema,
adminAPIEndpointsSchema,
apiVersionsSchema,
baseAuthorsSchema,
baseEmailSchema,
baseMembersSchema,
baseNewsletterSchema,
baseOffersSchema,
basePagesSchema,
basePostsSchema,
baseSettingsSchema,
baseSiteSchema,
baseTagsSchema,
baseTiersSchema,
browseParamsSchema,
contentAPICredentialsSchema,
ghostCodeInjectionSchema,
ghostExcerptSchema,
ghostFacebookSchema,
ghostIdentityInputSchema,
ghostIdentitySchema,
ghostMetaSchema,
ghostMetadataSchema,
ghostSocialMediaSchema,
ghostTwitterSchema,
ghostVisibilitySchema,
parseBrowseParams,
queryIdentitySchema,
schemaWithPickedFields
});
exports.BasicFetcher = BasicFetcher;
exports.BrowseFetcher = BrowseFetcher;
exports.QueryBuilder = QueryBuilder;
exports.ReadFetcher = ReadFetcher;
exports.adminAPICredentialsSchema = adminAPICredentialsSchema;
exports.adminAPIEndpointsSchema = adminAPIEndpointsSchema;
exports.apiVersionsSchema = apiVersionsSchema;
exports.baseAuthorsSchema = baseAuthorsSchema;
exports.baseEmailSchema = baseEmailSchema;
exports.baseMembersSchema = baseMembersSchema;
exports.baseNewsletterSchema = baseNewsletterSchema;
exports.baseOffersSchema = baseOffersSchema;
exports.basePagesSchema = basePagesSchema;
exports.basePostsSchema = basePostsSchema;
exports.baseSettingsSchema = baseSettingsSchema;
exports.baseSiteSchema = baseSiteSchema;
exports.baseTagsSchema = baseTagsSchema;
exports.baseTiersSchema = baseTiersSchema;
exports.browseParamsSchema = browseParamsSchema;
exports.contentAPICredentialsSchema = contentAPICredentialsSchema;
exports.ghostCodeInjectionSchema = ghostCodeInjectionSchema;
exports.ghostExcerptSchema = ghostExcerptSchema;
exports.ghostFacebookSchema = ghostFacebookSchema;
exports.ghostIdentityInputSchema = ghostIdentityInputSchema;
exports.ghostIdentitySchema = ghostIdentitySchema;
exports.ghostMetaSchema = ghostMetaSchema;
exports.ghostMetadataSchema = ghostMetadataSchema;
exports.ghostSocialMediaSchema = ghostSocialMediaSchema;
exports.ghostTwitterSchema = ghostTwitterSchema;
exports.ghostVisibilitySchema = ghostVisibilitySchema;
exports.parseBrowseParams = parseBrowseParams;
exports.queryIdentitySchema = queryIdentitySchema;
exports.schemaWithPickedFields = schemaWithPickedFields;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map

@@ -19,3 +19,3 @@ {

},
"version": "1.1.1",
"version": "1.1.2",
"main": "./dist/index.js",

@@ -42,3 +42,3 @@ "module": "./dist/index.mjs",

"cross-fetch": "^3.1.5",
"jsonwebtoken": "^9.0.0",
"jose": "^4.13.1",
"zod": "^3.21.4"

@@ -51,3 +51,3 @@ },

"dev": "tsup --watch",
"build": "tsup",
"build": "tsup --treeshake",
"clean": "rimraf .turbo node_modules dist",

@@ -54,0 +54,0 @@ "test": "vitest run",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc