@clipwright/core 0.27.0 → 0.29.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/api-failure.d.ts +70 -5
  3. package/dist/api-failure.js +108 -4
  4. package/dist/api-failure.js.map +1 -1
  5. package/dist/contract-dispositions.js +3 -3
  6. package/dist/contract-dispositions.js.map +1 -1
  7. package/dist/contracts/v1/workflow-brief.d.ts +402 -0
  8. package/dist/contracts/v1/workflow-brief.js +40 -0
  9. package/dist/contracts/v1/workflow-brief.js.map +1 -0
  10. package/dist/contracts/v1/workflow-catalog.d.ts +1062 -0
  11. package/dist/contracts/v1/workflow-catalog.js +45 -0
  12. package/dist/contracts/v1/workflow-catalog.js.map +1 -0
  13. package/dist/contracts/v1/workflow-client.d.ts +319 -0
  14. package/dist/contracts/v1/workflow-client.js +37 -0
  15. package/dist/contracts/v1/workflow-client.js.map +1 -0
  16. package/dist/contracts/v1/workflow-dto.d.ts +18 -0
  17. package/dist/contracts/v1/workflow-dto.js +25 -0
  18. package/dist/contracts/v1/workflow-dto.js.map +1 -0
  19. package/dist/contracts/v1/workflow-evidence.d.ts +115 -0
  20. package/dist/contracts/v1/workflow-evidence.js +33 -0
  21. package/dist/contracts/v1/workflow-evidence.js.map +1 -0
  22. package/dist/contracts/v1/workflow-execution.d.ts +822 -0
  23. package/dist/contracts/v1/workflow-execution.js +64 -0
  24. package/dist/contracts/v1/workflow-execution.js.map +1 -0
  25. package/dist/contracts/v1/workflow-plan.d.ts +1078 -0
  26. package/dist/contracts/v1/workflow-plan.js +31 -0
  27. package/dist/contracts/v1/workflow-plan.js.map +1 -0
  28. package/dist/contracts/v1/workflow-primitives.d.ts +63 -0
  29. package/dist/contracts/v1/workflow-primitives.js +19 -0
  30. package/dist/contracts/v1/workflow-primitives.js.map +1 -0
  31. package/dist/contracts/v1/workflow-run-read.d.ts +929 -0
  32. package/dist/contracts/v1/workflow-run-read.js +23 -0
  33. package/dist/contracts/v1/workflow-run-read.js.map +1 -0
  34. package/dist/edit-billing.d.ts +65 -0
  35. package/dist/edit-billing.js +30 -0
  36. package/dist/edit-billing.js.map +1 -0
  37. package/dist/edit-candidate.d.ts +158 -0
  38. package/dist/edit-candidate.js +64 -0
  39. package/dist/edit-candidate.js.map +1 -0
  40. package/dist/edit-revision.d.ts +162 -0
  41. package/dist/edit-revision.js +36 -0
  42. package/dist/edit-revision.js.map +1 -0
  43. package/dist/edit.d.ts +3 -0
  44. package/dist/edit.js +4 -1
  45. package/dist/edit.js.map +1 -1
  46. package/dist/endpoints.d.ts +8 -0
  47. package/dist/endpoints.js +25 -4
  48. package/dist/endpoints.js.map +1 -1
  49. package/dist/errors.d.ts +109 -1
  50. package/dist/errors.js +92 -0
  51. package/dist/errors.js.map +1 -1
  52. package/dist/faceless-customer-anchors.d.ts +7 -0
  53. package/dist/faceless-customer-anchors.js +31 -0
  54. package/dist/faceless-customer-anchors.js.map +1 -0
  55. package/dist/faceless-image-placement.d.ts +23 -0
  56. package/dist/faceless-image-placement.js +30 -0
  57. package/dist/faceless-image-placement.js.map +1 -0
  58. package/dist/faceless-public-plan.d.ts +2 -0
  59. package/dist/faceless-public-plan.js +6 -2
  60. package/dist/faceless-public-plan.js.map +1 -1
  61. package/dist/faceless-public.d.ts +257 -0
  62. package/dist/faceless-public.js +20 -0
  63. package/dist/faceless-public.js.map +1 -1
  64. package/dist/idempotency.d.ts +4 -0
  65. package/dist/idempotency.js +17 -0
  66. package/dist/idempotency.js.map +1 -1
  67. package/dist/index.d.ts +3 -0
  68. package/dist/index.js +3 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/run-static-warnings.js +3 -0
  71. package/dist/run-static-warnings.js.map +1 -1
  72. package/dist/runs.d.ts +110 -1
  73. package/dist/runs.js +28 -2
  74. package/dist/runs.js.map +1 -1
  75. package/dist/skills.d.ts +1 -1
  76. package/dist/skills.js +1 -1
  77. package/dist/skills.js.map +1 -1
  78. package/dist/workflows/catalog.d.ts +4 -0
  79. package/dist/workflows/catalog.js +57 -0
  80. package/dist/workflows/catalog.js.map +1 -0
  81. package/dist/workflows/index.d.ts +11 -0
  82. package/dist/workflows/index.js +12 -0
  83. package/dist/workflows/index.js.map +1 -0
  84. package/dist/workflows/methods/faceless-explainer.d.ts +175 -0
  85. package/dist/workflows/methods/faceless-explainer.js +20 -0
  86. package/dist/workflows/methods/faceless-explainer.js.map +1 -0
  87. package/dist/workflows/methods/kinetic-launch.d.ts +175 -0
  88. package/dist/workflows/methods/kinetic-launch.js +19 -0
  89. package/dist/workflows/methods/kinetic-launch.js.map +1 -0
  90. package/dist/workflows/methods/product-image-story.d.ts +175 -0
  91. package/dist/workflows/methods/product-image-story.js +20 -0
  92. package/dist/workflows/methods/product-image-story.js.map +1 -0
  93. package/dist/workflows/methods/shared.d.ts +190 -0
  94. package/dist/workflows/methods/shared.js +13 -0
  95. package/dist/workflows/methods/shared.js.map +1 -0
  96. package/dist/workflows/methods/ugc-faq-answer.d.ts +175 -0
  97. package/dist/workflows/methods/ugc-faq-answer.js +19 -0
  98. package/dist/workflows/methods/ugc-faq-answer.js.map +1 -0
  99. package/dist/workflows/methods/ugc-product-intro.d.ts +175 -0
  100. package/dist/workflows/methods/ugc-product-intro.js +19 -0
  101. package/dist/workflows/methods/ugc-product-intro.js.map +1 -0
  102. package/dist/workflows/methods/website-proof-demo.d.ts +175 -0
  103. package/dist/workflows/methods/website-proof-demo.js +19 -0
  104. package/dist/workflows/methods/website-proof-demo.js.map +1 -0
  105. package/dist/workflows/validate.d.ts +10 -0
  106. package/dist/workflows/validate.js +229 -0
  107. package/dist/workflows/validate.js.map +1 -0
  108. package/dist/workflows.d.ts +1 -0
  109. package/dist/workflows.js +2 -0
  110. package/dist/workflows.js.map +1 -0
  111. package/package.json +7 -2
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { run, runRead } from '../../runs.js';
3
+ import { workflowNativeRunRead, workflowOutcomeRead } from './workflow-execution.js';
4
+ import { workflowPlanDocumentRead } from './workflow-plan.js';
5
+ import { workflowDigest } from './workflow-primitives.js';
6
+ const frame = z.number().int().nonnegative().safe();
7
+ export const workflowAssetPlacementRead = z.looseObject({
8
+ instance_id: z.string().min(1), asset_id: z.string().min(1), source_digest: workflowDigest,
9
+ first_word: frame, end_word: frame, shot_id: z.string().min(1), start_frame: frame, end_frame: frame,
10
+ normalized_sha256: workflowDigest, width: z.number().int().positive().safe(), height: z.number().int().positive().safe(),
11
+ }).refine(value => value.end_word > value.first_word && value.end_frame >= value.start_frame, 'Placement interval must be ordered');
12
+ export const workflowRunOutcomeRead = workflowOutcomeRead.extend({
13
+ approved_plan: workflowPlanDocumentRead, asset_placements: z.array(workflowAssetPlacementRead).nullable(),
14
+ }).refine(value => ['method_id', 'version', 'content_digest', 'capability_digest']
15
+ .every(key => value.receipt.method[key] === value.approved_plan.method[key]), 'Approved plan must identify the purchased method');
16
+ const identifiesRun = (value) => !value.workflow || (value.workflow.receipt.run_id === value.run_id &&
17
+ value.workflow.receipt.skill === value.skill && value.workflow.state === value.state);
18
+ const workflow = workflowRunOutcomeRead.optional();
19
+ export const workflowRunIdentityRead = runRead.pick({ run_id: true, skill: true, state: true }).loose().extend({ workflow })
20
+ .refine(identifiesRun, 'Workflow must identify the native run');
21
+ export const workflowRun = run.extend({ workflow }).refine(identifiesRun, 'Workflow must identify the native run');
22
+ export const workflowRunRead = workflowNativeRunRead.extend({ workflow }).refine(identifiesRun, 'Workflow must identify the native run');
23
+ //# sourceMappingURL=workflow-run-read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-run-read.js","sourceRoot":"","sources":["../../../src/contracts/v1/workflow-run-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,mBAAm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ated unit, or a kept candidate entering the video. */
3
+ export declare const revisionPriceLine: z.ZodObject<{
4
+ shot_id: z.ZodString;
5
+ unit: z.ZodEnum<{
6
+ clip: "clip";
7
+ clip_with_new_picture: "clip_with_new_picture";
8
+ kept_clip: "kept_clip";
9
+ kept_picture: "kept_picture";
10
+ picture: "picture";
11
+ }>;
12
+ credits: z.ZodNumber;
13
+ }, z.core.$strict>;
14
+ export type RevisionPriceLine = z.infer<typeof revisionPriceLine>;
15
+ /** The price of a revision, frozen at admission. `zero_unit` names the rule a revision without generation took. */
16
+ export declare const revisionBilling: z.ZodObject<{
17
+ tariff_id: z.ZodString;
18
+ lines: z.ZodArray<z.ZodObject<{
19
+ shot_id: z.ZodString;
20
+ unit: z.ZodEnum<{
21
+ clip: "clip";
22
+ clip_with_new_picture: "clip_with_new_picture";
23
+ kept_clip: "kept_clip";
24
+ kept_picture: "kept_picture";
25
+ picture: "picture";
26
+ }>;
27
+ credits: z.ZodNumber;
28
+ }, z.core.$strict>>;
29
+ render_credits: z.ZodNumber;
30
+ zero_unit: z.ZodNullable<z.ZodEnum<{
31
+ free: "free";
32
+ priced: "priced";
33
+ }>>;
34
+ total_credits: z.ZodNumber;
35
+ }, z.core.$strict>;
36
+ export type RevisionBilling = z.infer<typeof revisionBilling>;
37
+ /** What a revision changes, as the server states it. */
38
+ export declare const editSummaryWire: z.ZodObject<{
39
+ retimed: z.ZodArray<z.ZodString>;
40
+ deleted: z.ZodArray<z.ZodString>;
41
+ added: z.ZodArray<z.ZodString>;
42
+ replaced: z.ZodArray<z.ZodObject<{
43
+ shot_id: z.ZodString;
44
+ from: z.ZodEnum<{
45
+ candidate: "candidate";
46
+ upload: "upload";
47
+ }>;
48
+ }, z.core.$strict>>;
49
+ generated: z.ZodArray<z.ZodObject<{
50
+ shot_id: z.ZodString;
51
+ kind: z.ZodEnum<{
52
+ clip: "clip";
53
+ picture: "picture";
54
+ presenter: "presenter";
55
+ }>;
56
+ mode: z.ZodEnum<{
57
+ animate: "animate";
58
+ edit_picture: "edit_picture";
59
+ new_picture: "new_picture";
60
+ retake: "retake";
61
+ }>;
62
+ }, z.core.$strict>>;
63
+ changed: z.ZodBoolean;
64
+ }, z.core.$strict>;
65
+ export type EditSummaryWire = z.infer<typeof editSummaryWire>;
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ import { SHOT_OPERATION_MODES } from "./edit-operations.js";
3
+ import { shotId } from "./edit-primitives.js";
4
+ // A leaf: `runs.ts` imports it, so it reaches neither `edit-document.ts` nor `runs.ts`.
5
+ const credits = z.number().int().nonnegative().safe();
6
+ const shotKind = z.enum(["picture", "clip", "presenter"]);
7
+ /** One priced line of a revision: a generated unit, or a kept candidate entering the video. */
8
+ export const revisionPriceLine = z.strictObject({
9
+ shot_id: shotId,
10
+ unit: z.enum(["picture", "clip", "clip_with_new_picture", "kept_picture", "kept_clip"]),
11
+ credits,
12
+ });
13
+ /** The price of a revision, frozen at admission. `zero_unit` names the rule a revision without generation took. */
14
+ export const revisionBilling = z.strictObject({
15
+ tariff_id: z.string().min(1),
16
+ lines: z.array(revisionPriceLine),
17
+ render_credits: credits,
18
+ zero_unit: z.enum(["priced", "free"]).nullable(),
19
+ total_credits: credits,
20
+ });
21
+ /** What a revision changes, as the server states it. */
22
+ export const editSummaryWire = z.strictObject({
23
+ retimed: z.array(shotId),
24
+ deleted: z.array(shotId),
25
+ added: z.array(shotId),
26
+ replaced: z.array(z.strictObject({ shot_id: shotId, from: z.enum(["candidate", "upload"]) })),
27
+ generated: z.array(z.strictObject({ shot_id: shotId, kind: shotKind, mode: z.enum(SHOT_OPERATION_MODES) })),
28
+ changed: z.boolean(),
29
+ });
30
+ //# sourceMappingURL=edit-billing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-billing.js","sourceRoot":"","sources":["../src/edit-billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,s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AAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7F,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;IAC3G,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC"}
@@ -0,0 +1,158 @@
1
+ import { z } from "zod";
2
+ /** One generated picture or clip for one shot. `take` makes a deliberate retry a new run; the same take replays the first. */
3
+ export declare const candidateRequest: z.ZodObject<{
4
+ shot_id: z.ZodString;
5
+ operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
+ mode: z.ZodLiteral<"retake">;
7
+ }, z.core.$strict>, z.ZodObject<{
8
+ mode: z.ZodLiteral<"new_picture">;
9
+ description: z.ZodString;
10
+ }, z.core.$strict>, z.ZodObject<{
11
+ mode: z.ZodLiteral<"edit_picture">;
12
+ instruction: z.ZodString;
13
+ }, z.core.$strict>, z.ZodObject<{
14
+ mode: z.ZodLiteral<"animate">;
15
+ motion: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strict>], "mode">;
17
+ take: z.ZodNumber;
18
+ }, z.core.$strict>;
19
+ export type CandidateRequest = z.infer<typeof candidateRequest>;
20
+ /** What a candidate would cost: one unit, charged once it is published, kept or discarded. */
21
+ export declare const candidateQuote: z.ZodObject<{
22
+ source_run_id: z.ZodString;
23
+ root_run_id: z.ZodString;
24
+ shot_id: z.ZodString;
25
+ kind: z.ZodEnum<{
26
+ clip: "clip";
27
+ picture: "picture";
28
+ }>;
29
+ operation_mode: z.ZodEnum<{
30
+ animate: "animate";
31
+ edit_picture: "edit_picture";
32
+ new_picture: "new_picture";
33
+ retake: "retake";
34
+ }>;
35
+ unit: z.ZodEnum<{
36
+ clip: "clip";
37
+ clip_with_new_picture: "clip_with_new_picture";
38
+ picture: "picture";
39
+ }>;
40
+ credits: z.ZodNumber;
41
+ usable_until: z.ZodString;
42
+ warnings: z.ZodArray<z.ZodString>;
43
+ contract_version: z.ZodString;
44
+ }, z.core.$strict>;
45
+ export type CandidateQuote = z.infer<typeof candidateQuote>;
46
+ /** The input a candidate run stores: the request, and what admission resolved for the worker. */
47
+ export declare const storedCandidateInput: z.ZodObject<{
48
+ shot_id: z.ZodString;
49
+ operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
50
+ mode: z.ZodLiteral<"retake">;
51
+ }, z.core.$strict>, z.ZodObject<{
52
+ mode: z.ZodLiteral<"new_picture">;
53
+ description: z.ZodString;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ mode: z.ZodLiteral<"edit_picture">;
56
+ instruction: z.ZodString;
57
+ }, z.core.$strict>, z.ZodObject<{
58
+ mode: z.ZodLiteral<"animate">;
59
+ motion: z.ZodOptional<z.ZodString>;
60
+ }, z.core.$strict>], "mode">;
61
+ take: z.ZodNumber;
62
+ source_run_id: z.ZodString;
63
+ resolved_candidate: z.ZodObject<{
64
+ root_run_id: z.ZodString;
65
+ shot_kind: z.ZodEnum<{
66
+ clip: "clip";
67
+ picture: "picture";
68
+ }>;
69
+ unit: z.ZodEnum<{
70
+ clip: "clip";
71
+ clip_with_new_picture: "clip_with_new_picture";
72
+ picture: "picture";
73
+ }>;
74
+ credits: z.ZodNumber;
75
+ }, z.core.$strict>;
76
+ }, z.core.$strict>;
77
+ export type StoredCandidateInput = z.infer<typeof storedCandidateInput>;
78
+ /** The candidates of one family, oldest first, each with its run's state and money. */
79
+ export declare const runCandidates: z.ZodObject<{
80
+ run_id: z.ZodString;
81
+ root_run_id: z.ZodString;
82
+ candidates: z.ZodArray<z.ZodObject<{
83
+ source_run_id: z.ZodString;
84
+ root_run_id: z.ZodString;
85
+ shot_id: z.ZodString;
86
+ kind: z.ZodEnum<{
87
+ clip: "clip";
88
+ picture: "picture";
89
+ }>;
90
+ operation_mode: z.ZodNullable<z.ZodEnum<{
91
+ animate: "animate";
92
+ edit_picture: "edit_picture";
93
+ new_picture: "new_picture";
94
+ retake: "retake";
95
+ }>>;
96
+ take: z.ZodNullable<z.ZodNumber>;
97
+ preview_url: z.ZodNullable<z.ZodString>;
98
+ usable_until: z.ZodNullable<z.ZodString>;
99
+ run_id: z.ZodString;
100
+ state: z.ZodEnum<{
101
+ avatar: "avatar";
102
+ compositing: "compositing";
103
+ failed: "failed";
104
+ generating: "generating";
105
+ queued: "queued";
106
+ scripting: "scripting";
107
+ succeeded: "succeeded";
108
+ tts: "tts";
109
+ uploading: "uploading";
110
+ }>;
111
+ credits_reserved: z.ZodNumber;
112
+ credits_charged: z.ZodNullable<z.ZodNumber>;
113
+ created_at: z.ZodString;
114
+ finished_at: z.ZodNullable<z.ZodString>;
115
+ }, z.core.$strip>>;
116
+ contract_version: z.ZodString;
117
+ }, z.core.$strict>;
118
+ export type RunCandidates = z.infer<typeof runCandidates>;
119
+ export declare const candidateQuoteRead: z.ZodObject<{
120
+ source_run_id: z.ZodString;
121
+ root_run_id: z.ZodString;
122
+ shot_id: z.ZodString;
123
+ credits: z.ZodNumber;
124
+ usable_until: z.ZodString;
125
+ warnings: z.ZodArray<z.ZodString>;
126
+ contract_version: z.ZodString;
127
+ kind: z.ZodString;
128
+ operation_mode: z.ZodString;
129
+ unit: z.ZodString;
130
+ }, z.core.$loose>;
131
+ export type CandidateQuoteRead = z.infer<typeof candidateQuoteRead>;
132
+ export declare const runCandidatesRead: z.ZodObject<{
133
+ run_id: z.ZodString;
134
+ root_run_id: z.ZodString;
135
+ contract_version: z.ZodString;
136
+ candidates: z.ZodArray<z.ZodObject<{
137
+ source_run_id: z.ZodString;
138
+ root_run_id: z.ZodString;
139
+ shot_id: z.ZodString;
140
+ take: z.ZodNullable<z.ZodNumber>;
141
+ preview_url: z.ZodNullable<z.ZodString>;
142
+ usable_until: z.ZodNullable<z.ZodString>;
143
+ run_id: z.ZodString;
144
+ credits_reserved: z.ZodNumber;
145
+ credits_charged: z.ZodNullable<z.ZodNumber>;
146
+ created_at: z.ZodString;
147
+ finished_at: z.ZodNullable<z.ZodString>;
148
+ kind: z.ZodString;
149
+ operation_mode: z.ZodNullable<z.ZodString>;
150
+ state: z.ZodString;
151
+ }, z.core.$loose>>;
152
+ }, z.core.$loose>;
153
+ export type RunCandidatesRead = z.infer<typeof runCandidatesRead>;
154
+ /** The one sentence every client and the docs page state a shot candidate's charge by. */
155
+ export declare const CANDIDATE_CHARGE_TEXT = "A delivered candidate is charged its one unit whether it is kept or discarded; one that fails is charged nothing, even when its paid work was already done.";
156
+ /** The paths of a run's candidate quote, start and list. The id is encoded, since it comes from the caller. */
157
+ export declare const runCandidatesQuotePath: (id: string) => string;
158
+ export declare const runCandidatesPath: (id: string) => string;
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ import { SHOT_OPERATION_MODES, shotId, shotOperation } from "./edit-operations.js";
3
+ import { runCandidate, runId, runState } from "./runs.js";
4
+ /** One generated picture or clip for one shot. `take` makes a deliberate retry a new run; the same take replays the first. */
5
+ export const candidateRequest = z.strictObject({
6
+ shot_id: shotId,
7
+ operation: shotOperation,
8
+ take: z.number().int().positive().safe(),
9
+ });
10
+ const credits = z.number().int().positive().safe();
11
+ /** What a candidate would cost: one unit, charged once it is published, kept or discarded. */
12
+ export const candidateQuote = z.strictObject({
13
+ source_run_id: runId,
14
+ root_run_id: runId,
15
+ shot_id: shotId,
16
+ kind: z.enum(["picture", "clip"]),
17
+ operation_mode: z.enum(SHOT_OPERATION_MODES),
18
+ unit: z.enum(["picture", "clip", "clip_with_new_picture"]),
19
+ credits,
20
+ usable_until: z.string().datetime(),
21
+ warnings: z.array(z.string()),
22
+ contract_version: z.string().min(1),
23
+ });
24
+ /** The input a candidate run stores: the request, and what admission resolved for the worker. */
25
+ export const storedCandidateInput = z.strictObject({
26
+ source_run_id: runId,
27
+ ...candidateRequest.shape,
28
+ resolved_candidate: z.strictObject({
29
+ root_run_id: runId,
30
+ shot_kind: z.enum(["picture", "clip"]),
31
+ unit: candidateQuote.shape.unit,
32
+ credits,
33
+ }),
34
+ });
35
+ /** The candidates of one family, oldest first, each with its run's state and money. */
36
+ export const runCandidates = z.strictObject({
37
+ run_id: runId,
38
+ root_run_id: runId,
39
+ candidates: z.array(runCandidate.extend({
40
+ run_id: runId,
41
+ state: runState,
42
+ credits_reserved: z.number().int().nonnegative(),
43
+ credits_charged: z.number().int().nonnegative().nullable(),
44
+ created_at: z.string().datetime(),
45
+ finished_at: z.string().datetime().nullable(),
46
+ })),
47
+ contract_version: z.string().min(1),
48
+ });
49
+ // What installed clients parse: kinds, modes, units and states are open strings, and unknown keys are kept.
50
+ export const candidateQuoteRead = candidateQuote.extend({
51
+ kind: z.string().min(1), operation_mode: z.string().min(1), unit: z.string().min(1),
52
+ }).loose();
53
+ const listedCandidate = runCandidates.shape.candidates.element;
54
+ export const runCandidatesRead = runCandidates.extend({
55
+ candidates: z.array(listedCandidate.extend({
56
+ kind: z.string().min(1), operation_mode: z.string().min(1).nullable(), state: z.string().min(1),
57
+ }).loose()),
58
+ }).loose();
59
+ /** The one sentence every client and the docs page state a shot candidate's charge by. */
60
+ export const CANDIDATE_CHARGE_TEXT = "A delivered candidate is charged its one unit whether it is kept or discarded; one that fails is charged nothing, even when its paid work was already done.";
61
+ /** The paths of a run's candidate quote, start and list. The id is encoded, since it comes from the caller. */
62
+ export const runCandidatesQuotePath = (id) => `/v1/runs/${encodeURIComponent(id)}/candidates/quote`;
63
+ export const runCandidatesPath = (id) => `/v1/runs/${encodeURIComponent(id)}/candidates`;
64
+ //# sourceMappingURL=edit-candidate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-candidate.js","sourceRoot":"","sources":["../src/edit-candidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,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AGX,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC;IACpD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC;QACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KAChG,CAAC,CAAC,KAAK,EAAE,CAAC;CACZ,CAAC,CAAC,KAAK,EAAE,CAAC;AAGX,0FAA0F;AAC1F,MAAM,CAAC,MAAM,qBAAqB,GAChC,6JAA6J,CAAC;AAEhK,+GAA+G;AAC/G,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,YAAY,kBAAkB,CAAC,EAAE,CAAC,mBAAmB,CAAC;AACpH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,YAAY,kBAAkB,CAAC,EAAE,CAAC,aAAa,CAAC"}
@@ -0,0 +1,162 @@
1
+ import { z } from "zod";
2
+ /** A revision asks for exactly one of: the whole document, or a list of shot changes over the run as it is. */
3
+ export declare const revisionRequest: z.ZodUnion<readonly [z.ZodObject<{
4
+ document: z.ZodObject<{
5
+ v: z.ZodLiteral<1>;
6
+ source_run_id: z.ZodString;
7
+ timebase: z.ZodObject<{
8
+ fps: z.ZodNumber;
9
+ }, z.core.$strict>;
10
+ duration_frames: z.ZodNumber;
11
+ shots: z.ZodArray<z.ZodObject<{
12
+ id: z.ZodString;
13
+ track: z.ZodEnum<{
14
+ presenter: "presenter";
15
+ visual: "visual";
16
+ }>;
17
+ kind: z.ZodEnum<{
18
+ clip: "clip";
19
+ picture: "picture";
20
+ presenter: "presenter";
21
+ }>;
22
+ start_frame: z.ZodNumber;
23
+ end_frame: z.ZodNumber;
24
+ media_offset_frames: z.ZodOptional<z.ZodNumber>;
25
+ asset: z.ZodDiscriminatedUnion<[z.ZodObject<{
26
+ from: z.ZodLiteral<"source">;
27
+ shot_id: z.ZodString;
28
+ }, z.core.$strict>, z.ZodObject<{
29
+ from: z.ZodLiteral<"candidate">;
30
+ run_id: z.ZodString;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ from: z.ZodLiteral<"upload">;
33
+ upload_id: z.ZodString;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ from: z.ZodLiteral<"generate">;
36
+ operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
37
+ mode: z.ZodLiteral<"retake">;
38
+ }, z.core.$strict>, z.ZodObject<{
39
+ mode: z.ZodLiteral<"new_picture">;
40
+ description: z.ZodString;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ mode: z.ZodLiteral<"edit_picture">;
43
+ instruction: z.ZodString;
44
+ }, z.core.$strict>, z.ZodObject<{
45
+ mode: z.ZodLiteral<"animate">;
46
+ motion: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strict>], "mode">;
48
+ }, z.core.$strict>], "from">;
49
+ }, z.core.$strict>>;
50
+ discarded: z.ZodDefault<z.ZodArray<z.ZodString>>;
51
+ }, z.core.$strict>;
52
+ }, z.core.$strict>, z.ZodObject<{
53
+ changes: z.ZodArray<z.ZodObject<{
54
+ shot_id: z.ZodString;
55
+ operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
56
+ mode: z.ZodLiteral<"retake">;
57
+ }, z.core.$strict>, z.ZodObject<{
58
+ mode: z.ZodLiteral<"new_picture">;
59
+ description: z.ZodString;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ mode: z.ZodLiteral<"edit_picture">;
62
+ instruction: z.ZodString;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ mode: z.ZodLiteral<"animate">;
65
+ motion: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strict>], "mode">;
67
+ }, z.core.$strict>>;
68
+ }, z.core.$strict>]>;
69
+ export type RevisionRequest = z.infer<typeof revisionRequest>;
70
+ /** What a revision would change and cost. The run route refuses what the quote refuses. */
71
+ export declare const revisionQuote: z.ZodObject<{
72
+ source_run_id: z.ZodString;
73
+ root_run_id: z.ZodString;
74
+ summary: z.ZodObject<{
75
+ retimed: z.ZodArray<z.ZodString>;
76
+ deleted: z.ZodArray<z.ZodString>;
77
+ added: z.ZodArray<z.ZodString>;
78
+ replaced: z.ZodArray<z.ZodObject<{
79
+ shot_id: z.ZodString;
80
+ from: z.ZodEnum<{
81
+ candidate: "candidate";
82
+ upload: "upload";
83
+ }>;
84
+ }, z.core.$strict>>;
85
+ generated: z.ZodArray<z.ZodObject<{
86
+ shot_id: z.ZodString;
87
+ kind: z.ZodEnum<{
88
+ clip: "clip";
89
+ picture: "picture";
90
+ presenter: "presenter";
91
+ }>;
92
+ mode: z.ZodEnum<{
93
+ animate: "animate";
94
+ edit_picture: "edit_picture";
95
+ new_picture: "new_picture";
96
+ retake: "retake";
97
+ }>;
98
+ }, z.core.$strict>>;
99
+ changed: z.ZodBoolean;
100
+ }, z.core.$strict>;
101
+ billing: z.ZodObject<{
102
+ tariff_id: z.ZodString;
103
+ lines: z.ZodArray<z.ZodObject<{
104
+ shot_id: z.ZodString;
105
+ unit: z.ZodEnum<{
106
+ clip: "clip";
107
+ clip_with_new_picture: "clip_with_new_picture";
108
+ kept_clip: "kept_clip";
109
+ kept_picture: "kept_picture";
110
+ picture: "picture";
111
+ }>;
112
+ credits: z.ZodNumber;
113
+ }, z.core.$strict>>;
114
+ render_credits: z.ZodNumber;
115
+ zero_unit: z.ZodNullable<z.ZodEnum<{
116
+ free: "free";
117
+ priced: "priced";
118
+ }>>;
119
+ total_credits: z.ZodNumber;
120
+ }, z.core.$strict>;
121
+ warnings: z.ZodArray<z.ZodString>;
122
+ contract_version: z.ZodString;
123
+ }, z.core.$strict>;
124
+ export type RevisionQuote = z.infer<typeof revisionQuote>;
125
+ export declare const revisionQuoteRead: z.ZodObject<{
126
+ source_run_id: z.ZodString;
127
+ root_run_id: z.ZodString;
128
+ warnings: z.ZodArray<z.ZodString>;
129
+ contract_version: z.ZodString;
130
+ summary: z.ZodObject<{
131
+ retimed: z.ZodArray<z.ZodString>;
132
+ deleted: z.ZodArray<z.ZodString>;
133
+ added: z.ZodArray<z.ZodString>;
134
+ changed: z.ZodBoolean;
135
+ replaced: z.ZodArray<z.ZodObject<{
136
+ shot_id: z.ZodString;
137
+ from: z.ZodString;
138
+ }, z.core.$loose>>;
139
+ generated: z.ZodArray<z.ZodObject<{
140
+ shot_id: z.ZodString;
141
+ kind: z.ZodString;
142
+ mode: z.ZodString;
143
+ }, z.core.$loose>>;
144
+ }, z.core.$loose>;
145
+ billing: z.ZodObject<{
146
+ tariff_id: z.ZodString;
147
+ render_credits: z.ZodNumber;
148
+ total_credits: z.ZodNumber;
149
+ lines: z.ZodArray<z.ZodObject<{
150
+ shot_id: z.ZodString;
151
+ credits: z.ZodNumber;
152
+ unit: z.ZodString;
153
+ }, z.core.$loose>>;
154
+ zero_unit: z.ZodNullable<z.ZodString>;
155
+ }, z.core.$loose>;
156
+ }, z.core.$loose>;
157
+ export type RevisionQuoteRead = z.infer<typeof revisionQuoteRead>;
158
+ /** The one sentence every client and the docs page state a revision's charge by. */
159
+ export declare const REVISION_CHARGE_TEXT = "A revision that delivers is charged its quoted total; one that fails is charged nothing, even when its paid work was already done.";
160
+ /** The paths of a run's revision quote and start. The id is encoded, since it comes from the caller. */
161
+ export declare const runRevisionsQuotePath: (id: string) => string;
162
+ export declare const runRevisionsPath: (id: string) => string;
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ import { editSummaryWire, revisionBilling, revisionPriceLine } from "./edit-billing.js";
3
+ import { editDocument } from "./edit-document.js";
4
+ import { shotChange } from "./edit-operations.js";
5
+ import { EDIT_MAX_SHOTS } from "./edit-rules.js";
6
+ import { runId } from "./runs.js";
7
+ /** A revision asks for exactly one of: the whole document, or a list of shot changes over the run as it is. */
8
+ export const revisionRequest = z.union([
9
+ z.strictObject({ document: editDocument }),
10
+ z.strictObject({ changes: z.array(shotChange).min(1).max(EDIT_MAX_SHOTS) }),
11
+ ]);
12
+ /** What a revision would change and cost. The run route refuses what the quote refuses. */
13
+ export const revisionQuote = z.strictObject({
14
+ source_run_id: runId,
15
+ root_run_id: runId,
16
+ summary: editSummaryWire,
17
+ billing: revisionBilling,
18
+ warnings: z.array(z.string()),
19
+ contract_version: z.string().min(1),
20
+ });
21
+ // What installed clients parse: units, zero rules, kinds, modes and origins are open strings, and unknown keys are kept.
22
+ const priceLineRead = revisionPriceLine.extend({ unit: z.string().min(1) }).loose();
23
+ const summaryRead = editSummaryWire.extend({
24
+ replaced: z.array(editSummaryWire.shape.replaced.element.extend({ from: z.string().min(1) }).loose()),
25
+ generated: z.array(editSummaryWire.shape.generated.element.extend({ kind: z.string().min(1), mode: z.string().min(1) }).loose()),
26
+ }).loose();
27
+ export const revisionQuoteRead = revisionQuote.extend({
28
+ summary: summaryRead,
29
+ billing: revisionBilling.extend({ lines: z.array(priceLineRead), zero_unit: z.string().min(1).nullable() }).loose(),
30
+ }).loose();
31
+ /** The one sentence every client and the docs page state a revision's charge by. */
32
+ export const REVISION_CHARGE_TEXT = "A revision that delivers is charged its quoted total; one that fails is charged nothing, even when its paid work was already done.";
33
+ /** The paths of a run's revision quote and start. The id is encoded, since it comes from the caller. */
34
+ export const runRevisionsQuotePath = (id) => `/v1/runs/${encodeURIComponent(id)}/revisions/quote`;
35
+ export const runRevisionsPath = (id) => `/v1/runs/${encodeURIComponent(id)}/revisions`;
36
+ //# sourceMappingURL=edit-revision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-revision.js","sourceRoot":"","sources":["../src/edit-revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,E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ate.js";
6
6
  export * from "./edit-faceless.js";
