@lizard-build/sdk 0.1.73 → 0.1.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -967,7 +967,11 @@ declare class GitReposAPI {
967
967
  /** Who moved which branch, when. */
968
968
  reflog(repo: RepoRef, ref?: string): Promise<unknown[]>;
969
969
  archive(repo: RepoRef, ref: string, format?: 'zip' | 'tar.gz'): Promise<Uint8Array>;
970
- /** The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works without a helper. */
970
+ /**
971
+ * The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works
972
+ * without a helper; git then keeps it in .git/config. For anything shared or logged, use a
973
+ * limited Lizard Git token (`tokens.create`) as `apiKey` instead of the account's key.
974
+ */
971
975
  cloneUrl(repo: RepoRef, opts?: {
972
976
  withKey?: boolean;
973
977
  }): string;
@@ -1055,10 +1059,102 @@ declare class GitSecretsAPI {
1055
1059
  set(repo: RepoRef, name: string, value: string): Promise<void>;
1056
1060
  delete(repo: RepoRef, name: string): Promise<void>;
1057
1061
  }
1062
+ interface Environment {
1063
+ id: number;
1064
+ name: string;
1065
+ reviewers: string[];
1066
+ preventSelfReview: boolean;
1067
+ waitMinutes: number;
1068
+ branchPolicy: 'all' | 'protected' | 'custom';
1069
+ branches: string[];
1070
+ secrets: string[];
1071
+ variables: string[];
1072
+ createdAt: number;
1073
+ }
1074
+ interface EnvironmentOpts {
1075
+ /** Up to 6 people with write access; any one approves a deployment. */
1076
+ reviewers?: string[];
1077
+ /** Whoever started a run can't approve its deployment. */
1078
+ preventSelfReview?: boolean;
1079
+ /** Minutes after approval before the job starts. */
1080
+ waitMinutes?: number;
1081
+ /** Which branches and tags may deploy: all, protected (with a branch rule), or `branches` patterns. */
1082
+ branchPolicy?: 'all' | 'protected' | 'custom';
1083
+ branches?: string[];
1084
+ }
1085
+ interface Deployment {
1086
+ jobId: number;
1087
+ environment: string;
1088
+ url?: string;
1089
+ state: 'waiting' | 'timer' | 'approved' | 'rejected';
1090
+ readyAt?: number;
1091
+ reviewer?: string;
1092
+ comment?: string;
1093
+ updatedAt: number;
1094
+ canReview: boolean;
1095
+ reviewers?: string[];
1096
+ }
1097
+ interface Variable {
1098
+ name: string;
1099
+ value: string;
1100
+ updatedAt: number;
1101
+ }
1102
+ declare class GitVariablesAPI {
1103
+ private readonly c;
1104
+ private readonly base;
1105
+ constructor(c: GitClient, base: (repo: RepoRef) => string);
1106
+ list(repo: RepoRef): Promise<{
1107
+ variables: Variable[];
1108
+ }>;
1109
+ set(repo: RepoRef, name: string, value: string): Promise<{
1110
+ name: string;
1111
+ }>;
1112
+ delete(repo: RepoRef, name: string): Promise<void>;
1113
+ }
1114
+ /** Environments: deployment protection rules, their secrets and variables (admins). */
1115
+ declare class GitEnvironmentsAPI {
1116
+ private readonly c;
1117
+ constructor(c: GitClient);
1118
+ private path;
1119
+ list(repo: RepoRef): Promise<{
1120
+ environments: Environment[];
1121
+ }>;
1122
+ get(repo: RepoRef, env: string): Promise<Environment>;
1123
+ /** Create it, or change its rules (fields left out stay). */
1124
+ set(repo: RepoRef, env: string, opts?: EnvironmentOpts): Promise<Environment>;
1125
+ delete(repo: RepoRef, env: string): Promise<void>;
1126
+ listSecrets(repo: RepoRef, env: string): Promise<{
1127
+ secrets: Array<{
1128
+ name: string;
1129
+ updatedAt: number;
1130
+ }>;
1131
+ }>;
1132
+ /** Only this environment's jobs get it, after its rules pass; it wins over a repository secret of the same name. */
1133
+ setSecret(repo: RepoRef, env: string, name: string, value: string): Promise<{
1134
+ name: string;
1135
+ }>;
1136
+ deleteSecret(repo: RepoRef, env: string, name: string): Promise<void>;
1137
+ variables(env: string): GitVariablesAPI;
1138
+ }
1058
1139
  declare class GitActionsAPI {
1059
1140
  private readonly c;
1060
1141
  readonly secrets: GitSecretsAPI;
1142
+ /** Repository variables: vars.NAME in every job. */
1143
+ readonly variables: GitVariablesAPI;
1061
1144
  constructor(c: GitClient);
1145
+ /** A run's jobs that deploy to an environment, and what each waits for. */
1146
+ deployments(repo: RepoRef, number: number): Promise<{
1147
+ deployments: Deployment[];
1148
+ }>;
1149
+ /** Approve or reject the run's waiting deployments (all you may review, or those named). */
1150
+ reviewDeployments(repo: RepoRef, number: number, opts: {
1151
+ state: 'approved' | 'rejected';
1152
+ environments?: string[];
1153
+ comment?: string;
1154
+ }): Promise<{
1155
+ state: string;
1156
+ environments: string[];
1157
+ }>;
1062
1158
  runs(repo: RepoRef, opts?: ListRunsOpts): Promise<{
1063
1159
  runs: Run[];
1064
1160
  more: boolean;
@@ -1236,6 +1332,7 @@ declare class GitAPI {
1236
1332
  readonly issues: GitIssuesOnlyAPI;
1237
1333
  readonly pulls: GitPullsAPI;
1238
1334
  readonly actions: GitActionsAPI;
1335
+ readonly environments: GitEnvironmentsAPI;
1239
1336
  readonly collaborators: GitCollaboratorsAPI;
1240
1337
  readonly webhooks: GitWebhooksAPI;
1241
1338
  readonly branchRules: GitBranchRulesAPI;
@@ -3269,4 +3366,4 @@ declare class LizardCLI {
3269
3366
  }): Promise<CLIResult>;
3270
3367
  }
3271
3368
 
3272
- export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type BranchRule, type BranchRuleOpts, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, type CombinedStatus, type CommitFilesOpts, type CommitStatus, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreatePullOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, DEFAULT_GIT_URL, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitAPI, GitActionsAPI, type Artifact as GitArtifact, type Blob$1 as GitBlob, GitBranchRulesAPI, GitClient, type Collaborator as GitCollaborator, GitCollaboratorsAPI, type Commit as GitCommit, type Delivery as GitDelivery, type FileChange as GitFileChange, GitHubAPI, type Invitation as GitInvitation, type Issue as GitIssue, type IssueDetail as GitIssueDetail, type IssueList as GitIssueList, GitIssuesOnlyAPI, type Job as GitJob, type Label as GitLabel, GitLabelsAPI, type Notification as GitNotification, GitNotificationsAPI, GitPullsAPI, type Ref as GitRef, type Release as GitRelease, GitReleasesAPI, type Repo as GitRepo, type RepoMeta as GitRepoMeta, GitReposAPI, type Role as GitRole, type Run as GitRun, GitSecretsAPI, GitStatusesAPI, type Token as GitToken, GitTokensAPI, type TreeEntry as GitTreeEntry, type GitUser, type Webhook as GitWebhook, GitWebhooksAPI, type Workflow as GitWorkflow, LimitExceededError, type LineComment, type ListIssuesOpts, type ListRunsOpts, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogChunk, type LogLine, type MergeOpts, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ReleaseOpts, type RepoRef, type ResaleMultipliers, type ResalePricing, type ReviewOpts, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type TokenOpts, type Transaction, type TransactionPage, type UpdateIssueOpts, Volume, type VolumeInfo, type WebhookOpts, type Workspace, type WorkspaceLimits, type WorkspaceLimitsInfo, type WorkspaceUsage, WorkspacesAPI, resolveProjectId };
3369
+ export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type BranchRule, type BranchRuleOpts, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, type CombinedStatus, type CommitFilesOpts, type CommitStatus, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreatePullOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, DEFAULT_GIT_URL, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, type EnvironmentOpts, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitAPI, GitActionsAPI, type Artifact as GitArtifact, type Blob$1 as GitBlob, GitBranchRulesAPI, GitClient, type Collaborator as GitCollaborator, GitCollaboratorsAPI, type Commit as GitCommit, type Delivery as GitDelivery, type Deployment as GitDeployment, type Environment as GitEnvironment, GitEnvironmentsAPI, type FileChange as GitFileChange, GitHubAPI, type Invitation as GitInvitation, type Issue as GitIssue, type IssueDetail as GitIssueDetail, type IssueList as GitIssueList, GitIssuesOnlyAPI, type Job as GitJob, type Label as GitLabel, GitLabelsAPI, type Notification as GitNotification, GitNotificationsAPI, GitPullsAPI, type Ref as GitRef, type Release as GitRelease, GitReleasesAPI, type Repo as GitRepo, type RepoMeta as GitRepoMeta, GitReposAPI, type Role as GitRole, type Run as GitRun, GitSecretsAPI, GitStatusesAPI, type Token as GitToken, GitTokensAPI, type TreeEntry as GitTreeEntry, type GitUser, type Variable as GitVariable, GitVariablesAPI, type Webhook as GitWebhook, GitWebhooksAPI, type Workflow as GitWorkflow, LimitExceededError, type LineComment, type ListIssuesOpts, type ListRunsOpts, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogChunk, type LogLine, type MergeOpts, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ReleaseOpts, type RepoRef, type ResaleMultipliers, type ResalePricing, type ReviewOpts, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type TokenOpts, type Transaction, type TransactionPage, type UpdateIssueOpts, Volume, type VolumeInfo, type WebhookOpts, type Workspace, type WorkspaceLimits, type WorkspaceLimitsInfo, type WorkspaceUsage, WorkspacesAPI, resolveProjectId };
package/dist/index.d.ts CHANGED
@@ -967,7 +967,11 @@ declare class GitReposAPI {
967
967
  /** Who moved which branch, when. */
968
968
  reflog(repo: RepoRef, ref?: string): Promise<unknown[]>;
969
969
  archive(repo: RepoRef, ref: string, format?: 'zip' | 'tar.gz'): Promise<Uint8Array>;
970
- /** The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works without a helper. */
970
+ /**
971
+ * The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works
972
+ * without a helper; git then keeps it in .git/config. For anything shared or logged, use a
973
+ * limited Lizard Git token (`tokens.create`) as `apiKey` instead of the account's key.
974
+ */
971
975
  cloneUrl(repo: RepoRef, opts?: {
972
976
  withKey?: boolean;
973
977
  }): string;
@@ -1055,10 +1059,102 @@ declare class GitSecretsAPI {
1055
1059
  set(repo: RepoRef, name: string, value: string): Promise<void>;
1056
1060
  delete(repo: RepoRef, name: string): Promise<void>;
1057
1061
  }
1062
+ interface Environment {
1063
+ id: number;
1064
+ name: string;
1065
+ reviewers: string[];
1066
+ preventSelfReview: boolean;
1067
+ waitMinutes: number;
1068
+ branchPolicy: 'all' | 'protected' | 'custom';
1069
+ branches: string[];
1070
+ secrets: string[];
1071
+ variables: string[];
1072
+ createdAt: number;
1073
+ }
1074
+ interface EnvironmentOpts {
1075
+ /** Up to 6 people with write access; any one approves a deployment. */
1076
+ reviewers?: string[];
1077
+ /** Whoever started a run can't approve its deployment. */
1078
+ preventSelfReview?: boolean;
1079
+ /** Minutes after approval before the job starts. */
1080
+ waitMinutes?: number;
1081
+ /** Which branches and tags may deploy: all, protected (with a branch rule), or `branches` patterns. */
1082
+ branchPolicy?: 'all' | 'protected' | 'custom';
1083
+ branches?: string[];
1084
+ }
1085
+ interface Deployment {
1086
+ jobId: number;
1087
+ environment: string;
1088
+ url?: string;
1089
+ state: 'waiting' | 'timer' | 'approved' | 'rejected';
1090
+ readyAt?: number;
1091
+ reviewer?: string;
1092
+ comment?: string;
1093
+ updatedAt: number;
1094
+ canReview: boolean;
1095
+ reviewers?: string[];
1096
+ }
1097
+ interface Variable {
1098
+ name: string;
1099
+ value: string;
1100
+ updatedAt: number;
1101
+ }
1102
+ declare class GitVariablesAPI {
1103
+ private readonly c;
1104
+ private readonly base;
1105
+ constructor(c: GitClient, base: (repo: RepoRef) => string);
1106
+ list(repo: RepoRef): Promise<{
1107
+ variables: Variable[];
1108
+ }>;
1109
+ set(repo: RepoRef, name: string, value: string): Promise<{
1110
+ name: string;
1111
+ }>;
1112
+ delete(repo: RepoRef, name: string): Promise<void>;
1113
+ }
1114
+ /** Environments: deployment protection rules, their secrets and variables (admins). */
1115
+ declare class GitEnvironmentsAPI {
1116
+ private readonly c;
1117
+ constructor(c: GitClient);
1118
+ private path;
1119
+ list(repo: RepoRef): Promise<{
1120
+ environments: Environment[];
1121
+ }>;
1122
+ get(repo: RepoRef, env: string): Promise<Environment>;
1123
+ /** Create it, or change its rules (fields left out stay). */
1124
+ set(repo: RepoRef, env: string, opts?: EnvironmentOpts): Promise<Environment>;
1125
+ delete(repo: RepoRef, env: string): Promise<void>;
1126
+ listSecrets(repo: RepoRef, env: string): Promise<{
1127
+ secrets: Array<{
1128
+ name: string;
1129
+ updatedAt: number;
1130
+ }>;
1131
+ }>;
1132
+ /** Only this environment's jobs get it, after its rules pass; it wins over a repository secret of the same name. */
1133
+ setSecret(repo: RepoRef, env: string, name: string, value: string): Promise<{
1134
+ name: string;
1135
+ }>;
1136
+ deleteSecret(repo: RepoRef, env: string, name: string): Promise<void>;
1137
+ variables(env: string): GitVariablesAPI;
1138
+ }
1058
1139
  declare class GitActionsAPI {
1059
1140
  private readonly c;
1060
1141
  readonly secrets: GitSecretsAPI;
1142
+ /** Repository variables: vars.NAME in every job. */
1143
+ readonly variables: GitVariablesAPI;
1061
1144
  constructor(c: GitClient);
1145
+ /** A run's jobs that deploy to an environment, and what each waits for. */
1146
+ deployments(repo: RepoRef, number: number): Promise<{
1147
+ deployments: Deployment[];
1148
+ }>;
1149
+ /** Approve or reject the run's waiting deployments (all you may review, or those named). */
1150
+ reviewDeployments(repo: RepoRef, number: number, opts: {
1151
+ state: 'approved' | 'rejected';
1152
+ environments?: string[];
1153
+ comment?: string;
1154
+ }): Promise<{
1155
+ state: string;
1156
+ environments: string[];
1157
+ }>;
1062
1158
  runs(repo: RepoRef, opts?: ListRunsOpts): Promise<{
1063
1159
  runs: Run[];
1064
1160
  more: boolean;
@@ -1236,6 +1332,7 @@ declare class GitAPI {
1236
1332
  readonly issues: GitIssuesOnlyAPI;
1237
1333
  readonly pulls: GitPullsAPI;
1238
1334
  readonly actions: GitActionsAPI;
1335
+ readonly environments: GitEnvironmentsAPI;
1239
1336
  readonly collaborators: GitCollaboratorsAPI;
1240
1337
  readonly webhooks: GitWebhooksAPI;
1241
1338
  readonly branchRules: GitBranchRulesAPI;
@@ -3269,4 +3366,4 @@ declare class LizardCLI {
3269
3366
  }): Promise<CLIResult>;
3270
3367
  }
3271
3368
 
3272
- export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type BranchRule, type BranchRuleOpts, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, type CombinedStatus, type CommitFilesOpts, type CommitStatus, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreatePullOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, DEFAULT_GIT_URL, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitAPI, GitActionsAPI, type Artifact as GitArtifact, type Blob$1 as GitBlob, GitBranchRulesAPI, GitClient, type Collaborator as GitCollaborator, GitCollaboratorsAPI, type Commit as GitCommit, type Delivery as GitDelivery, type FileChange as GitFileChange, GitHubAPI, type Invitation as GitInvitation, type Issue as GitIssue, type IssueDetail as GitIssueDetail, type IssueList as GitIssueList, GitIssuesOnlyAPI, type Job as GitJob, type Label as GitLabel, GitLabelsAPI, type Notification as GitNotification, GitNotificationsAPI, GitPullsAPI, type Ref as GitRef, type Release as GitRelease, GitReleasesAPI, type Repo as GitRepo, type RepoMeta as GitRepoMeta, GitReposAPI, type Role as GitRole, type Run as GitRun, GitSecretsAPI, GitStatusesAPI, type Token as GitToken, GitTokensAPI, type TreeEntry as GitTreeEntry, type GitUser, type Webhook as GitWebhook, GitWebhooksAPI, type Workflow as GitWorkflow, LimitExceededError, type LineComment, type ListIssuesOpts, type ListRunsOpts, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogChunk, type LogLine, type MergeOpts, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ReleaseOpts, type RepoRef, type ResaleMultipliers, type ResalePricing, type ReviewOpts, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type TokenOpts, type Transaction, type TransactionPage, type UpdateIssueOpts, Volume, type VolumeInfo, type WebhookOpts, type Workspace, type WorkspaceLimits, type WorkspaceLimitsInfo, type WorkspaceUsage, WorkspacesAPI, resolveProjectId };
3369
+ export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type BranchRule, type BranchRuleOpts, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, type CombinedStatus, type CommitFilesOpts, type CommitStatus, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreatePullOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, DEFAULT_GIT_URL, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, type EnvironmentOpts, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitAPI, GitActionsAPI, type Artifact as GitArtifact, type Blob$1 as GitBlob, GitBranchRulesAPI, GitClient, type Collaborator as GitCollaborator, GitCollaboratorsAPI, type Commit as GitCommit, type Delivery as GitDelivery, type Deployment as GitDeployment, type Environment as GitEnvironment, GitEnvironmentsAPI, type FileChange as GitFileChange, GitHubAPI, type Invitation as GitInvitation, type Issue as GitIssue, type IssueDetail as GitIssueDetail, type IssueList as GitIssueList, GitIssuesOnlyAPI, type Job as GitJob, type Label as GitLabel, GitLabelsAPI, type Notification as GitNotification, GitNotificationsAPI, GitPullsAPI, type Ref as GitRef, type Release as GitRelease, GitReleasesAPI, type Repo as GitRepo, type RepoMeta as GitRepoMeta, GitReposAPI, type Role as GitRole, type Run as GitRun, GitSecretsAPI, GitStatusesAPI, type Token as GitToken, GitTokensAPI, type TreeEntry as GitTreeEntry, type GitUser, type Variable as GitVariable, GitVariablesAPI, type Webhook as GitWebhook, GitWebhooksAPI, type Workflow as GitWorkflow, LimitExceededError, type LineComment, type ListIssuesOpts, type ListRunsOpts, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogChunk, type LogLine, type MergeOpts, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ReleaseOpts, type RepoRef, type ResaleMultipliers, type ResalePricing, type ReviewOpts, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type TokenOpts, type Transaction, type TransactionPage, type UpdateIssueOpts, Volume, type VolumeInfo, type WebhookOpts, type Workspace, type WorkspaceLimits, type WorkspaceLimitsInfo, type WorkspaceUsage, WorkspacesAPI, resolveProjectId };
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  GitBranchRulesAPI: () => GitBranchRulesAPI,
37
37
  GitClient: () => GitClient,
