Skip to content

scope/types

scope/types

Type Aliases

TBaseScope

type TBaseScope = z.infer<typeof BaseScopeSchema>;

Defined in: platform-utils/src/scope/types.ts:43


TNorbitalDBRecord

type TNorbitalDBRecord = Record<string, unknown> & object;

Defined in: platform-utils/src/scope/types.ts:7

Type Declaration

norbital_id
norbital_id: string;

TScopeOrganization

type TScopeOrganization = z.infer<typeof ScopeOrganizationSchema>;

Defined in: platform-utils/src/scope/types.ts:37


TScopeRequestor

type TScopeRequestor = z.infer<typeof UserInfoSchema>;

Defined in: platform-utils/src/scope/types.ts:30


TScopeTeamMember

type TScopeTeamMember = z.infer<typeof ScopeTeamMemberSchema>;

Defined in: platform-utils/src/scope/types.ts:17


TUserInfo

type TUserInfo = z.infer<typeof UserInfoSchema>;

Defined in: platform-utils/src/scope/types.ts:31

Variables

BaseScopeSchema

const BaseScopeSchema: ZodObject<{
  organization: ZodObject<{
     name: ZodString;
     norbital_id: ZodString;
  }, $strip>;
  requestor: ZodObject<{
     avatar_url: ZodNullable<ZodString>;
     deactivated_at: ZodNullable<ZodString>;
     email: ZodString;
     norbital_id: ZodString;
     role: ZodEnum<{
        admin: "admin";
        member: "member";
     }>;
     team_members: ZodArray<ZodObject<{
        description: ZodNullable<ZodString>;
        is_active: ZodNullable<ZodBoolean>;
        name: ZodNullable<ZodString>;
        norbital_id: ZodString;
        parent_id: ZodNullable<ZodString>;
     }, $strip>>;
     user_name: ZodString;
     user_status: ZodEnum<{
        active: "active";
        inactive: "inactive";
        pending_invitation: "pending_invitation";
     }>;
  }, $strip>;
}, $strip>;

Defined in: platform-utils/src/scope/types.ts:39


ScopeOrganizationSchema

const ScopeOrganizationSchema: ZodObject<{
  name: ZodString;
  norbital_id: ZodString;
}, $strip>;

Defined in: platform-utils/src/scope/types.ts:33


ScopeTeamMemberSchema

const ScopeTeamMemberSchema: ZodObject<{
  description: ZodNullable<ZodString>;
  is_active: ZodNullable<ZodBoolean>;
  name: ZodNullable<ZodString>;
  norbital_id: ZodString;
  parent_id: ZodNullable<ZodString>;
}, $strip>;

Defined in: platform-utils/src/scope/types.ts:10

Wire shape for a team member in execution scope (no DB audit columns).


UserInfoSchema

const UserInfoSchema: ZodObject<{
  avatar_url: ZodNullable<ZodString>;
  deactivated_at: ZodNullable<ZodString>;
  email: ZodString;
  norbital_id: ZodString;
  role: ZodEnum<{
     admin: "admin";
     member: "member";
  }>;
  team_members: ZodArray<ZodObject<{
     description: ZodNullable<ZodString>;
     is_active: ZodNullable<ZodBoolean>;
     name: ZodNullable<ZodString>;
     norbital_id: ZodString;
     parent_id: ZodNullable<ZodString>;
  }, $strip>>;
  user_name: ZodString;
  user_status: ZodEnum<{
     active: "active";
     inactive: "inactive";
     pending_invitation: "pending_invitation";
  }>;
}, $strip>;

Defined in: platform-utils/src/scope/types.ts:20

Requestor carried over HTTP headers between Core and the runtime isolate.

Functions

toWireBaseScope()

function toWireBaseScope(input): 
  | {
  organization: {
     name: string;
     norbital_id: string;
  };
  requestor: {
     avatar_url: string | null;
     deactivated_at: string | null;
     email: string;
     norbital_id: string;
     role: "admin" | "member";
     team_members: object[];
     user_name: string;
     user_status: "active" | "inactive" | "pending_invitation";
  };
}
  | null;

Defined in: platform-utils/src/scope/types.ts:85

Coerce tenant DB / session rows into the wire shape validated by BaseScopeSchema.

Parameters

Parameter Type
input { organization: { name: string; norbital_id: string; }; requestor: | Record<string, unknown> | { avatar_url: string | null; deactivated_at: string | null; email: string; norbital_id: string; role: "admin" | "member"; team_members: object[]; user_name: string; user_status: "active" | "inactive" | "pending_invitation"; }; }
input.organization { name: string; norbital_id: string; }
input.organization.name string
input.organization.norbital_id string
input.requestor | Record<string, unknown> | { avatar_url: string | null; deactivated_at: string | null; email: string; norbital_id: string; role: "admin" | "member"; team_members: object[]; user_name: string; user_status: "active" | "inactive" | "pending_invitation"; }

Returns

| { organization: { name: string; norbital_id: string; }; requestor: { avatar_url: string | null; deactivated_at: string | null; email: string; norbital_id: string; role: "admin" | "member"; team_members: object[]; user_name: string; user_status: "active" | "inactive" | "pending_invitation"; }; } | null