@anuragpal02/zcl-contracts 0.48.0 → 0.50.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/common.d.ts +20 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +32 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/pricing.d.ts +55 -0
- package/dist/pricing.d.ts.map +1 -0
- package/dist/pricing.js +46 -0
- package/package.json +1 -1
package/dist/common.d.ts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const idSchema: z.ZodString;
|
|
3
3
|
export declare const isoDateSchema: z.ZodString;
|
|
4
|
+
/**
|
|
5
|
+
* The machine-readable reason a request failed.
|
|
6
|
+
*
|
|
7
|
+
* These are the ONLY values a caller may branch on, and — because a UI turns a code
|
|
8
|
+
* into a sentence — each one has to mean a single thing. Two unrelated failures
|
|
9
|
+
* sharing a code produce a screen that lies:
|
|
10
|
+
*
|
|
11
|
+
* `POST /projects/:id/smart-video` used to answer 409 `conflict` both when another
|
|
12
|
+
* session had edited the wall AND when some panels simply had no image yet. The web
|
|
13
|
+
* app maps `conflict` to "Someone else changed this while you were working on it.
|
|
14
|
+
* Reload and try again." — advice that was useless in the second case, because
|
|
15
|
+
* reloading does not generate a missing still. `precondition_failed` exists to split
|
|
16
|
+
* those two apart.
|
|
17
|
+
*
|
|
18
|
+
* Adding a member is safe for consumers: both the web app and the BFF fall back to a
|
|
19
|
+
* generic sentence for a code they do not recognise, so an old client shows something
|
|
20
|
+
* vague rather than crashing. It is NOT safe to remove or rename one.
|
|
21
|
+
*/
|
|
4
22
|
export declare const apiErrorCodeSchema: z.ZodEnum<{
|
|
5
23
|
bad_request: "bad_request";
|
|
6
24
|
unauthorized: "unauthorized";
|
|
7
25
|
forbidden: "forbidden";
|
|
8
26
|
payment_required: "payment_required";
|
|
9
27
|
conflict: "conflict";
|
|
28
|
+
precondition_failed: "precondition_failed";
|
|
10
29
|
not_found: "not_found";
|
|
11
30
|
validation_failed: "validation_failed";
|
|
12
31
|
rate_limited: "rate_limited";
|
|
@@ -21,6 +40,7 @@ export declare const errorResponseSchema: z.ZodObject<{
|
|
|
21
40
|
forbidden: "forbidden";
|
|
22
41
|
payment_required: "payment_required";
|
|
23
42
|
conflict: "conflict";
|
|
43
|
+
precondition_failed: "precondition_failed";
|
|
24
44
|
not_found: "not_found";
|
|
25
45
|
validation_failed: "validation_failed";
|
|
26
46
|
rate_limited: "rate_limited";
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,QAAQ,aAAoB,CAAA;AACzC,eAAO,MAAM,aAAa,aAAwB,CAAA;AAElD,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,QAAQ,aAAoB,CAAA;AACzC,eAAO,MAAM,aAAa,aAAwB,CAAA;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAyB7B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;iBAM9B,CAAA;AAEF,eAAO,MAAM,gBAAgB;;iBAE3B,CAAA;AAEF,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO;;kBAE1E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO;;;;;kBAKhF;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
package/dist/common.js
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const idSchema = z.string().uuid();
|
|
3
3
|
export const isoDateSchema = z.string().datetime();
|
|
4
|
+
/**
|
|
5
|
+
* The machine-readable reason a request failed.
|
|
6
|
+
*
|
|
7
|
+
* These are the ONLY values a caller may branch on, and — because a UI turns a code
|
|
8
|
+
* into a sentence — each one has to mean a single thing. Two unrelated failures
|
|
9
|
+
* sharing a code produce a screen that lies:
|
|
10
|
+
*
|
|
11
|
+
* `POST /projects/:id/smart-video` used to answer 409 `conflict` both when another
|
|
12
|
+
* session had edited the wall AND when some panels simply had no image yet. The web
|
|
13
|
+
* app maps `conflict` to "Someone else changed this while you were working on it.
|
|
14
|
+
* Reload and try again." — advice that was useless in the second case, because
|
|
15
|
+
* reloading does not generate a missing still. `precondition_failed` exists to split
|
|
16
|
+
* those two apart.
|
|
17
|
+
*
|
|
18
|
+
* Adding a member is safe for consumers: both the web app and the BFF fall back to a
|
|
19
|
+
* generic sentence for a code they do not recognise, so an old client shows something
|
|
20
|
+
* vague rather than crashing. It is NOT safe to remove or rename one.
|
|
21
|
+
*/
|
|
4
22
|
export const apiErrorCodeSchema = z.enum([
|
|
5
23
|
'bad_request',
|
|
6
24
|
'unauthorized',
|
|
7
25
|
'forbidden',
|
|
8
26
|
'payment_required',
|
|
27
|
+
/**
|
|
28
|
+
* The resource changed underneath you: the version you loaded is no longer current.
|
|
29
|
+
* "Reload and try again" is honest advice, because reloading genuinely fixes it.
|
|
30
|
+
* Examples: a stale LED-map version, a guideline set edited since it was read.
|
|
31
|
+
*/
|
|
9
32
|
'conflict',
|
|
33
|
+
/**
|
|
34
|
+
* The resource exists and you may act on it, but it is not in a state that permits
|
|
35
|
+
* this operation yet. Reloading does NOT help — something has to be done first, and
|
|
36
|
+
* the accompanying `message` names it.
|
|
37
|
+
*
|
|
38
|
+
* Examples: panels that still have no generated still, a master job that has not
|
|
39
|
+
* finished, a reservation already captured.
|
|
40
|
+
*/
|
|
41
|
+
'precondition_failed',
|
|
10
42
|
'not_found',
|
|
11
43
|
'validation_failed',
|
|
12
44
|
'rate_limited',
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './client.js';
|
|
|
6
6
|
export * from './common.js';
|
|
7
7
|
export * from './collection.js';
|
|
8
8
|
export * from './credits.js';
|
|
9
|
+
export * from './pricing.js';
|
|
9
10
|
export * from './frame-iterator.js';
|
|
10
11
|
export * from './generation.js';
|
|
11
12
|
export * from './guidelines.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './client.js';
|
|
|
6
6
|
export * from './common.js';
|
|
7
7
|
export * from './collection.js';
|
|
8
8
|
export * from './credits.js';
|
|
9
|
+
export * from './pricing.js';
|
|
9
10
|
export * from './frame-iterator.js';
|
|
10
11
|
export * from './generation.js';
|
|
11
12
|
export * from './guidelines.js';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* What the tools cost, served BY the API so a client never has to know.
|
|
4
|
+
*
|
|
5
|
+
* ── Why this exists ──────────────────────────────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* The Loop Generator's price lived in three places: `LOOP_TOOL_CREDIT_COST` in
|
|
8
|
+
* zcl-api, a `creditsFor()` helper in the web app's hook, and a third copy as
|
|
9
|
+
* display strings in the markup. Nothing kept them in step, and they drifted — the
|
|
10
|
+
* UI quoted 250 / 1,250 while the API charged 188 / 313. At 4K that is FOUR TIMES
|
|
11
|
+
* the real price, shown to customers deciding whether they could afford it.
|
|
12
|
+
*
|
|
13
|
+
* The Frame Iterator has the identical shape (10 in the UI, 10 in the API) and is
|
|
14
|
+
* currently correct by luck rather than by construction — it drifts the moment
|
|
15
|
+
* either number moves.
|
|
16
|
+
*
|
|
17
|
+
* So the fix is not "correct the numbers", it is "have one number". The API owns
|
|
18
|
+
* the price because the API is what charges it; a client that displays a different
|
|
19
|
+
* figure is by definition wrong.
|
|
20
|
+
*
|
|
21
|
+
* ── Why it is public ─────────────────────────────────────────────────────────
|
|
22
|
+
*
|
|
23
|
+
* Both tools render for signed-out visitors, and they show the price before anyone
|
|
24
|
+
* has an account. A workspace-scoped shape could not serve that, and gating it
|
|
25
|
+
* behind auth would mean the signed-out UI going back to hardcoding — which is the
|
|
26
|
+
* bug this removes.
|
|
27
|
+
*
|
|
28
|
+
* Prices are already public information: they are on the pricing page.
|
|
29
|
+
*/
|
|
30
|
+
export declare const loopToolPricingSchema: z.ZodObject<{
|
|
31
|
+
'1080p': z.ZodNumber;
|
|
32
|
+
'4k': z.ZodNumber;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export declare const pricingSchema: z.ZodObject<{
|
|
35
|
+
loopTool: z.ZodObject<{
|
|
36
|
+
'1080p': z.ZodNumber;
|
|
37
|
+
'4k': z.ZodNumber;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
frameIterationCredits: z.ZodNumber;
|
|
40
|
+
imageCredits: z.ZodNumber;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export declare const pricingResponseSchema: z.ZodObject<{
|
|
43
|
+
data: z.ZodObject<{
|
|
44
|
+
loopTool: z.ZodObject<{
|
|
45
|
+
'1080p': z.ZodNumber;
|
|
46
|
+
'4k': z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
frameIterationCredits: z.ZodNumber;
|
|
49
|
+
imageCredits: z.ZodNumber;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type LoopToolPricing = z.infer<typeof loopToolPricingSchema>;
|
|
53
|
+
export type Pricing = z.infer<typeof pricingSchema>;
|
|
54
|
+
export type PricingResponse = z.infer<typeof pricingResponseSchema>;
|
|
55
|
+
//# sourceMappingURL=pricing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../src/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;iBAUxB,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;iBAAkC,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACnE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
|
package/dist/pricing.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiSuccessSchema } from './common.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the tools cost, served BY the API so a client never has to know.
|
|
5
|
+
*
|
|
6
|
+
* ── Why this exists ──────────────────────────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* The Loop Generator's price lived in three places: `LOOP_TOOL_CREDIT_COST` in
|
|
9
|
+
* zcl-api, a `creditsFor()` helper in the web app's hook, and a third copy as
|
|
10
|
+
* display strings in the markup. Nothing kept them in step, and they drifted — the
|
|
11
|
+
* UI quoted 250 / 1,250 while the API charged 188 / 313. At 4K that is FOUR TIMES
|
|
12
|
+
* the real price, shown to customers deciding whether they could afford it.
|
|
13
|
+
*
|
|
14
|
+
* The Frame Iterator has the identical shape (10 in the UI, 10 in the API) and is
|
|
15
|
+
* currently correct by luck rather than by construction — it drifts the moment
|
|
16
|
+
* either number moves.
|
|
17
|
+
*
|
|
18
|
+
* So the fix is not "correct the numbers", it is "have one number". The API owns
|
|
19
|
+
* the price because the API is what charges it; a client that displays a different
|
|
20
|
+
* figure is by definition wrong.
|
|
21
|
+
*
|
|
22
|
+
* ── Why it is public ─────────────────────────────────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* Both tools render for signed-out visitors, and they show the price before anyone
|
|
25
|
+
* has an account. A workspace-scoped shape could not serve that, and gating it
|
|
26
|
+
* behind auth would mean the signed-out UI going back to hardcoding — which is the
|
|
27
|
+
* bug this removes.
|
|
28
|
+
*
|
|
29
|
+
* Prices are already public information: they are on the pricing page.
|
|
30
|
+
*/
|
|
31
|
+
export const loopToolPricingSchema = z.object({
|
|
32
|
+
'1080p': z.number().int().positive(),
|
|
33
|
+
'4k': z.number().int().positive()
|
|
34
|
+
});
|
|
35
|
+
export const pricingSchema = z.object({
|
|
36
|
+
/** Standalone Loop Generator, keyed by the output resolution the user picks. */
|
|
37
|
+
loopTool: loopToolPricingSchema,
|
|
38
|
+
/** Frame Iterator, charged per variation — the client multiplies by the count. */
|
|
39
|
+
frameIterationCredits: z.number().int().positive(),
|
|
40
|
+
/**
|
|
41
|
+
* A single generated image: one concept variation, one panel, one edit. The wall
|
|
42
|
+
* flows multiply this by their own panel counts, which the client already knows.
|
|
43
|
+
*/
|
|
44
|
+
imageCredits: z.number().int().positive()
|
|
45
|
+
});
|
|
46
|
+
export const pricingResponseSchema = apiSuccessSchema(pricingSchema);
|