38
38
  GitCollaboratorsAPI: () => GitCollaboratorsAPI,
39
+ GitEnvironmentsAPI: () => GitEnvironmentsAPI,
39
40
  GitHubAPI: () => GitHubAPI,
40
41
  GitIssuesOnlyAPI: () => GitIssuesOnlyAPI,
41
42
  GitLabelsAPI: () => GitLabelsAPI,
@@ -46,6 +47,7 @@ __export(index_exports, {
46
47
  GitSecretsAPI: () => GitSecretsAPI,
47
48
  GitStatusesAPI: () => GitStatusesAPI,
48
49
  GitTokensAPI: () => GitTokensAPI,
50
+ GitVariablesAPI: () => GitVariablesAPI,
49
51
  GitWebhooksAPI: () => GitWebhooksAPI,
50
52
  LimitExceededError: () => LimitExceededError,
51
53
  Lizard: () => Lizard,
@@ -559,9 +561,14 @@ function qs(path, values) {
559
561
  for (const [k, v] of Object.entries(values)) if (v !== void 0 && v !== "") q.set(k, String(v));
560
562
  return q.size ? `${path}?${q}` : path;
561
563
  }
564
+ function segs(p) {
565
+ const parts = p.split("/");
566
+ if (parts.some((x) => x === "" || x === "." || x === "..")) throw new Error(`bad path: "${p}"`);
567
+ return parts.map(seg).join("/");
568
+ }
562
569
  function repoPath(repo) {
563
570
  const m = /^([^/\s]+)\/([^/\s]+?)(\.git)?$/.exec(repo);
564
- if (!m) throw new Error(`repository must be "owner/name", got "${repo}"`);
571
+ if (!m || [m[1], m[2]].some((x) => x === "." || x === "..")) throw new Error(`repository must be "owner/name", got "${repo}"`);
565
572
  return `/api/repos/${seg(m[1])}/${seg(m[2])}`;
566
573
  }
567
574
  var GitClient = class {
@@ -574,6 +581,8 @@ var GitClient = class {
574
581
  method,
575
582
  body,
576
583
  headers: { "X-API-Key": this.config.apiKey, ...headers },
584
+ redirect: "error",
585
+ // a redirect would carry the key to wherever it points
577
586
  signal: AbortSignal.timeout(this.config.requestTimeoutMs)
578
587
  });
579
588
  if (!res.ok) await handleApiError(res);
@@ -650,7 +659,7 @@ var GitReposAPI = class {
650
659
  return this.c.post(`${repoPath(repo)}/branches`, { name, from });
651
660
  }
652
661
  deleteBranch(repo, name) {
653
- return this.c.delete(`${repoPath(repo)}/branches/${name.split("/").map(seg).join("/")}`);
662
+ return this.c.delete(`${repoPath(repo)}/branches/${segs(name)}`);
654
663
  }
655
664
  tree(repo, opts = {}) {
656
665
  return this.c.get(qs(`${repoPath(repo)}/tree`, opts));
@@ -661,8 +670,9 @@ var GitReposAPI = class {
661
670
  }
662
671
  /** A file's bytes, whatever its size or type. */
663
672
  raw(repo, path, ref) {
673
+ repoPath(repo);
664
674
  const [owner, name] = repo.split("/");
665
- return this.c.bytes(`/raw/${seg(owner)}/${seg(name)}/${ref.split("/").map(seg).join("/")}/${path.split("/").map(seg).join("/")}`);
675
+ return this.c.bytes(`/raw/${seg(owner)}/${seg(name)}/${segs(ref)}/${segs(path)}`);
666
676
  }
667
677
  /** Every file path at a ref. */
668
678
  files(repo, ref) {
@@ -696,7 +706,11 @@ var GitReposAPI = class {
696
706
  archive(repo, ref, format = "tar.gz") {
697
707
  return this.c.bytes(`${repoPath(repo)}/archive/${seg(ref)}.${format}`);
698
708
  }
699
- /** The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works without a helper. */
709
+ /**
710
+ * The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works
711
+ * without a helper; git then keeps it in .git/config. For anything shared or logged, use a
712
+ * limited Lizard Git token (`tokens.create`) as `apiKey` instead of the account's key.
713
+ */
700
714
  cloneUrl(repo, opts = {}) {
701
715
  repoPath(repo);
702
716
  const u = new URL(`${this.c.url}/${repo.replace(/\.git$/, "")}.git`);
@@ -801,10 +815,68 @@ var GitSecretsAPI = class {
801
815
  return this.c.delete(`${repoPath(repo)}/actions/secrets/${seg(name)}`);
802
816
  }
803
817
  };
818
+ var GitVariablesAPI = class {
819
+ constructor(c, base) {
820
+ this.c = c;
821
+ this.base = base;
822
+ }
823
+ list(repo) {
824
+ return this.c.get(`${this.base(repo)}/variables`);
825
+ }
826
+ set(repo, name, value) {
827
+ return this.c.put(`${this.base(repo)}/variables/${seg(name)}`, { value });
828
+ }
829
+ delete(repo, name) {
830
+ return this.c.delete(`${this.base(repo)}/variables/${seg(name)}`);
831
+ }
832
+ };
833
+ var GitEnvironmentsAPI = class {
834
+ constructor(c) {
835
+ this.c = c;
836
+ }
837
+ path(repo, env) {
838
+ return `${repoPath(repo)}/actions/environments/${seg(env)}`;
839
+ }
840
+ list(repo) {
841
+ return this.c.get(`${repoPath(repo)}/actions/environments`);
842
+ }
843
+ get(repo, env) {
844
+ return this.c.get(this.path(repo, env));
845
+ }
846
+ /** Create it, or change its rules (fields left out stay). */
847
+ set(repo, env, opts = {}) {
848
+ return this.c.put(this.path(repo, env), opts);
849
+ }
850
+ delete(repo, env) {
851
+ return this.c.delete(this.path(repo, env));
852
+ }
853
+ listSecrets(repo, env) {
854
+ return this.c.get(`${this.path(repo, env)}/secrets`);
855
+ }
856
+ /** Only this environment's jobs get it, after its rules pass; it wins over a repository secret of the same name. */
857
+ setSecret(repo, env, name, value) {
858
+ return this.c.put(`${this.path(repo, env)}/secrets/${seg(name)}`, { value });
859
+ }
860
+ deleteSecret(repo, env, name) {
861
+ return this.c.delete(`${this.path(repo, env)}/secrets/${seg(name)}`);
862
+ }
863
+ variables(env) {
864
+ return new GitVariablesAPI(this.c, (repo) => this.path(repo, env));
865
+ }
866
+ };
804
867
  var GitActionsAPI = class {
805
868
  constructor(c) {
806
869
  this.c = c;
807
870
  this.secrets = new GitSecretsAPI(c);
871
+ this.variables = new GitVariablesAPI(c, (repo) => `${repoPath(repo)}/actions`);
872
+ }
873
+ /** A run's jobs that deploy to an environment, and what each waits for. */
874
+ deployments(repo, number) {
875
+ return this.c.get(`${repoPath(repo)}/actions/runs/${number}/deployments`);
876
+ }
877
+ /** Approve or reject the run's waiting deployments (all you may review, or those named). */
878
+ reviewDeployments(repo, number, opts) {
879
+ return this.c.post(`${repoPath(repo)}/actions/runs/${number}/deployments`, opts);
808
880
  }
809
881
  runs(repo, opts = {}) {
810
882
  return this.c.get(qs(`${repoPath(repo)}/actions/runs`, { ...opts }));
@@ -846,7 +918,7 @@ var GitActionsAPI = class {
846
918
  const until = Date.now() + (opts.timeoutMs ?? 30 * 6e4);
847
919
  for (; ; ) {
848
920
  const run = await this.run(repo, number);
849
- if (!["queued", "running", "waiting", "pending"].includes(run.status)) return run;
921
+ if (!["queued", "running", "waiting", "pending", "dispatched"].includes(run.status)) return run;
850
922
  if (Date.now() > until) throw new Error(`run ${number} is still ${run.status}`);
851
923
  await new Promise((r) => setTimeout(r, opts.intervalMs ?? 3e3));
852
924
  }
@@ -1052,6 +1124,7 @@ var GitAPI = class {
1052
1124
  this.issues = new GitIssuesOnlyAPI(c);
1053
1125
  this.pulls = new GitPullsAPI(c);
1054
1126
  this.actions = new GitActionsAPI(c);
1127
+ this.environments = new GitEnvironmentsAPI(c);
1055
1128
  this.collaborators = new GitCollaboratorsAPI(c);
1056
1129
  this.webhooks = new GitWebhooksAPI(c);
1057
1130
  this.branchRules = new GitBranchRulesAPI(c);
@@ -3248,6 +3321,7 @@ var LizardCLI = class {
3248
3321
  GitBranchRulesAPI,
3249
3322
  GitClient,
3250
3323
  GitCollaboratorsAPI,
3324
+ GitEnvironmentsAPI,
3251
3325
  GitHubAPI,
3252
3326
  GitIssuesOnlyAPI,
3253
3327
  GitLabelsAPI,
@@ -3258,6 +3332,7 @@ var LizardCLI = class {
3258
3332
  GitSecretsAPI,
3259
3333
  GitStatusesAPI,
3260
3334
  GitTokensAPI,
3335
+ GitVariablesAPI,
3261
3336
  GitWebhooksAPI,
3262
3337
  LimitExceededError,
3263
3338
  Lizard,
package/dist/index.mjs CHANGED
@@ -489,9 +489,14 @@ function qs(path, values) {
489
489
  for (const [k, v] of Object.entries(values)) if (v !== void 0 && v !== "") q.set(k, String(v));
490
490
  return q.size ? `${path}?${q}` : path;
491
491
  }
492
+ function segs(p) {
493
+ const parts = p.split("/");
494
+ if (parts.some((x) => x === "" || x === "." || x === "..")) throw new Error(`bad path: "${p}"`);
495
+ return parts.map(seg).join("/");
496
+ }
492
497
  function repoPath(repo) {
493
498
  const m = /^([^/\s]+)\/([^/\s]+?)(\.git)?$/.exec(repo);
494
- if (!m) throw new Error(`repository must be "owner/name", got "${repo}"`);
499
+ if (!m || [m[1], m[2]].some((x) => x === "." || x === "..")) throw new Error(`repository must be "owner/name", got "${repo}"`);
495
500
  return `/api/repos/${seg(m[1])}/${seg(m[2])}`;
496
501
  }
497
502
  var GitClient = class {
@@ -504,6 +509,8 @@ var GitClient = class {
504
509
  method,
505
510
  body,
506
511
  headers: { "X-API-Key": this.config.apiKey, ...headers },
512
+ redirect: "error",
513
+ // a redirect would carry the key to wherever it points
507
514
  signal: AbortSignal.timeout(this.config.requestTimeoutMs)
508
515
  });
509
516
  if (!res.ok) await handleApiError(res);
@@ -580,7 +587,7 @@ var GitReposAPI = class {
580
587
  return this.c.post(`${repoPath(repo)}/branches`, { name, from });
581
588
  }
582
589
  deleteBranch(repo, name) {
583
- return this.c.delete(`${repoPath(repo)}/branches/${name.split("/").map(seg).join("/")}`);
590
+ return this.c.delete(`${repoPath(repo)}/branches/${segs(name)}`);
584
591
  }
585
592
  tree(repo, opts = {}) {
586
593
  return this.c.get(qs(`${repoPath(repo)}/tree`, opts));
@@ -591,8 +598,9 @@ var GitReposAPI = class {
591
598
  }
592
599
  /** A file's bytes, whatever its size or type. */
593
600
  raw(repo, path, ref) {
601
+ repoPath(repo);
594
602
  const [owner, name] = repo.split("/");
595
- return this.c.bytes(`/raw/${seg(owner)}/${seg(name)}/${ref.split("/").map(seg).join("/")}/${path.split("/").map(seg).join("/")}`);
603
+ return this.c.bytes(`/raw/${seg(owner)}/${seg(name)}/${segs(ref)}/${segs(path)}`);
596
604
  }
597
605
  /** Every file path at a ref. */
598
606
  files(repo, ref) {
@@ -626,7 +634,11 @@ var GitReposAPI = class {
626
634
  archive(repo, ref, format = "tar.gz") {
627
635
  return this.c.bytes(`${repoPath(repo)}/archive/${seg(ref)}.${format}`);
628
636
  }
629
- /** The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works without a helper. */
637
+ /**
638
+ * The HTTPS clone URL. With `withKey`, it carries the API key, so plain `git clone` works
639
+ * without a helper; git then keeps it in .git/config. For anything shared or logged, use a
640
+ * limited Lizard Git token (`tokens.create`) as `apiKey` instead of the account's key.
641
+ */
630
642
  cloneUrl(repo, opts = {}) {
631
643
  repoPath(repo);
632
644
  const u = new URL(`${this.c.url}/${repo.replace(/\.git$/, "")}.git`);
@@ -731,10 +743,68 @@ var GitSecretsAPI = class {
731
743
  return this.c.delete(`${repoPath(repo)}/actions/secrets/${seg(name)}`);
732
744
  }
733
745
  };
746
+ var GitVariablesAPI = class {
747
+ constructor(c, base) {
748
+ this.c = c;
749
+ this.base = base;
750
+ }
751
+ list(repo) {
752
+ return this.c.get(`${this.base(repo)}/variables`);
753
+ }
754
+ set(repo, name, value) {
755
+ return this.c.put(`${this.base(repo)}/variables/${seg(name)}`, { value });
756
+ }
757
+ delete(repo, name) {
758
+ return this.c.delete(`${this.base(repo)}/variables/${seg(name)}`);
759
+ }
760
+ };
761
+ var GitEnvironmentsAPI = class {
762
+ constructor(c) {
763
+ this.c = c;
764
+ }
765
+ path(repo, env) {
766
+ return `${repoPath(repo)}/actions/environments/${seg(env)}`;
767
+ }
768
+ list(repo) {
769
+ return this.c.get(`${repoPath(repo)}/actions/environments`);
770
+ }
771
+ get(repo, env) {
772
+ return this.c.get(this.path(repo, env));
773
+ }
774
+ /** Create it, or change its rules (fields left out stay). */
775
+ set(repo, env, opts = {}) {
776
+ return this.c.put(this.path(repo, env), opts);
777
+ }
778
+ delete(repo, env) {
779
+ return this.c.delete(this.path(repo, env));
780
+ }
781
+ listSecrets(repo, env) {
782
+ return this.c.get(`${this.path(repo, env)}/secrets`);
783
+ }
784
+ /** Only this environment's jobs get it, after its rules pass; it wins over a repository secret of the same name. */
785
+ setSecret(repo, env, name, value) {
786
+ return this.c.put(`${this.path(repo, env)}/secrets/${seg(name)}`, { value });
787
+ }
788
+ deleteSecret(repo, env, name) {
789
+ return this.c.delete(`${this.path(repo, env)}/secrets/${seg(name)}`);
790
+ }
791
+ variables(env) {
792
+ return new GitVariablesAPI(this.c, (repo) => this.path(repo, env));
793
+ }
794
+ };
734
795
  var GitActionsAPI = class {
735
796
  constructor(c) {
736
797
  this.c = c;
737
798
  this.secrets = new GitSecretsAPI(c);
799
+ this.variables = new GitVariablesAPI(c, (repo) => `${repoPath(repo)}/actions`);
800
+ }
801
+ /** A run's jobs that deploy to an environment, and what each waits for. */
802
+ deployments(repo, number) {
803
+ return this.c.get(`${repoPath(repo)}/actions/runs/${number}/deployments`);
804
+ }
805
+ /** Approve or reject the run's waiting deployments (all you may review, or those named). */
806
+ reviewDeployments(repo, number, opts) {
807
+ return this.c.post(`${repoPath(repo)}/actions/runs/${number}/deployments`, opts);
738
808
  }
739
809
  runs(repo, opts = {}) {
740
810
  return this.c.get(qs(`${repoPath(repo)}/actions/runs`, { ...opts }));
@@ -776,7 +846,7 @@ var GitActionsAPI = class {
776
846
  const until = Date.now() + (opts.timeoutMs ?? 30 * 6e4);
777
847
  for (; ; ) {
778
848
  const run = await this.run(repo, number);
779
- if (!["queued", "running", "waiting", "pending"].includes(run.status)) return run;
849
+ if (!["queued", "running", "waiting", "pending", "dispatched"].includes(run.status)) return run;
780
850
  if (Date.now() > until) throw new Error(`run ${number} is still ${run.status}`);
781
851
  await new Promise((r) => setTimeout(r, opts.intervalMs ?? 3e3));
782
852
  }
@@ -982,6 +1052,7 @@ var GitAPI = class {
982
1052
  this.issues = new GitIssuesOnlyAPI(c);
983
1053
  this.pulls = new GitPullsAPI(c);
984
1054
  this.actions = new GitActionsAPI(c);
1055
+ this.environments = new GitEnvironmentsAPI(c);
985
1056
  this.collaborators = new GitCollaboratorsAPI(c);
986
1057
  this.webhooks = new GitWebhooksAPI(c);
987
1058
  this.branchRules = new GitBranchRulesAPI(c);
@@ -3177,6 +3248,7 @@ export {
3177
3248
  GitBranchRulesAPI,
3178
3249
  GitClient,
3179
3250
  GitCollaboratorsAPI,
3251
+ GitEnvironmentsAPI,
3180
3252
  GitHubAPI,
3181
3253
  GitIssuesOnlyAPI,
3182
3254
  GitLabelsAPI,
@@ -3187,6 +3259,7 @@ export {
3187
3259
  GitSecretsAPI,
3188
3260
  GitStatusesAPI,
3189
3261
  GitTokensAPI,
3262
+ GitVariablesAPI,
3190
3263
  GitWebhooksAPI,
3191
3264
  LimitExceededError,
3192
3265
  Lizard,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lizard-build/sdk",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "description": "TypeScript SDK for Lizard: Firecracker microVM sandboxes, code execution and cloud apps.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",