@amerged/ohmyhost-cli 0.1.58 → 0.1.60

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.
@@ -38206,7 +38206,7 @@ var FRAMEWORK_VERSION_POLICY = Object.freeze({
38206
38206
  floors: Object.freeze(["14.4.0"]),
38207
38207
  denied: Object.freeze([])
38208
38208
  }),
38209
- next: Object.freeze({ floors: Object.freeze(["16.4.1"]), denied: Object.freeze([]) }),
38209
+ next: Object.freeze({ floors: Object.freeze(["16.4.5"]), denied: Object.freeze([]) }),
38210
38210
  vite: Object.freeze({ floors: Object.freeze(["5.4.6"]), denied: Object.freeze([]) }),
38211
38211
  "@tanstack/react-start": Object.freeze({
38212
38212
  floors: Object.freeze(["1.168.60"]),
@@ -40144,6 +40144,12 @@ function isSaasCnameTarget(value) {
40144
40144
 
40145
40145
  // packages/contracts/dist/problem-policy.js
40146
40146
  var PROBLEM_POLICY = {
40147
+ preview_version_conflict: {
40148
+ status: 409,
40149
+ retryable: true,
40150
+ action: "Read the preview state, then repeat the original request with the same idempotency key.",
40151
+ title: "Preview changed"
40152
+ },
40147
40153
  source_generation_conflict: {
40148
40154
  status: 409,
40149
40155
  retryable: false,
@@ -43675,6 +43681,8 @@ var recognizedCommandLabel = (argv) => {
43675
43681
  return "project status";
43676
43682
  if (value === "project" && values[0] === "dev" && values[1] === "add")
43677
43683
  return "project dev add";
43684
+ if (value === "project" && values[0] === "preview" && ["get", "open", "stop", "rotate"].includes(values[1] ?? ""))
43685
+ return `project preview ${values[1]}`;
43678
43686
  if (value === "project" && values[0] === "handle" && values[1] === "check")
43679
43687
  return "project handle check";
43680
43688
  if (value === "project" && values[0] === "handle" && values[1] === "set")
@@ -44512,6 +44520,30 @@ var parseProductCliCommand = (argv) => {
44512
44520
  const options2 = parseOptions(values, ["--handle"]);
44513
44521
  return { kind: "project-handle-check", handle: options2["--handle"], credentialStore };
44514
44522
  }
44523
+ if (subcommand === "preview") {
44524
+ const action = values.shift();
44525
+ if (!action || !["get", "open", "stop", "rotate"].includes(action) || wait || follow || stdin || (action === "stop" || action === "rotate") !== yes)
44526
+ throw new InvalidCommandError();
44527
+ const changing = action === "stop" || action === "rotate";
44528
+ const options2 = parseOptions(values, changing ? ["--project", "--environment", "--idempotency-key"] : ["--project", "--environment"]);
44529
+ const environment = options2["--environment"];
44530
+ if (environment !== "dev" && environment !== "prod")
44531
+ throw new InvalidCommandError();
44532
+ if (changing)
44533
+ return {
44534
+ kind: action === "stop" ? "project-preview-stop" : "project-preview-rotate",
44535
+ projectId: options2["--project"],
44536
+ environment,
44537
+ idempotencyKey: options2["--idempotency-key"],
44538
+ credentialStore
44539
+ };
44540
+ return {
44541
+ kind: action === "get" ? "project-preview-get" : "project-preview-open",
44542
+ projectId: options2["--project"],
44543
+ environment,
44544
+ credentialStore
44545
+ };
44546
+ }
44515
44547
  if (subcommand === "dev-share") {
44516
44548
  const action = values.shift();
44517
44549
  if (action === "link") {
@@ -46389,7 +46421,7 @@ function exact4(v, keys) {
46389
46421
  // apps/product-cli/package.json
46390
46422
  var package_default = {
46391
46423
  name: "@ohmyhost/product-cli",
46392
- version: "0.1.58",
46424
+ version: "0.1.60",
46393
46425
  private: true,
46394
46426
  ohmyhost: {
46395
46427
  deployment: "production",
@@ -46741,6 +46773,10 @@ var HELP_USAGE = Object.freeze({
46741
46773
  "project notes set": "ohmyhost project notes set --project ULID --version NUMBER --markdown TEXT --idempotency-key KEY --json (no credentials or signed URLs)",
46742
46774
  "project status": "ohmyhost project status --project ULID --json",
46743
46775
  "project dev add": "ohmyhost project dev add --project ULID --idempotency-key KEY --json",
46776
+ "project preview get": "ohmyhost project preview get --project ULID --environment dev|prod --json",
46777
+ "project preview open": "ohmyhost project preview open --project ULID --environment dev|prod --json",
46778
+ "project preview stop": "ohmyhost project preview stop --project ULID --environment dev|prod --idempotency-key KEY --yes --json",
46779
+ "project preview rotate": "ohmyhost project preview rotate --project ULID --environment dev|prod --idempotency-key KEY --yes --json",
46744
46780
  "project dev-access create": "ohmyhost project dev-access create --project ULID --json",
46745
46781
  "project dev-share link": "ohmyhost project dev-share link --project ULID --json",
46746
46782
  "project dev-share rotate": "ohmyhost project dev-share rotate --project ULID --idempotency-key KEY --yes --json",
@@ -47243,6 +47279,21 @@ var ProductCli = class {
47243
47279
  return await this.getProjectStatus(command, signal);
47244
47280
  if (command.kind === "project-development-add")
47245
47281
  return await this.addProjectDevelopment(command, signal);
47282
+ if (command.kind === "project-preview-get" || command.kind === "project-preview-open" || command.kind === "project-preview-stop" || command.kind === "project-preview-rotate") {
47283
+ const api = await this.authenticatedApi(command.credentialStore, signal);
47284
+ if (!api.preview)
47285
+ throw new Error("Preview unavailable");
47286
+ const action = command.kind.slice("project-preview-".length);
47287
+ const preview = await api.preview(action, {
47288
+ projectId: command.projectId,
47289
+ environment: command.environment,
47290
+ ..."idempotencyKey" in command ? { idempotencyKey: command.idempotencyKey } : {}
47291
+ });
47292
+ return success(`project preview ${action}`, {
47293
+ status: "succeeded",
47294
+ preview
47295
+ });
47296
+ }
47246
47297
  if (command.kind === "project-dev-access-create")
47247
47298
  return await this.createDevAccessTicket(command, signal);
47248
47299
  if (command.kind === "project-flag-status" || command.kind === "project-flag-set") {
@@ -47418,7 +47469,9 @@ var ProductCli = class {
47418
47469
  throw new Error("Mail unavailable");
47419
47470
  return success(command.label, { mail: await api.managedMail(command.request) });
47420
47471
  }
47421
- return await this.deleteEnvironmentSecret(command, signal);
47472
+ if (command.kind === "secret-delete")
47473
+ return await this.deleteEnvironmentSecret(command, signal);
47474
+ throw new Error("Unsupported command");
47422
47475
  } catch (error) {
47423
47476
  if (error instanceof UserTokenFileError || error instanceof PrivateSecretFileError)
47424
47477
  return failure(name, 3, error.code, false, error.message);
@@ -49018,6 +49071,14 @@ var parsedCommandName = (command) => {
49018
49071
  return "project status";
49019
49072
  if (command.kind === "project-development-add")
49020
49073
  return "project dev add";
49074
+ if (command.kind === "project-preview-get")
49075
+ return "project preview get";
49076
+ if (command.kind === "project-preview-open")
49077
+ return "project preview open";
49078
+ if (command.kind === "project-preview-stop")
49079
+ return "project preview stop";
49080
+ if (command.kind === "project-preview-rotate")
49081
+ return "project preview rotate";
49021
49082
  if (command.kind === "project-dev-access-create")
49022
49083
  return "project dev-access create";
49023
49084
  if (command.kind === "project-dev-share-link")
@@ -50071,6 +50132,80 @@ var createClient = (config = {}) => {
50071
50132
  var client = createClient(createConfig({ throwOnError: true }));
50072
50133
 
50073
50134
  // packages/sdk-ts/dist/generated/sdk.gen.js
50135
+ var stopProjectPreview = (parameters, options) => {
50136
+ const params = buildClientParams([parameters], [
50137
+ {
50138
+ args: [
50139
+ { in: "headers", key: "X-Request-Id" },
50140
+ { in: "headers", key: "Idempotency-Key" },
50141
+ { in: "path", key: "project_id" },
50142
+ { in: "query", key: "environment" }
50143
+ ]
50144
+ }
50145
+ ]);
50146
+ return (options?.client ?? client).delete({
50147
+ responseStyle: "data",
50148
+ security: [{ scheme: "bearer", type: "http" }],
50149
+ url: "/v1/projects/{project_id}/preview",
50150
+ ...options,
50151
+ ...params
50152
+ });
50153
+ };
50154
+ var getProjectPreview = (parameters, options) => {
50155
+ const params = buildClientParams([parameters], [
50156
+ {
50157
+ args: [
50158
+ { in: "headers", key: "X-Request-Id" },
50159
+ { in: "path", key: "project_id" },
50160
+ { in: "query", key: "environment" }
50161
+ ]
50162
+ }
50163
+ ]);
50164
+ return (options?.client ?? client).get({
50165
+ responseStyle: "data",
50166
+ security: [{ scheme: "bearer", type: "http" }],
50167
+ url: "/v1/projects/{project_id}/preview",
50168
+ ...options,
50169
+ ...params
50170
+ });
50171
+ };
50172
+ var openProjectPreview = (parameters, options) => {
50173
+ const params = buildClientParams([parameters], [
50174
+ {
50175
+ args: [
50176
+ { in: "headers", key: "X-Request-Id" },
50177
+ { in: "path", key: "project_id" },
50178
+ { in: "query", key: "environment" }
50179
+ ]
50180
+ }
50181
+ ]);
50182
+ return (options?.client ?? client).post({
50183
+ responseStyle: "data",
50184
+ security: [{ scheme: "bearer", type: "http" }],
50185
+ url: "/v1/projects/{project_id}/preview",
50186
+ ...options,
50187
+ ...params
50188
+ });
50189
+ };
50190
+ var rotateProjectPreviewToken = (parameters, options) => {
50191
+ const params = buildClientParams([parameters], [
50192
+ {
50193
+ args: [
50194
+ { in: "headers", key: "X-Request-Id" },
50195
+ { in: "headers", key: "Idempotency-Key" },
50196
+ { in: "path", key: "project_id" },
50197
+ { in: "query", key: "environment" }
50198
+ ]
50199
+ }
50200
+ ]);
50201
+ return (options?.client ?? client).post({
50202
+ responseStyle: "data",
50203
+ security: [{ scheme: "bearer", type: "http" }],
50204
+ url: "/v1/projects/{project_id}/preview/token",
50205
+ ...options,
50206
+ ...params
50207
+ });
50208
+ };
50074
50209
  var getNativeAuthConfiguration = (parameters, options) => {
50075
50210
  const params = buildClientParams([parameters], [
50076
50211
  {
@@ -53924,739 +54059,479 @@ function checkedResponse(kind, value) {
53924
54059
 
53925
54060
  // apps/product-cli/dist/product-api.js
53926
54061
  import { randomUUID as randomUUID3 } from "node:crypto";
53927
- var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
53928
- var WATCH_SCOPE_MISMATCH = "Watch response scope mismatch";
53929
- var TABLE_SCOPE_MISMATCH = "Table response scope mismatch";
53930
- var SCHEDULE_SCOPE_MISMATCH = "Schedule response scope mismatch";
53931
- function assertDatabaseTableAnswer(value) {
53932
- const table = isRecordValue(value) ? value["table"] : void 0;
53933
- const columns = isRecordValue(table) ? table["columns"] : void 0;
53934
- const primaryKey = isRecordValue(table) ? table["primary_key"] : void 0;
53935
- if (!isRecordValue(table) || !hasExactKeys(table, ["environment", "schema", "table", "columns", "primary_key", "created"]) || table["environment"] !== "dev" && table["environment"] !== "prod" || table["schema"] !== "public" || !isDatabaseTableIdentifier(table["table"]) || typeof table["created"] !== "boolean" || !Array.isArray(columns) || columns.length < 1 || !columns.every(isDatabaseTableAnswerColumn) || !Array.isArray(primaryKey) || !primaryKey.every((name) => columns.some((column) => column["name"] === name)))
53936
- throw new TypeError("Invalid database table answer");
53937
- }
53938
- function isDatabaseTableAnswerColumn(value) {
53939
- return isRecordValue(value) && hasExactKeys(value, ["name", "type", "nullable", "identity", "default"]) && isDatabaseTableIdentifier(value["name"]) && DATABASE_TABLE_COLUMN_TYPES.includes(value["type"]) && typeof value["nullable"] === "boolean" && typeof value["identity"] === "boolean" && (value["default"] === null || DATABASE_TABLE_DEFAULTS.includes(value["default"]));
53940
- }
53941
- function isRecordValue(value) {
53942
- return typeof value === "object" && value !== null && !Array.isArray(value);
53943
- }
53944
- function hasExactKeys(value, keys) {
53945
- return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
53946
- }
53947
- var GeneratedSdkProductApi = class {
53948
- #client;
53949
- managedSource;
53950
- constructor(baseUrl, accessToken, fetch2) {
53951
- this.#client = createClient({ auth: accessToken, baseUrl, fetch: fetch2, throwOnError: true });
53952
- this.managedSource = new GeneratedSdkManagedSourceApi(() => this.#client);
53953
- }
53954
- async changeDatabaseCompute(input) {
53955
- return changeDatabaseCompute({
53956
- project_id: input.projectId,
53957
- body: {
53958
- environment: input.environment,
53959
- ...input.memoryMiB === void 0 ? { profile: input.profile } : { memory_mib: input.memoryMiB },
53960
- confirm: true
53961
- },
53962
- "Idempotency-Key": input.idempotencyKey
53963
- }, { client: this.#client });
53964
- }
53965
- async getDatabaseCompute(input) {
53966
- const value = await getDatabaseCompute({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
53967
- assertDatabaseCompute(value);
53968
- if (value.project_id !== input.projectId || value.environment !== input.environment)
53969
- throw new TypeError("Compute response scope mismatch");
53970
- return value;
53971
- }
53972
- async getProjectContext(projectId) {
53973
- const result = await getProjectContext({ project_id: projectId }, { client: this.#client });
53974
- assertProjectContext(result);
53975
- if (result.project_id !== projectId)
53976
- throw new TypeError("Project context scope mismatch");
53977
- return result;
53978
- }
53979
- async setProjectNotes(input) {
53980
- const result = await setProjectNotes({
53981
- project_id: input.projectId,
53982
- markdown: input.markdown,
53983
- expected_version: input.expectedVersion,
53984
- "Idempotency-Key": input.idempotencyKey
53985
- }, { client: this.#client });
53986
- assertProjectNotesReceipt(result);
53987
- return result;
53988
- }
53989
- createProjectExport(input) {
53990
- return createProjectExport({
53991
- project_id: input.projectId,
53992
- password: input.password,
53993
- "Idempotency-Key": input.idempotencyKey
53994
- }, { client: this.#client });
53995
- }
53996
- async getProjectExport(input) {
53997
- const result = await getProjectExport({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
53998
- assertProjectExport(result);
53999
- return result;
54000
- }
54001
- async createProjectExportDownloadLink(input) {
54002
- const result = await createProjectExportDownloadLink({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
54003
- assertProjectExportDownloadLink(result);
54004
- return result;
54005
- }
54006
- async getCurrentIdentity() {
54007
- return getCurrentIdentity({}, { client: this.#client });
54008
- }
54009
- async getAccountProfile() {
54010
- return parseAccountProfile(await getAccountProfile({ client: this.#client }));
54011
- }
54012
- getOrganizationReferral(organizationId) {
54013
- return getOrganizationReferral({ organization_id: organizationId }, { client: this.#client });
54014
- }
54015
- getOrganizationAccount(organizationId) {
54016
- return getOrganizationAccount({ organization_id: organizationId }, { client: this.#client });
54017
- }
54018
- getOrganizationCredits(organizationId) {
54019
- return getOrganizationCredits({ organization_id: organizationId }, { client: this.#client });
54020
- }
54021
- async createUserApiKey(input) {
54022
- return parseUserApiKeyCreation(await createUserApiKey({
54023
- organization_id: input.organizationId,
54024
- name: input.name,
54025
- "Idempotency-Key": input.idempotencyKey
54026
- }, { client: this.#client }));
54027
- }
54028
- async listUserApiKeys(input) {
54029
- return parseUserApiKeyPage(await listUserApiKeys({ organization_id: input.organizationId, ...input.after ? { after: input.after } : {} }, { client: this.#client }));
54030
- }
54031
- async revokeUserApiKey(input) {
54032
- await revokeUserApiKey({ organization_id: input.organizationId, key_id: input.keyId }, { client: this.#client });
54033
- }
54034
- createBillingCheckout(input) {
54035
- return createBillingCheckout({
54036
- organization_id: input.organizationId,
54037
- offer: input.offer,
54038
- packs: input.packs,
54039
- "Idempotency-Key": input.idempotencyKey
54040
- }, { client: this.#client });
54041
- }
54042
- getBillingCheckout(input) {
54043
- return getBillingCheckout({ organization_id: input.organizationId, checkout_id: input.checkoutId }, { client: this.#client });
54044
- }
54045
- getBillingRecharge(organizationId) {
54046
- return getBillingRecharge({ organization_id: organizationId }, { client: this.#client });
54047
- }
54048
- configureBillingRecharge(input) {
54049
- return configureBillingRecharge({
54050
- organization_id: input.organizationId,
54051
- "Idempotency-Key": input.idempotencyKey,
54052
- enabled: input.enabled,
54053
- monthly_limit_minor: input.monthlyLimitMinor,
54054
- consent: input.consent,
54055
- revision: input.revision
54056
- }, { client: this.#client });
54057
- }
54058
- createBillingPortal(organizationId) {
54059
- return createBillingPortal({ organization_id: organizationId, body: {} }, { client: this.#client });
54060
- }
54061
- getOrganizationCreditUsage(organizationId) {
54062
- return getOrganizationCreditUsage({ organization_id: organizationId }, { client: this.#client });
54063
- }
54064
- getProjectCreditBudget(projectId) {
54065
- return getProjectCreditBudget({ project_id: projectId }, { client: this.#client });
54066
- }
54067
- setProjectCreditBudget(input) {
54068
- return setProjectCreditBudget({
54069
- project_id: input.projectId,
54070
- "Idempotency-Key": input.idempotencyKey,
54071
- setProjectCreditBudgetRequest: { amount_micros: input.amountMicros, mode: input.mode }
54072
- }, { client: this.#client });
54073
- }
54074
- createOrganization(input) {
54075
- return createOrganization({
54076
- "Idempotency-Key": input.idempotencyKey,
54077
- createOrganizationRequest: {
54078
- name: input.name,
54079
- ...input.signupSource === void 0 ? {} : { signup_source: input.signupSource }
54080
- }
54081
- }, { client: this.#client });
54082
- }
54083
- async listProjects(input) {
54084
- return listProjects(input, { client: this.#client });
54085
- }
54086
- async changeProjectHandle(input) {
54087
- return changeProjectHandle({
54088
- project_id: input.projectId,
54089
- "Idempotency-Key": input.idempotencyKey,
54090
- "If-Match": input.ifMatch,
54091
- handle: input.handle
54092
- }, { client: this.#client });
54093
- }
54094
- async checkProjectHandle(input) {
54095
- return getProjectHandleAvailability({ handle: input.handle }, { client: this.#client });
54096
- }
54097
- async getProjectStatus(projectId) {
54098
- return getProjectStatus({ project_id: projectId }, { client: this.#client });
54099
- }
54100
- async writeProjectDatabase(input) {
54101
- return writeProjectDatabase({
54102
- project_id: input.projectId,
54103
- "Idempotency-Key": input.idempotencyKey,
54104
- projectDatabaseWriteRequest: {
54105
- environment: input.environment,
54106
- statement: input.statement,
54107
- parameters: [...input.parameters]
54108
- }
54109
- }, { client: this.#client });
54110
- }
54111
- async queryProjectDatabase(input) {
54112
- return queryProjectDatabase({
54113
- project_id: input.projectId,
54114
- projectDatabaseQueryRequest: {
54115
- environment: input.environment,
54116
- statement: input.statement,
54117
- parameters: [...input.parameters]
54118
- }
54119
- }, { client: this.#client });
54120
- }
54121
- /** The connection URI exists only in this response; nothing in the CLI persists it. */
54122
- async createProjectDatabaseAccess(input) {
54123
- const value = await createProjectDatabaseAccess({
54124
- project_id: input.projectId,
54125
- projectDatabaseAccessRequest: {
54126
- environment: input.environment,
54127
- mode: input.mode,
54128
- ttl_seconds: input.ttlSeconds,
54129
- label: input.label
54062
+
54063
+ // packages/contracts/dist/index.js
54064
+ var import__ = __toESM(require__(), 1);
54065
+ var import_yaml = __toESM(require_dist(), 1);
54066
+
54067
+ // packages/contracts/schemas/ohmyhost.schema.json
54068
+ var ohmyhost_schema_default = {
54069
+ $schema: "https://json-schema.org/draft/2020-12/schema",
54070
+ $id: "https://schemas.ohmyho.st/ohmyhost/v1/schema.json",
54071
+ title: "ohmyhost.yaml",
54072
+ description: "Version 1 project build and runtime configuration.",
54073
+ type: "object",
54074
+ additionalProperties: false,
54075
+ required: ["version", "project", "build", "runtime"],
54076
+ properties: {
54077
+ version: {
54078
+ const: 1
54079
+ },
54080
+ project: {
54081
+ type: "string",
54082
+ minLength: 1,
54083
+ maxLength: 63,
54084
+ pattern: "^[a-z](?:[a-z0-9-]*[a-z0-9])?$"
54085
+ },
54086
+ applicationRoot: {
54087
+ $ref: "#/$defs/applicationRoot"
54088
+ },
54089
+ build: {
54090
+ $ref: "#/$defs/build"
54091
+ },
54092
+ runtime: {
54093
+ $ref: "#/$defs/runtime"
54094
+ },
54095
+ database: {
54096
+ $ref: "#/$defs/database"
54097
+ },
54098
+ auth: {
54099
+ $ref: "#/$defs/auth"
54100
+ },
54101
+ mail: {
54102
+ $ref: "#/$defs/mail"
54103
+ },
54104
+ storage: {
54105
+ $ref: "#/$defs/storage"
54106
+ },
54107
+ ai: {
54108
+ $ref: "#/$defs/ai"
54109
+ },
54110
+ functions: {
54111
+ $ref: "#/$defs/functions"
54112
+ },
54113
+ credits: {
54114
+ $ref: "#/$defs/credits"
54115
+ },
54116
+ browser: {
54117
+ $ref: "#/$defs/browserRendering"
54118
+ }
54119
+ },
54120
+ $defs: {
54121
+ applicationRoot: {
54122
+ type: "string",
54123
+ minLength: 1,
54124
+ maxLength: 64,
54125
+ pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]*(?:/[A-Za-z0-9][A-Za-z0-9._-]*)*)$",
54126
+ allOf: [
54127
+ {
54128
+ pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]{0,62}(?:/[A-Za-z0-9][A-Za-z0-9._-]{0,62}){0,7})$"
54129
+ }
54130
+ ]
54131
+ },
54132
+ nonEmptyCommand: {
54133
+ type: "string",
54134
+ minLength: 1,
54135
+ maxLength: 4096
54136
+ },
54137
+ relativePath: {
54138
+ type: "string",
54139
+ minLength: 1,
54140
+ maxLength: 512,
54141
+ pattern: "^(?!/)(?!.*[\\\\:])(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
54142
+ },
54143
+ build: {
54144
+ type: "object",
54145
+ additionalProperties: false,
54146
+ required: ["install"],
54147
+ properties: {
54148
+ install: {
54149
+ $ref: "#/$defs/nonEmptyCommand"
54150
+ },
54151
+ command: {
54152
+ $ref: "#/$defs/nonEmptyCommand"
54153
+ },
54154
+ output: {
54155
+ $ref: "#/$defs/relativePath"
54156
+ },
54157
+ ssg_cache_max_mib: {
54158
+ type: "integer",
54159
+ minimum: 1,
54160
+ maximum: 64,
54161
+ description: "Maximum private immutable Next.js prerender cache in MiB; defaults to 32. Cache storage costs zero credits. Public assets retain their independent limit."
54162
+ },
54163
+ next_revalidate_path: {
54164
+ type: "boolean",
54165
+ description: "Opt into deployment-scoped on-demand Next.js path revalidation."
54166
+ }
54130
54167
  }
54131
- }, { client: this.#client });
54132
- assertProjectDatabaseAccessCredential(value);
54133
- return value;
54134
- }
54135
- async listProjectDatabaseAccess(input) {
54136
- const value = await listProjectDatabaseAccess({
54137
- project_id: input.projectId,
54138
- ...input.environment === void 0 ? {} : { environment: input.environment }
54139
- }, { client: this.#client });
54140
- assertProjectDatabaseAccessPage(value);
54141
- return value;
54142
- }
54143
- async revokeProjectDatabaseAccess(input) {
54144
- const value = await revokeProjectDatabaseAccess({ project_id: input.projectId, access_id: input.accessId }, { client: this.#client });
54145
- assertProjectDatabaseAccess(value);
54146
- return value;
54147
- }
54148
- async createProjectDatabaseWatch(input) {
54149
- const value = await createProjectDatabaseWatch({
54150
- project_id: input.projectId,
54151
- "Idempotency-Key": input.idempotencyKey,
54152
- databaseWatchCreateRequest: {
54153
- environment: input.environment,
54154
- schema: input.request.schema,
54155
- table: input.request.table,
54156
- columns: [...input.request.columns],
54157
- operations: [...input.request.operations]
54168
+ },
54169
+ runtime: {
54170
+ type: "object",
54171
+ additionalProperties: false,
54172
+ required: ["mode"],
54173
+ properties: {
54174
+ mode: {
54175
+ type: "string",
54176
+ enum: ["static", "edge", "functions", "auto"]
54177
+ },
54178
+ healthcheck: {
54179
+ type: "string",
54180
+ minLength: 1,
54181
+ maxLength: 256,
54182
+ pattern: "^/"
54183
+ },
54184
+ browser: {
54185
+ $ref: "#/$defs/browser"
54186
+ },
54187
+ egress: {
54188
+ type: "object",
54189
+ additionalProperties: false,
54190
+ required: ["allow"],
54191
+ properties: {
54192
+ allow: {
54193
+ type: "array",
54194
+ maxItems: 13,
54195
+ uniqueItems: true,
54196
+ items: {
54197
+ type: "string",
54198
+ minLength: 1,
54199
+ maxLength: 256,
54200
+ pattern: "^https://"
54201
+ }
54202
+ }
54203
+ }
54204
+ }
54158
54205
  }
54159
- }, { client: this.#client });
54160
- assertDatabaseWatch(value);
54161
- if (value.environment !== input.environment || value.schema !== input.request.schema || value.table !== input.request.table)
54162
- throw new TypeError(WATCH_SCOPE_MISMATCH);
54163
- return value;
54164
- }
54165
- async listProjectDatabaseWatches(input) {
54166
- const value = await listProjectDatabaseWatches({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
54167
- assertDatabaseWatchPage(value);
54168
- if (value.items.some((item) => item.environment !== input.environment))
54169
- throw new TypeError(WATCH_SCOPE_MISMATCH);
54170
- return value;
54171
- }
54172
- async deleteProjectDatabaseWatch(input) {
54173
- const value = await deleteProjectDatabaseWatch({
54174
- project_id: input.projectId,
54175
- environment: input.environment,
54176
- "Idempotency-Key": input.idempotencyKey,
54177
- watch_id: input.watchId
54178
- }, { client: this.#client });
54179
- assertDatabaseWatchDeleted(value);
54180
- if (value.id !== input.watchId)
54181
- throw new TypeError(WATCH_SCOPE_MISMATCH);
54182
- return value;
54183
- }
54184
- async createProjectDatabaseTable(input) {
54185
- const value = await createProjectDatabaseTable({
54186
- project_id: input.projectId,
54187
- "Idempotency-Key": input.idempotencyKey,
54188
- databaseTableCreateRequest: {
54189
- environment: input.environment,
54190
- table: input.request.table,
54191
- columns: [...input.request.columns],
54192
- ...input.request.primaryKey.length === 0 ? {} : { primary_key: [...input.request.primaryKey] }
54206
+ },
54207
+ browserOrigins: {
54208
+ type: "array",
54209
+ maxItems: 16,
54210
+ uniqueItems: true,
54211
+ items: {
54212
+ type: "string",
54213
+ minLength: 1,
54214
+ maxLength: 256,
54215
+ pattern: "^https://"
54193
54216
  }
54194
- }, { client: this.#client });
54195
- assertDatabaseTableAnswer(value);
54196
- if (value.table.environment !== input.environment || value.table.table !== input.request.table)
54197
- throw new TypeError(TABLE_SCOPE_MISMATCH);
54198
- return value;
54199
- }
54200
- /** The signing secret exists only in this answer; the CLI prints it once and stores nothing. */
54201
- async createProjectDatabaseWebhook(input) {
54202
- const value = await createProjectDatabaseWebhook({
54203
- project_id: input.projectId,
54204
- environment: input.environment,
54205
- "Idempotency-Key": input.idempotencyKey,
54206
- databaseWebhookCreateRequest: {
54207
- url: input.url,
54208
- event_types: [...input.eventTypes],
54209
- headers: { ...input.headers }
54217
+ },
54218
+ browser: {
54219
+ type: "object",
54220
+ additionalProperties: false,
54221
+ properties: {
54222
+ connect: {
54223
+ type: "array",
54224
+ maxItems: 16,
54225
+ uniqueItems: true,
54226
+ items: {
54227
+ type: "string",
54228
+ minLength: 1,
54229
+ maxLength: 256,
54230
+ pattern: "^(?:https|wss)://"
54231
+ }
54232
+ },
54233
+ scripts: {
54234
+ $ref: "#/$defs/browserOrigins"
54235
+ },
54236
+ styles: {
54237
+ $ref: "#/$defs/browserOrigins"
54238
+ },
54239
+ images: {
54240
+ $ref: "#/$defs/browserOrigins"
54241
+ },
54242
+ fonts: {
54243
+ $ref: "#/$defs/browserOrigins"
54244
+ },
54245
+ frames: {
54246
+ $ref: "#/$defs/browserOrigins"
54247
+ },
54248
+ frameAncestors: {
54249
+ $ref: "#/$defs/browserOrigins"
54250
+ },
54251
+ workers: {
54252
+ type: "object",
54253
+ additionalProperties: false,
54254
+ properties: {
54255
+ self: {
54256
+ type: "boolean"
54257
+ },
54258
+ blob: {
54259
+ type: "boolean"
54260
+ }
54261
+ }
54262
+ },
54263
+ cors: {
54264
+ type: "object",
54265
+ additionalProperties: false,
54266
+ properties: {
54267
+ origins: {
54268
+ $ref: "#/$defs/browserOrigins"
54269
+ },
54270
+ credentials: {
54271
+ type: "boolean"
54272
+ }
54273
+ }
54274
+ }
54210
54275
  }
54211
- }, { client: this.#client });
54212
- assertDatabaseWebhookCreated(value);
54213
- if (value.environment !== input.environment)
54214
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54215
- return value;
54216
- }
54217
- async getDatabaseWebhookSubscription(input) {
54218
- const value = await getDatabaseWebhookSubscription({
54219
- project_id: input.projectId,
54220
- environment: input.environment,
54221
- subscription_id: input.subscriptionId
54222
- }, { client: this.#client });
54223
- assertDatabaseWebhookSubscription(value);
54224
- if (value.id !== input.subscriptionId || value.environment !== input.environment)
54225
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54226
- return value;
54227
- }
54228
- async activateDatabaseWebhookSubscription(input) {
54229
- const value = await activateDatabaseWebhookSubscription({
54230
- project_id: input.projectId,
54231
- environment: input.environment,
54232
- subscription_id: input.subscriptionId,
54233
- generation: input.generation,
54234
- "Idempotency-Key": input.idempotencyKey,
54235
- databaseWebhookCreateRequest: {
54236
- ...input.request,
54237
- event_types: [...input.request.event_types],
54238
- headers: { ...input.request.headers }
54276
+ },
54277
+ database: {
54278
+ type: "object",
54279
+ additionalProperties: false,
54280
+ required: ["enabled"],
54281
+ properties: {
54282
+ enabled: {
54283
+ type: "boolean"
54284
+ },
54285
+ migrations: {
54286
+ $ref: "#/$defs/relativePath"
54287
+ }
54288
+ },
54289
+ if: {
54290
+ properties: {
54291
+ enabled: {
54292
+ const: true
54293
+ }
54294
+ },
54295
+ required: ["enabled"]
54296
+ },
54297
+ then: {
54298
+ properties: {
54299
+ migrations: {
54300
+ $ref: "#/$defs/relativePath"
54301
+ }
54302
+ },
54303
+ required: ["migrations"]
54239
54304
  }
54240
- }, { client: this.#client });
54241
- assertDatabaseWebhookSubscriptionActivation(value);
54242
- if (value.id !== input.subscriptionId || value.environment !== input.environment || value.generation !== input.generation)
54243
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54244
- return value;
54245
- }
54246
- async deactivateDatabaseWebhookSubscription(input) {
54247
- const value = await deactivateDatabaseWebhookSubscription({
54248
- project_id: input.projectId,
54249
- environment: input.environment,
54250
- subscription_id: input.subscriptionId,
54251
- generation: input.generation,
54252
- "Idempotency-Key": input.idempotencyKey
54253
- }, { client: this.#client });
54254
- assertDatabaseWebhookSubscription(value);
54255
- if (value.id !== input.subscriptionId || value.environment !== input.environment || value.generation !== input.generation || value.state !== "inactive")
54256
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54257
- return value;
54258
- }
54259
- async listProjectDatabaseWebhooks(input) {
54260
- const value = await listProjectDatabaseWebhooks({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
54261
- assertDatabaseWebhookPage(value);
54262
- if (value.items.some((item) => item.environment !== input.environment))
54263
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54264
- return value;
54265
- }
54266
- async getProjectDatabaseWebhook(input) {
54267
- const value = await getProjectDatabaseWebhook({
54268
- project_id: input.projectId,
54269
- environment: input.environment,
54270
- webhook_id: input.webhookId
54271
- }, { client: this.#client });
54272
- assertDatabaseWebhook(value);
54273
- if (value.id !== input.webhookId || value.environment !== input.environment)
54274
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54275
- return value;
54276
- }
54277
- async deleteProjectDatabaseWebhook(input) {
54278
- const value = await deleteProjectDatabaseWebhook({
54279
- "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
54280
- project_id: input.projectId,
54281
- environment: input.environment,
54282
- webhook_id: input.webhookId
54283
- }, { client: this.#client });
54284
- assertDatabaseWebhookDeleted(value);
54285
- if (value.id !== input.webhookId)
54286
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54287
- return value;
54288
- }
54289
- async testProjectDatabaseWebhook(input) {
54290
- const value = await testProjectDatabaseWebhook({
54291
- "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
54292
- project_id: input.projectId,
54293
- environment: input.environment,
54294
- webhook_id: input.webhookId
54295
- }, { client: this.#client });
54296
- assertDatabaseWebhookTest(value);
54297
- return value;
54298
- }
54299
- async listProjectDatabaseWebhookDeliveries(input) {
54300
- const value = await listProjectDatabaseWebhookDeliveries({
54301
- project_id: input.projectId,
54302
- environment: input.environment,
54303
- ...input.webhookId === void 0 ? {} : { webhook_id: input.webhookId },
54304
- ...input.limit === void 0 ? {} : { limit: input.limit },
54305
- ...input.cursor === void 0 ? {} : { cursor: input.cursor }
54306
- }, { client: this.#client });
54307
- assertDatabaseWebhookDeliveryPage(value);
54308
- if (input.webhookId !== void 0 && value.items.some((item) => item.webhook_id !== input.webhookId))
54309
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54310
- return value;
54311
- }
54312
- async replayProjectDatabaseWebhookDelivery(input) {
54313
- const value = await replayProjectDatabaseWebhookDelivery({
54314
- "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
54315
- project_id: input.projectId,
54316
- environment: input.environment,
54317
- delivery_id: input.deliveryId
54318
- }, { client: this.#client });
54319
- assertDatabaseWebhookReplayAccepted(value);
54320
- if (value.delivery_id !== input.deliveryId)
54321
- throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
54322
- return value;
54323
- }
54324
- /** A schedule runs the statements as the application's runtime role; the request confirms it. */
54325
- async setProjectDatabaseSchedule(input) {
54326
- const request = input.request;
54327
- const value = await setProjectDatabaseSchedule({
54328
- project_id: input.projectId,
54329
- environment: input.environment,
54330
- name: input.name,
54331
- databaseScheduleSetRequest: {
54332
- ...request.cron === null ? {} : { cron: request.cron },
54333
- ...request.every_seconds === null ? {} : { every_seconds: request.every_seconds },
54334
- statements: [...request.statements],
54335
- timeout_ms: request.timeout_ms,
54336
- enabled: request.enabled,
54337
- confirm: true
54305
+ },
54306
+ mail: {
54307
+ type: "object",
54308
+ additionalProperties: false,
54309
+ required: ["enabled"],
54310
+ properties: {
54311
+ enabled: {
54312
+ type: "boolean"
54313
+ }
54338
54314
  }
54339
- }, { client: this.#client });
54340
- assertDatabaseSchedule(value);
54341
- if (value.name !== input.name || value.environment !== input.environment)
54342
- throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
54343
- return value;
54344
- }
54345
- async listProjectDatabaseSchedules(input) {
54346
- const value = await listProjectDatabaseSchedules({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
54347
- assertDatabaseSchedulePage(value);
54348
- if (value.items.some((item) => item.environment !== input.environment))
54349
- throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
54350
- return value;
54351
- }
54352
- async getProjectDatabaseSchedule(input) {
54353
- const value = await getProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
54354
- assertDatabaseSchedule(value);
54355
- if (value.name !== input.name || value.environment !== input.environment)
54356
- throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
54357
- return value;
54358
- }
54359
- async deleteProjectDatabaseSchedule(input) {
54360
- const value = await deleteProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
54361
- assertDatabaseScheduleDeleted(value);
54362
- if (value.name !== input.name)
54363
- throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
54364
- return value;
54365
- }
54366
- async listProjectDatabaseScheduleRuns(input) {
54367
- const value = await listProjectDatabaseScheduleRuns({
54368
- project_id: input.projectId,
54369
- environment: input.environment,
54370
- name: input.name,
54371
- ...input.limit === void 0 ? {} : { limit: input.limit }
54372
- }, { client: this.#client });
54373
- assertDatabaseScheduleRunPage(value);
54374
- if (value.items.some((item) => item.schedule !== input.name))
54375
- throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
54376
- return value;
54377
- }
54378
- async runProjectDatabaseSchedule(input) {
54379
- const value = await runProjectDatabaseSchedule({
54380
- "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
54381
- project_id: input.projectId,
54382
- environment: input.environment,
54383
- name: input.name
54384
- }, { client: this.#client });
54385
- assertDatabaseScheduleRunAccepted(value);
54386
- if (value.schedule !== input.name)
54387
- throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
54388
- return value;
54389
- }
54390
- async getProjectDatabaseExecutionUsage(input) {
54391
- const value = await getProjectDatabaseExecutionUsage({
54392
- project_id: input.projectId,
54393
- environment: input.environment,
54394
- from: input.from,
54395
- to: input.to,
54396
- granularity: input.granularity,
54397
- ...input.limit === void 0 ? {} : { limit: input.limit },
54398
- ...input.cursor === void 0 ? {} : { cursor: input.cursor }
54399
- }, { client: this.#client });
54400
- assertDatabaseExecutionUsagePage(value);
54401
- return value;
54402
- }
54403
- async planPaidDomain(input) {
54404
- return planPaidProjectDomain({ project_id: input.projectId, paidDomainRequest: { hostname: input.hostname } }, { client: this.#client });
54405
- }
54406
- async applyPaidDomain(input) {
54407
- return applyPaidProjectDomain({
54408
- "Idempotency-Key": input.idempotencyKey,
54409
- project_id: input.projectId,
54410
- paidDomainRequest: { hostname: input.hostname }
54411
- }, { client: this.#client });
54412
- }
54413
- async getPaidDomain(projectId) {
54414
- return getPaidProjectDomain({ project_id: projectId }, { client: this.#client });
54415
- }
54416
- async deletePaidDomain(input) {
54417
- return deletePaidProjectDomain({
54418
- "Idempotency-Key": input.idempotencyKey,
54419
- project_id: input.projectId,
54420
- paidDomainRequest: { hostname: input.hostname }
54421
- }, { client: this.#client });
54422
- }
54423
- async ensureDevShareLink(projectId) {
54424
- return ensureProjectDevShareLink({ project_id: projectId }, { client: this.#client });
54425
- }
54426
- async rotateDevShareLink(projectId, idempotencyKey) {
54427
- return rotateProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
54428
- }
54429
- async revokeDevShareLink(projectId, idempotencyKey) {
54430
- return revokeProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
54431
- }
54432
- async setDevAccessMode(projectId, mode, idempotencyKey) {
54433
- return setProjectDevAccessMode({
54434
- project_id: projectId,
54435
- "Idempotency-Key": idempotencyKey,
54436
- setDevAccessModeRequest: { mode }
54437
- }, { client: this.#client });
54438
- }
54439
- async getPoweredByFlag(projectId) {
54440
- return getProjectPoweredByFlag({ project_id: projectId }, { client: this.#client });
54441
- }
54442
- async setPoweredByFlag(projectId, enabled, idempotencyKey) {
54443
- return setProjectPoweredByFlag({
54444
- project_id: projectId,
54445
- "Idempotency-Key": idempotencyKey,
54446
- setPoweredByFlagRequest: { enabled }
54447
- }, { client: this.#client });
54448
- }
54449
- async createDevAccessTicket(projectId) {
54450
- return createProjectDevAccessTicket({ project_id: projectId }, { client: this.#client });
54451
- }
54452
- async submitFeedback(input) {
54453
- return parseFeedbackReceipt(await submitFeedback({ "Idempotency-Key": input.idempotencyKey, feedbackSubmission: input.report }, { client: this.#client }));
54454
- }
54455
- async getFeedback(feedbackId, cursor) {
54456
- return parseFeedbackStatus(await getFeedback({ feedback_id: feedbackId, ...cursor === void 0 ? {} : { cursor } }, { client: this.#client }));
54457
- }
54458
- async planProjectDataChange(input) {
54459
- return parseProjectDataChangePlan2(await planProjectDataChange({ project_id: input.projectId, projectDataChangeRequest: { change: input.change } }, { client: this.#client }));
54460
- }
54461
- async createProjectDataChange(input) {
54462
- return parseOperation(await createProjectDataChange({
54463
- project_id: input.projectId,
54464
- projectDataChangeRequest: { change: input.change },
54465
- "If-Match": input.ifMatch,
54466
- "X-Confirmation-Token": input.confirmationToken,
54467
- "Idempotency-Key": input.idempotencyKey
54468
- }, { client: this.#client }));
54469
- }
54470
- async createProject(input) {
54471
- return createProject({
54472
- "Idempotency-Key": input.idempotencyKey,
54473
- createProjectRequest: {
54474
- organization_id: input.organizationId,
54475
- name: input.name,
54476
- ...input.dataMode === void 0 ? {} : { data_mode: input.dataMode },
54477
- ...input.devAccessMode === void 0 ? {} : { dev_access_mode: input.devAccessMode },
54478
- ...input.includeDevelopmentEnvironment === void 0 ? {} : { include_development_environment: input.includeDevelopmentEnvironment },
54479
- ...input.region === void 0 ? {} : { region: input.region }
54315
+ },
54316
+ storage: {
54317
+ type: "object",
54318
+ additionalProperties: false,
54319
+ required: ["provider", "jurisdiction", "public"],
54320
+ properties: {
54321
+ provider: {
54322
+ const: "r2"
54323
+ },
54324
+ jurisdiction: {
54325
+ type: "string",
54326
+ enum: ["us", "eu"]
54327
+ },
54328
+ public: {
54329
+ const: false
54330
+ }
54480
54331
  }
54481
- }, { client: this.#client });
54482
- }
54483
- async addProjectDevelopmentEnvironment(input) {
54484
- return addProjectDevelopmentEnvironment({ project_id: input.projectId, "Idempotency-Key": input.idempotencyKey, body: {} }, { client: this.#client });
54485
- }
54486
- async getOperation(operationId) {
54487
- return getOperation({ operation_id: operationId }, { client: this.#client });
54488
- }
54489
- async reconcileOperation(input) {
54490
- return reconcileOperation({
54491
- "Idempotency-Key": input.idempotencyKey,
54492
- operation_id: input.operationId
54493
- }, { client: this.#client });
54494
- }
54495
- async connectGithub(input) {
54496
- return connectGithubOrganization({
54497
- organization_id: input.organizationId,
54498
- "Idempotency-Key": input.idempotencyKey,
54499
- connectGithubOrganizationRequest: {}
54500
- }, { client: this.#client });
54501
- }
54502
- async getGithubConnection(organizationId) {
54503
- return getGithubOrganizationConnection({ organization_id: organizationId }, { client: this.#client });
54504
- }
54505
- async disconnectGithub(organizationId) {
54506
- return disconnectGithubOrganization({ organization_id: organizationId }, { client: this.#client });
54507
- }
54508
- async listOrganizationMcpConnections(organizationId) {
54509
- return listOrganizationMcpConnections({ organization_id: organizationId }, { client: this.#client });
54510
- }
54511
- async revokeOrganizationMcpConnection(input) {
54512
- return revokeOrganizationMcpConnection({ organization_id: input.organizationId, connection_id: input.connectionId }, { client: this.#client });
54513
- }
54514
- async linkSource(input) {
54515
- return linkProjectSource({
54516
- "Idempotency-Key": input.idempotencyKey,
54517
- project_id: input.projectId,
54518
- linkProjectSourceRequest: {
54519
- repository_owner: input.repositoryOwner,
54520
- repository_name: input.repositoryName
54332
+ },
54333
+ ai: {
54334
+ type: "object",
54335
+ additionalProperties: false,
54336
+ required: ["enabled"],
54337
+ properties: {
54338
+ enabled: {
54339
+ type: "boolean"
54340
+ },
54341
+ jurisdiction: {
54342
+ type: "string",
54343
+ enum: ["eu", "any"]
54344
+ }
54345
+ },
54346
+ if: {
54347
+ properties: {
54348
+ enabled: {
54349
+ const: true
54350
+ }
54351
+ },
54352
+ required: ["enabled"]
54353
+ },
54354
+ then: {
54355
+ properties: {
54356
+ jurisdiction: {
54357
+ type: "string",
54358
+ enum: ["eu", "any"]
54359
+ }
54360
+ },
54361
+ required: ["jurisdiction"]
54521
54362
  }
54522
- }, { client: this.#client });
54523
- }
54524
- async configureAutoDeploy(input) {
54525
- return configureProjectSourceAutoDeploy({
54526
- "Idempotency-Key": input.idempotencyKey,
54527
- project_id: input.projectId,
54528
- configureSourceAutoDeployRequest: { branch: input.branch, enabled: input.enabled }
54529
- }, { client: this.#client });
54530
- }
54531
- async getAutoDeploy(projectId) {
54532
- return getProjectSourceAutoDeploy({ project_id: projectId }, { client: this.#client });
54533
- }
54534
- async authorizeCloudflareDns(input) {
54535
- return createCloudflareDnsAuthorization({
54536
- "Idempotency-Key": input.idempotencyKey,
54537
- project_id: input.projectId,
54538
- createCloudflareDnsAuthorizationRequest: { zone: input.zone }
54539
- }, { client: this.#client });
54540
- }
54541
- async getCloudflareDnsStatus(projectId) {
54542
- return getCloudflareDnsAuthorizationStatus({ project_id: projectId }, { client: this.#client });
54543
- }
54544
- async applyProjectDomains(input) {
54545
- return configureProjectDomains({ "Idempotency-Key": input.idempotencyKey, project_id: input.projectId }, { client: this.#client });
54546
- }
54547
- async planDeployment(input) {
54548
- return planDeployment({
54549
- project_id: input.projectId,
54550
- planDeploymentRequest: {
54551
- commit_sha: input.commitSha,
54552
- ...input.environment === void 0 ? {} : { environment: input.environment }
54363
+ },
54364
+ auth: {
54365
+ type: "object",
54366
+ additionalProperties: false,
54367
+ required: ["provider"],
54368
+ properties: {
54369
+ provider: {
54370
+ type: "string",
54371
+ enum: ["none", "better-auth", "omh-native"]
54372
+ }
54553
54373
  }
54554
- }, { client: this.#client });
54555
- }
54556
- async createDeployment(input) {
54557
- return createDeployment({
54558
- "Idempotency-Key": input.idempotencyKey,
54559
- project_id: input.projectId,
54560
- createDeploymentRequest: { plan_id: input.planId }
54561
- }, { client: this.#client });
54562
- }
54563
- async getDeployment(input) {
54564
- return getDeployment({ project_id: input.projectId, deployment_id: input.deploymentId }, { client: this.#client });
54565
- }
54566
- async streamOperationEvents(operationId, signal, lastEventId) {
54567
- return (await streamOperationEvents({ operation_id: operationId }, {
54568
- client: this.#client,
54569
- signal,
54570
- // The generated client would otherwise retry a refused stream, such as a 404, forever.
54571
- sseMaxRetryAttempts: 1,
54572
- headers: {
54573
- Accept: "text/event-stream",
54574
- ...lastEventId === void 0 ? {} : { "Last-Event-ID": lastEventId }
54374
+ },
54375
+ functions: {
54376
+ type: "object",
54377
+ additionalProperties: false,
54378
+ required: ["crons"],
54379
+ properties: {
54380
+ crons: {
54381
+ type: "array",
54382
+ minItems: 1,
54383
+ maxItems: 8,
54384
+ uniqueItems: true,
54385
+ items: {
54386
+ type: "string",
54387
+ minLength: 9,
54388
+ maxLength: 64
54389
+ }
54390
+ }
54575
54391
  }
54576
- })).stream;
54577
- }
54578
- async getDeploymentLogs(input) {
54579
- return getDeploymentLogs({
54580
- project_id: input.projectId,
54581
- deployment_id: input.deploymentId,
54582
- limit: input.limit,
54583
- ...input.cursor === void 0 ? {} : { cursor: input.cursor }
54584
- }, { client: this.#client });
54585
- }
54586
- async planRollback(input) {
54587
- return planDeploymentRollback({ project_id: input.projectId, target_deployment_id: input.deploymentId }, { client: this.#client });
54588
- }
54589
- async rollback(input) {
54590
- return rollbackDeployment({
54591
- "Idempotency-Key": input.idempotencyKey,
54592
- "If-Match": input.ifMatch,
54593
- "X-Confirmation-Token": input.confirmationToken,
54594
- project_id: input.projectId,
54595
- target_deployment_id: input.deploymentId
54596
- }, { client: this.#client });
54597
- }
54598
- async planPromotion(input) {
54599
- return planDeploymentPromotion({ project_id: input.projectId, source_deployment_id: input.sourceDeploymentId }, { client: this.#client });
54600
- }
54601
- async promote(input) {
54602
- return promoteDeployment({
54603
- "Idempotency-Key": input.idempotencyKey,
54604
- "If-Match": input.ifMatch,
54605
- "X-Confirmation-Token": input.confirmationToken,
54606
- project_id: input.projectId,
54607
- source_deployment_id: input.sourceDeploymentId
54608
- }, { client: this.#client });
54609
- }
54610
- async planDelete(projectId) {
54611
- return planProjectDeletion({ project_id: projectId }, { client: this.#client });
54612
- }
54613
- async deleteProject(input) {
54614
- return deleteProject({
54615
- "Idempotency-Key": input.idempotencyKey,
54616
- "If-Match": input.ifMatch,
54617
- "X-Confirmation-Token": input.confirmationToken,
54618
- project_id: input.projectId
54619
- }, { client: this.#client });
54620
- }
54621
- async listEnvironmentSecrets(input) {
54622
- return listEnvironmentSecrets({ project_id: input.projectId, environment_id: input.environmentId }, { client: this.#client });
54623
- }
54624
- async listFunctionRuns(input) {
54625
- return listFunctionRuns({ project_id: input.projectId, environment_id: input.environmentId, limit: input.limit }, { client: this.#client });
54626
- }
54627
- async putEnvironmentSecret(input) {
54628
- return putEnvironmentSecret({
54629
- "Idempotency-Key": input.idempotencyKey,
54630
- project_id: input.projectId,
54631
- environment_id: input.environmentId,
54632
- secret_name: input.name,
54633
- putEnvironmentSecretRequest: { value: input.value }
54634
- }, { client: this.#client });
54635
- }
54636
- async deleteEnvironmentSecret(input) {
54637
- return deleteEnvironmentSecret({
54638
- "Idempotency-Key": input.idempotencyKey,
54639
- project_id: input.projectId,
54640
- environment_id: input.environmentId,
54641
- secret_name: input.name
54642
- }, { client: this.#client });
54643
- }
54644
- sharedMail(input) {
54645
- return executeSharedMail(this.#client, input);
54646
- }
54647
- managedMail(input) {
54648
- return executeManagedMail(this.#client, input);
54649
- }
54650
- nativeAuth(input) {
54651
- return executeNativeAuth(this.#client, input);
54652
- }
54392
+ },
54393
+ credits: {
54394
+ type: "object",
54395
+ additionalProperties: false,
54396
+ required: ["monthly_budget"],
54397
+ properties: {
54398
+ monthly_budget: {
54399
+ type: "integer",
54400
+ minimum: 0,
54401
+ maximum: 1e9
54402
+ },
54403
+ auto_recharge: {
54404
+ $ref: "#/$defs/autoRecharge"
54405
+ }
54406
+ }
54407
+ },
54408
+ autoRecharge: {
54409
+ type: "object",
54410
+ additionalProperties: false,
54411
+ required: ["enabled"],
54412
+ properties: {
54413
+ enabled: {
54414
+ type: "boolean"
54415
+ },
54416
+ threshold: {
54417
+ type: "integer",
54418
+ minimum: 0,
54419
+ maximum: 1e6
54420
+ },
54421
+ amount_usd_micros: {
54422
+ type: "integer",
54423
+ minimum: 1,
54424
+ maximum: 9007199254740991
54425
+ },
54426
+ monthly_cap_usd_micros: {
54427
+ type: "integer",
54428
+ minimum: 1,
54429
+ maximum: 9007199254740991
54430
+ }
54431
+ },
54432
+ if: {
54433
+ properties: {
54434
+ enabled: {
54435
+ const: true
54436
+ }
54437
+ },
54438
+ required: ["enabled"]
54439
+ },
54440
+ then: {
54441
+ properties: {
54442
+ threshold: {
54443
+ type: "integer",
54444
+ minimum: 0,
54445
+ maximum: 1e6
54446
+ },
54447
+ amount_usd_micros: {
54448
+ type: "integer",
54449
+ minimum: 1,
54450
+ maximum: 9007199254740991
54451
+ },
54452
+ monthly_cap_usd_micros: {
54453
+ type: "integer",
54454
+ minimum: 1,
54455
+ maximum: 9007199254740991
54456
+ }
54457
+ },
54458
+ required: ["threshold", "amount_usd_micros", "monthly_cap_usd_micros"]
54459
+ }
54460
+ },
54461
+ browserRendering: {
54462
+ type: "object",
54463
+ additionalProperties: false,
54464
+ required: ["enabled"],
54465
+ properties: {
54466
+ enabled: {
54467
+ type: "boolean"
54468
+ }
54469
+ }
54470
+ }
54471
+ },
54472
+ allOf: [
54473
+ {
54474
+ if: {
54475
+ type: "object",
54476
+ properties: {
54477
+ runtime: {
54478
+ type: "object",
54479
+ properties: {
54480
+ mode: {
54481
+ const: "functions"
54482
+ }
54483
+ },
54484
+ required: ["mode"]
54485
+ }
54486
+ },
54487
+ required: ["runtime"]
54488
+ },
54489
+ then: {
54490
+ type: "object",
54491
+ properties: {
54492
+ build: {
54493
+ type: "object",
54494
+ additionalProperties: false,
54495
+ required: ["install"],
54496
+ properties: {
54497
+ install: {
54498
+ $ref: "#/$defs/nonEmptyCommand"
54499
+ }
54500
+ }
54501
+ }
54502
+ }
54503
+ },
54504
+ else: {
54505
+ type: "object",
54506
+ properties: {
54507
+ build: {
54508
+ type: "object",
54509
+ additionalProperties: false,
54510
+ required: ["install", "command", "output"],
54511
+ properties: {
54512
+ install: {
54513
+ $ref: "#/$defs/nonEmptyCommand"
54514
+ },
54515
+ command: {
54516
+ $ref: "#/$defs/nonEmptyCommand"
54517
+ },
54518
+ output: {
54519
+ $ref: "#/$defs/relativePath"
54520
+ },
54521
+ ssg_cache_max_mib: {
54522
+ $ref: "#/$defs/build/properties/ssg_cache_max_mib"
54523
+ },
54524
+ next_revalidate_path: {
54525
+ $ref: "#/$defs/build/properties/next_revalidate_path"
54526
+ }
54527
+ }
54528
+ }
54529
+ }
54530
+ }
54531
+ }
54532
+ ]
54653
54533
  };
54654
54534
 
54655
- // apps/product-cli/dist/repository-init.js
54656
- import { createHash as createHash4 } from "node:crypto";
54657
- import { lstat as lstat3, open as open4, readFile as readFile3, readdir as readdir3, stat as stat2 } from "node:fs/promises";
54658
- import { dirname as dirname3, posix, resolve as resolve5 } from "node:path";
54659
-
54660
54535
  // packages/contracts/dist/application-root.js
54661
54536
  var APPLICATION_ROOT_PATTERN = /^(?:\.|[A-Za-z0-9][A-Za-z0-9._-]*(?:\/[A-Za-z0-9][A-Za-z0-9._-]*)*)$/u;
54662
54537
  var APPLICATION_ROOT_MAX_BYTES = 64;
@@ -54725,706 +54600,994 @@ function normalizeApplicationRoot(value = ".") {
54725
54600
  return value;
54726
54601
  }
54727
54602
 
54728
- // packages/contracts/dist/index.js
54729
- var import__ = __toESM(require__(), 1);
54730
- var import_yaml = __toESM(require_dist(), 1);
54731
-
54732
- // packages/contracts/schemas/ohmyhost.schema.json
54733
- var ohmyhost_schema_default = {
54734
- $schema: "https://json-schema.org/draft/2020-12/schema",
54735
- $id: "https://schemas.ohmyho.st/ohmyhost/v1/schema.json",
54736
- title: "ohmyhost.yaml",
54737
- description: "Version 1 project build and runtime configuration.",
54738
- type: "object",
54739
- additionalProperties: false,
54740
- required: ["version", "project", "build", "runtime"],
54741
- properties: {
54742
- version: {
54743
- const: 1
54744
- },
54745
- project: {
54746
- type: "string",
54747
- minLength: 1,
54748
- maxLength: 63,
54749
- pattern: "^[a-z](?:[a-z0-9-]*[a-z0-9])?$"
54750
- },
54751
- applicationRoot: {
54752
- $ref: "#/$defs/applicationRoot"
54753
- },
54754
- build: {
54755
- $ref: "#/$defs/build"
54756
- },
54757
- runtime: {
54758
- $ref: "#/$defs/runtime"
54759
- },
54760
- database: {
54761
- $ref: "#/$defs/database"
54762
- },
54763
- auth: {
54764
- $ref: "#/$defs/auth"
54765
- },
54766
- mail: {
54767
- $ref: "#/$defs/mail"
54768
- },
54769
- storage: {
54770
- $ref: "#/$defs/storage"
54603
+ // packages/contracts/dist/functions.js
54604
+ function normalizeCrons(value) {
54605
+ if (!Array.isArray(value) || value.length === 0 || value.length > 8) {
54606
+ throw new TypeError("ohmyhost.yaml functions.crons must list one to eight schedules");
54607
+ }
54608
+ const crons = value.map((entry) => {
54609
+ if (typeof entry !== "string")
54610
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54611
+ return normalizeCron(entry);
54612
+ });
54613
+ const sorted = [...crons].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
54614
+ for (let index = 1; index < sorted.length; index += 1) {
54615
+ if (sorted[index - 1] === sorted[index]) {
54616
+ throw new TypeError("ohmyhost.yaml functions.crons must be unique");
54617
+ }
54618
+ }
54619
+ return Object.freeze(sorted);
54620
+ }
54621
+ function normalizeCron(value) {
54622
+ if (value !== value.trim() || value.includes(" ")) {
54623
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54624
+ }
54625
+ const fields = value.split(" ");
54626
+ if (fields.length !== 5)
54627
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54628
+ const [minute, hour, day, month, weekday] = fields;
54629
+ if (minute === void 0 || hour === void 0 || day === void 0 || month === void 0 || weekday === void 0 || !validCronMinute(minute) || !validCronField(hour, 0, 23) || !validCronField(day, 1, 31) || !validCronField(month, 1, 12) || !validCronField(weekday, 0, 6)) {
54630
+ throw new TypeError("ohmyhost.yaml cron is invalid");
54631
+ }
54632
+ return value;
54633
+ }
54634
+ function validCronMinute(value) {
54635
+ const step = /^\*\/([1-9]|[1-5][0-9])$/u.exec(value);
54636
+ if (step !== null)
54637
+ return Number(step[1]) >= 5;
54638
+ return value !== "*" && validCronField(value, 0, 59);
54639
+ }
54640
+ function validCronField(value, minimum, maximum) {
54641
+ if (value === "*")
54642
+ return true;
54643
+ if (!/^(?:0|[1-9][0-9]?)$/u.test(value))
54644
+ return false;
54645
+ const parsed = Number(value);
54646
+ return parsed >= minimum && parsed <= maximum;
54647
+ }
54648
+
54649
+ // packages/contracts/dist/browser-capabilities.js
54650
+ var RESOURCE_GROUPS = [
54651
+ "connect",
54652
+ "scripts",
54653
+ "styles",
54654
+ "images",
54655
+ "fonts",
54656
+ "frames",
54657
+ "frameAncestors"
54658
+ ];
54659
+ var POLICY_KEYS = [...RESOURCE_GROUPS, "workers", "cors"];
54660
+ var MAX_ORIGINS = 16;
54661
+ function normalizeBrowserPolicy(value) {
54662
+ const input = value === void 0 ? {} : policyRecord(value, POLICY_KEYS);
54663
+ const workers = input["workers"] === void 0 ? {} : policyRecord(input["workers"], ["self", "blob"]);
54664
+ const cors = input["cors"] === void 0 ? {} : policyRecord(input["cors"], ["origins", "credentials"]);
54665
+ const resources = Object.fromEntries(RESOURCE_GROUPS.map((group) => [group, normalizeOrigins(input[group], group === "connect")]));
54666
+ return Object.freeze({
54667
+ ...resources,
54668
+ workers: Object.freeze({
54669
+ self: normalizeBoolean(workers["self"]),
54670
+ blob: normalizeBoolean(workers["blob"])
54671
+ }),
54672
+ cors: Object.freeze({
54673
+ origins: normalizeOrigins(cors["origins"], false),
54674
+ credentials: normalizeBoolean(cors["credentials"])
54675
+ })
54676
+ });
54677
+ }
54678
+ function policyRecord(value, keys, complete = false) {
54679
+ if (typeof value !== "object" || value === null || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || Object.keys(value).some((key) => !keys.includes(key)) || complete && Object.keys(value).length !== keys.length)
54680
+ throw invalidPolicy();
54681
+ return value;
54682
+ }
54683
+ function normalizeBoolean(value) {
54684
+ if (value === void 0)
54685
+ return false;
54686
+ if (typeof value !== "boolean")
54687
+ throw invalidPolicy();
54688
+ return value;
54689
+ }
54690
+ function normalizeOrigins(value, allowWebSocket) {
54691
+ if (value === void 0)
54692
+ return Object.freeze([]);
54693
+ if (!Array.isArray(value) || value.length > MAX_ORIGINS)
54694
+ throw invalidPolicy();
54695
+ const origins = [];
54696
+ for (const origin of value) {
54697
+ if (!browserOrigin(origin, allowWebSocket) || origins.includes(origin))
54698
+ throw invalidPolicy();
54699
+ origins.push(origin);
54700
+ }
54701
+ return Object.freeze(origins.sort());
54702
+ }
54703
+ function browserOrigin(value, allowWebSocket) {
54704
+ if (typeof value !== "string" || value.length > 256)
54705
+ return false;
54706
+ try {
54707
+ const url = new URL(value);
54708
+ return (url.protocol === "https:" || allowWebSocket && url.protocol === "wss:") && url.origin === value && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname.includes(".") && !url.hostname.endsWith(".local") && !url.hostname.endsWith(".internal") && !/^\d+(?:\.\d+){3}$/u.test(url.hostname) && url.hostname.split(".").every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label));
54709
+ } catch {
54710
+ return false;
54711
+ }
54712
+ }
54713
+ function invalidPolicy() {
54714
+ return new TypeError("Invalid browser capability policy");
54715
+ }
54716
+
54717
+ // packages/contracts/dist/preview-view.js
54718
+ function parsePreviewView(value, scope) {
54719
+ if (!value || typeof value !== "object" || Array.isArray(value))
54720
+ throw new TypeError("Invalid preview response");
54721
+ const row = value;
54722
+ const ulid5 = /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u;
54723
+ if (Object.keys(row).sort().join(",") !== "environment,id,project_id,source,status,url" || typeof row["id"] !== "string" || !ulid5.test(row["id"]) || typeof row["project_id"] !== "string" || !ulid5.test(row["project_id"]) || row["environment"] !== "dev" && row["environment"] !== "prod" || !["cold", "starting", "ready", "sleeping"].includes(String(row["status"])) || typeof row["url"] !== "string" || !/^https:\/\/[a-z2-7]{51}[aq]\.preview(?:\.dev)?\.omh\.st$/u.test(row["url"]) || scope !== void 0 && (row["project_id"] !== scope.projectId || row["environment"] !== scope.environment))
54724
+ throw new TypeError("Invalid preview response");
54725
+ if (row["source"] !== null) {
54726
+ const source = row["source"];
54727
+ if (!source || typeof source !== "object" || Array.isArray(source))
54728
+ throw new TypeError("Invalid preview response");
54729
+ const item = source;
54730
+ if (Object.keys(item).sort().join(",") !== "commit_sha,sequence" || typeof item["sequence"] !== "number" || !Number.isSafeInteger(item["sequence"]) || item["sequence"] <= 0 || typeof item["commit_sha"] !== "string" || !/^(?!0{40}$)[0-9a-f]{40}$/u.test(item["commit_sha"]))
54731
+ throw new TypeError("Invalid preview response");
54732
+ }
54733
+ return value;
54734
+ }
54735
+
54736
+ // packages/contracts/dist/index.js
54737
+ var validateOhmyhostConfig = new import__.Ajv2020({
54738
+ allErrors: true,
54739
+ strict: true
54740
+ }).compile(ohmyhost_schema_default);
54741
+ function parseOhmyhostConfig(value) {
54742
+ if (!validateOhmyhostConfig(value)) {
54743
+ throw new TypeError(`ohmyhost.yaml is invalid: ${formatErrors(validateOhmyhostConfig.errors)}`);
54744
+ }
54745
+ const input = value;
54746
+ const config = {
54747
+ version: 1,
54748
+ project: input.project,
54749
+ applicationRoot: normalizeApplicationRoot(input.applicationRoot),
54750
+ build: input.runtime.mode === "functions" ? Object.freeze({ install: input.build.install }) : Object.freeze({
54751
+ install: input.build.install,
54752
+ command: input.build.command,
54753
+ output: input.build.output,
54754
+ ...input.build.ssg_cache_max_mib === void 0 ? {} : { ssg_cache_max_mib: input.build.ssg_cache_max_mib },
54755
+ ...input.build.next_revalidate_path === true ? { next_revalidate_path: true } : {}
54756
+ }),
54757
+ runtime: Object.freeze({
54758
+ mode: input.runtime.mode,
54759
+ healthcheck: normalizeHealthcheck(input.runtime.healthcheck),
54760
+ egress: Object.freeze({
54761
+ allow: normalizeEgressOrigins(input.runtime.egress?.allow)
54762
+ }),
54763
+ ...input.runtime.browser === void 0 ? {} : { browser: normalizeBrowserPolicy(input.runtime.browser) }
54764
+ }),
54765
+ ...input.database === void 0 ? {} : {
54766
+ database: Object.freeze({
54767
+ enabled: input.database.enabled,
54768
+ ...input.database.migrations === void 0 ? {} : { migrations: input.database.migrations }
54769
+ })
54771
54770
  },
54772
- ai: {
54773
- $ref: "#/$defs/ai"
54771
+ ...input.auth === void 0 ? {} : { auth: Object.freeze({ provider: input.auth.provider }) },
54772
+ ...input.mail === void 0 ? {} : { mail: Object.freeze({ enabled: input.mail.enabled }) },
54773
+ ...input.storage === void 0 ? {} : {
54774
+ storage: Object.freeze({
54775
+ provider: input.storage.provider,
54776
+ jurisdiction: input.storage.jurisdiction,
54777
+ public: input.storage.public
54778
+ })
54774
54779
  },
54775
- functions: {
54776
- $ref: "#/$defs/functions"
54780
+ ...input.ai === void 0 ? {} : {
54781
+ ai: Object.freeze({
54782
+ enabled: input.ai.enabled,
54783
+ ...input.ai.jurisdiction === void 0 ? {} : { jurisdiction: input.ai.jurisdiction }
54784
+ })
54777
54785
  },
54778
- credits: {
54779
- $ref: "#/$defs/credits"
54786
+ ...input.browser === void 0 ? {} : { browser: Object.freeze({ enabled: input.browser.enabled }) },
54787
+ ...input.functions === void 0 ? {} : {
54788
+ functions: Object.freeze({ crons: normalizeCrons(input.functions.crons) })
54780
54789
  },
54781
- browser: {
54782
- $ref: "#/$defs/browserRendering"
54783
- }
54784
- },
54785
- $defs: {
54786
- applicationRoot: {
54787
- type: "string",
54788
- minLength: 1,
54789
- maxLength: 64,
54790
- pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]*(?:/[A-Za-z0-9][A-Za-z0-9._-]*)*)$",
54791
- allOf: [
54792
- {
54793
- pattern: "^(?:\\.|[A-Za-z0-9][A-Za-z0-9._-]{0,62}(?:/[A-Za-z0-9][A-Za-z0-9._-]{0,62}){0,7})$"
54794
- }
54795
- ]
54796
- },
54797
- nonEmptyCommand: {
54798
- type: "string",
54799
- minLength: 1,
54800
- maxLength: 4096
54801
- },
54802
- relativePath: {
54803
- type: "string",
54804
- minLength: 1,
54805
- maxLength: 512,
54806
- pattern: "^(?!/)(?!.*[\\\\:])(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
54807
- },
54808
- build: {
54809
- type: "object",
54810
- additionalProperties: false,
54811
- required: ["install"],
54812
- properties: {
54813
- install: {
54814
- $ref: "#/$defs/nonEmptyCommand"
54815
- },
54816
- command: {
54817
- $ref: "#/$defs/nonEmptyCommand"
54818
- },
54819
- output: {
54820
- $ref: "#/$defs/relativePath"
54821
- },
54822
- ssg_cache_max_mib: {
54823
- type: "integer",
54824
- minimum: 1,
54825
- maximum: 64,
54826
- description: "Maximum private immutable Next.js prerender cache in MiB; defaults to 32. Cache storage costs zero credits. Public assets retain their independent limit."
54827
- },
54828
- next_revalidate_path: {
54829
- type: "boolean",
54830
- description: "Opt into deployment-scoped on-demand Next.js path revalidation."
54831
- }
54832
- }
54833
- },
54834
- runtime: {
54835
- type: "object",
54836
- additionalProperties: false,
54837
- required: ["mode"],
54838
- properties: {
54839
- mode: {
54840
- type: "string",
54841
- enum: ["static", "edge", "functions", "auto"]
54842
- },
54843
- healthcheck: {
54844
- type: "string",
54845
- minLength: 1,
54846
- maxLength: 256,
54847
- pattern: "^/"
54848
- },
54849
- browser: {
54850
- $ref: "#/$defs/browser"
54851
- },
54852
- egress: {
54853
- type: "object",
54854
- additionalProperties: false,
54855
- required: ["allow"],
54856
- properties: {
54857
- allow: {
54858
- type: "array",
54859
- maxItems: 13,
54860
- uniqueItems: true,
54861
- items: {
54862
- type: "string",
54863
- minLength: 1,
54864
- maxLength: 256,
54865
- pattern: "^https://"
54866
- }
54867
- }
54868
- }
54869
- }
54870
- }
54871
- },
54872
- browserOrigins: {
54873
- type: "array",
54874
- maxItems: 16,
54875
- uniqueItems: true,
54876
- items: {
54877
- type: "string",
54878
- minLength: 1,
54879
- maxLength: 256,
54880
- pattern: "^https://"
54881
- }
54882
- },
54883
- browser: {
54884
- type: "object",
54885
- additionalProperties: false,
54886
- properties: {
54887
- connect: {
54888
- type: "array",
54889
- maxItems: 16,
54890
- uniqueItems: true,
54891
- items: {
54892
- type: "string",
54893
- minLength: 1,
54894
- maxLength: 256,
54895
- pattern: "^(?:https|wss)://"
54896
- }
54897
- },
54898
- scripts: {
54899
- $ref: "#/$defs/browserOrigins"
54900
- },
54901
- styles: {
54902
- $ref: "#/$defs/browserOrigins"
54903
- },
54904
- images: {
54905
- $ref: "#/$defs/browserOrigins"
54906
- },
54907
- fonts: {
54908
- $ref: "#/$defs/browserOrigins"
54909
- },
54910
- frames: {
54911
- $ref: "#/$defs/browserOrigins"
54912
- },
54913
- frameAncestors: {
54914
- $ref: "#/$defs/browserOrigins"
54915
- },
54916
- workers: {
54917
- type: "object",
54918
- additionalProperties: false,
54919
- properties: {
54920
- self: {
54921
- type: "boolean"
54922
- },
54923
- blob: {
54924
- type: "boolean"
54925
- }
54926
- }
54927
- },
54928
- cors: {
54929
- type: "object",
54930
- additionalProperties: false,
54931
- properties: {
54932
- origins: {
54933
- $ref: "#/$defs/browserOrigins"
54934
- },
54935
- credentials: {
54936
- type: "boolean"
54937
- }
54938
- }
54790
+ ...input.credits === void 0 ? {} : {
54791
+ credits: Object.freeze({
54792
+ monthly_budget: input.credits.monthly_budget,
54793
+ ...input.credits.auto_recharge === void 0 ? {} : {
54794
+ auto_recharge: Object.freeze({
54795
+ enabled: input.credits.auto_recharge.enabled,
54796
+ ...input.credits.auto_recharge.threshold === void 0 ? {} : { threshold: input.credits.auto_recharge.threshold },
54797
+ ...input.credits.auto_recharge.amount_usd_micros === void 0 ? {} : { amount_usd_micros: input.credits.auto_recharge.amount_usd_micros },
54798
+ ...input.credits.auto_recharge.monthly_cap_usd_micros === void 0 ? {} : {
54799
+ monthly_cap_usd_micros: input.credits.auto_recharge.monthly_cap_usd_micros
54800
+ }
54801
+ })
54939
54802
  }
54803
+ })
54804
+ }
54805
+ };
54806
+ return Object.freeze(config);
54807
+ }
54808
+ function normalizeHealthcheck(value) {
54809
+ const candidate = value ?? "/";
54810
+ if (candidate !== candidate.trim() || !candidate.startsWith("/") || candidate.startsWith("//") || candidate.includes("\\") || candidate.includes("?") || candidate.includes("#") || candidate.split("/").some((segment) => segment === "." || segment === "..")) {
54811
+ throw new TypeError("ohmyhost.yaml runtime healthcheck is invalid");
54812
+ }
54813
+ return candidate;
54814
+ }
54815
+ function normalizeEgressOrigins(value) {
54816
+ const origins = [...value ?? []];
54817
+ for (const origin of origins) {
54818
+ let parsed;
54819
+ try {
54820
+ parsed = new URL(origin);
54821
+ } catch {
54822
+ throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
54823
+ }
54824
+ if (parsed.protocol !== "https:" || parsed.port !== "" || parsed.username !== "" || parsed.password !== "" || parsed.origin !== origin || parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "" || forbiddenEgressHostname(parsed.hostname)) {
54825
+ throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
54826
+ }
54827
+ }
54828
+ origins.sort();
54829
+ return Object.freeze(origins);
54830
+ }
54831
+ function forbiddenEgressHostname(hostname) {
54832
+ const normalized = hostname.toLowerCase();
54833
+ return /(?:^|\.)ohmyho-(?:mail|storage)-gateway-[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*\.workers\.dev\.?$/u.test(normalized) || normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || /^\d{1,3}(?:\.\d{1,3}){3}$/u.test(normalized) || normalized.startsWith("[") || normalized.endsWith("]");
54834
+ }
54835
+ function parseOhmyhostConfigYaml(source) {
54836
+ if (typeof source !== "string") {
54837
+ throw new TypeError("ohmyhost.yaml must be a string");
54838
+ }
54839
+ let value;
54840
+ try {
54841
+ value = (0, import_yaml.parse)(source);
54842
+ } catch {
54843
+ throw new TypeError("ohmyhost.yaml is not valid YAML");
54844
+ }
54845
+ return parseOhmyhostConfig(value);
54846
+ }
54847
+ function formatErrors(errors) {
54848
+ return (errors ?? []).map(({ instancePath, message }) => `${instancePath || "/"} ${message ?? "is invalid"}`).join("; ");
54849
+ }
54850
+
54851
+ // apps/product-cli/dist/product-api.js
54852
+ var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
54853
+ var WATCH_SCOPE_MISMATCH = "Watch response scope mismatch";
54854
+ var TABLE_SCOPE_MISMATCH = "Table response scope mismatch";
54855
+ var SCHEDULE_SCOPE_MISMATCH = "Schedule response scope mismatch";
54856
+ function assertDatabaseTableAnswer(value) {
54857
+ const table = isRecordValue(value) ? value["table"] : void 0;
54858
+ const columns = isRecordValue(table) ? table["columns"] : void 0;
54859
+ const primaryKey = isRecordValue(table) ? table["primary_key"] : void 0;
54860
+ if (!isRecordValue(table) || !hasExactKeys(table, ["environment", "schema", "table", "columns", "primary_key", "created"]) || table["environment"] !== "dev" && table["environment"] !== "prod" || table["schema"] !== "public" || !isDatabaseTableIdentifier(table["table"]) || typeof table["created"] !== "boolean" || !Array.isArray(columns) || columns.length < 1 || !columns.every(isDatabaseTableAnswerColumn) || !Array.isArray(primaryKey) || !primaryKey.every((name) => columns.some((column) => column["name"] === name)))
54861
+ throw new TypeError("Invalid database table answer");
54862
+ }
54863
+ function isDatabaseTableAnswerColumn(value) {
54864
+ return isRecordValue(value) && hasExactKeys(value, ["name", "type", "nullable", "identity", "default"]) && isDatabaseTableIdentifier(value["name"]) && DATABASE_TABLE_COLUMN_TYPES.includes(value["type"]) && typeof value["nullable"] === "boolean" && typeof value["identity"] === "boolean" && (value["default"] === null || DATABASE_TABLE_DEFAULTS.includes(value["default"]));
54865
+ }
54866
+ function isRecordValue(value) {
54867
+ return typeof value === "object" && value !== null && !Array.isArray(value);
54868
+ }
54869
+ function hasExactKeys(value, keys) {
54870
+ return Object.keys(value).sort().join(",") === [...keys].sort().join(",");
54871
+ }
54872
+ var GeneratedSdkProductApi = class {
54873
+ #client;
54874
+ managedSource;
54875
+ constructor(baseUrl, accessToken, fetch2) {
54876
+ this.#client = createClient({ auth: accessToken, baseUrl, fetch: fetch2, throwOnError: true });
54877
+ this.managedSource = new GeneratedSdkManagedSourceApi(() => this.#client);
54878
+ }
54879
+ async changeDatabaseCompute(input) {
54880
+ return changeDatabaseCompute({
54881
+ project_id: input.projectId,
54882
+ body: {
54883
+ environment: input.environment,
54884
+ ...input.memoryMiB === void 0 ? { profile: input.profile } : { memory_mib: input.memoryMiB },
54885
+ confirm: true
54886
+ },
54887
+ "Idempotency-Key": input.idempotencyKey
54888
+ }, { client: this.#client });
54889
+ }
54890
+ async getDatabaseCompute(input) {
54891
+ const value = await getDatabaseCompute({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
54892
+ assertDatabaseCompute(value);
54893
+ if (value.project_id !== input.projectId || value.environment !== input.environment)
54894
+ throw new TypeError("Compute response scope mismatch");
54895
+ return value;
54896
+ }
54897
+ async getProjectContext(projectId) {
54898
+ const result = await getProjectContext({ project_id: projectId }, { client: this.#client });
54899
+ assertProjectContext(result);
54900
+ if (result.project_id !== projectId)
54901
+ throw new TypeError("Project context scope mismatch");
54902
+ return result;
54903
+ }
54904
+ async setProjectNotes(input) {
54905
+ const result = await setProjectNotes({
54906
+ project_id: input.projectId,
54907
+ markdown: input.markdown,
54908
+ expected_version: input.expectedVersion,
54909
+ "Idempotency-Key": input.idempotencyKey
54910
+ }, { client: this.#client });
54911
+ assertProjectNotesReceipt(result);
54912
+ return result;
54913
+ }
54914
+ createProjectExport(input) {
54915
+ return createProjectExport({
54916
+ project_id: input.projectId,
54917
+ password: input.password,
54918
+ "Idempotency-Key": input.idempotencyKey
54919
+ }, { client: this.#client });
54920
+ }
54921
+ async getProjectExport(input) {
54922
+ const result = await getProjectExport({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
54923
+ assertProjectExport(result);
54924
+ return result;
54925
+ }
54926
+ async createProjectExportDownloadLink(input) {
54927
+ const result = await createProjectExportDownloadLink({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
54928
+ assertProjectExportDownloadLink(result);
54929
+ return result;
54930
+ }
54931
+ async getCurrentIdentity() {
54932
+ return getCurrentIdentity({}, { client: this.#client });
54933
+ }
54934
+ async getAccountProfile() {
54935
+ return parseAccountProfile(await getAccountProfile({ client: this.#client }));
54936
+ }
54937
+ getOrganizationReferral(organizationId) {
54938
+ return getOrganizationReferral({ organization_id: organizationId }, { client: this.#client });
54939
+ }
54940
+ getOrganizationAccount(organizationId) {
54941
+ return getOrganizationAccount({ organization_id: organizationId }, { client: this.#client });
54942
+ }
54943
+ getOrganizationCredits(organizationId) {
54944
+ return getOrganizationCredits({ organization_id: organizationId }, { client: this.#client });
54945
+ }
54946
+ async createUserApiKey(input) {
54947
+ return parseUserApiKeyCreation(await createUserApiKey({
54948
+ organization_id: input.organizationId,
54949
+ name: input.name,
54950
+ "Idempotency-Key": input.idempotencyKey
54951
+ }, { client: this.#client }));
54952
+ }
54953
+ async listUserApiKeys(input) {
54954
+ return parseUserApiKeyPage(await listUserApiKeys({ organization_id: input.organizationId, ...input.after ? { after: input.after } : {} }, { client: this.#client }));
54955
+ }
54956
+ async revokeUserApiKey(input) {
54957
+ await revokeUserApiKey({ organization_id: input.organizationId, key_id: input.keyId }, { client: this.#client });
54958
+ }
54959
+ createBillingCheckout(input) {
54960
+ return createBillingCheckout({
54961
+ organization_id: input.organizationId,
54962
+ offer: input.offer,
54963
+ packs: input.packs,
54964
+ "Idempotency-Key": input.idempotencyKey
54965
+ }, { client: this.#client });
54966
+ }
54967
+ getBillingCheckout(input) {
54968
+ return getBillingCheckout({ organization_id: input.organizationId, checkout_id: input.checkoutId }, { client: this.#client });
54969
+ }
54970
+ getBillingRecharge(organizationId) {
54971
+ return getBillingRecharge({ organization_id: organizationId }, { client: this.#client });
54972
+ }
54973
+ configureBillingRecharge(input) {
54974
+ return configureBillingRecharge({
54975
+ organization_id: input.organizationId,
54976
+ "Idempotency-Key": input.idempotencyKey,
54977
+ enabled: input.enabled,
54978
+ monthly_limit_minor: input.monthlyLimitMinor,
54979
+ consent: input.consent,
54980
+ revision: input.revision
54981
+ }, { client: this.#client });
54982
+ }
54983
+ createBillingPortal(organizationId) {
54984
+ return createBillingPortal({ organization_id: organizationId, body: {} }, { client: this.#client });
54985
+ }
54986
+ getOrganizationCreditUsage(organizationId) {
54987
+ return getOrganizationCreditUsage({ organization_id: organizationId }, { client: this.#client });
54988
+ }
54989
+ getProjectCreditBudget(projectId) {
54990
+ return getProjectCreditBudget({ project_id: projectId }, { client: this.#client });
54991
+ }
54992
+ setProjectCreditBudget(input) {
54993
+ return setProjectCreditBudget({
54994
+ project_id: input.projectId,
54995
+ "Idempotency-Key": input.idempotencyKey,
54996
+ setProjectCreditBudgetRequest: { amount_micros: input.amountMicros, mode: input.mode }
54997
+ }, { client: this.#client });
54998
+ }
54999
+ createOrganization(input) {
55000
+ return createOrganization({
55001
+ "Idempotency-Key": input.idempotencyKey,
55002
+ createOrganizationRequest: {
55003
+ name: input.name,
55004
+ ...input.signupSource === void 0 ? {} : { signup_source: input.signupSource }
54940
55005
  }
54941
- },
54942
- database: {
54943
- type: "object",
54944
- additionalProperties: false,
54945
- required: ["enabled"],
54946
- properties: {
54947
- enabled: {
54948
- type: "boolean"
54949
- },
54950
- migrations: {
54951
- $ref: "#/$defs/relativePath"
54952
- }
54953
- },
54954
- if: {
54955
- properties: {
54956
- enabled: {
54957
- const: true
54958
- }
54959
- },
54960
- required: ["enabled"]
54961
- },
54962
- then: {
54963
- properties: {
54964
- migrations: {
54965
- $ref: "#/$defs/relativePath"
54966
- }
54967
- },
54968
- required: ["migrations"]
55006
+ }, { client: this.#client });
55007
+ }
55008
+ async listProjects(input) {
55009
+ return listProjects(input, { client: this.#client });
55010
+ }
55011
+ async changeProjectHandle(input) {
55012
+ return changeProjectHandle({
55013
+ project_id: input.projectId,
55014
+ "Idempotency-Key": input.idempotencyKey,
55015
+ "If-Match": input.ifMatch,
55016
+ handle: input.handle
55017
+ }, { client: this.#client });
55018
+ }
55019
+ async checkProjectHandle(input) {
55020
+ return getProjectHandleAvailability({ handle: input.handle }, { client: this.#client });
55021
+ }
55022
+ async getProjectStatus(projectId) {
55023
+ return getProjectStatus({ project_id: projectId }, { client: this.#client });
55024
+ }
55025
+ async writeProjectDatabase(input) {
55026
+ return writeProjectDatabase({
55027
+ project_id: input.projectId,
55028
+ "Idempotency-Key": input.idempotencyKey,
55029
+ projectDatabaseWriteRequest: {
55030
+ environment: input.environment,
55031
+ statement: input.statement,
55032
+ parameters: [...input.parameters]
54969
55033
  }
54970
- },
54971
- mail: {
54972
- type: "object",
54973
- additionalProperties: false,
54974
- required: ["enabled"],
54975
- properties: {
54976
- enabled: {
54977
- type: "boolean"
54978
- }
55034
+ }, { client: this.#client });
55035
+ }
55036
+ async queryProjectDatabase(input) {
55037
+ return queryProjectDatabase({
55038
+ project_id: input.projectId,
55039
+ projectDatabaseQueryRequest: {
55040
+ environment: input.environment,
55041
+ statement: input.statement,
55042
+ parameters: [...input.parameters]
54979
55043
  }
54980
- },
54981
- storage: {
54982
- type: "object",
54983
- additionalProperties: false,
54984
- required: ["provider", "jurisdiction", "public"],
54985
- properties: {
54986
- provider: {
54987
- const: "r2"
54988
- },
54989
- jurisdiction: {
54990
- type: "string",
54991
- enum: ["us", "eu"]
54992
- },
54993
- public: {
54994
- const: false
54995
- }
55044
+ }, { client: this.#client });
55045
+ }
55046
+ /** The connection URI exists only in this response; nothing in the CLI persists it. */
55047
+ async createProjectDatabaseAccess(input) {
55048
+ const value = await createProjectDatabaseAccess({
55049
+ project_id: input.projectId,
55050
+ projectDatabaseAccessRequest: {
55051
+ environment: input.environment,
55052
+ mode: input.mode,
55053
+ ttl_seconds: input.ttlSeconds,
55054
+ label: input.label
54996
55055
  }
54997
- },
54998
- ai: {
54999
- type: "object",
55000
- additionalProperties: false,
55001
- required: ["enabled"],
55002
- properties: {
55003
- enabled: {
55004
- type: "boolean"
55005
- },
55006
- jurisdiction: {
55007
- type: "string",
55008
- enum: ["eu", "any"]
55009
- }
55010
- },
55011
- if: {
55012
- properties: {
55013
- enabled: {
55014
- const: true
55015
- }
55016
- },
55017
- required: ["enabled"]
55018
- },
55019
- then: {
55020
- properties: {
55021
- jurisdiction: {
55022
- type: "string",
55023
- enum: ["eu", "any"]
55024
- }
55025
- },
55026
- required: ["jurisdiction"]
55056
+ }, { client: this.#client });
55057
+ assertProjectDatabaseAccessCredential(value);
55058
+ return value;
55059
+ }
55060
+ async listProjectDatabaseAccess(input) {
55061
+ const value = await listProjectDatabaseAccess({
55062
+ project_id: input.projectId,
55063
+ ...input.environment === void 0 ? {} : { environment: input.environment }
55064
+ }, { client: this.#client });
55065
+ assertProjectDatabaseAccessPage(value);
55066
+ return value;
55067
+ }
55068
+ async revokeProjectDatabaseAccess(input) {
55069
+ const value = await revokeProjectDatabaseAccess({ project_id: input.projectId, access_id: input.accessId }, { client: this.#client });
55070
+ assertProjectDatabaseAccess(value);
55071
+ return value;
55072
+ }
55073
+ async createProjectDatabaseWatch(input) {
55074
+ const value = await createProjectDatabaseWatch({
55075
+ project_id: input.projectId,
55076
+ "Idempotency-Key": input.idempotencyKey,
55077
+ databaseWatchCreateRequest: {
55078
+ environment: input.environment,
55079
+ schema: input.request.schema,
55080
+ table: input.request.table,
55081
+ columns: [...input.request.columns],
55082
+ operations: [...input.request.operations]
55027
55083
  }
55028
- },
55029
- auth: {
55030
- type: "object",
55031
- additionalProperties: false,
55032
- required: ["provider"],
55033
- properties: {
55034
- provider: {
55035
- type: "string",
55036
- enum: ["none", "better-auth", "omh-native"]
55037
- }
55084
+ }, { client: this.#client });
55085
+ assertDatabaseWatch(value);
55086
+ if (value.environment !== input.environment || value.schema !== input.request.schema || value.table !== input.request.table)
55087
+ throw new TypeError(WATCH_SCOPE_MISMATCH);
55088
+ return value;
55089
+ }
55090
+ async listProjectDatabaseWatches(input) {
55091
+ const value = await listProjectDatabaseWatches({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
55092
+ assertDatabaseWatchPage(value);
55093
+ if (value.items.some((item) => item.environment !== input.environment))
55094
+ throw new TypeError(WATCH_SCOPE_MISMATCH);
55095
+ return value;
55096
+ }
55097
+ async deleteProjectDatabaseWatch(input) {
55098
+ const value = await deleteProjectDatabaseWatch({
55099
+ project_id: input.projectId,
55100
+ environment: input.environment,
55101
+ "Idempotency-Key": input.idempotencyKey,
55102
+ watch_id: input.watchId
55103
+ }, { client: this.#client });
55104
+ assertDatabaseWatchDeleted(value);
55105
+ if (value.id !== input.watchId)
55106
+ throw new TypeError(WATCH_SCOPE_MISMATCH);
55107
+ return value;
55108
+ }
55109
+ async createProjectDatabaseTable(input) {
55110
+ const value = await createProjectDatabaseTable({
55111
+ project_id: input.projectId,
55112
+ "Idempotency-Key": input.idempotencyKey,
55113
+ databaseTableCreateRequest: {
55114
+ environment: input.environment,
55115
+ table: input.request.table,
55116
+ columns: [...input.request.columns],
55117
+ ...input.request.primaryKey.length === 0 ? {} : { primary_key: [...input.request.primaryKey] }
55038
55118
  }
55039
- },
55040
- functions: {
55041
- type: "object",
55042
- additionalProperties: false,
55043
- required: ["crons"],
55044
- properties: {
55045
- crons: {
55046
- type: "array",
55047
- minItems: 1,
55048
- maxItems: 8,
55049
- uniqueItems: true,
55050
- items: {
55051
- type: "string",
55052
- minLength: 9,
55053
- maxLength: 64
55054
- }
55055
- }
55119
+ }, { client: this.#client });
55120
+ assertDatabaseTableAnswer(value);
55121
+ if (value.table.environment !== input.environment || value.table.table !== input.request.table)
55122
+ throw new TypeError(TABLE_SCOPE_MISMATCH);
55123
+ return value;
55124
+ }
55125
+ /** The signing secret exists only in this answer; the CLI prints it once and stores nothing. */
55126
+ async createProjectDatabaseWebhook(input) {
55127
+ const value = await createProjectDatabaseWebhook({
55128
+ project_id: input.projectId,
55129
+ environment: input.environment,
55130
+ "Idempotency-Key": input.idempotencyKey,
55131
+ databaseWebhookCreateRequest: {
55132
+ url: input.url,
55133
+ event_types: [...input.eventTypes],
55134
+ headers: { ...input.headers }
55135
+ }
55136
+ }, { client: this.#client });
55137
+ assertDatabaseWebhookCreated(value);
55138
+ if (value.environment !== input.environment)
55139
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55140
+ return value;
55141
+ }
55142
+ async getDatabaseWebhookSubscription(input) {
55143
+ const value = await getDatabaseWebhookSubscription({
55144
+ project_id: input.projectId,
55145
+ environment: input.environment,
55146
+ subscription_id: input.subscriptionId
55147
+ }, { client: this.#client });
55148
+ assertDatabaseWebhookSubscription(value);
55149
+ if (value.id !== input.subscriptionId || value.environment !== input.environment)
55150
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55151
+ return value;
55152
+ }
55153
+ async activateDatabaseWebhookSubscription(input) {
55154
+ const value = await activateDatabaseWebhookSubscription({
55155
+ project_id: input.projectId,
55156
+ environment: input.environment,
55157
+ subscription_id: input.subscriptionId,
55158
+ generation: input.generation,
55159
+ "Idempotency-Key": input.idempotencyKey,
55160
+ databaseWebhookCreateRequest: {
55161
+ ...input.request,
55162
+ event_types: [...input.request.event_types],
55163
+ headers: { ...input.request.headers }
55056
55164
  }
55057
- },
55058
- credits: {
55059
- type: "object",
55060
- additionalProperties: false,
55061
- required: ["monthly_budget"],
55062
- properties: {
55063
- monthly_budget: {
55064
- type: "integer",
55065
- minimum: 0,
55066
- maximum: 1e9
55067
- },
55068
- auto_recharge: {
55069
- $ref: "#/$defs/autoRecharge"
55070
- }
55165
+ }, { client: this.#client });
55166
+ assertDatabaseWebhookSubscriptionActivation(value);
55167
+ if (value.id !== input.subscriptionId || value.environment !== input.environment || value.generation !== input.generation)
55168
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55169
+ return value;
55170
+ }
55171
+ async deactivateDatabaseWebhookSubscription(input) {
55172
+ const value = await deactivateDatabaseWebhookSubscription({
55173
+ project_id: input.projectId,
55174
+ environment: input.environment,
55175
+ subscription_id: input.subscriptionId,
55176
+ generation: input.generation,
55177
+ "Idempotency-Key": input.idempotencyKey
55178
+ }, { client: this.#client });
55179
+ assertDatabaseWebhookSubscription(value);
55180
+ if (value.id !== input.subscriptionId || value.environment !== input.environment || value.generation !== input.generation || value.state !== "inactive")
55181
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55182
+ return value;
55183
+ }
55184
+ async listProjectDatabaseWebhooks(input) {
55185
+ const value = await listProjectDatabaseWebhooks({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
55186
+ assertDatabaseWebhookPage(value);
55187
+ if (value.items.some((item) => item.environment !== input.environment))
55188
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55189
+ return value;
55190
+ }
55191
+ async getProjectDatabaseWebhook(input) {
55192
+ const value = await getProjectDatabaseWebhook({
55193
+ project_id: input.projectId,
55194
+ environment: input.environment,
55195
+ webhook_id: input.webhookId
55196
+ }, { client: this.#client });
55197
+ assertDatabaseWebhook(value);
55198
+ if (value.id !== input.webhookId || value.environment !== input.environment)
55199
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55200
+ return value;
55201
+ }
55202
+ async deleteProjectDatabaseWebhook(input) {
55203
+ const value = await deleteProjectDatabaseWebhook({
55204
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
55205
+ project_id: input.projectId,
55206
+ environment: input.environment,
55207
+ webhook_id: input.webhookId
55208
+ }, { client: this.#client });
55209
+ assertDatabaseWebhookDeleted(value);
55210
+ if (value.id !== input.webhookId)
55211
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55212
+ return value;
55213
+ }
55214
+ async testProjectDatabaseWebhook(input) {
55215
+ const value = await testProjectDatabaseWebhook({
55216
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
55217
+ project_id: input.projectId,
55218
+ environment: input.environment,
55219
+ webhook_id: input.webhookId
55220
+ }, { client: this.#client });
55221
+ assertDatabaseWebhookTest(value);
55222
+ return value;
55223
+ }
55224
+ async listProjectDatabaseWebhookDeliveries(input) {
55225
+ const value = await listProjectDatabaseWebhookDeliveries({
55226
+ project_id: input.projectId,
55227
+ environment: input.environment,
55228
+ ...input.webhookId === void 0 ? {} : { webhook_id: input.webhookId },
55229
+ ...input.limit === void 0 ? {} : { limit: input.limit },
55230
+ ...input.cursor === void 0 ? {} : { cursor: input.cursor }
55231
+ }, { client: this.#client });
55232
+ assertDatabaseWebhookDeliveryPage(value);
55233
+ if (input.webhookId !== void 0 && value.items.some((item) => item.webhook_id !== input.webhookId))
55234
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55235
+ return value;
55236
+ }
55237
+ async replayProjectDatabaseWebhookDelivery(input) {
55238
+ const value = await replayProjectDatabaseWebhookDelivery({
55239
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
55240
+ project_id: input.projectId,
55241
+ environment: input.environment,
55242
+ delivery_id: input.deliveryId
55243
+ }, { client: this.#client });
55244
+ assertDatabaseWebhookReplayAccepted(value);
55245
+ if (value.delivery_id !== input.deliveryId)
55246
+ throw new TypeError(WEBHOOK_SCOPE_MISMATCH);
55247
+ return value;
55248
+ }
55249
+ /** A schedule runs the statements as the application's runtime role; the request confirms it. */
55250
+ async setProjectDatabaseSchedule(input) {
55251
+ const request = input.request;
55252
+ const value = await setProjectDatabaseSchedule({
55253
+ project_id: input.projectId,
55254
+ environment: input.environment,
55255
+ name: input.name,
55256
+ databaseScheduleSetRequest: {
55257
+ ...request.cron === null ? {} : { cron: request.cron },
55258
+ ...request.every_seconds === null ? {} : { every_seconds: request.every_seconds },
55259
+ statements: [...request.statements],
55260
+ timeout_ms: request.timeout_ms,
55261
+ enabled: request.enabled,
55262
+ confirm: true
55263
+ }
55264
+ }, { client: this.#client });
55265
+ assertDatabaseSchedule(value);
55266
+ if (value.name !== input.name || value.environment !== input.environment)
55267
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
55268
+ return value;
55269
+ }
55270
+ async listProjectDatabaseSchedules(input) {
55271
+ const value = await listProjectDatabaseSchedules({ project_id: input.projectId, environment: input.environment }, { client: this.#client });
55272
+ assertDatabaseSchedulePage(value);
55273
+ if (value.items.some((item) => item.environment !== input.environment))
55274
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
55275
+ return value;
55276
+ }
55277
+ async getProjectDatabaseSchedule(input) {
55278
+ const value = await getProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
55279
+ assertDatabaseSchedule(value);
55280
+ if (value.name !== input.name || value.environment !== input.environment)
55281
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
55282
+ return value;
55283
+ }
55284
+ async deleteProjectDatabaseSchedule(input) {
55285
+ const value = await deleteProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
55286
+ assertDatabaseScheduleDeleted(value);
55287
+ if (value.name !== input.name)
55288
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
55289
+ return value;
55290
+ }
55291
+ async listProjectDatabaseScheduleRuns(input) {
55292
+ const value = await listProjectDatabaseScheduleRuns({
55293
+ project_id: input.projectId,
55294
+ environment: input.environment,
55295
+ name: input.name,
55296
+ ...input.limit === void 0 ? {} : { limit: input.limit }
55297
+ }, { client: this.#client });
55298
+ assertDatabaseScheduleRunPage(value);
55299
+ if (value.items.some((item) => item.schedule !== input.name))
55300
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
55301
+ return value;
55302
+ }
55303
+ async runProjectDatabaseSchedule(input) {
55304
+ const value = await runProjectDatabaseSchedule({
55305
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
55306
+ project_id: input.projectId,
55307
+ environment: input.environment,
55308
+ name: input.name
55309
+ }, { client: this.#client });
55310
+ assertDatabaseScheduleRunAccepted(value);
55311
+ if (value.schedule !== input.name)
55312
+ throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
55313
+ return value;
55314
+ }
55315
+ async getProjectDatabaseExecutionUsage(input) {
55316
+ const value = await getProjectDatabaseExecutionUsage({
55317
+ project_id: input.projectId,
55318
+ environment: input.environment,
55319
+ from: input.from,
55320
+ to: input.to,
55321
+ granularity: input.granularity,
55322
+ ...input.limit === void 0 ? {} : { limit: input.limit },
55323
+ ...input.cursor === void 0 ? {} : { cursor: input.cursor }
55324
+ }, { client: this.#client });
55325
+ assertDatabaseExecutionUsagePage(value);
55326
+ return value;
55327
+ }
55328
+ async planPaidDomain(input) {
55329
+ return planPaidProjectDomain({ project_id: input.projectId, paidDomainRequest: { hostname: input.hostname } }, { client: this.#client });
55330
+ }
55331
+ async applyPaidDomain(input) {
55332
+ return applyPaidProjectDomain({
55333
+ "Idempotency-Key": input.idempotencyKey,
55334
+ project_id: input.projectId,
55335
+ paidDomainRequest: { hostname: input.hostname }
55336
+ }, { client: this.#client });
55337
+ }
55338
+ async getPaidDomain(projectId) {
55339
+ return getPaidProjectDomain({ project_id: projectId }, { client: this.#client });
55340
+ }
55341
+ async deletePaidDomain(input) {
55342
+ return deletePaidProjectDomain({
55343
+ "Idempotency-Key": input.idempotencyKey,
55344
+ project_id: input.projectId,
55345
+ paidDomainRequest: { hostname: input.hostname }
55346
+ }, { client: this.#client });
55347
+ }
55348
+ async ensureDevShareLink(projectId) {
55349
+ return ensureProjectDevShareLink({ project_id: projectId }, { client: this.#client });
55350
+ }
55351
+ async preview(action, input) {
55352
+ const args = { project_id: input.projectId, environment: input.environment };
55353
+ const result = action === "get" ? await getProjectPreview(args, { client: this.#client }) : action === "open" ? await openProjectPreview(args, { client: this.#client }) : input.idempotencyKey === void 0 ? (() => {
55354
+ throw new TypeError("Preview idempotency key is required");
55355
+ })() : action === "stop" ? await stopProjectPreview({ ...args, "Idempotency-Key": input.idempotencyKey }, { client: this.#client }) : await rotateProjectPreviewToken({ ...args, "Idempotency-Key": input.idempotencyKey }, { client: this.#client });
55356
+ return parsePreviewView(result, input);
55357
+ }
55358
+ async rotateDevShareLink(projectId, idempotencyKey) {
55359
+ return rotateProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
55360
+ }
55361
+ async revokeDevShareLink(projectId, idempotencyKey) {
55362
+ return revokeProjectDevShareLink({ project_id: projectId, "Idempotency-Key": idempotencyKey }, { client: this.#client });
55363
+ }
55364
+ async setDevAccessMode(projectId, mode, idempotencyKey) {
55365
+ return setProjectDevAccessMode({
55366
+ project_id: projectId,
55367
+ "Idempotency-Key": idempotencyKey,
55368
+ setDevAccessModeRequest: { mode }
55369
+ }, { client: this.#client });
55370
+ }
55371
+ async getPoweredByFlag(projectId) {
55372
+ return getProjectPoweredByFlag({ project_id: projectId }, { client: this.#client });
55373
+ }
55374
+ async setPoweredByFlag(projectId, enabled, idempotencyKey) {
55375
+ return setProjectPoweredByFlag({
55376
+ project_id: projectId,
55377
+ "Idempotency-Key": idempotencyKey,
55378
+ setPoweredByFlagRequest: { enabled }
55379
+ }, { client: this.#client });
55380
+ }
55381
+ async createDevAccessTicket(projectId) {
55382
+ return createProjectDevAccessTicket({ project_id: projectId }, { client: this.#client });
55383
+ }
55384
+ async submitFeedback(input) {
55385
+ return parseFeedbackReceipt(await submitFeedback({ "Idempotency-Key": input.idempotencyKey, feedbackSubmission: input.report }, { client: this.#client }));
55386
+ }
55387
+ async getFeedback(feedbackId, cursor) {
55388
+ return parseFeedbackStatus(await getFeedback({ feedback_id: feedbackId, ...cursor === void 0 ? {} : { cursor } }, { client: this.#client }));
55389
+ }
55390
+ async planProjectDataChange(input) {
55391
+ return parseProjectDataChangePlan2(await planProjectDataChange({ project_id: input.projectId, projectDataChangeRequest: { change: input.change } }, { client: this.#client }));
55392
+ }
55393
+ async createProjectDataChange(input) {
55394
+ return parseOperation(await createProjectDataChange({
55395
+ project_id: input.projectId,
55396
+ projectDataChangeRequest: { change: input.change },
55397
+ "If-Match": input.ifMatch,
55398
+ "X-Confirmation-Token": input.confirmationToken,
55399
+ "Idempotency-Key": input.idempotencyKey
55400
+ }, { client: this.#client }));
55401
+ }
55402
+ async createProject(input) {
55403
+ return createProject({
55404
+ "Idempotency-Key": input.idempotencyKey,
55405
+ createProjectRequest: {
55406
+ organization_id: input.organizationId,
55407
+ name: input.name,
55408
+ ...input.dataMode === void 0 ? {} : { data_mode: input.dataMode },
55409
+ ...input.devAccessMode === void 0 ? {} : { dev_access_mode: input.devAccessMode },
55410
+ ...input.includeDevelopmentEnvironment === void 0 ? {} : { include_development_environment: input.includeDevelopmentEnvironment },
55411
+ ...input.region === void 0 ? {} : { region: input.region }
55071
55412
  }
55072
- },
55073
- autoRecharge: {
55074
- type: "object",
55075
- additionalProperties: false,
55076
- required: ["enabled"],
55077
- properties: {
55078
- enabled: {
55079
- type: "boolean"
55080
- },
55081
- threshold: {
55082
- type: "integer",
55083
- minimum: 0,
55084
- maximum: 1e6
55085
- },
55086
- amount_usd_micros: {
55087
- type: "integer",
55088
- minimum: 1,
55089
- maximum: 9007199254740991
55090
- },
55091
- monthly_cap_usd_micros: {
55092
- type: "integer",
55093
- minimum: 1,
55094
- maximum: 9007199254740991
55095
- }
55096
- },
55097
- if: {
55098
- properties: {
55099
- enabled: {
55100
- const: true
55101
- }
55102
- },
55103
- required: ["enabled"]
55104
- },
55105
- then: {
55106
- properties: {
55107
- threshold: {
55108
- type: "integer",
55109
- minimum: 0,
55110
- maximum: 1e6
55111
- },
55112
- amount_usd_micros: {
55113
- type: "integer",
55114
- minimum: 1,
55115
- maximum: 9007199254740991
55116
- },
55117
- monthly_cap_usd_micros: {
55118
- type: "integer",
55119
- minimum: 1,
55120
- maximum: 9007199254740991
55121
- }
55122
- },
55123
- required: ["threshold", "amount_usd_micros", "monthly_cap_usd_micros"]
55413
+ }, { client: this.#client });
55414
+ }
55415
+ async addProjectDevelopmentEnvironment(input) {
55416
+ return addProjectDevelopmentEnvironment({ project_id: input.projectId, "Idempotency-Key": input.idempotencyKey, body: {} }, { client: this.#client });
55417
+ }
55418
+ async getOperation(operationId) {
55419
+ return getOperation({ operation_id: operationId }, { client: this.#client });
55420
+ }
55421
+ async reconcileOperation(input) {
55422
+ return reconcileOperation({
55423
+ "Idempotency-Key": input.idempotencyKey,
55424
+ operation_id: input.operationId
55425
+ }, { client: this.#client });
55426
+ }
55427
+ async connectGithub(input) {
55428
+ return connectGithubOrganization({
55429
+ organization_id: input.organizationId,
55430
+ "Idempotency-Key": input.idempotencyKey,
55431
+ connectGithubOrganizationRequest: {}
55432
+ }, { client: this.#client });
55433
+ }
55434
+ async getGithubConnection(organizationId) {
55435
+ return getGithubOrganizationConnection({ organization_id: organizationId }, { client: this.#client });
55436
+ }
55437
+ async disconnectGithub(organizationId) {
55438
+ return disconnectGithubOrganization({ organization_id: organizationId }, { client: this.#client });
55439
+ }
55440
+ async listOrganizationMcpConnections(organizationId) {
55441
+ return listOrganizationMcpConnections({ organization_id: organizationId }, { client: this.#client });
55442
+ }
55443
+ async revokeOrganizationMcpConnection(input) {
55444
+ return revokeOrganizationMcpConnection({ organization_id: input.organizationId, connection_id: input.connectionId }, { client: this.#client });
55445
+ }
55446
+ async linkSource(input) {
55447
+ return linkProjectSource({
55448
+ "Idempotency-Key": input.idempotencyKey,
55449
+ project_id: input.projectId,
55450
+ linkProjectSourceRequest: {
55451
+ repository_owner: input.repositoryOwner,
55452
+ repository_name: input.repositoryName
55124
55453
  }
55125
- },
55126
- browserRendering: {
55127
- type: "object",
55128
- additionalProperties: false,
55129
- required: ["enabled"],
55130
- properties: {
55131
- enabled: {
55132
- type: "boolean"
55133
- }
55454
+ }, { client: this.#client });
55455
+ }
55456
+ async configureAutoDeploy(input) {
55457
+ return configureProjectSourceAutoDeploy({
55458
+ "Idempotency-Key": input.idempotencyKey,
55459
+ project_id: input.projectId,
55460
+ configureSourceAutoDeployRequest: { branch: input.branch, enabled: input.enabled }
55461
+ }, { client: this.#client });
55462
+ }
55463
+ async getAutoDeploy(projectId) {
55464
+ return getProjectSourceAutoDeploy({ project_id: projectId }, { client: this.#client });
55465
+ }
55466
+ async authorizeCloudflareDns(input) {
55467
+ return createCloudflareDnsAuthorization({
55468
+ "Idempotency-Key": input.idempotencyKey,
55469
+ project_id: input.projectId,
55470
+ createCloudflareDnsAuthorizationRequest: { zone: input.zone }
55471
+ }, { client: this.#client });
55472
+ }
55473
+ async getCloudflareDnsStatus(projectId) {
55474
+ return getCloudflareDnsAuthorizationStatus({ project_id: projectId }, { client: this.#client });
55475
+ }
55476
+ async applyProjectDomains(input) {
55477
+ return configureProjectDomains({ "Idempotency-Key": input.idempotencyKey, project_id: input.projectId }, { client: this.#client });
55478
+ }
55479
+ async planDeployment(input) {
55480
+ return planDeployment({
55481
+ project_id: input.projectId,
55482
+ planDeploymentRequest: {
55483
+ commit_sha: input.commitSha,
55484
+ ...input.environment === void 0 ? {} : { environment: input.environment }
55134
55485
  }
55135
- }
55136
- },
55137
- allOf: [
55138
- {
55139
- if: {
55140
- type: "object",
55141
- properties: {
55142
- runtime: {
55143
- type: "object",
55144
- properties: {
55145
- mode: {
55146
- const: "functions"
55147
- }
55148
- },
55149
- required: ["mode"]
55150
- }
55151
- },
55152
- required: ["runtime"]
55153
- },
55154
- then: {
55155
- type: "object",
55156
- properties: {
55157
- build: {
55158
- type: "object",
55159
- additionalProperties: false,
55160
- required: ["install"],
55161
- properties: {
55162
- install: {
55163
- $ref: "#/$defs/nonEmptyCommand"
55164
- }
55165
- }
55166
- }
55167
- }
55168
- },
55169
- else: {
55170
- type: "object",
55171
- properties: {
55172
- build: {
55173
- type: "object",
55174
- additionalProperties: false,
55175
- required: ["install", "command", "output"],
55176
- properties: {
55177
- install: {
55178
- $ref: "#/$defs/nonEmptyCommand"
55179
- },
55180
- command: {
55181
- $ref: "#/$defs/nonEmptyCommand"
55182
- },
55183
- output: {
55184
- $ref: "#/$defs/relativePath"
55185
- },
55186
- ssg_cache_max_mib: {
55187
- $ref: "#/$defs/build/properties/ssg_cache_max_mib"
55188
- },
55189
- next_revalidate_path: {
55190
- $ref: "#/$defs/build/properties/next_revalidate_path"
55191
- }
55192
- }
55193
- }
55194
- }
55486
+ }, { client: this.#client });
55487
+ }
55488
+ async createDeployment(input) {
55489
+ return createDeployment({
55490
+ "Idempotency-Key": input.idempotencyKey,
55491
+ project_id: input.projectId,
55492
+ createDeploymentRequest: { plan_id: input.planId }
55493
+ }, { client: this.#client });
55494
+ }
55495
+ async getDeployment(input) {
55496
+ return getDeployment({ project_id: input.projectId, deployment_id: input.deploymentId }, { client: this.#client });
55497
+ }
55498
+ async streamOperationEvents(operationId, signal, lastEventId) {
55499
+ return (await streamOperationEvents({ operation_id: operationId }, {
55500
+ client: this.#client,
55501
+ signal,
55502
+ // The generated client would otherwise retry a refused stream, such as a 404, forever.
55503
+ sseMaxRetryAttempts: 1,
55504
+ headers: {
55505
+ Accept: "text/event-stream",
55506
+ ...lastEventId === void 0 ? {} : { "Last-Event-ID": lastEventId }
55195
55507
  }
55196
- }
55197
- ]
55198
- };
55199
-
55200
- // packages/contracts/dist/functions.js
55201
- function normalizeCrons(value) {
55202
- if (!Array.isArray(value) || value.length === 0 || value.length > 8) {
55203
- throw new TypeError("ohmyhost.yaml functions.crons must list one to eight schedules");
55508
+ })).stream;
55204
55509
  }
55205
- const crons = value.map((entry) => {
55206
- if (typeof entry !== "string")
55207
- throw new TypeError("ohmyhost.yaml cron is invalid");
55208
- return normalizeCron(entry);
55209
- });
55210
- const sorted = [...crons].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
55211
- for (let index = 1; index < sorted.length; index += 1) {
55212
- if (sorted[index - 1] === sorted[index]) {
55213
- throw new TypeError("ohmyhost.yaml functions.crons must be unique");
55214
- }
55510
+ async getDeploymentLogs(input) {
55511
+ return getDeploymentLogs({
55512
+ project_id: input.projectId,
55513
+ deployment_id: input.deploymentId,
55514
+ limit: input.limit,
55515
+ ...input.cursor === void 0 ? {} : { cursor: input.cursor }
55516
+ }, { client: this.#client });
55517
+ }
55518
+ async planRollback(input) {
55519
+ return planDeploymentRollback({ project_id: input.projectId, target_deployment_id: input.deploymentId }, { client: this.#client });
55520
+ }
55521
+ async rollback(input) {
55522
+ return rollbackDeployment({
55523
+ "Idempotency-Key": input.idempotencyKey,
55524
+ "If-Match": input.ifMatch,
55525
+ "X-Confirmation-Token": input.confirmationToken,
55526
+ project_id: input.projectId,
55527
+ target_deployment_id: input.deploymentId
55528
+ }, { client: this.#client });
55215
55529
  }
55216
- return Object.freeze(sorted);
55217
- }
55218
- function normalizeCron(value) {
55219
- if (value !== value.trim() || value.includes(" ")) {
55220
- throw new TypeError("ohmyhost.yaml cron is invalid");
55530
+ async planPromotion(input) {
55531
+ return planDeploymentPromotion({ project_id: input.projectId, source_deployment_id: input.sourceDeploymentId }, { client: this.#client });
55221
55532
  }
55222
- const fields = value.split(" ");
55223
- if (fields.length !== 5)
55224
- throw new TypeError("ohmyhost.yaml cron is invalid");
55225
- const [minute, hour, day, month, weekday] = fields;
55226
- if (minute === void 0 || hour === void 0 || day === void 0 || month === void 0 || weekday === void 0 || !validCronMinute(minute) || !validCronField(hour, 0, 23) || !validCronField(day, 1, 31) || !validCronField(month, 1, 12) || !validCronField(weekday, 0, 6)) {
55227
- throw new TypeError("ohmyhost.yaml cron is invalid");
55533
+ async promote(input) {
55534
+ return promoteDeployment({
55535
+ "Idempotency-Key": input.idempotencyKey,
55536
+ "If-Match": input.ifMatch,
55537
+ "X-Confirmation-Token": input.confirmationToken,
55538
+ project_id: input.projectId,
55539
+ source_deployment_id: input.sourceDeploymentId
55540
+ }, { client: this.#client });
55228
55541
  }
55229
- return value;
55230
- }
55231
- function validCronMinute(value) {
55232
- const step = /^\*\/([1-9]|[1-5][0-9])$/u.exec(value);
55233
- if (step !== null)
55234
- return Number(step[1]) >= 5;
55235
- return value !== "*" && validCronField(value, 0, 59);
55236
- }
55237
- function validCronField(value, minimum, maximum) {
55238
- if (value === "*")
55239
- return true;
55240
- if (!/^(?:0|[1-9][0-9]?)$/u.test(value))
55241
- return false;
55242
- const parsed = Number(value);
55243
- return parsed >= minimum && parsed <= maximum;
55244
- }
55245
-
55246
- // packages/contracts/dist/browser-capabilities.js
55247
- var RESOURCE_GROUPS = [
55248
- "connect",
55249
- "scripts",
55250
- "styles",
55251
- "images",
55252
- "fonts",
55253
- "frames",
55254
- "frameAncestors"
55255
- ];
55256
- var POLICY_KEYS = [...RESOURCE_GROUPS, "workers", "cors"];
55257
- var MAX_ORIGINS = 16;
55258
- function normalizeBrowserPolicy(value) {
55259
- const input = value === void 0 ? {} : policyRecord(value, POLICY_KEYS);
55260
- const workers = input["workers"] === void 0 ? {} : policyRecord(input["workers"], ["self", "blob"]);
55261
- const cors = input["cors"] === void 0 ? {} : policyRecord(input["cors"], ["origins", "credentials"]);
55262
- const resources = Object.fromEntries(RESOURCE_GROUPS.map((group) => [group, normalizeOrigins(input[group], group === "connect")]));
55263
- return Object.freeze({
55264
- ...resources,
55265
- workers: Object.freeze({
55266
- self: normalizeBoolean(workers["self"]),
55267
- blob: normalizeBoolean(workers["blob"])
55268
- }),
55269
- cors: Object.freeze({
55270
- origins: normalizeOrigins(cors["origins"], false),
55271
- credentials: normalizeBoolean(cors["credentials"])
55272
- })
55273
- });
55274
- }
55275
- function policyRecord(value, keys, complete = false) {
55276
- if (typeof value !== "object" || value === null || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || Object.keys(value).some((key) => !keys.includes(key)) || complete && Object.keys(value).length !== keys.length)
55277
- throw invalidPolicy();
55278
- return value;
55279
- }
55280
- function normalizeBoolean(value) {
55281
- if (value === void 0)
55282
- return false;
55283
- if (typeof value !== "boolean")
55284
- throw invalidPolicy();
55285
- return value;
55286
- }
55287
- function normalizeOrigins(value, allowWebSocket) {
55288
- if (value === void 0)
55289
- return Object.freeze([]);
55290
- if (!Array.isArray(value) || value.length > MAX_ORIGINS)
55291
- throw invalidPolicy();
55292
- const origins = [];
55293
- for (const origin of value) {
55294
- if (!browserOrigin(origin, allowWebSocket) || origins.includes(origin))
55295
- throw invalidPolicy();
55296
- origins.push(origin);
55542
+ async planDelete(projectId) {
55543
+ return planProjectDeletion({ project_id: projectId }, { client: this.#client });
55297
55544
  }
55298
- return Object.freeze(origins.sort());
55299
- }
55300
- function browserOrigin(value, allowWebSocket) {
55301
- if (typeof value !== "string" || value.length > 256)
55302
- return false;
55303
- try {
55304
- const url = new URL(value);
55305
- return (url.protocol === "https:" || allowWebSocket && url.protocol === "wss:") && url.origin === value && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname.includes(".") && !url.hostname.endsWith(".local") && !url.hostname.endsWith(".internal") && !/^\d+(?:\.\d+){3}$/u.test(url.hostname) && url.hostname.split(".").every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u.test(label));
55306
- } catch {
55307
- return false;
55545
+ async deleteProject(input) {
55546
+ return deleteProject({
55547
+ "Idempotency-Key": input.idempotencyKey,
55548
+ "If-Match": input.ifMatch,
55549
+ "X-Confirmation-Token": input.confirmationToken,
55550
+ project_id: input.projectId
55551
+ }, { client: this.#client });
55308
55552
  }
55309
- }
55310
- function invalidPolicy() {
55311
- return new TypeError("Invalid browser capability policy");
55312
- }
55313
-
55314
- // packages/contracts/dist/index.js
55315
- var validateOhmyhostConfig = new import__.Ajv2020({
55316
- allErrors: true,
55317
- strict: true
55318
- }).compile(ohmyhost_schema_default);
55319
- function parseOhmyhostConfig(value) {
55320
- if (!validateOhmyhostConfig(value)) {
55321
- throw new TypeError(`ohmyhost.yaml is invalid: ${formatErrors(validateOhmyhostConfig.errors)}`);
55553
+ async listEnvironmentSecrets(input) {
55554
+ return listEnvironmentSecrets({ project_id: input.projectId, environment_id: input.environmentId }, { client: this.#client });
55322
55555
  }
55323
- const input = value;
55324
- const config = {
55325
- version: 1,
55326
- project: input.project,
55327
- applicationRoot: normalizeApplicationRoot(input.applicationRoot),
55328
- build: input.runtime.mode === "functions" ? Object.freeze({ install: input.build.install }) : Object.freeze({
55329
- install: input.build.install,
55330
- command: input.build.command,
55331
- output: input.build.output,
55332
- ...input.build.ssg_cache_max_mib === void 0 ? {} : { ssg_cache_max_mib: input.build.ssg_cache_max_mib },
55333
- ...input.build.next_revalidate_path === true ? { next_revalidate_path: true } : {}
55334
- }),
55335
- runtime: Object.freeze({
55336
- mode: input.runtime.mode,
55337
- healthcheck: normalizeHealthcheck(input.runtime.healthcheck),
55338
- egress: Object.freeze({
55339
- allow: normalizeEgressOrigins(input.runtime.egress?.allow)
55340
- }),
55341
- ...input.runtime.browser === void 0 ? {} : { browser: normalizeBrowserPolicy(input.runtime.browser) }
55342
- }),
55343
- ...input.database === void 0 ? {} : {
55344
- database: Object.freeze({
55345
- enabled: input.database.enabled,
55346
- ...input.database.migrations === void 0 ? {} : { migrations: input.database.migrations }
55347
- })
55348
- },
55349
- ...input.auth === void 0 ? {} : { auth: Object.freeze({ provider: input.auth.provider }) },
55350
- ...input.mail === void 0 ? {} : { mail: Object.freeze({ enabled: input.mail.enabled }) },
55351
- ...input.storage === void 0 ? {} : {
55352
- storage: Object.freeze({
55353
- provider: input.storage.provider,
55354
- jurisdiction: input.storage.jurisdiction,
55355
- public: input.storage.public
55356
- })
55357
- },
55358
- ...input.ai === void 0 ? {} : {
55359
- ai: Object.freeze({
55360
- enabled: input.ai.enabled,
55361
- ...input.ai.jurisdiction === void 0 ? {} : { jurisdiction: input.ai.jurisdiction }
55362
- })
55363
- },
55364
- ...input.browser === void 0 ? {} : { browser: Object.freeze({ enabled: input.browser.enabled }) },
55365
- ...input.functions === void 0 ? {} : {
55366
- functions: Object.freeze({ crons: normalizeCrons(input.functions.crons) })
55367
- },
55368
- ...input.credits === void 0 ? {} : {
55369
- credits: Object.freeze({
55370
- monthly_budget: input.credits.monthly_budget,
55371
- ...input.credits.auto_recharge === void 0 ? {} : {
55372
- auto_recharge: Object.freeze({
55373
- enabled: input.credits.auto_recharge.enabled,
55374
- ...input.credits.auto_recharge.threshold === void 0 ? {} : { threshold: input.credits.auto_recharge.threshold },
55375
- ...input.credits.auto_recharge.amount_usd_micros === void 0 ? {} : { amount_usd_micros: input.credits.auto_recharge.amount_usd_micros },
55376
- ...input.credits.auto_recharge.monthly_cap_usd_micros === void 0 ? {} : {
55377
- monthly_cap_usd_micros: input.credits.auto_recharge.monthly_cap_usd_micros
55378
- }
55379
- })
55380
- }
55381
- })
55382
- }
55383
- };
55384
- return Object.freeze(config);
55385
- }
55386
- function normalizeHealthcheck(value) {
55387
- const candidate = value ?? "/";
55388
- if (candidate !== candidate.trim() || !candidate.startsWith("/") || candidate.startsWith("//") || candidate.includes("\\") || candidate.includes("?") || candidate.includes("#") || candidate.split("/").some((segment) => segment === "." || segment === "..")) {
55389
- throw new TypeError("ohmyhost.yaml runtime healthcheck is invalid");
55556
+ async listFunctionRuns(input) {
55557
+ return listFunctionRuns({ project_id: input.projectId, environment_id: input.environmentId, limit: input.limit }, { client: this.#client });
55390
55558
  }
55391
- return candidate;
55392
- }
55393
- function normalizeEgressOrigins(value) {
55394
- const origins = [...value ?? []];
55395
- for (const origin of origins) {
55396
- let parsed;
55397
- try {
55398
- parsed = new URL(origin);
55399
- } catch {
55400
- throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55401
- }
55402
- if (parsed.protocol !== "https:" || parsed.port !== "" || parsed.username !== "" || parsed.password !== "" || parsed.origin !== origin || parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "" || forbiddenEgressHostname(parsed.hostname)) {
55403
- throw new TypeError("ohmyhost.yaml runtime egress origin is invalid");
55404
- }
55559
+ async putEnvironmentSecret(input) {
55560
+ return putEnvironmentSecret({
55561
+ "Idempotency-Key": input.idempotencyKey,
55562
+ project_id: input.projectId,
55563
+ environment_id: input.environmentId,
55564
+ secret_name: input.name,
55565
+ putEnvironmentSecretRequest: { value: input.value }
55566
+ }, { client: this.#client });
55405
55567
  }
55406
- origins.sort();
55407
- return Object.freeze(origins);
55408
- }
55409
- function forbiddenEgressHostname(hostname) {
55410
- const normalized = hostname.toLowerCase();
55411
- return /(?:^|\.)ohmyho-(?:mail|storage)-gateway-[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*\.workers\.dev\.?$/u.test(normalized) || normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || /^\d{1,3}(?:\.\d{1,3}){3}$/u.test(normalized) || normalized.startsWith("[") || normalized.endsWith("]");
55412
- }
55413
- function parseOhmyhostConfigYaml(source) {
55414
- if (typeof source !== "string") {
55415
- throw new TypeError("ohmyhost.yaml must be a string");
55568
+ async deleteEnvironmentSecret(input) {
55569
+ return deleteEnvironmentSecret({
55570
+ "Idempotency-Key": input.idempotencyKey,
55571
+ project_id: input.projectId,
55572
+ environment_id: input.environmentId,
55573
+ secret_name: input.name
55574
+ }, { client: this.#client });
55416
55575
  }
55417
- let value;
55418
- try {
55419
- value = (0, import_yaml.parse)(source);
55420
- } catch {
55421
- throw new TypeError("ohmyhost.yaml is not valid YAML");
55576
+ sharedMail(input) {
55577
+ return executeSharedMail(this.#client, input);
55422
55578
  }
55423
- return parseOhmyhostConfig(value);
55424
- }
55425
- function formatErrors(errors) {
55426
- return (errors ?? []).map(({ instancePath, message }) => `${instancePath || "/"} ${message ?? "is invalid"}`).join("; ");
55427
- }
55579
+ managedMail(input) {
55580
+ return executeManagedMail(this.#client, input);
55581
+ }
55582
+ nativeAuth(input) {
55583
+ return executeNativeAuth(this.#client, input);
55584
+ }
55585
+ };
55586
+
55587
+ // apps/product-cli/dist/repository-init.js
55588
+ import { createHash as createHash4 } from "node:crypto";
55589
+ import { lstat as lstat3, open as open4, readFile as readFile3, readdir as readdir3, stat as stat2 } from "node:fs/promises";
55590
+ import { dirname as dirname3, posix, resolve as resolve5 } from "node:path";
55428
55591
 
55429
55592
  // packages/contracts/dist/framework-source-rules.js
55430
55593
  var import_yaml2 = __toESM(require_dist(), 1);