@idelio/contracts 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/api-keys.d.ts +44 -0
- package/dist/api-keys.js +19 -0
- package/dist/assets.d.ts +188 -0
- package/dist/assets.js +107 -0
- package/dist/billing.d.ts +94 -0
- package/dist/billing.js +67 -0
- package/dist/brands.d.ts +641 -0
- package/dist/brands.js +364 -0
- package/dist/catalog.d.ts +26 -0
- package/dist/catalog.js +53 -0
- package/dist/consent.d.ts +60 -0
- package/dist/consent.js +65 -0
- package/dist/creative-direction.d.ts +333 -0
- package/dist/creative-direction.js +681 -0
- package/dist/credits.d.ts +38 -0
- package/dist/credits.js +31 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.js +22 -0
- package/dist/events.d.ts +20 -0
- package/dist/events.js +29 -0
- package/dist/ids.d.ts +28 -0
- package/dist/ids.js +29 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/jobs.d.ts +100 -0
- package/dist/jobs.js +81 -0
- package/dist/me.d.ts +77 -0
- package/dist/me.js +45 -0
- package/dist/notifications.d.ts +17 -0
- package/dist/notifications.js +26 -0
- package/dist/pricing.d.ts +38 -0
- package/dist/pricing.js +105 -0
- package/dist/rate-limits.d.ts +8 -0
- package/dist/rate-limits.js +18 -0
- package/dist/usage.d.ts +22 -0
- package/dist/usage.js +11 -0
- package/dist/waitlist.d.ts +34 -0
- package/dist/waitlist.js +27 -0
- package/dist/webhooks.d.ts +74 -0
- package/dist/webhooks.js +26 -0
- package/openapi/openapi.yaml +3026 -0
- package/package.json +54 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ledgerReasons: readonly ["grant", "purchase", "reserve", "settle", "refund", "clawback"];
|
|
3
|
+
export declare const ledgerEntrySchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
job_id: z.ZodNullable<z.ZodString>;
|
|
7
|
+
delta: z.ZodNumber;
|
|
8
|
+
reason: z.ZodEnum<{
|
|
9
|
+
grant: "grant";
|
|
10
|
+
purchase: "purchase";
|
|
11
|
+
reserve: "reserve";
|
|
12
|
+
settle: "settle";
|
|
13
|
+
refund: "refund";
|
|
14
|
+
clawback: "clawback";
|
|
15
|
+
}>;
|
|
16
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
17
|
+
balance_after: z.ZodNumber;
|
|
18
|
+
created_at: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const creditBalanceSchema: z.ZodObject<{
|
|
21
|
+
balance: z.ZodNumber;
|
|
22
|
+
plan: z.ZodEnum<{
|
|
23
|
+
studio: "studio";
|
|
24
|
+
free: "free";
|
|
25
|
+
pro: "pro";
|
|
26
|
+
agency: "agency";
|
|
27
|
+
}>;
|
|
28
|
+
monthly_allowance: z.ZodNumber;
|
|
29
|
+
renews_at: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const planAllowances: {
|
|
32
|
+
readonly free: 25;
|
|
33
|
+
readonly pro: 250;
|
|
34
|
+
readonly studio: 750;
|
|
35
|
+
readonly agency: 1400;
|
|
36
|
+
};
|
|
37
|
+
export type LedgerEntry = z.infer<typeof ledgerEntrySchema>;
|
|
38
|
+
export type CreditBalance = z.infer<typeof creditBalanceSchema>;
|
package/dist/credits.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ledgerReasons = [
|
|
3
|
+
"grant",
|
|
4
|
+
"purchase",
|
|
5
|
+
"reserve",
|
|
6
|
+
"settle",
|
|
7
|
+
"refund",
|
|
8
|
+
"clawback",
|
|
9
|
+
];
|
|
10
|
+
export const ledgerEntrySchema = z.object({
|
|
11
|
+
id: z.string(),
|
|
12
|
+
workspace_id: z.string().optional(),
|
|
13
|
+
job_id: z.string().nullable(),
|
|
14
|
+
delta: z.number().int(),
|
|
15
|
+
reason: z.enum(ledgerReasons),
|
|
16
|
+
idempotency_key: z.string().optional(),
|
|
17
|
+
balance_after: z.number().int(),
|
|
18
|
+
created_at: z.string().datetime(),
|
|
19
|
+
});
|
|
20
|
+
export const creditBalanceSchema = z.object({
|
|
21
|
+
balance: z.number().int(),
|
|
22
|
+
plan: z.enum(["free", "pro", "studio", "agency"]),
|
|
23
|
+
monthly_allowance: z.number().int(),
|
|
24
|
+
renews_at: z.string().datetime().nullable(),
|
|
25
|
+
});
|
|
26
|
+
export const planAllowances = {
|
|
27
|
+
free: 25,
|
|
28
|
+
pro: 250,
|
|
29
|
+
studio: 750,
|
|
30
|
+
agency: 1400,
|
|
31
|
+
};
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const errorTypes: readonly ["invalid_request_error", "authentication_error", "permission_error", "not_found_error", "conflict_error", "payment_error", "rate_limit_error", "api_error"];
|
|
3
|
+
export declare const errorEnvelopeSchema: z.ZodObject<{
|
|
4
|
+
error: z.ZodObject<{
|
|
5
|
+
type: z.ZodEnum<{
|
|
6
|
+
invalid_request_error: "invalid_request_error";
|
|
7
|
+
authentication_error: "authentication_error";
|
|
8
|
+
permission_error: "permission_error";
|
|
9
|
+
not_found_error: "not_found_error";
|
|
10
|
+
conflict_error: "conflict_error";
|
|
11
|
+
payment_error: "payment_error";
|
|
12
|
+
rate_limit_error: "rate_limit_error";
|
|
13
|
+
api_error: "api_error";
|
|
14
|
+
}>;
|
|
15
|
+
code: z.ZodString;
|
|
16
|
+
message: z.ZodString;
|
|
17
|
+
param: z.ZodOptional<z.ZodString>;
|
|
18
|
+
request_id: z.ZodString;
|
|
19
|
+
docs_url: z.ZodOptional<z.ZodString>;
|
|
20
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
param: z.ZodString;
|
|
22
|
+
message: z.ZodString;
|
|
23
|
+
}, z.core.$strip>>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type ErrorEnvelope = z.infer<typeof errorEnvelopeSchema>;
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const errorTypes = [
|
|
3
|
+
"invalid_request_error",
|
|
4
|
+
"authentication_error",
|
|
5
|
+
"permission_error",
|
|
6
|
+
"not_found_error",
|
|
7
|
+
"conflict_error",
|
|
8
|
+
"payment_error",
|
|
9
|
+
"rate_limit_error",
|
|
10
|
+
"api_error",
|
|
11
|
+
];
|
|
12
|
+
export const errorEnvelopeSchema = z.object({
|
|
13
|
+
error: z.object({
|
|
14
|
+
type: z.enum(errorTypes),
|
|
15
|
+
code: z.string(),
|
|
16
|
+
message: z.string(),
|
|
17
|
+
param: z.string().optional(),
|
|
18
|
+
request_id: z.string(),
|
|
19
|
+
docs_url: z.string().url().optional(),
|
|
20
|
+
errors: z.array(z.object({ param: z.string(), message: z.string() })).optional(),
|
|
21
|
+
}),
|
|
22
|
+
});
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const webhookEventTypes: readonly ["brand.completed", "brand.updated", "asset.ready", "asset.regenerated", "job.failed", "credits.low", "credits.settled", "subscription.changed"];
|
|
3
|
+
export declare const webhookEnvelopeSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
type: z.ZodEnum<{
|
|
6
|
+
"brand.completed": "brand.completed";
|
|
7
|
+
"brand.updated": "brand.updated";
|
|
8
|
+
"asset.ready": "asset.ready";
|
|
9
|
+
"asset.regenerated": "asset.regenerated";
|
|
10
|
+
"job.failed": "job.failed";
|
|
11
|
+
"credits.low": "credits.low";
|
|
12
|
+
"credits.settled": "credits.settled";
|
|
13
|
+
"subscription.changed": "subscription.changed";
|
|
14
|
+
}>;
|
|
15
|
+
created_at: z.ZodString;
|
|
16
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const sseEventTypes: readonly ["job.step.started", "job.step.completed", "asset.ready", "asset.failed", "asset.insufficient_credits", "asset.retrying", "assets.pending_retry", "job.completed", "job.completed_with_errors", "job.failed"];
|
|
19
|
+
export type WebhookEventType = (typeof webhookEventTypes)[number];
|
|
20
|
+
export type SseEventType = (typeof sseEventTypes)[number];
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const webhookEventTypes = [
|
|
3
|
+
"brand.completed",
|
|
4
|
+
"brand.updated",
|
|
5
|
+
"asset.ready",
|
|
6
|
+
"asset.regenerated",
|
|
7
|
+
"job.failed",
|
|
8
|
+
"credits.low",
|
|
9
|
+
"credits.settled",
|
|
10
|
+
"subscription.changed",
|
|
11
|
+
];
|
|
12
|
+
export const webhookEnvelopeSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
type: z.enum(webhookEventTypes),
|
|
15
|
+
created_at: z.string().datetime(),
|
|
16
|
+
data: z.record(z.string(), z.unknown()),
|
|
17
|
+
});
|
|
18
|
+
export const sseEventTypes = [
|
|
19
|
+
"job.step.started",
|
|
20
|
+
"job.step.completed",
|
|
21
|
+
"asset.ready",
|
|
22
|
+
"asset.failed",
|
|
23
|
+
"asset.insufficient_credits",
|
|
24
|
+
"asset.retrying",
|
|
25
|
+
"assets.pending_retry",
|
|
26
|
+
"job.completed",
|
|
27
|
+
"job.completed_with_errors",
|
|
28
|
+
"job.failed",
|
|
29
|
+
];
|
package/dist/ids.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const idPrefixes: {
|
|
3
|
+
readonly workspace: "ws";
|
|
4
|
+
readonly user: "user";
|
|
5
|
+
readonly brand: "brand";
|
|
6
|
+
readonly brandVersion: "bv";
|
|
7
|
+
readonly asset: "asset";
|
|
8
|
+
readonly assetVersion: "av";
|
|
9
|
+
readonly job: "job";
|
|
10
|
+
readonly apiKey: "key";
|
|
11
|
+
readonly creditLedgerEntry: "led";
|
|
12
|
+
readonly webhookEndpoint: "whe";
|
|
13
|
+
readonly webhookDelivery: "whd";
|
|
14
|
+
readonly event: "evt";
|
|
15
|
+
readonly usageEvent: "evtu";
|
|
16
|
+
readonly notification: "ntf";
|
|
17
|
+
readonly waitlistSignup: "wl";
|
|
18
|
+
readonly designToken: "dt";
|
|
19
|
+
readonly template: "tpl";
|
|
20
|
+
readonly consentRecord: "consent";
|
|
21
|
+
readonly brandSuggestionBatch: "sug";
|
|
22
|
+
readonly billingIdempotencyKey: "bik";
|
|
23
|
+
readonly checkoutSession: "chk";
|
|
24
|
+
readonly jobAsset: "asset_job";
|
|
25
|
+
readonly request: "req";
|
|
26
|
+
};
|
|
27
|
+
export type IdPrefix = (typeof idPrefixes)[keyof typeof idPrefixes];
|
|
28
|
+
export declare const prefixedId: (prefix: IdPrefix) => z.ZodString;
|
package/dist/ids.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const idPrefixes = {
|
|
3
|
+
workspace: "ws",
|
|
4
|
+
user: "user",
|
|
5
|
+
brand: "brand",
|
|
6
|
+
brandVersion: "bv",
|
|
7
|
+
asset: "asset",
|
|
8
|
+
assetVersion: "av",
|
|
9
|
+
job: "job",
|
|
10
|
+
apiKey: "key",
|
|
11
|
+
creditLedgerEntry: "led",
|
|
12
|
+
webhookEndpoint: "whe",
|
|
13
|
+
webhookDelivery: "whd",
|
|
14
|
+
event: "evt",
|
|
15
|
+
usageEvent: "evtu",
|
|
16
|
+
notification: "ntf",
|
|
17
|
+
waitlistSignup: "wl",
|
|
18
|
+
designToken: "dt",
|
|
19
|
+
template: "tpl",
|
|
20
|
+
consentRecord: "consent",
|
|
21
|
+
brandSuggestionBatch: "sug",
|
|
22
|
+
billingIdempotencyKey: "bik",
|
|
23
|
+
checkoutSession: "chk",
|
|
24
|
+
jobAsset: "asset_job",
|
|
25
|
+
request: "req",
|
|
26
|
+
};
|
|
27
|
+
export const prefixedId = (prefix) => z.string().regex(new RegExp(`^${prefix}_[a-zA-Z0-9]{8,}$`), {
|
|
28
|
+
message: `expected an id prefixed with "${prefix}_"`,
|
|
29
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "./api-keys.js";
|
|
2
|
+
export * from "./assets.js";
|
|
3
|
+
export * from "./billing.js";
|
|
4
|
+
export * from "./brands.js";
|
|
5
|
+
export * from "./catalog.js";
|
|
6
|
+
export * from "./consent.js";
|
|
7
|
+
export * from "./creative-direction.js";
|
|
8
|
+
export * from "./credits.js";
|
|
9
|
+
export * from "./errors.js";
|
|
10
|
+
export * from "./events.js";
|
|
11
|
+
export * from "./ids.js";
|
|
12
|
+
export * from "./jobs.js";
|
|
13
|
+
export * from "./me.js";
|
|
14
|
+
export * from "./notifications.js";
|
|
15
|
+
export * from "./pricing.js";
|
|
16
|
+
export * from "./rate-limits.js";
|
|
17
|
+
export * from "./usage.js";
|
|
18
|
+
export * from "./waitlist.js";
|
|
19
|
+
export * from "./webhooks.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "./api-keys.js";
|
|
2
|
+
export * from "./assets.js";
|
|
3
|
+
export * from "./billing.js";
|
|
4
|
+
export * from "./brands.js";
|
|
5
|
+
export * from "./catalog.js";
|
|
6
|
+
export * from "./consent.js";
|
|
7
|
+
export * from "./creative-direction.js";
|
|
8
|
+
export * from "./credits.js";
|
|
9
|
+
export * from "./errors.js";
|
|
10
|
+
export * from "./events.js";
|
|
11
|
+
export * from "./ids.js";
|
|
12
|
+
export * from "./jobs.js";
|
|
13
|
+
export * from "./me.js";
|
|
14
|
+
export * from "./notifications.js";
|
|
15
|
+
export * from "./pricing.js";
|
|
16
|
+
export * from "./rate-limits.js";
|
|
17
|
+
export * from "./usage.js";
|
|
18
|
+
export * from "./waitlist.js";
|
|
19
|
+
export * from "./webhooks.js";
|
package/dist/jobs.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const jobStatuses: readonly ["queued", "running", "completed", "completed_with_errors", "failed", "canceled"];
|
|
3
|
+
export declare const pipelineSteps: readonly ["intake", "strategy", "visual_system", "logo", "brand_guardian", "applications", "render_package", "persist_deliver"];
|
|
4
|
+
export declare const jobStepNames: readonly ["intake", "strategy", "visual_system", "logo", "brand_guardian", "applications", "render_package", "persist_deliver", ...("logo_alternative" | "logo_wordmark" | "color_palette" | "font_pairing" | "logo_mono" | "logo_reversed" | "favicon" | "brand_guide" | "profile_avatar" | "social_x" | "social_linkedin" | "social_linkedin_personal" | "social_facebook" | "social_youtube" | "social_post" | "social_story" | "app_icon" | "og_image" | "email_signature" | "hero_image" | "play_feature_graphic" | "business_card" | "letterhead" | "mockup" | "custom_image")[], "packaging", "dna_refine"];
|
|
5
|
+
export declare const jobStepSchema: z.ZodObject<{
|
|
6
|
+
step: z.ZodString;
|
|
7
|
+
status: z.ZodEnum<{
|
|
8
|
+
failed: "failed";
|
|
9
|
+
pending: "pending";
|
|
10
|
+
running: "running";
|
|
11
|
+
completed: "completed";
|
|
12
|
+
skipped: "skipped";
|
|
13
|
+
}>;
|
|
14
|
+
started_at: z.ZodNullable<z.ZodString>;
|
|
15
|
+
completed_at: z.ZodNullable<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const jobKinds: readonly ["brand_generation", "asset_regeneration", "brand_expand", "brand_export", "brand_bundle", "brand_dna_refine"];
|
|
18
|
+
export type JobKind = (typeof jobKinds)[number];
|
|
19
|
+
export declare const generationJobSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
brand_id: z.ZodString;
|
|
22
|
+
kind: z.ZodEnum<{
|
|
23
|
+
brand_generation: "brand_generation";
|
|
24
|
+
asset_regeneration: "asset_regeneration";
|
|
25
|
+
brand_expand: "brand_expand";
|
|
26
|
+
brand_export: "brand_export";
|
|
27
|
+
brand_bundle: "brand_bundle";
|
|
28
|
+
brand_dna_refine: "brand_dna_refine";
|
|
29
|
+
}>;
|
|
30
|
+
workflow_id: z.ZodString;
|
|
31
|
+
team_tier: z.ZodEnum<{
|
|
32
|
+
flash: "flash";
|
|
33
|
+
studio: "studio";
|
|
34
|
+
elite: "elite";
|
|
35
|
+
}>;
|
|
36
|
+
credit_multiplier: z.ZodNumber;
|
|
37
|
+
status: z.ZodEnum<{
|
|
38
|
+
failed: "failed";
|
|
39
|
+
queued: "queued";
|
|
40
|
+
running: "running";
|
|
41
|
+
completed: "completed";
|
|
42
|
+
completed_with_errors: "completed_with_errors";
|
|
43
|
+
canceled: "canceled";
|
|
44
|
+
}>;
|
|
45
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
46
|
+
step: z.ZodString;
|
|
47
|
+
status: z.ZodEnum<{
|
|
48
|
+
failed: "failed";
|
|
49
|
+
pending: "pending";
|
|
50
|
+
running: "running";
|
|
51
|
+
completed: "completed";
|
|
52
|
+
skipped: "skipped";
|
|
53
|
+
}>;
|
|
54
|
+
started_at: z.ZodNullable<z.ZodString>;
|
|
55
|
+
completed_at: z.ZodNullable<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
credits_reserved: z.ZodNumber;
|
|
58
|
+
credits_used: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
eta_seconds: z.ZodNullable<z.ZodNumber>;
|
|
60
|
+
download_url: z.ZodNullable<z.ZodString>;
|
|
61
|
+
created_at: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type GenerationJob = z.infer<typeof generationJobSchema>;
|
|
64
|
+
export type PipelineStep = (typeof pipelineSteps)[number];
|
|
65
|
+
export type JobStepName = (typeof jobStepNames)[number];
|
|
66
|
+
export declare const logoLockupOverrideSchema: z.ZodEnum<{
|
|
67
|
+
horizontal: "horizontal";
|
|
68
|
+
stacked: "stacked";
|
|
69
|
+
}>;
|
|
70
|
+
export declare const logoSelectionRequestSchema: z.ZodObject<{
|
|
71
|
+
asset_version_id: z.ZodString;
|
|
72
|
+
lockup_override: z.ZodOptional<z.ZodEnum<{
|
|
73
|
+
horizontal: "horizontal";
|
|
74
|
+
stacked: "stacked";
|
|
75
|
+
}>>;
|
|
76
|
+
family_override: z.ZodOptional<z.ZodString>;
|
|
77
|
+
ink_override: z.ZodOptional<z.ZodString>;
|
|
78
|
+
accent_override: z.ZodOptional<z.ZodString>;
|
|
79
|
+
style_seed_override: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type LogoSelectionRequest = z.infer<typeof logoSelectionRequestSchema>;
|
|
82
|
+
export declare const logoConceptPreviewQuerySchema: z.ZodObject<{
|
|
83
|
+
lockup: z.ZodOptional<z.ZodEnum<{
|
|
84
|
+
horizontal: "horizontal";
|
|
85
|
+
stacked: "stacked";
|
|
86
|
+
}>>;
|
|
87
|
+
family: z.ZodOptional<z.ZodString>;
|
|
88
|
+
ink: z.ZodOptional<z.ZodString>;
|
|
89
|
+
accent: z.ZodOptional<z.ZodString>;
|
|
90
|
+
style_seed: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export type LogoConceptPreviewQuery = z.infer<typeof logoConceptPreviewQuerySchema>;
|
|
93
|
+
export declare const logoConceptPaletteSchema: z.ZodObject<{
|
|
94
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
95
|
+
hex: z.ZodString;
|
|
96
|
+
role: z.ZodString;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
brand_name: z.ZodNullable<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type LogoConceptPalette = z.infer<typeof logoConceptPaletteSchema>;
|
package/dist/jobs.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { expandableAssetKinds, teamTiers } from "./brands.js";
|
|
3
|
+
export const jobStatuses = [
|
|
4
|
+
"queued",
|
|
5
|
+
"running",
|
|
6
|
+
"completed",
|
|
7
|
+
"completed_with_errors",
|
|
8
|
+
"failed",
|
|
9
|
+
"canceled",
|
|
10
|
+
];
|
|
11
|
+
export const pipelineSteps = [
|
|
12
|
+
"intake",
|
|
13
|
+
"strategy",
|
|
14
|
+
"visual_system",
|
|
15
|
+
"logo",
|
|
16
|
+
"brand_guardian",
|
|
17
|
+
"applications",
|
|
18
|
+
"render_package",
|
|
19
|
+
"persist_deliver",
|
|
20
|
+
];
|
|
21
|
+
export const jobStepNames = [
|
|
22
|
+
...pipelineSteps,
|
|
23
|
+
...expandableAssetKinds,
|
|
24
|
+
"packaging",
|
|
25
|
+
"dna_refine",
|
|
26
|
+
];
|
|
27
|
+
export const jobStepSchema = z.object({
|
|
28
|
+
step: z.string().min(1),
|
|
29
|
+
status: z.enum(["pending", "running", "completed", "failed", "skipped"]),
|
|
30
|
+
started_at: z.string().datetime().nullable(),
|
|
31
|
+
completed_at: z.string().datetime().nullable(),
|
|
32
|
+
});
|
|
33
|
+
export const jobKinds = [
|
|
34
|
+
"brand_generation",
|
|
35
|
+
"asset_regeneration",
|
|
36
|
+
"brand_expand",
|
|
37
|
+
"brand_export",
|
|
38
|
+
"brand_bundle",
|
|
39
|
+
"brand_dna_refine",
|
|
40
|
+
];
|
|
41
|
+
export const generationJobSchema = z.object({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
brand_id: z.string(),
|
|
44
|
+
kind: z.enum(jobKinds),
|
|
45
|
+
workflow_id: z.string(),
|
|
46
|
+
team_tier: z.enum(teamTiers),
|
|
47
|
+
credit_multiplier: z.number(),
|
|
48
|
+
status: z.enum(jobStatuses),
|
|
49
|
+
steps: z.array(jobStepSchema),
|
|
50
|
+
credits_reserved: z.number().int(),
|
|
51
|
+
credits_used: z.number().int().nullable(),
|
|
52
|
+
eta_seconds: z.number().int().nullable(),
|
|
53
|
+
download_url: z.string().nullable(),
|
|
54
|
+
created_at: z.string().datetime(),
|
|
55
|
+
});
|
|
56
|
+
export const logoLockupOverrideSchema = z.enum(["horizontal", "stacked"]);
|
|
57
|
+
const hexColorSchema = z
|
|
58
|
+
.string()
|
|
59
|
+
.regex(/^#[0-9A-Fa-f]{6}$/, "must be a 6-digit hex colour like #14162E");
|
|
60
|
+
export const logoSelectionRequestSchema = z.object({
|
|
61
|
+
asset_version_id: z.string(),
|
|
62
|
+
lockup_override: logoLockupOverrideSchema.optional(),
|
|
63
|
+
family_override: z.string().optional(),
|
|
64
|
+
ink_override: hexColorSchema.optional(),
|
|
65
|
+
accent_override: hexColorSchema.optional(),
|
|
66
|
+
style_seed_override: z.string().optional(),
|
|
67
|
+
});
|
|
68
|
+
export const logoConceptPreviewQuerySchema = z.object({
|
|
69
|
+
lockup: logoLockupOverrideSchema.optional(),
|
|
70
|
+
family: z.string().optional(),
|
|
71
|
+
ink: hexColorSchema.optional(),
|
|
72
|
+
accent: hexColorSchema.optional(),
|
|
73
|
+
style_seed: z.string().optional(),
|
|
74
|
+
});
|
|
75
|
+
export const logoConceptPaletteSchema = z.object({
|
|
76
|
+
tokens: z.array(z.object({
|
|
77
|
+
hex: z.string(),
|
|
78
|
+
role: z.string(),
|
|
79
|
+
})),
|
|
80
|
+
brand_name: z.string().nullable(),
|
|
81
|
+
});
|
package/dist/me.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const workspaceRoles: readonly ["owner", "admin", "member"];
|
|
3
|
+
export declare const workspaceRoleSchema: z.ZodEnum<{
|
|
4
|
+
owner: "owner";
|
|
5
|
+
admin: "admin";
|
|
6
|
+
member: "member";
|
|
7
|
+
}>;
|
|
8
|
+
export type WorkspaceRole = z.infer<typeof workspaceRoleSchema>;
|
|
9
|
+
export declare const meResponseSchema: z.ZodObject<{
|
|
10
|
+
user: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
email: z.ZodNullable<z.ZodString>;
|
|
13
|
+
clerkUserId: z.ZodNullable<z.ZodString>;
|
|
14
|
+
termsAcceptedAt: z.ZodNullable<z.ZodString>;
|
|
15
|
+
onboardingCompletedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
workspace: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
clerkOrgId: z.ZodString;
|
|
21
|
+
plan: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
role: z.ZodEnum<{
|
|
24
|
+
owner: "owner";
|
|
25
|
+
admin: "admin";
|
|
26
|
+
member: "member";
|
|
27
|
+
}>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type MeResponse = z.infer<typeof meResponseSchema>;
|
|
30
|
+
export declare const completeOnboardingResponseSchema: z.ZodObject<{
|
|
31
|
+
onboardingCompletedAt: z.ZodString;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type CompleteOnboardingResponse = z.infer<typeof completeOnboardingResponseSchema>;
|
|
34
|
+
export declare const workspaceSchema: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
plan: z.ZodEnum<{
|
|
38
|
+
studio: "studio";
|
|
39
|
+
free: "free";
|
|
40
|
+
pro: "pro";
|
|
41
|
+
agency: "agency";
|
|
42
|
+
}>;
|
|
43
|
+
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type Workspace = z.infer<typeof workspaceSchema>;
|
|
46
|
+
export declare const updateWorkspaceRequestSchema: z.ZodObject<{
|
|
47
|
+
name: z.ZodOptional<z.ZodString>;
|
|
48
|
+
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type UpdateWorkspaceRequest = z.infer<typeof updateWorkspaceRequestSchema>;
|
|
51
|
+
export declare const memberSchema: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
email: z.ZodString;
|
|
54
|
+
role: z.ZodEnum<{
|
|
55
|
+
owner: "owner";
|
|
56
|
+
admin: "admin";
|
|
57
|
+
member: "member";
|
|
58
|
+
}>;
|
|
59
|
+
created_at: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export type Member = z.infer<typeof memberSchema>;
|
|
62
|
+
export declare const inviteMemberRequestSchema: z.ZodObject<{
|
|
63
|
+
email: z.ZodString;
|
|
64
|
+
role: z.ZodEnum<{
|
|
65
|
+
admin: "admin";
|
|
66
|
+
member: "member";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type InviteMemberRequest = z.infer<typeof inviteMemberRequestSchema>;
|
|
70
|
+
export declare const changeMemberRoleRequestSchema: z.ZodObject<{
|
|
71
|
+
role: z.ZodEnum<{
|
|
72
|
+
owner: "owner";
|
|
73
|
+
admin: "admin";
|
|
74
|
+
member: "member";
|
|
75
|
+
}>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type ChangeMemberRoleRequest = z.infer<typeof changeMemberRoleRequestSchema>;
|
package/dist/me.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const workspaceRoles = ["owner", "admin", "member"];
|
|
3
|
+
export const workspaceRoleSchema = z.enum(workspaceRoles);
|
|
4
|
+
export const meResponseSchema = z.object({
|
|
5
|
+
user: z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
email: z.string().email().nullable(),
|
|
8
|
+
clerkUserId: z.string().nullable(),
|
|
9
|
+
termsAcceptedAt: z.string().datetime().nullable(),
|
|
10
|
+
onboardingCompletedAt: z.string().datetime().nullable().optional(),
|
|
11
|
+
}),
|
|
12
|
+
workspace: z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
clerkOrgId: z.string(),
|
|
16
|
+
plan: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
role: workspaceRoleSchema,
|
|
19
|
+
});
|
|
20
|
+
export const completeOnboardingResponseSchema = z.object({
|
|
21
|
+
onboardingCompletedAt: z.string().datetime(),
|
|
22
|
+
});
|
|
23
|
+
export const workspaceSchema = z.object({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
name: z.string(),
|
|
26
|
+
plan: z.enum(["free", "pro", "studio", "agency"]),
|
|
27
|
+
settings: z.record(z.string(), z.unknown()),
|
|
28
|
+
});
|
|
29
|
+
export const updateWorkspaceRequestSchema = z.object({
|
|
30
|
+
name: z.string().min(1).optional(),
|
|
31
|
+
settings: z.record(z.string(), z.unknown()).optional(),
|
|
32
|
+
});
|
|
33
|
+
export const memberSchema = z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
email: z.string().email(),
|
|
36
|
+
role: workspaceRoleSchema,
|
|
37
|
+
created_at: z.string().datetime(),
|
|
38
|
+
});
|
|
39
|
+
export const inviteMemberRequestSchema = z.object({
|
|
40
|
+
email: z.string().email(),
|
|
41
|
+
role: z.enum(["admin", "member"]),
|
|
42
|
+
});
|
|
43
|
+
export const changeMemberRoleRequestSchema = z.object({
|
|
44
|
+
role: workspaceRoleSchema,
|
|
45
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const notificationEventKeys: readonly ["workspace_welcome", "member_joined", "low_credits", "payment_failed", "trial_ending", "brand_ready", "asset_ready", "logo_pending", "generation_failed", "purchase_confirmed"];
|
|
3
|
+
export type NotificationEventKey = (typeof notificationEventKeys)[number];
|
|
4
|
+
export declare const notificationDataSchema: z.ZodObject<{
|
|
5
|
+
brand_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
brand_name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
job_id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
asset_id: z.ZodOptional<z.ZodString>;
|
|
9
|
+
asset_kind: z.ZodOptional<z.ZodString>;
|
|
10
|
+
balance: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
next_retry_at: z.ZodOptional<z.ZodString>;
|
|
12
|
+
refunded: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
canceled: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
checkout_session_id: z.ZodOptional<z.ZodString>;
|
|
15
|
+
purchased_credits: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type NotificationData = z.infer<typeof notificationDataSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const notificationEventKeys = [
|
|
3
|
+
"workspace_welcome",
|
|
4
|
+
"member_joined",
|
|
5
|
+
"low_credits",
|
|
6
|
+
"payment_failed",
|
|
7
|
+
"trial_ending",
|
|
8
|
+
"brand_ready",
|
|
9
|
+
"asset_ready",
|
|
10
|
+
"logo_pending",
|
|
11
|
+
"generation_failed",
|
|
12
|
+
"purchase_confirmed",
|
|
13
|
+
];
|
|
14
|
+
export const notificationDataSchema = z.object({
|
|
15
|
+
brand_id: z.string().optional(),
|
|
16
|
+
brand_name: z.string().optional(),
|
|
17
|
+
job_id: z.string().optional(),
|
|
18
|
+
asset_id: z.string().optional(),
|
|
19
|
+
asset_kind: z.string().optional(),
|
|
20
|
+
balance: z.number().optional(),
|
|
21
|
+
next_retry_at: z.string().optional(),
|
|
22
|
+
refunded: z.boolean().optional(),
|
|
23
|
+
canceled: z.boolean().optional(),
|
|
24
|
+
checkout_session_id: z.string().optional(),
|
|
25
|
+
purchased_credits: z.number().optional(),
|
|
26
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AssetKind, TeamTier } from "./brands.js";
|
|
2
|
+
export declare const ASSET_BASE_CREDITS: Record<AssetKind, number>;
|
|
3
|
+
export declare const CREDIT_MULTIPLIERS: Record<TeamTier, number>;
|
|
4
|
+
export declare const FREE_KINDS: ReadonlySet<string>;
|
|
5
|
+
export declare const LOW_CREDITS_THRESHOLD = 25;
|
|
6
|
+
export declare const FREE_PLAN_CREDITS = 25;
|
|
7
|
+
export declare const DNA_REFINE_CREDITS = 3;
|
|
8
|
+
export declare const LOGO_CONCEPT_REGENERATE_CREDITS = 2;
|
|
9
|
+
export declare function estimateCredits(assets: readonly AssetKind[], tier: TeamTier): number;
|
|
10
|
+
export declare function creditsForKind(kind: string): number | null;
|
|
11
|
+
export interface Plan {
|
|
12
|
+
id: "free" | "pro" | "studio" | "agency";
|
|
13
|
+
name: string;
|
|
14
|
+
priceUsd: number;
|
|
15
|
+
credits: number;
|
|
16
|
+
popular?: boolean;
|
|
17
|
+
features: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const PLANS: readonly Plan[];
|
|
20
|
+
export interface CreditPack {
|
|
21
|
+
credits: number;
|
|
22
|
+
priceUsd: number;
|
|
23
|
+
perCreditUsd: number;
|
|
24
|
+
badge?: "MOST POPULAR" | "BEST VALUE";
|
|
25
|
+
}
|
|
26
|
+
export declare const CREDIT_PACKS: readonly CreditPack[];
|
|
27
|
+
export declare const TAX_NOTICE = "Prices exclude tax. Any tax due is shown at checkout.";
|
|
28
|
+
export declare const SELLER_NOTICE = "Sold by SFER LABS LLC. Stripe processes the payment.";
|
|
29
|
+
export declare function renewalNotice(priceUsd: number): string;
|
|
30
|
+
export declare const DEFAULT_AUTO_TOPUP_PACK_CREDITS = 300;
|
|
31
|
+
export declare const AGENCY_RATES: {
|
|
32
|
+
readonly baseUsd: 3800;
|
|
33
|
+
readonly perAssetUsd: 520;
|
|
34
|
+
};
|
|
35
|
+
export declare const CALCULATOR: {
|
|
36
|
+
readonly planCoveredAssets: 24;
|
|
37
|
+
readonly topUpPerAssetUsd: 1.2;
|
|
38
|
+
};
|