@deepraxis/cli 0.2.2-dev.3656610 → 0.2.2-dev.4034191
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/COMMANDS.md +51 -6
- package/README.md +10 -4
- package/dist/praxis.js +3831 -131
- package/package.json +1 -1
package/dist/praxis.js
CHANGED
|
@@ -6946,6 +6946,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
6946
6946
|
|
|
6947
6947
|
// src/main.ts
|
|
6948
6948
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
6949
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
6949
6950
|
import { spawn as spawn2 } from "node:child_process";
|
|
6950
6951
|
import { createInterface } from "node:readline";
|
|
6951
6952
|
|
|
@@ -17166,7 +17167,7 @@ Execution errors include error.details.prints containing output printed before f
|
|
|
17166
17167
|
name: "folder",
|
|
17167
17168
|
type: "string",
|
|
17168
17169
|
required: false,
|
|
17169
|
-
description: "Optional destination path within the bound media library; omitted uses its default folder."
|
|
17170
|
+
description: "Optional destination path within the bound media library; omitted uses its default folder. Naming a binding or a folder also imports the finished video into that media library as an asset. Omit both and the export is a file only: read file.url to download it."
|
|
17170
17171
|
},
|
|
17171
17172
|
{
|
|
17172
17173
|
name: "name",
|
|
@@ -17184,7 +17185,7 @@ Execution errors include error.details.prints containing output printed before f
|
|
|
17184
17185
|
name: "binding",
|
|
17185
17186
|
type: "string",
|
|
17186
17187
|
required: false,
|
|
17187
|
-
description: "Writable binding name used as the export destination; omission uses default_upload."
|
|
17188
|
+
description: "Writable binding name used as the export destination; omission uses default_upload. Naming a binding or a folder also imports the finished video into that media library as an asset. Omit both and the export is a file only; read file.url to download it."
|
|
17188
17189
|
},
|
|
17189
17190
|
{
|
|
17190
17191
|
name: "revision",
|
|
@@ -18682,6 +18683,718 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
18682
18683
|
]
|
|
18683
18684
|
}
|
|
18684
18685
|
},
|
|
18686
|
+
{
|
|
18687
|
+
resource: "devops.environments.checkpoints",
|
|
18688
|
+
method: "list",
|
|
18689
|
+
summary: "List environment checkpoints",
|
|
18690
|
+
description: 'List where each target of an environment currently stands: the release and commit deployed to it, the promotion that put it there, and how far behind the default branch that commit is. Read it to answer "what is running in production right now" and to tell a promotion that will change something apart from one that will skip every target as unchanged. behindMain counts commits on the default branch that the deployed commit does not have, so zero means the environment carries the current branch head. Targets that were never deployed to have no checkpoints until something deploys to them.',
|
|
18691
|
+
http: "GET",
|
|
18692
|
+
path: "/devops/v1/environments/{id}/checkpoints",
|
|
18693
|
+
streaming: "no",
|
|
18694
|
+
pagination: false,
|
|
18695
|
+
pathParams: [
|
|
18696
|
+
{
|
|
18697
|
+
name: "id",
|
|
18698
|
+
sdkName: "id",
|
|
18699
|
+
description: "The environment identifier from a project's environment list; the tier or the display name is not an address."
|
|
18700
|
+
}
|
|
18701
|
+
],
|
|
18702
|
+
query: []
|
|
18703
|
+
},
|
|
18704
|
+
{
|
|
18705
|
+
resource: "devops.flags",
|
|
18706
|
+
method: "retrieve",
|
|
18707
|
+
summary: "Retrieve a flag",
|
|
18708
|
+
description: "Read one flag in full: every environment's configuration, the rules and rollouts each environment serves, the flag's lifecycle, and where code references its key as of the last scan. Call it before changing an environment so you can send the version you read, and after a release to confirm the flag reached the state you expected. An archived flag is still readable here — that is how its key and history stay answerable after it stopped evaluating. codeRefs.count tells you how much code still names the key, which is what decides whether removing the flag is safe.",
|
|
18709
|
+
http: "GET",
|
|
18710
|
+
path: "/devops/v1/flags/{id}",
|
|
18711
|
+
streaming: "no",
|
|
18712
|
+
pagination: false,
|
|
18713
|
+
pathParams: [
|
|
18714
|
+
{
|
|
18715
|
+
name: "id",
|
|
18716
|
+
sdkName: "id",
|
|
18717
|
+
description: "The flag identifier from a flag list or create answer; code names a flag by its key, while this API addresses it by id."
|
|
18718
|
+
}
|
|
18719
|
+
],
|
|
18720
|
+
query: []
|
|
18721
|
+
},
|
|
18722
|
+
{
|
|
18723
|
+
resource: "devops.flags",
|
|
18724
|
+
method: "update",
|
|
18725
|
+
summary: "Update a flag",
|
|
18726
|
+
description: "Change a flag's metadata — its name, description, owner, observation deadline, removal ticket or tags — without touching what any environment serves. Send the fields to change inside flag and name them in updateMask; a field present in flag but absent from the mask is left alone, and a mask naming a field this operation cannot change is refused rather than ignored. Sending null clears a nullable field such as observeUntil. Served values are not changed here: use the environment update for what an environment serves, which is versioned and checked. An archived flag cannot be updated.",
|
|
18727
|
+
http: "PATCH",
|
|
18728
|
+
path: "/devops/v1/flags/{id}",
|
|
18729
|
+
streaming: "no",
|
|
18730
|
+
pagination: false,
|
|
18731
|
+
pathParams: [
|
|
18732
|
+
{
|
|
18733
|
+
name: "id",
|
|
18734
|
+
sdkName: "id",
|
|
18735
|
+
description: "The flag identifier from a flag list or create answer; code names a flag by its key, while this API addresses it by id."
|
|
18736
|
+
}
|
|
18737
|
+
],
|
|
18738
|
+
query: [],
|
|
18739
|
+
body: {
|
|
18740
|
+
required: true,
|
|
18741
|
+
fields: [
|
|
18742
|
+
{
|
|
18743
|
+
name: "flag",
|
|
18744
|
+
type: "object",
|
|
18745
|
+
required: true,
|
|
18746
|
+
description: "The updatable fields of a flag, as the body of an update. Values left out are not touched, and null clears a nullable one."
|
|
18747
|
+
},
|
|
18748
|
+
{
|
|
18749
|
+
name: "updateMask",
|
|
18750
|
+
type: "array",
|
|
18751
|
+
itemType: "string",
|
|
18752
|
+
required: false,
|
|
18753
|
+
description: "Which fields to write, by name; omit it to write every field the flag object carries. A field not listed here is left as it is, even when the object carries it."
|
|
18754
|
+
}
|
|
18755
|
+
]
|
|
18756
|
+
}
|
|
18757
|
+
},
|
|
18758
|
+
{
|
|
18759
|
+
resource: "devops.flags.environments",
|
|
18760
|
+
method: "update",
|
|
18761
|
+
summary: "Update a flag's environment",
|
|
18762
|
+
description: "Change what one environment of a flag serves: whether it is on, its targeting rules, its prerequisite flags, its individually targeted keys, its fallthrough, and the progressive rollout it runs. This is the write that changes runtime behaviour, so it is versioned: send the version you read and a change based on a stale version is refused with FLAG_VERSION_CONFLICT instead of silently overwriting someone else's edit. comment records why the configuration changed, next to the change itself. Targets whose keys are not deployed yet are refused with FLAG_CODE_NOT_DEPLOYED, because serving a variation the running code cannot name would fail at evaluation time.",
|
|
18763
|
+
http: "PATCH",
|
|
18764
|
+
path: "/devops/v1/flags/{id}/environments/{environment}",
|
|
18765
|
+
streaming: "no",
|
|
18766
|
+
pagination: false,
|
|
18767
|
+
pathParams: [
|
|
18768
|
+
{
|
|
18769
|
+
name: "id",
|
|
18770
|
+
sdkName: "id",
|
|
18771
|
+
description: "The flag identifier from a flag list or create answer; code names a flag by its key, while this API addresses it by id."
|
|
18772
|
+
},
|
|
18773
|
+
{
|
|
18774
|
+
name: "environment",
|
|
18775
|
+
sdkName: "environment",
|
|
18776
|
+
description: "The environment whose configuration you are changing, from the flag's own environments map or the project's environment list."
|
|
18777
|
+
}
|
|
18778
|
+
],
|
|
18779
|
+
query: [],
|
|
18780
|
+
body: {
|
|
18781
|
+
required: true,
|
|
18782
|
+
fields: [
|
|
18783
|
+
{
|
|
18784
|
+
name: "version",
|
|
18785
|
+
type: "number",
|
|
18786
|
+
required: true,
|
|
18787
|
+
description: "The configuration version you read before making this change; when the environment has moved past it the write is refused with FLAG_VERSION_CONFLICT rather than overwriting."
|
|
18788
|
+
},
|
|
18789
|
+
{
|
|
18790
|
+
name: "comment",
|
|
18791
|
+
type: "string",
|
|
18792
|
+
required: true,
|
|
18793
|
+
description: "Why the configuration is changing, stored with the change so the history reads as decisions rather than as diffs."
|
|
18794
|
+
},
|
|
18795
|
+
{
|
|
18796
|
+
name: "config",
|
|
18797
|
+
type: "object",
|
|
18798
|
+
required: true,
|
|
18799
|
+
description: "The configuration to write for one environment. This call replaces the whole configuration, so send what you read with your change applied rather than only the changed part."
|
|
18800
|
+
}
|
|
18801
|
+
]
|
|
18802
|
+
}
|
|
18803
|
+
},
|
|
18804
|
+
{
|
|
18805
|
+
resource: "devops.flags",
|
|
18806
|
+
method: "archive",
|
|
18807
|
+
summary: "Archive a flag",
|
|
18808
|
+
description: "Archive a flag once it is no longer needed: it stops evaluating in every environment, leaves the ordinary flag list, and keeps its key and history. Use it for a flag whose code has been removed and whose key nothing names any more; codeRefs.count on the flag is what tells you whether that is true. Archiving is the terminal lifecycle state — an archived flag is never un-archived and its key is never reused, so a flag that may come back is turned off in its environment instead. The key stays reserved, which is why a later create with the same key is refused.",
|
|
18809
|
+
http: "POST",
|
|
18810
|
+
path: "/devops/v1/flags/{id}:archive",
|
|
18811
|
+
streaming: "no",
|
|
18812
|
+
pagination: false,
|
|
18813
|
+
pathParams: [
|
|
18814
|
+
{
|
|
18815
|
+
name: "id",
|
|
18816
|
+
sdkName: "id",
|
|
18817
|
+
description: "The flag identifier from a flag list or create answer; code names a flag by its key, while this API addresses it by id."
|
|
18818
|
+
}
|
|
18819
|
+
],
|
|
18820
|
+
query: []
|
|
18821
|
+
},
|
|
18822
|
+
{
|
|
18823
|
+
resource: "devops.flags",
|
|
18824
|
+
method: "conclude",
|
|
18825
|
+
summary: "Conclude a flag",
|
|
18826
|
+
description: "Record the decision a temporary flag's observation window ended with: promote makes the chosen variation the permanent behaviour and moves the flag to launched, rollback returns the environment to its off behaviour, and extend keeps observing with a new observeUntil deadline. reason is stored as the attribution of the decision. This is the act the observation flag machinery requires when the deadline arrives, so an expired flag is concluded rather than left standing. A promote or rollback finishes the flag's rollout; the code and the flag are then removed by the ticket the flag recorded, which this call does not do.",
|
|
18827
|
+
http: "POST",
|
|
18828
|
+
path: "/devops/v1/flags/{id}:conclude",
|
|
18829
|
+
streaming: "no",
|
|
18830
|
+
pagination: false,
|
|
18831
|
+
pathParams: [
|
|
18832
|
+
{
|
|
18833
|
+
name: "id",
|
|
18834
|
+
sdkName: "id",
|
|
18835
|
+
description: "The flag identifier from a flag list or create answer; code names a flag by its key, while this API addresses it by id."
|
|
18836
|
+
}
|
|
18837
|
+
],
|
|
18838
|
+
query: [],
|
|
18839
|
+
body: {
|
|
18840
|
+
required: true,
|
|
18841
|
+
fields: [
|
|
18842
|
+
{
|
|
18843
|
+
name: "action",
|
|
18844
|
+
type: "string",
|
|
18845
|
+
enum: [
|
|
18846
|
+
"promote",
|
|
18847
|
+
"rollback",
|
|
18848
|
+
"extend"
|
|
18849
|
+
],
|
|
18850
|
+
required: true,
|
|
18851
|
+
description: "What the deadline decided; promote and rollback finish the flag's rollout, while extend keeps it running with a new deadline."
|
|
18852
|
+
},
|
|
18853
|
+
{
|
|
18854
|
+
name: "observeUntil",
|
|
18855
|
+
type: "string",
|
|
18856
|
+
required: false,
|
|
18857
|
+
description: "The new deadline, required by extend and refused with the others; it must be later than the deadline being replaced."
|
|
18858
|
+
},
|
|
18859
|
+
{
|
|
18860
|
+
name: "reason",
|
|
18861
|
+
type: "string",
|
|
18862
|
+
required: true,
|
|
18863
|
+
description: "Why the decision went this way, recorded on the flag as the attribution the observation machinery requires."
|
|
18864
|
+
}
|
|
18865
|
+
]
|
|
18866
|
+
}
|
|
18867
|
+
},
|
|
18868
|
+
{
|
|
18869
|
+
resource: "devops.progressiveRollouts",
|
|
18870
|
+
method: "create",
|
|
18871
|
+
summary: "Create a progressive rollout",
|
|
18872
|
+
description: "Start a staged rollout of one variation of a flag in one environment: the steps are percentages with a hold time each, and the guard says which signals are watched and whether a bad reading pauses the rollout or rolls it back. Use it instead of turning a flag fully on, so a bad variation is caught at a small percentage. bucketBy names the context attribute that decides which bucket a caller falls into, so the same caller stays in the same bucket across steps. One progressive rollout runs per flag and environment; a second one while the first is active is refused with ROLLOUT_ALREADY_ACTIVE.",
|
|
18873
|
+
http: "POST",
|
|
18874
|
+
path: "/devops/v1/progressive-rollouts",
|
|
18875
|
+
streaming: "no",
|
|
18876
|
+
pagination: false,
|
|
18877
|
+
pathParams: [],
|
|
18878
|
+
query: [],
|
|
18879
|
+
body: {
|
|
18880
|
+
required: true,
|
|
18881
|
+
fields: [
|
|
18882
|
+
{
|
|
18883
|
+
name: "flag",
|
|
18884
|
+
type: "string",
|
|
18885
|
+
required: true,
|
|
18886
|
+
description: "The flag to ramp; it must not be archived, its environment must already be on, and its configuration must exist there."
|
|
18887
|
+
},
|
|
18888
|
+
{
|
|
18889
|
+
name: "environment",
|
|
18890
|
+
type: "string",
|
|
18891
|
+
required: true,
|
|
18892
|
+
description: "The environment to ramp in; the flag must be on there already, because ramping an off environment would serve nobody."
|
|
18893
|
+
},
|
|
18894
|
+
{
|
|
18895
|
+
name: "variation",
|
|
18896
|
+
type: "string",
|
|
18897
|
+
required: true,
|
|
18898
|
+
description: "The variation to ramp up; it must be one of the flag's variations and must not be the off variation, which is what the rest of the callers already get."
|
|
18899
|
+
},
|
|
18900
|
+
{
|
|
18901
|
+
name: "bucketBy",
|
|
18902
|
+
type: "string",
|
|
18903
|
+
required: false,
|
|
18904
|
+
description: "Which context attribute decides a caller's bucket; omit it to bucket by the targeting key, which keeps one caller on one side."
|
|
18905
|
+
},
|
|
18906
|
+
{
|
|
18907
|
+
name: "steps",
|
|
18908
|
+
type: "array",
|
|
18909
|
+
itemType: "object",
|
|
18910
|
+
required: true,
|
|
18911
|
+
description: "The steps to walk, at least one; percentages must be whole numbers from 0 to 100 that never decrease, and the first step takes effect immediately."
|
|
18912
|
+
},
|
|
18913
|
+
{
|
|
18914
|
+
name: "guard",
|
|
18915
|
+
type: "object",
|
|
18916
|
+
required: true,
|
|
18917
|
+
description: "What is watched while a rollout runs, and what happens when a reading is bad."
|
|
18918
|
+
}
|
|
18919
|
+
]
|
|
18920
|
+
}
|
|
18921
|
+
},
|
|
18922
|
+
{
|
|
18923
|
+
resource: "devops.progressiveRollouts",
|
|
18924
|
+
method: "retrieve",
|
|
18925
|
+
summary: "Retrieve a progressive rollout",
|
|
18926
|
+
description: "Read one progressive rollout: which step it is on, how much of the audience that is, when the next step is due, and every step it has already taken with who moved it and why. Poll it to follow a rollout, and read history to find out why it paused or rolled back — a guard that fired leaves the step and the reason there. state scheduled means the first step has not started, running means it is advancing on its hold times, and rolled_back is terminal. nextStepTime is the time the current hold ends.",
|
|
18927
|
+
http: "GET",
|
|
18928
|
+
path: "/devops/v1/progressive-rollouts/{id}",
|
|
18929
|
+
streaming: "no",
|
|
18930
|
+
pagination: false,
|
|
18931
|
+
pathParams: [
|
|
18932
|
+
{
|
|
18933
|
+
name: "id",
|
|
18934
|
+
sdkName: "id",
|
|
18935
|
+
description: "The progressive rollout identifier returned by the progressive rollout create answer."
|
|
18936
|
+
}
|
|
18937
|
+
],
|
|
18938
|
+
query: []
|
|
18939
|
+
},
|
|
18940
|
+
{
|
|
18941
|
+
resource: "devops.progressiveRollouts",
|
|
18942
|
+
method: "pause",
|
|
18943
|
+
summary: "Pause a progressive rollout",
|
|
18944
|
+
description: "Hold a running progressive rollout at its current percentage: no further step is taken until it is resumed, and the percentage already served keeps being served. Use it when a guard signal looks wrong but not wrong enough to roll back, so a person can look before the rollout advances. reason is recorded on the rollout as the attribution of the hold. Pausing a rollout that already completed or was rolled back is refused; read it first to see whether there is anything to hold.",
|
|
18945
|
+
http: "POST",
|
|
18946
|
+
path: "/devops/v1/progressive-rollouts/{id}:pause",
|
|
18947
|
+
streaming: "no",
|
|
18948
|
+
pagination: false,
|
|
18949
|
+
pathParams: [
|
|
18950
|
+
{
|
|
18951
|
+
name: "id",
|
|
18952
|
+
sdkName: "id",
|
|
18953
|
+
description: "The progressive rollout identifier returned by the progressive rollout create answer."
|
|
18954
|
+
}
|
|
18955
|
+
],
|
|
18956
|
+
query: [],
|
|
18957
|
+
body: {
|
|
18958
|
+
required: true,
|
|
18959
|
+
fields: [
|
|
18960
|
+
{
|
|
18961
|
+
name: "reason",
|
|
18962
|
+
type: "string",
|
|
18963
|
+
required: true,
|
|
18964
|
+
description: "Why the rollout is being paused or rolled back, recorded verbatim in the rollout's history as the attribution of the act."
|
|
18965
|
+
}
|
|
18966
|
+
]
|
|
18967
|
+
}
|
|
18968
|
+
},
|
|
18969
|
+
{
|
|
18970
|
+
resource: "devops.progressiveRollouts",
|
|
18971
|
+
method: "resume",
|
|
18972
|
+
summary: "Resume a progressive rollout",
|
|
18973
|
+
description: "Continue a paused progressive rollout from the step it stopped at, restarting the hold time for the current step rather than skipping it. Use it after a pause has been looked into and the rollout is judged safe to continue. A rollout that is running already, or that finished, is refused; read it first to see whether it is paused. The resumption is attributed to the credential that sends it and recorded in the rollout's step history.",
|
|
18974
|
+
http: "POST",
|
|
18975
|
+
path: "/devops/v1/progressive-rollouts/{id}:resume",
|
|
18976
|
+
streaming: "no",
|
|
18977
|
+
pagination: false,
|
|
18978
|
+
pathParams: [
|
|
18979
|
+
{
|
|
18980
|
+
name: "id",
|
|
18981
|
+
sdkName: "id",
|
|
18982
|
+
description: "The progressive rollout identifier returned by the progressive rollout create answer."
|
|
18983
|
+
}
|
|
18984
|
+
],
|
|
18985
|
+
query: []
|
|
18986
|
+
},
|
|
18987
|
+
{
|
|
18988
|
+
resource: "devops.progressiveRollouts",
|
|
18989
|
+
method: "rollback",
|
|
18990
|
+
summary: "Roll back a progressive rollout",
|
|
18991
|
+
description: "End a progressive rollout by returning the flag's environment to the variation it served before the rollout started, so the audience that was already switched over goes back. Use it when a guard signal says the variation is bad and waiting for the next step would expose more callers. reason is recorded on the rollout as the attribution of the decision. The rollback is terminal: the rollout does not restart, and a new rollout is created if the variation should be tried again. It changes what the environment serves, not the flag's other environments.",
|
|
18992
|
+
http: "POST",
|
|
18993
|
+
path: "/devops/v1/progressive-rollouts/{id}:rollback",
|
|
18994
|
+
streaming: "no",
|
|
18995
|
+
pagination: false,
|
|
18996
|
+
pathParams: [
|
|
18997
|
+
{
|
|
18998
|
+
name: "id",
|
|
18999
|
+
sdkName: "id",
|
|
19000
|
+
description: "The progressive rollout identifier returned by the progressive rollout create answer."
|
|
19001
|
+
}
|
|
19002
|
+
],
|
|
19003
|
+
query: [],
|
|
19004
|
+
body: {
|
|
19005
|
+
required: true,
|
|
19006
|
+
fields: [
|
|
19007
|
+
{
|
|
19008
|
+
name: "reason",
|
|
19009
|
+
type: "string",
|
|
19010
|
+
required: true,
|
|
19011
|
+
description: "Why the rollout is being paused or rolled back, recorded verbatim in the rollout's history as the attribution of the act."
|
|
19012
|
+
}
|
|
19013
|
+
]
|
|
19014
|
+
}
|
|
19015
|
+
},
|
|
19016
|
+
{
|
|
19017
|
+
resource: "devops.projects",
|
|
19018
|
+
method: "list",
|
|
19019
|
+
summary: "List projects",
|
|
19020
|
+
description: "List the delivery projects this organization has, newest first, with each project's repository binding and settings. Call this first when you do not already hold a project id: every other operation in this domain is addressed by one. A project from another organization is never listed, so an empty page means this organization has none rather than that they are hidden. The order is by creation time descending; follow nextPageToken until it is empty to see them all.",
|
|
19021
|
+
http: "GET",
|
|
19022
|
+
path: "/devops/v1/projects",
|
|
19023
|
+
streaming: "no",
|
|
19024
|
+
pagination: false,
|
|
19025
|
+
pathParams: [],
|
|
19026
|
+
query: [
|
|
19027
|
+
{
|
|
19028
|
+
name: "pageSize",
|
|
19029
|
+
type: "integer",
|
|
19030
|
+
required: false,
|
|
19031
|
+
description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
|
|
19032
|
+
},
|
|
19033
|
+
{
|
|
19034
|
+
name: "pageToken",
|
|
19035
|
+
type: "string",
|
|
19036
|
+
required: false,
|
|
19037
|
+
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
19038
|
+
}
|
|
19039
|
+
]
|
|
19040
|
+
},
|
|
19041
|
+
{
|
|
19042
|
+
resource: "devops.projects",
|
|
19043
|
+
method: "retrieve",
|
|
19044
|
+
summary: "Retrieve a project",
|
|
19045
|
+
description: "Read one project by id: its repository binding, its release schedule and its gate settings. Use it to confirm a project's configuration before releasing into it, and to learn which environment a promotion order starts from. A project that was deleted, or that belongs to another organization, answers PROJECT_NOT_FOUND — the two are indistinguishable on purpose, so the answer never tells you whether a project exists elsewhere.",
|
|
19046
|
+
http: "GET",
|
|
19047
|
+
path: "/devops/v1/projects/{id}",
|
|
19048
|
+
streaming: "no",
|
|
19049
|
+
pagination: false,
|
|
19050
|
+
pathParams: [
|
|
19051
|
+
{
|
|
19052
|
+
name: "id",
|
|
19053
|
+
sdkName: "id",
|
|
19054
|
+
description: "The project identifier returned by the project list, not the project's display name or its repository name."
|
|
19055
|
+
}
|
|
19056
|
+
],
|
|
19057
|
+
query: []
|
|
19058
|
+
},
|
|
19059
|
+
{
|
|
19060
|
+
resource: "devops.projects.environments",
|
|
19061
|
+
method: "list",
|
|
19062
|
+
summary: "List environments",
|
|
19063
|
+
description: "List the project's environments in promotion order: development first, production last. order is the promotion sequence, so the environment before the one you are promoting into is the one that must have verified the release first. Each entry carries its tier, whether it requires approval, and whether its queue is idle or busy; a busy queue names the promotion holding it and how many wait behind. This collection is not paged: a project has few environments and the whole ordered list is the answer.",
|
|
19064
|
+
http: "GET",
|
|
19065
|
+
path: "/devops/v1/projects/{project}/environments",
|
|
19066
|
+
streaming: "no",
|
|
19067
|
+
pagination: false,
|
|
19068
|
+
pathParams: [
|
|
19069
|
+
{
|
|
19070
|
+
name: "project",
|
|
19071
|
+
sdkName: "project",
|
|
19072
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19073
|
+
}
|
|
19074
|
+
],
|
|
19075
|
+
query: []
|
|
19076
|
+
},
|
|
19077
|
+
{
|
|
19078
|
+
resource: "devops.projects.flags",
|
|
19079
|
+
method: "list",
|
|
19080
|
+
summary: "List flags",
|
|
19081
|
+
description: "List the project's flags with their per-environment configuration, newest first. Use it to find a flag by key when code names one, and to review the flags of a project — the entries carry lifecycle, staleness, the observation deadline and the removal ticket, which is what an expiry review reads. filter accepts exactly one term, lifecycle=archived, to list the archived flags instead of the live ones; any other filter or orderBy is refused rather than ignored. totalSize is answered on the first page only.",
|
|
19082
|
+
http: "GET",
|
|
19083
|
+
path: "/devops/v1/projects/{project}/flags",
|
|
19084
|
+
streaming: "no",
|
|
19085
|
+
pagination: false,
|
|
19086
|
+
pathParams: [
|
|
19087
|
+
{
|
|
19088
|
+
name: "project",
|
|
19089
|
+
sdkName: "project",
|
|
19090
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19091
|
+
}
|
|
19092
|
+
],
|
|
19093
|
+
query: [
|
|
19094
|
+
{
|
|
19095
|
+
name: "pageSize",
|
|
19096
|
+
type: "integer",
|
|
19097
|
+
required: false,
|
|
19098
|
+
description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
|
|
19099
|
+
},
|
|
19100
|
+
{
|
|
19101
|
+
name: "pageToken",
|
|
19102
|
+
type: "string",
|
|
19103
|
+
required: false,
|
|
19104
|
+
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
19105
|
+
},
|
|
19106
|
+
{
|
|
19107
|
+
name: "filter",
|
|
19108
|
+
type: "string",
|
|
19109
|
+
required: false,
|
|
19110
|
+
description: "Exactly one filter term is accepted: lifecycle=archived lists the archived flags, which are hidden by default. Any other field, operator or value is refused with INVALID_ARGUMENT rather than ignored."
|
|
19111
|
+
}
|
|
19112
|
+
]
|
|
19113
|
+
},
|
|
19114
|
+
{
|
|
19115
|
+
resource: "devops.projects.flags",
|
|
19116
|
+
method: "create",
|
|
19117
|
+
summary: "Create a flag",
|
|
19118
|
+
description: "Create a feature flag in a project: its key, what kind of flag it is, the values it can serve, and which variation is served when it is off. The key is what code names, so it is unique per project and a key already in use is refused with FLAG_KEY_TAKEN rather than reused — an archived flag keeps its key. owner, observeUntil and removalTicket carry the flag's lifecycle: a release or experiment flag expects an observation deadline and the ticket that removes it, and a flag missing them is refused with FLAG_LIFECYCLE_INCOMPLETE. A new flag starts with every environment off, so creating one changes no runtime behaviour; turn an environment on with the environment update.",
|
|
19119
|
+
http: "POST",
|
|
19120
|
+
path: "/devops/v1/projects/{project}/flags",
|
|
19121
|
+
streaming: "no",
|
|
19122
|
+
pagination: false,
|
|
19123
|
+
pathParams: [
|
|
19124
|
+
{
|
|
19125
|
+
name: "project",
|
|
19126
|
+
sdkName: "project",
|
|
19127
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19128
|
+
}
|
|
19129
|
+
],
|
|
19130
|
+
query: [],
|
|
19131
|
+
body: {
|
|
19132
|
+
required: true,
|
|
19133
|
+
fields: [
|
|
19134
|
+
{
|
|
19135
|
+
name: "key",
|
|
19136
|
+
type: "string",
|
|
19137
|
+
required: true,
|
|
19138
|
+
description: "The name code will call this flag by; unique inside the project, and a key already in use is refused with FLAG_KEY_TAKEN rather than reused."
|
|
19139
|
+
},
|
|
19140
|
+
{
|
|
19141
|
+
name: "name",
|
|
19142
|
+
type: "string",
|
|
19143
|
+
required: true,
|
|
19144
|
+
description: "Display name of the flag, shown wherever it is listed."
|
|
19145
|
+
},
|
|
19146
|
+
{
|
|
19147
|
+
name: "description",
|
|
19148
|
+
type: "string",
|
|
19149
|
+
required: false,
|
|
19150
|
+
description: "What this flag does to the product, so a later reader does not have to trace the code to find out."
|
|
19151
|
+
},
|
|
19152
|
+
{
|
|
19153
|
+
name: "kind",
|
|
19154
|
+
type: "string",
|
|
19155
|
+
enum: [
|
|
19156
|
+
"release",
|
|
19157
|
+
"experiment",
|
|
19158
|
+
"ops",
|
|
19159
|
+
"permission"
|
|
19160
|
+
],
|
|
19161
|
+
required: true,
|
|
19162
|
+
description: "What sort of flag this is; it decides the expected lifetime, and a release or experiment flag must carry an observation deadline."
|
|
19163
|
+
},
|
|
19164
|
+
{
|
|
19165
|
+
name: "valueType",
|
|
19166
|
+
type: "string",
|
|
19167
|
+
enum: [
|
|
19168
|
+
"boolean",
|
|
19169
|
+
"string",
|
|
19170
|
+
"number",
|
|
19171
|
+
"object"
|
|
19172
|
+
],
|
|
19173
|
+
required: true,
|
|
19174
|
+
description: "The type every variation must have; a variation of another type is refused."
|
|
19175
|
+
},
|
|
19176
|
+
{
|
|
19177
|
+
name: "variations",
|
|
19178
|
+
type: "array",
|
|
19179
|
+
itemType: "object",
|
|
19180
|
+
required: true,
|
|
19181
|
+
description: "The values the flag can serve, at least two for a flag that decides anything; their ids are what defaults and rules name."
|
|
19182
|
+
},
|
|
19183
|
+
{
|
|
19184
|
+
name: "defaults",
|
|
19185
|
+
type: "object",
|
|
19186
|
+
required: true,
|
|
19187
|
+
description: "The variations a flag falls back to: what a caller that matches nothing gets when the flag is on, and what everyone gets when it is off."
|
|
19188
|
+
},
|
|
19189
|
+
{
|
|
19190
|
+
name: "owner",
|
|
19191
|
+
type: "object",
|
|
19192
|
+
required: false,
|
|
19193
|
+
description: "Who performed an action, so a state change or a run can be attributed rather than guessed at."
|
|
19194
|
+
},
|
|
19195
|
+
{
|
|
19196
|
+
name: "observeUntil",
|
|
19197
|
+
type: "string",
|
|
19198
|
+
required: false,
|
|
19199
|
+
description: "RFC 3339 UTC time this flag must be decided by; required for a release or experiment flag and refused with INVALID_ARGUMENT when it is missing."
|
|
19200
|
+
},
|
|
19201
|
+
{
|
|
19202
|
+
name: "removalTicket",
|
|
19203
|
+
type: "string",
|
|
19204
|
+
required: false,
|
|
19205
|
+
description: "The ticket that will remove the flag and its code; giving it here is what makes the removal traceable from the flag itself."
|
|
19206
|
+
},
|
|
19207
|
+
{
|
|
19208
|
+
name: "pullRequest",
|
|
19209
|
+
type: "string",
|
|
19210
|
+
required: false,
|
|
19211
|
+
description: "The pull request that declared this flag, when the flag comes from a code change rather than being created by hand."
|
|
19212
|
+
},
|
|
19213
|
+
{
|
|
19214
|
+
name: "requestId",
|
|
19215
|
+
type: "string",
|
|
19216
|
+
required: false,
|
|
19217
|
+
description: "Caller-chosen key that makes this create idempotent: repeating it answers the flag the first call created instead of refusing the key as taken."
|
|
19218
|
+
}
|
|
19219
|
+
]
|
|
19220
|
+
}
|
|
19221
|
+
},
|
|
19222
|
+
{
|
|
19223
|
+
resource: "devops.projects.promotions",
|
|
19224
|
+
method: "list",
|
|
19225
|
+
summary: "List promotions",
|
|
19226
|
+
description: `List the project's promotions, newest first, across every environment. Use it to see what is queued, what is observing, and what finished recently, without reading each environment separately. A promotion in a terminal state stays in this list, which is how a caller tells "never promoted" apart from "promoted and then rolled back". Neither filter nor orderBy is accepted yet, so page through with pageToken instead of narrowing the query.`,
|
|
19227
|
+
http: "GET",
|
|
19228
|
+
path: "/devops/v1/projects/{project}/promotions",
|
|
19229
|
+
streaming: "no",
|
|
19230
|
+
pagination: false,
|
|
19231
|
+
pathParams: [
|
|
19232
|
+
{
|
|
19233
|
+
name: "project",
|
|
19234
|
+
sdkName: "project",
|
|
19235
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19236
|
+
}
|
|
19237
|
+
],
|
|
19238
|
+
query: [
|
|
19239
|
+
{
|
|
19240
|
+
name: "pageSize",
|
|
19241
|
+
type: "integer",
|
|
19242
|
+
required: false,
|
|
19243
|
+
description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
|
|
19244
|
+
},
|
|
19245
|
+
{
|
|
19246
|
+
name: "pageToken",
|
|
19247
|
+
type: "string",
|
|
19248
|
+
required: false,
|
|
19249
|
+
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
19250
|
+
}
|
|
19251
|
+
]
|
|
19252
|
+
},
|
|
19253
|
+
{
|
|
19254
|
+
resource: "devops.projects.releases",
|
|
19255
|
+
method: "list",
|
|
19256
|
+
summary: "List releases",
|
|
19257
|
+
description: "List the project's releases, newest first. Use it to find the release a promotion should carry, or to see what has been released recently and whether any of it was abandoned. The list carries the render state and the abandoned flag, so a caller can skip a release that is still rendering or that was withdrawn without reading each one. Neither filter nor orderBy is accepted on this collection yet; a request that sends one is refused rather than silently ignored.",
|
|
19258
|
+
http: "GET",
|
|
19259
|
+
path: "/devops/v1/projects/{project}/releases",
|
|
19260
|
+
streaming: "no",
|
|
19261
|
+
pagination: false,
|
|
19262
|
+
pathParams: [
|
|
19263
|
+
{
|
|
19264
|
+
name: "project",
|
|
19265
|
+
sdkName: "project",
|
|
19266
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19267
|
+
}
|
|
19268
|
+
],
|
|
19269
|
+
query: [
|
|
19270
|
+
{
|
|
19271
|
+
name: "pageSize",
|
|
19272
|
+
type: "integer",
|
|
19273
|
+
required: false,
|
|
19274
|
+
description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
|
|
19275
|
+
},
|
|
19276
|
+
{
|
|
19277
|
+
name: "pageToken",
|
|
19278
|
+
type: "string",
|
|
19279
|
+
required: false,
|
|
19280
|
+
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
19281
|
+
}
|
|
19282
|
+
]
|
|
19283
|
+
},
|
|
19284
|
+
{
|
|
19285
|
+
resource: "devops.projects.releases",
|
|
19286
|
+
method: "create",
|
|
19287
|
+
summary: "Create a release",
|
|
19288
|
+
description: "Create a release: an immutable snapshot of what will be deployed, named and fingerprinted once so later promotions can be compared against it. Send commit to release a commit as it stands, or base plus picks to build a patch release on a release that is already in production; the two shapes are exclusive and the patch shape is refused with PATCH_NOT_ELIGIBLE when the picks do not qualify. Rendering starts immediately and the answer reports its state; a promotion refuses a release that is still rendering with RELEASE_NOT_READY rather than deploying half of it. Set validateOnly to see the plan and the refusals without writing a release, and requestId to make a retry of the same call answer the first release instead of creating a second.",
|
|
19289
|
+
http: "POST",
|
|
19290
|
+
path: "/devops/v1/projects/{project}/releases",
|
|
19291
|
+
streaming: "no",
|
|
19292
|
+
pagination: false,
|
|
19293
|
+
pathParams: [
|
|
19294
|
+
{
|
|
19295
|
+
name: "project",
|
|
19296
|
+
sdkName: "project",
|
|
19297
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19298
|
+
}
|
|
19299
|
+
],
|
|
19300
|
+
query: [],
|
|
19301
|
+
body: {
|
|
19302
|
+
required: true,
|
|
19303
|
+
fields: [
|
|
19304
|
+
{
|
|
19305
|
+
name: "commit",
|
|
19306
|
+
type: "string",
|
|
19307
|
+
required: false,
|
|
19308
|
+
description: "Full 40-character commit to release as it stands; give this or base with picks, never both."
|
|
19309
|
+
},
|
|
19310
|
+
{
|
|
19311
|
+
name: "base",
|
|
19312
|
+
type: "string",
|
|
19313
|
+
required: false,
|
|
19314
|
+
description: "The production release a patch is built on; give it together with picks, and only when production currently runs that release."
|
|
19315
|
+
},
|
|
19316
|
+
{
|
|
19317
|
+
name: "picks",
|
|
19318
|
+
type: "array",
|
|
19319
|
+
itemType: "string",
|
|
19320
|
+
required: false,
|
|
19321
|
+
description: "The commits to cherry-pick onto base, in the request; each must be on the default branch and already verified below production. Request order is not the order they land in."
|
|
19322
|
+
},
|
|
19323
|
+
{
|
|
19324
|
+
name: "validateOnly",
|
|
19325
|
+
type: "boolean",
|
|
19326
|
+
required: false,
|
|
19327
|
+
description: "True to check the request and answer the plan and its refusals without creating a release; use it to find out whether a patch qualifies before committing to it."
|
|
19328
|
+
},
|
|
19329
|
+
{
|
|
19330
|
+
name: "requestId",
|
|
19331
|
+
type: "string",
|
|
19332
|
+
required: false,
|
|
19333
|
+
description: "Caller-chosen key that makes this call idempotent: repeating it answers the release the first call created instead of cutting a second one. Reuse it only for the same content."
|
|
19334
|
+
}
|
|
19335
|
+
]
|
|
19336
|
+
}
|
|
19337
|
+
},
|
|
19338
|
+
{
|
|
19339
|
+
resource: "devops.projects.targets",
|
|
19340
|
+
method: "list",
|
|
19341
|
+
summary: "List targets",
|
|
19342
|
+
description: "List what the project deploys — one target per deployable path in the repository, with its kind, its destination and the targets it depends on. Targets are discovered from the code, not entered by hand, so this list is the service's reading of the repository rather than a configuration you maintain here. A project whose catalog has never been read has it read on the first call, at the default branch's head, so the first answer is already the catalog instead of an empty page. Archived targets, which the repository no longer deploys, are left out.",
|
|
19343
|
+
http: "GET",
|
|
19344
|
+
path: "/devops/v1/projects/{project}/targets",
|
|
19345
|
+
streaming: "no",
|
|
19346
|
+
pagination: false,
|
|
19347
|
+
pathParams: [
|
|
19348
|
+
{
|
|
19349
|
+
name: "project",
|
|
19350
|
+
sdkName: "project",
|
|
19351
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19352
|
+
}
|
|
19353
|
+
],
|
|
19354
|
+
query: [
|
|
19355
|
+
{
|
|
19356
|
+
name: "pageSize",
|
|
19357
|
+
type: "integer",
|
|
19358
|
+
required: false,
|
|
19359
|
+
description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
|
|
19360
|
+
},
|
|
19361
|
+
{
|
|
19362
|
+
name: "pageToken",
|
|
19363
|
+
type: "string",
|
|
19364
|
+
required: false,
|
|
19365
|
+
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
19366
|
+
}
|
|
19367
|
+
]
|
|
19368
|
+
},
|
|
19369
|
+
{
|
|
19370
|
+
resource: "devops.projects.targets",
|
|
19371
|
+
method: "refresh",
|
|
19372
|
+
summary: "Refresh the target catalog",
|
|
19373
|
+
description: "Re-read the repository at a commit and answer the deployment targets it implies, recording what was found. Call it after adding or removing a deployable service so later promotions see the current layout; omit commit to read the default branch's head, or name one to read that commit. The answer includes the dependency graph and any cycles in it, and a cycle is reported rather than refused, matching how the deploy pipeline treats one. This is a read of the repository that also remembers what it read, so it is safe to call again; nothing is deployed by it.",
|
|
19374
|
+
http: "POST",
|
|
19375
|
+
path: "/devops/v1/projects/{project}/targets:refresh",
|
|
19376
|
+
streaming: "no",
|
|
19377
|
+
pagination: false,
|
|
19378
|
+
pathParams: [
|
|
19379
|
+
{
|
|
19380
|
+
name: "project",
|
|
19381
|
+
sdkName: "project",
|
|
19382
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19383
|
+
}
|
|
19384
|
+
],
|
|
19385
|
+
query: [],
|
|
19386
|
+
body: {
|
|
19387
|
+
required: false,
|
|
19388
|
+
fields: [
|
|
19389
|
+
{
|
|
19390
|
+
name: "commit",
|
|
19391
|
+
type: "string",
|
|
19392
|
+
required: false,
|
|
19393
|
+
description: "Full 40-character commit sha to read instead of the default branch's head; use it to see what a past commit implied rather than what the branch says now."
|
|
19394
|
+
}
|
|
19395
|
+
]
|
|
19396
|
+
}
|
|
19397
|
+
},
|
|
18685
19398
|
{
|
|
18686
19399
|
resource: "devops.projects.testCases",
|
|
18687
19400
|
method: "list",
|
|
@@ -18957,12 +19670,129 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
18957
19670
|
required: false,
|
|
18958
19671
|
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
18959
19672
|
},
|
|
18960
|
-
{
|
|
18961
|
-
name: "filter",
|
|
18962
|
-
type: "string",
|
|
18963
|
-
required: false,
|
|
18964
|
-
description: "AIP-160 equality filter over one declared field, for example state=running or result=failed. An undeclared field is refused with INVALID_ARGUMENT; it is never ignored, so a mistyped filter cannot quietly return everything."
|
|
18965
|
-
},
|
|
19673
|
+
{
|
|
19674
|
+
name: "filter",
|
|
19675
|
+
type: "string",
|
|
19676
|
+
required: false,
|
|
19677
|
+
description: "AIP-160 equality filter over one declared field, for example state=running or result=failed. An undeclared field is refused with INVALID_ARGUMENT; it is never ignored, so a mistyped filter cannot quietly return everything."
|
|
19678
|
+
},
|
|
19679
|
+
{
|
|
19680
|
+
name: "orderBy",
|
|
19681
|
+
type: "string",
|
|
19682
|
+
required: false,
|
|
19683
|
+
description: "Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource's own order."
|
|
19684
|
+
}
|
|
19685
|
+
]
|
|
19686
|
+
},
|
|
19687
|
+
{
|
|
19688
|
+
resource: "devops.projects.testRuns",
|
|
19689
|
+
method: "create",
|
|
19690
|
+
summary: "Create a test run",
|
|
19691
|
+
description: "Start a run of the project's tests at one commit. Name a plan to use its selector, or pass a selector directly for this run alone; the ref says which commit to test and is required, because a run without a commit has nothing to report against. waitUntil decides how far the call waits before answering — queued, the default, returns as soon as the run exists; started waits until the run has begun, except for an external run, which is answered at once because it leaves queued only when your own CI uploads; finished waits for a verdict. The wait is bounded at about 25 seconds, and a wait that reaches that bound returns the run as it stands rather than failing — read state to see whether it finished. A retry of an earlier run is a new run: pass its commit and selector, and read the earlier run to compare.",
|
|
19692
|
+
http: "POST",
|
|
19693
|
+
path: "/devops/v1/projects/{project}/test-runs",
|
|
19694
|
+
streaming: "no",
|
|
19695
|
+
pagination: false,
|
|
19696
|
+
pathParams: [
|
|
19697
|
+
{
|
|
19698
|
+
name: "project",
|
|
19699
|
+
sdkName: "project",
|
|
19700
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19701
|
+
}
|
|
19702
|
+
],
|
|
19703
|
+
query: [],
|
|
19704
|
+
body: {
|
|
19705
|
+
required: true,
|
|
19706
|
+
fields: [
|
|
19707
|
+
{
|
|
19708
|
+
name: "ref",
|
|
19709
|
+
type: "object",
|
|
19710
|
+
required: true,
|
|
19711
|
+
description: "The exact revision a run tested. A commit is always named, because a run without one has nothing to report against."
|
|
19712
|
+
},
|
|
19713
|
+
{
|
|
19714
|
+
name: "plan",
|
|
19715
|
+
type: "string",
|
|
19716
|
+
required: false,
|
|
19717
|
+
description: "Plan whose selector this run uses; omit it when passing selector instead. Naming a plan records the run against that plan, which is what a gate reads."
|
|
19718
|
+
},
|
|
19719
|
+
{
|
|
19720
|
+
name: "selector",
|
|
19721
|
+
type: "object",
|
|
19722
|
+
required: false,
|
|
19723
|
+
description: "An ad-hoc selector for this run alone, used instead of a plan's; it is not saved as a plan, so a run you want to repeat should name a plan."
|
|
19724
|
+
},
|
|
19725
|
+
{
|
|
19726
|
+
name: "environment",
|
|
19727
|
+
type: "string",
|
|
19728
|
+
required: false,
|
|
19729
|
+
description: "Environment to run against; it decides whether production-only cases become selectable. Omit it for a run that needs no environment."
|
|
19730
|
+
},
|
|
19731
|
+
{
|
|
19732
|
+
name: "repeat",
|
|
19733
|
+
type: "integer",
|
|
19734
|
+
required: false,
|
|
19735
|
+
description: "How many times each selected case runs, which is how a flake is told apart from a real failure; omit for once."
|
|
19736
|
+
},
|
|
19737
|
+
{
|
|
19738
|
+
name: "waitUntil",
|
|
19739
|
+
type: "string",
|
|
19740
|
+
enum: [
|
|
19741
|
+
"queued",
|
|
19742
|
+
"started",
|
|
19743
|
+
"finished"
|
|
19744
|
+
],
|
|
19745
|
+
required: false,
|
|
19746
|
+
description: "How far the call waits before answering, bounded at about 25 seconds; omit it for queued, which returns at once. The wait reads the run's own state, so a wait that reaches the bound returns the run as it stands instead of failing — check state before assuming the request was honoured."
|
|
19747
|
+
},
|
|
19748
|
+
{
|
|
19749
|
+
name: "executor",
|
|
19750
|
+
type: "string",
|
|
19751
|
+
enum: [
|
|
19752
|
+
"cloud",
|
|
19753
|
+
"external"
|
|
19754
|
+
],
|
|
19755
|
+
required: false,
|
|
19756
|
+
description: "Who carries the run out. cloud, the default, runs the selected cases in Praxis at the commit; external creates a run that waits for your own CI to upload a report with test-reports."
|
|
19757
|
+
},
|
|
19758
|
+
{
|
|
19759
|
+
name: "requestId",
|
|
19760
|
+
type: "string",
|
|
19761
|
+
required: false,
|
|
19762
|
+
description: "A key you choose to make creating this run idempotent: repeating the call with the same requestId returns the run it created instead of starting another, so a retry after a timeout is safe."
|
|
19763
|
+
}
|
|
19764
|
+
]
|
|
19765
|
+
}
|
|
19766
|
+
},
|
|
19767
|
+
{
|
|
19768
|
+
resource: "devops.projects.testSuites",
|
|
19769
|
+
method: "list",
|
|
19770
|
+
summary: "List test suites",
|
|
19771
|
+
description: "List the suites the project's newest catalog discovered — one suite per test file and framework pair, with its size, purposes and question count. Use it to find the suite id a case belongs to, or to see which files make up an area before selecting cases from them. Suites come from the catalog, so a file added in code appears only after its commit's catalog is published. Archived suites are returned too; they carry archived true and no case is ever silently dropped from the list.",
|
|
19772
|
+
http: "GET",
|
|
19773
|
+
path: "/devops/v1/projects/{project}/test-suites",
|
|
19774
|
+
streaming: "no",
|
|
19775
|
+
pagination: false,
|
|
19776
|
+
pathParams: [
|
|
19777
|
+
{
|
|
19778
|
+
name: "project",
|
|
19779
|
+
sdkName: "project",
|
|
19780
|
+
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
19781
|
+
}
|
|
19782
|
+
],
|
|
19783
|
+
query: [
|
|
19784
|
+
{
|
|
19785
|
+
name: "pageSize",
|
|
19786
|
+
type: "integer",
|
|
19787
|
+
required: false,
|
|
19788
|
+
description: "How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone."
|
|
19789
|
+
},
|
|
19790
|
+
{
|
|
19791
|
+
name: "pageToken",
|
|
19792
|
+
type: "string",
|
|
19793
|
+
required: false,
|
|
19794
|
+
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
19795
|
+
},
|
|
18966
19796
|
{
|
|
18967
19797
|
name: "orderBy",
|
|
18968
19798
|
type: "string",
|
|
@@ -18972,99 +19802,235 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
18972
19802
|
]
|
|
18973
19803
|
},
|
|
18974
19804
|
{
|
|
18975
|
-
resource: "devops.
|
|
19805
|
+
resource: "devops.promotions",
|
|
18976
19806
|
method: "create",
|
|
18977
|
-
summary: "Create a
|
|
18978
|
-
description: "
|
|
19807
|
+
summary: "Create a promotion",
|
|
19808
|
+
description: "Promote a release into one environment: this is the operation that actually schedules a deployment. Name the release and the environment; path is regular for an ordinary promotion, patch to carry a patch release, targeted to deploy only the targets you list, and rollback to return the environment to an earlier release. The service reads the environment's promotion order and refuses when an upstream environment has not verified this release yet, unless a bypass carries the authorization for that gate. An environment takes one promotion at a time, so a create while another is running is queued behind it rather than refused. Set validateOnly to read the plan and its refusals — layers, skipped targets, pending migrations, missing configuration keys — without scheduling anything, which is the safe way to find out what a promotion will do.",
|
|
18979
19809
|
http: "POST",
|
|
18980
|
-
path: "/devops/v1/
|
|
19810
|
+
path: "/devops/v1/promotions",
|
|
18981
19811
|
streaming: "no",
|
|
18982
19812
|
pagination: false,
|
|
18983
|
-
pathParams: [
|
|
18984
|
-
{
|
|
18985
|
-
name: "project",
|
|
18986
|
-
sdkName: "project",
|
|
18987
|
-
description: "Identifies the project whose data you are reading, from the project list or create answer."
|
|
18988
|
-
}
|
|
18989
|
-
],
|
|
19813
|
+
pathParams: [],
|
|
18990
19814
|
query: [],
|
|
18991
19815
|
body: {
|
|
18992
19816
|
required: true,
|
|
18993
19817
|
fields: [
|
|
18994
19818
|
{
|
|
18995
|
-
name: "
|
|
18996
|
-
type: "
|
|
19819
|
+
name: "release",
|
|
19820
|
+
type: "string",
|
|
18997
19821
|
required: true,
|
|
18998
|
-
description: "The
|
|
19822
|
+
description: "The release to promote, from a release list or create answer; promoting an abandoned release is refused."
|
|
18999
19823
|
},
|
|
19000
19824
|
{
|
|
19001
|
-
name: "
|
|
19825
|
+
name: "environment",
|
|
19826
|
+
type: "string",
|
|
19827
|
+
required: true,
|
|
19828
|
+
description: "The environment to deploy into, from the project's environment list; the upstream environment must have verified the release unless a bypass covers that gate."
|
|
19829
|
+
},
|
|
19830
|
+
{
|
|
19831
|
+
name: "path",
|
|
19002
19832
|
type: "string",
|
|
19833
|
+
enum: [
|
|
19834
|
+
"regular",
|
|
19835
|
+
"patch",
|
|
19836
|
+
"targeted",
|
|
19837
|
+
"rollback"
|
|
19838
|
+
],
|
|
19003
19839
|
required: false,
|
|
19004
|
-
description: "
|
|
19840
|
+
description: "How the release should travel; omit it for an ordinary promotion. A path other than regular is not creatable yet and is refused with NOT_IMPLEMENTED."
|
|
19005
19841
|
},
|
|
19006
19842
|
{
|
|
19007
|
-
name: "
|
|
19008
|
-
type: "
|
|
19843
|
+
name: "targets",
|
|
19844
|
+
type: "array",
|
|
19845
|
+
itemType: "string",
|
|
19009
19846
|
required: false,
|
|
19010
|
-
description: "
|
|
19847
|
+
description: "Deploy only these targets; omit it to let the plan choose from what changed. Naming a target the plan would skip does not force it — read skipped in the plan."
|
|
19011
19848
|
},
|
|
19012
19849
|
{
|
|
19013
|
-
name: "
|
|
19014
|
-
type: "
|
|
19850
|
+
name: "bypass",
|
|
19851
|
+
type: "array",
|
|
19852
|
+
itemType: "object",
|
|
19015
19853
|
required: false,
|
|
19016
|
-
description: "
|
|
19854
|
+
description: "Gates to skip, each naming the approval that authorizes it; a bypass is refused unless the project allows skipping upstream and the approval covers this release, environment and gate."
|
|
19017
19855
|
},
|
|
19018
19856
|
{
|
|
19019
|
-
name: "
|
|
19020
|
-
type: "
|
|
19857
|
+
name: "validateOnly",
|
|
19858
|
+
type: "boolean",
|
|
19021
19859
|
required: false,
|
|
19022
|
-
description: "
|
|
19860
|
+
description: "True to answer the plan without scheduling anything; use it to find out whether a promotion would be refused before committing to it. Nothing is deployed."
|
|
19023
19861
|
},
|
|
19024
19862
|
{
|
|
19025
|
-
name: "
|
|
19863
|
+
name: "requestId",
|
|
19026
19864
|
type: "string",
|
|
19027
|
-
enum: [
|
|
19028
|
-
"queued",
|
|
19029
|
-
"started",
|
|
19030
|
-
"finished"
|
|
19031
|
-
],
|
|
19032
19865
|
required: false,
|
|
19033
|
-
description: "
|
|
19866
|
+
description: "Caller-chosen key that makes this create idempotent: repeating it answers the promotion the first call made instead of scheduling a second one."
|
|
19867
|
+
}
|
|
19868
|
+
]
|
|
19869
|
+
}
|
|
19870
|
+
},
|
|
19871
|
+
{
|
|
19872
|
+
resource: "devops.promotions",
|
|
19873
|
+
method: "retrieve",
|
|
19874
|
+
summary: "Retrieve a promotion",
|
|
19875
|
+
description: "Read one promotion: its state, its approval, its plan, and the failure that stopped it when there is one. Poll this after creating a promotion to follow it to a terminal state, or read it to find out why a deployment stopped — failure.cause tells plan refusal apart from a failed deploy, and executor names the runs involved. Pass expand=rollouts to receive the per-target rollouts in the same answer instead of listing them separately. state observing means the environment is deployed and the observation window is running, so the promotion is not finished and conclude is still to come.",
|
|
19876
|
+
http: "GET",
|
|
19877
|
+
path: "/devops/v1/promotions/{id}",
|
|
19878
|
+
streaming: "no",
|
|
19879
|
+
pagination: false,
|
|
19880
|
+
pathParams: [
|
|
19881
|
+
{
|
|
19882
|
+
name: "id",
|
|
19883
|
+
sdkName: "id",
|
|
19884
|
+
description: "The promotion identifier returned by a promotion list or create answer."
|
|
19885
|
+
}
|
|
19886
|
+
],
|
|
19887
|
+
query: [
|
|
19888
|
+
{
|
|
19889
|
+
name: "expand",
|
|
19890
|
+
type: "string",
|
|
19891
|
+
enum: [
|
|
19892
|
+
"rollouts"
|
|
19893
|
+
],
|
|
19894
|
+
required: false,
|
|
19895
|
+
description: "Extra sections to inline in the answer; today only rollouts, which adds the per-target rollouts this promotion owns. Omit it for the promotion alone."
|
|
19896
|
+
}
|
|
19897
|
+
]
|
|
19898
|
+
},
|
|
19899
|
+
{
|
|
19900
|
+
resource: "devops.promotions",
|
|
19901
|
+
method: "approve",
|
|
19902
|
+
summary: "Approve or reject a promotion",
|
|
19903
|
+
description: "Answer the approval an environment asked for: send approved true to let the promotion proceed, false to reject it and end it in approval_rejected. This is the environment-level gate an environment with requireApproval raises, not the per-rollout approval. Comment records the reasoning next to the decision, which is what a later reader sees instead of the bare verdict. The call is refused with PROMOTION_NOT_AWAITING_APPROVAL when the promotion is not waiting for one, so a stale approval cannot restart something that already finished. Approving is attributed to the credential that sends it.",
|
|
19904
|
+
http: "POST",
|
|
19905
|
+
path: "/devops/v1/promotions/{id}:approve",
|
|
19906
|
+
streaming: "no",
|
|
19907
|
+
pagination: false,
|
|
19908
|
+
pathParams: [
|
|
19909
|
+
{
|
|
19910
|
+
name: "id",
|
|
19911
|
+
sdkName: "id",
|
|
19912
|
+
description: "The promotion identifier returned by a promotion list or create answer."
|
|
19913
|
+
}
|
|
19914
|
+
],
|
|
19915
|
+
query: [],
|
|
19916
|
+
body: {
|
|
19917
|
+
required: true,
|
|
19918
|
+
fields: [
|
|
19919
|
+
{
|
|
19920
|
+
name: "approved",
|
|
19921
|
+
type: "boolean",
|
|
19922
|
+
required: true,
|
|
19923
|
+
description: "True to approve, which lets the promotion deploy; false rejects it and ends the promotion as approval_rejected."
|
|
19034
19924
|
},
|
|
19035
19925
|
{
|
|
19036
|
-
name: "
|
|
19926
|
+
name: "comment",
|
|
19927
|
+
type: "string",
|
|
19928
|
+
required: false,
|
|
19929
|
+
description: "What the approver wants recorded with the decision, stored verbatim; omit it when there is nothing to add."
|
|
19930
|
+
}
|
|
19931
|
+
]
|
|
19932
|
+
}
|
|
19933
|
+
},
|
|
19934
|
+
{
|
|
19935
|
+
resource: "devops.promotions",
|
|
19936
|
+
method: "cancel",
|
|
19937
|
+
summary: "Cancel a promotion",
|
|
19938
|
+
description: "Stop a promotion that has not finished, moving it through cancelling to cancelled and stopping the deploys it had scheduled. Use it to halt a deployment that is failing or that should no longer continue; reason is recorded as the attribution of the stop. Cancelling does not undo what already deployed: an environment whose targets were written keeps those targets, and returning them to an earlier release is a separate rollback promotion. A promotion that already reached a terminal state is refused with PROMOTION_ALREADY_FINISHED rather than silently ignored.",
|
|
19939
|
+
http: "POST",
|
|
19940
|
+
path: "/devops/v1/promotions/{id}:cancel",
|
|
19941
|
+
streaming: "no",
|
|
19942
|
+
pagination: false,
|
|
19943
|
+
pathParams: [
|
|
19944
|
+
{
|
|
19945
|
+
name: "id",
|
|
19946
|
+
sdkName: "id",
|
|
19947
|
+
description: "The promotion identifier returned by a promotion list or create answer."
|
|
19948
|
+
}
|
|
19949
|
+
],
|
|
19950
|
+
query: [],
|
|
19951
|
+
body: {
|
|
19952
|
+
required: true,
|
|
19953
|
+
fields: [
|
|
19954
|
+
{
|
|
19955
|
+
name: "reason",
|
|
19956
|
+
type: "string",
|
|
19957
|
+
required: true,
|
|
19958
|
+
description: "Why the promotion is being cancelled, stored on it as the attribution of the act."
|
|
19959
|
+
}
|
|
19960
|
+
]
|
|
19961
|
+
}
|
|
19962
|
+
},
|
|
19963
|
+
{
|
|
19964
|
+
resource: "devops.promotions",
|
|
19965
|
+
method: "conclude",
|
|
19966
|
+
summary: "Conclude an observation",
|
|
19967
|
+
description: `Record the verdict on a promotion that is observing: send keep to accept the deployment as the environment's new state, or rollback to return the environment to the release it held before. This is the decision the observation window exists for, so a promotion in observing state stays open until it is concluded; reason is stored as the attribution. Concluding with rollback schedules the return, it does not merely label the promotion. A promotion that is not observing is refused with PROMOTION_NOT_OBSERVING, which is how a caller tells "already concluded" apart from a call that had no effect.`,
|
|
19968
|
+
http: "POST",
|
|
19969
|
+
path: "/devops/v1/promotions/{id}:conclude",
|
|
19970
|
+
streaming: "no",
|
|
19971
|
+
pagination: false,
|
|
19972
|
+
pathParams: [
|
|
19973
|
+
{
|
|
19974
|
+
name: "id",
|
|
19975
|
+
sdkName: "id",
|
|
19976
|
+
description: "The promotion identifier returned by a promotion list or create answer."
|
|
19977
|
+
}
|
|
19978
|
+
],
|
|
19979
|
+
query: [],
|
|
19980
|
+
body: {
|
|
19981
|
+
required: true,
|
|
19982
|
+
fields: [
|
|
19983
|
+
{
|
|
19984
|
+
name: "action",
|
|
19037
19985
|
type: "string",
|
|
19038
19986
|
enum: [
|
|
19039
|
-
"
|
|
19040
|
-
"
|
|
19987
|
+
"keep",
|
|
19988
|
+
"rollback"
|
|
19041
19989
|
],
|
|
19042
|
-
required:
|
|
19043
|
-
description: "
|
|
19990
|
+
required: true,
|
|
19991
|
+
description: "Which way the window is decided; a rollback schedules the return of the environment rather than only labelling the promotion."
|
|
19044
19992
|
},
|
|
19045
19993
|
{
|
|
19046
|
-
name: "
|
|
19994
|
+
name: "reason",
|
|
19047
19995
|
type: "string",
|
|
19048
|
-
required:
|
|
19049
|
-
description: "
|
|
19996
|
+
required: true,
|
|
19997
|
+
description: "Why the window was decided that way, recorded on the promotion's observation as the attribution of the verdict."
|
|
19050
19998
|
}
|
|
19051
19999
|
]
|
|
19052
20000
|
}
|
|
19053
20001
|
},
|
|
19054
20002
|
{
|
|
19055
|
-
resource: "devops.
|
|
20003
|
+
resource: "devops.promotions",
|
|
20004
|
+
method: "retry",
|
|
20005
|
+
summary: "Retry a promotion",
|
|
20006
|
+
description: "Continue a promotion that stopped part-way, such as one in halted where some targets succeeded and others failed. The retry re-runs the targets that did not succeed and leaves the ones that did alone, so a partially deployed environment is completed rather than redeployed from the start. A promotion that is still running is refused, and so is one that already reached a terminal state; read the promotion first and retry only a halted or errored one. The retry is attributed to the credential that sends it and is recorded on the promotion.",
|
|
20007
|
+
http: "POST",
|
|
20008
|
+
path: "/devops/v1/promotions/{id}:retry",
|
|
20009
|
+
streaming: "no",
|
|
20010
|
+
pagination: false,
|
|
20011
|
+
pathParams: [
|
|
20012
|
+
{
|
|
20013
|
+
name: "id",
|
|
20014
|
+
sdkName: "id",
|
|
20015
|
+
description: "The promotion identifier returned by a promotion list or create answer."
|
|
20016
|
+
}
|
|
20017
|
+
],
|
|
20018
|
+
query: []
|
|
20019
|
+
},
|
|
20020
|
+
{
|
|
20021
|
+
resource: "devops.promotions.rollouts",
|
|
19056
20022
|
method: "list",
|
|
19057
|
-
summary: "List
|
|
19058
|
-
description: "List the
|
|
20023
|
+
summary: "List a promotion's rollouts",
|
|
20024
|
+
description: "List the per-target rollouts of one promotion: which target each is deploying, which layer it waits on, and where in its phases it has got to. Call it when a promotion is halted or failed to find the target that stopped, since the promotion's own state summarises what the rollouts show one by one. A promotion with nothing to deploy answers an empty page rather than a refusal. Neither filter nor orderBy is accepted here, and the rollouts come in the order the plan laid them out.",
|
|
19059
20025
|
http: "GET",
|
|
19060
|
-
path: "/devops/v1/
|
|
20026
|
+
path: "/devops/v1/promotions/{promotion}/rollouts",
|
|
19061
20027
|
streaming: "no",
|
|
19062
20028
|
pagination: false,
|
|
19063
20029
|
pathParams: [
|
|
19064
20030
|
{
|
|
19065
|
-
name: "
|
|
19066
|
-
sdkName: "
|
|
19067
|
-
description: "
|
|
20031
|
+
name: "promotion",
|
|
20032
|
+
sdkName: "promotion",
|
|
20033
|
+
description: "The promotion whose rollouts you are reading, from a promotion list or create answer."
|
|
19068
20034
|
}
|
|
19069
20035
|
],
|
|
19070
20036
|
query: [
|
|
@@ -19079,15 +20045,74 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
19079
20045
|
type: "string",
|
|
19080
20046
|
required: false,
|
|
19081
20047
|
description: "The cursor from the previous page's nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page."
|
|
19082
|
-
},
|
|
19083
|
-
{
|
|
19084
|
-
name: "orderBy",
|
|
19085
|
-
type: "string",
|
|
19086
|
-
required: false,
|
|
19087
|
-
description: "Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource's own order."
|
|
19088
20048
|
}
|
|
19089
20049
|
]
|
|
19090
20050
|
},
|
|
20051
|
+
{
|
|
20052
|
+
resource: "devops.releases",
|
|
20053
|
+
method: "retrieve",
|
|
20054
|
+
summary: "Retrieve a release",
|
|
20055
|
+
description: "Read one release in full: the commit it carries, the targets and source digests it was rendered from, which environments have verified it, and where it currently runs. Call it before promoting to confirm the release is not abandoned and that its render succeeded, and after deploying to learn which environments already hold it so the same release is not promoted twice. A release from another organization answers RELEASE_NOT_FOUND, which is also the answer for one that never existed.",
|
|
20056
|
+
http: "GET",
|
|
20057
|
+
path: "/devops/v1/releases/{id}",
|
|
20058
|
+
streaming: "no",
|
|
20059
|
+
pagination: false,
|
|
20060
|
+
pathParams: [
|
|
20061
|
+
{
|
|
20062
|
+
name: "id",
|
|
20063
|
+
sdkName: "id",
|
|
20064
|
+
description: "The release identifier returned by a release list or create answer; a release is addressed by this id, never by its display name."
|
|
20065
|
+
}
|
|
20066
|
+
],
|
|
20067
|
+
query: []
|
|
20068
|
+
},
|
|
20069
|
+
{
|
|
20070
|
+
resource: "devops.releases",
|
|
20071
|
+
method: "abandon",
|
|
20072
|
+
summary: "Abandon a release",
|
|
20073
|
+
description: "Withdraw a release so it can no longer be promoted: a later promotion of it is refused with RELEASE_ABANDONED. Use it when a release was created by mistake or has been superseded, and record why in reason — the reason is stored on the release as the attribution of the act. A release with a promotion still in flight cannot be abandoned, because the queue is mid-flight on it; cancel that promotion first, which is the door for stopping a deployment. Abandoning is one-way: a withdrawn release is never un-abandoned, and a new release is created instead.",
|
|
20074
|
+
http: "POST",
|
|
20075
|
+
path: "/devops/v1/releases/{id}:abandon",
|
|
20076
|
+
streaming: "no",
|
|
20077
|
+
pagination: false,
|
|
20078
|
+
pathParams: [
|
|
20079
|
+
{
|
|
20080
|
+
name: "id",
|
|
20081
|
+
sdkName: "id",
|
|
20082
|
+
description: "The release identifier returned by a release list or create answer; a release is addressed by this id, never by its display name."
|
|
20083
|
+
}
|
|
20084
|
+
],
|
|
20085
|
+
query: [],
|
|
20086
|
+
body: {
|
|
20087
|
+
required: true,
|
|
20088
|
+
fields: [
|
|
20089
|
+
{
|
|
20090
|
+
name: "reason",
|
|
20091
|
+
type: "string",
|
|
20092
|
+
required: true,
|
|
20093
|
+
description: "Why this release no longer should be promoted, recorded verbatim on the release for whoever reads it later."
|
|
20094
|
+
}
|
|
20095
|
+
]
|
|
20096
|
+
}
|
|
20097
|
+
},
|
|
20098
|
+
{
|
|
20099
|
+
resource: "devops.rollouts",
|
|
20100
|
+
method: "retrieve",
|
|
20101
|
+
summary: "Retrieve a rollout",
|
|
20102
|
+
description: "Read one rollout in full: its phases and the jobs inside them, each job's most recent attempt, the checkpoint it was deploying from, and why it failed when it did. This is the level that names the failing step — a promotion tells you that a target failed, a rollout tells you which job run did and what it reported. Use logFileId or a job run's eventLogPath to reach the logs that step produced. A rollout from another organization answers ROLLOUT_NOT_FOUND, the same answer as one that never existed.",
|
|
20103
|
+
http: "GET",
|
|
20104
|
+
path: "/devops/v1/rollouts/{id}",
|
|
20105
|
+
streaming: "no",
|
|
20106
|
+
pagination: false,
|
|
20107
|
+
pathParams: [
|
|
20108
|
+
{
|
|
20109
|
+
name: "id",
|
|
20110
|
+
sdkName: "id",
|
|
20111
|
+
description: "The rollout identifier from a promotion's rollout list or a promotion read with expand=rollouts."
|
|
20112
|
+
}
|
|
20113
|
+
],
|
|
20114
|
+
query: []
|
|
20115
|
+
},
|
|
19091
20116
|
{
|
|
19092
20117
|
resource: "devops.testCases",
|
|
19093
20118
|
method: "retrieve",
|
|
@@ -20678,6 +21703,41 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
20678
21703
|
]
|
|
20679
21704
|
}
|
|
20680
21705
|
},
|
|
21706
|
+
{
|
|
21707
|
+
resource: "media.libraries",
|
|
21708
|
+
method: "retrieveDefault",
|
|
21709
|
+
summary: "Get default library",
|
|
21710
|
+
description: "Return this organization’s default library. Calling ensures the organization’s default library exists (ADR-093): the first call creates it and later calls return the same library, so this is the method to call before writing when no library id is known. Generated and edited media land here when no library is named. The path segment {lib} accepts the literal default, which resolves to this library before the credential check — so an agent that has never listed libraries can still write to the right place. Returns the same Library object as libraries.retrieve; a credential bound to one library reaches this only when that binding covers the default library.",
|
|
21711
|
+
http: "GET",
|
|
21712
|
+
path: "/media/v1/libraries/default",
|
|
21713
|
+
streaming: "no",
|
|
21714
|
+
pagination: false,
|
|
21715
|
+
pathParams: [],
|
|
21716
|
+
query: []
|
|
21717
|
+
},
|
|
21718
|
+
{
|
|
21719
|
+
resource: "media.libraries",
|
|
21720
|
+
method: "setDefault",
|
|
21721
|
+
summary: "Set default library",
|
|
21722
|
+
description: "Point this organization’s default library at an existing library. Calling ensures the organization’s default library exists (ADR-093): the path is resolved before the credential check, so a first call creates the default library when there is none and then repoints it. The path segment {lib} accepts the literal default, which resolves to this library before the credential check. Supply library_id from library creation or listing; the library must be active and belong to the organization. This changes where library-less generation and uploads land across the whole organization, so it affects other callers as well as this one. It does not move or copy any asset — assets already in the previous default library stay there. Returns the library now set as the default. Deleting the default library is refused with LIBRARY_IS_DEFAULT until another library is made the default.",
|
|
21723
|
+
http: "PUT",
|
|
21724
|
+
path: "/media/v1/libraries/default",
|
|
21725
|
+
streaming: "no",
|
|
21726
|
+
pagination: false,
|
|
21727
|
+
pathParams: [],
|
|
21728
|
+
query: [],
|
|
21729
|
+
body: {
|
|
21730
|
+
required: true,
|
|
21731
|
+
fields: [
|
|
21732
|
+
{
|
|
21733
|
+
name: "library_id",
|
|
21734
|
+
type: "string",
|
|
21735
|
+
required: true,
|
|
21736
|
+
description: "Identifier of a library belonging to the caller."
|
|
21737
|
+
}
|
|
21738
|
+
]
|
|
21739
|
+
}
|
|
21740
|
+
},
|
|
20681
21741
|
{
|
|
20682
21742
|
resource: "media.libraries",
|
|
20683
21743
|
method: "delete",
|
|
@@ -20802,6 +21862,25 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
20802
21862
|
required: false,
|
|
20803
21863
|
description: "image, video (including audio), raw; auto is accepted by Upload actions only, and listing with auto returns 400."
|
|
20804
21864
|
},
|
|
21865
|
+
{
|
|
21866
|
+
name: "material_type",
|
|
21867
|
+
type: "string",
|
|
21868
|
+
enum: [
|
|
21869
|
+
"image",
|
|
21870
|
+
"video",
|
|
21871
|
+
"audio",
|
|
21872
|
+
"voice",
|
|
21873
|
+
"sticker",
|
|
21874
|
+
"font",
|
|
21875
|
+
"text_style",
|
|
21876
|
+
"text_template",
|
|
21877
|
+
"animation_preset",
|
|
21878
|
+
"lut",
|
|
21879
|
+
"transition_map"
|
|
21880
|
+
],
|
|
21881
|
+
required: false,
|
|
21882
|
+
description: "Filter assets to one kind of material, independent of the stored resource_type. Omit to list every material type. Assets stored before this field existed match no material_type filter."
|
|
21883
|
+
},
|
|
20805
21884
|
{
|
|
20806
21885
|
name: "cursor",
|
|
20807
21886
|
type: "string",
|
|
@@ -21162,6 +22241,68 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21162
22241
|
]
|
|
21163
22242
|
}
|
|
21164
22243
|
},
|
|
22244
|
+
{
|
|
22245
|
+
resource: "media.assets",
|
|
22246
|
+
method: "edit",
|
|
22247
|
+
summary: "Edit asset",
|
|
22248
|
+
description: "Edit an existing asset and store the result as a new asset. Use library_id from creation or listing and asset_id from asset creation or listing; library_id also accepts the literal default, which resolves to the organization’s default library before the credential check. The source asset is never overwritten: the new asset hangs under it in the edit chain, records it in derived_from, and reads back with assets.lineage, so earlier steps stay reachable. The body is operation plus the optional model, asset_folder, understanding and idempotency_key; operation.type selects the edit and carries that operation’s own fields. This release performs variations, inpaint, erase, replace_object, recolor, remove_background and replace_background on images; every other type in the operation vocabulary — the video and audio edits — is refused with OPERATION_NOT_SUPPORTED. inpaint takes mask, a PNG File identifier beginning with file- whose transparent area marks the region to replace, plus the prompt describing what belongs there. Aspects beyond the source asset’s material type return REFERENCE_TYPE_MISMATCH. Editing is charged through Router and the job records the charge in usage. The response is 202 with a queued Job whose type is image, whose operation is the edit applied, and whose source_asset_id is the asset edited; poll GET /media/v1/libraries/{library_id}/jobs/{job_id} until it is completed or failed, then read the produced asset. Example: POST /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/edits with {\"operation\":{\"type\":\"variations\",\"strength\":\"subtle\"}}.",
|
|
22249
|
+
http: "POST",
|
|
22250
|
+
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/edits",
|
|
22251
|
+
streaming: "no",
|
|
22252
|
+
pagination: false,
|
|
22253
|
+
pathParams: [
|
|
22254
|
+
{
|
|
22255
|
+
name: "library_id",
|
|
22256
|
+
sdkName: "library_id",
|
|
22257
|
+
description: "Library ID returned by creation."
|
|
22258
|
+
},
|
|
22259
|
+
{
|
|
22260
|
+
name: "asset_id",
|
|
22261
|
+
sdkName: "asset_id",
|
|
22262
|
+
description: "32-character asset ID."
|
|
22263
|
+
}
|
|
22264
|
+
],
|
|
22265
|
+
query: [],
|
|
22266
|
+
body: {
|
|
22267
|
+
required: true,
|
|
22268
|
+
fields: [
|
|
22269
|
+
{
|
|
22270
|
+
name: "operation",
|
|
22271
|
+
type: "object",
|
|
22272
|
+
required: true,
|
|
22273
|
+
description: "One edit to apply to the source asset. type selects the operation and the discriminating branch carries that operation’s fields. This release performs variations, inpaint, erase, replace_object, recolor, remove_background and replace_background on images; every other type here describes the operation vocabulary and is refused with OPERATION_NOT_SUPPORTED."
|
|
22274
|
+
},
|
|
22275
|
+
{
|
|
22276
|
+
name: "model",
|
|
22277
|
+
type: "string",
|
|
22278
|
+
required: false,
|
|
22279
|
+
description: "Router model that performs the edit; omit it to use the library default image model."
|
|
22280
|
+
},
|
|
22281
|
+
{
|
|
22282
|
+
name: "asset_folder",
|
|
22283
|
+
type: "string",
|
|
22284
|
+
required: false,
|
|
22285
|
+
description: "Folder the produced asset is filed under; defaults to the source asset’s folder. New path segments containing U+FFFD or consisting only of question marks are rejected with INVALID_PARAMS; send UTF-8 names. Existing affected folders remain readable and assets can be moved out."
|
|
22286
|
+
},
|
|
22287
|
+
{
|
|
22288
|
+
name: "understanding",
|
|
22289
|
+
type: "string",
|
|
22290
|
+
enum: [
|
|
22291
|
+
"auto",
|
|
22292
|
+
"skip"
|
|
22293
|
+
],
|
|
22294
|
+
required: false,
|
|
22295
|
+
description: "Understanding behavior for the produced asset; defaults to auto."
|
|
22296
|
+
},
|
|
22297
|
+
{
|
|
22298
|
+
name: "idempotency_key",
|
|
22299
|
+
type: "string",
|
|
22300
|
+
required: false,
|
|
22301
|
+
description: "Stable key so a retried request reuses the same job instead of editing and charging again; reusing it with different content is rejected."
|
|
22302
|
+
}
|
|
22303
|
+
]
|
|
22304
|
+
}
|
|
22305
|
+
},
|
|
21165
22306
|
{
|
|
21166
22307
|
resource: "media.libraries.assets.frames",
|
|
21167
22308
|
method: "create",
|
|
@@ -21208,6 +22349,29 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21208
22349
|
]
|
|
21209
22350
|
}
|
|
21210
22351
|
},
|
|
22352
|
+
{
|
|
22353
|
+
resource: "media.assets",
|
|
22354
|
+
method: "lineage",
|
|
22355
|
+
summary: "Get asset lineage",
|
|
22356
|
+
description: "Read the whole edit tree containing one asset, so a caller sees what it was edited from and what was edited from it. Use library_id from creation or listing and asset_id from asset creation or listing; library_id also accepts the literal default, which resolves to the organization’s default library before the credential check. The response names the root the tree descends from, the asset asked about, and every step between them, each with the operation, prompt and creation time that produced it. Deleted assets stay in the tree, marked deleted, so the chain stays connected after cleanup. This is a read: it starts no processing and changes no asset. Example: GET /media/v1/libraries/lib_example/assets/9dfa312ef9bc4b00816339b598b1152c/lineage.",
|
|
22357
|
+
http: "GET",
|
|
22358
|
+
path: "/media/v1/libraries/{library_id}/assets/{asset_id}/lineage",
|
|
22359
|
+
streaming: "no",
|
|
22360
|
+
pagination: false,
|
|
22361
|
+
pathParams: [
|
|
22362
|
+
{
|
|
22363
|
+
name: "library_id",
|
|
22364
|
+
sdkName: "library_id",
|
|
22365
|
+
description: "Library ID returned by creation."
|
|
22366
|
+
},
|
|
22367
|
+
{
|
|
22368
|
+
name: "asset_id",
|
|
22369
|
+
sdkName: "asset_id",
|
|
22370
|
+
description: "32-character asset ID."
|
|
22371
|
+
}
|
|
22372
|
+
],
|
|
22373
|
+
query: []
|
|
22374
|
+
},
|
|
21211
22375
|
{
|
|
21212
22376
|
resource: "media.libraries.assets.reprocess",
|
|
21213
22377
|
method: "create",
|
|
@@ -21609,6 +22773,126 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21609
22773
|
]
|
|
21610
22774
|
}
|
|
21611
22775
|
},
|
|
22776
|
+
{
|
|
22777
|
+
resource: "media.images",
|
|
22778
|
+
method: "generate",
|
|
22779
|
+
summary: "Generate image",
|
|
22780
|
+
description: "Generate one or more images from a text prompt and store them straight into the library. Use library_id from creation or listing; the path segment {library_id} also accepts the literal default, which resolves to the organization’s default library before the credential check, so an agent that has never listed a library can still generate. The request body is the image request itself: prompt is required, and n, size, background, output_format, output, references, seed, model, asset_folder and understanding are optional. Set output to sticker for a cut-out with a transparent background. references attach existing assets with a role — edit_target, style, structure or subject — and a model that cannot honour a role returns REFERENCE_TYPE_MISMATCH. Aspect ratio is not accepted for images; name size instead. Generation is charged through Router and the job records the charge in usage; nothing is charged for a request refused before it starts. The response is 202 with a queued Job whose type is image and whose operation is generate; poll GET /media/v1/libraries/{library_id}/jobs/{job_id} until its status is completed or failed, then read the produced assets from the library. Send Idempotency-Key, or idempotency_key in the body, to retry without generating and charging twice. Example: POST /media/v1/libraries/default/images/generations with {\"prompt\":\"A red kite above a calm sea at sunrise\",\"n\":1,\"output\":\"sticker\"}.",
|
|
22781
|
+
http: "POST",
|
|
22782
|
+
path: "/media/v1/libraries/{library_id}/images/generations",
|
|
22783
|
+
streaming: "no",
|
|
22784
|
+
pagination: false,
|
|
22785
|
+
pathParams: [
|
|
22786
|
+
{
|
|
22787
|
+
name: "library_id",
|
|
22788
|
+
sdkName: "library_id",
|
|
22789
|
+
description: "Library ID returned by creation."
|
|
22790
|
+
}
|
|
22791
|
+
],
|
|
22792
|
+
query: [],
|
|
22793
|
+
body: {
|
|
22794
|
+
required: true,
|
|
22795
|
+
fields: [
|
|
22796
|
+
{
|
|
22797
|
+
name: "prompt",
|
|
22798
|
+
type: "string",
|
|
22799
|
+
required: true,
|
|
22800
|
+
description: "Text prompt describing the image to generate; Router forwards it to the image model unchanged."
|
|
22801
|
+
},
|
|
22802
|
+
{
|
|
22803
|
+
name: "negative_prompt",
|
|
22804
|
+
type: "string",
|
|
22805
|
+
required: false,
|
|
22806
|
+
description: "What the image must not contain. Models without a negative-prompt control ignore it."
|
|
22807
|
+
},
|
|
22808
|
+
{
|
|
22809
|
+
name: "n",
|
|
22810
|
+
type: "integer",
|
|
22811
|
+
required: false,
|
|
22812
|
+
description: "Images to generate in one job, from 1 to 10; defaults to 1. Each produced image is charged separately."
|
|
22813
|
+
},
|
|
22814
|
+
{
|
|
22815
|
+
name: "size",
|
|
22816
|
+
type: "string",
|
|
22817
|
+
required: false,
|
|
22818
|
+
description: "Requested pixel size written as width x height. Router validates it against the chosen model and rejects an unsupported size with INVALID_PARAMS."
|
|
22819
|
+
},
|
|
22820
|
+
{
|
|
22821
|
+
name: "background",
|
|
22822
|
+
type: "string",
|
|
22823
|
+
enum: [
|
|
22824
|
+
"transparent",
|
|
22825
|
+
"opaque",
|
|
22826
|
+
"auto"
|
|
22827
|
+
],
|
|
22828
|
+
required: false,
|
|
22829
|
+
description: "Background handling; defaults to auto. Whether transparency is honoured depends on the model."
|
|
22830
|
+
},
|
|
22831
|
+
{
|
|
22832
|
+
name: "output_format",
|
|
22833
|
+
type: "string",
|
|
22834
|
+
enum: [
|
|
22835
|
+
"png",
|
|
22836
|
+
"jpeg",
|
|
22837
|
+
"webp"
|
|
22838
|
+
],
|
|
22839
|
+
required: false,
|
|
22840
|
+
description: "Encoding of the stored image; defaults to png. Transparency requires png or webp."
|
|
22841
|
+
},
|
|
22842
|
+
{
|
|
22843
|
+
name: "output",
|
|
22844
|
+
type: "string",
|
|
22845
|
+
enum: [
|
|
22846
|
+
"image",
|
|
22847
|
+
"sticker"
|
|
22848
|
+
],
|
|
22849
|
+
required: false,
|
|
22850
|
+
description: "How the result is stored: image for a normal picture, or sticker for a cut-out committed with material_type sticker; defaults to image."
|
|
22851
|
+
},
|
|
22852
|
+
{
|
|
22853
|
+
name: "references",
|
|
22854
|
+
type: "array",
|
|
22855
|
+
itemType: "object",
|
|
22856
|
+
required: false,
|
|
22857
|
+
description: "Existing assets the model may use, each with the role it plays. Router answers REFERENCE_TYPE_MISMATCH when the chosen model cannot honour a role."
|
|
22858
|
+
},
|
|
22859
|
+
{
|
|
22860
|
+
name: "seed",
|
|
22861
|
+
type: "integer",
|
|
22862
|
+
required: false,
|
|
22863
|
+
description: "Seed for reproducible sampling; omit it to let the model choose one."
|
|
22864
|
+
},
|
|
22865
|
+
{
|
|
22866
|
+
name: "model",
|
|
22867
|
+
type: "string",
|
|
22868
|
+
required: false,
|
|
22869
|
+
description: "Router model with image-generation capability; omit it to use the library default image model."
|
|
22870
|
+
},
|
|
22871
|
+
{
|
|
22872
|
+
name: "asset_folder",
|
|
22873
|
+
type: "string",
|
|
22874
|
+
required: false,
|
|
22875
|
+
description: "Folder the produced asset is filed under; defaults to the library root. New path segments containing U+FFFD or consisting only of question marks are rejected with INVALID_PARAMS; send UTF-8 names. Existing affected folders remain readable and assets can be moved out."
|
|
22876
|
+
},
|
|
22877
|
+
{
|
|
22878
|
+
name: "understanding",
|
|
22879
|
+
type: "string",
|
|
22880
|
+
enum: [
|
|
22881
|
+
"auto",
|
|
22882
|
+
"skip"
|
|
22883
|
+
],
|
|
22884
|
+
required: false,
|
|
22885
|
+
description: "Understanding behavior for the produced asset; defaults to auto."
|
|
22886
|
+
},
|
|
22887
|
+
{
|
|
22888
|
+
name: "idempotency_key",
|
|
22889
|
+
type: "string",
|
|
22890
|
+
required: false,
|
|
22891
|
+
description: "Stable key so a retried request reuses the same job instead of generating and charging again; reusing it with different content is rejected."
|
|
22892
|
+
}
|
|
22893
|
+
]
|
|
22894
|
+
}
|
|
22895
|
+
},
|
|
21612
22896
|
{
|
|
21613
22897
|
resource: "media.libraries.jobs",
|
|
21614
22898
|
method: "list",
|
|
@@ -21631,11 +22915,13 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21631
22915
|
type: "string",
|
|
21632
22916
|
enum: [
|
|
21633
22917
|
"queued",
|
|
22918
|
+
"in_progress",
|
|
21634
22919
|
"running",
|
|
21635
22920
|
"completed",
|
|
21636
22921
|
"completed_with_errors",
|
|
21637
22922
|
"failed",
|
|
21638
|
-
"cancelled"
|
|
22923
|
+
"cancelled",
|
|
22924
|
+
"canceled"
|
|
21639
22925
|
],
|
|
21640
22926
|
required: false,
|
|
21641
22927
|
description: "Filter jobs by their current status."
|
|
@@ -21834,7 +23120,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21834
23120
|
name: "top_k",
|
|
21835
23121
|
type: "integer",
|
|
21836
23122
|
required: false,
|
|
21837
|
-
description: "Maximum search hits, from 1 to 50; defaults to 20."
|
|
23123
|
+
description: "Maximum search hits, from 1 to 50; defaults to 20. top_k takes effect and bounds how many distinct hits come back, counting collapsed duplicates as one hit."
|
|
21838
23124
|
},
|
|
21839
23125
|
{
|
|
21840
23126
|
name: "mode",
|
|
@@ -21845,6 +23131,25 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21845
23131
|
],
|
|
21846
23132
|
required: false,
|
|
21847
23133
|
description: "Ranking mode: hybrid combines semantic and keyword matches; semantic uses vector similarity only. Defaults to hybrid."
|
|
23134
|
+
},
|
|
23135
|
+
{
|
|
23136
|
+
name: "material_type",
|
|
23137
|
+
type: "string",
|
|
23138
|
+
enum: [
|
|
23139
|
+
"image",
|
|
23140
|
+
"video",
|
|
23141
|
+
"audio",
|
|
23142
|
+
"voice",
|
|
23143
|
+
"sticker",
|
|
23144
|
+
"font",
|
|
23145
|
+
"text_style",
|
|
23146
|
+
"text_template",
|
|
23147
|
+
"animation_preset",
|
|
23148
|
+
"lut",
|
|
23149
|
+
"transition_map"
|
|
23150
|
+
],
|
|
23151
|
+
required: false,
|
|
23152
|
+
description: "What this asset is as a reusable material, as opposed to resource_type (its stored file category). Omitted on assets stored before this field existed and on raw assets that are not materials."
|
|
21848
23153
|
}
|
|
21849
23154
|
]
|
|
21850
23155
|
}
|
|
@@ -21957,7 +23262,7 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21957
23262
|
name: "top_k",
|
|
21958
23263
|
type: "integer",
|
|
21959
23264
|
required: false,
|
|
21960
|
-
description: "Maximum search hits, from 1 to 50; defaults to 20."
|
|
23265
|
+
description: "Maximum search hits, from 1 to 50; defaults to 20. top_k takes effect and bounds how many distinct hits come back, counting collapsed duplicates as one hit."
|
|
21961
23266
|
},
|
|
21962
23267
|
{
|
|
21963
23268
|
name: "mode",
|
|
@@ -21968,6 +23273,25 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
21968
23273
|
],
|
|
21969
23274
|
required: false,
|
|
21970
23275
|
description: "Ranking mode: hybrid combines semantic and keyword matches; semantic uses vector similarity only. Defaults to hybrid."
|
|
23276
|
+
},
|
|
23277
|
+
{
|
|
23278
|
+
name: "material_type",
|
|
23279
|
+
type: "string",
|
|
23280
|
+
enum: [
|
|
23281
|
+
"image",
|
|
23282
|
+
"video",
|
|
23283
|
+
"audio",
|
|
23284
|
+
"voice",
|
|
23285
|
+
"sticker",
|
|
23286
|
+
"font",
|
|
23287
|
+
"text_style",
|
|
23288
|
+
"text_template",
|
|
23289
|
+
"animation_preset",
|
|
23290
|
+
"lut",
|
|
23291
|
+
"transition_map"
|
|
23292
|
+
],
|
|
23293
|
+
required: false,
|
|
23294
|
+
description: "What this asset is as a reusable material, as opposed to resource_type (its stored file category). Omitted on assets stored before this field existed and on raw assets that are not materials."
|
|
21971
23295
|
}
|
|
21972
23296
|
]
|
|
21973
23297
|
}
|
|
@@ -22080,6 +23404,152 @@ The default is return=minimal: success returns HTTP 201 with an empty body. Send
|
|
|
22080
23404
|
],
|
|
22081
23405
|
query: []
|
|
22082
23406
|
},
|
|
23407
|
+
{
|
|
23408
|
+
resource: "media.videos",
|
|
23409
|
+
method: "generate",
|
|
23410
|
+
summary: "Generate video",
|
|
23411
|
+
description: "Generate one or more videos from a text prompt and store them straight into the library. Use library_id from creation or listing; the path segment {library_id} also accepts the literal default, which resolves to the organization’s default library before the credential check, so an agent that has never listed a library can still generate. mode says what the video is anchored to: text needs only a prompt, image animates the existing image named by first_frame, and first_last interpolates between first_frame and last_frame. The frames must be image or sticker assets of the same library; Router is sent a fetchable URL for each, recorded in the produced asset’s provenance. mode reference and output gif are refused with OPERATION_NOT_SUPPORTED in this release, and negative_prompt, references and an unknown mode are refused before anything is charged. Every output lands in the library as a video asset as soon as it is ready — there is no candidate state and nothing expires, so outputs.save is not part of this lane. Generation is charged per second through Router and the job records the charge in usage; a refused request costs nothing. The response is 202 with a queued Job whose type is video and whose operation is generate; poll GET /media/v1/libraries/{library_id}/jobs/{job_id} until its status is completed or failed, then read the produced assets from the library. Send Idempotency-Key, or idempotency_key in the body, to retry without generating and charging twice. Example: POST /media/v1/libraries/default/videos/generations with {\"prompt\":\"A red kite above a calm sea at sunrise\",\"mode\":\"text\",\"n\":1}.",
|
|
23412
|
+
http: "POST",
|
|
23413
|
+
path: "/media/v1/libraries/{library_id}/videos/generations",
|
|
23414
|
+
streaming: "no",
|
|
23415
|
+
pagination: false,
|
|
23416
|
+
pathParams: [
|
|
23417
|
+
{
|
|
23418
|
+
name: "library_id",
|
|
23419
|
+
sdkName: "library_id",
|
|
23420
|
+
description: "Library ID returned by creation."
|
|
23421
|
+
}
|
|
23422
|
+
],
|
|
23423
|
+
query: [],
|
|
23424
|
+
body: {
|
|
23425
|
+
required: true,
|
|
23426
|
+
fields: [
|
|
23427
|
+
{
|
|
23428
|
+
name: "prompt",
|
|
23429
|
+
type: "string",
|
|
23430
|
+
required: true,
|
|
23431
|
+
description: "Text prompt describing the video to generate; Router forwards it to the video model unchanged."
|
|
23432
|
+
},
|
|
23433
|
+
{
|
|
23434
|
+
name: "negative_prompt",
|
|
23435
|
+
type: "string",
|
|
23436
|
+
required: false,
|
|
23437
|
+
description: "What the video must not contain. Models without a negative-prompt control ignore it."
|
|
23438
|
+
},
|
|
23439
|
+
{
|
|
23440
|
+
name: "mode",
|
|
23441
|
+
type: "string",
|
|
23442
|
+
enum: [
|
|
23443
|
+
"text",
|
|
23444
|
+
"image",
|
|
23445
|
+
"first_last",
|
|
23446
|
+
"reference"
|
|
23447
|
+
],
|
|
23448
|
+
required: true,
|
|
23449
|
+
description: "What the video is anchored to. text needs only a prompt; image animates first_frame; first_last bookends first_frame and last_frame; reference is refused with OPERATION_NOT_SUPPORTED in this release."
|
|
23450
|
+
},
|
|
23451
|
+
{
|
|
23452
|
+
name: "first_frame",
|
|
23453
|
+
type: "string",
|
|
23454
|
+
required: false,
|
|
23455
|
+
description: "Asset identifier returned by upload or asset listing; distinct from public_id and content hashes."
|
|
23456
|
+
},
|
|
23457
|
+
{
|
|
23458
|
+
name: "last_frame",
|
|
23459
|
+
type: "string",
|
|
23460
|
+
required: false,
|
|
23461
|
+
description: "Asset identifier returned by upload or asset listing; distinct from public_id and content hashes."
|
|
23462
|
+
},
|
|
23463
|
+
{
|
|
23464
|
+
name: "references",
|
|
23465
|
+
type: "array",
|
|
23466
|
+
itemType: "object",
|
|
23467
|
+
required: false,
|
|
23468
|
+
description: "Existing assets the model may use, each with the role it plays. Not supported by the video lane in this release: sending it is refused with OPERATION_NOT_SUPPORTED."
|
|
23469
|
+
},
|
|
23470
|
+
{
|
|
23471
|
+
name: "duration_seconds",
|
|
23472
|
+
type: "integer",
|
|
23473
|
+
required: false,
|
|
23474
|
+
description: "Requested video length in seconds. Router validates it against the chosen model’s supported durations and rejects an unsupported value with INVALID_PARAMS."
|
|
23475
|
+
},
|
|
23476
|
+
{
|
|
23477
|
+
name: "resolution",
|
|
23478
|
+
type: "string",
|
|
23479
|
+
enum: [
|
|
23480
|
+
"480p",
|
|
23481
|
+
"720p",
|
|
23482
|
+
"1080p",
|
|
23483
|
+
"4k"
|
|
23484
|
+
],
|
|
23485
|
+
required: false,
|
|
23486
|
+
description: "Requested output resolution; Router validates it against the chosen model."
|
|
23487
|
+
},
|
|
23488
|
+
{
|
|
23489
|
+
name: "aspect_ratio",
|
|
23490
|
+
type: "string",
|
|
23491
|
+
required: false,
|
|
23492
|
+
description: "Output aspect ratio written as width:height; defaults to 16:9. Router validates it against the chosen model and rejects an unsupported ratio with INVALID_PARAMS."
|
|
23493
|
+
},
|
|
23494
|
+
{
|
|
23495
|
+
name: "generate_audio",
|
|
23496
|
+
type: "boolean",
|
|
23497
|
+
required: false,
|
|
23498
|
+
description: "True to generate an audio track with the video. Whether audio is produced depends on the model."
|
|
23499
|
+
},
|
|
23500
|
+
{
|
|
23501
|
+
name: "output",
|
|
23502
|
+
type: "string",
|
|
23503
|
+
enum: [
|
|
23504
|
+
"mp4",
|
|
23505
|
+
"gif"
|
|
23506
|
+
],
|
|
23507
|
+
required: false,
|
|
23508
|
+
description: "Container of the produced video; defaults to mp4. gif is refused with OPERATION_NOT_SUPPORTED because this release has no GIF encoding for the lane."
|
|
23509
|
+
},
|
|
23510
|
+
{
|
|
23511
|
+
name: "n",
|
|
23512
|
+
type: "integer",
|
|
23513
|
+
required: false,
|
|
23514
|
+
description: "Videos to generate in one job, from 1 to 4; defaults to 1. Each produced video is charged separately."
|
|
23515
|
+
},
|
|
23516
|
+
{
|
|
23517
|
+
name: "seed",
|
|
23518
|
+
type: "integer",
|
|
23519
|
+
required: false,
|
|
23520
|
+
description: "Seed for reproducible sampling; omit it to let the model choose one."
|
|
23521
|
+
},
|
|
23522
|
+
{
|
|
23523
|
+
name: "model",
|
|
23524
|
+
type: "string",
|
|
23525
|
+
required: false,
|
|
23526
|
+
description: "Router model with video-generation capability; omit it to use the library default video model."
|
|
23527
|
+
},
|
|
23528
|
+
{
|
|
23529
|
+
name: "asset_folder",
|
|
23530
|
+
type: "string",
|
|
23531
|
+
required: false,
|
|
23532
|
+
description: "Folder the produced asset is filed under; defaults to the library root. New path segments containing U+FFFD or consisting only of question marks are rejected with INVALID_PARAMS; send UTF-8 names. Existing affected folders remain readable and assets can be moved out."
|
|
23533
|
+
},
|
|
23534
|
+
{
|
|
23535
|
+
name: "understanding",
|
|
23536
|
+
type: "string",
|
|
23537
|
+
enum: [
|
|
23538
|
+
"auto",
|
|
23539
|
+
"skip"
|
|
23540
|
+
],
|
|
23541
|
+
required: false,
|
|
23542
|
+
description: "Understanding behavior for the produced asset; defaults to auto."
|
|
23543
|
+
},
|
|
23544
|
+
{
|
|
23545
|
+
name: "idempotency_key",
|
|
23546
|
+
type: "string",
|
|
23547
|
+
required: false,
|
|
23548
|
+
description: "Stable key so a retried request reuses the same job instead of generating and charging again; reusing it with different content is rejected."
|
|
23549
|
+
}
|
|
23550
|
+
]
|
|
23551
|
+
}
|
|
23552
|
+
},
|
|
22083
23553
|
{
|
|
22084
23554
|
resource: "meta.docs",
|
|
22085
23555
|
method: "search",
|
|
@@ -24652,7 +26122,7 @@ for more details.`
|
|
|
24652
26122
|
resource: "ontology.nodes",
|
|
24653
26123
|
method: "create",
|
|
24654
26124
|
summary: "Create node",
|
|
24655
|
-
description: "Record one entity in the graph, for a system mirroring a record it owns. type must already be registered and ref, when given, must match that type's ref_prefix. Send an Idempotency-Key header; repeating the same key with the same content returns the first result instead of creating a second node. This writes structure only
|
|
26125
|
+
description: "Record one entity in the graph, for a system mirroring a record it owns. type must already be registered and ref, when given, must match that type's ref_prefix. Send an Idempotency-Key header; repeating the same key with the same content returns the first result instead of creating a second node. This writes structure only; it does not give any agent a memory.",
|
|
24656
26126
|
http: "POST",
|
|
24657
26127
|
path: "/ontology/v1/nodes",
|
|
24658
26128
|
streaming: "no",
|
|
@@ -24926,7 +26396,7 @@ for more details.`
|
|
|
24926
26396
|
resource: "ontology.relations",
|
|
24927
26397
|
method: "create",
|
|
24928
26398
|
summary: "Create relation",
|
|
24929
|
-
description: "Record one fact between two existing nodes, for a system mirroring a relationship it owns. type must be registered and must admit these endpoints; fact states the relationship in one sentence. Send an Idempotency-Key header; repeating the same key returns the first result instead of writing a second relation. This writes structure only
|
|
26399
|
+
description: "Record one fact between two existing nodes, for a system mirroring a relationship it owns. type must be registered and must admit these endpoints; fact states the relationship in one sentence. Send an Idempotency-Key header; repeating the same key returns the first result instead of writing a second relation. This writes structure only; it does not give any agent a memory.",
|
|
24930
26400
|
http: "POST",
|
|
24931
26401
|
path: "/ontology/v1/relations",
|
|
24932
26402
|
streaming: "no",
|
|
@@ -25038,7 +26508,7 @@ for more details.`
|
|
|
25038
26508
|
resource: "ontology.search",
|
|
25039
26509
|
method: "create",
|
|
25040
26510
|
summary: "Search nodes",
|
|
25041
|
-
description: "Resolve text to the nodes it most likely names, when a mirror holds a name and needs the node id it corresponds to. Results are ranked candidates, not an answer, each reporting whether the match came from the node's name, an alias, its description or a relation's fact. Narrow with types, and cap the result count with limit (1–50, default 20). This reads structure; it is not an agent recall
|
|
26511
|
+
description: "Resolve text to the nodes it most likely names, when a mirror holds a name and needs the node id it corresponds to. Results are ranked candidates, not an answer, each reporting whether the match came from the node's name, an alias, its description or a relation's fact. Narrow with types, and cap the result count with limit (1–50, default 20). This reads structure; it is not an agent's recall, which reads the graph from that agent's own viewpoint inside its sessions.",
|
|
25042
26512
|
http: "POST",
|
|
25043
26513
|
path: "/ontology/v1/search",
|
|
25044
26514
|
streaming: "no",
|
|
@@ -27712,7 +29182,7 @@ for more details.`
|
|
|
27712
29182
|
required: true,
|
|
27713
29183
|
fields: [
|
|
27714
29184
|
{
|
|
27715
|
-
name: "
|
|
29185
|
+
name: "update_mask",
|
|
27716
29186
|
type: "array",
|
|
27717
29187
|
itemType: "string",
|
|
27718
29188
|
required: true,
|
|
@@ -27955,7 +29425,7 @@ for more details.`
|
|
|
27955
29425
|
required: true,
|
|
27956
29426
|
fields: [
|
|
27957
29427
|
{
|
|
27958
|
-
name: "
|
|
29428
|
+
name: "update_mask",
|
|
27959
29429
|
type: "array",
|
|
27960
29430
|
itemType: "string",
|
|
27961
29431
|
required: true,
|
|
@@ -28266,7 +29736,7 @@ for more details.`
|
|
|
28266
29736
|
required: true,
|
|
28267
29737
|
fields: [
|
|
28268
29738
|
{
|
|
28269
|
-
name: "
|
|
29739
|
+
name: "update_mask",
|
|
28270
29740
|
type: "array",
|
|
28271
29741
|
itemType: "string",
|
|
28272
29742
|
required: true,
|
|
@@ -28427,7 +29897,7 @@ for more details.`
|
|
|
28427
29897
|
resource: "studio.themes",
|
|
28428
29898
|
method: "list",
|
|
28429
29899
|
summary: "List the rendition themes of a platform",
|
|
28430
|
-
description: "List themes: the layouts a rendition is produced with, for one platform or for all of them. Pass a platform to see only the themes that platform can use. A theme decides the page or card a rendition is built into, so read the chosen theme before creating a rendition rather than after the output looks wrong.",
|
|
29900
|
+
description: "List themes: the layouts a rendition is produced with, for one platform or for all of them. Pass a platform to see only the themes that platform can use. The first page starts with the built-in themes (builtin true, such as warm-card@1 for Xiaohongshu cards and plain-mono@1 for WeChat articles), which every organization can use and nobody can change or delete; your organization's own themes follow. A theme decides the page or card a rendition is built into, so read the chosen theme before creating a rendition rather than after the output looks wrong.",
|
|
28431
29901
|
http: "GET",
|
|
28432
29902
|
path: "/studio/v1/themes",
|
|
28433
29903
|
streaming: "no",
|
|
@@ -28576,7 +30046,7 @@ for more details.`
|
|
|
28576
30046
|
required: true,
|
|
28577
30047
|
fields: [
|
|
28578
30048
|
{
|
|
28579
|
-
name: "
|
|
30049
|
+
name: "update_mask",
|
|
28580
30050
|
type: "array",
|
|
28581
30051
|
itemType: "string",
|
|
28582
30052
|
required: true,
|
|
@@ -28716,7 +30186,7 @@ for more details.`
|
|
|
28716
30186
|
description: "Caller-chosen key and value pairs kept on a resource; the keys are the caller's own names and no platform meaning is attached to them."
|
|
28717
30187
|
},
|
|
28718
30188
|
{
|
|
28719
|
-
name: "
|
|
30189
|
+
name: "request_id",
|
|
28720
30190
|
type: "string",
|
|
28721
30191
|
required: false,
|
|
28722
30192
|
description: "Caller-chosen key that makes this create safe to repeat: the same value answers the first result instead of creating a second work."
|
|
@@ -28789,14 +30259,14 @@ for more details.`
|
|
|
28789
30259
|
required: true,
|
|
28790
30260
|
fields: [
|
|
28791
30261
|
{
|
|
28792
|
-
name: "
|
|
30262
|
+
name: "update_mask",
|
|
28793
30263
|
type: "array",
|
|
28794
30264
|
itemType: "string",
|
|
28795
30265
|
required: true,
|
|
28796
30266
|
description: "Field paths this call changes, spelled as they appear in the work, such as title or goal.message; a field left out keeps its value."
|
|
28797
30267
|
},
|
|
28798
30268
|
{
|
|
28799
|
-
name: "
|
|
30269
|
+
name: "expected_revision",
|
|
28800
30270
|
type: "integer",
|
|
28801
30271
|
required: false,
|
|
28802
30272
|
description: "Work revision the caller read; when the work moved past it the write is refused with REVISION_CONFLICT and nothing changes."
|
|
@@ -28868,7 +30338,7 @@ for more details.`
|
|
|
28868
30338
|
required: true,
|
|
28869
30339
|
fields: [
|
|
28870
30340
|
{
|
|
28871
|
-
name: "
|
|
30341
|
+
name: "expected_revision",
|
|
28872
30342
|
type: "integer",
|
|
28873
30343
|
required: false,
|
|
28874
30344
|
description: "Brief revision the caller read; a mismatch is refused with REVISION_CONFLICT rather than merged."
|
|
@@ -28887,21 +30357,21 @@ for more details.`
|
|
|
28887
30357
|
description: "Source files to keep with the brief, added to the ones already attached."
|
|
28888
30358
|
},
|
|
28889
30359
|
{
|
|
28890
|
-
name: "
|
|
30360
|
+
name: "add_points",
|
|
28891
30361
|
type: "array",
|
|
28892
|
-
itemType: "
|
|
30362
|
+
itemType: "object",
|
|
28893
30363
|
required: false,
|
|
28894
|
-
description: "New requirement points to split out of the brief; each receives the next free key in order."
|
|
30364
|
+
description: "New requirement points to split out of the brief; each receives the next free key in order. A plain string is a unit point; pass { text, scope: work } for a constraint on the whole piece (period, voice, point of view, cast, words to avoid)."
|
|
28895
30365
|
},
|
|
28896
30366
|
{
|
|
28897
|
-
name: "
|
|
30367
|
+
name: "edit_points",
|
|
28898
30368
|
type: "array",
|
|
28899
30369
|
itemType: "object",
|
|
28900
30370
|
required: false,
|
|
28901
30371
|
description: "Existing points to reword, each naming the key it keeps and the text that replaces it."
|
|
28902
30372
|
},
|
|
28903
30373
|
{
|
|
28904
|
-
name: "
|
|
30374
|
+
name: "remove_points",
|
|
28905
30375
|
type: "array",
|
|
28906
30376
|
itemType: "string",
|
|
28907
30377
|
required: false,
|
|
@@ -28984,7 +30454,7 @@ for more details.`
|
|
|
28984
30454
|
description: "Unit tree to create the draft with, given by the caller instead of a template; children nest, and a unit without a kind takes the genre default for its position."
|
|
28985
30455
|
},
|
|
28986
30456
|
{
|
|
28987
|
-
name: "
|
|
30457
|
+
name: "derived_from",
|
|
28988
30458
|
type: "object",
|
|
28989
30459
|
required: false,
|
|
28990
30460
|
description: "What the new draft should be derived from, so the service can record the source revision for later staleness checks."
|
|
@@ -28996,7 +30466,7 @@ for more details.`
|
|
|
28996
30466
|
description: "Initial values for the genre properties, keyed by property key; a value the genre does not define is refused rather than stored."
|
|
28997
30467
|
},
|
|
28998
30468
|
{
|
|
28999
|
-
name: "
|
|
30469
|
+
name: "request_id",
|
|
29000
30470
|
type: "string",
|
|
29001
30471
|
required: false,
|
|
29002
30472
|
description: "Caller-chosen key that makes this create safe to repeat: the same value answers the first draft instead of creating a second one."
|
|
@@ -29065,14 +30535,14 @@ for more details.`
|
|
|
29065
30535
|
required: true,
|
|
29066
30536
|
fields: [
|
|
29067
30537
|
{
|
|
29068
|
-
name: "
|
|
30538
|
+
name: "update_mask",
|
|
29069
30539
|
type: "array",
|
|
29070
30540
|
itemType: "string",
|
|
29071
30541
|
required: true,
|
|
29072
30542
|
description: "Field paths this call changes, such as title, key or props.topics; a field left out keeps its value."
|
|
29073
30543
|
},
|
|
29074
30544
|
{
|
|
29075
|
-
name: "
|
|
30545
|
+
name: "expected_revision",
|
|
29076
30546
|
type: "integer",
|
|
29077
30547
|
required: false,
|
|
29078
30548
|
description: "Draft revision the caller read; a mismatch is refused with REVISION_CONFLICT and nothing changes. Omit it only for structure calls that genuinely do not depend on the current state."
|
|
@@ -29171,6 +30641,64 @@ for more details.`
|
|
|
29171
30641
|
],
|
|
29172
30642
|
query: []
|
|
29173
30643
|
},
|
|
30644
|
+
{
|
|
30645
|
+
resource: "studio.works.drafts.renditions",
|
|
30646
|
+
method: "create",
|
|
30647
|
+
summary: "Create a rendition of a draft for a platform",
|
|
30648
|
+
description: "Create a rendition: the form of one draft that a platform receives, such as a Xiaohongshu card set, a DOCX file or a Markdown file. Read the platform first with the platform call and pass its versioned key; pass a theme only to override the platform's default layout. Pass render true to render in the same call and read render_state and issues in the answer; without it the rendition starts as pending and the render call produces it. Rendering a Xiaohongshu card set is billed by Browser Rendering time (meter browser_ms, product studio-render); DOCX and Markdown renditions are not billed. A draft with no body renders as invalid with a draft_empty issue, and an unavailable render service leaves render_state failed with a render_unavailable issue, so repeat the render call later. Send a request_id to make a repeated call return the first rendition instead of creating another. Next, publish the rendition to export it.",
|
|
30649
|
+
http: "POST",
|
|
30650
|
+
path: "/studio/v1/works/{work}/drafts/{draft}/renditions",
|
|
30651
|
+
streaming: "no",
|
|
30652
|
+
pagination: false,
|
|
30653
|
+
pathParams: [
|
|
30654
|
+
{
|
|
30655
|
+
name: "work",
|
|
30656
|
+
sdkName: "work",
|
|
30657
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
30658
|
+
},
|
|
30659
|
+
{
|
|
30660
|
+
name: "draft",
|
|
30661
|
+
sdkName: "draft",
|
|
30662
|
+
description: "Draft being addressed, either its in-work key such as novel or its drf_ identifier; a key renamed earlier still resolves through its previous value."
|
|
30663
|
+
}
|
|
30664
|
+
],
|
|
30665
|
+
query: [],
|
|
30666
|
+
body: {
|
|
30667
|
+
required: true,
|
|
30668
|
+
fields: [
|
|
30669
|
+
{
|
|
30670
|
+
name: "platform",
|
|
30671
|
+
type: "string",
|
|
30672
|
+
required: true,
|
|
30673
|
+
description: "Versioned platform key from the platform list. Export platforms today are markdown@1, docx@1 and xiaohongshu@1; a platform that only publishes to an account answers PLATFORM_NOT_AVAILABLE."
|
|
30674
|
+
},
|
|
30675
|
+
{
|
|
30676
|
+
name: "theme",
|
|
30677
|
+
type: "string",
|
|
30678
|
+
required: false,
|
|
30679
|
+
description: "Theme to render with, a thm_ identifier or a built-in key from the theme list; omit it to use the platform default."
|
|
30680
|
+
},
|
|
30681
|
+
{
|
|
30682
|
+
name: "settings",
|
|
30683
|
+
type: "object",
|
|
30684
|
+
required: false,
|
|
30685
|
+
description: "Per-rendition settings; each platform reads only the settings that apply to it and ignores the rest."
|
|
30686
|
+
},
|
|
30687
|
+
{
|
|
30688
|
+
name: "render",
|
|
30689
|
+
type: "boolean",
|
|
30690
|
+
required: false,
|
|
30691
|
+
description: "Whether to render in the same call. True returns a rendition that is already rendered, invalid or failed; false or omitted returns it pending, to be rendered by the render operation."
|
|
30692
|
+
},
|
|
30693
|
+
{
|
|
30694
|
+
name: "request_id",
|
|
30695
|
+
type: "string",
|
|
30696
|
+
required: false,
|
|
30697
|
+
description: "Caller-chosen key that makes a repeated create return the first rendition instead of making another; use a new value for each distinct rendition."
|
|
30698
|
+
}
|
|
30699
|
+
]
|
|
30700
|
+
}
|
|
30701
|
+
},
|
|
29174
30702
|
{
|
|
29175
30703
|
resource: "studio.works.drafts",
|
|
29176
30704
|
method: "retrieveReview",
|
|
@@ -29416,7 +30944,7 @@ for more details.`
|
|
|
29416
30944
|
required: false,
|
|
29417
30945
|
fields: [
|
|
29418
30946
|
{
|
|
29419
|
-
name: "
|
|
30947
|
+
name: "expected_revision",
|
|
29420
30948
|
type: "integer",
|
|
29421
30949
|
required: false,
|
|
29422
30950
|
description: "Draft revision the caller read; a mismatch is refused rather than confirming a draft that changed under the caller."
|
|
@@ -29424,6 +30952,212 @@ for more details.`
|
|
|
29424
30952
|
]
|
|
29425
30953
|
}
|
|
29426
30954
|
},
|
|
30955
|
+
{
|
|
30956
|
+
resource: "studio.works.renditions",
|
|
30957
|
+
method: "list",
|
|
30958
|
+
summary: "List the renditions of a work",
|
|
30959
|
+
description: "List the renditions of one work, each with its platform, render state, stale flag and publish state. Pass draft to see only the renditions of one draft. Use it to find the rendition to publish or to render again, and read stale before exporting: a stale rendition was built from an older draft and cannot be exported until the render call has rebuilt it. The answer is one page; keep following next_page_token while it is present.",
|
|
30960
|
+
http: "GET",
|
|
30961
|
+
path: "/studio/v1/works/{work}/renditions",
|
|
30962
|
+
streaming: "no",
|
|
30963
|
+
pagination: false,
|
|
30964
|
+
pathParams: [
|
|
30965
|
+
{
|
|
30966
|
+
name: "work",
|
|
30967
|
+
sdkName: "work",
|
|
30968
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
30969
|
+
}
|
|
30970
|
+
],
|
|
30971
|
+
query: [
|
|
30972
|
+
{
|
|
30973
|
+
name: "draft",
|
|
30974
|
+
type: "string",
|
|
30975
|
+
required: false,
|
|
30976
|
+
description: "Draft key such as novel or its drf_ identifier; when given, only the renditions of that draft are returned. Omit it to list the renditions of every draft in the work."
|
|
30977
|
+
},
|
|
30978
|
+
{
|
|
30979
|
+
name: "page_size",
|
|
30980
|
+
type: "integer",
|
|
30981
|
+
required: false,
|
|
30982
|
+
description: "How many items this page returns, 1 to 100; omitted uses the service default. Treat the answer as one page, not the whole set, and keep following next_page_token while it is present."
|
|
30983
|
+
},
|
|
30984
|
+
{
|
|
30985
|
+
name: "page_token",
|
|
30986
|
+
type: "string",
|
|
30987
|
+
required: false,
|
|
30988
|
+
description: "Cursor from the previous answer's next_page_token; it is opaque, so pass it back unchanged and never build one from an id or an offset."
|
|
30989
|
+
}
|
|
30990
|
+
]
|
|
30991
|
+
},
|
|
30992
|
+
{
|
|
30993
|
+
resource: "studio.works.renditions",
|
|
30994
|
+
method: "delete",
|
|
30995
|
+
summary: "Delete a rendition",
|
|
30996
|
+
description: "Delete a rendition and stop listing it. The draft it was built from is untouched, and a new rendition can be created from it at any time. Files already downloaded from an earlier export are not affected. Use it to clear a failed or abandoned rendition; to refresh one, call the render operation instead.",
|
|
30997
|
+
http: "DELETE",
|
|
30998
|
+
path: "/studio/v1/works/{work}/renditions/{rendition}",
|
|
30999
|
+
streaming: "no",
|
|
31000
|
+
pagination: false,
|
|
31001
|
+
pathParams: [
|
|
31002
|
+
{
|
|
31003
|
+
name: "work",
|
|
31004
|
+
sdkName: "work",
|
|
31005
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
31006
|
+
},
|
|
31007
|
+
{
|
|
31008
|
+
name: "rendition",
|
|
31009
|
+
sdkName: "rendition",
|
|
31010
|
+
description: "Rendition being addressed, by its rnd_ identifier from the rendition list or from the create answer."
|
|
31011
|
+
}
|
|
31012
|
+
],
|
|
31013
|
+
query: []
|
|
31014
|
+
},
|
|
31015
|
+
{
|
|
31016
|
+
resource: "studio.works.renditions",
|
|
31017
|
+
method: "retrieve",
|
|
31018
|
+
summary: "Read one rendition",
|
|
31019
|
+
description: "Read one rendition in full: its render state, the validation issues the render found, the parts (one per card page or thread post), the files it produced and its publish state. Call it after create, render or publish to see the outcome, because a render that finished invalid or failed is reported here and not as an HTTP error. stale is true when the draft has changed since source_revision; call the render operation before exporting a stale rendition.",
|
|
31020
|
+
http: "GET",
|
|
31021
|
+
path: "/studio/v1/works/{work}/renditions/{rendition}",
|
|
31022
|
+
streaming: "no",
|
|
31023
|
+
pagination: false,
|
|
31024
|
+
pathParams: [
|
|
31025
|
+
{
|
|
31026
|
+
name: "work",
|
|
31027
|
+
sdkName: "work",
|
|
31028
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
31029
|
+
},
|
|
31030
|
+
{
|
|
31031
|
+
name: "rendition",
|
|
31032
|
+
sdkName: "rendition",
|
|
31033
|
+
description: "Rendition being addressed, by its rnd_ identifier from the rendition list or from the create answer."
|
|
31034
|
+
}
|
|
31035
|
+
],
|
|
31036
|
+
query: []
|
|
31037
|
+
},
|
|
31038
|
+
{
|
|
31039
|
+
resource: "studio.works.renditions",
|
|
31040
|
+
method: "update",
|
|
31041
|
+
summary: "Change the theme or settings of a rendition",
|
|
31042
|
+
description: "Change a rendition's theme or settings. Send update_mask naming exactly the fields you change, such as theme or settings; a field left out keeps its value. The produced files are not rebuilt by this call, so call the render operation afterwards to apply the change. A rendition whose export or publish has started is locked and answers RENDITION_PUBLISH_LOCKED; create a new rendition for new content.",
|
|
31043
|
+
http: "PATCH",
|
|
31044
|
+
path: "/studio/v1/works/{work}/renditions/{rendition}",
|
|
31045
|
+
streaming: "no",
|
|
31046
|
+
pagination: false,
|
|
31047
|
+
pathParams: [
|
|
31048
|
+
{
|
|
31049
|
+
name: "work",
|
|
31050
|
+
sdkName: "work",
|
|
31051
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
31052
|
+
},
|
|
31053
|
+
{
|
|
31054
|
+
name: "rendition",
|
|
31055
|
+
sdkName: "rendition",
|
|
31056
|
+
description: "Rendition being addressed, by its rnd_ identifier from the rendition list or from the create answer."
|
|
31057
|
+
}
|
|
31058
|
+
],
|
|
31059
|
+
query: [],
|
|
31060
|
+
body: {
|
|
31061
|
+
required: true,
|
|
31062
|
+
fields: [
|
|
31063
|
+
{
|
|
31064
|
+
name: "update_mask",
|
|
31065
|
+
type: "array",
|
|
31066
|
+
itemType: "string",
|
|
31067
|
+
required: true,
|
|
31068
|
+
description: "Field paths this call changes: theme, settings or both; a field left out keeps its value."
|
|
31069
|
+
},
|
|
31070
|
+
{
|
|
31071
|
+
name: "theme",
|
|
31072
|
+
type: "string",
|
|
31073
|
+
required: false,
|
|
31074
|
+
description: "New theme, a thm_ identifier or a built-in key, used when theme is named in the update mask; render again to apply it."
|
|
31075
|
+
},
|
|
31076
|
+
{
|
|
31077
|
+
name: "settings",
|
|
31078
|
+
type: "object",
|
|
31079
|
+
required: false,
|
|
31080
|
+
description: "Per-rendition settings; each platform reads only the settings that apply to it and ignores the rest."
|
|
31081
|
+
}
|
|
31082
|
+
]
|
|
31083
|
+
}
|
|
31084
|
+
},
|
|
31085
|
+
{
|
|
31086
|
+
resource: "studio.works.renditions",
|
|
31087
|
+
method: "retrieveContent",
|
|
31088
|
+
summary: "Get a download URL for a rendition file",
|
|
31089
|
+
description: "Get a signed, short-lived URL to download what a rendition produced. Without part it points to the rendition's own first file: the ZIP of pages for a card rendition, the DOCX for docx@1. With part it points to that part's first file, such as one card PNG; a part that has no file, or a rendition not rendered yet, answers RENDITION_NOT_RENDERED, and an index no part has answers INVALID_PARAMS. Call it after a successful render or export, download the url before expire_time, and call again for a fresh one when it has expired. The URL is a credential: do not store or share it.",
|
|
31090
|
+
http: "GET",
|
|
31091
|
+
path: "/studio/v1/works/{work}/renditions/{rendition}/content",
|
|
31092
|
+
streaming: "no",
|
|
31093
|
+
pagination: false,
|
|
31094
|
+
pathParams: [
|
|
31095
|
+
{
|
|
31096
|
+
name: "work",
|
|
31097
|
+
sdkName: "work",
|
|
31098
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
31099
|
+
},
|
|
31100
|
+
{
|
|
31101
|
+
name: "rendition",
|
|
31102
|
+
sdkName: "rendition",
|
|
31103
|
+
description: "Rendition being addressed, by its rnd_ identifier from the rendition list or from the create answer."
|
|
31104
|
+
}
|
|
31105
|
+
],
|
|
31106
|
+
query: [
|
|
31107
|
+
{
|
|
31108
|
+
name: "part",
|
|
31109
|
+
type: "integer",
|
|
31110
|
+
required: false,
|
|
31111
|
+
description: "Index of the part to download, the index value of an entry in the rendition's parts list; omit it to get the rendition's own first file."
|
|
31112
|
+
}
|
|
31113
|
+
]
|
|
31114
|
+
},
|
|
31115
|
+
{
|
|
31116
|
+
resource: "studio.works.renditions",
|
|
31117
|
+
method: "publish",
|
|
31118
|
+
summary: "Export a rendition",
|
|
31119
|
+
description: "Export a rendition for the platforms that deliver a file: markdown@1, docx@1 and xiaohongshu@1 end with publish.state exported, and a card rendition gains one ZIP of its pages in files. Publishing to a platform account such as X or WeChat is not available yet and answers PLATFORM_NOT_AVAILABLE; export instead. The rendition must be rendered, not stale and without error-level issues: RENDITION_NOT_RENDERED means call the render operation first, RENDITION_STALE means the draft changed so render again, RENDITION_INVALID means fix the draft problems listed in issues and render again. Exporting the same rendition twice at once answers REVISION_CONFLICT; retry shortly. Next, call the content operation to download the file.",
|
|
31120
|
+
http: "POST",
|
|
31121
|
+
path: "/studio/v1/works/{work}/renditions/{rendition}:publish",
|
|
31122
|
+
streaming: "no",
|
|
31123
|
+
pagination: false,
|
|
31124
|
+
pathParams: [
|
|
31125
|
+
{
|
|
31126
|
+
name: "work",
|
|
31127
|
+
sdkName: "work",
|
|
31128
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
31129
|
+
},
|
|
31130
|
+
{
|
|
31131
|
+
name: "rendition",
|
|
31132
|
+
sdkName: "rendition",
|
|
31133
|
+
description: "Rendition being addressed, by its rnd_ identifier from the rendition list or from the create answer."
|
|
31134
|
+
}
|
|
31135
|
+
],
|
|
31136
|
+
query: []
|
|
31137
|
+
},
|
|
31138
|
+
{
|
|
31139
|
+
resource: "studio.works.renditions",
|
|
31140
|
+
method: "render",
|
|
31141
|
+
summary: "Render a rendition again from the current draft",
|
|
31142
|
+
description: "Render the rendition from the draft as it is now, replacing its parts and files and clearing stale. Call it after the draft changed, after a theme or settings change, or after a failed render. The answer carries render_state: rendered, invalid when the draft has an error-level issue (for example draft_empty on a draft with no body), or failed when the render service was unavailable (issue render_unavailable; repeat later). A render does not fail the HTTP call for those outcomes, so read render_state and issues. Rendering a Xiaohongshu card set is billed by Browser Rendering time (meter browser_ms, product studio-render); DOCX and Markdown are not billed. Rendering the same rendition twice at once answers REVISION_CONFLICT; retry shortly. Next, publish the rendition to export it.",
|
|
31143
|
+
http: "POST",
|
|
31144
|
+
path: "/studio/v1/works/{work}/renditions/{rendition}:render",
|
|
31145
|
+
streaming: "no",
|
|
31146
|
+
pagination: false,
|
|
31147
|
+
pathParams: [
|
|
31148
|
+
{
|
|
31149
|
+
name: "work",
|
|
31150
|
+
sdkName: "work",
|
|
31151
|
+
description: "The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value."
|
|
31152
|
+
},
|
|
31153
|
+
{
|
|
31154
|
+
name: "rendition",
|
|
31155
|
+
sdkName: "rendition",
|
|
31156
|
+
description: "Rendition being addressed, by its rnd_ identifier from the rendition list or from the create answer."
|
|
31157
|
+
}
|
|
31158
|
+
],
|
|
31159
|
+
query: []
|
|
31160
|
+
},
|
|
29427
31161
|
{
|
|
29428
31162
|
resource: "studio.works.units",
|
|
29429
31163
|
method: "retrieve",
|
|
@@ -38352,6 +40086,341 @@ var devopsTestReportsUpload = (options) => (options.client ?? client).post({
|
|
|
38352
40086
|
...options.headers
|
|
38353
40087
|
}
|
|
38354
40088
|
});
|
|
40089
|
+
var devopsProjectsList = (options) => (options?.client ?? client).get({
|
|
40090
|
+
security: [{
|
|
40091
|
+
key: "devops-bearerAuth",
|
|
40092
|
+
scheme: "bearer",
|
|
40093
|
+
type: "http"
|
|
40094
|
+
}],
|
|
40095
|
+
url: "/devops/v1/projects",
|
|
40096
|
+
...options
|
|
40097
|
+
});
|
|
40098
|
+
var devopsProjectsGet = (options) => (options.client ?? client).get({
|
|
40099
|
+
security: [{
|
|
40100
|
+
key: "devops-bearerAuth",
|
|
40101
|
+
scheme: "bearer",
|
|
40102
|
+
type: "http"
|
|
40103
|
+
}],
|
|
40104
|
+
url: "/devops/v1/projects/{id}",
|
|
40105
|
+
...options
|
|
40106
|
+
});
|
|
40107
|
+
var devopsReleasesList = (options) => (options.client ?? client).get({
|
|
40108
|
+
security: [{
|
|
40109
|
+
key: "devops-bearerAuth",
|
|
40110
|
+
scheme: "bearer",
|
|
40111
|
+
type: "http"
|
|
40112
|
+
}],
|
|
40113
|
+
url: "/devops/v1/projects/{project}/releases",
|
|
40114
|
+
...options
|
|
40115
|
+
});
|
|
40116
|
+
var devopsReleasesCreate = (options) => (options.client ?? client).post({
|
|
40117
|
+
security: [{
|
|
40118
|
+
key: "devops-bearerAuth",
|
|
40119
|
+
scheme: "bearer",
|
|
40120
|
+
type: "http"
|
|
40121
|
+
}],
|
|
40122
|
+
url: "/devops/v1/projects/{project}/releases",
|
|
40123
|
+
...options,
|
|
40124
|
+
headers: {
|
|
40125
|
+
"Content-Type": "application/json",
|
|
40126
|
+
...options.headers
|
|
40127
|
+
}
|
|
40128
|
+
});
|
|
40129
|
+
var devopsReleasesGet = (options) => (options.client ?? client).get({
|
|
40130
|
+
security: [{
|
|
40131
|
+
key: "devops-bearerAuth",
|
|
40132
|
+
scheme: "bearer",
|
|
40133
|
+
type: "http"
|
|
40134
|
+
}],
|
|
40135
|
+
url: "/devops/v1/releases/{id}",
|
|
40136
|
+
...options
|
|
40137
|
+
});
|
|
40138
|
+
var devopsReleasesAbandon = (options) => (options.client ?? client).post({
|
|
40139
|
+
security: [{
|
|
40140
|
+
key: "devops-bearerAuth",
|
|
40141
|
+
scheme: "bearer",
|
|
40142
|
+
type: "http"
|
|
40143
|
+
}],
|
|
40144
|
+
url: "/devops/v1/releases/{id}:abandon",
|
|
40145
|
+
...options,
|
|
40146
|
+
headers: {
|
|
40147
|
+
"Content-Type": "application/json",
|
|
40148
|
+
...options.headers
|
|
40149
|
+
}
|
|
40150
|
+
});
|
|
40151
|
+
var devopsPromotionsCreate = (options) => (options.client ?? client).post({
|
|
40152
|
+
security: [{
|
|
40153
|
+
key: "devops-bearerAuth",
|
|
40154
|
+
scheme: "bearer",
|
|
40155
|
+
type: "http"
|
|
40156
|
+
}],
|
|
40157
|
+
url: "/devops/v1/promotions",
|
|
40158
|
+
...options,
|
|
40159
|
+
headers: {
|
|
40160
|
+
"Content-Type": "application/json",
|
|
40161
|
+
...options.headers
|
|
40162
|
+
}
|
|
40163
|
+
});
|
|
40164
|
+
var devopsPromotionsList = (options) => (options.client ?? client).get({
|
|
40165
|
+
security: [{
|
|
40166
|
+
key: "devops-bearerAuth",
|
|
40167
|
+
scheme: "bearer",
|
|
40168
|
+
type: "http"
|
|
40169
|
+
}],
|
|
40170
|
+
url: "/devops/v1/projects/{project}/promotions",
|
|
40171
|
+
...options
|
|
40172
|
+
});
|
|
40173
|
+
var devopsPromotionsGet = (options) => (options.client ?? client).get({
|
|
40174
|
+
security: [{
|
|
40175
|
+
key: "devops-bearerAuth",
|
|
40176
|
+
scheme: "bearer",
|
|
40177
|
+
type: "http"
|
|
40178
|
+
}],
|
|
40179
|
+
url: "/devops/v1/promotions/{id}",
|
|
40180
|
+
...options
|
|
40181
|
+
});
|
|
40182
|
+
var devopsPromotionsApprove = (options) => (options.client ?? client).post({
|
|
40183
|
+
security: [{
|
|
40184
|
+
key: "devops-bearerAuth",
|
|
40185
|
+
scheme: "bearer",
|
|
40186
|
+
type: "http"
|
|
40187
|
+
}],
|
|
40188
|
+
url: "/devops/v1/promotions/{id}:approve",
|
|
40189
|
+
...options,
|
|
40190
|
+
headers: {
|
|
40191
|
+
"Content-Type": "application/json",
|
|
40192
|
+
...options.headers
|
|
40193
|
+
}
|
|
40194
|
+
});
|
|
40195
|
+
var devopsPromotionsCancel = (options) => (options.client ?? client).post({
|
|
40196
|
+
security: [{
|
|
40197
|
+
key: "devops-bearerAuth",
|
|
40198
|
+
scheme: "bearer",
|
|
40199
|
+
type: "http"
|
|
40200
|
+
}],
|
|
40201
|
+
url: "/devops/v1/promotions/{id}:cancel",
|
|
40202
|
+
...options,
|
|
40203
|
+
headers: {
|
|
40204
|
+
"Content-Type": "application/json",
|
|
40205
|
+
...options.headers
|
|
40206
|
+
}
|
|
40207
|
+
});
|
|
40208
|
+
var devopsPromotionsRetry = (options) => (options.client ?? client).post({
|
|
40209
|
+
security: [{
|
|
40210
|
+
key: "devops-bearerAuth",
|
|
40211
|
+
scheme: "bearer",
|
|
40212
|
+
type: "http"
|
|
40213
|
+
}],
|
|
40214
|
+
url: "/devops/v1/promotions/{id}:retry",
|
|
40215
|
+
...options
|
|
40216
|
+
});
|
|
40217
|
+
var devopsPromotionsConclude = (options) => (options.client ?? client).post({
|
|
40218
|
+
security: [{
|
|
40219
|
+
key: "devops-bearerAuth",
|
|
40220
|
+
scheme: "bearer",
|
|
40221
|
+
type: "http"
|
|
40222
|
+
}],
|
|
40223
|
+
url: "/devops/v1/promotions/{id}:conclude",
|
|
40224
|
+
...options,
|
|
40225
|
+
headers: {
|
|
40226
|
+
"Content-Type": "application/json",
|
|
40227
|
+
...options.headers
|
|
40228
|
+
}
|
|
40229
|
+
});
|
|
40230
|
+
var devopsRolloutsList = (options) => (options.client ?? client).get({
|
|
40231
|
+
security: [{
|
|
40232
|
+
key: "devops-bearerAuth",
|
|
40233
|
+
scheme: "bearer",
|
|
40234
|
+
type: "http"
|
|
40235
|
+
}],
|
|
40236
|
+
url: "/devops/v1/promotions/{promotion}/rollouts",
|
|
40237
|
+
...options
|
|
40238
|
+
});
|
|
40239
|
+
var devopsRolloutsGet = (options) => (options.client ?? client).get({
|
|
40240
|
+
security: [{
|
|
40241
|
+
key: "devops-bearerAuth",
|
|
40242
|
+
scheme: "bearer",
|
|
40243
|
+
type: "http"
|
|
40244
|
+
}],
|
|
40245
|
+
url: "/devops/v1/rollouts/{id}",
|
|
40246
|
+
...options
|
|
40247
|
+
});
|
|
40248
|
+
var devopsEnvironmentsList = (options) => (options.client ?? client).get({
|
|
40249
|
+
security: [{
|
|
40250
|
+
key: "devops-bearerAuth",
|
|
40251
|
+
scheme: "bearer",
|
|
40252
|
+
type: "http"
|
|
40253
|
+
}],
|
|
40254
|
+
url: "/devops/v1/projects/{project}/environments",
|
|
40255
|
+
...options
|
|
40256
|
+
});
|
|
40257
|
+
var devopsEnvironmentsCheckpointsList = (options) => (options.client ?? client).get({
|
|
40258
|
+
security: [{
|
|
40259
|
+
key: "devops-bearerAuth",
|
|
40260
|
+
scheme: "bearer",
|
|
40261
|
+
type: "http"
|
|
40262
|
+
}],
|
|
40263
|
+
url: "/devops/v1/environments/{id}/checkpoints",
|
|
40264
|
+
...options
|
|
40265
|
+
});
|
|
40266
|
+
var devopsTargetsList = (options) => (options.client ?? client).get({
|
|
40267
|
+
security: [{
|
|
40268
|
+
key: "devops-bearerAuth",
|
|
40269
|
+
scheme: "bearer",
|
|
40270
|
+
type: "http"
|
|
40271
|
+
}],
|
|
40272
|
+
url: "/devops/v1/projects/{project}/targets",
|
|
40273
|
+
...options
|
|
40274
|
+
});
|
|
40275
|
+
var devopsTargetsRefresh = (options) => (options.client ?? client).post({
|
|
40276
|
+
security: [{
|
|
40277
|
+
key: "devops-bearerAuth",
|
|
40278
|
+
scheme: "bearer",
|
|
40279
|
+
type: "http"
|
|
40280
|
+
}],
|
|
40281
|
+
url: "/devops/v1/projects/{project}/targets:refresh",
|
|
40282
|
+
...options,
|
|
40283
|
+
headers: {
|
|
40284
|
+
"Content-Type": "application/json",
|
|
40285
|
+
...options.headers
|
|
40286
|
+
}
|
|
40287
|
+
});
|
|
40288
|
+
var devopsFlagsList = (options) => (options.client ?? client).get({
|
|
40289
|
+
security: [{
|
|
40290
|
+
key: "devops-bearerAuth",
|
|
40291
|
+
scheme: "bearer",
|
|
40292
|
+
type: "http"
|
|
40293
|
+
}],
|
|
40294
|
+
url: "/devops/v1/projects/{project}/flags",
|
|
40295
|
+
...options
|
|
40296
|
+
});
|
|
40297
|
+
var devopsFlagsCreate = (options) => (options.client ?? client).post({
|
|
40298
|
+
security: [{
|
|
40299
|
+
key: "devops-bearerAuth",
|
|
40300
|
+
scheme: "bearer",
|
|
40301
|
+
type: "http"
|
|
40302
|
+
}],
|
|
40303
|
+
url: "/devops/v1/projects/{project}/flags",
|
|
40304
|
+
...options,
|
|
40305
|
+
headers: {
|
|
40306
|
+
"Content-Type": "application/json",
|
|
40307
|
+
...options.headers
|
|
40308
|
+
}
|
|
40309
|
+
});
|
|
40310
|
+
var devopsFlagsGet = (options) => (options.client ?? client).get({
|
|
40311
|
+
security: [{
|
|
40312
|
+
key: "devops-bearerAuth",
|
|
40313
|
+
scheme: "bearer",
|
|
40314
|
+
type: "http"
|
|
40315
|
+
}],
|
|
40316
|
+
url: "/devops/v1/flags/{id}",
|
|
40317
|
+
...options
|
|
40318
|
+
});
|
|
40319
|
+
var devopsFlagsUpdate = (options) => (options.client ?? client).patch({
|
|
40320
|
+
security: [{
|
|
40321
|
+
key: "devops-bearerAuth",
|
|
40322
|
+
scheme: "bearer",
|
|
40323
|
+
type: "http"
|
|
40324
|
+
}],
|
|
40325
|
+
url: "/devops/v1/flags/{id}",
|
|
40326
|
+
...options,
|
|
40327
|
+
headers: {
|
|
40328
|
+
"Content-Type": "application/json",
|
|
40329
|
+
...options.headers
|
|
40330
|
+
}
|
|
40331
|
+
});
|
|
40332
|
+
var devopsFlagsUpdateEnvironment = (options) => (options.client ?? client).patch({
|
|
40333
|
+
security: [{
|
|
40334
|
+
key: "devops-bearerAuth",
|
|
40335
|
+
scheme: "bearer",
|
|
40336
|
+
type: "http"
|
|
40337
|
+
}],
|
|
40338
|
+
url: "/devops/v1/flags/{id}/environments/{environment}",
|
|
40339
|
+
...options,
|
|
40340
|
+
headers: {
|
|
40341
|
+
"Content-Type": "application/json",
|
|
40342
|
+
...options.headers
|
|
40343
|
+
}
|
|
40344
|
+
});
|
|
40345
|
+
var devopsFlagsConclude = (options) => (options.client ?? client).post({
|
|
40346
|
+
security: [{
|
|
40347
|
+
key: "devops-bearerAuth",
|
|
40348
|
+
scheme: "bearer",
|
|
40349
|
+
type: "http"
|
|
40350
|
+
}],
|
|
40351
|
+
url: "/devops/v1/flags/{id}:conclude",
|
|
40352
|
+
...options,
|
|
40353
|
+
headers: {
|
|
40354
|
+
"Content-Type": "application/json",
|
|
40355
|
+
...options.headers
|
|
40356
|
+
}
|
|
40357
|
+
});
|
|
40358
|
+
var devopsFlagsArchive = (options) => (options.client ?? client).post({
|
|
40359
|
+
security: [{
|
|
40360
|
+
key: "devops-bearerAuth",
|
|
40361
|
+
scheme: "bearer",
|
|
40362
|
+
type: "http"
|
|
40363
|
+
}],
|
|
40364
|
+
url: "/devops/v1/flags/{id}:archive",
|
|
40365
|
+
...options
|
|
40366
|
+
});
|
|
40367
|
+
var devopsProgressiveRolloutsCreate = (options) => (options.client ?? client).post({
|
|
40368
|
+
security: [{
|
|
40369
|
+
key: "devops-bearerAuth",
|
|
40370
|
+
scheme: "bearer",
|
|
40371
|
+
type: "http"
|
|
40372
|
+
}],
|
|
40373
|
+
url: "/devops/v1/progressive-rollouts",
|
|
40374
|
+
...options,
|
|
40375
|
+
headers: {
|
|
40376
|
+
"Content-Type": "application/json",
|
|
40377
|
+
...options.headers
|
|
40378
|
+
}
|
|
40379
|
+
});
|
|
40380
|
+
var devopsProgressiveRolloutsGet = (options) => (options.client ?? client).get({
|
|
40381
|
+
security: [{
|
|
40382
|
+
key: "devops-bearerAuth",
|
|
40383
|
+
scheme: "bearer",
|
|
40384
|
+
type: "http"
|
|
40385
|
+
}],
|
|
40386
|
+
url: "/devops/v1/progressive-rollouts/{id}",
|
|
40387
|
+
...options
|
|
40388
|
+
});
|
|
40389
|
+
var devopsProgressiveRolloutsPause = (options) => (options.client ?? client).post({
|
|
40390
|
+
security: [{
|
|
40391
|
+
key: "devops-bearerAuth",
|
|
40392
|
+
scheme: "bearer",
|
|
40393
|
+
type: "http"
|
|
40394
|
+
}],
|
|
40395
|
+
url: "/devops/v1/progressive-rollouts/{id}:pause",
|
|
40396
|
+
...options,
|
|
40397
|
+
headers: {
|
|
40398
|
+
"Content-Type": "application/json",
|
|
40399
|
+
...options.headers
|
|
40400
|
+
}
|
|
40401
|
+
});
|
|
40402
|
+
var devopsProgressiveRolloutsResume = (options) => (options.client ?? client).post({
|
|
40403
|
+
security: [{
|
|
40404
|
+
key: "devops-bearerAuth",
|
|
40405
|
+
scheme: "bearer",
|
|
40406
|
+
type: "http"
|
|
40407
|
+
}],
|
|
40408
|
+
url: "/devops/v1/progressive-rollouts/{id}:resume",
|
|
40409
|
+
...options
|
|
40410
|
+
});
|
|
40411
|
+
var devopsProgressiveRolloutsRollback = (options) => (options.client ?? client).post({
|
|
40412
|
+
security: [{
|
|
40413
|
+
key: "devops-bearerAuth",
|
|
40414
|
+
scheme: "bearer",
|
|
40415
|
+
type: "http"
|
|
40416
|
+
}],
|
|
40417
|
+
url: "/devops/v1/progressive-rollouts/{id}:rollback",
|
|
40418
|
+
...options,
|
|
40419
|
+
headers: {
|
|
40420
|
+
"Content-Type": "application/json",
|
|
40421
|
+
...options.headers
|
|
40422
|
+
}
|
|
40423
|
+
});
|
|
38355
40424
|
var knowledgeListVectorStores = (options) => (options?.client ?? client).get({
|
|
38356
40425
|
security: [{
|
|
38357
40426
|
key: "knowledge-bearerAuth",
|
|
@@ -38873,6 +40942,76 @@ var mediaCreateDeliveryToken = (options) => (options.client ?? client).post({
|
|
|
38873
40942
|
...options.headers
|
|
38874
40943
|
}
|
|
38875
40944
|
});
|
|
40945
|
+
var mediaGetDefaultLibrary = (options) => (options?.client ?? client).get({
|
|
40946
|
+
security: [{
|
|
40947
|
+
key: "media-BearerAuth",
|
|
40948
|
+
scheme: "bearer",
|
|
40949
|
+
type: "http"
|
|
40950
|
+
}],
|
|
40951
|
+
url: "/media/v1/libraries/default",
|
|
40952
|
+
...options
|
|
40953
|
+
});
|
|
40954
|
+
var mediaSetDefaultLibrary = (options) => (options.client ?? client).put({
|
|
40955
|
+
security: [{
|
|
40956
|
+
key: "media-BearerAuth",
|
|
40957
|
+
scheme: "bearer",
|
|
40958
|
+
type: "http"
|
|
40959
|
+
}],
|
|
40960
|
+
url: "/media/v1/libraries/default",
|
|
40961
|
+
...options,
|
|
40962
|
+
headers: {
|
|
40963
|
+
"Content-Type": "application/json",
|
|
40964
|
+
...options.headers
|
|
40965
|
+
}
|
|
40966
|
+
});
|
|
40967
|
+
var mediaGetAssetLineage = (options) => (options.client ?? client).get({
|
|
40968
|
+
security: [{
|
|
40969
|
+
key: "media-BearerAuth",
|
|
40970
|
+
scheme: "bearer",
|
|
40971
|
+
type: "http"
|
|
40972
|
+
}],
|
|
40973
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/lineage",
|
|
40974
|
+
...options
|
|
40975
|
+
});
|
|
40976
|
+
var mediaGenerateImage = (options) => (options.client ?? client).post({
|
|
40977
|
+
security: [{
|
|
40978
|
+
key: "media-BearerAuth",
|
|
40979
|
+
scheme: "bearer",
|
|
40980
|
+
type: "http"
|
|
40981
|
+
}],
|
|
40982
|
+
url: "/media/v1/libraries/{library_id}/images/generations",
|
|
40983
|
+
...options,
|
|
40984
|
+
headers: {
|
|
40985
|
+
"Content-Type": "application/json",
|
|
40986
|
+
...options.headers
|
|
40987
|
+
}
|
|
40988
|
+
});
|
|
40989
|
+
var mediaGenerateVideo = (options) => (options.client ?? client).post({
|
|
40990
|
+
security: [{
|
|
40991
|
+
key: "media-BearerAuth",
|
|
40992
|
+
scheme: "bearer",
|
|
40993
|
+
type: "http"
|
|
40994
|
+
}],
|
|
40995
|
+
url: "/media/v1/libraries/{library_id}/videos/generations",
|
|
40996
|
+
...options,
|
|
40997
|
+
headers: {
|
|
40998
|
+
"Content-Type": "application/json",
|
|
40999
|
+
...options.headers
|
|
41000
|
+
}
|
|
41001
|
+
});
|
|
41002
|
+
var mediaEditAsset = (options) => (options.client ?? client).post({
|
|
41003
|
+
security: [{
|
|
41004
|
+
key: "media-BearerAuth",
|
|
41005
|
+
scheme: "bearer",
|
|
41006
|
+
type: "http"
|
|
41007
|
+
}],
|
|
41008
|
+
url: "/media/v1/libraries/{library_id}/assets/{asset_id}/edits",
|
|
41009
|
+
...options,
|
|
41010
|
+
headers: {
|
|
41011
|
+
"Content-Type": "application/json",
|
|
41012
|
+
...options.headers
|
|
41013
|
+
}
|
|
41014
|
+
});
|
|
38876
41015
|
var mediaUnderstandingFailureSummary = (options) => (options.client ?? client).get({
|
|
38877
41016
|
security: [{
|
|
38878
41017
|
key: "media-BearerAuth",
|
|
@@ -40791,6 +42930,118 @@ var studioThemesUpdate = (options) => (options.client ?? client).patch({
|
|
|
40791
42930
|
...options.headers
|
|
40792
42931
|
}
|
|
40793
42932
|
});
|
|
42933
|
+
var studioRenditionsCreate = (options) => (options.client ?? client).post({
|
|
42934
|
+
security: [{
|
|
42935
|
+
key: "BearerAuth",
|
|
42936
|
+
scheme: "bearer",
|
|
42937
|
+
type: "http"
|
|
42938
|
+
}, {
|
|
42939
|
+
key: "ApiKeyAuth",
|
|
42940
|
+
name: "X-API-Key",
|
|
42941
|
+
type: "apiKey"
|
|
42942
|
+
}],
|
|
42943
|
+
url: "/studio/v1/works/{work}/drafts/{draft}/renditions",
|
|
42944
|
+
...options,
|
|
42945
|
+
headers: {
|
|
42946
|
+
"Content-Type": "application/json",
|
|
42947
|
+
...options.headers
|
|
42948
|
+
}
|
|
42949
|
+
});
|
|
42950
|
+
var studioRenditionsList = (options) => (options.client ?? client).get({
|
|
42951
|
+
security: [{
|
|
42952
|
+
key: "BearerAuth",
|
|
42953
|
+
scheme: "bearer",
|
|
42954
|
+
type: "http"
|
|
42955
|
+
}, {
|
|
42956
|
+
key: "ApiKeyAuth",
|
|
42957
|
+
name: "X-API-Key",
|
|
42958
|
+
type: "apiKey"
|
|
42959
|
+
}],
|
|
42960
|
+
url: "/studio/v1/works/{work}/renditions",
|
|
42961
|
+
...options
|
|
42962
|
+
});
|
|
42963
|
+
var studioRenditionsDelete = (options) => (options.client ?? client).delete({
|
|
42964
|
+
security: [{
|
|
42965
|
+
key: "BearerAuth",
|
|
42966
|
+
scheme: "bearer",
|
|
42967
|
+
type: "http"
|
|
42968
|
+
}, {
|
|
42969
|
+
key: "ApiKeyAuth",
|
|
42970
|
+
name: "X-API-Key",
|
|
42971
|
+
type: "apiKey"
|
|
42972
|
+
}],
|
|
42973
|
+
url: "/studio/v1/works/{work}/renditions/{rendition}",
|
|
42974
|
+
...options
|
|
42975
|
+
});
|
|
42976
|
+
var studioRenditionsGet = (options) => (options.client ?? client).get({
|
|
42977
|
+
security: [{
|
|
42978
|
+
key: "BearerAuth",
|
|
42979
|
+
scheme: "bearer",
|
|
42980
|
+
type: "http"
|
|
42981
|
+
}, {
|
|
42982
|
+
key: "ApiKeyAuth",
|
|
42983
|
+
name: "X-API-Key",
|
|
42984
|
+
type: "apiKey"
|
|
42985
|
+
}],
|
|
42986
|
+
url: "/studio/v1/works/{work}/renditions/{rendition}",
|
|
42987
|
+
...options
|
|
42988
|
+
});
|
|
42989
|
+
var studioRenditionsUpdate = (options) => (options.client ?? client).patch({
|
|
42990
|
+
security: [{
|
|
42991
|
+
key: "BearerAuth",
|
|
42992
|
+
scheme: "bearer",
|
|
42993
|
+
type: "http"
|
|
42994
|
+
}, {
|
|
42995
|
+
key: "ApiKeyAuth",
|
|
42996
|
+
name: "X-API-Key",
|
|
42997
|
+
type: "apiKey"
|
|
42998
|
+
}],
|
|
42999
|
+
url: "/studio/v1/works/{work}/renditions/{rendition}",
|
|
43000
|
+
...options,
|
|
43001
|
+
headers: {
|
|
43002
|
+
"Content-Type": "application/json",
|
|
43003
|
+
...options.headers
|
|
43004
|
+
}
|
|
43005
|
+
});
|
|
43006
|
+
var studioRenditionsRender = (options) => (options.client ?? client).post({
|
|
43007
|
+
security: [{
|
|
43008
|
+
key: "BearerAuth",
|
|
43009
|
+
scheme: "bearer",
|
|
43010
|
+
type: "http"
|
|
43011
|
+
}, {
|
|
43012
|
+
key: "ApiKeyAuth",
|
|
43013
|
+
name: "X-API-Key",
|
|
43014
|
+
type: "apiKey"
|
|
43015
|
+
}],
|
|
43016
|
+
url: "/studio/v1/works/{work}/renditions/{rendition}:render",
|
|
43017
|
+
...options
|
|
43018
|
+
});
|
|
43019
|
+
var studioRenditionsPublish = (options) => (options.client ?? client).post({
|
|
43020
|
+
security: [{
|
|
43021
|
+
key: "BearerAuth",
|
|
43022
|
+
scheme: "bearer",
|
|
43023
|
+
type: "http"
|
|
43024
|
+
}, {
|
|
43025
|
+
key: "ApiKeyAuth",
|
|
43026
|
+
name: "X-API-Key",
|
|
43027
|
+
type: "apiKey"
|
|
43028
|
+
}],
|
|
43029
|
+
url: "/studio/v1/works/{work}/renditions/{rendition}:publish",
|
|
43030
|
+
...options
|
|
43031
|
+
});
|
|
43032
|
+
var studioRenditionsContentUrl = (options) => (options.client ?? client).get({
|
|
43033
|
+
security: [{
|
|
43034
|
+
key: "BearerAuth",
|
|
43035
|
+
scheme: "bearer",
|
|
43036
|
+
type: "http"
|
|
43037
|
+
}, {
|
|
43038
|
+
key: "ApiKeyAuth",
|
|
43039
|
+
name: "X-API-Key",
|
|
43040
|
+
type: "apiKey"
|
|
43041
|
+
}],
|
|
43042
|
+
url: "/studio/v1/works/{work}/renditions/{rendition}/content",
|
|
43043
|
+
...options
|
|
43044
|
+
});
|
|
40794
43045
|
var vaultListVaults = (options) => (options?.client ?? client).get({
|
|
40795
43046
|
security: [{
|
|
40796
43047
|
key: "vault-bearerAuth",
|
|
@@ -42248,8 +44499,49 @@ function createDatabase(transport) {
|
|
|
42248
44499
|
}
|
|
42249
44500
|
function createDevops(transport) {
|
|
42250
44501
|
return {
|
|
44502
|
+
environments: {
|
|
44503
|
+
checkpoints: {
|
|
44504
|
+
list: bind(transport, devopsEnvironmentsCheckpointsList)
|
|
44505
|
+
}
|
|
44506
|
+
},
|
|
44507
|
+
flags: {
|
|
44508
|
+
archive: bind(transport, devopsFlagsArchive),
|
|
44509
|
+
conclude: bind(transport, devopsFlagsConclude),
|
|
44510
|
+
environments: {
|
|
44511
|
+
update: bind(transport, devopsFlagsUpdateEnvironment)
|
|
44512
|
+
},
|
|
44513
|
+
retrieve: bind(transport, devopsFlagsGet),
|
|
44514
|
+
update: bind(transport, devopsFlagsUpdate)
|
|
44515
|
+
},
|
|
44516
|
+
progressiveRollouts: {
|
|
44517
|
+
create: bind(transport, devopsProgressiveRolloutsCreate),
|
|
44518
|
+
pause: bind(transport, devopsProgressiveRolloutsPause),
|
|
44519
|
+
resume: bind(transport, devopsProgressiveRolloutsResume),
|
|
44520
|
+
retrieve: bind(transport, devopsProgressiveRolloutsGet),
|
|
44521
|
+
rollback: bind(transport, devopsProgressiveRolloutsRollback)
|
|
44522
|
+
},
|
|
42251
44523
|
projects: {
|
|
44524
|
+
environments: {
|
|
44525
|
+
list: bind(transport, devopsEnvironmentsList)
|
|
44526
|
+
},
|
|
44527
|
+
flags: {
|
|
44528
|
+
create: bind(transport, devopsFlagsCreate),
|
|
44529
|
+
list: bind(transport, devopsFlagsList)
|
|
44530
|
+
},
|
|
44531
|
+
list: bind(transport, devopsProjectsList),
|
|
44532
|
+
promotions: {
|
|
44533
|
+
list: bind(transport, devopsPromotionsList)
|
|
44534
|
+
},
|
|
44535
|
+
releases: {
|
|
44536
|
+
create: bind(transport, devopsReleasesCreate),
|
|
44537
|
+
list: bind(transport, devopsReleasesList)
|
|
44538
|
+
},
|
|
44539
|
+
retrieve: bind(transport, devopsProjectsGet),
|
|
42252
44540
|
retrieveTestCatalog: bind(transport, devopsTestCatalogGet),
|
|
44541
|
+
targets: {
|
|
44542
|
+
list: bind(transport, devopsTargetsList),
|
|
44543
|
+
refresh: bind(transport, devopsTargetsRefresh)
|
|
44544
|
+
},
|
|
42253
44545
|
testCases: {
|
|
42254
44546
|
list: bind(transport, devopsTestCasesList)
|
|
42255
44547
|
},
|
|
@@ -42268,6 +44560,24 @@ function createDevops(transport) {
|
|
|
42268
44560
|
list: bind(transport, devopsTestSuitesList)
|
|
42269
44561
|
}
|
|
42270
44562
|
},
|
|
44563
|
+
promotions: {
|
|
44564
|
+
approve: bind(transport, devopsPromotionsApprove),
|
|
44565
|
+
cancel: bind(transport, devopsPromotionsCancel),
|
|
44566
|
+
conclude: bind(transport, devopsPromotionsConclude),
|
|
44567
|
+
create: bind(transport, devopsPromotionsCreate),
|
|
44568
|
+
retrieve: bind(transport, devopsPromotionsGet),
|
|
44569
|
+
retry: bind(transport, devopsPromotionsRetry),
|
|
44570
|
+
rollouts: {
|
|
44571
|
+
list: bind(transport, devopsRolloutsList)
|
|
44572
|
+
}
|
|
44573
|
+
},
|
|
44574
|
+
releases: {
|
|
44575
|
+
abandon: bind(transport, devopsReleasesAbandon),
|
|
44576
|
+
retrieve: bind(transport, devopsReleasesGet)
|
|
44577
|
+
},
|
|
44578
|
+
rollouts: {
|
|
44579
|
+
retrieve: bind(transport, devopsRolloutsGet)
|
|
44580
|
+
},
|
|
42271
44581
|
testCases: {
|
|
42272
44582
|
retrieve: bind(transport, devopsTestCasesGet)
|
|
42273
44583
|
},
|
|
@@ -42366,11 +44676,18 @@ function createKnowledge(transport) {
|
|
|
42366
44676
|
}
|
|
42367
44677
|
function createMedia(transport) {
|
|
42368
44678
|
return {
|
|
44679
|
+
assets: {
|
|
44680
|
+
edit: bind(transport, mediaEditAsset),
|
|
44681
|
+
lineage: bind(transport, mediaGetAssetLineage)
|
|
44682
|
+
},
|
|
42369
44683
|
generation: {
|
|
42370
44684
|
capabilities: {
|
|
42371
44685
|
list: bind(transport, mediaGetGenerationCapabilities)
|
|
42372
44686
|
}
|
|
42373
44687
|
},
|
|
44688
|
+
images: {
|
|
44689
|
+
generate: bind(transport, mediaGenerateImage)
|
|
44690
|
+
},
|
|
42374
44691
|
libraries: {
|
|
42375
44692
|
assets: {
|
|
42376
44693
|
batch: bind(transport, mediaBatchAssets),
|
|
@@ -42426,6 +44743,7 @@ function createMedia(transport) {
|
|
|
42426
44743
|
},
|
|
42427
44744
|
restore: bind(transport, mediaRestoreLibrary),
|
|
42428
44745
|
retrieve: bind(transport, mediaGetLibrary),
|
|
44746
|
+
retrieveDefault: bind(transport, mediaGetDefaultLibrary),
|
|
42429
44747
|
search: {
|
|
42430
44748
|
create: bind(transport, mediaSearch),
|
|
42431
44749
|
expression: {
|
|
@@ -42438,11 +44756,15 @@ function createMedia(transport) {
|
|
|
42438
44756
|
create: bind(transport, mediaVisualSearch)
|
|
42439
44757
|
}
|
|
42440
44758
|
},
|
|
44759
|
+
setDefault: bind(transport, mediaSetDefaultLibrary),
|
|
42441
44760
|
understandings: {
|
|
42442
44761
|
list: bindPage(transport, mediaListUnderstandingsByLibrary),
|
|
42443
44762
|
retrieveFailureSummary: bind(transport, mediaUnderstandingFailureSummary)
|
|
42444
44763
|
},
|
|
42445
44764
|
update: bind(transport, mediaUpdateLibrary)
|
|
44765
|
+
},
|
|
44766
|
+
videos: {
|
|
44767
|
+
generate: bind(transport, mediaGenerateVideo)
|
|
42446
44768
|
}
|
|
42447
44769
|
};
|
|
42448
44770
|
}
|
|
@@ -42746,6 +45068,9 @@ function createStudio(transport) {
|
|
|
42746
45068
|
create: bind(transport, studioDraftsCreate),
|
|
42747
45069
|
list: bind(transport, studioDraftsList),
|
|
42748
45070
|
rebase: bind(transport, studioDraftsRebase),
|
|
45071
|
+
renditions: {
|
|
45072
|
+
create: bind(transport, studioRenditionsCreate)
|
|
45073
|
+
},
|
|
42749
45074
|
retrieve: bind(transport, studioDraftsGet),
|
|
42750
45075
|
retrieveExport: bind(transport, studioDraftsExport),
|
|
42751
45076
|
retrieveOutline: bind(transport, studioDraftsOutline),
|
|
@@ -42761,6 +45086,15 @@ function createStudio(transport) {
|
|
|
42761
45086
|
update: bind(transport, studioDraftsUpdate)
|
|
42762
45087
|
},
|
|
42763
45088
|
list: bind(transport, studioWorksList),
|
|
45089
|
+
renditions: {
|
|
45090
|
+
delete: bind(transport, studioRenditionsDelete),
|
|
45091
|
+
list: bind(transport, studioRenditionsList),
|
|
45092
|
+
publish: bind(transport, studioRenditionsPublish),
|
|
45093
|
+
render: bind(transport, studioRenditionsRender),
|
|
45094
|
+
retrieve: bind(transport, studioRenditionsGet),
|
|
45095
|
+
retrieveContent: bind(transport, studioRenditionsContentUrl),
|
|
45096
|
+
update: bind(transport, studioRenditionsUpdate)
|
|
45097
|
+
},
|
|
42764
45098
|
resolve: bind(transport, studioWorksResolve),
|
|
42765
45099
|
retrieve: bind(transport, studioWorksGet),
|
|
42766
45100
|
units: {
|
|
@@ -44735,6 +47069,7 @@ var workflows = [
|
|
|
44735
47069
|
{ words: ["app", "rollback"], usage: "app rollback [--dir <path>] [--to <version_id>]", summary: "Deploy the previous version again (or --to a given version) and wait until it is active.", example: "praxis app rollback --to <version_id>" },
|
|
44736
47070
|
{ words: ["devops", "deploy", "plan"], usage: "devops deploy plan [--env <name>] [--since <commit>]", summary: "Plan this repository's deploy: the targets by dependency layer, and with --since the ones a change touches. Local facts only — no login, no request.", example: "praxis devops deploy plan --env develop --since HEAD~1" },
|
|
44737
47071
|
{ words: ["devops", "test", "run"], usage: "devops test run --remote [--project <dvp_…>] [--no-wait] [--repeat <n>] [--select <kind:value>]", summary: "Run the DevOps test selection for the pushed HEAD on the Praxis cloud, wait for the verdict and list the failed cases.", example: "praxis devops test run --remote --select smoke" },
|
|
47072
|
+
{ words: ["canvas", "import"], usage: "canvas import <file.pen> [--name <name>] [--canvas <cvs_…> --yes] [--frames <id,id>] [--image-root <dir>] [--dry-run]", summary: "Import a Pencil .pen file as a canvas, uploading the images it references first.", example: 'praxis canvas import design.pen --name "Landing page"' },
|
|
44738
47073
|
{ words: ["skill"], usage: "skill [--install <dir>]", summary: "Print the AI skill, or write <dir>/praxis-cli/SKILL.md." }
|
|
44739
47074
|
];
|
|
44740
47075
|
var workflowNouns = [...new Set(workflows.filter((w) => w.words.length > 1).map((w) => w.words[0]))];
|
|
@@ -45120,8 +47455,11 @@ async function withLock(lockPath, run, ports = {}) {
|
|
|
45120
47455
|
}
|
|
45121
47456
|
|
|
45122
47457
|
// src/auth/credentials.ts
|
|
45123
|
-
function
|
|
45124
|
-
return
|
|
47458
|
+
function apiKeyVariable(env) {
|
|
47459
|
+
return env === "develop" ? "PRAXIS_API_KEY_DEVELOP" : "PRAXIS_API_KEY";
|
|
47460
|
+
}
|
|
47461
|
+
function credentialSource(vars, env) {
|
|
47462
|
+
return vars[apiKeyVariable(env)] ? "api-key" : vars.PRAXIS_API_TOKEN ? "machine-token" : "login";
|
|
45125
47463
|
}
|
|
45126
47464
|
async function identityRpc(config, fetchImpl, method, params, token) {
|
|
45127
47465
|
const response = await fetchImpl(`${config.gatewayUrl}/rpc/practice-identity`, {
|
|
@@ -45151,8 +47489,9 @@ function jwtFetch(fetchImpl, token) {
|
|
|
45151
47489
|
function credentials(config, vars, ports) {
|
|
45152
47490
|
const path = ports.path ?? tokenPath(config.env);
|
|
45153
47491
|
const store = ports.store ?? createTokenStore(config.env, path, ports.secretStore);
|
|
45154
|
-
const source = credentialSource(vars);
|
|
45155
|
-
const
|
|
47492
|
+
const source = credentialSource(vars, config.env);
|
|
47493
|
+
const keyVariable = apiKeyVariable(config.env);
|
|
47494
|
+
const apiKey = vars[keyVariable];
|
|
45156
47495
|
const machineToken = source === "machine-token" ? vars.PRAXIS_API_TOKEN : undefined;
|
|
45157
47496
|
const remember = ports.remember ?? (() => {});
|
|
45158
47497
|
if (apiKey)
|
|
@@ -45164,7 +47503,7 @@ function credentials(config, vars, ports) {
|
|
|
45164
47503
|
let pending;
|
|
45165
47504
|
const requireLogin = () => {
|
|
45166
47505
|
if (apiKey)
|
|
45167
|
-
throw new UsageError("The API Key determines the organization; listing or switching login organizations is unavailable.",
|
|
47506
|
+
throw new UsageError("The API Key determines the organization; listing or switching login organizations is unavailable.", `Unset ${keyVariable} and run \`praxis login\`, then retry the org command.`);
|
|
45168
47507
|
if (machineToken)
|
|
45169
47508
|
throw new UsageError("The machine token determines the organization; listing or switching login organizations is unavailable.", "Unset PRAXIS_API_TOKEN and run `praxis login`, then retry the org command.");
|
|
45170
47509
|
};
|
|
@@ -45188,7 +47527,7 @@ function credentials(config, vars, ports) {
|
|
|
45188
47527
|
async function get(org) {
|
|
45189
47528
|
if (apiKey) {
|
|
45190
47529
|
if (org)
|
|
45191
|
-
throw new UsageError("--org cannot override an API Key organization",
|
|
47530
|
+
throw new UsageError("--org cannot override an API Key organization", `Remove --org or unset ${keyVariable} and run \`praxis login\`.`);
|
|
45192
47531
|
return { source: "api-key", token: apiKey };
|
|
45193
47532
|
}
|
|
45194
47533
|
if (machineToken) {
|
|
@@ -45271,7 +47610,7 @@ function skillDocument(commands) {
|
|
|
45271
47610
|
"## General rules",
|
|
45272
47611
|
"",
|
|
45273
47612
|
"- Select the environment only with `PRAXIS_ENV`; there is no `--env` option. The dev package defaults to develop.",
|
|
45274
|
-
"- Authenticate with `PRAXIS_API_KEY
|
|
47613
|
+
"- Authenticate with the API key of the environment (`PRAXIS_API_KEY` for production, `PRAXIS_API_KEY_DEVELOP` for develop; a key only works in the environment that issued it), `PRAXIS_API_TOKEN` (a machine token, sent in the Authorization header; computers have it set) or `praxis login`, in that order. Login saves the session even when an environment credential takes precedence; unset the named variable in its warning to use the saved login. API keys and machine tokens determine the organization; login sessions can use `--org <organization_id>`. `PRAXIS_API_URL` overrides the API base and must be an https deepraxis.com URL.",
|
|
45275
47614
|
"- AI mode is enabled automatically in supported agent environments. Use `--format agent` to select it explicitly.",
|
|
45276
47615
|
"- Use `--json` for the complete JSON response without presentation truncation. Successful JSON output goes to stdout; errors go to stderr.",
|
|
45277
47616
|
"- Supply bodies with `--data JSON`, `--data @file.json`, or `--data -` for stdin. Scalar field options override matching JSON fields. Structured fields require `--data`. Multipart binary fields accept local file paths (or @paths), with repeatable flags for arrays. A binary field named data uses `--data <path>` instead of JSON.",
|
|
@@ -45305,7 +47644,22 @@ function skillDocument(commands) {
|
|
|
45305
47644
|
"- `--select` narrows the run: `tag:<tag>` (a bare word reads as a tag), `package:<path>`, `suite:<path>`, `file:<path>`. `--repeat N` runs each selected case N times (a flake then shows up as flaky, not as a failure).",
|
|
45306
47645
|
"- The run waits by default and polls every 5s; `--no-wait` returns as soon as the run exists, with `result` still `pending`.",
|
|
45307
47646
|
"- Exit code 0 means the verdict passed (or is still pending); 1 means failed, errored, cancelled or timed out — the failed cases are listed, up to 20, with the run URL for the rest; 2 is a usage error.",
|
|
45308
|
-
"- The run URL is on the Console of the environment the CLI talks to; the run id is also on stdout with `--json`."
|
|
47647
|
+
"- The run URL is on the Console of the environment the CLI talks to; the run id is also on stdout with `--json`.",
|
|
47648
|
+
"",
|
|
47649
|
+
"## canvas import (workflow)",
|
|
47650
|
+
"",
|
|
47651
|
+
"Import a Pencil `.pen` file as a canvas, uploading the images it references first:",
|
|
47652
|
+
"",
|
|
47653
|
+
"- Use it for a `.pen` file on this machine. The canvas API itself only takes nodes that already point at platform file ids, and a codemode program runs in the cloud where it cannot read your files — this command is the local half.",
|
|
47654
|
+
"- Node ids, component references, variables and themes are preserved as written: the file imports as it is, not as a redraw.",
|
|
47655
|
+
"- `--name <name>` names a new canvas (default: the file name without `.pen`). `--canvas <cvs_…>` imports into an existing canvas instead, which **clears every node already on it** — that is why it also requires `--yes`.",
|
|
47656
|
+
"- `--frames <id,id>` imports only these top-level nodes, in document order. The top-level nodes their `ref`s need come along automatically and are listed as `added`.",
|
|
47657
|
+
"- Images: an image fill must name a platform file id (`file-…`). Each non-`file-` url is looked up beside the `.pen` file, then under each `--image-root <dir>` (repeatable), then by file name under each root, and uploaded with a signed URL. Identical content uploads once.",
|
|
47658
|
+
"- An image that is not found locally is **not** a failure: it is listed under `images.missing` and `warnings` and the import continues. The canvas then shows a placeholder there — fix the path and re-import rather than leaving it.",
|
|
47659
|
+
"- `--dry-run` reads the local file and prints the plan (top-level nodes, added dependencies, node count, images found/missing, chunk count) without logging in or sending any request. Use it to check a document before it reaches a canvas.",
|
|
47660
|
+
"- Large documents go up in chunks of at most 1.5 M JSON characters; the first chunk resets the canvas and carries the variables and themes. The command is not atomic across chunks: a failure part-way leaves what already arrived, so re-run it (`--canvas … --yes` replaces the whole canvas).",
|
|
47661
|
+
"- Exit code 0 means the import completed, warnings included; 2 is a usage error (missing `--yes` with `--canvas`, an unreadable or non-`.pen` file).",
|
|
47662
|
+
"- `--format json` prints `{ canvas_id, viewer_url, revision, frames, added, nodes, images: { uploaded, reused, missing }, chunks, warnings, dry_run }`. Warnings are `FRAME_NOT_FOUND`, `REF_DANGLING`, `IMAGE_UNMAPPED` (planned) and `UNSUPPORTED_IMAGE_URL` (the service could not resolve one)."
|
|
45309
47663
|
];
|
|
45310
47664
|
let domain;
|
|
45311
47665
|
for (const command of commands) {
|
|
@@ -45429,7 +47783,7 @@ Enter code: ${code.user_code}` });
|
|
|
45429
47783
|
const location = await (ports.store ?? createTokenStore(config.env, path)).save(toStored(flow.tokens, ports.now()));
|
|
45430
47784
|
if (location !== "keychain")
|
|
45431
47785
|
ports.emit({ kind: "message", channel: "stderr", text: "stored in a file (no system keychain available)" });
|
|
45432
|
-
const shadowedBy = ports.source === "api-key" ?
|
|
47786
|
+
const shadowedBy = ports.source === "api-key" ? apiKeyVariable(config.env) : ports.source === "machine-token" ? "PRAXIS_API_TOKEN" : undefined;
|
|
45433
47787
|
ports.emit({ kind: "message", text: `Logged in (${config.env}).` });
|
|
45434
47788
|
if (shadowedBy)
|
|
45435
47789
|
ports.emit({ kind: "message", channel: "stderr", text: `Note: ${shadowedBy} is set and takes precedence over this login. Unset it (unset ${shadowedBy}) to use the login.` });
|
|
@@ -46121,6 +48475,13 @@ function workerNameOf(config) {
|
|
|
46121
48475
|
const name = config?.name;
|
|
46122
48476
|
return typeof name === "string" && name !== "" ? name : undefined;
|
|
46123
48477
|
}
|
|
48478
|
+
function productionBlockOf(config) {
|
|
48479
|
+
const env = config?.env;
|
|
48480
|
+
if (env === null || typeof env !== "object")
|
|
48481
|
+
return;
|
|
48482
|
+
const block = env.production;
|
|
48483
|
+
return block !== null && typeof block === "object" ? block : undefined;
|
|
48484
|
+
}
|
|
46124
48485
|
function bindingReferences(config) {
|
|
46125
48486
|
const references = [];
|
|
46126
48487
|
const own = workerNameOf(config);
|
|
@@ -46200,18 +48561,23 @@ function packageManifestOf(text) {
|
|
|
46200
48561
|
return null;
|
|
46201
48562
|
const name = parsed.name;
|
|
46202
48563
|
const dependencies = new Set;
|
|
46203
|
-
|
|
48564
|
+
const devOnly = new Set;
|
|
48565
|
+
for (const field of ["dependencies", "peerDependencies", "optionalDependencies", "devDependencies"]) {
|
|
46204
48566
|
const block = parsed[field];
|
|
46205
48567
|
if (block === null || typeof block !== "object" || Array.isArray(block))
|
|
46206
48568
|
continue;
|
|
46207
48569
|
for (const [dependency, version] of Object.entries(block)) {
|
|
46208
|
-
if (typeof version
|
|
46209
|
-
|
|
48570
|
+
if (typeof version !== "string" || !version.startsWith("workspace:") || dependencies.has(dependency))
|
|
48571
|
+
continue;
|
|
48572
|
+
dependencies.add(dependency);
|
|
48573
|
+
if (field === "devDependencies")
|
|
48574
|
+
devOnly.add(dependency);
|
|
46210
48575
|
}
|
|
46211
48576
|
}
|
|
46212
48577
|
return {
|
|
46213
48578
|
...typeof name === "string" && name !== "" ? { name } : {},
|
|
46214
|
-
workspaceDependencies: [...dependencies].sort()
|
|
48579
|
+
workspaceDependencies: [...dependencies].sort(),
|
|
48580
|
+
devOnlyWorkspaceDependencies: [...devOnly].sort()
|
|
46215
48581
|
};
|
|
46216
48582
|
}
|
|
46217
48583
|
function lifecycleOf(text) {
|
|
@@ -46390,7 +48756,8 @@ var WORKSPACE_PASSES = Symbol("deploy-core.workspace-passes");
|
|
|
46390
48756
|
async function readWorkspacesOnce(facts, options) {
|
|
46391
48757
|
const tree = new Set(facts.tree);
|
|
46392
48758
|
const index = await workspaceIndexOf(facts, options);
|
|
46393
|
-
|
|
48759
|
+
const limit = options.readConcurrency !== undefined && options.readConcurrency >= 1 ? Math.floor(options.readConcurrency) : READ_CONCURRENCY;
|
|
48760
|
+
return await mapBounded(index.packages, limit, async (entry) => {
|
|
46394
48761
|
const manifest = manifestPathIn(entry.dir, tree);
|
|
46395
48762
|
const [manifestText, configText] = await Promise.all([
|
|
46396
48763
|
facts.read(entry.packageJson),
|
|
@@ -46405,7 +48772,8 @@ async function readWorkspacesOnce(facts, options) {
|
|
|
46405
48772
|
config,
|
|
46406
48773
|
...workerNameOf(config) === undefined ? {} : { workerName: workerNameOf(config) },
|
|
46407
48774
|
lifecycle: lifecycleOf(manifestText),
|
|
46408
|
-
workspaceDependencies: pkg?.workspaceDependencies ?? []
|
|
48775
|
+
workspaceDependencies: pkg?.workspaceDependencies ?? [],
|
|
48776
|
+
devOnlyWorkspaceDependencies: pkg?.devOnlyWorkspaceDependencies ?? []
|
|
46409
48777
|
};
|
|
46410
48778
|
});
|
|
46411
48779
|
}
|
|
@@ -46447,7 +48815,9 @@ function workspaceCloudflareProvider(options = {}) {
|
|
|
46447
48815
|
name: workspace.packageName ?? (workspace.dir === "." ? "app" : workspace.dir.split("/").at(-1)),
|
|
46448
48816
|
destination: "cloudflare",
|
|
46449
48817
|
...workspace.workerName === undefined ? {} : { workerName: workspace.workerName },
|
|
46450
|
-
...environments === undefined ? {} : { environments }
|
|
48818
|
+
...environments === undefined ? {} : { environments },
|
|
48819
|
+
production: productionBlockOf(workspace.config) !== undefined,
|
|
48820
|
+
onTrain: lifecycle?.train !== false
|
|
46451
48821
|
});
|
|
46452
48822
|
}
|
|
46453
48823
|
return { targets: [...partial.targets, ...targets] };
|
|
@@ -46496,19 +48866,50 @@ function closePlan(drafts, workspaces) {
|
|
|
46496
48866
|
const configOf = new Map(workspaces.map((workspace) => [workspace.dir, workspace.config]));
|
|
46497
48867
|
const edges = wranglerEdges(drafts.map((draft) => ({ id: draft.path, config: configOf.get(draft.path) ?? null })));
|
|
46498
48868
|
const byName = directoriesOfPackageNames(workspaces);
|
|
46499
|
-
const dependenciesOf = (dir) =>
|
|
48869
|
+
const dependenciesOf = (dir) => {
|
|
48870
|
+
const workspace = workspaces.find((entry) => entry.dir === dir);
|
|
48871
|
+
if (workspace === undefined)
|
|
48872
|
+
return [];
|
|
48873
|
+
const devOnly = new Set(workspace.devOnlyWorkspaceDependencies ?? []);
|
|
48874
|
+
return workspace.workspaceDependencies.filter((name) => {
|
|
48875
|
+
if (!devOnly.has(name))
|
|
48876
|
+
return true;
|
|
48877
|
+
const path = byName.get(name);
|
|
48878
|
+
return path === undefined || !isDeployToolDependency(name, path);
|
|
48879
|
+
});
|
|
48880
|
+
};
|
|
46500
48881
|
return drafts.map((draft) => ({
|
|
46501
48882
|
path: draft.path,
|
|
46502
48883
|
name: draft.name,
|
|
46503
48884
|
destination: draft.destination,
|
|
46504
48885
|
dependsOn: edges.get(draft.path) ?? [],
|
|
46505
48886
|
...draft.environments === undefined ? {} : { environments: draft.environments },
|
|
48887
|
+
production: draft.production === true,
|
|
48888
|
+
onTrain: draft.onTrain !== false,
|
|
46506
48889
|
workspaceDeps: workspaceClosureOf(draft.path, byName, dependenciesOf)
|
|
46507
48890
|
})).sort((a, b) => a.path.localeCompare(b.path));
|
|
46508
48891
|
}
|
|
48892
|
+
function isDeployToolDependency(name, path) {
|
|
48893
|
+
const directory = path.replace(/^(\.\/)+/, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
48894
|
+
if (directory === "packages/mise" || directory.startsWith("packages/mise/"))
|
|
48895
|
+
return true;
|
|
48896
|
+
if (directory === "packages/testing" || directory.startsWith("packages/testing/"))
|
|
48897
|
+
return true;
|
|
48898
|
+
return name.startsWith("@mise/");
|
|
48899
|
+
}
|
|
46509
48900
|
function targetsFor(plan, environment2) {
|
|
46510
48901
|
return plan.targets.filter((target) => target.environments === undefined || target.environments.includes(environment2));
|
|
46511
48902
|
}
|
|
48903
|
+
var TARGET_EXTERNAL_INPUTS = {
|
|
48904
|
+
"apps/docs": [
|
|
48905
|
+
"apps/api/openapi/openapi.yaml",
|
|
48906
|
+
"packages/praxis/rpc-kit/src/errors.ts",
|
|
48907
|
+
"services/agent/src/domain/error-codes.ts",
|
|
48908
|
+
...["application", "database", "knowledge"].map((s) => `services/${s}/src/api/error-exit.ts`),
|
|
48909
|
+
...["router", "vault", "browser", "search"].map((s) => `services/${s}/src/api/rpc-contract.ts`),
|
|
48910
|
+
...["media", "automation", "sandbox", "file", "billing", "config", "eventbus", "lakehouse", "identity", "notification", "ops", "registry"].map((s) => `services/${s}/src/api/contract.ts`)
|
|
48911
|
+
]
|
|
48912
|
+
};
|
|
46512
48913
|
function diffTargets(plan, changedPaths) {
|
|
46513
48914
|
const changed = new Set(changedPaths);
|
|
46514
48915
|
const touches = (dir) => {
|
|
@@ -46520,7 +48921,8 @@ function diffTargets(plan, changedPaths) {
|
|
|
46520
48921
|
return true;
|
|
46521
48922
|
return false;
|
|
46522
48923
|
};
|
|
46523
|
-
|
|
48924
|
+
const readsChangedInput = (dir) => (TARGET_EXTERNAL_INPUTS[dir] ?? []).some((file) => changed.has(file));
|
|
48925
|
+
return plan.targets.filter((target) => touches(target.path) || target.workspaceDeps.some(touches) || readsChangedInput(target.path) || target.workspaceDeps.some(readsChangedInput)).map((target) => target.path);
|
|
46524
48926
|
}
|
|
46525
48927
|
function layersOf(plan) {
|
|
46526
48928
|
const paths = plan.targets.map((target) => target.path);
|
|
@@ -46690,6 +49092,1231 @@ async function devopsDeployPlan(args, ports) {
|
|
|
46690
49092
|
ports.human(renderDeployPlan(view));
|
|
46691
49093
|
}
|
|
46692
49094
|
|
|
49095
|
+
// src/commands/canvas-import.ts
|
|
49096
|
+
import { basename as basename2, dirname as dirname2, join as join5, resolve as resolve3 } from "node:path";
|
|
49097
|
+
|
|
49098
|
+
// ../../packages/canvas/document/src/types.ts
|
|
49099
|
+
class OpRejectedError extends Error {
|
|
49100
|
+
rejection;
|
|
49101
|
+
constructor(rejection) {
|
|
49102
|
+
super(`${rejection.code}: ${JSON.stringify(rejection)}`);
|
|
49103
|
+
this.rejection = rejection;
|
|
49104
|
+
}
|
|
49105
|
+
}
|
|
49106
|
+
var CONTAINER_TYPES = new Set(["frame", "group"]);
|
|
49107
|
+
// ../../packages/canvas/document/src/legacy-props.ts
|
|
49108
|
+
function ownIconProps(node2) {
|
|
49109
|
+
const out = { ...node2 };
|
|
49110
|
+
if ((node2.type === "icon" || node2.type === undefined) && "iconName" in node2) {
|
|
49111
|
+
if (!("icon" in node2))
|
|
49112
|
+
out.icon = node2.iconName;
|
|
49113
|
+
delete out.iconName;
|
|
49114
|
+
}
|
|
49115
|
+
return out;
|
|
49116
|
+
}
|
|
49117
|
+
function migrateLegacyIconProps(node2) {
|
|
49118
|
+
const out = ownIconProps(node2);
|
|
49119
|
+
if (node2.descendants && typeof node2.descendants === "object" && !Array.isArray(node2.descendants))
|
|
49120
|
+
out.descendants = Object.fromEntries(Object.entries(node2.descendants).map(([key, value]) => [
|
|
49121
|
+
key,
|
|
49122
|
+
value && typeof value === "object" && !Array.isArray(value) ? migrateLegacyIconProps(value) : value
|
|
49123
|
+
]));
|
|
49124
|
+
if (Array.isArray(node2.children))
|
|
49125
|
+
out.children = node2.children.map((child) => migrateLegacyIconProps(child));
|
|
49126
|
+
return out;
|
|
49127
|
+
}
|
|
49128
|
+
function migrateLegacyProps(node2) {
|
|
49129
|
+
const out = ownIconProps(node2);
|
|
49130
|
+
const stroke = node2.stroke;
|
|
49131
|
+
if (stroke && typeof stroke === "object" && !Array.isArray(stroke) && "fill" in stroke) {
|
|
49132
|
+
const old = stroke;
|
|
49133
|
+
out.stroke = old.fill;
|
|
49134
|
+
if (!("strokeWidth" in node2) && "thickness" in old)
|
|
49135
|
+
out.strokeWidth = old.thickness;
|
|
49136
|
+
if (!("strokeAlignment" in node2) && "align" in old) {
|
|
49137
|
+
out.strokeAlignment = old.align === "inside" ? "inner" : old.align === "outside" ? "outer" : old.align;
|
|
49138
|
+
}
|
|
49139
|
+
}
|
|
49140
|
+
if (Array.isArray(node2.children))
|
|
49141
|
+
out.children = node2.children.map((child) => migrateLegacyProps(child));
|
|
49142
|
+
if (node2.descendants && typeof node2.descendants === "object" && !Array.isArray(node2.descendants))
|
|
49143
|
+
out.descendants = Object.fromEntries(Object.entries(node2.descendants).map(([key, value]) => [
|
|
49144
|
+
key,
|
|
49145
|
+
value && typeof value === "object" && !Array.isArray(value) ? migrateLegacyProps(value) : value
|
|
49146
|
+
]));
|
|
49147
|
+
return out;
|
|
49148
|
+
}
|
|
49149
|
+
|
|
49150
|
+
// ../../packages/canvas/document/src/store.ts
|
|
49151
|
+
var DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
49152
|
+
var BASE = DIGITS.length;
|
|
49153
|
+
function midpoint(a, b) {
|
|
49154
|
+
if (b !== null) {
|
|
49155
|
+
let n = 0;
|
|
49156
|
+
while ((a[n] ?? "0") === b[n])
|
|
49157
|
+
n++;
|
|
49158
|
+
if (n > 0)
|
|
49159
|
+
return b.slice(0, n) + midpoint(a.slice(n), b.slice(n));
|
|
49160
|
+
}
|
|
49161
|
+
const da = a ? DIGITS.indexOf(a[0]) : 0;
|
|
49162
|
+
const db = b !== null ? DIGITS.indexOf(b[0]) : BASE;
|
|
49163
|
+
if (db - da > 1)
|
|
49164
|
+
return DIGITS[Math.floor((da + db) / 2)];
|
|
49165
|
+
if (b !== null && b.length > 1)
|
|
49166
|
+
return b.slice(0, 1);
|
|
49167
|
+
return DIGITS[da] + midpoint(a.slice(1), null);
|
|
49168
|
+
}
|
|
49169
|
+
function between(a, b) {
|
|
49170
|
+
return midpoint(a ?? "", b);
|
|
49171
|
+
}
|
|
49172
|
+
function spacedKeys(n) {
|
|
49173
|
+
let width = 1;
|
|
49174
|
+
while (BASE ** width < n + 2)
|
|
49175
|
+
width++;
|
|
49176
|
+
const keys = [];
|
|
49177
|
+
for (let i = 1;i <= n; i++) {
|
|
49178
|
+
let v = i;
|
|
49179
|
+
let s = "";
|
|
49180
|
+
for (let d = 0;d < width; d++) {
|
|
49181
|
+
s = DIGITS[v % BASE] + s;
|
|
49182
|
+
v = Math.floor(v / BASE);
|
|
49183
|
+
}
|
|
49184
|
+
keys.push(s + "V");
|
|
49185
|
+
}
|
|
49186
|
+
return keys;
|
|
49187
|
+
}
|
|
49188
|
+
|
|
49189
|
+
class MapNodeStore {
|
|
49190
|
+
nodes = new Map;
|
|
49191
|
+
kids = new Map;
|
|
49192
|
+
vars = {};
|
|
49193
|
+
themeAxes = {};
|
|
49194
|
+
rev = 0;
|
|
49195
|
+
get(id) {
|
|
49196
|
+
return this.nodes.get(id);
|
|
49197
|
+
}
|
|
49198
|
+
children(id) {
|
|
49199
|
+
return this.kids.get(id) ?? [];
|
|
49200
|
+
}
|
|
49201
|
+
variables() {
|
|
49202
|
+
return this.vars;
|
|
49203
|
+
}
|
|
49204
|
+
themes() {
|
|
49205
|
+
return this.themeAxes;
|
|
49206
|
+
}
|
|
49207
|
+
revision() {
|
|
49208
|
+
return this.rev;
|
|
49209
|
+
}
|
|
49210
|
+
unlink(n) {
|
|
49211
|
+
const list = this.kids.get(n.parent);
|
|
49212
|
+
if (!list)
|
|
49213
|
+
return;
|
|
49214
|
+
const i = list.indexOf(n.id);
|
|
49215
|
+
if (i >= 0)
|
|
49216
|
+
list.splice(i, 1);
|
|
49217
|
+
}
|
|
49218
|
+
link(n) {
|
|
49219
|
+
let list = this.kids.get(n.parent);
|
|
49220
|
+
if (!list)
|
|
49221
|
+
this.kids.set(n.parent, list = []);
|
|
49222
|
+
let lo = 0;
|
|
49223
|
+
let hi = list.length;
|
|
49224
|
+
if (hi && this.nodes.get(list[hi - 1]).ord < n.ord)
|
|
49225
|
+
lo = hi;
|
|
49226
|
+
while (lo < hi) {
|
|
49227
|
+
const mid = lo + hi >> 1;
|
|
49228
|
+
const o = this.nodes.get(list[mid]).ord;
|
|
49229
|
+
if (o < n.ord || o === n.ord && list[mid] < n.id)
|
|
49230
|
+
lo = mid + 1;
|
|
49231
|
+
else
|
|
49232
|
+
hi = mid;
|
|
49233
|
+
}
|
|
49234
|
+
list.splice(lo, 0, n.id);
|
|
49235
|
+
}
|
|
49236
|
+
put(node2) {
|
|
49237
|
+
const prev = this.nodes.get(node2.id);
|
|
49238
|
+
if (prev && (prev.parent !== node2.parent || prev.ord !== node2.ord))
|
|
49239
|
+
this.unlink(prev);
|
|
49240
|
+
this.nodes.set(node2.id, node2);
|
|
49241
|
+
if (!prev || prev.parent !== node2.parent || prev.ord !== node2.ord)
|
|
49242
|
+
this.link(node2);
|
|
49243
|
+
}
|
|
49244
|
+
remove(id) {
|
|
49245
|
+
const prev = this.nodes.get(id);
|
|
49246
|
+
if (!prev)
|
|
49247
|
+
return;
|
|
49248
|
+
this.unlink(prev);
|
|
49249
|
+
this.kids.delete(id);
|
|
49250
|
+
this.nodes.delete(id);
|
|
49251
|
+
}
|
|
49252
|
+
setVariables(vars, themes) {
|
|
49253
|
+
this.vars = vars;
|
|
49254
|
+
this.themeAxes = themes;
|
|
49255
|
+
}
|
|
49256
|
+
setRevision(rev) {
|
|
49257
|
+
this.rev = rev;
|
|
49258
|
+
}
|
|
49259
|
+
size() {
|
|
49260
|
+
return this.nodes.size;
|
|
49261
|
+
}
|
|
49262
|
+
reindex() {}
|
|
49263
|
+
}
|
|
49264
|
+
function ownProps(node2) {
|
|
49265
|
+
const { children: _c, ...rest } = node2;
|
|
49266
|
+
return rest;
|
|
49267
|
+
}
|
|
49268
|
+
function flatten(nodes, parent, top, rev, out = []) {
|
|
49269
|
+
const keys = spacedKeys(nodes.length);
|
|
49270
|
+
nodes.forEach((n, i) => {
|
|
49271
|
+
const t = top ?? n.id;
|
|
49272
|
+
const props = ownProps(n);
|
|
49273
|
+
const ord = typeof props.__ord === "string" ? props.__ord : keys[i];
|
|
49274
|
+
delete props.__ord;
|
|
49275
|
+
out.push({ id: n.id, parent, ord, top: t, props, rev });
|
|
49276
|
+
if (Array.isArray(n.children) && n.children.length)
|
|
49277
|
+
flatten(n.children, n.id, t, rev, out);
|
|
49278
|
+
});
|
|
49279
|
+
return out;
|
|
49280
|
+
}
|
|
49281
|
+
function subtree(store, id, depth = Infinity, withOrd = false) {
|
|
49282
|
+
const row = store.get(id);
|
|
49283
|
+
if (!row)
|
|
49284
|
+
throw new Error(`node ${id} not found`);
|
|
49285
|
+
const node2 = migrateLegacyIconProps(row.props);
|
|
49286
|
+
if (withOrd)
|
|
49287
|
+
node2.__ord = row.ord;
|
|
49288
|
+
const kids = store.children(id);
|
|
49289
|
+
if (kids.length) {
|
|
49290
|
+
if (depth <= 0)
|
|
49291
|
+
node2.children = "...";
|
|
49292
|
+
else
|
|
49293
|
+
node2.children = kids.map((k) => subtree(store, k, depth - 1, withOrd));
|
|
49294
|
+
}
|
|
49295
|
+
return node2;
|
|
49296
|
+
}
|
|
49297
|
+
// ../../packages/canvas/document/src/apply.ts
|
|
49298
|
+
function applyOp(store, op, rev) {
|
|
49299
|
+
switch (op.op) {
|
|
49300
|
+
case "insert": {
|
|
49301
|
+
const top = op.parent === null ? null : store.get(op.parent).top;
|
|
49302
|
+
const rows = flatten([op.node], op.parent, top, rev);
|
|
49303
|
+
rows[0] = { ...rows[0], ord: op.ord };
|
|
49304
|
+
for (const r of rows)
|
|
49305
|
+
store.put(r);
|
|
49306
|
+
return [rows[0].top];
|
|
49307
|
+
}
|
|
49308
|
+
case "update": {
|
|
49309
|
+
const row = store.get(op.id);
|
|
49310
|
+
const props = { ...row.props };
|
|
49311
|
+
for (const [k, v] of Object.entries(op.patch)) {
|
|
49312
|
+
if (v === undefined || v === null)
|
|
49313
|
+
delete props[k];
|
|
49314
|
+
else
|
|
49315
|
+
props[k] = v;
|
|
49316
|
+
}
|
|
49317
|
+
store.put({ ...row, props, rev });
|
|
49318
|
+
return [row.top];
|
|
49319
|
+
}
|
|
49320
|
+
case "delete": {
|
|
49321
|
+
const row = store.get(op.id);
|
|
49322
|
+
removeSubtree(store, op.id);
|
|
49323
|
+
return [row.top];
|
|
49324
|
+
}
|
|
49325
|
+
case "move": {
|
|
49326
|
+
const row = store.get(op.id);
|
|
49327
|
+
const oldTop = row.top;
|
|
49328
|
+
const newTop = op.parent === null ? op.id : store.get(op.parent).top;
|
|
49329
|
+
store.put({ ...row, parent: op.parent, ord: op.ord, top: newTop, rev });
|
|
49330
|
+
if (newTop !== oldTop)
|
|
49331
|
+
retop(store, op.id, newTop, rev);
|
|
49332
|
+
return oldTop === newTop ? [newTop] : [oldTop, newTop];
|
|
49333
|
+
}
|
|
49334
|
+
case "setVariables": {
|
|
49335
|
+
const vars = op.replace ? op.variables : { ...store.variables(), ...op.variables };
|
|
49336
|
+
const themes = { ...store.themes() };
|
|
49337
|
+
for (const [axis, values] of Object.entries(op.themes)) {
|
|
49338
|
+
const cur = themes[axis] ?? [];
|
|
49339
|
+
themes[axis] = [...cur, ...values.filter((v) => !cur.includes(v))];
|
|
49340
|
+
}
|
|
49341
|
+
store.setVariables(vars, themes);
|
|
49342
|
+
return [];
|
|
49343
|
+
}
|
|
49344
|
+
}
|
|
49345
|
+
}
|
|
49346
|
+
function removeSubtree(store, id) {
|
|
49347
|
+
for (const c of store.children(id))
|
|
49348
|
+
removeSubtree(store, c);
|
|
49349
|
+
store.remove(id);
|
|
49350
|
+
}
|
|
49351
|
+
function retop(store, id, top, rev) {
|
|
49352
|
+
for (const c of store.children(id)) {
|
|
49353
|
+
const row = store.get(c);
|
|
49354
|
+
store.put({ ...row, top, rev });
|
|
49355
|
+
retop(store, c, top, rev);
|
|
49356
|
+
}
|
|
49357
|
+
}
|
|
49358
|
+
// ../../packages/canvas/document/src/expand.ts
|
|
49359
|
+
function defaultTheme(themes) {
|
|
49360
|
+
const t = {};
|
|
49361
|
+
for (const [axis, values] of Object.entries(themes))
|
|
49362
|
+
if (values.length)
|
|
49363
|
+
t[axis] = values[0];
|
|
49364
|
+
return t;
|
|
49365
|
+
}
|
|
49366
|
+
function resolveVariable(name, vars, theme, depth = 0) {
|
|
49367
|
+
const def = vars[name];
|
|
49368
|
+
if (!def || depth > 8)
|
|
49369
|
+
return;
|
|
49370
|
+
let v;
|
|
49371
|
+
if (Array.isArray(def.value)) {
|
|
49372
|
+
let best;
|
|
49373
|
+
for (const e of def.value) {
|
|
49374
|
+
const keys = Object.keys(e.theme ?? {});
|
|
49375
|
+
if (keys.every((k) => theme[k] === e.theme[k]) && (!best || keys.length > best.score))
|
|
49376
|
+
best = { value: e.value, score: keys.length };
|
|
49377
|
+
}
|
|
49378
|
+
v = best?.value ?? def.value[0]?.value;
|
|
49379
|
+
} else
|
|
49380
|
+
v = def.value;
|
|
49381
|
+
if (typeof v === "string" && v.startsWith("$") && vars[v.slice(1)])
|
|
49382
|
+
return resolveVariable(v.slice(1), vars, theme, depth + 1);
|
|
49383
|
+
return v;
|
|
49384
|
+
}
|
|
49385
|
+
function resolveDeep(value, vars, theme) {
|
|
49386
|
+
if (typeof value === "string") {
|
|
49387
|
+
if (value.startsWith("$") && vars[value.slice(1)] !== undefined)
|
|
49388
|
+
return resolveVariable(value.slice(1), vars, theme);
|
|
49389
|
+
return value;
|
|
49390
|
+
}
|
|
49391
|
+
if (Array.isArray(value))
|
|
49392
|
+
return value.map((v) => resolveDeep(v, vars, theme));
|
|
49393
|
+
if (value && typeof value === "object") {
|
|
49394
|
+
const out = {};
|
|
49395
|
+
for (const [k, v] of Object.entries(value))
|
|
49396
|
+
out[k] = resolveDeep(v, vars, theme);
|
|
49397
|
+
return out;
|
|
49398
|
+
}
|
|
49399
|
+
return value;
|
|
49400
|
+
}
|
|
49401
|
+
var SKIP_RESOLVE = new Set(["id", "type", "ref", "descendants", "name", "content", "children"]);
|
|
49402
|
+
function resolveProps(props, vars, theme) {
|
|
49403
|
+
const out = {};
|
|
49404
|
+
for (const [k, v] of Object.entries(props))
|
|
49405
|
+
out[k] = SKIP_RESOLVE.has(k) ? v : resolveDeep(v, vars, theme);
|
|
49406
|
+
if (typeof props.content === "string" && props.content.startsWith("$") && vars[props.content.slice(1)] !== undefined)
|
|
49407
|
+
out.content = String(resolveVariable(props.content.slice(1), vars, theme));
|
|
49408
|
+
return out;
|
|
49409
|
+
}
|
|
49410
|
+
function propsOf(store, src) {
|
|
49411
|
+
if (src.kind === "store")
|
|
49412
|
+
return store.get(src.id)?.props;
|
|
49413
|
+
const { children: _c, ...rest } = src.node;
|
|
49414
|
+
return rest;
|
|
49415
|
+
}
|
|
49416
|
+
function childrenOf(store, src) {
|
|
49417
|
+
if (src.kind === "store")
|
|
49418
|
+
return store.children(src.id).map((id) => ({ kind: "store", id }));
|
|
49419
|
+
return (src.node.children ?? []).map((node2) => ({ kind: "inline", node: node2 }));
|
|
49420
|
+
}
|
|
49421
|
+
function expandNode(store, id, parentTheme) {
|
|
49422
|
+
return expandSrc({ store, vars: store.variables(), stack: [] }, { kind: "store", id }, parentTheme, null, {});
|
|
49423
|
+
}
|
|
49424
|
+
function expandSrc(ctx, src, parentTheme, pathPrefix, overrides) {
|
|
49425
|
+
let props = propsOf(ctx.store, src);
|
|
49426
|
+
if (!props)
|
|
49427
|
+
return null;
|
|
49428
|
+
const ownId = props.id;
|
|
49429
|
+
const path = pathPrefix ? `${pathPrefix}/${ownId}` : ownId;
|
|
49430
|
+
const ov = pathPrefix ? overrides[ownId] : undefined;
|
|
49431
|
+
if (ov && typeof ov.type === "string") {
|
|
49432
|
+
const repl = ov;
|
|
49433
|
+
const replId = typeof repl.id === "string" ? repl.id : ownId;
|
|
49434
|
+
const e = expandSrc(ctx, { kind: "inline", node: { ...repl, id: replId } }, parentTheme, null, {});
|
|
49435
|
+
return e ? { ...e, role: "instance-child" } : null;
|
|
49436
|
+
}
|
|
49437
|
+
if (ov)
|
|
49438
|
+
props = { ...props, ...ov };
|
|
49439
|
+
const theme = props.theme && typeof props.theme === "object" ? { ...parentTheme, ...props.theme } : parentTheme;
|
|
49440
|
+
if (props.type === "ref")
|
|
49441
|
+
return expandRef(ctx, props, path, theme, pathPrefix ? childOverrides(overrides, ownId) : {});
|
|
49442
|
+
const resolved = resolveProps(props, ctx.vars, theme);
|
|
49443
|
+
const children = [];
|
|
49444
|
+
for (const c of childrenOf(ctx.store, src)) {
|
|
49445
|
+
const e = expandSrc(ctx, c, theme, pathPrefix, overrides);
|
|
49446
|
+
if (e)
|
|
49447
|
+
children.push(e);
|
|
49448
|
+
}
|
|
49449
|
+
return {
|
|
49450
|
+
path,
|
|
49451
|
+
type: props.type,
|
|
49452
|
+
props: resolved,
|
|
49453
|
+
children,
|
|
49454
|
+
theme,
|
|
49455
|
+
role: pathPrefix ? "instance-child" : props.reusable ? "component" : "plain"
|
|
49456
|
+
};
|
|
49457
|
+
}
|
|
49458
|
+
function childOverrides(overrides, id) {
|
|
49459
|
+
const out = {};
|
|
49460
|
+
const prefix = id + "/";
|
|
49461
|
+
for (const [k, v] of Object.entries(overrides))
|
|
49462
|
+
if (k.startsWith(prefix))
|
|
49463
|
+
out[k.slice(prefix.length)] = v;
|
|
49464
|
+
return out;
|
|
49465
|
+
}
|
|
49466
|
+
function expandRef(ctx, ref, path, theme, inherited) {
|
|
49467
|
+
const target = ref.ref;
|
|
49468
|
+
const comp = ctx.store.get(target);
|
|
49469
|
+
if (!comp || ctx.stack.includes(target))
|
|
49470
|
+
return null;
|
|
49471
|
+
const descendants = { ...ref.descendants ?? {} };
|
|
49472
|
+
for (const [id, override] of Object.entries(inherited)) {
|
|
49473
|
+
descendants[id] = typeof override.type === "string" ? override : { ...descendants[id], ...override };
|
|
49474
|
+
}
|
|
49475
|
+
const { id: _i, type: _t, ref: _r, descendants: _d, reusable: _re, ...refOwn } = ref;
|
|
49476
|
+
const root = { ...comp.props, ...refOwn, id: ref.id };
|
|
49477
|
+
delete root.reusable;
|
|
49478
|
+
ctx.stack.push(target);
|
|
49479
|
+
const rootTheme = root.theme && typeof root.theme === "object" ? { ...theme, ...root.theme } : theme;
|
|
49480
|
+
const children = [];
|
|
49481
|
+
for (const c of ctx.store.children(target)) {
|
|
49482
|
+
const e = expandSrc(ctx, { kind: "store", id: c }, rootTheme, path, descendants);
|
|
49483
|
+
if (e)
|
|
49484
|
+
children.push(e);
|
|
49485
|
+
}
|
|
49486
|
+
ctx.stack.pop();
|
|
49487
|
+
return { path, type: root.type, props: resolveProps(root, ctx.vars, rootTheme), children, theme: rootTheme, role: "instance" };
|
|
49488
|
+
}
|
|
49489
|
+
// ../../packages/canvas/document/src/known-props.ts
|
|
49490
|
+
var ENTITY = "id type name context reusable theme enabled opacity flipX flipY layoutPosition metadata rotation x y children";
|
|
49491
|
+
var SIZE = "width height";
|
|
49492
|
+
var STROKE = "stroke strokeWidth strokeLinecap strokeLinejoin strokeAlignment";
|
|
49493
|
+
var EFFECTS = "effect";
|
|
49494
|
+
var GRAPHICS = `${EFFECTS} ${STROKE} fill`;
|
|
49495
|
+
var TEXT = "fontFamily fontSize fontWeight letterSpacing fontStyle underline lineHeight textAlign textAlignVertical strikethrough href";
|
|
49496
|
+
var LAYOUT = "layout gap layoutIncludeStroke padding justifyContent alignItems";
|
|
49497
|
+
var RECTANGLE = `${SIZE} ${GRAPHICS} cornerRadius`;
|
|
49498
|
+
var keys = (extra) => new Set(`${ENTITY} ${extra}`.split(/\s+/));
|
|
49499
|
+
var KNOWN_PROPS = {
|
|
49500
|
+
rectangle: keys(RECTANGLE),
|
|
49501
|
+
ellipse: keys(`${SIZE} ${GRAPHICS} innerRadius startAngle sweepAngle`),
|
|
49502
|
+
polygon: keys(`${SIZE} ${GRAPHICS} polygonCount cornerRadius`),
|
|
49503
|
+
path: keys(`${SIZE} ${GRAPHICS} fillRule geometry viewBox`),
|
|
49504
|
+
text: keys(`${SIZE} ${GRAPHICS} ${TEXT} content textGrowth`),
|
|
49505
|
+
frame: keys(`${RECTANGLE} ${LAYOUT} clip placeholder slot`),
|
|
49506
|
+
group: keys(EFFECTS),
|
|
49507
|
+
note: keys(`${SIZE} ${TEXT} content`),
|
|
49508
|
+
prompt: keys(`${SIZE} ${TEXT} content model`),
|
|
49509
|
+
context: keys(`${SIZE} ${TEXT} content`),
|
|
49510
|
+
icon: keys(`${SIZE} ${EFFECTS} library icon weight fill`),
|
|
49511
|
+
script: keys(`${SIZE} clip scriptUri inputs`),
|
|
49512
|
+
browser: keys(`${SIZE} ${EFFECTS} ${STROKE} url deviceId zoom scrollX scrollY cornerRadius`),
|
|
49513
|
+
ref: keys("ref descendants")
|
|
49514
|
+
};
|
|
49515
|
+
function unknownProperties(node2, type) {
|
|
49516
|
+
if (type === "ref")
|
|
49517
|
+
return [];
|
|
49518
|
+
const allowed = Object.hasOwn(KNOWN_PROPS, type) ? KNOWN_PROPS[type] : keys("");
|
|
49519
|
+
return Object.keys(node2).filter((key) => !key.startsWith("__") && !allowed.has(key));
|
|
49520
|
+
}
|
|
49521
|
+
function iconNameOf(node2) {
|
|
49522
|
+
for (const key of ["icon", "iconName"]) {
|
|
49523
|
+
const value = node2[key];
|
|
49524
|
+
if (typeof value === "string" && value.trim() !== "")
|
|
49525
|
+
return value;
|
|
49526
|
+
}
|
|
49527
|
+
return "";
|
|
49528
|
+
}
|
|
49529
|
+
function hasUnsupportedImageUrl(node2) {
|
|
49530
|
+
const invalid = (paint) => {
|
|
49531
|
+
if (Array.isArray(paint))
|
|
49532
|
+
return paint.some(invalid);
|
|
49533
|
+
if (!paint || typeof paint !== "object")
|
|
49534
|
+
return false;
|
|
49535
|
+
const fill = paint;
|
|
49536
|
+
return fill.type === "image" && (typeof fill.url !== "string" || !/^file-[0-9A-Za-z]{24}$/.test(fill.url));
|
|
49537
|
+
};
|
|
49538
|
+
return invalid(node2.fill) || invalid(node2.stroke);
|
|
49539
|
+
}
|
|
49540
|
+
|
|
49541
|
+
// ../../packages/canvas/document/src/execute-api.ts
|
|
49542
|
+
var LIMITS = { ops: 5000, printBytes: 64 * 1024, screenshots: 4 };
|
|
49543
|
+
var ID_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
49544
|
+
class ExecuteApi {
|
|
49545
|
+
store;
|
|
49546
|
+
rec;
|
|
49547
|
+
bounds;
|
|
49548
|
+
rev;
|
|
49549
|
+
random;
|
|
49550
|
+
document = "document";
|
|
49551
|
+
layoutCache = new Map;
|
|
49552
|
+
constructor(store, rec, bounds, rev, random = Math.random) {
|
|
49553
|
+
this.store = store;
|
|
49554
|
+
this.rec = rec;
|
|
49555
|
+
this.bounds = bounds;
|
|
49556
|
+
this.rev = rev;
|
|
49557
|
+
this.random = random;
|
|
49558
|
+
}
|
|
49559
|
+
mint() {
|
|
49560
|
+
for (;; ) {
|
|
49561
|
+
let id = "";
|
|
49562
|
+
for (let i = 0;i < 5; i++)
|
|
49563
|
+
id += ID_CHARS[Math.floor(this.random() * ID_CHARS.length)];
|
|
49564
|
+
if (!this.store.get(id))
|
|
49565
|
+
return id;
|
|
49566
|
+
}
|
|
49567
|
+
}
|
|
49568
|
+
commit(op) {
|
|
49569
|
+
if (this.rec.ops.length >= LIMITS.ops)
|
|
49570
|
+
throw new Error(`SCRIPT_LIMIT: more than ${LIMITS.ops} operations in one execute`);
|
|
49571
|
+
const touched = applyOp(this.store, op, this.rev);
|
|
49572
|
+
this.mutations++;
|
|
49573
|
+
this.rec.ops.push(op);
|
|
49574
|
+
if (op.op === "setVariables")
|
|
49575
|
+
this.rec.allTouched = true;
|
|
49576
|
+
for (const t of touched) {
|
|
49577
|
+
this.rec.touchedTop.add(t);
|
|
49578
|
+
this.layoutCache.delete(t);
|
|
49579
|
+
}
|
|
49580
|
+
if (op.op === "setVariables")
|
|
49581
|
+
this.layoutCache.clear();
|
|
49582
|
+
}
|
|
49583
|
+
parentId(parent) {
|
|
49584
|
+
if (parent === "document" || parent === "" || parent == null)
|
|
49585
|
+
return null;
|
|
49586
|
+
if (parent.includes("/"))
|
|
49587
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: "parent", reason: "cannot insert inside a component instance; use Replace on the instance child" });
|
|
49588
|
+
const row = this.store.get(parent);
|
|
49589
|
+
if (!row)
|
|
49590
|
+
throw new OpRejectedError({ code: "PARENT_NOT_FOUND", path: parent });
|
|
49591
|
+
if (!CONTAINER_TYPES.has(row.props.type))
|
|
49592
|
+
throw new OpRejectedError({ code: "CANNOT_HAVE_CHILDREN", parent, type: row.props.type });
|
|
49593
|
+
return parent;
|
|
49594
|
+
}
|
|
49595
|
+
lastOrd(parent) {
|
|
49596
|
+
const kids = this.store.children(parent);
|
|
49597
|
+
return kids.length ? this.store.get(kids[kids.length - 1]).ord : null;
|
|
49598
|
+
}
|
|
49599
|
+
withIds(node2) {
|
|
49600
|
+
if (typeof node2 !== "object" || node2 === null || typeof node2.type !== "string")
|
|
49601
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: "type", reason: "node needs a type" });
|
|
49602
|
+
if (node2.type === "ref") {
|
|
49603
|
+
const target = node2.ref;
|
|
49604
|
+
if (!this.store.get(target))
|
|
49605
|
+
throw new OpRejectedError({ code: "UNKNOWN_REF", ref: target });
|
|
49606
|
+
}
|
|
49607
|
+
for (const k of ["width", "height"]) {
|
|
49608
|
+
const v = node2[k];
|
|
49609
|
+
if (typeof v === "number" && v < 0)
|
|
49610
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: k, reason: "negative size" });
|
|
49611
|
+
if (typeof v === "string" && /%|vh|vw|calc/.test(v))
|
|
49612
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: k, reason: "percentage and viewport sizes are not supported" });
|
|
49613
|
+
}
|
|
49614
|
+
const id = this.mint();
|
|
49615
|
+
const out = { ...node2, id };
|
|
49616
|
+
if (typeof node2.name === "string")
|
|
49617
|
+
this.rec.created[node2.name] = id;
|
|
49618
|
+
if (Array.isArray(node2.children)) {
|
|
49619
|
+
if (!CONTAINER_TYPES.has(node2.type))
|
|
49620
|
+
throw new OpRejectedError({ code: "CANNOT_HAVE_CHILDREN", parent: id, type: node2.type });
|
|
49621
|
+
out.children = node2.children.map((c) => this.withIds(c));
|
|
49622
|
+
}
|
|
49623
|
+
return out;
|
|
49624
|
+
}
|
|
49625
|
+
warnProps(data, type, nodeId) {
|
|
49626
|
+
if (hasUnsupportedImageUrl(data) && this.rec.warnings.length < 20 && !this.rec.warnings.some((w) => w.code === "UNSUPPORTED_IMAGE_URL" && w.nodeId === nodeId))
|
|
49627
|
+
this.rec.warnings.push({ code: "UNSUPPORTED_IMAGE_URL", nodeId, message: "image fill url must be a file id (file-…)" });
|
|
49628
|
+
if (data.type === "icon" && !iconNameOf(data) && this.rec.warnings.length < 20 && !this.rec.warnings.some((w) => w.code === "ICON_NAME_MISSING" && w.nodeId === nodeId))
|
|
49629
|
+
this.rec.warnings.push({ code: "ICON_NAME_MISSING", nodeId, message: "icon node has no icon: set icon to a lucide name (name is the node's name, not the icon)" });
|
|
49630
|
+
for (const prop of unknownProperties(data, type)) {
|
|
49631
|
+
const message = `${prop} is not a .pen property`;
|
|
49632
|
+
if (this.rec.warnings.length >= 20)
|
|
49633
|
+
break;
|
|
49634
|
+
if (!this.rec.warnings.some((w) => w.code === "UNKNOWN_PROPERTY" && w.nodeId === nodeId && w.message === message))
|
|
49635
|
+
this.rec.warnings.push({ code: "UNKNOWN_PROPERTY", nodeId, message });
|
|
49636
|
+
}
|
|
49637
|
+
for (const child of Array.isArray(data.children) ? data.children : [])
|
|
49638
|
+
this.warnProps(child, child.type, child.id ?? nodeId);
|
|
49639
|
+
if (data.descendants && typeof data.descendants === "object") {
|
|
49640
|
+
const descendants = typeof data.ref === "string" ? this.resolveDescendantKeys(data.ref, data.descendants) : data.descendants;
|
|
49641
|
+
for (const [key, value] of Object.entries(descendants)) {
|
|
49642
|
+
if (!value || typeof value !== "object")
|
|
49643
|
+
continue;
|
|
49644
|
+
const patch = value;
|
|
49645
|
+
const target = this.store.get(key)?.props.type ?? (typeof data.ref === "string" ? this.expandedAt(`${data.ref}/${key}`, {})?.node.type : undefined);
|
|
49646
|
+
this.warnProps(patch, typeof patch.type === "string" ? patch.type : target ?? "ref", `${nodeId}/${key}`);
|
|
49647
|
+
}
|
|
49648
|
+
}
|
|
49649
|
+
}
|
|
49650
|
+
splitInstancePath(path) {
|
|
49651
|
+
const i = path.indexOf("/");
|
|
49652
|
+
if (i < 0)
|
|
49653
|
+
return null;
|
|
49654
|
+
return { owner: path.slice(0, i), rest: path.slice(i + 1) };
|
|
49655
|
+
}
|
|
49656
|
+
resolveDescendantKeys(rootId, desc) {
|
|
49657
|
+
const byName = new Map;
|
|
49658
|
+
const walk = (id) => {
|
|
49659
|
+
for (const c of this.store.children(id)) {
|
|
49660
|
+
const n = this.store.get(c).props;
|
|
49661
|
+
if (n.name)
|
|
49662
|
+
byName.set(n.name, [...byName.get(n.name) ?? [], c]);
|
|
49663
|
+
walk(c);
|
|
49664
|
+
}
|
|
49665
|
+
};
|
|
49666
|
+
walk(rootId);
|
|
49667
|
+
const out = {};
|
|
49668
|
+
for (const [k, v] of Object.entries(desc)) {
|
|
49669
|
+
let key = k;
|
|
49670
|
+
if (!k.includes("/") && !this.store.get(k)) {
|
|
49671
|
+
const hits = byName.get(k);
|
|
49672
|
+
if (hits?.length === 1)
|
|
49673
|
+
key = hits[0];
|
|
49674
|
+
}
|
|
49675
|
+
out[key] = v;
|
|
49676
|
+
}
|
|
49677
|
+
return out;
|
|
49678
|
+
}
|
|
49679
|
+
Insert(parent, nodeData) {
|
|
49680
|
+
const p = this.parentId(parent);
|
|
49681
|
+
let node2 = this.withIds(migrateLegacyProps(nodeData));
|
|
49682
|
+
if (node2.type === "ref" && node2.descendants && typeof node2.descendants === "object")
|
|
49683
|
+
node2 = { ...node2, descendants: this.resolveDescendantKeys(node2.ref, node2.descendants) };
|
|
49684
|
+
this.warnProps(node2, node2.type, node2.id);
|
|
49685
|
+
this.commit({ op: "insert", parent: p, ord: between(this.lastOrd(p), null), node: node2 });
|
|
49686
|
+
return node2.id;
|
|
49687
|
+
}
|
|
49688
|
+
Copy(path, parent, copyNodeData = {}) {
|
|
49689
|
+
if (path.includes("/"))
|
|
49690
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: "path", reason: "copying an instance child is not supported in this spike" });
|
|
49691
|
+
const src = this.store.get(path);
|
|
49692
|
+
if (!src)
|
|
49693
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49694
|
+
const p = this.parentId(parent);
|
|
49695
|
+
const { descendants, ...over } = migrateLegacyProps(copyNodeData);
|
|
49696
|
+
let node2;
|
|
49697
|
+
if (src.props.reusable) {
|
|
49698
|
+
node2 = { type: "ref", ref: src.id, ...over };
|
|
49699
|
+
if (descendants)
|
|
49700
|
+
node2.descendants = this.resolveDescendantKeys(src.id, descendants);
|
|
49701
|
+
node2 = this.withIds(node2);
|
|
49702
|
+
} else {
|
|
49703
|
+
const tree = subtree(this.store, src.id);
|
|
49704
|
+
const descMap = descendants ? this.resolveDescendantKeys(src.id, descendants) : {};
|
|
49705
|
+
const apply = (n) => {
|
|
49706
|
+
const d = descMap[n.id];
|
|
49707
|
+
let out = d && typeof d.type === "string" ? { ...d } : { ...n, ...d ?? {} };
|
|
49708
|
+
if (Array.isArray(n.children) && !(d && typeof d.type === "string"))
|
|
49709
|
+
out = { ...out, children: n.children.map(apply) };
|
|
49710
|
+
return out;
|
|
49711
|
+
};
|
|
49712
|
+
node2 = this.withIds({ ...apply(tree), ...over });
|
|
49713
|
+
}
|
|
49714
|
+
this.warnProps(node2, node2.type, node2.id);
|
|
49715
|
+
this.commit({ op: "insert", parent: p, ord: between(this.lastOrd(p), null), node: node2 });
|
|
49716
|
+
return node2.id;
|
|
49717
|
+
}
|
|
49718
|
+
Update(path, updateData) {
|
|
49719
|
+
updateData = migrateLegacyProps(updateData);
|
|
49720
|
+
const inst = this.splitInstancePath(path);
|
|
49721
|
+
if (inst) {
|
|
49722
|
+
const owner = this.store.get(inst.owner);
|
|
49723
|
+
if (!owner || owner.props.type !== "ref")
|
|
49724
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49725
|
+
const desc = { ...owner.props.descendants ?? {} };
|
|
49726
|
+
this.warnProps(updateData, this.expandedAt(path, {})?.node.type ?? "ref", path);
|
|
49727
|
+
desc[inst.rest] = { ...desc[inst.rest] ?? {}, ...updateData };
|
|
49728
|
+
this.commit({ op: "update", id: owner.id, patch: { descendants: desc } });
|
|
49729
|
+
return;
|
|
49730
|
+
}
|
|
49731
|
+
const row = this.store.get(path);
|
|
49732
|
+
if (!row)
|
|
49733
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49734
|
+
for (const f of ["id", "type", "ref"])
|
|
49735
|
+
if (f in updateData && updateData[f] !== row.props[f])
|
|
49736
|
+
throw new OpRejectedError({ code: "IMMUTABLE_FIELD", field: f });
|
|
49737
|
+
if ("children" in updateData)
|
|
49738
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: "children", reason: "use Replace to change children" });
|
|
49739
|
+
const { id: _i, type: _t, ref: _r, ...patch } = updateData;
|
|
49740
|
+
if (patch.descendants && row.props.type === "ref")
|
|
49741
|
+
patch.descendants = { ...row.props.descendants ?? {}, ...this.resolveDescendantKeys(row.props.ref, patch.descendants) };
|
|
49742
|
+
this.warnProps({ ...patch, ...row.props.type === "ref" ? { ref: row.props.ref } : {} }, row.props.type, row.id);
|
|
49743
|
+
this.commit({ op: "update", id: row.id, patch });
|
|
49744
|
+
}
|
|
49745
|
+
Replace(path, nodeData) {
|
|
49746
|
+
const inst = this.splitInstancePath(path);
|
|
49747
|
+
if (inst) {
|
|
49748
|
+
const owner = this.store.get(inst.owner);
|
|
49749
|
+
if (!owner || owner.props.type !== "ref")
|
|
49750
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49751
|
+
const node3 = this.withIds(migrateLegacyProps(nodeData));
|
|
49752
|
+
this.warnProps(node3, node3.type, node3.id);
|
|
49753
|
+
const desc = { ...owner.props.descendants ?? {}, [inst.rest]: node3 };
|
|
49754
|
+
this.commit({ op: "update", id: owner.id, patch: { descendants: desc } });
|
|
49755
|
+
return node3.id;
|
|
49756
|
+
}
|
|
49757
|
+
const row = this.store.get(path);
|
|
49758
|
+
if (!row)
|
|
49759
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49760
|
+
const node2 = this.withIds(migrateLegacyProps(nodeData));
|
|
49761
|
+
this.warnProps(node2, node2.type, node2.id);
|
|
49762
|
+
this.commit({ op: "delete", id: row.id });
|
|
49763
|
+
this.commit({ op: "insert", parent: row.parent, ord: row.ord, node: node2 });
|
|
49764
|
+
return node2.id;
|
|
49765
|
+
}
|
|
49766
|
+
Move(path, parent, index) {
|
|
49767
|
+
if (path.includes("/"))
|
|
49768
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: "path", reason: "instance children cannot be moved; edit the component" });
|
|
49769
|
+
const row = this.store.get(path);
|
|
49770
|
+
if (!row)
|
|
49771
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49772
|
+
const p = parent === undefined ? row.parent : this.parentId(parent);
|
|
49773
|
+
for (let cur = p;cur !== null; cur = this.store.get(cur)?.parent ?? null)
|
|
49774
|
+
if (cur === row.id)
|
|
49775
|
+
throw new OpRejectedError({ code: "CYCLE", id: row.id, parent: p });
|
|
49776
|
+
const siblings = this.store.children(p).filter((s) => s !== row.id);
|
|
49777
|
+
const i = index === undefined ? siblings.length : Math.max(0, Math.min(index, siblings.length));
|
|
49778
|
+
const before = i > 0 ? this.store.get(siblings[i - 1]).ord : null;
|
|
49779
|
+
const after = i < siblings.length ? this.store.get(siblings[i]).ord : null;
|
|
49780
|
+
this.commit({ op: "move", id: row.id, parent: p, ord: between(before, after) });
|
|
49781
|
+
}
|
|
49782
|
+
Delete(path) {
|
|
49783
|
+
if (path === "document")
|
|
49784
|
+
throw new OpRejectedError({ code: "ROOT_PROTECTED" });
|
|
49785
|
+
if (path.includes("/"))
|
|
49786
|
+
throw new OpRejectedError({ code: "INSTANCE_CHILD_DELETE", path });
|
|
49787
|
+
if (!this.store.get(path))
|
|
49788
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49789
|
+
this.commit({ op: "delete", id: path });
|
|
49790
|
+
}
|
|
49791
|
+
SetVariables(variables, replace = false) {
|
|
49792
|
+
const themes = {};
|
|
49793
|
+
for (const [name, def] of Object.entries(variables ?? {})) {
|
|
49794
|
+
if (name.startsWith("$"))
|
|
49795
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: name, reason: "variable names must not start with $" });
|
|
49796
|
+
if (!def || typeof def !== "object" || !("type" in def) || !("value" in def))
|
|
49797
|
+
throw new OpRejectedError({ code: "INVALID_VALUE", property: name, reason: "expected { type, value }" });
|
|
49798
|
+
if (Array.isArray(def.value))
|
|
49799
|
+
for (const e of def.value)
|
|
49800
|
+
for (const [axis, v] of Object.entries(e.theme ?? {}))
|
|
49801
|
+
themes[axis] = [...new Set([...themes[axis] ?? [], v])];
|
|
49802
|
+
}
|
|
49803
|
+
this.commit({ op: "setVariables", variables, themes, replace });
|
|
49804
|
+
}
|
|
49805
|
+
GetVariables() {
|
|
49806
|
+
return { variables: this.store.variables(), themes: this.store.themes() };
|
|
49807
|
+
}
|
|
49808
|
+
Get(a, b, c) {
|
|
49809
|
+
let path = null;
|
|
49810
|
+
let visit2 = null;
|
|
49811
|
+
let opts = {};
|
|
49812
|
+
for (const arg of [a, b, c]) {
|
|
49813
|
+
if (typeof arg === "string")
|
|
49814
|
+
path = arg;
|
|
49815
|
+
else if (typeof arg === "function")
|
|
49816
|
+
visit2 = arg;
|
|
49817
|
+
else if (arg && typeof arg === "object")
|
|
49818
|
+
opts = arg;
|
|
49819
|
+
}
|
|
49820
|
+
if (!path && !visit2)
|
|
49821
|
+
throw new Error("Reading the whole document without a visitor would return everything! Pass a visitor or target a specific node.");
|
|
49822
|
+
if (!visit2)
|
|
49823
|
+
return this.readNode(path, opts);
|
|
49824
|
+
const out = [];
|
|
49825
|
+
const roots = path && path !== "document" ? [path] : this.store.children(null);
|
|
49826
|
+
for (const r of roots)
|
|
49827
|
+
this.visitFrom(r, visit2, opts, out);
|
|
49828
|
+
return out;
|
|
49829
|
+
}
|
|
49830
|
+
readNode(path, opts) {
|
|
49831
|
+
if (opts.resolveInstances || opts.resolveVariables || path.includes("/")) {
|
|
49832
|
+
const e = this.expandedAt(path, opts);
|
|
49833
|
+
if (!e)
|
|
49834
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49835
|
+
return toPen(e.node, opts.depth ?? Infinity, !!opts.resolveVariables, opts.resolveInstances !== false || path.includes("/"));
|
|
49836
|
+
}
|
|
49837
|
+
if (!this.store.get(path))
|
|
49838
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
|
|
49839
|
+
return subtree(this.store, path, opts.depth ?? Infinity);
|
|
49840
|
+
}
|
|
49841
|
+
expandedCache = new Map;
|
|
49842
|
+
mutations = 0;
|
|
49843
|
+
expandedAt(path, _opts) {
|
|
49844
|
+
const first = path.split("/")[0];
|
|
49845
|
+
const row = this.store.get(first);
|
|
49846
|
+
if (!row)
|
|
49847
|
+
return null;
|
|
49848
|
+
let hit = this.expandedCache.get(row.top);
|
|
49849
|
+
if (!hit || hit.rev !== this.mutations) {
|
|
49850
|
+
const tree = expandNode(this.store, row.top, defaultTheme(this.store.themes()));
|
|
49851
|
+
if (!tree)
|
|
49852
|
+
return null;
|
|
49853
|
+
const index = new Map;
|
|
49854
|
+
const walk = (n) => {
|
|
49855
|
+
index.set(n.path, n);
|
|
49856
|
+
n.children.forEach(walk);
|
|
49857
|
+
};
|
|
49858
|
+
walk(tree);
|
|
49859
|
+
hit = { rev: this.mutations, index };
|
|
49860
|
+
this.expandedCache.set(row.top, hit);
|
|
49861
|
+
if (this.expandedCache.size > 8)
|
|
49862
|
+
this.expandedCache.delete(this.expandedCache.keys().next().value);
|
|
49863
|
+
}
|
|
49864
|
+
const node2 = hit.index.get(path);
|
|
49865
|
+
return node2 ? { node: node2, top: row.top } : null;
|
|
49866
|
+
}
|
|
49867
|
+
layoutOf(top) {
|
|
49868
|
+
let l = this.layoutCache.get(top);
|
|
49869
|
+
if (!l) {
|
|
49870
|
+
l = this.bounds.layout(top);
|
|
49871
|
+
this.layoutCache.set(top, l);
|
|
49872
|
+
if (this.layoutCache.size > 8)
|
|
49873
|
+
this.layoutCache.delete(this.layoutCache.keys().next().value);
|
|
49874
|
+
}
|
|
49875
|
+
return l;
|
|
49876
|
+
}
|
|
49877
|
+
visitFrom(startPath, visit2, opts, out) {
|
|
49878
|
+
const at = this.expandedAt(startPath, opts);
|
|
49879
|
+
if (!at)
|
|
49880
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path: startPath });
|
|
49881
|
+
const self = this;
|
|
49882
|
+
const withInstances = !!opts.resolveInstances;
|
|
49883
|
+
const walk = (e, parentCtx, depth, index) => {
|
|
49884
|
+
if (opts.depth !== undefined && depth > opts.depth)
|
|
49885
|
+
return;
|
|
49886
|
+
let skip = false;
|
|
49887
|
+
const node2 = toPen(e, 0, !!opts.resolveVariables, withInstances, true);
|
|
49888
|
+
const ctx = {
|
|
49889
|
+
node: node2,
|
|
49890
|
+
parentCtx,
|
|
49891
|
+
depth,
|
|
49892
|
+
index,
|
|
49893
|
+
get bounds() {
|
|
49894
|
+
const b = self.layoutOf(at.top).boxes.get(e.path);
|
|
49895
|
+
return b ? { x: b.x, y: b.y, width: b.width, height: b.height } : { x: 0, y: 0, width: 0, height: 0 };
|
|
49896
|
+
},
|
|
49897
|
+
get problems() {
|
|
49898
|
+
const p = self.layoutOf(at.top).problems.find((q) => q.path === e.path && (q.code === "PARTIALLY_CLIPPED" || q.code === "FULLY_CLIPPED"));
|
|
49899
|
+
return p ? p.code === "FULLY_CLIPPED" ? "fully clipped" : "partially clipped" : undefined;
|
|
49900
|
+
},
|
|
49901
|
+
skipChildren() {
|
|
49902
|
+
skip = true;
|
|
49903
|
+
}
|
|
49904
|
+
};
|
|
49905
|
+
const r = visit2(node2, ctx);
|
|
49906
|
+
if (r !== undefined)
|
|
49907
|
+
out.push(r);
|
|
49908
|
+
if (skip)
|
|
49909
|
+
return;
|
|
49910
|
+
if (e.role === "instance" && !withInstances)
|
|
49911
|
+
return;
|
|
49912
|
+
e.children.forEach((c, i) => walk(c, ctx, depth + 1, i));
|
|
49913
|
+
};
|
|
49914
|
+
walk(at.node, undefined, 0, 0);
|
|
49915
|
+
}
|
|
49916
|
+
level(root, parent, opts) {
|
|
49917
|
+
const withInstances = !!opts.resolveInstances;
|
|
49918
|
+
const conv = (e) => ({
|
|
49919
|
+
node: toPen(e, 0, !!opts.resolveVariables, withInstances, true),
|
|
49920
|
+
path: e.path,
|
|
49921
|
+
more: e.children.length > 0 && !(e.role === "instance" && !withInstances)
|
|
49922
|
+
});
|
|
49923
|
+
if (parent === null) {
|
|
49924
|
+
const roots = root && root !== "document" ? [root] : this.store.children(null);
|
|
49925
|
+
return roots.map((r) => {
|
|
49926
|
+
const at2 = this.expandedAt(r, opts);
|
|
49927
|
+
if (!at2)
|
|
49928
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path: r });
|
|
49929
|
+
return conv(at2.node);
|
|
49930
|
+
});
|
|
49931
|
+
}
|
|
49932
|
+
const at = this.expandedAt(parent, opts);
|
|
49933
|
+
return at ? at.node.children.map(conv) : [];
|
|
49934
|
+
}
|
|
49935
|
+
tree(path, opts) {
|
|
49936
|
+
const withInstances = !!opts.resolveInstances;
|
|
49937
|
+
const roots = path && path !== "document" ? [path] : this.store.children(null);
|
|
49938
|
+
const out = [];
|
|
49939
|
+
for (const r of roots) {
|
|
49940
|
+
const at = this.expandedAt(r, opts);
|
|
49941
|
+
if (!at)
|
|
49942
|
+
throw new OpRejectedError({ code: "NODE_NOT_FOUND", path: r });
|
|
49943
|
+
const conv = (e, depth) => ({
|
|
49944
|
+
node: toPen(e, 0, !!opts.resolveVariables, withInstances, true),
|
|
49945
|
+
path: e.path,
|
|
49946
|
+
children: e.role === "instance" && !withInstances || opts.depth !== undefined && depth >= opts.depth ? [] : e.children.map((c) => conv(c, depth + 1))
|
|
49947
|
+
});
|
|
49948
|
+
out.push(conv(at.node, 0));
|
|
49949
|
+
}
|
|
49950
|
+
return out;
|
|
49951
|
+
}
|
|
49952
|
+
boundsOf(path) {
|
|
49953
|
+
const first = path.split("/")[0];
|
|
49954
|
+
const row = this.store.get(first);
|
|
49955
|
+
if (!row)
|
|
49956
|
+
return { bounds: { x: 0, y: 0, width: 0, height: 0 } };
|
|
49957
|
+
const l = this.layoutOf(row.top);
|
|
49958
|
+
const b = l.boxes.get(path);
|
|
49959
|
+
const p = l.problems.find((q) => q.path === path && (q.code === "PARTIALLY_CLIPPED" || q.code === "FULLY_CLIPPED"));
|
|
49960
|
+
return {
|
|
49961
|
+
bounds: b ? { x: b.x, y: b.y, width: b.width, height: b.height } : { x: 0, y: 0, width: 0, height: 0 },
|
|
49962
|
+
problems: p ? p.code === "FULLY_CLIPPED" ? "fully clipped" : "partially clipped" : undefined
|
|
49963
|
+
};
|
|
49964
|
+
}
|
|
49965
|
+
FindEmptySpace(input) {
|
|
49966
|
+
const dir = input.direction ?? "right";
|
|
49967
|
+
const pad = input.padding ?? 0;
|
|
49968
|
+
const rects = [];
|
|
49969
|
+
const tops = input.nodeId ? [input.nodeId] : this.store.children(null);
|
|
49970
|
+
for (const t of tops) {
|
|
49971
|
+
const row = this.store.get(t);
|
|
49972
|
+
if (!row)
|
|
49973
|
+
continue;
|
|
49974
|
+
const b = this.layoutOf(row.top).boxes.get(t);
|
|
49975
|
+
if (b)
|
|
49976
|
+
rects.push({ x: b.wx, y: b.wy, width: b.width, height: b.height });
|
|
49977
|
+
}
|
|
49978
|
+
if (!rects.length)
|
|
49979
|
+
return { x: 0, y: 0 };
|
|
49980
|
+
const minX = Math.min(...rects.map((r) => r.x));
|
|
49981
|
+
const minY = Math.min(...rects.map((r) => r.y));
|
|
49982
|
+
const maxX = Math.max(...rects.map((r) => r.x + r.width));
|
|
49983
|
+
const maxY = Math.max(...rects.map((r) => r.y + r.height));
|
|
49984
|
+
if (dir === "right")
|
|
49985
|
+
return { x: maxX + pad, y: minY };
|
|
49986
|
+
if (dir === "left")
|
|
49987
|
+
return { x: minX - pad - input.width, y: minY };
|
|
49988
|
+
if (dir === "bottom")
|
|
49989
|
+
return { x: minX, y: maxY + pad };
|
|
49990
|
+
return { x: minX, y: minY - pad - input.height };
|
|
49991
|
+
}
|
|
49992
|
+
Print(...values) {
|
|
49993
|
+
const line = values.map((v) => typeof v === "string" ? v : JSON.stringify(v)).join(" ");
|
|
49994
|
+
this.rec.printBytes += line.length;
|
|
49995
|
+
if (this.rec.printBytes > LIMITS.printBytes)
|
|
49996
|
+
throw new Error(`SCRIPT_LIMIT: Print output over ${LIMITS.printBytes} bytes`);
|
|
49997
|
+
this.rec.prints.push(line);
|
|
49998
|
+
}
|
|
49999
|
+
TakeScreenshot(nodeIds) {
|
|
50000
|
+
for (const id of nodeIds)
|
|
50001
|
+
if (this.rec.screenshots.length < LIMITS.screenshots)
|
|
50002
|
+
this.rec.screenshots.push(id);
|
|
50003
|
+
}
|
|
50004
|
+
}
|
|
50005
|
+
function toPen(e, depth, _resolved, _instances, shallow = false) {
|
|
50006
|
+
const node2 = { ...e.props, id: e.path, type: e.type };
|
|
50007
|
+
if (!shallow && e.children.length) {
|
|
50008
|
+
if (depth <= 0)
|
|
50009
|
+
node2.children = "...";
|
|
50010
|
+
else
|
|
50011
|
+
node2.children = e.children.map((c) => toPen(c, depth - 1, _resolved, _instances));
|
|
50012
|
+
}
|
|
50013
|
+
return node2;
|
|
50014
|
+
}
|
|
50015
|
+
// ../../packages/canvas/document/src/pen-import.ts
|
|
50016
|
+
var FILE_ID = /^file-/;
|
|
50017
|
+
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
50018
|
+
var isImage = (node2) => node2.type === "image" && typeof node2.url === "string";
|
|
50019
|
+
var isRef = (node2) => node2.type === "ref" && typeof node2.ref === "string";
|
|
50020
|
+
function visit2(value, nodeId, fn) {
|
|
50021
|
+
if (Array.isArray(value)) {
|
|
50022
|
+
for (const item of value)
|
|
50023
|
+
visit2(item, nodeId, fn);
|
|
50024
|
+
return;
|
|
50025
|
+
}
|
|
50026
|
+
const node2 = asRecord(value);
|
|
50027
|
+
if (!node2)
|
|
50028
|
+
return;
|
|
50029
|
+
const id = typeof node2.id === "string" ? node2.id : nodeId;
|
|
50030
|
+
fn(node2, id);
|
|
50031
|
+
for (const key of Object.keys(node2))
|
|
50032
|
+
visit2(node2[key], id, fn);
|
|
50033
|
+
}
|
|
50034
|
+
function indexTops(tops) {
|
|
50035
|
+
const owner = new Map;
|
|
50036
|
+
for (const top of tops) {
|
|
50037
|
+
visit2(top, top.id, (node2) => {
|
|
50038
|
+
if (typeof node2.id === "string")
|
|
50039
|
+
owner.set(node2.id, top.id);
|
|
50040
|
+
});
|
|
50041
|
+
}
|
|
50042
|
+
return owner;
|
|
50043
|
+
}
|
|
50044
|
+
var clone = (value) => JSON.parse(JSON.stringify(value));
|
|
50045
|
+
function penImageUrls(nodes) {
|
|
50046
|
+
const urls = [];
|
|
50047
|
+
const seen = new Set;
|
|
50048
|
+
for (const node2 of nodes) {
|
|
50049
|
+
visit2(node2, node2.id, (value) => {
|
|
50050
|
+
if (!isImage(value))
|
|
50051
|
+
return;
|
|
50052
|
+
const url = value.url;
|
|
50053
|
+
if (FILE_ID.test(url) || seen.has(url))
|
|
50054
|
+
return;
|
|
50055
|
+
seen.add(url);
|
|
50056
|
+
urls.push(url);
|
|
50057
|
+
});
|
|
50058
|
+
}
|
|
50059
|
+
return urls;
|
|
50060
|
+
}
|
|
50061
|
+
function planPenImport(doc, opts = {}) {
|
|
50062
|
+
const tops = Array.isArray(doc.children) ? doc.children : [];
|
|
50063
|
+
const warnings = [];
|
|
50064
|
+
const selected = new Set;
|
|
50065
|
+
const added = [];
|
|
50066
|
+
if (opts.frames === undefined) {
|
|
50067
|
+
for (const top of tops)
|
|
50068
|
+
selected.add(top.id);
|
|
50069
|
+
} else {
|
|
50070
|
+
const frames = new Set(opts.frames);
|
|
50071
|
+
for (const id of frames) {
|
|
50072
|
+
if (!tops.some((top) => top.id === id))
|
|
50073
|
+
warnings.push({ code: "FRAME_NOT_FOUND", id });
|
|
50074
|
+
else
|
|
50075
|
+
selected.add(id);
|
|
50076
|
+
}
|
|
50077
|
+
const owner = indexTops(tops);
|
|
50078
|
+
const byId = new Map(tops.map((top) => [top.id, top]));
|
|
50079
|
+
const dangling = new Set;
|
|
50080
|
+
for (let queue = [...selected];queue.length > 0; ) {
|
|
50081
|
+
const top = byId.get(queue.shift());
|
|
50082
|
+
if (!top)
|
|
50083
|
+
continue;
|
|
50084
|
+
visit2(top, top.id, (node2, nodeId) => {
|
|
50085
|
+
if (!isRef(node2))
|
|
50086
|
+
return;
|
|
50087
|
+
const ref = node2.ref;
|
|
50088
|
+
const target = owner.get(ref);
|
|
50089
|
+
if (target === undefined) {
|
|
50090
|
+
const key = `${ref}\x00${nodeId}`;
|
|
50091
|
+
if (dangling.has(key))
|
|
50092
|
+
return;
|
|
50093
|
+
dangling.add(key);
|
|
50094
|
+
warnings.push({ code: "REF_DANGLING", ref, nodeId });
|
|
50095
|
+
return;
|
|
50096
|
+
}
|
|
50097
|
+
if (selected.has(target))
|
|
50098
|
+
return;
|
|
50099
|
+
selected.add(target);
|
|
50100
|
+
queue.push(target);
|
|
50101
|
+
});
|
|
50102
|
+
}
|
|
50103
|
+
for (const top of tops)
|
|
50104
|
+
if (selected.has(top.id) && !frames.has(top.id))
|
|
50105
|
+
added.push(top.id);
|
|
50106
|
+
}
|
|
50107
|
+
const images = opts.images ?? {};
|
|
50108
|
+
const unmapped = new Map;
|
|
50109
|
+
const children = tops.filter((top) => selected.has(top.id)).map((top) => clone(top));
|
|
50110
|
+
for (const node2 of children) {
|
|
50111
|
+
visit2(node2, node2.id, (value, nodeId) => {
|
|
50112
|
+
if (!isImage(value))
|
|
50113
|
+
return;
|
|
50114
|
+
const url = value.url;
|
|
50115
|
+
if (FILE_ID.test(url))
|
|
50116
|
+
return;
|
|
50117
|
+
const fileId = Object.hasOwn(images, url) ? images[url] : undefined;
|
|
50118
|
+
if (typeof fileId === "string") {
|
|
50119
|
+
value.url = fileId;
|
|
50120
|
+
return;
|
|
50121
|
+
}
|
|
50122
|
+
const nodeIds = unmapped.get(url);
|
|
50123
|
+
if (nodeIds) {
|
|
50124
|
+
if (!nodeIds.includes(nodeId))
|
|
50125
|
+
nodeIds.push(nodeId);
|
|
50126
|
+
} else
|
|
50127
|
+
unmapped.set(url, [nodeId]);
|
|
50128
|
+
});
|
|
50129
|
+
}
|
|
50130
|
+
for (const [url, nodeIds] of unmapped)
|
|
50131
|
+
warnings.push({ code: "IMAGE_UNMAPPED", url, nodeIds });
|
|
50132
|
+
return {
|
|
50133
|
+
children,
|
|
50134
|
+
...doc.variables ? { variables: clone(doc.variables) } : {},
|
|
50135
|
+
...doc.themes ? { themes: clone(doc.themes) } : {},
|
|
50136
|
+
added,
|
|
50137
|
+
warnings
|
|
50138
|
+
};
|
|
50139
|
+
}
|
|
50140
|
+
// src/commands/canvas-import.ts
|
|
50141
|
+
var CHUNK_CHARS = 1500000;
|
|
50142
|
+
function countNodes(nodes) {
|
|
50143
|
+
let total = 0;
|
|
50144
|
+
const walk = (list) => {
|
|
50145
|
+
for (const node2 of list) {
|
|
50146
|
+
total++;
|
|
50147
|
+
if (Array.isArray(node2.children))
|
|
50148
|
+
walk(node2.children);
|
|
50149
|
+
}
|
|
50150
|
+
};
|
|
50151
|
+
walk(nodes);
|
|
50152
|
+
return total;
|
|
50153
|
+
}
|
|
50154
|
+
function chunkTopNodes(nodes, limit = CHUNK_CHARS) {
|
|
50155
|
+
const chunks = [];
|
|
50156
|
+
let current = [];
|
|
50157
|
+
let size = 0;
|
|
50158
|
+
for (const node2 of nodes) {
|
|
50159
|
+
const length = JSON.stringify(node2).length;
|
|
50160
|
+
if (current.length && size + length > limit) {
|
|
50161
|
+
chunks.push(current);
|
|
50162
|
+
current = [];
|
|
50163
|
+
size = 0;
|
|
50164
|
+
}
|
|
50165
|
+
current.push(node2);
|
|
50166
|
+
size += length;
|
|
50167
|
+
}
|
|
50168
|
+
if (current.length)
|
|
50169
|
+
chunks.push(current);
|
|
50170
|
+
return chunks;
|
|
50171
|
+
}
|
|
50172
|
+
var CONTENT_TYPES = {
|
|
50173
|
+
png: "image/png",
|
|
50174
|
+
jpg: "image/jpeg",
|
|
50175
|
+
jpeg: "image/jpeg",
|
|
50176
|
+
webp: "image/webp",
|
|
50177
|
+
gif: "image/gif",
|
|
50178
|
+
svg: "image/svg+xml",
|
|
50179
|
+
avif: "image/avif"
|
|
50180
|
+
};
|
|
50181
|
+
var contentTypeOf = (url) => CONTENT_TYPES[url.split(".").pop()?.toLowerCase() ?? ""] ?? "application/octet-stream";
|
|
50182
|
+
var viewerUrlFor = (canvasId, env) => `https://console${env === "develop" ? "-develop" : ""}.deepraxis.com/canvases/${canvasId}`;
|
|
50183
|
+
function imageCandidates(url, penFile, roots) {
|
|
50184
|
+
const name = basename2(url);
|
|
50185
|
+
return [...new Set([
|
|
50186
|
+
join5(dirname2(penFile), url),
|
|
50187
|
+
...roots.map((root) => join5(root, url)),
|
|
50188
|
+
...roots.map((root) => join5(root, name))
|
|
50189
|
+
])];
|
|
50190
|
+
}
|
|
50191
|
+
var isMissing = (error) => error?.code === "ENOENT";
|
|
50192
|
+
var reason = (error) => error instanceof Error ? error.message : String(error);
|
|
50193
|
+
async function findImage(url, candidates, ports) {
|
|
50194
|
+
for (const path of candidates) {
|
|
50195
|
+
try {
|
|
50196
|
+
return await ports.readBytes(path);
|
|
50197
|
+
} catch (error) {
|
|
50198
|
+
if (!isMissing(error))
|
|
50199
|
+
throw new UsageError(`cannot read ${path}, needed for image ${url}`, reason(error));
|
|
50200
|
+
}
|
|
50201
|
+
}
|
|
50202
|
+
return;
|
|
50203
|
+
}
|
|
50204
|
+
var warningKey = (warning) => `${warning.code}\x00${"url" in warning ? warning.url : ("id" in warning) ? warning.id : warning.ref}\x00${"nodeId" in warning ? warning.nodeId : ""}`;
|
|
50205
|
+
var warningLine = (warning) => {
|
|
50206
|
+
switch (warning.code) {
|
|
50207
|
+
case "IMAGE_UNMAPPED":
|
|
50208
|
+
return `${warning.code}: ${warning.url} (${warning.nodeIds.length} node(s))`;
|
|
50209
|
+
case "REF_DANGLING":
|
|
50210
|
+
return `${warning.code}: ${warning.ref} at ${warning.nodeId}`;
|
|
50211
|
+
case "FRAME_NOT_FOUND":
|
|
50212
|
+
return `${warning.code}: ${warning.id}`;
|
|
50213
|
+
default:
|
|
50214
|
+
return `${warning.code}: ${warning.url}`;
|
|
50215
|
+
}
|
|
50216
|
+
};
|
|
50217
|
+
async function canvasImport(args, ports) {
|
|
50218
|
+
if (args.canvas !== undefined && !args.yes) {
|
|
50219
|
+
throw new UsageError(`--canvas ${args.canvas} clears every node already on that canvas`, "It is a whole-canvas replacement, not a merge. Re-run with --yes, or omit --canvas to import into a new canvas.");
|
|
50220
|
+
}
|
|
50221
|
+
const file = resolve3(ports.cwd, args.file);
|
|
50222
|
+
let text;
|
|
50223
|
+
try {
|
|
50224
|
+
text = await ports.readFile(file);
|
|
50225
|
+
} catch (error) {
|
|
50226
|
+
throw new UsageError(`cannot read ${args.file}`, isMissing(error) ? "Check the path: `praxis canvas import <file.pen>`." : reason(error));
|
|
50227
|
+
}
|
|
50228
|
+
let doc;
|
|
50229
|
+
try {
|
|
50230
|
+
doc = JSON.parse(text);
|
|
50231
|
+
} catch (error) {
|
|
50232
|
+
throw new UsageError(`${args.file} is not valid JSON`, reason(error));
|
|
50233
|
+
}
|
|
50234
|
+
if (!Array.isArray(doc.children))
|
|
50235
|
+
throw new UsageError(`${args.file} has no children array`, "A .pen document is an object with a children array of top-level nodes.");
|
|
50236
|
+
const frames = args.frames?.filter((frame) => frame !== "");
|
|
50237
|
+
const roots = (args.imageRoots ?? []).map((root) => resolve3(ports.cwd, root));
|
|
50238
|
+
const selection = planPenImport(doc, frames ? { frames } : {});
|
|
50239
|
+
const urls = penImageUrls(selection.children);
|
|
50240
|
+
const found = new Map;
|
|
50241
|
+
const missing = [];
|
|
50242
|
+
for (const url of urls) {
|
|
50243
|
+
const bytes = await findImage(url, imageCandidates(url, file, roots), ports);
|
|
50244
|
+
if (bytes === undefined)
|
|
50245
|
+
missing.push(url);
|
|
50246
|
+
else
|
|
50247
|
+
found.set(url, { bytes, digest: await ports.hash(bytes) });
|
|
50248
|
+
}
|
|
50249
|
+
const images = {};
|
|
50250
|
+
let uploaded = 0;
|
|
50251
|
+
let reused = 0;
|
|
50252
|
+
if (!args.dryRun) {
|
|
50253
|
+
const byDigest = new Map;
|
|
50254
|
+
for (const [url, { bytes, digest }] of found) {
|
|
50255
|
+
const existing = byDigest.get(digest);
|
|
50256
|
+
if (existing !== undefined) {
|
|
50257
|
+
images[url] = existing;
|
|
50258
|
+
reused++;
|
|
50259
|
+
continue;
|
|
50260
|
+
}
|
|
50261
|
+
const id = await ports.upload({ filename: basename2(url), bytes, contentType: contentTypeOf(url) });
|
|
50262
|
+
byDigest.set(digest, id);
|
|
50263
|
+
images[url] = id;
|
|
50264
|
+
uploaded++;
|
|
50265
|
+
}
|
|
50266
|
+
}
|
|
50267
|
+
const plan = planPenImport(doc, { ...frames ? { frames } : {}, images });
|
|
50268
|
+
const chunks = chunkTopNodes(plan.children);
|
|
50269
|
+
const nodes = countNodes(plan.children);
|
|
50270
|
+
const warnings = plan.warnings.filter((warning) => !(args.dryRun && warning.code === "IMAGE_UNMAPPED" && !missing.includes(warning.url)));
|
|
50271
|
+
let canvasId = null;
|
|
50272
|
+
let revision = null;
|
|
50273
|
+
if (!args.dryRun) {
|
|
50274
|
+
canvasId = args.canvas ?? (await ports.rpc("canvas.canvases.create", { name: args.name ?? basename2(file).replace(/\.pen$/, "") })).id;
|
|
50275
|
+
for (let index = 0;index < chunks.length; index++) {
|
|
50276
|
+
const result2 = await ports.rpc("canvas.canvases.import", {
|
|
50277
|
+
canvasId,
|
|
50278
|
+
reset: index === 0,
|
|
50279
|
+
...index === 0 && plan.variables ? { variables: plan.variables } : {},
|
|
50280
|
+
...index === 0 && plan.themes ? { themes: plan.themes } : {},
|
|
50281
|
+
children: chunks[index]
|
|
50282
|
+
});
|
|
50283
|
+
revision = result2.revision;
|
|
50284
|
+
const seen = new Set(warnings.map(warningKey));
|
|
50285
|
+
for (const warning of result2.warnings ?? []) {
|
|
50286
|
+
if (seen.has(warningKey(warning)))
|
|
50287
|
+
continue;
|
|
50288
|
+
seen.add(warningKey(warning));
|
|
50289
|
+
warnings.push(warning);
|
|
50290
|
+
}
|
|
50291
|
+
}
|
|
50292
|
+
}
|
|
50293
|
+
const result = {
|
|
50294
|
+
canvas_id: canvasId,
|
|
50295
|
+
viewer_url: canvasId === null ? null : viewerUrlFor(canvasId, ports.env),
|
|
50296
|
+
revision,
|
|
50297
|
+
frames: plan.children.map((node2) => node2.id),
|
|
50298
|
+
added: plan.added,
|
|
50299
|
+
nodes,
|
|
50300
|
+
images: { uploaded, reused, missing },
|
|
50301
|
+
chunks: chunks.length,
|
|
50302
|
+
warnings,
|
|
50303
|
+
dry_run: args.dryRun
|
|
50304
|
+
};
|
|
50305
|
+
ports.emit({ kind: "object", data: result });
|
|
50306
|
+
const name = args.name ?? basename2(file).replace(/\.pen$/, "");
|
|
50307
|
+
const headline = `${plan.children.length} top-level nodes (${plan.added.length} added as component dependencies), ${nodes} nodes, ${chunks.length} chunk(s)`;
|
|
50308
|
+
ports.human([
|
|
50309
|
+
args.dryRun ? `${file}: ${headline}` : `${canvasId} ${name} — ${headline}, ${uploaded} image(s) uploaded${reused ? `, ${reused} reused` : ""}`,
|
|
50310
|
+
...result.viewer_url ? [result.viewer_url] : [],
|
|
50311
|
+
...plan.added.length ? [`added as dependencies: ${plan.added.join(", ")}`] : [],
|
|
50312
|
+
`${urls.length - missing.length}/${urls.length} image(s) found locally`,
|
|
50313
|
+
...missing.length ? [`not found (they will not render): ${missing.join(", ")}`] : [],
|
|
50314
|
+
...warnings.map(warningLine)
|
|
50315
|
+
].join(`
|
|
50316
|
+
`));
|
|
50317
|
+
return 0;
|
|
50318
|
+
}
|
|
50319
|
+
|
|
46693
50320
|
// src/main.ts
|
|
46694
50321
|
import { spawnSync } from "node:child_process";
|
|
46695
50322
|
|
|
@@ -46749,13 +50376,13 @@ var groups = [["id"], ["name", "title", "display_name"], ["status", "state"], ["
|
|
|
46749
50376
|
var isExtraColumn = (key) => !groups.some((group) => group.includes(key));
|
|
46750
50377
|
function columnsFor(items) {
|
|
46751
50378
|
const rows = items.map(record);
|
|
46752
|
-
const
|
|
50379
|
+
const keys2 = [...new Set(rows.flatMap((row) => Object.keys(row)))];
|
|
46753
50380
|
const chosen = groups.flatMap((group) => {
|
|
46754
|
-
const key = group.find((k) =>
|
|
50381
|
+
const key = group.find((k) => keys2.includes(k));
|
|
46755
50382
|
return key ? [key] : [];
|
|
46756
50383
|
});
|
|
46757
50384
|
const standard = new Set([...groups.flat(), "object"]);
|
|
46758
|
-
const extra =
|
|
50385
|
+
const extra = keys2.filter((key) => !standard.has(key) && rows.some((row) => row[key] !== null && row[key] !== undefined) && rows.every((row) => {
|
|
46759
50386
|
const v = row[key];
|
|
46760
50387
|
return v === null || v === undefined || typeof v === "boolean" || typeof v === "number" || typeof v === "string" && [...v].length <= 24;
|
|
46761
50388
|
})).slice(0, 2);
|
|
@@ -46810,9 +50437,9 @@ class ModelStream {
|
|
|
46810
50437
|
const data = streamData(event), message = record(data.message), response = record(data.response);
|
|
46811
50438
|
this.chunks.push(streamText(event));
|
|
46812
50439
|
const choices = Array.isArray(data.choices) ? data.choices : [];
|
|
46813
|
-
const
|
|
46814
|
-
if (typeof
|
|
46815
|
-
this.finishReason =
|
|
50440
|
+
const reason2 = choices.map((c) => record(c).finish_reason).find((r) => typeof r === "string" && r) ?? record(data.delta).stop_reason ?? message.stop_reason ?? data.stop_reason ?? record(response.incomplete_details).reason ?? response.status;
|
|
50441
|
+
if (typeof reason2 === "string" && reason2)
|
|
50442
|
+
this.finishReason = reason2;
|
|
46816
50443
|
else if (["response.completed", "response.incomplete", "response.failed"].includes(String(data.type)))
|
|
46817
50444
|
this.finishReason = String(data.type).slice("response.".length);
|
|
46818
50445
|
for (const usage of [message.usage, data.usage, response.usage]) {
|
|
@@ -47247,14 +50874,15 @@ var humanize = (code) => {
|
|
|
47247
50874
|
const words = code.toLowerCase().split("_").filter(Boolean).join(" ");
|
|
47248
50875
|
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
47249
50876
|
};
|
|
47250
|
-
function authHint(source) {
|
|
50877
|
+
function authHint(source, env) {
|
|
50878
|
+
const keyVariable = apiKeyVariable(env);
|
|
47251
50879
|
switch (source) {
|
|
47252
50880
|
case "api-key":
|
|
47253
|
-
return
|
|
50881
|
+
return `The ${env} API key from ${keyVariable} was rejected; check or replace it, or unset it to use \`praxis login\`.`;
|
|
47254
50882
|
case "machine-token":
|
|
47255
50883
|
return "The machine token from PRAXIS_API_TOKEN was rejected (it may have expired); unset it to use `praxis login`, or refresh it.";
|
|
47256
50884
|
case "login":
|
|
47257
|
-
return
|
|
50885
|
+
return `Run \`praxis login\` or set ${keyVariable}.`;
|
|
47258
50886
|
}
|
|
47259
50887
|
}
|
|
47260
50888
|
function errorInput(error, ctx) {
|
|
@@ -47284,7 +50912,7 @@ function errorInput(error, ctx) {
|
|
|
47284
50912
|
else if (serverText(problem?.hint))
|
|
47285
50913
|
hint2 = serverText(problem?.hint);
|
|
47286
50914
|
else if (authFailure)
|
|
47287
|
-
hint2 = authHint(source);
|
|
50915
|
+
hint2 = authHint(source, ctx.env === "develop" ? "develop" : "production");
|
|
47288
50916
|
else if (status === 404)
|
|
47289
50917
|
hint2 = ctx.listCommand ? `Check the id; list existing ones with \`${ctx.listCommand}\`` : "Check the id.";
|
|
47290
50918
|
else if (status === 403)
|
|
@@ -47323,7 +50951,7 @@ function startProgress(ctx, write = (text) => writeOutput({ stderr: text })) {
|
|
|
47323
50951
|
}
|
|
47324
50952
|
|
|
47325
50953
|
// src/main.ts
|
|
47326
|
-
var version = "0.2.2-dev.
|
|
50954
|
+
var version = "0.2.2-dev.4034191";
|
|
47327
50955
|
var commands = commandTree(operations);
|
|
47328
50956
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
47329
50957
|
function route(argv) {
|
|
@@ -47360,19 +50988,21 @@ var defaults = {
|
|
|
47360
50988
|
stderrIsTTY: Boolean(process.stderr.isTTY),
|
|
47361
50989
|
columns: process.stdout.columns ?? 100,
|
|
47362
50990
|
readFile: (path) => readFile3(path, "utf8"),
|
|
50991
|
+
readBytes: (path) => readFile3(path),
|
|
50992
|
+
sha256: async (bytes) => createHash3("sha256").update(bytes).digest("hex"),
|
|
47363
50993
|
async readStdin() {
|
|
47364
50994
|
const chunks = [];
|
|
47365
50995
|
for await (const chunk of process.stdin)
|
|
47366
50996
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
47367
50997
|
return Buffer.concat(chunks).toString("utf8");
|
|
47368
50998
|
},
|
|
47369
|
-
ask: () => new Promise((
|
|
50999
|
+
ask: () => new Promise((resolve4) => {
|
|
47370
51000
|
const input = createInterface({ input: process.stdin, terminal: false });
|
|
47371
51001
|
input.once("line", (line) => {
|
|
47372
|
-
|
|
51002
|
+
resolve4(/^(y|yes)$/i.test(line.trim()));
|
|
47373
51003
|
input.close();
|
|
47374
51004
|
});
|
|
47375
|
-
input.once("close", () =>
|
|
51005
|
+
input.once("close", () => resolve4(false));
|
|
47376
51006
|
}),
|
|
47377
51007
|
async openBrowser(url) {
|
|
47378
51008
|
try {
|
|
@@ -47380,27 +51010,27 @@ var defaults = {
|
|
|
47380
51010
|
if (!["https:", "http:"].includes(parsed.protocol))
|
|
47381
51011
|
return;
|
|
47382
51012
|
const cmd = process.platform === "darwin" ? ["open", url] : process.platform === "win32" ? ["rundll32", "url.dll,FileProtocolHandler", url] : ["xdg-open", url];
|
|
47383
|
-
await new Promise((
|
|
51013
|
+
await new Promise((resolve4, reject) => {
|
|
47384
51014
|
const child = spawn2(cmd[0], cmd.slice(1), { stdio: "ignore" });
|
|
47385
51015
|
child.once("error", reject);
|
|
47386
|
-
child.once("close", () =>
|
|
51016
|
+
child.once("close", () => resolve4());
|
|
47387
51017
|
});
|
|
47388
51018
|
} catch {}
|
|
47389
51019
|
},
|
|
47390
|
-
wait: (ms) => new Promise((
|
|
51020
|
+
wait: (ms) => new Promise((resolve4) => setTimeout(resolve4, ms)),
|
|
47391
51021
|
render,
|
|
47392
|
-
spawn: (cmd, args, options) => new Promise((
|
|
51022
|
+
spawn: (cmd, args, options) => new Promise((resolve4, reject) => {
|
|
47393
51023
|
const child = spawn2(cmd, args, { cwd: options.cwd, stdio: ["ignore", 2, 2] });
|
|
47394
51024
|
child.once("error", reject);
|
|
47395
|
-
child.once("close", (code) =>
|
|
51025
|
+
child.once("close", (code) => resolve4(code ?? 1));
|
|
47396
51026
|
}),
|
|
47397
|
-
spawnCapture: (cmd, args, options) => new Promise((
|
|
51027
|
+
spawnCapture: (cmd, args, options) => new Promise((resolve4, reject) => {
|
|
47398
51028
|
const child = spawn2(cmd, args, { cwd: options.cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
47399
51029
|
const chunks = [];
|
|
47400
51030
|
child.stdout.on("data", (c) => chunks.push(c));
|
|
47401
51031
|
child.stderr.on("data", (c) => chunks.push(c));
|
|
47402
51032
|
child.once("error", reject);
|
|
47403
|
-
child.once("close", (code) =>
|
|
51033
|
+
child.once("close", (code) => resolve4({ code: code ?? 1, output: Buffer.concat(chunks).toString("utf8") }));
|
|
47404
51034
|
}),
|
|
47405
51035
|
has: (bin) => spawnSync(process.platform === "win32" ? "where" : "which", [bin], { stdio: "ignore" }).status === 0,
|
|
47406
51036
|
cwd: process.cwd()
|
|
@@ -47419,6 +51049,13 @@ var appOptions = {
|
|
|
47419
51049
|
{ name: "no-wait", type: "boolean", description: "Return as soon as the run exists instead of waiting for a verdict." },
|
|
47420
51050
|
{ name: "repeat", type: "string", description: "How many times each selected case runs (default: 1)." },
|
|
47421
51051
|
{ name: "select", type: "string", repeated: true, description: "Narrow the selection; repeatable. tag:<tag> (a bare word reads as a tag), package:<path>, suite:<path> or file:<path>." }
|
|
51052
|
+
],
|
|
51053
|
+
"canvas import": [
|
|
51054
|
+
{ name: "name", type: "string", description: "Name for the new canvas (default: the file name without .pen)." },
|
|
51055
|
+
{ name: "canvas", type: "string", description: "Import into this existing canvas instead of a new one. Whole-canvas replacement: it clears what is already there and requires --yes." },
|
|
51056
|
+
{ name: "frames", type: "string", description: "Comma-separated top-level node ids to import. The components they reference come along automatically." },
|
|
51057
|
+
{ name: "image-root", type: "string", repeated: true, description: "Directory to resolve image paths against; repeatable. Tried after the .pen file's own directory, then by file name." },
|
|
51058
|
+
{ name: "dry-run", type: "boolean", description: "Read the local file and print the plan. No login and no request." }
|
|
47422
51059
|
]
|
|
47423
51060
|
};
|
|
47424
51061
|
async function main(argv, injected = {}) {
|
|
@@ -47427,6 +51064,8 @@ async function main(argv, injected = {}) {
|
|
|
47427
51064
|
const write = outputSession((result, context) => ports.render(redact(result, secrets), context));
|
|
47428
51065
|
if (ports.env.PRAXIS_API_KEY)
|
|
47429
51066
|
secrets.push(ports.env.PRAXIS_API_KEY);
|
|
51067
|
+
if (ports.env.PRAXIS_API_KEY_DEVELOP)
|
|
51068
|
+
secrets.push(ports.env.PRAXIS_API_KEY_DEVELOP);
|
|
47430
51069
|
if (ports.env.PRAXIS_API_TOKEN)
|
|
47431
51070
|
secrets.push(ports.env.PRAXIS_API_TOKEN);
|
|
47432
51071
|
let ctx = {
|
|
@@ -47516,7 +51155,7 @@ Examples:
|
|
|
47516
51155
|
return 0;
|
|
47517
51156
|
}
|
|
47518
51157
|
const path = ports.tokenPath ?? tokenPath(config.env);
|
|
47519
|
-
const
|
|
51158
|
+
const store2 = createTokenStore(config.env, path, selectSecretStore(ports.env, ports.secretStore));
|
|
47520
51159
|
const wireFetch = async (input, init) => {
|
|
47521
51160
|
const request = new Request(input, init);
|
|
47522
51161
|
request.headers.set("User-Agent", `praxis-cli/${version}${ctx.mode === "agent" ? ` agent/${ctx.agentName ?? "unknown"}` : ""}`);
|
|
@@ -47526,7 +51165,7 @@ Examples:
|
|
|
47526
51165
|
}
|
|
47527
51166
|
return ports.fetch(request);
|
|
47528
51167
|
};
|
|
47529
|
-
const auth = credentials(config, ports.env, { fetch: wireFetch, now: ports.now, path, store, remember: (s) => {
|
|
51168
|
+
const auth = credentials(config, ports.env, { fetch: wireFetch, now: ports.now, path, store: store2, remember: (s) => {
|
|
47530
51169
|
secrets.push(s);
|
|
47531
51170
|
} });
|
|
47532
51171
|
ctx.credentialSource = auth.source;
|
|
@@ -47602,7 +51241,7 @@ Examples:
|
|
|
47602
51241
|
return 0;
|
|
47603
51242
|
}
|
|
47604
51243
|
const name = selected.words.join(" ");
|
|
47605
|
-
const arity = name === "api" ? 2 : name === "org switch" || name === "app create" ? 1 : 0;
|
|
51244
|
+
const arity = name === "api" ? 2 : name === "org switch" || name === "app create" || name === "canvas import" ? 1 : 0;
|
|
47606
51245
|
if (parsed.positional.length !== arity)
|
|
47607
51246
|
throw new UsageError(`${name} expects ${arity} positional argument(s)`);
|
|
47608
51247
|
if (name === "devops deploy plan") {
|
|
@@ -47635,12 +51274,12 @@ Examples:
|
|
|
47635
51274
|
switch (name) {
|
|
47636
51275
|
case "login":
|
|
47637
51276
|
if (flags["no-input"] || quiet)
|
|
47638
|
-
throw new UsageError("login requires displaying a device code", "Remove --no-input / --quiet or set PRAXIS_API_KEY for scripts.");
|
|
51277
|
+
throw new UsageError("login requires displaying a device code", "Remove --no-input / --quiet, or set PRAXIS_API_KEY (production) / PRAXIS_API_KEY_DEVELOP (develop) for scripts.");
|
|
47639
51278
|
ctx.credentialSource = "login";
|
|
47640
|
-
await login(config, path, { ...ports, source: auth.source, json: ctx.mode === "json", store, fetch: wireFetch, emit, remember: (s) => secrets.push(s) });
|
|
51279
|
+
await login(config, path, { ...ports, source: auth.source, json: ctx.mode === "json", store: store2, fetch: wireFetch, emit, remember: (s) => secrets.push(s) });
|
|
47641
51280
|
break;
|
|
47642
51281
|
case "logout":
|
|
47643
|
-
emit({ kind: "message", text: await
|
|
51282
|
+
emit({ kind: "message", text: await store2.delete() ? "Logged out." : "Not logged in." });
|
|
47644
51283
|
break;
|
|
47645
51284
|
case "whoami":
|
|
47646
51285
|
emit({ kind: "object", data: await whoami(auth, config.env, org) });
|
|
@@ -47699,6 +51338,67 @@ Examples:
|
|
|
47699
51338
|
cwd: ports.cwd
|
|
47700
51339
|
});
|
|
47701
51340
|
}
|
|
51341
|
+
case "canvas import": {
|
|
51342
|
+
const authorize = async () => {
|
|
51343
|
+
const credential = await auth.get(org);
|
|
51344
|
+
return { Authorization: `Bearer ${credential.token}`, ...credential.source === "api-key" ? { "X-API-Key": credential.token } : {} };
|
|
51345
|
+
};
|
|
51346
|
+
const rpc = async (method, params) => {
|
|
51347
|
+
const response = await wireFetch(`${config.apiUrl}/canvas/v1/rpc`, {
|
|
51348
|
+
method: "POST",
|
|
51349
|
+
headers: { ...await authorize(), "content-type": "application/json" },
|
|
51350
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
51351
|
+
signal: AbortSignal.timeout(120000),
|
|
51352
|
+
redirect: "error"
|
|
51353
|
+
});
|
|
51354
|
+
const reply = await response.json();
|
|
51355
|
+
if (!response.ok || reply.error)
|
|
51356
|
+
throw new PraxisError({ code: "CANVAS_RPC_ERROR", message: `${method}: ${reply.error?.message ?? `HTTP ${response.status}`}` });
|
|
51357
|
+
if (!Object.hasOwn(reply, "result"))
|
|
51358
|
+
throw new PraxisError({ code: "INVALID_RESPONSE", message: `${method} answered no result` });
|
|
51359
|
+
return reply.result;
|
|
51360
|
+
};
|
|
51361
|
+
const upload = async ({ filename, bytes, contentType }) => {
|
|
51362
|
+
const signed = await wireFetch(`${config.apiUrl}/file/v1/uploads/signed`, {
|
|
51363
|
+
method: "POST",
|
|
51364
|
+
headers: { ...await authorize(), "content-type": "application/json" },
|
|
51365
|
+
body: JSON.stringify({ filename, bytes: bytes.length, content_type: contentType, purpose: "user_data" }),
|
|
51366
|
+
signal: AbortSignal.timeout(60000),
|
|
51367
|
+
redirect: "error"
|
|
51368
|
+
});
|
|
51369
|
+
const session = await signed.json();
|
|
51370
|
+
if (!signed.ok || typeof session.url !== "string")
|
|
51371
|
+
throw new PraxisError({ code: "UPLOAD_REJECTED", message: `signed upload for ${filename} failed (HTTP ${signed.status})` });
|
|
51372
|
+
const sent = await wireFetch(session.url, { method: "PUT", headers: { "content-type": contentType, "content-length": String(bytes.length) }, body: bytes, signal: AbortSignal.timeout(120000), redirect: "error" });
|
|
51373
|
+
const file = await sent.json();
|
|
51374
|
+
if (!sent.ok || typeof file.id !== "string")
|
|
51375
|
+
throw new PraxisError({ code: "UPLOAD_FAILED", message: `uploading ${filename} failed (HTTP ${sent.status})` });
|
|
51376
|
+
return file.id;
|
|
51377
|
+
};
|
|
51378
|
+
return await canvasImport({
|
|
51379
|
+
file: parsed.positional[0],
|
|
51380
|
+
name: parsed.flags.name?.[0],
|
|
51381
|
+
canvas: parsed.flags.canvas?.[0],
|
|
51382
|
+
frames: typeof parsed.flags.frames?.[0] === "string" ? parsed.flags.frames[0].split(",").map((frame) => frame.trim()).filter(Boolean) : undefined,
|
|
51383
|
+
imageRoots: parsed.flags["image-root"],
|
|
51384
|
+
dryRun: Boolean(parsed.flags["dry-run"]?.[0]),
|
|
51385
|
+
yes: Boolean(flags.yes)
|
|
51386
|
+
}, {
|
|
51387
|
+
readFile: ports.readFile,
|
|
51388
|
+
readBytes: ports.readBytes,
|
|
51389
|
+
hash: ports.sha256,
|
|
51390
|
+
env: config.env,
|
|
51391
|
+
mode: ctx.mode,
|
|
51392
|
+
emit,
|
|
51393
|
+
cwd: ports.cwd,
|
|
51394
|
+
rpc,
|
|
51395
|
+
upload,
|
|
51396
|
+
human: (text) => {
|
|
51397
|
+
if (ctx.mode === "human")
|
|
51398
|
+
emit({ kind: "message", channel: "stdout", text });
|
|
51399
|
+
}
|
|
51400
|
+
});
|
|
51401
|
+
}
|
|
47702
51402
|
case "api": {
|
|
47703
51403
|
const method = parsed.positional[0];
|
|
47704
51404
|
if (!HTTP_METHOD.test(method))
|