7
+ export * from "./edit-billing.js";
8
+ export * from "./edit-revision.js";
9
+ export * from "./edit-candidate.js";
package/dist/edit.js CHANGED
@@ -1,8 +1,11 @@
1
- // The editor contract in one subpath: rules, operations, the edit document, the shots view, validation, the faceless projection.
1
+ // The editor contract in one subpath: rules, operations, the edit document, the shots view, validation, the faceless projection, the revision and its price, the shot candidate.
2
2
  export * from "./edit-rules.js";
3
3
  export * from "./edit-operations.js";
4
4
  export * from "./edit-document.js";
5
5
  export * from "./edit-shots.js";
6
6
  export * from "./edit-validate.js";
7
7
  export * from "./edit-faceless.js";
8
+ export * from "./edit-billing.js";
9
+ export * from "./edit-revision.js";
10
+ export * from "./edit-candidate.js";
8
11
  //# sourceMappingURL=edit.js.map
package/dist/edit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"edit.js","sourceRoot":"","sources":["../src/edit.ts"],"names":[],"mappings":"AAAA,iIAAiI;AACjI,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../src/edit.ts"],"names":[],"mappings":"AAAA,iLAAiL;AACjL,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -1,3 +1,11 @@
1
+ export declare const PUBLIC_WORKFLOWS_PATH = "/v1/public/workflows";
2
+ export declare const PUBLIC_WORKFLOW_PATH = "/v1/public/workflows/:id";
3
+ export declare const WORKFLOW_PLANS_PATH = "/v1/workflow-plans";
4
+ export declare const WORKFLOW_PLAN_PATH = "/v1/workflow-plans/:id";
5
+ export declare const WORKFLOW_REVISIONS_PATH = "/v1/workflow-plans/:id/revisions";
6
+ export declare const WORKFLOW_APPROVE_PATH = "/v1/workflow-plans/:id/approve";
7
+ export declare const WORKFLOW_QUOTE_PATH = "/v1/workflow-plans/:id/quote";
8
+ export declare const WORKFLOW_RUN_PATH = "/v1/workflow-plans/:id/run";
1
9
  export interface ApiEndpoint {
2
10
  method: "GET" | "POST" | "DELETE";
3
11
  /** The path in Hono notation: a parameter is `:id`. */