@neopress/cli 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +300 -1
- package/dist/index.js +148 -0
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -24944,6 +24944,30 @@ function serializeHeadshot(h) {
|
|
|
24944
24944
|
updatedAt: h.updated_at
|
|
24945
24945
|
};
|
|
24946
24946
|
}
|
|
24947
|
+
function serializeLogo(l) {
|
|
24948
|
+
return {
|
|
24949
|
+
id: l.id,
|
|
24950
|
+
imageUrl: l.image_url,
|
|
24951
|
+
width: l.width,
|
|
24952
|
+
height: l.height,
|
|
24953
|
+
aspectRatio: l.aspect_ratio,
|
|
24954
|
+
mimeType: l.mime_type,
|
|
24955
|
+
byteSize: l.byte_size,
|
|
24956
|
+
type: l.type,
|
|
24957
|
+
font: l.font,
|
|
24958
|
+
color: l.color,
|
|
24959
|
+
hue: l.hue,
|
|
24960
|
+
tone: l.tone,
|
|
24961
|
+
toneScore: l.tone_score,
|
|
24962
|
+
name: l.name,
|
|
24963
|
+
variant: l.variant,
|
|
24964
|
+
sha256: l.sha256,
|
|
24965
|
+
tags: l.tags ?? [],
|
|
24966
|
+
isActive: l.is_active,
|
|
24967
|
+
createdAt: l.created_at,
|
|
24968
|
+
updatedAt: l.updated_at
|
|
24969
|
+
};
|
|
24970
|
+
}
|
|
24947
24971
|
function serializeSite(site) {
|
|
24948
24972
|
return {
|
|
24949
24973
|
id: site.id,
|
|
@@ -40785,6 +40809,128 @@ var HeadshotsEndpoint = class {
|
|
|
40785
40809
|
}
|
|
40786
40810
|
};
|
|
40787
40811
|
|
|
40812
|
+
// ../sdk/dist/endpoints/logos.js
|
|
40813
|
+
var LogosEndpoint = class {
|
|
40814
|
+
client;
|
|
40815
|
+
constructor(client) {
|
|
40816
|
+
this.client = client;
|
|
40817
|
+
}
|
|
40818
|
+
async list(params) {
|
|
40819
|
+
const { page, limit, offset } = this.client.resolvePagination(params);
|
|
40820
|
+
let query = this.client.db.from("logo_pool").select("*", { count: "exact" });
|
|
40821
|
+
if (params?.type)
|
|
40822
|
+
query = query.eq("type", params.type);
|
|
40823
|
+
if (params?.tone)
|
|
40824
|
+
query = query.eq("tone", params.tone);
|
|
40825
|
+
if (params?.font)
|
|
40826
|
+
query = query.eq("font", params.font);
|
|
40827
|
+
if (params?.hue !== void 0)
|
|
40828
|
+
query = query.eq("hue", params.hue);
|
|
40829
|
+
if (params?.isActive !== void 0)
|
|
40830
|
+
query = query.eq("is_active", params.isActive);
|
|
40831
|
+
if (params?.order) {
|
|
40832
|
+
query = query.order("created_at", { ascending: params.order === "asc" });
|
|
40833
|
+
} else {
|
|
40834
|
+
query = query.order("type", { ascending: true }).order("hue", { ascending: true }).order("name", { ascending: true });
|
|
40835
|
+
}
|
|
40836
|
+
const { data, error: error48, count } = await query.range(offset, offset + limit - 1);
|
|
40837
|
+
if (error48)
|
|
40838
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
40839
|
+
return {
|
|
40840
|
+
data: (data ?? []).map((r) => serializeLogo(r)),
|
|
40841
|
+
pagination: this.client.paginationMeta(page, limit, offset, count ?? 0)
|
|
40842
|
+
};
|
|
40843
|
+
}
|
|
40844
|
+
async get(id) {
|
|
40845
|
+
const { data, error: error48 } = await this.client.db.from("logo_pool").select("*").eq("id", id).single();
|
|
40846
|
+
if (error48)
|
|
40847
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
40848
|
+
return serializeLogo(data);
|
|
40849
|
+
}
|
|
40850
|
+
async create(params) {
|
|
40851
|
+
const values = {
|
|
40852
|
+
image_url: params.imageUrl,
|
|
40853
|
+
type: params.type,
|
|
40854
|
+
font: params.font,
|
|
40855
|
+
color: params.color,
|
|
40856
|
+
hue: params.hue,
|
|
40857
|
+
tone: params.tone,
|
|
40858
|
+
name: params.name
|
|
40859
|
+
};
|
|
40860
|
+
if (params.toneScore !== void 0)
|
|
40861
|
+
values.tone_score = params.toneScore;
|
|
40862
|
+
if (params.variant !== void 0)
|
|
40863
|
+
values.variant = params.variant;
|
|
40864
|
+
if (params.sha256 !== void 0)
|
|
40865
|
+
values.sha256 = params.sha256;
|
|
40866
|
+
if (params.width !== void 0)
|
|
40867
|
+
values.width = params.width;
|
|
40868
|
+
if (params.height !== void 0)
|
|
40869
|
+
values.height = params.height;
|
|
40870
|
+
if (params.aspectRatio !== void 0)
|
|
40871
|
+
values.aspect_ratio = params.aspectRatio;
|
|
40872
|
+
if (params.mimeType !== void 0)
|
|
40873
|
+
values.mime_type = params.mimeType;
|
|
40874
|
+
if (params.byteSize !== void 0)
|
|
40875
|
+
values.byte_size = params.byteSize;
|
|
40876
|
+
if (params.tags !== void 0)
|
|
40877
|
+
values.tags = params.tags;
|
|
40878
|
+
if (params.isActive !== void 0)
|
|
40879
|
+
values.is_active = params.isActive;
|
|
40880
|
+
const { data, error: error48 } = await this.client.db.from("logo_pool").insert(values).select().single();
|
|
40881
|
+
if (error48)
|
|
40882
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
40883
|
+
return serializeLogo(data);
|
|
40884
|
+
}
|
|
40885
|
+
async update(id, params) {
|
|
40886
|
+
const values = {};
|
|
40887
|
+
if (params.imageUrl !== void 0)
|
|
40888
|
+
values.image_url = params.imageUrl;
|
|
40889
|
+
if (params.type !== void 0)
|
|
40890
|
+
values.type = params.type;
|
|
40891
|
+
if (params.font !== void 0)
|
|
40892
|
+
values.font = params.font;
|
|
40893
|
+
if (params.color !== void 0)
|
|
40894
|
+
values.color = params.color;
|
|
40895
|
+
if (params.hue !== void 0)
|
|
40896
|
+
values.hue = params.hue;
|
|
40897
|
+
if (params.tone !== void 0)
|
|
40898
|
+
values.tone = params.tone;
|
|
40899
|
+
if (params.name !== void 0)
|
|
40900
|
+
values.name = params.name;
|
|
40901
|
+
if (params.toneScore !== void 0)
|
|
40902
|
+
values.tone_score = params.toneScore;
|
|
40903
|
+
if (params.variant !== void 0)
|
|
40904
|
+
values.variant = params.variant;
|
|
40905
|
+
if (params.sha256 !== void 0)
|
|
40906
|
+
values.sha256 = params.sha256;
|
|
40907
|
+
if (params.width !== void 0)
|
|
40908
|
+
values.width = params.width;
|
|
40909
|
+
if (params.height !== void 0)
|
|
40910
|
+
values.height = params.height;
|
|
40911
|
+
if (params.aspectRatio !== void 0)
|
|
40912
|
+
values.aspect_ratio = params.aspectRatio;
|
|
40913
|
+
if (params.mimeType !== void 0)
|
|
40914
|
+
values.mime_type = params.mimeType;
|
|
40915
|
+
if (params.byteSize !== void 0)
|
|
40916
|
+
values.byte_size = params.byteSize;
|
|
40917
|
+
if (params.tags !== void 0)
|
|
40918
|
+
values.tags = params.tags;
|
|
40919
|
+
if (params.isActive !== void 0)
|
|
40920
|
+
values.is_active = params.isActive;
|
|
40921
|
+
const { data, error: error48 } = await this.client.db.from("logo_pool").update(values).eq("id", id).select().single();
|
|
40922
|
+
if (error48)
|
|
40923
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
40924
|
+
return serializeLogo(data);
|
|
40925
|
+
}
|
|
40926
|
+
async delete(id) {
|
|
40927
|
+
const { error: error48 } = await this.client.db.from("logo_pool").delete().eq("id", id);
|
|
40928
|
+
if (error48)
|
|
40929
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
40930
|
+
return { id, deleted: true };
|
|
40931
|
+
}
|
|
40932
|
+
};
|
|
40933
|
+
|
|
40788
40934
|
// ../sdk/dist/client.js
|
|
40789
40935
|
var NeopressClient = class {
|
|
40790
40936
|
baseUrl;
|
|
@@ -40806,6 +40952,7 @@ var NeopressClient = class {
|
|
|
40806
40952
|
analytics;
|
|
40807
40953
|
templates;
|
|
40808
40954
|
headshots;
|
|
40955
|
+
logos;
|
|
40809
40956
|
constructor(options) {
|
|
40810
40957
|
this.baseUrl = (options.baseUrl || "https://app.neopress.ai").replace(/\/$/, "");
|
|
40811
40958
|
this.accessToken = options.accessToken || "";
|
|
@@ -40825,6 +40972,7 @@ var NeopressClient = class {
|
|
|
40825
40972
|
this.analytics = new AnalyticsEndpoint(this);
|
|
40826
40973
|
this.templates = new TemplatesEndpoint(this);
|
|
40827
40974
|
this.headshots = new HeadshotsEndpoint(this);
|
|
40975
|
+
this.logos = new LogosEndpoint(this);
|
|
40828
40976
|
}
|
|
40829
40977
|
get siteBasePath() {
|
|
40830
40978
|
return `/api/v1/sites/${this.siteId}`;
|
|
@@ -41974,6 +42122,156 @@ Pass at least one field. --active/--inactive toggle is_active; --tags replaces t
|
|
|
41974
42122
|
});
|
|
41975
42123
|
}
|
|
41976
42124
|
|
|
42125
|
+
// src/commands/logos.ts
|
|
42126
|
+
var TYPES = ["wordmark", "lockup", "signature"];
|
|
42127
|
+
var TONES = ["playful", "neutral", "serious"];
|
|
42128
|
+
function validateEnum2(value, allowed, flag) {
|
|
42129
|
+
if (value !== void 0 && !allowed.includes(value)) {
|
|
42130
|
+
fail(`${flag} must be one of: ${allowed.join(", ")}`);
|
|
42131
|
+
}
|
|
42132
|
+
}
|
|
42133
|
+
function parseNonNegativeInt2(raw, flag) {
|
|
42134
|
+
if (raw === void 0) return void 0;
|
|
42135
|
+
const value = Number(raw);
|
|
42136
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
42137
|
+
fail(`${flag} must be a non-negative integer`);
|
|
42138
|
+
}
|
|
42139
|
+
return value;
|
|
42140
|
+
}
|
|
42141
|
+
function parseHue(raw) {
|
|
42142
|
+
if (raw === void 0) return void 0;
|
|
42143
|
+
const value = Number(raw);
|
|
42144
|
+
if (!Number.isInteger(value) || value < 0 || value > 11) {
|
|
42145
|
+
fail("--hue must be an integer 0-11 (12-bucket hue wheel)");
|
|
42146
|
+
}
|
|
42147
|
+
return value;
|
|
42148
|
+
}
|
|
42149
|
+
function registerLogoCommands(program3) {
|
|
42150
|
+
const logos = program3.command("logos").description("Manage the shared logo pool (super-admin only)").addHelpText("after", `
|
|
42151
|
+
Examples:
|
|
42152
|
+
$ neopress logos list --type lockup --tone playful
|
|
42153
|
+
$ neopress logos create --image-url https://cdn/x.webp --type wordmark --font geometric --color '#4f46e5' --hue 8 --tone neutral --name Northwind
|
|
42154
|
+
$ neopress logos update 12 --inactive
|
|
42155
|
+
The pool is global and RLS-gated: only the super-admin account can read or write it. No active site is needed.`);
|
|
42156
|
+
logos.command("list").description("List logo pool entries").option("--type <type>", `Filter by type (${TYPES.join("/")})`).option("--tone <tone>", `Filter by tone (${TONES.join("/")})`).option("--font <font>", "Filter by font family").option("--hue <n>", "Filter by hue bucket (0-11)").option("--active", "Only active entries").option("--inactive", "Only inactive entries").option("--order <asc|desc>", ORDER_OPTION_DESC).option("--page <n>", "Page number", "1").option("--limit <n>", "Results per page", "20").addHelpText("after", `
|
|
42157
|
+
Examples:
|
|
42158
|
+
$ neopress logos list
|
|
42159
|
+
$ neopress logos list --type signature --tone serious --active
|
|
42160
|
+
Filters are equality matches on the pool's diversity axes; results are paginated.`).action(async (options) => {
|
|
42161
|
+
validateEnum2(options.type, TYPES, "--type");
|
|
42162
|
+
validateEnum2(options.tone, TONES, "--tone");
|
|
42163
|
+
if (options.active && options.inactive) {
|
|
42164
|
+
fail("Use only one of --active or --inactive.");
|
|
42165
|
+
}
|
|
42166
|
+
const hue = parseHue(options.hue);
|
|
42167
|
+
const params = {
|
|
42168
|
+
page: parseInt(options.page, 10),
|
|
42169
|
+
limit: parseInt(options.limit, 10),
|
|
42170
|
+
order: parseOrder(options.order),
|
|
42171
|
+
type: options.type,
|
|
42172
|
+
tone: options.tone,
|
|
42173
|
+
font: options.font
|
|
42174
|
+
};
|
|
42175
|
+
if (hue !== void 0) params.hue = hue;
|
|
42176
|
+
if (options.active) params.isActive = true;
|
|
42177
|
+
else if (options.inactive) params.isActive = false;
|
|
42178
|
+
const client = await getGlobalClientAsync();
|
|
42179
|
+
const res = await client.logos.list(params);
|
|
42180
|
+
output(res);
|
|
42181
|
+
});
|
|
42182
|
+
logos.command("get <id>").description("Get a logo pool entry").action(async (id) => {
|
|
42183
|
+
const client = await getGlobalClientAsync();
|
|
42184
|
+
const data = await client.logos.get(parseInt(id, 10));
|
|
42185
|
+
output(data);
|
|
42186
|
+
});
|
|
42187
|
+
logos.command("create").description("Add a logo to the pool").requiredOption("--image-url <url>", "Public image URL").requiredOption("--type <type>", `Type (${TYPES.join("/")})`).requiredOption("--font <font>", "Font family, e.g. geometric").requiredOption("--color <hex>", "Brand ink hex, e.g. #4f46e5").requiredOption("--hue <n>", "Hue bucket (0-11)").requiredOption("--tone <tone>", `Tone (${TONES.join("/")})`).requiredOption("--name <name>", "Fictional brand name").option("--tone-score <n>", "Authored tone score (provenance)").option("--variant <variant>", "Variant descriptor, e.g. lk-mark7-left-duo").option("--sha256 <hash>", "Content hash").option("--width <n>", "Image width in px").option("--height <n>", "Image height in px").option("--aspect-ratio <ratio>", "Aspect ratio, e.g. 4:1").option("--mime-type <type>", "MIME type, e.g. image/webp").option("--byte-size <n>", "File size in bytes").option("--tags <csv>", "Comma-separated tags").option("--inactive", "Create as inactive (default active)").addHelpText("after", `
|
|
42188
|
+
Examples:
|
|
42189
|
+
$ neopress logos create --image-url https://cdn/a.webp --type lockup --font grotesk --color '#0d9488' --hue 5 --tone neutral --name Kestrel
|
|
42190
|
+
image_url is unique. The DB rejects out-of-range type/tone/hue values.`).action(async (options) => {
|
|
42191
|
+
validateEnum2(options.type, TYPES, "--type");
|
|
42192
|
+
validateEnum2(options.tone, TONES, "--tone");
|
|
42193
|
+
const hue = parseHue(options.hue);
|
|
42194
|
+
const params = {
|
|
42195
|
+
imageUrl: options.imageUrl,
|
|
42196
|
+
type: options.type,
|
|
42197
|
+
font: options.font,
|
|
42198
|
+
color: options.color,
|
|
42199
|
+
hue,
|
|
42200
|
+
tone: options.tone,
|
|
42201
|
+
name: options.name
|
|
42202
|
+
};
|
|
42203
|
+
if (options.toneScore !== void 0) {
|
|
42204
|
+
const n = Number(options.toneScore);
|
|
42205
|
+
if (Number.isNaN(n)) fail("--tone-score must be a number");
|
|
42206
|
+
params.toneScore = n;
|
|
42207
|
+
}
|
|
42208
|
+
if (options.variant) params.variant = options.variant;
|
|
42209
|
+
if (options.sha256) params.sha256 = options.sha256;
|
|
42210
|
+
const width = parseNonNegativeInt2(options.width, "--width");
|
|
42211
|
+
if (width !== void 0) params.width = width;
|
|
42212
|
+
const height = parseNonNegativeInt2(options.height, "--height");
|
|
42213
|
+
if (height !== void 0) params.height = height;
|
|
42214
|
+
if (options.aspectRatio) params.aspectRatio = options.aspectRatio;
|
|
42215
|
+
if (options.mimeType) params.mimeType = options.mimeType;
|
|
42216
|
+
const byteSize = parseNonNegativeInt2(options.byteSize, "--byte-size");
|
|
42217
|
+
if (byteSize !== void 0) params.byteSize = byteSize;
|
|
42218
|
+
if (options.tags) params.tags = String(options.tags).split(",").map((t) => t.trim()).filter(Boolean);
|
|
42219
|
+
if (options.inactive) params.isActive = false;
|
|
42220
|
+
const client = await getGlobalClientAsync();
|
|
42221
|
+
const data = await client.logos.create(params);
|
|
42222
|
+
output(data);
|
|
42223
|
+
});
|
|
42224
|
+
logos.command("update <id>").description("Update a logo pool entry").option("--image-url <url>", "Public image URL").option("--type <type>", `Type (${TYPES.join("/")})`).option("--font <font>", "Font family").option("--color <hex>", "Brand ink hex").option("--hue <n>", "Hue bucket (0-11)").option("--tone <tone>", `Tone (${TONES.join("/")})`).option("--name <name>", "Fictional brand name").option("--tone-score <n>", "Authored tone score").option("--variant <variant>", "Variant descriptor").option("--sha256 <hash>", "Content hash").option("--width <n>", "Image width in px").option("--height <n>", "Image height in px").option("--aspect-ratio <ratio>", "Aspect ratio, e.g. 4:1").option("--mime-type <type>", "MIME type, e.g. image/webp").option("--byte-size <n>", "File size in bytes").option("--tags <csv>", "Comma-separated tags (replaces existing)").option("--active", "Mark active").option("--inactive", "Mark inactive").addHelpText("after", `
|
|
42225
|
+
Examples:
|
|
42226
|
+
$ neopress logos update 12 --inactive
|
|
42227
|
+
$ neopress logos update 12 --tone playful --tags studio,flat
|
|
42228
|
+
Pass at least one field. --active/--inactive toggle is_active; --tags replaces the tag list.`).action(async (id, options) => {
|
|
42229
|
+
validateEnum2(options.type, TYPES, "--type");
|
|
42230
|
+
validateEnum2(options.tone, TONES, "--tone");
|
|
42231
|
+
if (options.active && options.inactive) {
|
|
42232
|
+
fail("Use only one of --active or --inactive.");
|
|
42233
|
+
}
|
|
42234
|
+
const params = {};
|
|
42235
|
+
if (options.imageUrl) params.imageUrl = options.imageUrl;
|
|
42236
|
+
if (options.type) params.type = options.type;
|
|
42237
|
+
if (options.font) params.font = options.font;
|
|
42238
|
+
if (options.color) params.color = options.color;
|
|
42239
|
+
const hue = parseHue(options.hue);
|
|
42240
|
+
if (hue !== void 0) params.hue = hue;
|
|
42241
|
+
if (options.tone) params.tone = options.tone;
|
|
42242
|
+
if (options.name) params.name = options.name;
|
|
42243
|
+
if (options.toneScore !== void 0) {
|
|
42244
|
+
const n = Number(options.toneScore);
|
|
42245
|
+
if (Number.isNaN(n)) fail("--tone-score must be a number");
|
|
42246
|
+
params.toneScore = n;
|
|
42247
|
+
}
|
|
42248
|
+
if (options.variant) params.variant = options.variant;
|
|
42249
|
+
if (options.sha256) params.sha256 = options.sha256;
|
|
42250
|
+
const width = parseNonNegativeInt2(options.width, "--width");
|
|
42251
|
+
if (width !== void 0) params.width = width;
|
|
42252
|
+
const height = parseNonNegativeInt2(options.height, "--height");
|
|
42253
|
+
if (height !== void 0) params.height = height;
|
|
42254
|
+
if (options.aspectRatio) params.aspectRatio = options.aspectRatio;
|
|
42255
|
+
if (options.mimeType) params.mimeType = options.mimeType;
|
|
42256
|
+
const byteSize = parseNonNegativeInt2(options.byteSize, "--byte-size");
|
|
42257
|
+
if (byteSize !== void 0) params.byteSize = byteSize;
|
|
42258
|
+
if (options.tags) params.tags = String(options.tags).split(",").map((t) => t.trim()).filter(Boolean);
|
|
42259
|
+
if (options.active) params.isActive = true;
|
|
42260
|
+
else if (options.inactive) params.isActive = false;
|
|
42261
|
+
if (Object.keys(params).length === 0) {
|
|
42262
|
+
fail("No fields to update.");
|
|
42263
|
+
}
|
|
42264
|
+
const client = await getGlobalClientAsync();
|
|
42265
|
+
const data = await client.logos.update(parseInt(id, 10), params);
|
|
42266
|
+
output(data);
|
|
42267
|
+
});
|
|
42268
|
+
logos.command("delete <id>").description("Delete a logo pool entry (hard delete)").action(async (id) => {
|
|
42269
|
+
const client = await getGlobalClientAsync();
|
|
42270
|
+
await client.logos.delete(parseInt(id, 10));
|
|
42271
|
+
ok(`Logo ${id} deleted`);
|
|
42272
|
+
});
|
|
42273
|
+
}
|
|
42274
|
+
|
|
41977
42275
|
// src/commands/guide.ts
|
|
41978
42276
|
function describeOption(opt) {
|
|
41979
42277
|
const info = { flags: opt.flags, description: opt.description || "" };
|
|
@@ -42058,7 +42356,7 @@ function registerGuideCommands(program3) {
|
|
|
42058
42356
|
|
|
42059
42357
|
// src/bin.ts
|
|
42060
42358
|
var program2 = new Command();
|
|
42061
|
-
program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("4.
|
|
42359
|
+
program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("4.5.0").option("--json", "Output in JSON format (for AI tools and pipes)").option("--site <idOrHandle>", "Target a specific site (overrides active site; not persisted)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
|
|
42062
42360
|
const opts = thisCommand.optsWithGlobals();
|
|
42063
42361
|
if (opts.site) setSiteOverride(String(opts.site));
|
|
42064
42362
|
if (opts.json || !process.stdout.isTTY) setJsonMode(true);
|
|
@@ -42077,6 +42375,7 @@ registerEntryReferenceCommands(program2);
|
|
|
42077
42375
|
registerAnalyticsCommands(program2);
|
|
42078
42376
|
registerTemplateCommands(program2);
|
|
42079
42377
|
registerHeadshotCommands(program2);
|
|
42378
|
+
registerLogoCommands(program2);
|
|
42080
42379
|
registerGuideCommands(program2);
|
|
42081
42380
|
program2.addHelpText(
|
|
42082
42381
|
"after",
|
package/dist/index.js
CHANGED
|
@@ -21166,6 +21166,30 @@ function serializeHeadshot(h) {
|
|
|
21166
21166
|
updatedAt: h.updated_at
|
|
21167
21167
|
};
|
|
21168
21168
|
}
|
|
21169
|
+
function serializeLogo(l) {
|
|
21170
|
+
return {
|
|
21171
|
+
id: l.id,
|
|
21172
|
+
imageUrl: l.image_url,
|
|
21173
|
+
width: l.width,
|
|
21174
|
+
height: l.height,
|
|
21175
|
+
aspectRatio: l.aspect_ratio,
|
|
21176
|
+
mimeType: l.mime_type,
|
|
21177
|
+
byteSize: l.byte_size,
|
|
21178
|
+
type: l.type,
|
|
21179
|
+
font: l.font,
|
|
21180
|
+
color: l.color,
|
|
21181
|
+
hue: l.hue,
|
|
21182
|
+
tone: l.tone,
|
|
21183
|
+
toneScore: l.tone_score,
|
|
21184
|
+
name: l.name,
|
|
21185
|
+
variant: l.variant,
|
|
21186
|
+
sha256: l.sha256,
|
|
21187
|
+
tags: l.tags ?? [],
|
|
21188
|
+
isActive: l.is_active,
|
|
21189
|
+
createdAt: l.created_at,
|
|
21190
|
+
updatedAt: l.updated_at
|
|
21191
|
+
};
|
|
21192
|
+
}
|
|
21169
21193
|
function serializeSite(site) {
|
|
21170
21194
|
return {
|
|
21171
21195
|
id: site.id,
|
|
@@ -37007,6 +37031,128 @@ var HeadshotsEndpoint = class {
|
|
|
37007
37031
|
}
|
|
37008
37032
|
};
|
|
37009
37033
|
|
|
37034
|
+
// ../sdk/dist/endpoints/logos.js
|
|
37035
|
+
var LogosEndpoint = class {
|
|
37036
|
+
client;
|
|
37037
|
+
constructor(client) {
|
|
37038
|
+
this.client = client;
|
|
37039
|
+
}
|
|
37040
|
+
async list(params) {
|
|
37041
|
+
const { page, limit, offset } = this.client.resolvePagination(params);
|
|
37042
|
+
let query = this.client.db.from("logo_pool").select("*", { count: "exact" });
|
|
37043
|
+
if (params?.type)
|
|
37044
|
+
query = query.eq("type", params.type);
|
|
37045
|
+
if (params?.tone)
|
|
37046
|
+
query = query.eq("tone", params.tone);
|
|
37047
|
+
if (params?.font)
|
|
37048
|
+
query = query.eq("font", params.font);
|
|
37049
|
+
if (params?.hue !== void 0)
|
|
37050
|
+
query = query.eq("hue", params.hue);
|
|
37051
|
+
if (params?.isActive !== void 0)
|
|
37052
|
+
query = query.eq("is_active", params.isActive);
|
|
37053
|
+
if (params?.order) {
|
|
37054
|
+
query = query.order("created_at", { ascending: params.order === "asc" });
|
|
37055
|
+
} else {
|
|
37056
|
+
query = query.order("type", { ascending: true }).order("hue", { ascending: true }).order("name", { ascending: true });
|
|
37057
|
+
}
|
|
37058
|
+
const { data, error: error48, count } = await query.range(offset, offset + limit - 1);
|
|
37059
|
+
if (error48)
|
|
37060
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
37061
|
+
return {
|
|
37062
|
+
data: (data ?? []).map((r) => serializeLogo(r)),
|
|
37063
|
+
pagination: this.client.paginationMeta(page, limit, offset, count ?? 0)
|
|
37064
|
+
};
|
|
37065
|
+
}
|
|
37066
|
+
async get(id) {
|
|
37067
|
+
const { data, error: error48 } = await this.client.db.from("logo_pool").select("*").eq("id", id).single();
|
|
37068
|
+
if (error48)
|
|
37069
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
37070
|
+
return serializeLogo(data);
|
|
37071
|
+
}
|
|
37072
|
+
async create(params) {
|
|
37073
|
+
const values = {
|
|
37074
|
+
image_url: params.imageUrl,
|
|
37075
|
+
type: params.type,
|
|
37076
|
+
font: params.font,
|
|
37077
|
+
color: params.color,
|
|
37078
|
+
hue: params.hue,
|
|
37079
|
+
tone: params.tone,
|
|
37080
|
+
name: params.name
|
|
37081
|
+
};
|
|
37082
|
+
if (params.toneScore !== void 0)
|
|
37083
|
+
values.tone_score = params.toneScore;
|
|
37084
|
+
if (params.variant !== void 0)
|
|
37085
|
+
values.variant = params.variant;
|
|
37086
|
+
if (params.sha256 !== void 0)
|
|
37087
|
+
values.sha256 = params.sha256;
|
|
37088
|
+
if (params.width !== void 0)
|
|
37089
|
+
values.width = params.width;
|
|
37090
|
+
if (params.height !== void 0)
|
|
37091
|
+
values.height = params.height;
|
|
37092
|
+
if (params.aspectRatio !== void 0)
|
|
37093
|
+
values.aspect_ratio = params.aspectRatio;
|
|
37094
|
+
if (params.mimeType !== void 0)
|
|
37095
|
+
values.mime_type = params.mimeType;
|
|
37096
|
+
if (params.byteSize !== void 0)
|
|
37097
|
+
values.byte_size = params.byteSize;
|
|
37098
|
+
if (params.tags !== void 0)
|
|
37099
|
+
values.tags = params.tags;
|
|
37100
|
+
if (params.isActive !== void 0)
|
|
37101
|
+
values.is_active = params.isActive;
|
|
37102
|
+
const { data, error: error48 } = await this.client.db.from("logo_pool").insert(values).select().single();
|
|
37103
|
+
if (error48)
|
|
37104
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
37105
|
+
return serializeLogo(data);
|
|
37106
|
+
}
|
|
37107
|
+
async update(id, params) {
|
|
37108
|
+
const values = {};
|
|
37109
|
+
if (params.imageUrl !== void 0)
|
|
37110
|
+
values.image_url = params.imageUrl;
|
|
37111
|
+
if (params.type !== void 0)
|
|
37112
|
+
values.type = params.type;
|
|
37113
|
+
if (params.font !== void 0)
|
|
37114
|
+
values.font = params.font;
|
|
37115
|
+
if (params.color !== void 0)
|
|
37116
|
+
values.color = params.color;
|
|
37117
|
+
if (params.hue !== void 0)
|
|
37118
|
+
values.hue = params.hue;
|
|
37119
|
+
if (params.tone !== void 0)
|
|
37120
|
+
values.tone = params.tone;
|
|
37121
|
+
if (params.name !== void 0)
|
|
37122
|
+
values.name = params.name;
|
|
37123
|
+
if (params.toneScore !== void 0)
|
|
37124
|
+
values.tone_score = params.toneScore;
|
|
37125
|
+
if (params.variant !== void 0)
|
|
37126
|
+
values.variant = params.variant;
|
|
37127
|
+
if (params.sha256 !== void 0)
|
|
37128
|
+
values.sha256 = params.sha256;
|
|
37129
|
+
if (params.width !== void 0)
|
|
37130
|
+
values.width = params.width;
|
|
37131
|
+
if (params.height !== void 0)
|
|
37132
|
+
values.height = params.height;
|
|
37133
|
+
if (params.aspectRatio !== void 0)
|
|
37134
|
+
values.aspect_ratio = params.aspectRatio;
|
|
37135
|
+
if (params.mimeType !== void 0)
|
|
37136
|
+
values.mime_type = params.mimeType;
|
|
37137
|
+
if (params.byteSize !== void 0)
|
|
37138
|
+
values.byte_size = params.byteSize;
|
|
37139
|
+
if (params.tags !== void 0)
|
|
37140
|
+
values.tags = params.tags;
|
|
37141
|
+
if (params.isActive !== void 0)
|
|
37142
|
+
values.is_active = params.isActive;
|
|
37143
|
+
const { data, error: error48 } = await this.client.db.from("logo_pool").update(values).eq("id", id).select().single();
|
|
37144
|
+
if (error48)
|
|
37145
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
37146
|
+
return serializeLogo(data);
|
|
37147
|
+
}
|
|
37148
|
+
async delete(id) {
|
|
37149
|
+
const { error: error48 } = await this.client.db.from("logo_pool").delete().eq("id", id);
|
|
37150
|
+
if (error48)
|
|
37151
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
37152
|
+
return { id, deleted: true };
|
|
37153
|
+
}
|
|
37154
|
+
};
|
|
37155
|
+
|
|
37010
37156
|
// ../sdk/dist/client.js
|
|
37011
37157
|
var NeopressClient = class {
|
|
37012
37158
|
baseUrl;
|
|
@@ -37028,6 +37174,7 @@ var NeopressClient = class {
|
|
|
37028
37174
|
analytics;
|
|
37029
37175
|
templates;
|
|
37030
37176
|
headshots;
|
|
37177
|
+
logos;
|
|
37031
37178
|
constructor(options) {
|
|
37032
37179
|
this.baseUrl = (options.baseUrl || "https://app.neopress.ai").replace(/\/$/, "");
|
|
37033
37180
|
this.accessToken = options.accessToken || "";
|
|
@@ -37047,6 +37194,7 @@ var NeopressClient = class {
|
|
|
37047
37194
|
this.analytics = new AnalyticsEndpoint(this);
|
|
37048
37195
|
this.templates = new TemplatesEndpoint(this);
|
|
37049
37196
|
this.headshots = new HeadshotsEndpoint(this);
|
|
37197
|
+
this.logos = new LogosEndpoint(this);
|
|
37050
37198
|
}
|
|
37051
37199
|
get siteBasePath() {
|
|
37052
37200
|
return `/api/v1/sites/${this.siteId}`;
|