@amerged/ohmyhost-cli 0.1.33 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @amerged/ohmyhost-cli
2
2
 
3
- ohmyho.st cli client, version 0.1.33.
3
+ ohmyho.st cli client, version 0.1.34.
4
4
 
5
5
  ```sh
6
6
  npm install --global @amerged/ohmyhost-cli
package/dist/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __ohmyhostCreateRequire } from "node:module"; const require = __ohmyhostCreateRequire(import.meta.url);
3
3
  import {
4
4
  runProductionCli
5
- } from "./chunk-3RDHFA76.js";
5
+ } from "./chunk-SRN6L765.js";
6
6
  import "./chunk-7D2RFLWM.js";
7
7
 
8
8
  // apps/product-cli/dist/bin.js
@@ -37142,14 +37142,25 @@ function parseProjectCreditBudget(value) {
37142
37142
  return input;
37143
37143
  }
37144
37144
  var parseCurrentIdentity = (value) => {
37145
- const input = exactRecord2(value, ["actor_id", "organization_ids"]);
37145
+ const input = exactRecord2(value, ["actor_id", "email", "organization_ids", "organizations"]);
37146
+ const email = input["email"];
37146
37147
  const organizationIds = input["organization_ids"];
37148
+ const organizations = input["organizations"];
37147
37149
  if (typeof input["actor_id"] !== "string" || input["actor_id"].length === 0 || input["actor_id"].length > 256 || [...input["actor_id"]].some((character) => {
37148
37150
  const codePoint = character.codePointAt(0) ?? 0;
37149
37151
  return codePoint <= 31 || codePoint === 127;
37150
- }) || !Array.isArray(organizationIds) || organizationIds.some((organizationId) => !isUlid(organizationId)) || new Set(organizationIds).size !== organizationIds.length) {
37152
+ }) || email !== null && (!boundedString(email, 3, 254) || !/^[^\s@]+@[^\s@.]+(?:\.[^\s@.]+)+$/u.test(email) || /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(email)) || !Array.isArray(organizationIds) || organizationIds.some((organizationId) => !isUlid(organizationId)) || new Set(organizationIds).size !== organizationIds.length || !Array.isArray(organizations) || organizations.length !== organizationIds.length) {
37151
37153
  throw new ResponseContractError();
37152
37154
  }
37155
+ organizations.forEach((organization, index) => {
37156
+ const entry = exactRecord2(organization, ["id", "name"]);
37157
+ if (entry["id"] !== organizationIds[index] || !boundedString(entry["name"], 1, 128) || entry["name"].trim() !== entry["name"] || [...entry["name"]].some((character) => {
37158
+ const codePoint = character.codePointAt(0) ?? 0;
37159
+ return codePoint <= 31 || codePoint === 127;
37160
+ })) {
37161
+ throw new ResponseContractError();
37162
+ }
37163
+ });
37153
37164
  return input;
37154
37165
  };
37155
37166
  var parseAccountProfile = (value) => {
@@ -40628,7 +40639,7 @@ function exact3(v, keys) {
40628
40639
  // apps/product-cli/package.json
40629
40640
  var package_default = {
40630
40641
  name: "@ohmyhost/product-cli",
40631
- version: "0.1.33",
40642
+ version: "0.1.34",
40632
40643
  private: true,
40633
40644
  ohmyhost: {
40634
40645
  deployment: "production",
@@ -40965,7 +40976,7 @@ var HELP_USAGE = Object.freeze({
40965
40976
  "project flag set": "ohmyhost project flag set --project ULID --enabled true|false --idempotency-key KEY --json (shows the small Powered by ohmyho.st flag on the production site; while it shows, this project's custom domain uses no domain credits and also works on Free, and each Paid period bought through Stripe adds 250 credits to the workspace, however many projects show the flag)",
40966
40977
  "project handle check": "ohmyhost project handle check --handle HANDLE --json (is this address free? answers with a reason and free alternatives; the address becomes HANDLE.check.omh.st)",
40967
40978
  "project handle set": "ohmyhost project handle set --project ULID --handle HANDLE --if-match ETAG --idempotency-key KEY --json (moves the project to a free address; the old one stops working and anyone may claim it)",
40968
- "database compute set": "ohmyhost database compute set --project ULID --environment dev|prod --profile standard|performance --idempotency-key KEY --yes [--wait] --json\n standard: Free 0.25 CU/1 GB/60s idle, Paid 0.5 CU/2 GB/60s idle. performance: Paid 1 CU/4 GB/300s idle, 2.5x database compute credits per equal active minute; longer idle time also consumes credits.",
40979
+ "database compute set": "ohmyhost database compute set --project ULID --environment dev|prod --profile standard|performance --idempotency-key KEY --yes [--wait] --json\n standard: Free 0.25 CU/1 GB, Paid 0.5 CU/2 GB. performance: Paid 1 CU/4 GB, 2.5x database compute credits per equal active minute. All profiles use the provider-default idle suspension.",
40969
40980
  "database compute get": "ohmyhost database compute get --project ULID [--environment dev|prod] --json",
40970
40981
  "database write": "ohmyhost database write --project ULID --environment dev|prod --statement-file PATH --idempotency-key KEY [--parameters-json JSON] --yes --json",
40971
40982
  "database query": "ohmyhost database query --project ULID --environment dev|prod --statement SQL [--parameters-json JSON] --json",
package/dist/index.js CHANGED
@@ -99,7 +99,7 @@ import {
99
99
  selectWorkspace,
100
100
  verifiedUserId,
101
101
  workspaceOf
102
- } from "./chunk-3RDHFA76.js";
102
+ } from "./chunk-SRN6L765.js";
103
103
  import {
104
104
  CredentialStoreIntegrityError,
105
105
  CredentialStoreUnavailableError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amerged/ohmyhost-cli",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/product-cli",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "private": true,
5
5
  "ohmyhost": {
6
6
  "deployment": "production",
@@ -399,7 +399,7 @@ const HELP_USAGE = Object.freeze({
399
399
  "ohmyhost project handle set --project ULID --handle HANDLE --if-match ETAG --idempotency-key KEY --json (moves the project to a free address; the old one stops working and anyone may claim it)",
400
400
  "database compute set":
401
401
  "ohmyhost database compute set --project ULID --environment dev|prod --profile standard|performance --idempotency-key KEY --yes [--wait] --json\n" +
402
- " standard: Free 0.25 CU/1 GB/60s idle, Paid 0.5 CU/2 GB/60s idle. performance: Paid 1 CU/4 GB/300s idle, 2.5x database compute credits per equal active minute; longer idle time also consumes credits.",
402
+ " standard: Free 0.25 CU/1 GB, Paid 0.5 CU/2 GB. performance: Paid 1 CU/4 GB, 2.5x database compute credits per equal active minute. All profiles use the provider-default idle suspension.",
403
403
  "database compute get":
404
404
  "ohmyhost database compute get --project ULID [--environment dev|prod] --json",
405
405
  "database write":
@@ -63,7 +63,9 @@ export interface SafeProblem {
63
63
 
64
64
  export interface PublicCurrentIdentity {
65
65
  readonly actor_id: string;
66
+ readonly email: string | null;
66
67
  readonly organization_ids: readonly string[];
68
+ readonly organizations: readonly { readonly id: string; readonly name: string }[];
67
69
  }
68
70
 
69
71
  /** One workspace the signed-in user belongs to, with the provider identity a selection needs. */
@@ -635,8 +637,10 @@ export function parseProjectCreditBudget(value: unknown): ProjectCreditBudget {
635
637
  }
636
638
 
637
639
  export const parseCurrentIdentity = (value: unknown): PublicCurrentIdentity => {
638
- const input = exactRecord(value, ["actor_id", "organization_ids"]);
640
+ const input = exactRecord(value, ["actor_id", "email", "organization_ids", "organizations"]);
641
+ const email = input["email"];
639
642
  const organizationIds = input["organization_ids"];
643
+ const organizations = input["organizations"];
640
644
  if (
641
645
  typeof input["actor_id"] !== "string" ||
642
646
  input["actor_id"].length === 0 ||
@@ -645,12 +649,32 @@ export const parseCurrentIdentity = (value: unknown): PublicCurrentIdentity => {
645
649
  const codePoint = character.codePointAt(0) ?? 0;
646
650
  return codePoint <= 31 || codePoint === 127;
647
651
  }) ||
652
+ (email !== null &&
653
+ (!boundedString(email, 3, 254) ||
654
+ !/^[^\s@]+@[^\s@.]+(?:\.[^\s@.]+)+$/u.test(email) ||
655
+ /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(email))) ||
648
656
  !Array.isArray(organizationIds) ||
649
657
  organizationIds.some((organizationId) => !isUlid(organizationId)) ||
650
- new Set(organizationIds).size !== organizationIds.length
658
+ new Set(organizationIds).size !== organizationIds.length ||
659
+ !Array.isArray(organizations) ||
660
+ organizations.length !== organizationIds.length
651
661
  ) {
652
662
  throw new ResponseContractError();
653
663
  }
664
+ organizations.forEach((organization: unknown, index) => {
665
+ const entry = exactRecord(organization, ["id", "name"]);
666
+ if (
667
+ entry["id"] !== organizationIds[index] ||
668
+ !boundedString(entry["name"], 1, 128) ||
669
+ entry["name"].trim() !== entry["name"] ||
670
+ [...entry["name"]].some((character) => {
671
+ const codePoint = character.codePointAt(0) ?? 0;
672
+ return codePoint <= 31 || codePoint === 127;
673
+ })
674
+ ) {
675
+ throw new ResponseContractError();
676
+ }
677
+ });
654
678
  return input as unknown as PublicCurrentIdentity;
655
679
  };
656
680
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/sdk-ts",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -945,7 +945,7 @@ export const completeCloudflareDnsAuthorization = <ThrowOnError extends boolean
945
945
  /**
946
946
  * Get the current authenticated identity
947
947
  *
948
- * Returns the stable ohmyhost actor and internal organization identifiers derived from the bearer credential.
948
+ * Returns the stable ohmyhost actor, the current user's or API-key owner's email, and the credential's organization scope with current display names. Machine-to-machine credentials have a null email. Organizations match organization_ids in the same order.
949
949
  */
950
950
  export const getCurrentIdentity = <ThrowOnError extends boolean = true>(
951
951
  parameters?: {
@@ -1148,11 +1148,25 @@ export type OrganizationAccount = {
1148
1148
  };
1149
1149
 
1150
1150
  /**
1151
- * Minimal customer-visible identity and organization scope for authenticated agent clients.
1151
+ * Customer-visible current account and credential organization scope for authenticated agent clients.
1152
1152
  */
1153
1153
  export type CurrentIdentity = {
1154
1154
  actor_id: string;
1155
+ /**
1156
+ * Email of the current user or user API-key owner; null for machine-to-machine credentials.
1157
+ */
1158
+ email: string | null;
1155
1159
  organization_ids: Array<Ulid>;
1160
+ /**
1161
+ * Current names for exactly the organization_ids scope, in the same order.
1162
+ */
1163
+ organizations: Array<{
1164
+ id: Ulid;
1165
+ /**
1166
+ * Current organization display name without surrounding whitespace or ASCII control characters.
1167
+ */
1168
+ name: string;
1169
+ }>;
1156
1170
  };
1157
1171
 
1158
1172
  export type Project = {