diff --git a/.agents/skills/cli-admin/references/app-achievement.md b/.agents/skills/cli-admin/references/app-achievement.md index 66afb3497..fb54901dd 100644 --- a/.agents/skills/cli-admin/references/app-achievement.md +++ b/.agents/skills/cli-admin/references/app-achievement.md @@ -8,6 +8,9 @@ CRUD operations for AppAchievement records via csdk CLI ```bash csdk app-achievement list +csdk app-achievement list --where.. --orderBy +csdk app-achievement list --limit 10 --after +csdk app-achievement find-first --where.. csdk app-achievement get --id csdk app-achievement create --name [--actorId ] [--count ] csdk app-achievement update --id [--actorId ] [--name ] [--count ] @@ -16,12 +19,42 @@ csdk app-achievement delete --id ## Examples -### List all appAchievement records +### List appAchievement records ```bash csdk app-achievement list ``` +### List appAchievement records with pagination + +```bash +csdk app-achievement list --limit 10 --offset 0 +``` + +### List appAchievement records with cursor pagination + +```bash +csdk app-achievement list --limit 10 --after +``` + +### Find first matching appAchievement + +```bash +csdk app-achievement find-first --where.id.equalTo +``` + +### List appAchievement records with field selection + +```bash +csdk app-achievement list --select id,id +``` + +### List appAchievement records with filtering and ordering + +```bash +csdk app-achievement list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appAchievement ```bash diff --git a/.agents/skills/cli-admin/references/app-admin-grant.md b/.agents/skills/cli-admin/references/app-admin-grant.md index 386e13894..8567b49bc 100644 --- a/.agents/skills/cli-admin/references/app-admin-grant.md +++ b/.agents/skills/cli-admin/references/app-admin-grant.md @@ -8,6 +8,9 @@ CRUD operations for AppAdminGrant records via csdk CLI ```bash csdk app-admin-grant list +csdk app-admin-grant list --where.. --orderBy +csdk app-admin-grant list --limit 10 --after +csdk app-admin-grant find-first --where.. csdk app-admin-grant get --id csdk app-admin-grant create --actorId [--isGrant ] [--grantorId ] csdk app-admin-grant update --id [--isGrant ] [--actorId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk app-admin-grant delete --id ## Examples -### List all appAdminGrant records +### List appAdminGrant records ```bash csdk app-admin-grant list ``` +### List appAdminGrant records with pagination + +```bash +csdk app-admin-grant list --limit 10 --offset 0 +``` + +### List appAdminGrant records with cursor pagination + +```bash +csdk app-admin-grant list --limit 10 --after +``` + +### Find first matching appAdminGrant + +```bash +csdk app-admin-grant find-first --where.id.equalTo +``` + +### List appAdminGrant records with field selection + +```bash +csdk app-admin-grant list --select id,id +``` + +### List appAdminGrant records with filtering and ordering + +```bash +csdk app-admin-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appAdminGrant ```bash diff --git a/.agents/skills/cli-admin/references/app-grant.md b/.agents/skills/cli-admin/references/app-grant.md index 42fd59655..9880b8767 100644 --- a/.agents/skills/cli-admin/references/app-grant.md +++ b/.agents/skills/cli-admin/references/app-grant.md @@ -8,6 +8,9 @@ CRUD operations for AppGrant records via csdk CLI ```bash csdk app-grant list +csdk app-grant list --where.. --orderBy +csdk app-grant list --limit 10 --after +csdk app-grant find-first --where.. csdk app-grant get --id csdk app-grant create --actorId [--permissions ] [--isGrant ] [--grantorId ] csdk app-grant update --id [--permissions ] [--isGrant ] [--actorId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk app-grant delete --id ## Examples -### List all appGrant records +### List appGrant records ```bash csdk app-grant list ``` +### List appGrant records with pagination + +```bash +csdk app-grant list --limit 10 --offset 0 +``` + +### List appGrant records with cursor pagination + +```bash +csdk app-grant list --limit 10 --after +``` + +### Find first matching appGrant + +```bash +csdk app-grant find-first --where.id.equalTo +``` + +### List appGrant records with field selection + +```bash +csdk app-grant list --select id,id +``` + +### List appGrant records with filtering and ordering + +```bash +csdk app-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appGrant ```bash diff --git a/.agents/skills/cli-admin/references/app-level-requirement.md b/.agents/skills/cli-admin/references/app-level-requirement.md index 64d030baf..42bf8c189 100644 --- a/.agents/skills/cli-admin/references/app-level-requirement.md +++ b/.agents/skills/cli-admin/references/app-level-requirement.md @@ -8,6 +8,9 @@ CRUD operations for AppLevelRequirement records via csdk CLI ```bash csdk app-level-requirement list +csdk app-level-requirement list --where.. --orderBy +csdk app-level-requirement list --limit 10 --after +csdk app-level-requirement find-first --where.. csdk app-level-requirement get --id csdk app-level-requirement create --name --level [--description ] [--requiredCount ] [--priority ] csdk app-level-requirement update --id [--name ] [--level ] [--description ] [--requiredCount ] [--priority ] @@ -16,12 +19,42 @@ csdk app-level-requirement delete --id ## Examples -### List all appLevelRequirement records +### List appLevelRequirement records ```bash csdk app-level-requirement list ``` +### List appLevelRequirement records with pagination + +```bash +csdk app-level-requirement list --limit 10 --offset 0 +``` + +### List appLevelRequirement records with cursor pagination + +```bash +csdk app-level-requirement list --limit 10 --after +``` + +### Find first matching appLevelRequirement + +```bash +csdk app-level-requirement find-first --where.id.equalTo +``` + +### List appLevelRequirement records with field selection + +```bash +csdk app-level-requirement list --select id,id +``` + +### List appLevelRequirement records with filtering and ordering + +```bash +csdk app-level-requirement list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLevelRequirement ```bash diff --git a/.agents/skills/cli-admin/references/app-level.md b/.agents/skills/cli-admin/references/app-level.md index e02091191..8c44edf92 100644 --- a/.agents/skills/cli-admin/references/app-level.md +++ b/.agents/skills/cli-admin/references/app-level.md @@ -8,6 +8,9 @@ CRUD operations for AppLevel records via csdk CLI ```bash csdk app-level list +csdk app-level list --where.. --orderBy +csdk app-level list --limit 10 --after +csdk app-level find-first --where.. csdk app-level get --id csdk app-level create --name [--description ] [--image ] [--ownerId ] csdk app-level update --id [--name ] [--description ] [--image ] [--ownerId ] @@ -16,12 +19,42 @@ csdk app-level delete --id ## Examples -### List all appLevel records +### List appLevel records ```bash csdk app-level list ``` +### List appLevel records with pagination + +```bash +csdk app-level list --limit 10 --offset 0 +``` + +### List appLevel records with cursor pagination + +```bash +csdk app-level list --limit 10 --after +``` + +### Find first matching appLevel + +```bash +csdk app-level find-first --where.id.equalTo +``` + +### List appLevel records with field selection + +```bash +csdk app-level list --select id,id +``` + +### List appLevel records with filtering and ordering + +```bash +csdk app-level list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLevel ```bash diff --git a/.agents/skills/cli-admin/references/app-limit-default.md b/.agents/skills/cli-admin/references/app-limit-default.md index d29ead549..3acad75f5 100644 --- a/.agents/skills/cli-admin/references/app-limit-default.md +++ b/.agents/skills/cli-admin/references/app-limit-default.md @@ -8,6 +8,9 @@ CRUD operations for AppLimitDefault records via csdk CLI ```bash csdk app-limit-default list +csdk app-limit-default list --where.. --orderBy +csdk app-limit-default list --limit 10 --after +csdk app-limit-default find-first --where.. csdk app-limit-default get --id csdk app-limit-default create --name [--max ] csdk app-limit-default update --id [--name ] [--max ] @@ -16,12 +19,42 @@ csdk app-limit-default delete --id ## Examples -### List all appLimitDefault records +### List appLimitDefault records ```bash csdk app-limit-default list ``` +### List appLimitDefault records with pagination + +```bash +csdk app-limit-default list --limit 10 --offset 0 +``` + +### List appLimitDefault records with cursor pagination + +```bash +csdk app-limit-default list --limit 10 --after +``` + +### Find first matching appLimitDefault + +```bash +csdk app-limit-default find-first --where.id.equalTo +``` + +### List appLimitDefault records with field selection + +```bash +csdk app-limit-default list --select id,id +``` + +### List appLimitDefault records with filtering and ordering + +```bash +csdk app-limit-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLimitDefault ```bash diff --git a/.agents/skills/cli-admin/references/app-limit.md b/.agents/skills/cli-admin/references/app-limit.md index a164f5c9d..1b995e011 100644 --- a/.agents/skills/cli-admin/references/app-limit.md +++ b/.agents/skills/cli-admin/references/app-limit.md @@ -8,6 +8,9 @@ CRUD operations for AppLimit records via csdk CLI ```bash csdk app-limit list +csdk app-limit list --where.. --orderBy +csdk app-limit list --limit 10 --after +csdk app-limit find-first --where.. csdk app-limit get --id csdk app-limit create --actorId [--name ] [--num ] [--max ] csdk app-limit update --id [--name ] [--actorId ] [--num ] [--max ] @@ -16,12 +19,42 @@ csdk app-limit delete --id ## Examples -### List all appLimit records +### List appLimit records ```bash csdk app-limit list ``` +### List appLimit records with pagination + +```bash +csdk app-limit list --limit 10 --offset 0 +``` + +### List appLimit records with cursor pagination + +```bash +csdk app-limit list --limit 10 --after +``` + +### Find first matching appLimit + +```bash +csdk app-limit find-first --where.id.equalTo +``` + +### List appLimit records with field selection + +```bash +csdk app-limit list --select id,id +``` + +### List appLimit records with filtering and ordering + +```bash +csdk app-limit list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLimit ```bash diff --git a/.agents/skills/cli-admin/references/app-membership-default.md b/.agents/skills/cli-admin/references/app-membership-default.md index da2a194e0..836c99bef 100644 --- a/.agents/skills/cli-admin/references/app-membership-default.md +++ b/.agents/skills/cli-admin/references/app-membership-default.md @@ -8,6 +8,9 @@ CRUD operations for AppMembershipDefault records via csdk CLI ```bash csdk app-membership-default list +csdk app-membership-default list --where.. --orderBy +csdk app-membership-default list --limit 10 --after +csdk app-membership-default find-first --where.. csdk app-membership-default get --id csdk app-membership-default create [--createdBy ] [--updatedBy ] [--isApproved ] [--isVerified ] csdk app-membership-default update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--isVerified ] @@ -16,12 +19,42 @@ csdk app-membership-default delete --id ## Examples -### List all appMembershipDefault records +### List appMembershipDefault records ```bash csdk app-membership-default list ``` +### List appMembershipDefault records with pagination + +```bash +csdk app-membership-default list --limit 10 --offset 0 +``` + +### List appMembershipDefault records with cursor pagination + +```bash +csdk app-membership-default list --limit 10 --after +``` + +### Find first matching appMembershipDefault + +```bash +csdk app-membership-default find-first --where.id.equalTo +``` + +### List appMembershipDefault records with field selection + +```bash +csdk app-membership-default list --select id,id +``` + +### List appMembershipDefault records with filtering and ordering + +```bash +csdk app-membership-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appMembershipDefault ```bash diff --git a/.agents/skills/cli-admin/references/app-membership.md b/.agents/skills/cli-admin/references/app-membership.md index 0b5e5fb3b..c58e06de7 100644 --- a/.agents/skills/cli-admin/references/app-membership.md +++ b/.agents/skills/cli-admin/references/app-membership.md @@ -8,6 +8,9 @@ CRUD operations for AppMembership records via csdk CLI ```bash csdk app-membership list +csdk app-membership list --where.. --orderBy +csdk app-membership list --limit 10 --after +csdk app-membership find-first --where.. csdk app-membership get --id csdk app-membership create --actorId [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isVerified ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--profileId ] csdk app-membership update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isVerified ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--actorId ] [--profileId ] @@ -16,12 +19,42 @@ csdk app-membership delete --id ## Examples -### List all appMembership records +### List appMembership records ```bash csdk app-membership list ``` +### List appMembership records with pagination + +```bash +csdk app-membership list --limit 10 --offset 0 +``` + +### List appMembership records with cursor pagination + +```bash +csdk app-membership list --limit 10 --after +``` + +### Find first matching appMembership + +```bash +csdk app-membership find-first --where.id.equalTo +``` + +### List appMembership records with field selection + +```bash +csdk app-membership list --select id,id +``` + +### List appMembership records with filtering and ordering + +```bash +csdk app-membership list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appMembership ```bash diff --git a/.agents/skills/cli-admin/references/app-owner-grant.md b/.agents/skills/cli-admin/references/app-owner-grant.md index cf34fe8f0..9884f4a52 100644 --- a/.agents/skills/cli-admin/references/app-owner-grant.md +++ b/.agents/skills/cli-admin/references/app-owner-grant.md @@ -8,6 +8,9 @@ CRUD operations for AppOwnerGrant records via csdk CLI ```bash csdk app-owner-grant list +csdk app-owner-grant list --where.. --orderBy +csdk app-owner-grant list --limit 10 --after +csdk app-owner-grant find-first --where.. csdk app-owner-grant get --id csdk app-owner-grant create --actorId [--isGrant ] [--grantorId ] csdk app-owner-grant update --id [--isGrant ] [--actorId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk app-owner-grant delete --id ## Examples -### List all appOwnerGrant records +### List appOwnerGrant records ```bash csdk app-owner-grant list ``` +### List appOwnerGrant records with pagination + +```bash +csdk app-owner-grant list --limit 10 --offset 0 +``` + +### List appOwnerGrant records with cursor pagination + +```bash +csdk app-owner-grant list --limit 10 --after +``` + +### Find first matching appOwnerGrant + +```bash +csdk app-owner-grant find-first --where.id.equalTo +``` + +### List appOwnerGrant records with field selection + +```bash +csdk app-owner-grant list --select id,id +``` + +### List appOwnerGrant records with filtering and ordering + +```bash +csdk app-owner-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appOwnerGrant ```bash diff --git a/.agents/skills/cli-admin/references/app-permission-default.md b/.agents/skills/cli-admin/references/app-permission-default.md index 6be7c4fc6..86ef24503 100644 --- a/.agents/skills/cli-admin/references/app-permission-default.md +++ b/.agents/skills/cli-admin/references/app-permission-default.md @@ -8,6 +8,9 @@ CRUD operations for AppPermissionDefault records via csdk CLI ```bash csdk app-permission-default list +csdk app-permission-default list --where.. --orderBy +csdk app-permission-default list --limit 10 --after +csdk app-permission-default find-first --where.. csdk app-permission-default get --id csdk app-permission-default create [--permissions ] csdk app-permission-default update --id [--permissions ] @@ -16,12 +19,42 @@ csdk app-permission-default delete --id ## Examples -### List all appPermissionDefault records +### List appPermissionDefault records ```bash csdk app-permission-default list ``` +### List appPermissionDefault records with pagination + +```bash +csdk app-permission-default list --limit 10 --offset 0 +``` + +### List appPermissionDefault records with cursor pagination + +```bash +csdk app-permission-default list --limit 10 --after +``` + +### Find first matching appPermissionDefault + +```bash +csdk app-permission-default find-first --where.id.equalTo +``` + +### List appPermissionDefault records with field selection + +```bash +csdk app-permission-default list --select id,id +``` + +### List appPermissionDefault records with filtering and ordering + +```bash +csdk app-permission-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appPermissionDefault ```bash diff --git a/.agents/skills/cli-admin/references/app-permission.md b/.agents/skills/cli-admin/references/app-permission.md index cc7ed0f1e..82c849598 100644 --- a/.agents/skills/cli-admin/references/app-permission.md +++ b/.agents/skills/cli-admin/references/app-permission.md @@ -8,6 +8,9 @@ CRUD operations for AppPermission records via csdk CLI ```bash csdk app-permission list +csdk app-permission list --where.. --orderBy +csdk app-permission list --limit 10 --after +csdk app-permission find-first --where.. csdk app-permission get --id csdk app-permission create [--name ] [--bitnum ] [--bitstr ] [--description ] csdk app-permission update --id [--name ] [--bitnum ] [--bitstr ] [--description ] @@ -16,12 +19,42 @@ csdk app-permission delete --id ## Examples -### List all appPermission records +### List appPermission records ```bash csdk app-permission list ``` +### List appPermission records with pagination + +```bash +csdk app-permission list --limit 10 --offset 0 +``` + +### List appPermission records with cursor pagination + +```bash +csdk app-permission list --limit 10 --after +``` + +### Find first matching appPermission + +```bash +csdk app-permission find-first --where.id.equalTo +``` + +### List appPermission records with field selection + +```bash +csdk app-permission list --select id,id +``` + +### List appPermission records with filtering and ordering + +```bash +csdk app-permission list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appPermission ```bash diff --git a/.agents/skills/cli-admin/references/app-step.md b/.agents/skills/cli-admin/references/app-step.md index fe3da0029..7495cb26b 100644 --- a/.agents/skills/cli-admin/references/app-step.md +++ b/.agents/skills/cli-admin/references/app-step.md @@ -8,6 +8,9 @@ CRUD operations for AppStep records via csdk CLI ```bash csdk app-step list +csdk app-step list --where.. --orderBy +csdk app-step list --limit 10 --after +csdk app-step find-first --where.. csdk app-step get --id csdk app-step create --name [--actorId ] [--count ] csdk app-step update --id [--actorId ] [--name ] [--count ] @@ -16,12 +19,42 @@ csdk app-step delete --id ## Examples -### List all appStep records +### List appStep records ```bash csdk app-step list ``` +### List appStep records with pagination + +```bash +csdk app-step list --limit 10 --offset 0 +``` + +### List appStep records with cursor pagination + +```bash +csdk app-step list --limit 10 --after +``` + +### Find first matching appStep + +```bash +csdk app-step find-first --where.id.equalTo +``` + +### List appStep records with field selection + +```bash +csdk app-step list --select id,id +``` + +### List appStep records with filtering and ordering + +```bash +csdk app-step list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appStep ```bash diff --git a/.agents/skills/cli-admin/references/claimed-invite.md b/.agents/skills/cli-admin/references/claimed-invite.md index eb3b4d390..104b1753c 100644 --- a/.agents/skills/cli-admin/references/claimed-invite.md +++ b/.agents/skills/cli-admin/references/claimed-invite.md @@ -8,6 +8,9 @@ CRUD operations for ClaimedInvite records via csdk CLI ```bash csdk claimed-invite list +csdk claimed-invite list --where.. --orderBy +csdk claimed-invite list --limit 10 --after +csdk claimed-invite find-first --where.. csdk claimed-invite get --id csdk claimed-invite create [--data ] [--senderId ] [--receiverId ] csdk claimed-invite update --id [--data ] [--senderId ] [--receiverId ] @@ -16,12 +19,42 @@ csdk claimed-invite delete --id ## Examples -### List all claimedInvite records +### List claimedInvite records ```bash csdk claimed-invite list ``` +### List claimedInvite records with pagination + +```bash +csdk claimed-invite list --limit 10 --offset 0 +``` + +### List claimedInvite records with cursor pagination + +```bash +csdk claimed-invite list --limit 10 --after +``` + +### Find first matching claimedInvite + +```bash +csdk claimed-invite find-first --where.id.equalTo +``` + +### List claimedInvite records with field selection + +```bash +csdk claimed-invite list --select id,id +``` + +### List claimedInvite records with filtering and ordering + +```bash +csdk claimed-invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a claimedInvite ```bash diff --git a/.agents/skills/cli-admin/references/invite.md b/.agents/skills/cli-admin/references/invite.md index c2f5ecced..640c18bd1 100644 --- a/.agents/skills/cli-admin/references/invite.md +++ b/.agents/skills/cli-admin/references/invite.md @@ -8,6 +8,9 @@ CRUD operations for Invite records via csdk CLI ```bash csdk invite list +csdk invite list --where.. --orderBy +csdk invite list --limit 10 --after +csdk invite find-first --where.. csdk invite get --id csdk invite create [--email ] [--senderId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] csdk invite update --id [--email ] [--senderId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] @@ -16,12 +19,42 @@ csdk invite delete --id ## Examples -### List all invite records +### List invite records ```bash csdk invite list ``` +### List invite records with pagination + +```bash +csdk invite list --limit 10 --offset 0 +``` + +### List invite records with cursor pagination + +```bash +csdk invite list --limit 10 --after +``` + +### Find first matching invite + +```bash +csdk invite find-first --where.id.equalTo +``` + +### List invite records with field selection + +```bash +csdk invite list --select id,id +``` + +### List invite records with filtering and ordering + +```bash +csdk invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a invite ```bash diff --git a/.agents/skills/cli-admin/references/membership-type.md b/.agents/skills/cli-admin/references/membership-type.md index d7d30e4da..657508364 100644 --- a/.agents/skills/cli-admin/references/membership-type.md +++ b/.agents/skills/cli-admin/references/membership-type.md @@ -8,6 +8,9 @@ CRUD operations for MembershipType records via csdk CLI ```bash csdk membership-type list +csdk membership-type list --where.. --orderBy +csdk membership-type list --limit 10 --after +csdk membership-type find-first --where.. csdk membership-type get --id csdk membership-type create --name --description --prefix csdk membership-type update --id [--name ] [--description ] [--prefix ] @@ -16,12 +19,42 @@ csdk membership-type delete --id ## Examples -### List all membershipType records +### List membershipType records ```bash csdk membership-type list ``` +### List membershipType records with pagination + +```bash +csdk membership-type list --limit 10 --offset 0 +``` + +### List membershipType records with cursor pagination + +```bash +csdk membership-type list --limit 10 --after +``` + +### Find first matching membershipType + +```bash +csdk membership-type find-first --where.id.equalTo +``` + +### List membershipType records with field selection + +```bash +csdk membership-type list --select id,id +``` + +### List membershipType records with filtering and ordering + +```bash +csdk membership-type list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a membershipType ```bash diff --git a/.agents/skills/cli-admin/references/org-admin-grant.md b/.agents/skills/cli-admin/references/org-admin-grant.md index c218e0190..82488b55c 100644 --- a/.agents/skills/cli-admin/references/org-admin-grant.md +++ b/.agents/skills/cli-admin/references/org-admin-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgAdminGrant records via csdk CLI ```bash csdk org-admin-grant list +csdk org-admin-grant list --where.. --orderBy +csdk org-admin-grant list --limit 10 --after +csdk org-admin-grant find-first --where.. csdk org-admin-grant get --id csdk org-admin-grant create --actorId --entityId [--isGrant ] [--grantorId ] csdk org-admin-grant update --id [--isGrant ] [--actorId ] [--entityId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk org-admin-grant delete --id ## Examples -### List all orgAdminGrant records +### List orgAdminGrant records ```bash csdk org-admin-grant list ``` +### List orgAdminGrant records with pagination + +```bash +csdk org-admin-grant list --limit 10 --offset 0 +``` + +### List orgAdminGrant records with cursor pagination + +```bash +csdk org-admin-grant list --limit 10 --after +``` + +### Find first matching orgAdminGrant + +```bash +csdk org-admin-grant find-first --where.id.equalTo +``` + +### List orgAdminGrant records with field selection + +```bash +csdk org-admin-grant list --select id,id +``` + +### List orgAdminGrant records with filtering and ordering + +```bash +csdk org-admin-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgAdminGrant ```bash diff --git a/.agents/skills/cli-admin/references/org-chart-edge-grant.md b/.agents/skills/cli-admin/references/org-chart-edge-grant.md index 3cdca07be..008cc0452 100644 --- a/.agents/skills/cli-admin/references/org-chart-edge-grant.md +++ b/.agents/skills/cli-admin/references/org-chart-edge-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgChartEdgeGrant records via csdk CLI ```bash csdk org-chart-edge-grant list +csdk org-chart-edge-grant list --where.. --orderBy +csdk org-chart-edge-grant list --limit 10 --after +csdk org-chart-edge-grant find-first --where.. csdk org-chart-edge-grant get --id csdk org-chart-edge-grant create --entityId --childId [--parentId ] [--grantorId ] [--isGrant ] [--positionTitle ] [--positionLevel ] csdk org-chart-edge-grant update --id [--entityId ] [--childId ] [--parentId ] [--grantorId ] [--isGrant ] [--positionTitle ] [--positionLevel ] @@ -16,12 +19,42 @@ csdk org-chart-edge-grant delete --id ## Examples -### List all orgChartEdgeGrant records +### List orgChartEdgeGrant records ```bash csdk org-chart-edge-grant list ``` +### List orgChartEdgeGrant records with pagination + +```bash +csdk org-chart-edge-grant list --limit 10 --offset 0 +``` + +### List orgChartEdgeGrant records with cursor pagination + +```bash +csdk org-chart-edge-grant list --limit 10 --after +``` + +### Find first matching orgChartEdgeGrant + +```bash +csdk org-chart-edge-grant find-first --where.id.equalTo +``` + +### List orgChartEdgeGrant records with field selection + +```bash +csdk org-chart-edge-grant list --select id,id +``` + +### List orgChartEdgeGrant records with filtering and ordering + +```bash +csdk org-chart-edge-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgChartEdgeGrant ```bash diff --git a/.agents/skills/cli-admin/references/org-chart-edge.md b/.agents/skills/cli-admin/references/org-chart-edge.md index 324cd6f53..0153401f4 100644 --- a/.agents/skills/cli-admin/references/org-chart-edge.md +++ b/.agents/skills/cli-admin/references/org-chart-edge.md @@ -8,6 +8,9 @@ CRUD operations for OrgChartEdge records via csdk CLI ```bash csdk org-chart-edge list +csdk org-chart-edge list --where.. --orderBy +csdk org-chart-edge list --limit 10 --after +csdk org-chart-edge find-first --where.. csdk org-chart-edge get --id csdk org-chart-edge create --entityId --childId [--parentId ] [--positionTitle ] [--positionLevel ] csdk org-chart-edge update --id [--entityId ] [--childId ] [--parentId ] [--positionTitle ] [--positionLevel ] @@ -16,12 +19,42 @@ csdk org-chart-edge delete --id ## Examples -### List all orgChartEdge records +### List orgChartEdge records ```bash csdk org-chart-edge list ``` +### List orgChartEdge records with pagination + +```bash +csdk org-chart-edge list --limit 10 --offset 0 +``` + +### List orgChartEdge records with cursor pagination + +```bash +csdk org-chart-edge list --limit 10 --after +``` + +### Find first matching orgChartEdge + +```bash +csdk org-chart-edge find-first --where.id.equalTo +``` + +### List orgChartEdge records with field selection + +```bash +csdk org-chart-edge list --select id,id +``` + +### List orgChartEdge records with filtering and ordering + +```bash +csdk org-chart-edge list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgChartEdge ```bash diff --git a/.agents/skills/cli-admin/references/org-claimed-invite.md b/.agents/skills/cli-admin/references/org-claimed-invite.md index c5bbd2520..3ba4a9c08 100644 --- a/.agents/skills/cli-admin/references/org-claimed-invite.md +++ b/.agents/skills/cli-admin/references/org-claimed-invite.md @@ -8,6 +8,9 @@ CRUD operations for OrgClaimedInvite records via csdk CLI ```bash csdk org-claimed-invite list +csdk org-claimed-invite list --where.. --orderBy +csdk org-claimed-invite list --limit 10 --after +csdk org-claimed-invite find-first --where.. csdk org-claimed-invite get --id csdk org-claimed-invite create --entityId [--data ] [--senderId ] [--receiverId ] csdk org-claimed-invite update --id [--data ] [--senderId ] [--receiverId ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-claimed-invite delete --id ## Examples -### List all orgClaimedInvite records +### List orgClaimedInvite records ```bash csdk org-claimed-invite list ``` +### List orgClaimedInvite records with pagination + +```bash +csdk org-claimed-invite list --limit 10 --offset 0 +``` + +### List orgClaimedInvite records with cursor pagination + +```bash +csdk org-claimed-invite list --limit 10 --after +``` + +### Find first matching orgClaimedInvite + +```bash +csdk org-claimed-invite find-first --where.id.equalTo +``` + +### List orgClaimedInvite records with field selection + +```bash +csdk org-claimed-invite list --select id,id +``` + +### List orgClaimedInvite records with filtering and ordering + +```bash +csdk org-claimed-invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgClaimedInvite ```bash diff --git a/.agents/skills/cli-admin/references/org-get-managers-record.md b/.agents/skills/cli-admin/references/org-get-managers-record.md index 2ba1c77eb..46d21f702 100644 --- a/.agents/skills/cli-admin/references/org-get-managers-record.md +++ b/.agents/skills/cli-admin/references/org-get-managers-record.md @@ -8,6 +8,9 @@ CRUD operations for OrgGetManagersRecord records via csdk CLI ```bash csdk org-get-managers-record list +csdk org-get-managers-record list --where.. --orderBy +csdk org-get-managers-record list --limit 10 --after +csdk org-get-managers-record find-first --where.. csdk org-get-managers-record get --id csdk org-get-managers-record create --userId --depth csdk org-get-managers-record update --id [--userId ] [--depth ] @@ -16,12 +19,42 @@ csdk org-get-managers-record delete --id ## Examples -### List all orgGetManagersRecord records +### List orgGetManagersRecord records ```bash csdk org-get-managers-record list ``` +### List orgGetManagersRecord records with pagination + +```bash +csdk org-get-managers-record list --limit 10 --offset 0 +``` + +### List orgGetManagersRecord records with cursor pagination + +```bash +csdk org-get-managers-record list --limit 10 --after +``` + +### Find first matching orgGetManagersRecord + +```bash +csdk org-get-managers-record find-first --where.id.equalTo +``` + +### List orgGetManagersRecord records with field selection + +```bash +csdk org-get-managers-record list --select id,id +``` + +### List orgGetManagersRecord records with filtering and ordering + +```bash +csdk org-get-managers-record list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgGetManagersRecord ```bash diff --git a/.agents/skills/cli-admin/references/org-get-subordinates-record.md b/.agents/skills/cli-admin/references/org-get-subordinates-record.md index a2eba788a..0e36be169 100644 --- a/.agents/skills/cli-admin/references/org-get-subordinates-record.md +++ b/.agents/skills/cli-admin/references/org-get-subordinates-record.md @@ -8,6 +8,9 @@ CRUD operations for OrgGetSubordinatesRecord records via csdk CLI ```bash csdk org-get-subordinates-record list +csdk org-get-subordinates-record list --where.. --orderBy +csdk org-get-subordinates-record list --limit 10 --after +csdk org-get-subordinates-record find-first --where.. csdk org-get-subordinates-record get --id csdk org-get-subordinates-record create --userId --depth csdk org-get-subordinates-record update --id [--userId ] [--depth ] @@ -16,12 +19,42 @@ csdk org-get-subordinates-record delete --id ## Examples -### List all orgGetSubordinatesRecord records +### List orgGetSubordinatesRecord records ```bash csdk org-get-subordinates-record list ``` +### List orgGetSubordinatesRecord records with pagination + +```bash +csdk org-get-subordinates-record list --limit 10 --offset 0 +``` + +### List orgGetSubordinatesRecord records with cursor pagination + +```bash +csdk org-get-subordinates-record list --limit 10 --after +``` + +### Find first matching orgGetSubordinatesRecord + +```bash +csdk org-get-subordinates-record find-first --where.id.equalTo +``` + +### List orgGetSubordinatesRecord records with field selection + +```bash +csdk org-get-subordinates-record list --select id,id +``` + +### List orgGetSubordinatesRecord records with filtering and ordering + +```bash +csdk org-get-subordinates-record list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgGetSubordinatesRecord ```bash diff --git a/.agents/skills/cli-admin/references/org-grant.md b/.agents/skills/cli-admin/references/org-grant.md index 145753a49..b03e47787 100644 --- a/.agents/skills/cli-admin/references/org-grant.md +++ b/.agents/skills/cli-admin/references/org-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgGrant records via csdk CLI ```bash csdk org-grant list +csdk org-grant list --where.. --orderBy +csdk org-grant list --limit 10 --after +csdk org-grant find-first --where.. csdk org-grant get --id csdk org-grant create --actorId --entityId [--permissions ] [--isGrant ] [--grantorId ] csdk org-grant update --id [--permissions ] [--isGrant ] [--actorId ] [--entityId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk org-grant delete --id ## Examples -### List all orgGrant records +### List orgGrant records ```bash csdk org-grant list ``` +### List orgGrant records with pagination + +```bash +csdk org-grant list --limit 10 --offset 0 +``` + +### List orgGrant records with cursor pagination + +```bash +csdk org-grant list --limit 10 --after +``` + +### Find first matching orgGrant + +```bash +csdk org-grant find-first --where.id.equalTo +``` + +### List orgGrant records with field selection + +```bash +csdk org-grant list --select id,id +``` + +### List orgGrant records with filtering and ordering + +```bash +csdk org-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgGrant ```bash diff --git a/.agents/skills/cli-admin/references/org-invite.md b/.agents/skills/cli-admin/references/org-invite.md index 617044171..1f48d7b17 100644 --- a/.agents/skills/cli-admin/references/org-invite.md +++ b/.agents/skills/cli-admin/references/org-invite.md @@ -8,6 +8,9 @@ CRUD operations for OrgInvite records via csdk CLI ```bash csdk org-invite list +csdk org-invite list --where.. --orderBy +csdk org-invite list --limit 10 --after +csdk org-invite find-first --where.. csdk org-invite get --id csdk org-invite create --entityId [--email ] [--senderId ] [--receiverId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] csdk org-invite update --id [--email ] [--senderId ] [--receiverId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-invite delete --id ## Examples -### List all orgInvite records +### List orgInvite records ```bash csdk org-invite list ``` +### List orgInvite records with pagination + +```bash +csdk org-invite list --limit 10 --offset 0 +``` + +### List orgInvite records with cursor pagination + +```bash +csdk org-invite list --limit 10 --after +``` + +### Find first matching orgInvite + +```bash +csdk org-invite find-first --where.id.equalTo +``` + +### List orgInvite records with field selection + +```bash +csdk org-invite list --select id,id +``` + +### List orgInvite records with filtering and ordering + +```bash +csdk org-invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgInvite ```bash diff --git a/.agents/skills/cli-admin/references/org-limit-default.md b/.agents/skills/cli-admin/references/org-limit-default.md index cd194fb49..017e51f53 100644 --- a/.agents/skills/cli-admin/references/org-limit-default.md +++ b/.agents/skills/cli-admin/references/org-limit-default.md @@ -8,6 +8,9 @@ CRUD operations for OrgLimitDefault records via csdk CLI ```bash csdk org-limit-default list +csdk org-limit-default list --where.. --orderBy +csdk org-limit-default list --limit 10 --after +csdk org-limit-default find-first --where.. csdk org-limit-default get --id csdk org-limit-default create --name [--max ] csdk org-limit-default update --id [--name ] [--max ] @@ -16,12 +19,42 @@ csdk org-limit-default delete --id ## Examples -### List all orgLimitDefault records +### List orgLimitDefault records ```bash csdk org-limit-default list ``` +### List orgLimitDefault records with pagination + +```bash +csdk org-limit-default list --limit 10 --offset 0 +``` + +### List orgLimitDefault records with cursor pagination + +```bash +csdk org-limit-default list --limit 10 --after +``` + +### Find first matching orgLimitDefault + +```bash +csdk org-limit-default find-first --where.id.equalTo +``` + +### List orgLimitDefault records with field selection + +```bash +csdk org-limit-default list --select id,id +``` + +### List orgLimitDefault records with filtering and ordering + +```bash +csdk org-limit-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgLimitDefault ```bash diff --git a/.agents/skills/cli-admin/references/org-limit.md b/.agents/skills/cli-admin/references/org-limit.md index 39759354c..e3ba12bd9 100644 --- a/.agents/skills/cli-admin/references/org-limit.md +++ b/.agents/skills/cli-admin/references/org-limit.md @@ -8,6 +8,9 @@ CRUD operations for OrgLimit records via csdk CLI ```bash csdk org-limit list +csdk org-limit list --where.. --orderBy +csdk org-limit list --limit 10 --after +csdk org-limit find-first --where.. csdk org-limit get --id csdk org-limit create --actorId --entityId [--name ] [--num ] [--max ] csdk org-limit update --id [--name ] [--actorId ] [--num ] [--max ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-limit delete --id ## Examples -### List all orgLimit records +### List orgLimit records ```bash csdk org-limit list ``` +### List orgLimit records with pagination + +```bash +csdk org-limit list --limit 10 --offset 0 +``` + +### List orgLimit records with cursor pagination + +```bash +csdk org-limit list --limit 10 --after +``` + +### Find first matching orgLimit + +```bash +csdk org-limit find-first --where.id.equalTo +``` + +### List orgLimit records with field selection + +```bash +csdk org-limit list --select id,id +``` + +### List orgLimit records with filtering and ordering + +```bash +csdk org-limit list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgLimit ```bash diff --git a/.agents/skills/cli-admin/references/org-member.md b/.agents/skills/cli-admin/references/org-member.md index 5b21dd4ad..c1019fee5 100644 --- a/.agents/skills/cli-admin/references/org-member.md +++ b/.agents/skills/cli-admin/references/org-member.md @@ -8,6 +8,9 @@ CRUD operations for OrgMember records via csdk CLI ```bash csdk org-member list +csdk org-member list --where.. --orderBy +csdk org-member list --limit 10 --after +csdk org-member find-first --where.. csdk org-member get --id csdk org-member create --actorId --entityId [--isAdmin ] csdk org-member update --id [--isAdmin ] [--actorId ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-member delete --id ## Examples -### List all orgMember records +### List orgMember records ```bash csdk org-member list ``` +### List orgMember records with pagination + +```bash +csdk org-member list --limit 10 --offset 0 +``` + +### List orgMember records with cursor pagination + +```bash +csdk org-member list --limit 10 --after +``` + +### Find first matching orgMember + +```bash +csdk org-member find-first --where.id.equalTo +``` + +### List orgMember records with field selection + +```bash +csdk org-member list --select id,id +``` + +### List orgMember records with filtering and ordering + +```bash +csdk org-member list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgMember ```bash diff --git a/.agents/skills/cli-admin/references/org-membership-default.md b/.agents/skills/cli-admin/references/org-membership-default.md index a76cae763..08862abd5 100644 --- a/.agents/skills/cli-admin/references/org-membership-default.md +++ b/.agents/skills/cli-admin/references/org-membership-default.md @@ -8,6 +8,9 @@ CRUD operations for OrgMembershipDefault records via csdk CLI ```bash csdk org-membership-default list +csdk org-membership-default list --where.. --orderBy +csdk org-membership-default list --limit 10 --after +csdk org-membership-default find-first --where.. csdk org-membership-default get --id csdk org-membership-default create --entityId [--createdBy ] [--updatedBy ] [--isApproved ] [--deleteMemberCascadeGroups ] [--createGroupsCascadeMembers ] csdk org-membership-default update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--entityId ] [--deleteMemberCascadeGroups ] [--createGroupsCascadeMembers ] @@ -16,12 +19,42 @@ csdk org-membership-default delete --id ## Examples -### List all orgMembershipDefault records +### List orgMembershipDefault records ```bash csdk org-membership-default list ``` +### List orgMembershipDefault records with pagination + +```bash +csdk org-membership-default list --limit 10 --offset 0 +``` + +### List orgMembershipDefault records with cursor pagination + +```bash +csdk org-membership-default list --limit 10 --after +``` + +### Find first matching orgMembershipDefault + +```bash +csdk org-membership-default find-first --where.id.equalTo +``` + +### List orgMembershipDefault records with field selection + +```bash +csdk org-membership-default list --select id,id +``` + +### List orgMembershipDefault records with filtering and ordering + +```bash +csdk org-membership-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgMembershipDefault ```bash diff --git a/.agents/skills/cli-admin/references/org-membership.md b/.agents/skills/cli-admin/references/org-membership.md index acae0207f..f8ea35463 100644 --- a/.agents/skills/cli-admin/references/org-membership.md +++ b/.agents/skills/cli-admin/references/org-membership.md @@ -8,6 +8,9 @@ CRUD operations for OrgMembership records via csdk CLI ```bash csdk org-membership list +csdk org-membership list --where.. --orderBy +csdk org-membership list --limit 10 --after +csdk org-membership find-first --where.. csdk org-membership get --id csdk org-membership create --actorId --entityId [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--profileId ] csdk org-membership update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--actorId ] [--entityId ] [--profileId ] @@ -16,12 +19,42 @@ csdk org-membership delete --id ## Examples -### List all orgMembership records +### List orgMembership records ```bash csdk org-membership list ``` +### List orgMembership records with pagination + +```bash +csdk org-membership list --limit 10 --offset 0 +``` + +### List orgMembership records with cursor pagination + +```bash +csdk org-membership list --limit 10 --after +``` + +### Find first matching orgMembership + +```bash +csdk org-membership find-first --where.id.equalTo +``` + +### List orgMembership records with field selection + +```bash +csdk org-membership list --select id,id +``` + +### List orgMembership records with filtering and ordering + +```bash +csdk org-membership list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgMembership ```bash diff --git a/.agents/skills/cli-admin/references/org-owner-grant.md b/.agents/skills/cli-admin/references/org-owner-grant.md index 21431f91a..e354a4b4f 100644 --- a/.agents/skills/cli-admin/references/org-owner-grant.md +++ b/.agents/skills/cli-admin/references/org-owner-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgOwnerGrant records via csdk CLI ```bash csdk org-owner-grant list +csdk org-owner-grant list --where.. --orderBy +csdk org-owner-grant list --limit 10 --after +csdk org-owner-grant find-first --where.. csdk org-owner-grant get --id csdk org-owner-grant create --actorId --entityId [--isGrant ] [--grantorId ] csdk org-owner-grant update --id [--isGrant ] [--actorId ] [--entityId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk org-owner-grant delete --id ## Examples -### List all orgOwnerGrant records +### List orgOwnerGrant records ```bash csdk org-owner-grant list ``` +### List orgOwnerGrant records with pagination + +```bash +csdk org-owner-grant list --limit 10 --offset 0 +``` + +### List orgOwnerGrant records with cursor pagination + +```bash +csdk org-owner-grant list --limit 10 --after +``` + +### Find first matching orgOwnerGrant + +```bash +csdk org-owner-grant find-first --where.id.equalTo +``` + +### List orgOwnerGrant records with field selection + +```bash +csdk org-owner-grant list --select id,id +``` + +### List orgOwnerGrant records with filtering and ordering + +```bash +csdk org-owner-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgOwnerGrant ```bash diff --git a/.agents/skills/cli-admin/references/org-permission-default.md b/.agents/skills/cli-admin/references/org-permission-default.md index cbbbcdb67..41e903345 100644 --- a/.agents/skills/cli-admin/references/org-permission-default.md +++ b/.agents/skills/cli-admin/references/org-permission-default.md @@ -8,6 +8,9 @@ CRUD operations for OrgPermissionDefault records via csdk CLI ```bash csdk org-permission-default list +csdk org-permission-default list --where.. --orderBy +csdk org-permission-default list --limit 10 --after +csdk org-permission-default find-first --where.. csdk org-permission-default get --id csdk org-permission-default create --entityId [--permissions ] csdk org-permission-default update --id [--permissions ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-permission-default delete --id ## Examples -### List all orgPermissionDefault records +### List orgPermissionDefault records ```bash csdk org-permission-default list ``` +### List orgPermissionDefault records with pagination + +```bash +csdk org-permission-default list --limit 10 --offset 0 +``` + +### List orgPermissionDefault records with cursor pagination + +```bash +csdk org-permission-default list --limit 10 --after +``` + +### Find first matching orgPermissionDefault + +```bash +csdk org-permission-default find-first --where.id.equalTo +``` + +### List orgPermissionDefault records with field selection + +```bash +csdk org-permission-default list --select id,id +``` + +### List orgPermissionDefault records with filtering and ordering + +```bash +csdk org-permission-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgPermissionDefault ```bash diff --git a/.agents/skills/cli-admin/references/org-permission.md b/.agents/skills/cli-admin/references/org-permission.md index 623dba5e2..26b1805d2 100644 --- a/.agents/skills/cli-admin/references/org-permission.md +++ b/.agents/skills/cli-admin/references/org-permission.md @@ -8,6 +8,9 @@ CRUD operations for OrgPermission records via csdk CLI ```bash csdk org-permission list +csdk org-permission list --where.. --orderBy +csdk org-permission list --limit 10 --after +csdk org-permission find-first --where.. csdk org-permission get --id csdk org-permission create [--name ] [--bitnum ] [--bitstr ] [--description ] csdk org-permission update --id [--name ] [--bitnum ] [--bitstr ] [--description ] @@ -16,12 +19,42 @@ csdk org-permission delete --id ## Examples -### List all orgPermission records +### List orgPermission records ```bash csdk org-permission list ``` +### List orgPermission records with pagination + +```bash +csdk org-permission list --limit 10 --offset 0 +``` + +### List orgPermission records with cursor pagination + +```bash +csdk org-permission list --limit 10 --after +``` + +### Find first matching orgPermission + +```bash +csdk org-permission find-first --where.id.equalTo +``` + +### List orgPermission records with field selection + +```bash +csdk org-permission list --select id,id +``` + +### List orgPermission records with filtering and ordering + +```bash +csdk org-permission list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgPermission ```bash diff --git a/.agents/skills/cli-auth/references/audit-log.md b/.agents/skills/cli-auth/references/audit-log.md index 2efabcde5..d61f67db2 100644 --- a/.agents/skills/cli-auth/references/audit-log.md +++ b/.agents/skills/cli-auth/references/audit-log.md @@ -8,6 +8,9 @@ CRUD operations for AuditLog records via csdk CLI ```bash csdk audit-log list +csdk audit-log list --where.. --orderBy +csdk audit-log list --limit 10 --after +csdk audit-log find-first --where.. csdk audit-log get --id csdk audit-log create --event --success [--actorId ] [--origin ] [--userAgent ] [--ipAddress ] csdk audit-log update --id [--event ] [--actorId ] [--origin ] [--userAgent ] [--ipAddress ] [--success ] @@ -16,12 +19,42 @@ csdk audit-log delete --id ## Examples -### List all auditLog records +### List auditLog records ```bash csdk audit-log list ``` +### List auditLog records with pagination + +```bash +csdk audit-log list --limit 10 --offset 0 +``` + +### List auditLog records with cursor pagination + +```bash +csdk audit-log list --limit 10 --after +``` + +### Find first matching auditLog + +```bash +csdk audit-log find-first --where.id.equalTo +``` + +### List auditLog records with field selection + +```bash +csdk audit-log list --select id,id +``` + +### List auditLog records with filtering and ordering + +```bash +csdk audit-log list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a auditLog ```bash diff --git a/.agents/skills/cli-auth/references/connected-account.md b/.agents/skills/cli-auth/references/connected-account.md index 4744ff431..866f6aaf1 100644 --- a/.agents/skills/cli-auth/references/connected-account.md +++ b/.agents/skills/cli-auth/references/connected-account.md @@ -8,6 +8,9 @@ CRUD operations for ConnectedAccount records via csdk CLI ```bash csdk connected-account list +csdk connected-account list --where.. --orderBy +csdk connected-account list --limit 10 --after +csdk connected-account find-first --where.. csdk connected-account get --id csdk connected-account create --service --identifier --details [--ownerId ] [--isVerified ] csdk connected-account update --id [--ownerId ] [--service ] [--identifier ] [--details ] [--isVerified ] @@ -16,12 +19,42 @@ csdk connected-account delete --id ## Examples -### List all connectedAccount records +### List connectedAccount records ```bash csdk connected-account list ``` +### List connectedAccount records with pagination + +```bash +csdk connected-account list --limit 10 --offset 0 +``` + +### List connectedAccount records with cursor pagination + +```bash +csdk connected-account list --limit 10 --after +``` + +### Find first matching connectedAccount + +```bash +csdk connected-account find-first --where.id.equalTo +``` + +### List connectedAccount records with field selection + +```bash +csdk connected-account list --select id,id +``` + +### List connectedAccount records with filtering and ordering + +```bash +csdk connected-account list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a connectedAccount ```bash diff --git a/.agents/skills/cli-auth/references/crypto-address.md b/.agents/skills/cli-auth/references/crypto-address.md index 7b695bd67..954ecfa53 100644 --- a/.agents/skills/cli-auth/references/crypto-address.md +++ b/.agents/skills/cli-auth/references/crypto-address.md @@ -8,6 +8,9 @@ CRUD operations for CryptoAddress records via csdk CLI ```bash csdk crypto-address list +csdk crypto-address list --where.. --orderBy +csdk crypto-address list --limit 10 --after +csdk crypto-address find-first --where.. csdk crypto-address get --id csdk crypto-address create --address [--ownerId ] [--isVerified ] [--isPrimary ] csdk crypto-address update --id [--ownerId ] [--address ] [--isVerified ] [--isPrimary ] @@ -16,12 +19,42 @@ csdk crypto-address delete --id ## Examples -### List all cryptoAddress records +### List cryptoAddress records ```bash csdk crypto-address list ``` +### List cryptoAddress records with pagination + +```bash +csdk crypto-address list --limit 10 --offset 0 +``` + +### List cryptoAddress records with cursor pagination + +```bash +csdk crypto-address list --limit 10 --after +``` + +### Find first matching cryptoAddress + +```bash +csdk crypto-address find-first --where.id.equalTo +``` + +### List cryptoAddress records with field selection + +```bash +csdk crypto-address list --select id,id +``` + +### List cryptoAddress records with filtering and ordering + +```bash +csdk crypto-address list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a cryptoAddress ```bash diff --git a/.agents/skills/cli-auth/references/email.md b/.agents/skills/cli-auth/references/email.md index 5fcee25e7..367bb914e 100644 --- a/.agents/skills/cli-auth/references/email.md +++ b/.agents/skills/cli-auth/references/email.md @@ -8,6 +8,9 @@ CRUD operations for Email records via csdk CLI ```bash csdk email list +csdk email list --where.. --orderBy +csdk email list --limit 10 --after +csdk email find-first --where.. csdk email get --id csdk email create --email [--ownerId ] [--isVerified ] [--isPrimary ] csdk email update --id [--ownerId ] [--email ] [--isVerified ] [--isPrimary ] @@ -16,12 +19,42 @@ csdk email delete --id ## Examples -### List all email records +### List email records ```bash csdk email list ``` +### List email records with pagination + +```bash +csdk email list --limit 10 --offset 0 +``` + +### List email records with cursor pagination + +```bash +csdk email list --limit 10 --after +``` + +### Find first matching email + +```bash +csdk email find-first --where.id.equalTo +``` + +### List email records with field selection + +```bash +csdk email list --select id,id +``` + +### List email records with filtering and ordering + +```bash +csdk email list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a email ```bash diff --git a/.agents/skills/cli-auth/references/phone-number.md b/.agents/skills/cli-auth/references/phone-number.md index 9bb80c4b3..6243be4e5 100644 --- a/.agents/skills/cli-auth/references/phone-number.md +++ b/.agents/skills/cli-auth/references/phone-number.md @@ -8,6 +8,9 @@ CRUD operations for PhoneNumber records via csdk CLI ```bash csdk phone-number list +csdk phone-number list --where.. --orderBy +csdk phone-number list --limit 10 --after +csdk phone-number find-first --where.. csdk phone-number get --id csdk phone-number create --cc --number [--ownerId ] [--isVerified ] [--isPrimary ] csdk phone-number update --id [--ownerId ] [--cc ] [--number ] [--isVerified ] [--isPrimary ] @@ -16,12 +19,42 @@ csdk phone-number delete --id ## Examples -### List all phoneNumber records +### List phoneNumber records ```bash csdk phone-number list ``` +### List phoneNumber records with pagination + +```bash +csdk phone-number list --limit 10 --offset 0 +``` + +### List phoneNumber records with cursor pagination + +```bash +csdk phone-number list --limit 10 --after +``` + +### Find first matching phoneNumber + +```bash +csdk phone-number find-first --where.id.equalTo +``` + +### List phoneNumber records with field selection + +```bash +csdk phone-number list --select id,id +``` + +### List phoneNumber records with filtering and ordering + +```bash +csdk phone-number list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a phoneNumber ```bash diff --git a/.agents/skills/cli-auth/references/role-type.md b/.agents/skills/cli-auth/references/role-type.md index 0ac32c001..e21f127bc 100644 --- a/.agents/skills/cli-auth/references/role-type.md +++ b/.agents/skills/cli-auth/references/role-type.md @@ -8,6 +8,9 @@ CRUD operations for RoleType records via csdk CLI ```bash csdk role-type list +csdk role-type list --where.. --orderBy +csdk role-type list --limit 10 --after +csdk role-type find-first --where.. csdk role-type get --id csdk role-type create --name csdk role-type update --id [--name ] @@ -16,12 +19,42 @@ csdk role-type delete --id ## Examples -### List all roleType records +### List roleType records ```bash csdk role-type list ``` +### List roleType records with pagination + +```bash +csdk role-type list --limit 10 --offset 0 +``` + +### List roleType records with cursor pagination + +```bash +csdk role-type list --limit 10 --after +``` + +### Find first matching roleType + +```bash +csdk role-type find-first --where.id.equalTo +``` + +### List roleType records with field selection + +```bash +csdk role-type list --select id,id +``` + +### List roleType records with filtering and ordering + +```bash +csdk role-type list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a roleType ```bash diff --git a/.agents/skills/cli-auth/references/user.md b/.agents/skills/cli-auth/references/user.md index fbe78b595..6c0e4081d 100644 --- a/.agents/skills/cli-auth/references/user.md +++ b/.agents/skills/cli-auth/references/user.md @@ -4,13 +4,17 @@ CRUD operations for User records via csdk CLI -**Unified Search API fields:** `displayNameTrgmSimilarity`, `searchScore` +**Unified Search API fields:** `searchTsv`, `displayNameTrgmSimilarity`, `searchScore` Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. ## Usage ```bash csdk user list +csdk user list --where.. --orderBy +csdk user list --limit 10 --after +csdk user find-first --where.. +csdk user search csdk user get --id csdk user create [--username ] [--displayName ] [--profilePicture ] [--type ] csdk user update --id [--username ] [--displayName ] [--profilePicture ] [--type ] @@ -19,12 +23,67 @@ csdk user delete --id ## Examples -### List all user records +### List user records ```bash csdk user list ``` +### List user records with pagination + +```bash +csdk user list --limit 10 --offset 0 +``` + +### List user records with cursor pagination + +```bash +csdk user list --limit 10 --after +``` + +### Find first matching user + +```bash +csdk user find-first --where.id.equalTo +``` + +### List user records with field selection + +```bash +csdk user list --select id,id +``` + +### List user records with filtering and ordering + +```bash +csdk user list --where.id.equalTo --orderBy ID_ASC +``` + +### Full-text search via tsvector (`searchTsv`) + +```bash +csdk user list --where.searchTsv "search query" --select title,tsvRank +``` + +### Fuzzy search via trigram similarity (`trgmDisplayName`) + +```bash +csdk user list --where.trgmDisplayName.value "approximate query" --where.trgmDisplayName.threshold 0.3 --select title,displayNameTrgmSimilarity +``` + +### Composite search (fullTextSearch dispatches to all text adapters) + +```bash +csdk user list --where.fullTextSearch "search query" --select title,tsvRank,displayNameTrgmSimilarity,searchScore +``` + +### Search with pagination and field projection + +```bash +csdk user list --where.fullTextSearch "query" --limit 10 --select id,title,searchScore +csdk user search "query" --limit 10 --select id,title,searchScore +``` + ### Create a user ```bash diff --git a/.agents/skills/cli-objects/references/commit.md b/.agents/skills/cli-objects/references/commit.md index d08124bd3..62eca9428 100644 --- a/.agents/skills/cli-objects/references/commit.md +++ b/.agents/skills/cli-objects/references/commit.md @@ -8,6 +8,9 @@ CRUD operations for Commit records via csdk CLI ```bash csdk commit list +csdk commit list --where.. --orderBy +csdk commit list --limit 10 --after +csdk commit find-first --where.. csdk commit get --id csdk commit create --databaseId --storeId [--message ] [--parentIds ] [--authorId ] [--committerId ] [--treeId ] [--date ] csdk commit update --id [--message ] [--databaseId ] [--storeId ] [--parentIds ] [--authorId ] [--committerId ] [--treeId ] [--date ] @@ -16,12 +19,42 @@ csdk commit delete --id ## Examples -### List all commit records +### List commit records ```bash csdk commit list ``` +### List commit records with pagination + +```bash +csdk commit list --limit 10 --offset 0 +``` + +### List commit records with cursor pagination + +```bash +csdk commit list --limit 10 --after +``` + +### Find first matching commit + +```bash +csdk commit find-first --where.id.equalTo +``` + +### List commit records with field selection + +```bash +csdk commit list --select id,id +``` + +### List commit records with filtering and ordering + +```bash +csdk commit list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a commit ```bash diff --git a/.agents/skills/cli-objects/references/get-all-record.md b/.agents/skills/cli-objects/references/get-all-record.md index 95294973c..b9b5a653d 100644 --- a/.agents/skills/cli-objects/references/get-all-record.md +++ b/.agents/skills/cli-objects/references/get-all-record.md @@ -8,6 +8,9 @@ CRUD operations for GetAllRecord records via csdk CLI ```bash csdk get-all-record list +csdk get-all-record list --where.. --orderBy +csdk get-all-record list --limit 10 --after +csdk get-all-record find-first --where.. csdk get-all-record get --id csdk get-all-record create --path --data csdk get-all-record update --id [--path ] [--data ] @@ -16,12 +19,42 @@ csdk get-all-record delete --id ## Examples -### List all getAllRecord records +### List getAllRecord records ```bash csdk get-all-record list ``` +### List getAllRecord records with pagination + +```bash +csdk get-all-record list --limit 10 --offset 0 +``` + +### List getAllRecord records with cursor pagination + +```bash +csdk get-all-record list --limit 10 --after +``` + +### Find first matching getAllRecord + +```bash +csdk get-all-record find-first --where.id.equalTo +``` + +### List getAllRecord records with field selection + +```bash +csdk get-all-record list --select id,id +``` + +### List getAllRecord records with filtering and ordering + +```bash +csdk get-all-record list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a getAllRecord ```bash diff --git a/.agents/skills/cli-objects/references/object.md b/.agents/skills/cli-objects/references/object.md index fa82a724f..97a623855 100644 --- a/.agents/skills/cli-objects/references/object.md +++ b/.agents/skills/cli-objects/references/object.md @@ -8,6 +8,9 @@ CRUD operations for Object records via csdk CLI ```bash csdk object list +csdk object list --where.. --orderBy +csdk object list --limit 10 --after +csdk object find-first --where.. csdk object get --id csdk object create --databaseId [--kids ] [--ktree ] [--data ] [--frzn ] csdk object update --id [--databaseId ] [--kids ] [--ktree ] [--data ] [--frzn ] @@ -16,12 +19,42 @@ csdk object delete --id ## Examples -### List all object records +### List object records ```bash csdk object list ``` +### List object records with pagination + +```bash +csdk object list --limit 10 --offset 0 +``` + +### List object records with cursor pagination + +```bash +csdk object list --limit 10 --after +``` + +### Find first matching object + +```bash +csdk object find-first --where.id.equalTo +``` + +### List object records with field selection + +```bash +csdk object list --select id,id +``` + +### List object records with filtering and ordering + +```bash +csdk object list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a object ```bash diff --git a/.agents/skills/cli-objects/references/ref.md b/.agents/skills/cli-objects/references/ref.md index 7603bfe61..5369e7520 100644 --- a/.agents/skills/cli-objects/references/ref.md +++ b/.agents/skills/cli-objects/references/ref.md @@ -8,6 +8,9 @@ CRUD operations for Ref records via csdk CLI ```bash csdk ref list +csdk ref list --where.. --orderBy +csdk ref list --limit 10 --after +csdk ref find-first --where.. csdk ref get --id csdk ref create --name --databaseId --storeId [--commitId ] csdk ref update --id [--name ] [--databaseId ] [--storeId ] [--commitId ] @@ -16,12 +19,42 @@ csdk ref delete --id ## Examples -### List all ref records +### List ref records ```bash csdk ref list ``` +### List ref records with pagination + +```bash +csdk ref list --limit 10 --offset 0 +``` + +### List ref records with cursor pagination + +```bash +csdk ref list --limit 10 --after +``` + +### Find first matching ref + +```bash +csdk ref find-first --where.id.equalTo +``` + +### List ref records with field selection + +```bash +csdk ref list --select id,id +``` + +### List ref records with filtering and ordering + +```bash +csdk ref list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a ref ```bash diff --git a/.agents/skills/cli-objects/references/store.md b/.agents/skills/cli-objects/references/store.md index 18c71e259..25b76714d 100644 --- a/.agents/skills/cli-objects/references/store.md +++ b/.agents/skills/cli-objects/references/store.md @@ -8,6 +8,9 @@ CRUD operations for Store records via csdk CLI ```bash csdk store list +csdk store list --where.. --orderBy +csdk store list --limit 10 --after +csdk store find-first --where.. csdk store get --id csdk store create --name --databaseId [--hash ] csdk store update --id [--name ] [--databaseId ] [--hash ] @@ -16,12 +19,42 @@ csdk store delete --id ## Examples -### List all store records +### List store records ```bash csdk store list ``` +### List store records with pagination + +```bash +csdk store list --limit 10 --offset 0 +``` + +### List store records with cursor pagination + +```bash +csdk store list --limit 10 --after +``` + +### Find first matching store + +```bash +csdk store find-first --where.id.equalTo +``` + +### List store records with field selection + +```bash +csdk store list --select id,id +``` + +### List store records with filtering and ordering + +```bash +csdk store list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a store ```bash diff --git a/.agents/skills/cli-public/SKILL.md b/.agents/skills/cli-public/SKILL.md index 01641b226..6b93c12c6 100644 --- a/.agents/skills/cli-public/SKILL.md +++ b/.agents/skills/cli-public/SKILL.md @@ -152,11 +152,11 @@ See the `references/` directory for detailed per-entity API documentation: - [migrate-file](references/migrate-file.md) - [app-limit-default](references/app-limit-default.md) - [org-limit-default](references/org-limit-default.md) -- [node-type-registry](references/node-type-registry.md) - [membership-type](references/membership-type.md) - [commit](references/commit.md) - [app-membership-default](references/app-membership-default.md) - [rls-module](references/rls-module.md) +- [node-type-registry](references/node-type-registry.md) - [org-membership-default](references/org-membership-default.md) - [sql-action](references/sql-action.md) - [user](references/user.md) diff --git a/.agents/skills/cli-public/references/api-module.md b/.agents/skills/cli-public/references/api-module.md index 932e0a084..7de5488ee 100644 --- a/.agents/skills/cli-public/references/api-module.md +++ b/.agents/skills/cli-public/references/api-module.md @@ -8,6 +8,9 @@ CRUD operations for ApiModule records via csdk CLI ```bash csdk api-module list +csdk api-module list --where.. --orderBy +csdk api-module list --limit 10 --after +csdk api-module find-first --where.. csdk api-module get --id csdk api-module create --databaseId --apiId --name --data csdk api-module update --id [--databaseId ] [--apiId ] [--name ] [--data ] @@ -16,12 +19,42 @@ csdk api-module delete --id ## Examples -### List all apiModule records +### List apiModule records ```bash csdk api-module list ``` +### List apiModule records with pagination + +```bash +csdk api-module list --limit 10 --offset 0 +``` + +### List apiModule records with cursor pagination + +```bash +csdk api-module list --limit 10 --after +``` + +### Find first matching apiModule + +```bash +csdk api-module find-first --where.id.equalTo +``` + +### List apiModule records with field selection + +```bash +csdk api-module list --select id,id +``` + +### List apiModule records with filtering and ordering + +```bash +csdk api-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a apiModule ```bash diff --git a/.agents/skills/cli-public/references/api-schema.md b/.agents/skills/cli-public/references/api-schema.md index fc55b43e3..23abc22c9 100644 --- a/.agents/skills/cli-public/references/api-schema.md +++ b/.agents/skills/cli-public/references/api-schema.md @@ -8,6 +8,9 @@ CRUD operations for ApiSchema records via csdk CLI ```bash csdk api-schema list +csdk api-schema list --where.. --orderBy +csdk api-schema list --limit 10 --after +csdk api-schema find-first --where.. csdk api-schema get --id csdk api-schema create --databaseId --schemaId --apiId csdk api-schema update --id [--databaseId ] [--schemaId ] [--apiId ] @@ -16,12 +19,42 @@ csdk api-schema delete --id ## Examples -### List all apiSchema records +### List apiSchema records ```bash csdk api-schema list ``` +### List apiSchema records with pagination + +```bash +csdk api-schema list --limit 10 --offset 0 +``` + +### List apiSchema records with cursor pagination + +```bash +csdk api-schema list --limit 10 --after +``` + +### Find first matching apiSchema + +```bash +csdk api-schema find-first --where.id.equalTo +``` + +### List apiSchema records with field selection + +```bash +csdk api-schema list --select id,id +``` + +### List apiSchema records with filtering and ordering + +```bash +csdk api-schema list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a apiSchema ```bash diff --git a/.agents/skills/cli-public/references/api.md b/.agents/skills/cli-public/references/api.md index 31de40a4d..207993866 100644 --- a/.agents/skills/cli-public/references/api.md +++ b/.agents/skills/cli-public/references/api.md @@ -8,6 +8,9 @@ CRUD operations for Api records via csdk CLI ```bash csdk api list +csdk api list --where.. --orderBy +csdk api list --limit 10 --after +csdk api find-first --where.. csdk api get --id csdk api create --databaseId --name [--dbname ] [--roleName ] [--anonRole ] [--isPublic ] csdk api update --id [--databaseId ] [--name ] [--dbname ] [--roleName ] [--anonRole ] [--isPublic ] @@ -16,12 +19,42 @@ csdk api delete --id ## Examples -### List all api records +### List api records ```bash csdk api list ``` +### List api records with pagination + +```bash +csdk api list --limit 10 --offset 0 +``` + +### List api records with cursor pagination + +```bash +csdk api list --limit 10 --after +``` + +### Find first matching api + +```bash +csdk api find-first --where.id.equalTo +``` + +### List api records with field selection + +```bash +csdk api list --select id,id +``` + +### List api records with filtering and ordering + +```bash +csdk api list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a api ```bash diff --git a/.agents/skills/cli-public/references/app-achievement.md b/.agents/skills/cli-public/references/app-achievement.md index 66afb3497..fb54901dd 100644 --- a/.agents/skills/cli-public/references/app-achievement.md +++ b/.agents/skills/cli-public/references/app-achievement.md @@ -8,6 +8,9 @@ CRUD operations for AppAchievement records via csdk CLI ```bash csdk app-achievement list +csdk app-achievement list --where.. --orderBy +csdk app-achievement list --limit 10 --after +csdk app-achievement find-first --where.. csdk app-achievement get --id csdk app-achievement create --name [--actorId ] [--count ] csdk app-achievement update --id [--actorId ] [--name ] [--count ] @@ -16,12 +19,42 @@ csdk app-achievement delete --id ## Examples -### List all appAchievement records +### List appAchievement records ```bash csdk app-achievement list ``` +### List appAchievement records with pagination + +```bash +csdk app-achievement list --limit 10 --offset 0 +``` + +### List appAchievement records with cursor pagination + +```bash +csdk app-achievement list --limit 10 --after +``` + +### Find first matching appAchievement + +```bash +csdk app-achievement find-first --where.id.equalTo +``` + +### List appAchievement records with field selection + +```bash +csdk app-achievement list --select id,id +``` + +### List appAchievement records with filtering and ordering + +```bash +csdk app-achievement list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appAchievement ```bash diff --git a/.agents/skills/cli-public/references/app-admin-grant.md b/.agents/skills/cli-public/references/app-admin-grant.md index 386e13894..8567b49bc 100644 --- a/.agents/skills/cli-public/references/app-admin-grant.md +++ b/.agents/skills/cli-public/references/app-admin-grant.md @@ -8,6 +8,9 @@ CRUD operations for AppAdminGrant records via csdk CLI ```bash csdk app-admin-grant list +csdk app-admin-grant list --where.. --orderBy +csdk app-admin-grant list --limit 10 --after +csdk app-admin-grant find-first --where.. csdk app-admin-grant get --id csdk app-admin-grant create --actorId [--isGrant ] [--grantorId ] csdk app-admin-grant update --id [--isGrant ] [--actorId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk app-admin-grant delete --id ## Examples -### List all appAdminGrant records +### List appAdminGrant records ```bash csdk app-admin-grant list ``` +### List appAdminGrant records with pagination + +```bash +csdk app-admin-grant list --limit 10 --offset 0 +``` + +### List appAdminGrant records with cursor pagination + +```bash +csdk app-admin-grant list --limit 10 --after +``` + +### Find first matching appAdminGrant + +```bash +csdk app-admin-grant find-first --where.id.equalTo +``` + +### List appAdminGrant records with field selection + +```bash +csdk app-admin-grant list --select id,id +``` + +### List appAdminGrant records with filtering and ordering + +```bash +csdk app-admin-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appAdminGrant ```bash diff --git a/.agents/skills/cli-public/references/app-grant.md b/.agents/skills/cli-public/references/app-grant.md index 42fd59655..9880b8767 100644 --- a/.agents/skills/cli-public/references/app-grant.md +++ b/.agents/skills/cli-public/references/app-grant.md @@ -8,6 +8,9 @@ CRUD operations for AppGrant records via csdk CLI ```bash csdk app-grant list +csdk app-grant list --where.. --orderBy +csdk app-grant list --limit 10 --after +csdk app-grant find-first --where.. csdk app-grant get --id csdk app-grant create --actorId [--permissions ] [--isGrant ] [--grantorId ] csdk app-grant update --id [--permissions ] [--isGrant ] [--actorId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk app-grant delete --id ## Examples -### List all appGrant records +### List appGrant records ```bash csdk app-grant list ``` +### List appGrant records with pagination + +```bash +csdk app-grant list --limit 10 --offset 0 +``` + +### List appGrant records with cursor pagination + +```bash +csdk app-grant list --limit 10 --after +``` + +### Find first matching appGrant + +```bash +csdk app-grant find-first --where.id.equalTo +``` + +### List appGrant records with field selection + +```bash +csdk app-grant list --select id,id +``` + +### List appGrant records with filtering and ordering + +```bash +csdk app-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appGrant ```bash diff --git a/.agents/skills/cli-public/references/app-level-requirement.md b/.agents/skills/cli-public/references/app-level-requirement.md index 64d030baf..42bf8c189 100644 --- a/.agents/skills/cli-public/references/app-level-requirement.md +++ b/.agents/skills/cli-public/references/app-level-requirement.md @@ -8,6 +8,9 @@ CRUD operations for AppLevelRequirement records via csdk CLI ```bash csdk app-level-requirement list +csdk app-level-requirement list --where.. --orderBy +csdk app-level-requirement list --limit 10 --after +csdk app-level-requirement find-first --where.. csdk app-level-requirement get --id csdk app-level-requirement create --name --level [--description ] [--requiredCount ] [--priority ] csdk app-level-requirement update --id [--name ] [--level ] [--description ] [--requiredCount ] [--priority ] @@ -16,12 +19,42 @@ csdk app-level-requirement delete --id ## Examples -### List all appLevelRequirement records +### List appLevelRequirement records ```bash csdk app-level-requirement list ``` +### List appLevelRequirement records with pagination + +```bash +csdk app-level-requirement list --limit 10 --offset 0 +``` + +### List appLevelRequirement records with cursor pagination + +```bash +csdk app-level-requirement list --limit 10 --after +``` + +### Find first matching appLevelRequirement + +```bash +csdk app-level-requirement find-first --where.id.equalTo +``` + +### List appLevelRequirement records with field selection + +```bash +csdk app-level-requirement list --select id,id +``` + +### List appLevelRequirement records with filtering and ordering + +```bash +csdk app-level-requirement list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLevelRequirement ```bash diff --git a/.agents/skills/cli-public/references/app-level.md b/.agents/skills/cli-public/references/app-level.md index e02091191..8c44edf92 100644 --- a/.agents/skills/cli-public/references/app-level.md +++ b/.agents/skills/cli-public/references/app-level.md @@ -8,6 +8,9 @@ CRUD operations for AppLevel records via csdk CLI ```bash csdk app-level list +csdk app-level list --where.. --orderBy +csdk app-level list --limit 10 --after +csdk app-level find-first --where.. csdk app-level get --id csdk app-level create --name [--description ] [--image ] [--ownerId ] csdk app-level update --id [--name ] [--description ] [--image ] [--ownerId ] @@ -16,12 +19,42 @@ csdk app-level delete --id ## Examples -### List all appLevel records +### List appLevel records ```bash csdk app-level list ``` +### List appLevel records with pagination + +```bash +csdk app-level list --limit 10 --offset 0 +``` + +### List appLevel records with cursor pagination + +```bash +csdk app-level list --limit 10 --after +``` + +### Find first matching appLevel + +```bash +csdk app-level find-first --where.id.equalTo +``` + +### List appLevel records with field selection + +```bash +csdk app-level list --select id,id +``` + +### List appLevel records with filtering and ordering + +```bash +csdk app-level list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLevel ```bash diff --git a/.agents/skills/cli-public/references/app-limit-default.md b/.agents/skills/cli-public/references/app-limit-default.md index d29ead549..3acad75f5 100644 --- a/.agents/skills/cli-public/references/app-limit-default.md +++ b/.agents/skills/cli-public/references/app-limit-default.md @@ -8,6 +8,9 @@ CRUD operations for AppLimitDefault records via csdk CLI ```bash csdk app-limit-default list +csdk app-limit-default list --where.. --orderBy +csdk app-limit-default list --limit 10 --after +csdk app-limit-default find-first --where.. csdk app-limit-default get --id csdk app-limit-default create --name [--max ] csdk app-limit-default update --id [--name ] [--max ] @@ -16,12 +19,42 @@ csdk app-limit-default delete --id ## Examples -### List all appLimitDefault records +### List appLimitDefault records ```bash csdk app-limit-default list ``` +### List appLimitDefault records with pagination + +```bash +csdk app-limit-default list --limit 10 --offset 0 +``` + +### List appLimitDefault records with cursor pagination + +```bash +csdk app-limit-default list --limit 10 --after +``` + +### Find first matching appLimitDefault + +```bash +csdk app-limit-default find-first --where.id.equalTo +``` + +### List appLimitDefault records with field selection + +```bash +csdk app-limit-default list --select id,id +``` + +### List appLimitDefault records with filtering and ordering + +```bash +csdk app-limit-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLimitDefault ```bash diff --git a/.agents/skills/cli-public/references/app-limit.md b/.agents/skills/cli-public/references/app-limit.md index a164f5c9d..1b995e011 100644 --- a/.agents/skills/cli-public/references/app-limit.md +++ b/.agents/skills/cli-public/references/app-limit.md @@ -8,6 +8,9 @@ CRUD operations for AppLimit records via csdk CLI ```bash csdk app-limit list +csdk app-limit list --where.. --orderBy +csdk app-limit list --limit 10 --after +csdk app-limit find-first --where.. csdk app-limit get --id csdk app-limit create --actorId [--name ] [--num ] [--max ] csdk app-limit update --id [--name ] [--actorId ] [--num ] [--max ] @@ -16,12 +19,42 @@ csdk app-limit delete --id ## Examples -### List all appLimit records +### List appLimit records ```bash csdk app-limit list ``` +### List appLimit records with pagination + +```bash +csdk app-limit list --limit 10 --offset 0 +``` + +### List appLimit records with cursor pagination + +```bash +csdk app-limit list --limit 10 --after +``` + +### Find first matching appLimit + +```bash +csdk app-limit find-first --where.id.equalTo +``` + +### List appLimit records with field selection + +```bash +csdk app-limit list --select id,id +``` + +### List appLimit records with filtering and ordering + +```bash +csdk app-limit list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appLimit ```bash diff --git a/.agents/skills/cli-public/references/app-membership-default.md b/.agents/skills/cli-public/references/app-membership-default.md index da2a194e0..836c99bef 100644 --- a/.agents/skills/cli-public/references/app-membership-default.md +++ b/.agents/skills/cli-public/references/app-membership-default.md @@ -8,6 +8,9 @@ CRUD operations for AppMembershipDefault records via csdk CLI ```bash csdk app-membership-default list +csdk app-membership-default list --where.. --orderBy +csdk app-membership-default list --limit 10 --after +csdk app-membership-default find-first --where.. csdk app-membership-default get --id csdk app-membership-default create [--createdBy ] [--updatedBy ] [--isApproved ] [--isVerified ] csdk app-membership-default update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--isVerified ] @@ -16,12 +19,42 @@ csdk app-membership-default delete --id ## Examples -### List all appMembershipDefault records +### List appMembershipDefault records ```bash csdk app-membership-default list ``` +### List appMembershipDefault records with pagination + +```bash +csdk app-membership-default list --limit 10 --offset 0 +``` + +### List appMembershipDefault records with cursor pagination + +```bash +csdk app-membership-default list --limit 10 --after +``` + +### Find first matching appMembershipDefault + +```bash +csdk app-membership-default find-first --where.id.equalTo +``` + +### List appMembershipDefault records with field selection + +```bash +csdk app-membership-default list --select id,id +``` + +### List appMembershipDefault records with filtering and ordering + +```bash +csdk app-membership-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appMembershipDefault ```bash diff --git a/.agents/skills/cli-public/references/app-membership.md b/.agents/skills/cli-public/references/app-membership.md index 0b5e5fb3b..c58e06de7 100644 --- a/.agents/skills/cli-public/references/app-membership.md +++ b/.agents/skills/cli-public/references/app-membership.md @@ -8,6 +8,9 @@ CRUD operations for AppMembership records via csdk CLI ```bash csdk app-membership list +csdk app-membership list --where.. --orderBy +csdk app-membership list --limit 10 --after +csdk app-membership find-first --where.. csdk app-membership get --id csdk app-membership create --actorId [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isVerified ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--profileId ] csdk app-membership update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isVerified ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--actorId ] [--profileId ] @@ -16,12 +19,42 @@ csdk app-membership delete --id ## Examples -### List all appMembership records +### List appMembership records ```bash csdk app-membership list ``` +### List appMembership records with pagination + +```bash +csdk app-membership list --limit 10 --offset 0 +``` + +### List appMembership records with cursor pagination + +```bash +csdk app-membership list --limit 10 --after +``` + +### Find first matching appMembership + +```bash +csdk app-membership find-first --where.id.equalTo +``` + +### List appMembership records with field selection + +```bash +csdk app-membership list --select id,id +``` + +### List appMembership records with filtering and ordering + +```bash +csdk app-membership list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appMembership ```bash diff --git a/.agents/skills/cli-public/references/app-owner-grant.md b/.agents/skills/cli-public/references/app-owner-grant.md index cf34fe8f0..9884f4a52 100644 --- a/.agents/skills/cli-public/references/app-owner-grant.md +++ b/.agents/skills/cli-public/references/app-owner-grant.md @@ -8,6 +8,9 @@ CRUD operations for AppOwnerGrant records via csdk CLI ```bash csdk app-owner-grant list +csdk app-owner-grant list --where.. --orderBy +csdk app-owner-grant list --limit 10 --after +csdk app-owner-grant find-first --where.. csdk app-owner-grant get --id csdk app-owner-grant create --actorId [--isGrant ] [--grantorId ] csdk app-owner-grant update --id [--isGrant ] [--actorId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk app-owner-grant delete --id ## Examples -### List all appOwnerGrant records +### List appOwnerGrant records ```bash csdk app-owner-grant list ``` +### List appOwnerGrant records with pagination + +```bash +csdk app-owner-grant list --limit 10 --offset 0 +``` + +### List appOwnerGrant records with cursor pagination + +```bash +csdk app-owner-grant list --limit 10 --after +``` + +### Find first matching appOwnerGrant + +```bash +csdk app-owner-grant find-first --where.id.equalTo +``` + +### List appOwnerGrant records with field selection + +```bash +csdk app-owner-grant list --select id,id +``` + +### List appOwnerGrant records with filtering and ordering + +```bash +csdk app-owner-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appOwnerGrant ```bash diff --git a/.agents/skills/cli-public/references/app-permission-default.md b/.agents/skills/cli-public/references/app-permission-default.md index 6be7c4fc6..86ef24503 100644 --- a/.agents/skills/cli-public/references/app-permission-default.md +++ b/.agents/skills/cli-public/references/app-permission-default.md @@ -8,6 +8,9 @@ CRUD operations for AppPermissionDefault records via csdk CLI ```bash csdk app-permission-default list +csdk app-permission-default list --where.. --orderBy +csdk app-permission-default list --limit 10 --after +csdk app-permission-default find-first --where.. csdk app-permission-default get --id csdk app-permission-default create [--permissions ] csdk app-permission-default update --id [--permissions ] @@ -16,12 +19,42 @@ csdk app-permission-default delete --id ## Examples -### List all appPermissionDefault records +### List appPermissionDefault records ```bash csdk app-permission-default list ``` +### List appPermissionDefault records with pagination + +```bash +csdk app-permission-default list --limit 10 --offset 0 +``` + +### List appPermissionDefault records with cursor pagination + +```bash +csdk app-permission-default list --limit 10 --after +``` + +### Find first matching appPermissionDefault + +```bash +csdk app-permission-default find-first --where.id.equalTo +``` + +### List appPermissionDefault records with field selection + +```bash +csdk app-permission-default list --select id,id +``` + +### List appPermissionDefault records with filtering and ordering + +```bash +csdk app-permission-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appPermissionDefault ```bash diff --git a/.agents/skills/cli-public/references/app-permission.md b/.agents/skills/cli-public/references/app-permission.md index cc7ed0f1e..82c849598 100644 --- a/.agents/skills/cli-public/references/app-permission.md +++ b/.agents/skills/cli-public/references/app-permission.md @@ -8,6 +8,9 @@ CRUD operations for AppPermission records via csdk CLI ```bash csdk app-permission list +csdk app-permission list --where.. --orderBy +csdk app-permission list --limit 10 --after +csdk app-permission find-first --where.. csdk app-permission get --id csdk app-permission create [--name ] [--bitnum ] [--bitstr ] [--description ] csdk app-permission update --id [--name ] [--bitnum ] [--bitstr ] [--description ] @@ -16,12 +19,42 @@ csdk app-permission delete --id ## Examples -### List all appPermission records +### List appPermission records ```bash csdk app-permission list ``` +### List appPermission records with pagination + +```bash +csdk app-permission list --limit 10 --offset 0 +``` + +### List appPermission records with cursor pagination + +```bash +csdk app-permission list --limit 10 --after +``` + +### Find first matching appPermission + +```bash +csdk app-permission find-first --where.id.equalTo +``` + +### List appPermission records with field selection + +```bash +csdk app-permission list --select id,id +``` + +### List appPermission records with filtering and ordering + +```bash +csdk app-permission list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appPermission ```bash diff --git a/.agents/skills/cli-public/references/app-step.md b/.agents/skills/cli-public/references/app-step.md index fe3da0029..7495cb26b 100644 --- a/.agents/skills/cli-public/references/app-step.md +++ b/.agents/skills/cli-public/references/app-step.md @@ -8,6 +8,9 @@ CRUD operations for AppStep records via csdk CLI ```bash csdk app-step list +csdk app-step list --where.. --orderBy +csdk app-step list --limit 10 --after +csdk app-step find-first --where.. csdk app-step get --id csdk app-step create --name [--actorId ] [--count ] csdk app-step update --id [--actorId ] [--name ] [--count ] @@ -16,12 +19,42 @@ csdk app-step delete --id ## Examples -### List all appStep records +### List appStep records ```bash csdk app-step list ``` +### List appStep records with pagination + +```bash +csdk app-step list --limit 10 --offset 0 +``` + +### List appStep records with cursor pagination + +```bash +csdk app-step list --limit 10 --after +``` + +### Find first matching appStep + +```bash +csdk app-step find-first --where.id.equalTo +``` + +### List appStep records with field selection + +```bash +csdk app-step list --select id,id +``` + +### List appStep records with filtering and ordering + +```bash +csdk app-step list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a appStep ```bash diff --git a/.agents/skills/cli-public/references/app.md b/.agents/skills/cli-public/references/app.md index 18d696971..74913982c 100644 --- a/.agents/skills/cli-public/references/app.md +++ b/.agents/skills/cli-public/references/app.md @@ -8,6 +8,9 @@ CRUD operations for App records via csdk CLI ```bash csdk app list +csdk app list --where.. --orderBy +csdk app list --limit 10 --after +csdk app find-first --where.. csdk app get --id csdk app create --databaseId --siteId [--name ] [--appImage ] [--appStoreLink ] [--appStoreId ] [--appIdPrefix ] [--playStoreLink ] csdk app update --id [--databaseId ] [--siteId ] [--name ] [--appImage ] [--appStoreLink ] [--appStoreId ] [--appIdPrefix ] [--playStoreLink ] @@ -16,12 +19,42 @@ csdk app delete --id ## Examples -### List all app records +### List app records ```bash csdk app list ``` +### List app records with pagination + +```bash +csdk app list --limit 10 --offset 0 +``` + +### List app records with cursor pagination + +```bash +csdk app list --limit 10 --after +``` + +### Find first matching app + +```bash +csdk app find-first --where.id.equalTo +``` + +### List app records with field selection + +```bash +csdk app list --select id,id +``` + +### List app records with filtering and ordering + +```bash +csdk app list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a app ```bash diff --git a/.agents/skills/cli-public/references/ast-migration.md b/.agents/skills/cli-public/references/ast-migration.md index 08ba37ec6..507116319 100644 --- a/.agents/skills/cli-public/references/ast-migration.md +++ b/.agents/skills/cli-public/references/ast-migration.md @@ -8,6 +8,9 @@ CRUD operations for AstMigration records via csdk CLI ```bash csdk ast-migration list +csdk ast-migration list --where.. --orderBy +csdk ast-migration list --limit 10 --after +csdk ast-migration find-first --where.. csdk ast-migration get --id csdk ast-migration create [--databaseId ] [--name ] [--requires ] [--payload ] [--deploys ] [--deploy ] [--revert ] [--verify ] [--action ] [--actionId ] [--actorId ] csdk ast-migration update --id [--databaseId ] [--name ] [--requires ] [--payload ] [--deploys ] [--deploy ] [--revert ] [--verify ] [--action ] [--actionId ] [--actorId ] @@ -16,12 +19,42 @@ csdk ast-migration delete --id ## Examples -### List all astMigration records +### List astMigration records ```bash csdk ast-migration list ``` +### List astMigration records with pagination + +```bash +csdk ast-migration list --limit 10 --offset 0 +``` + +### List astMigration records with cursor pagination + +```bash +csdk ast-migration list --limit 10 --after +``` + +### Find first matching astMigration + +```bash +csdk ast-migration find-first --where.id.equalTo +``` + +### List astMigration records with field selection + +```bash +csdk ast-migration list --select id,id +``` + +### List astMigration records with filtering and ordering + +```bash +csdk ast-migration list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a astMigration ```bash diff --git a/.agents/skills/cli-public/references/audit-log.md b/.agents/skills/cli-public/references/audit-log.md index 2efabcde5..d61f67db2 100644 --- a/.agents/skills/cli-public/references/audit-log.md +++ b/.agents/skills/cli-public/references/audit-log.md @@ -8,6 +8,9 @@ CRUD operations for AuditLog records via csdk CLI ```bash csdk audit-log list +csdk audit-log list --where.. --orderBy +csdk audit-log list --limit 10 --after +csdk audit-log find-first --where.. csdk audit-log get --id csdk audit-log create --event --success [--actorId ] [--origin ] [--userAgent ] [--ipAddress ] csdk audit-log update --id [--event ] [--actorId ] [--origin ] [--userAgent ] [--ipAddress ] [--success ] @@ -16,12 +19,42 @@ csdk audit-log delete --id ## Examples -### List all auditLog records +### List auditLog records ```bash csdk audit-log list ``` +### List auditLog records with pagination + +```bash +csdk audit-log list --limit 10 --offset 0 +``` + +### List auditLog records with cursor pagination + +```bash +csdk audit-log list --limit 10 --after +``` + +### Find first matching auditLog + +```bash +csdk audit-log find-first --where.id.equalTo +``` + +### List auditLog records with field selection + +```bash +csdk audit-log list --select id,id +``` + +### List auditLog records with filtering and ordering + +```bash +csdk audit-log list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a auditLog ```bash diff --git a/.agents/skills/cli-public/references/blueprint-template.md b/.agents/skills/cli-public/references/blueprint-template.md index bc0e1e8cc..1393578cf 100644 --- a/.agents/skills/cli-public/references/blueprint-template.md +++ b/.agents/skills/cli-public/references/blueprint-template.md @@ -8,6 +8,9 @@ CRUD operations for BlueprintTemplate records via csdk CLI ```bash csdk blueprint-template list +csdk blueprint-template list --where.. --orderBy +csdk blueprint-template list --limit 10 --after +csdk blueprint-template find-first --where.. csdk blueprint-template get --id csdk blueprint-template create --name --displayName --ownerId --definition [--version ] [--description ] [--visibility ] [--categories ] [--tags ] [--definitionSchemaVersion ] [--source ] [--complexity ] [--copyCount ] [--forkCount ] [--forkedFromId ] [--definitionHash ] [--tableHashes ] csdk blueprint-template update --id [--name ] [--version ] [--displayName ] [--description ] [--ownerId ] [--visibility ] [--categories ] [--tags ] [--definition ] [--definitionSchemaVersion ] [--source ] [--complexity ] [--copyCount ] [--forkCount ] [--forkedFromId ] [--definitionHash ] [--tableHashes ] @@ -16,12 +19,42 @@ csdk blueprint-template delete --id ## Examples -### List all blueprintTemplate records +### List blueprintTemplate records ```bash csdk blueprint-template list ``` +### List blueprintTemplate records with pagination + +```bash +csdk blueprint-template list --limit 10 --offset 0 +``` + +### List blueprintTemplate records with cursor pagination + +```bash +csdk blueprint-template list --limit 10 --after +``` + +### Find first matching blueprintTemplate + +```bash +csdk blueprint-template find-first --where.id.equalTo +``` + +### List blueprintTemplate records with field selection + +```bash +csdk blueprint-template list --select id,id +``` + +### List blueprintTemplate records with filtering and ordering + +```bash +csdk blueprint-template list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a blueprintTemplate ```bash diff --git a/.agents/skills/cli-public/references/blueprint.md b/.agents/skills/cli-public/references/blueprint.md index c5fa16738..94604c5c9 100644 --- a/.agents/skills/cli-public/references/blueprint.md +++ b/.agents/skills/cli-public/references/blueprint.md @@ -8,6 +8,9 @@ CRUD operations for Blueprint records via csdk CLI ```bash csdk blueprint list +csdk blueprint list --where.. --orderBy +csdk blueprint list --limit 10 --after +csdk blueprint find-first --where.. csdk blueprint get --id csdk blueprint create --ownerId --databaseId --name --displayName --definition [--description ] [--templateId ] [--status ] [--constructedAt ] [--errorDetails ] [--refMap ] [--constructedDefinition ] [--definitionHash ] [--tableHashes ] csdk blueprint update --id [--ownerId ] [--databaseId ] [--name ] [--displayName ] [--description ] [--definition ] [--templateId ] [--status ] [--constructedAt ] [--errorDetails ] [--refMap ] [--constructedDefinition ] [--definitionHash ] [--tableHashes ] @@ -16,12 +19,42 @@ csdk blueprint delete --id ## Examples -### List all blueprint records +### List blueprint records ```bash csdk blueprint list ``` +### List blueprint records with pagination + +```bash +csdk blueprint list --limit 10 --offset 0 +``` + +### List blueprint records with cursor pagination + +```bash +csdk blueprint list --limit 10 --after +``` + +### Find first matching blueprint + +```bash +csdk blueprint find-first --where.id.equalTo +``` + +### List blueprint records with field selection + +```bash +csdk blueprint list --select id,id +``` + +### List blueprint records with filtering and ordering + +```bash +csdk blueprint list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a blueprint ```bash diff --git a/.agents/skills/cli-public/references/check-constraint.md b/.agents/skills/cli-public/references/check-constraint.md index dde335d98..fcf131c5d 100644 --- a/.agents/skills/cli-public/references/check-constraint.md +++ b/.agents/skills/cli-public/references/check-constraint.md @@ -8,6 +8,9 @@ CRUD operations for CheckConstraint records via csdk CLI ```bash csdk check-constraint list +csdk check-constraint list --where.. --orderBy +csdk check-constraint list --limit 10 --after +csdk check-constraint find-first --where.. csdk check-constraint get --id csdk check-constraint create --tableId --fieldIds [--databaseId ] [--name ] [--type ] [--expr ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] csdk check-constraint update --id [--databaseId ] [--tableId ] [--name ] [--type ] [--fieldIds ] [--expr ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk check-constraint delete --id ## Examples -### List all checkConstraint records +### List checkConstraint records ```bash csdk check-constraint list ``` +### List checkConstraint records with pagination + +```bash +csdk check-constraint list --limit 10 --offset 0 +``` + +### List checkConstraint records with cursor pagination + +```bash +csdk check-constraint list --limit 10 --after +``` + +### Find first matching checkConstraint + +```bash +csdk check-constraint find-first --where.id.equalTo +``` + +### List checkConstraint records with field selection + +```bash +csdk check-constraint list --select id,id +``` + +### List checkConstraint records with filtering and ordering + +```bash +csdk check-constraint list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a checkConstraint ```bash diff --git a/.agents/skills/cli-public/references/claimed-invite.md b/.agents/skills/cli-public/references/claimed-invite.md index eb3b4d390..104b1753c 100644 --- a/.agents/skills/cli-public/references/claimed-invite.md +++ b/.agents/skills/cli-public/references/claimed-invite.md @@ -8,6 +8,9 @@ CRUD operations for ClaimedInvite records via csdk CLI ```bash csdk claimed-invite list +csdk claimed-invite list --where.. --orderBy +csdk claimed-invite list --limit 10 --after +csdk claimed-invite find-first --where.. csdk claimed-invite get --id csdk claimed-invite create [--data ] [--senderId ] [--receiverId ] csdk claimed-invite update --id [--data ] [--senderId ] [--receiverId ] @@ -16,12 +19,42 @@ csdk claimed-invite delete --id ## Examples -### List all claimedInvite records +### List claimedInvite records ```bash csdk claimed-invite list ``` +### List claimedInvite records with pagination + +```bash +csdk claimed-invite list --limit 10 --offset 0 +``` + +### List claimedInvite records with cursor pagination + +```bash +csdk claimed-invite list --limit 10 --after +``` + +### Find first matching claimedInvite + +```bash +csdk claimed-invite find-first --where.id.equalTo +``` + +### List claimedInvite records with field selection + +```bash +csdk claimed-invite list --select id,id +``` + +### List claimedInvite records with filtering and ordering + +```bash +csdk claimed-invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a claimedInvite ```bash diff --git a/.agents/skills/cli-public/references/commit.md b/.agents/skills/cli-public/references/commit.md index d08124bd3..62eca9428 100644 --- a/.agents/skills/cli-public/references/commit.md +++ b/.agents/skills/cli-public/references/commit.md @@ -8,6 +8,9 @@ CRUD operations for Commit records via csdk CLI ```bash csdk commit list +csdk commit list --where.. --orderBy +csdk commit list --limit 10 --after +csdk commit find-first --where.. csdk commit get --id csdk commit create --databaseId --storeId [--message ] [--parentIds ] [--authorId ] [--committerId ] [--treeId ] [--date ] csdk commit update --id [--message ] [--databaseId ] [--storeId ] [--parentIds ] [--authorId ] [--committerId ] [--treeId ] [--date ] @@ -16,12 +19,42 @@ csdk commit delete --id ## Examples -### List all commit records +### List commit records ```bash csdk commit list ``` +### List commit records with pagination + +```bash +csdk commit list --limit 10 --offset 0 +``` + +### List commit records with cursor pagination + +```bash +csdk commit list --limit 10 --after +``` + +### Find first matching commit + +```bash +csdk commit find-first --where.id.equalTo +``` + +### List commit records with field selection + +```bash +csdk commit list --select id,id +``` + +### List commit records with filtering and ordering + +```bash +csdk commit list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a commit ```bash diff --git a/.agents/skills/cli-public/references/connected-account.md b/.agents/skills/cli-public/references/connected-account.md index 4744ff431..866f6aaf1 100644 --- a/.agents/skills/cli-public/references/connected-account.md +++ b/.agents/skills/cli-public/references/connected-account.md @@ -8,6 +8,9 @@ CRUD operations for ConnectedAccount records via csdk CLI ```bash csdk connected-account list +csdk connected-account list --where.. --orderBy +csdk connected-account list --limit 10 --after +csdk connected-account find-first --where.. csdk connected-account get --id csdk connected-account create --service --identifier --details [--ownerId ] [--isVerified ] csdk connected-account update --id [--ownerId ] [--service ] [--identifier ] [--details ] [--isVerified ] @@ -16,12 +19,42 @@ csdk connected-account delete --id ## Examples -### List all connectedAccount records +### List connectedAccount records ```bash csdk connected-account list ``` +### List connectedAccount records with pagination + +```bash +csdk connected-account list --limit 10 --offset 0 +``` + +### List connectedAccount records with cursor pagination + +```bash +csdk connected-account list --limit 10 --after +``` + +### Find first matching connectedAccount + +```bash +csdk connected-account find-first --where.id.equalTo +``` + +### List connectedAccount records with field selection + +```bash +csdk connected-account list --select id,id +``` + +### List connectedAccount records with filtering and ordering + +```bash +csdk connected-account list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a connectedAccount ```bash diff --git a/.agents/skills/cli-public/references/connected-accounts-module.md b/.agents/skills/cli-public/references/connected-accounts-module.md index 7136c38b0..fc70f0c73 100644 --- a/.agents/skills/cli-public/references/connected-accounts-module.md +++ b/.agents/skills/cli-public/references/connected-accounts-module.md @@ -8,6 +8,9 @@ CRUD operations for ConnectedAccountsModule records via csdk CLI ```bash csdk connected-accounts-module list +csdk connected-accounts-module list --where.. --orderBy +csdk connected-accounts-module list --limit 10 --after +csdk connected-accounts-module find-first --where.. csdk connected-accounts-module get --id csdk connected-accounts-module create --databaseId --tableName [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] csdk connected-accounts-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] [--tableName ] @@ -16,12 +19,42 @@ csdk connected-accounts-module delete --id ## Examples -### List all connectedAccountsModule records +### List connectedAccountsModule records ```bash csdk connected-accounts-module list ``` +### List connectedAccountsModule records with pagination + +```bash +csdk connected-accounts-module list --limit 10 --offset 0 +``` + +### List connectedAccountsModule records with cursor pagination + +```bash +csdk connected-accounts-module list --limit 10 --after +``` + +### Find first matching connectedAccountsModule + +```bash +csdk connected-accounts-module find-first --where.id.equalTo +``` + +### List connectedAccountsModule records with field selection + +```bash +csdk connected-accounts-module list --select id,id +``` + +### List connectedAccountsModule records with filtering and ordering + +```bash +csdk connected-accounts-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a connectedAccountsModule ```bash diff --git a/.agents/skills/cli-public/references/crypto-address.md b/.agents/skills/cli-public/references/crypto-address.md index 7b695bd67..954ecfa53 100644 --- a/.agents/skills/cli-public/references/crypto-address.md +++ b/.agents/skills/cli-public/references/crypto-address.md @@ -8,6 +8,9 @@ CRUD operations for CryptoAddress records via csdk CLI ```bash csdk crypto-address list +csdk crypto-address list --where.. --orderBy +csdk crypto-address list --limit 10 --after +csdk crypto-address find-first --where.. csdk crypto-address get --id csdk crypto-address create --address [--ownerId ] [--isVerified ] [--isPrimary ] csdk crypto-address update --id [--ownerId ] [--address ] [--isVerified ] [--isPrimary ] @@ -16,12 +19,42 @@ csdk crypto-address delete --id ## Examples -### List all cryptoAddress records +### List cryptoAddress records ```bash csdk crypto-address list ``` +### List cryptoAddress records with pagination + +```bash +csdk crypto-address list --limit 10 --offset 0 +``` + +### List cryptoAddress records with cursor pagination + +```bash +csdk crypto-address list --limit 10 --after +``` + +### Find first matching cryptoAddress + +```bash +csdk crypto-address find-first --where.id.equalTo +``` + +### List cryptoAddress records with field selection + +```bash +csdk crypto-address list --select id,id +``` + +### List cryptoAddress records with filtering and ordering + +```bash +csdk crypto-address list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a cryptoAddress ```bash diff --git a/.agents/skills/cli-public/references/crypto-addresses-module.md b/.agents/skills/cli-public/references/crypto-addresses-module.md index a1f7e9da0..b464a0d6f 100644 --- a/.agents/skills/cli-public/references/crypto-addresses-module.md +++ b/.agents/skills/cli-public/references/crypto-addresses-module.md @@ -8,6 +8,9 @@ CRUD operations for CryptoAddressesModule records via csdk CLI ```bash csdk crypto-addresses-module list +csdk crypto-addresses-module list --where.. --orderBy +csdk crypto-addresses-module list --limit 10 --after +csdk crypto-addresses-module find-first --where.. csdk crypto-addresses-module get --id csdk crypto-addresses-module create --databaseId --tableName [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] [--cryptoNetwork ] csdk crypto-addresses-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] [--tableName ] [--cryptoNetwork ] @@ -16,12 +19,42 @@ csdk crypto-addresses-module delete --id ## Examples -### List all cryptoAddressesModule records +### List cryptoAddressesModule records ```bash csdk crypto-addresses-module list ``` +### List cryptoAddressesModule records with pagination + +```bash +csdk crypto-addresses-module list --limit 10 --offset 0 +``` + +### List cryptoAddressesModule records with cursor pagination + +```bash +csdk crypto-addresses-module list --limit 10 --after +``` + +### Find first matching cryptoAddressesModule + +```bash +csdk crypto-addresses-module find-first --where.id.equalTo +``` + +### List cryptoAddressesModule records with field selection + +```bash +csdk crypto-addresses-module list --select id,id +``` + +### List cryptoAddressesModule records with filtering and ordering + +```bash +csdk crypto-addresses-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a cryptoAddressesModule ```bash diff --git a/.agents/skills/cli-public/references/crypto-auth-module.md b/.agents/skills/cli-public/references/crypto-auth-module.md index 660666aaf..a10b53f7d 100644 --- a/.agents/skills/cli-public/references/crypto-auth-module.md +++ b/.agents/skills/cli-public/references/crypto-auth-module.md @@ -8,6 +8,9 @@ CRUD operations for CryptoAuthModule records via csdk CLI ```bash csdk crypto-auth-module list +csdk crypto-auth-module list --where.. --orderBy +csdk crypto-auth-module list --limit 10 --after +csdk crypto-auth-module find-first --where.. csdk crypto-auth-module get --id csdk crypto-auth-module create --databaseId --userField [--schemaId ] [--usersTableId ] [--secretsTableId ] [--sessionsTableId ] [--sessionCredentialsTableId ] [--addressesTableId ] [--cryptoNetwork ] [--signInRequestChallenge ] [--signInRecordFailure ] [--signUpWithKey ] [--signInWithChallenge ] csdk crypto-auth-module update --id [--databaseId ] [--schemaId ] [--usersTableId ] [--secretsTableId ] [--sessionsTableId ] [--sessionCredentialsTableId ] [--addressesTableId ] [--userField ] [--cryptoNetwork ] [--signInRequestChallenge ] [--signInRecordFailure ] [--signUpWithKey ] [--signInWithChallenge ] @@ -16,12 +19,42 @@ csdk crypto-auth-module delete --id ## Examples -### List all cryptoAuthModule records +### List cryptoAuthModule records ```bash csdk crypto-auth-module list ``` +### List cryptoAuthModule records with pagination + +```bash +csdk crypto-auth-module list --limit 10 --offset 0 +``` + +### List cryptoAuthModule records with cursor pagination + +```bash +csdk crypto-auth-module list --limit 10 --after +``` + +### Find first matching cryptoAuthModule + +```bash +csdk crypto-auth-module find-first --where.id.equalTo +``` + +### List cryptoAuthModule records with field selection + +```bash +csdk crypto-auth-module list --select id,id +``` + +### List cryptoAuthModule records with filtering and ordering + +```bash +csdk crypto-auth-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a cryptoAuthModule ```bash diff --git a/.agents/skills/cli-public/references/database-provision-module.md b/.agents/skills/cli-public/references/database-provision-module.md index 21aaef891..f89fdb3fa 100644 --- a/.agents/skills/cli-public/references/database-provision-module.md +++ b/.agents/skills/cli-public/references/database-provision-module.md @@ -8,6 +8,9 @@ CRUD operations for DatabaseProvisionModule records via csdk CLI ```bash csdk database-provision-module list +csdk database-provision-module list --where.. --orderBy +csdk database-provision-module list --limit 10 --after +csdk database-provision-module find-first --where.. csdk database-provision-module get --id csdk database-provision-module create --databaseName --ownerId --domain [--subdomain ] [--modules ] [--options ] [--bootstrapUser ] [--status ] [--errorMessage ] [--databaseId ] [--completedAt ] csdk database-provision-module update --id [--databaseName ] [--ownerId ] [--subdomain ] [--domain ] [--modules ] [--options ] [--bootstrapUser ] [--status ] [--errorMessage ] [--databaseId ] [--completedAt ] @@ -16,12 +19,42 @@ csdk database-provision-module delete --id ## Examples -### List all databaseProvisionModule records +### List databaseProvisionModule records ```bash csdk database-provision-module list ``` +### List databaseProvisionModule records with pagination + +```bash +csdk database-provision-module list --limit 10 --offset 0 +``` + +### List databaseProvisionModule records with cursor pagination + +```bash +csdk database-provision-module list --limit 10 --after +``` + +### Find first matching databaseProvisionModule + +```bash +csdk database-provision-module find-first --where.id.equalTo +``` + +### List databaseProvisionModule records with field selection + +```bash +csdk database-provision-module list --select id,id +``` + +### List databaseProvisionModule records with filtering and ordering + +```bash +csdk database-provision-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a databaseProvisionModule ```bash diff --git a/.agents/skills/cli-public/references/database-transfer.md b/.agents/skills/cli-public/references/database-transfer.md index 636f36fdb..50de09117 100644 --- a/.agents/skills/cli-public/references/database-transfer.md +++ b/.agents/skills/cli-public/references/database-transfer.md @@ -8,6 +8,9 @@ CRUD operations for DatabaseTransfer records via csdk CLI ```bash csdk database-transfer list +csdk database-transfer list --where.. --orderBy +csdk database-transfer list --limit 10 --after +csdk database-transfer find-first --where.. csdk database-transfer get --id csdk database-transfer create --databaseId --targetOwnerId --initiatedBy [--sourceApproved ] [--targetApproved ] [--sourceApprovedAt ] [--targetApprovedAt ] [--status ] [--notes ] [--expiresAt ] [--completedAt ] csdk database-transfer update --id [--databaseId ] [--targetOwnerId ] [--sourceApproved ] [--targetApproved ] [--sourceApprovedAt ] [--targetApprovedAt ] [--status ] [--initiatedBy ] [--notes ] [--expiresAt ] [--completedAt ] @@ -16,12 +19,42 @@ csdk database-transfer delete --id ## Examples -### List all databaseTransfer records +### List databaseTransfer records ```bash csdk database-transfer list ``` +### List databaseTransfer records with pagination + +```bash +csdk database-transfer list --limit 10 --offset 0 +``` + +### List databaseTransfer records with cursor pagination + +```bash +csdk database-transfer list --limit 10 --after +``` + +### Find first matching databaseTransfer + +```bash +csdk database-transfer find-first --where.id.equalTo +``` + +### List databaseTransfer records with field selection + +```bash +csdk database-transfer list --select id,id +``` + +### List databaseTransfer records with filtering and ordering + +```bash +csdk database-transfer list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a databaseTransfer ```bash diff --git a/.agents/skills/cli-public/references/database.md b/.agents/skills/cli-public/references/database.md index 5ce57f1f5..35e71400b 100644 --- a/.agents/skills/cli-public/references/database.md +++ b/.agents/skills/cli-public/references/database.md @@ -8,6 +8,9 @@ CRUD operations for Database records via csdk CLI ```bash csdk database list +csdk database list --where.. --orderBy +csdk database list --limit 10 --after +csdk database find-first --where.. csdk database get --id csdk database create [--ownerId ] [--schemaHash ] [--name ] [--label ] [--hash ] csdk database update --id [--ownerId ] [--schemaHash ] [--name ] [--label ] [--hash ] @@ -16,12 +19,42 @@ csdk database delete --id ## Examples -### List all database records +### List database records ```bash csdk database list ``` +### List database records with pagination + +```bash +csdk database list --limit 10 --offset 0 +``` + +### List database records with cursor pagination + +```bash +csdk database list --limit 10 --after +``` + +### Find first matching database + +```bash +csdk database find-first --where.id.equalTo +``` + +### List database records with field selection + +```bash +csdk database list --select id,id +``` + +### List database records with filtering and ordering + +```bash +csdk database list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a database ```bash diff --git a/.agents/skills/cli-public/references/default-ids-module.md b/.agents/skills/cli-public/references/default-ids-module.md index 9dfc631ed..00d5ec0db 100644 --- a/.agents/skills/cli-public/references/default-ids-module.md +++ b/.agents/skills/cli-public/references/default-ids-module.md @@ -8,6 +8,9 @@ CRUD operations for DefaultIdsModule records via csdk CLI ```bash csdk default-ids-module list +csdk default-ids-module list --where.. --orderBy +csdk default-ids-module list --limit 10 --after +csdk default-ids-module find-first --where.. csdk default-ids-module get --id csdk default-ids-module create --databaseId csdk default-ids-module update --id [--databaseId ] @@ -16,12 +19,42 @@ csdk default-ids-module delete --id ## Examples -### List all defaultIdsModule records +### List defaultIdsModule records ```bash csdk default-ids-module list ``` +### List defaultIdsModule records with pagination + +```bash +csdk default-ids-module list --limit 10 --offset 0 +``` + +### List defaultIdsModule records with cursor pagination + +```bash +csdk default-ids-module list --limit 10 --after +``` + +### Find first matching defaultIdsModule + +```bash +csdk default-ids-module find-first --where.id.equalTo +``` + +### List defaultIdsModule records with field selection + +```bash +csdk default-ids-module list --select id,id +``` + +### List defaultIdsModule records with filtering and ordering + +```bash +csdk default-ids-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a defaultIdsModule ```bash diff --git a/.agents/skills/cli-public/references/default-privilege.md b/.agents/skills/cli-public/references/default-privilege.md index 33fb2e377..ae3d299be 100644 --- a/.agents/skills/cli-public/references/default-privilege.md +++ b/.agents/skills/cli-public/references/default-privilege.md @@ -8,6 +8,9 @@ CRUD operations for DefaultPrivilege records via csdk CLI ```bash csdk default-privilege list +csdk default-privilege list --where.. --orderBy +csdk default-privilege list --limit 10 --after +csdk default-privilege find-first --where.. csdk default-privilege get --id csdk default-privilege create --schemaId --objectType --privilege --granteeName [--databaseId ] [--isGrant ] csdk default-privilege update --id [--databaseId ] [--schemaId ] [--objectType ] [--privilege ] [--granteeName ] [--isGrant ] @@ -16,12 +19,42 @@ csdk default-privilege delete --id ## Examples -### List all defaultPrivilege records +### List defaultPrivilege records ```bash csdk default-privilege list ``` +### List defaultPrivilege records with pagination + +```bash +csdk default-privilege list --limit 10 --offset 0 +``` + +### List defaultPrivilege records with cursor pagination + +```bash +csdk default-privilege list --limit 10 --after +``` + +### Find first matching defaultPrivilege + +```bash +csdk default-privilege find-first --where.id.equalTo +``` + +### List defaultPrivilege records with field selection + +```bash +csdk default-privilege list --select id,id +``` + +### List defaultPrivilege records with filtering and ordering + +```bash +csdk default-privilege list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a defaultPrivilege ```bash diff --git a/.agents/skills/cli-public/references/denormalized-table-field.md b/.agents/skills/cli-public/references/denormalized-table-field.md index 573eedb61..52d474670 100644 --- a/.agents/skills/cli-public/references/denormalized-table-field.md +++ b/.agents/skills/cli-public/references/denormalized-table-field.md @@ -8,6 +8,9 @@ CRUD operations for DenormalizedTableField records via csdk CLI ```bash csdk denormalized-table-field list +csdk denormalized-table-field list --where.. --orderBy +csdk denormalized-table-field list --limit 10 --after +csdk denormalized-table-field find-first --where.. csdk denormalized-table-field get --id csdk denormalized-table-field create --databaseId --tableId --fieldId --refTableId --refFieldId [--setIds ] [--refIds ] [--useUpdates ] [--updateDefaults ] [--funcName ] [--funcOrder ] csdk denormalized-table-field update --id [--databaseId ] [--tableId ] [--fieldId ] [--setIds ] [--refTableId ] [--refFieldId ] [--refIds ] [--useUpdates ] [--updateDefaults ] [--funcName ] [--funcOrder ] @@ -16,12 +19,42 @@ csdk denormalized-table-field delete --id ## Examples -### List all denormalizedTableField records +### List denormalizedTableField records ```bash csdk denormalized-table-field list ``` +### List denormalizedTableField records with pagination + +```bash +csdk denormalized-table-field list --limit 10 --offset 0 +``` + +### List denormalizedTableField records with cursor pagination + +```bash +csdk denormalized-table-field list --limit 10 --after +``` + +### Find first matching denormalizedTableField + +```bash +csdk denormalized-table-field find-first --where.id.equalTo +``` + +### List denormalizedTableField records with field selection + +```bash +csdk denormalized-table-field list --select id,id +``` + +### List denormalizedTableField records with filtering and ordering + +```bash +csdk denormalized-table-field list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a denormalizedTableField ```bash diff --git a/.agents/skills/cli-public/references/domain.md b/.agents/skills/cli-public/references/domain.md index 2444923b9..b48978a13 100644 --- a/.agents/skills/cli-public/references/domain.md +++ b/.agents/skills/cli-public/references/domain.md @@ -8,6 +8,9 @@ CRUD operations for Domain records via csdk CLI ```bash csdk domain list +csdk domain list --where.. --orderBy +csdk domain list --limit 10 --after +csdk domain find-first --where.. csdk domain get --id csdk domain create --databaseId [--apiId ] [--siteId ] [--subdomain ] [--domain ] csdk domain update --id [--databaseId ] [--apiId ] [--siteId ] [--subdomain ] [--domain ] @@ -16,12 +19,42 @@ csdk domain delete --id ## Examples -### List all domain records +### List domain records ```bash csdk domain list ``` +### List domain records with pagination + +```bash +csdk domain list --limit 10 --offset 0 +``` + +### List domain records with cursor pagination + +```bash +csdk domain list --limit 10 --after +``` + +### Find first matching domain + +```bash +csdk domain find-first --where.id.equalTo +``` + +### List domain records with field selection + +```bash +csdk domain list --select id,id +``` + +### List domain records with filtering and ordering + +```bash +csdk domain list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a domain ```bash diff --git a/.agents/skills/cli-public/references/email.md b/.agents/skills/cli-public/references/email.md index 5fcee25e7..367bb914e 100644 --- a/.agents/skills/cli-public/references/email.md +++ b/.agents/skills/cli-public/references/email.md @@ -8,6 +8,9 @@ CRUD operations for Email records via csdk CLI ```bash csdk email list +csdk email list --where.. --orderBy +csdk email list --limit 10 --after +csdk email find-first --where.. csdk email get --id csdk email create --email [--ownerId ] [--isVerified ] [--isPrimary ] csdk email update --id [--ownerId ] [--email ] [--isVerified ] [--isPrimary ] @@ -16,12 +19,42 @@ csdk email delete --id ## Examples -### List all email records +### List email records ```bash csdk email list ``` +### List email records with pagination + +```bash +csdk email list --limit 10 --offset 0 +``` + +### List email records with cursor pagination + +```bash +csdk email list --limit 10 --after +``` + +### Find first matching email + +```bash +csdk email find-first --where.id.equalTo +``` + +### List email records with field selection + +```bash +csdk email list --select id,id +``` + +### List email records with filtering and ordering + +```bash +csdk email list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a email ```bash diff --git a/.agents/skills/cli-public/references/emails-module.md b/.agents/skills/cli-public/references/emails-module.md index 3ce9d90d5..24be6b0dd 100644 --- a/.agents/skills/cli-public/references/emails-module.md +++ b/.agents/skills/cli-public/references/emails-module.md @@ -8,6 +8,9 @@ CRUD operations for EmailsModule records via csdk CLI ```bash csdk emails-module list +csdk emails-module list --where.. --orderBy +csdk emails-module list --limit 10 --after +csdk emails-module find-first --where.. csdk emails-module get --id csdk emails-module create --databaseId --tableName [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] csdk emails-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] [--tableName ] @@ -16,12 +19,42 @@ csdk emails-module delete --id ## Examples -### List all emailsModule records +### List emailsModule records ```bash csdk emails-module list ``` +### List emailsModule records with pagination + +```bash +csdk emails-module list --limit 10 --offset 0 +``` + +### List emailsModule records with cursor pagination + +```bash +csdk emails-module list --limit 10 --after +``` + +### Find first matching emailsModule + +```bash +csdk emails-module find-first --where.id.equalTo +``` + +### List emailsModule records with field selection + +```bash +csdk emails-module list --select id,id +``` + +### List emailsModule records with filtering and ordering + +```bash +csdk emails-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a emailsModule ```bash diff --git a/.agents/skills/cli-public/references/embedding-chunk.md b/.agents/skills/cli-public/references/embedding-chunk.md index e4c8dcb8f..36de27d0b 100644 --- a/.agents/skills/cli-public/references/embedding-chunk.md +++ b/.agents/skills/cli-public/references/embedding-chunk.md @@ -8,6 +8,9 @@ CRUD operations for EmbeddingChunk records via csdk CLI ```bash csdk embedding-chunk list +csdk embedding-chunk list --where.. --orderBy +csdk embedding-chunk list --limit 10 --after +csdk embedding-chunk find-first --where.. csdk embedding-chunk get --id csdk embedding-chunk create --tableId [--databaseId ] [--embeddingFieldId ] [--chunksTableId ] [--chunksTableName ] [--contentFieldName ] [--dimensions ] [--metric ] [--chunkSize ] [--chunkOverlap ] [--chunkStrategy ] [--metadataFields ] [--enqueueChunkingJob ] [--chunkingTaskName ] [--parentFkFieldId ] csdk embedding-chunk update --id [--databaseId ] [--tableId ] [--embeddingFieldId ] [--chunksTableId ] [--chunksTableName ] [--contentFieldName ] [--dimensions ] [--metric ] [--chunkSize ] [--chunkOverlap ] [--chunkStrategy ] [--metadataFields ] [--enqueueChunkingJob ] [--chunkingTaskName ] [--parentFkFieldId ] @@ -16,12 +19,42 @@ csdk embedding-chunk delete --id ## Examples -### List all embeddingChunk records +### List embeddingChunk records ```bash csdk embedding-chunk list ``` +### List embeddingChunk records with pagination + +```bash +csdk embedding-chunk list --limit 10 --offset 0 +``` + +### List embeddingChunk records with cursor pagination + +```bash +csdk embedding-chunk list --limit 10 --after +``` + +### Find first matching embeddingChunk + +```bash +csdk embedding-chunk find-first --where.id.equalTo +``` + +### List embeddingChunk records with field selection + +```bash +csdk embedding-chunk list --select id,id +``` + +### List embeddingChunk records with filtering and ordering + +```bash +csdk embedding-chunk list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a embeddingChunk ```bash diff --git a/.agents/skills/cli-public/references/encrypted-secrets-module.md b/.agents/skills/cli-public/references/encrypted-secrets-module.md index 7e8e0e091..2f6717deb 100644 --- a/.agents/skills/cli-public/references/encrypted-secrets-module.md +++ b/.agents/skills/cli-public/references/encrypted-secrets-module.md @@ -8,6 +8,9 @@ CRUD operations for EncryptedSecretsModule records via csdk CLI ```bash csdk encrypted-secrets-module list +csdk encrypted-secrets-module list --where.. --orderBy +csdk encrypted-secrets-module list --limit 10 --after +csdk encrypted-secrets-module find-first --where.. csdk encrypted-secrets-module get --id csdk encrypted-secrets-module create --databaseId [--schemaId ] [--tableId ] [--tableName ] csdk encrypted-secrets-module update --id [--databaseId ] [--schemaId ] [--tableId ] [--tableName ] @@ -16,12 +19,42 @@ csdk encrypted-secrets-module delete --id ## Examples -### List all encryptedSecretsModule records +### List encryptedSecretsModule records ```bash csdk encrypted-secrets-module list ``` +### List encryptedSecretsModule records with pagination + +```bash +csdk encrypted-secrets-module list --limit 10 --offset 0 +``` + +### List encryptedSecretsModule records with cursor pagination + +```bash +csdk encrypted-secrets-module list --limit 10 --after +``` + +### Find first matching encryptedSecretsModule + +```bash +csdk encrypted-secrets-module find-first --where.id.equalTo +``` + +### List encryptedSecretsModule records with field selection + +```bash +csdk encrypted-secrets-module list --select id,id +``` + +### List encryptedSecretsModule records with filtering and ordering + +```bash +csdk encrypted-secrets-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a encryptedSecretsModule ```bash diff --git a/.agents/skills/cli-public/references/enum.md b/.agents/skills/cli-public/references/enum.md index 324ee3678..756eea869 100644 --- a/.agents/skills/cli-public/references/enum.md +++ b/.agents/skills/cli-public/references/enum.md @@ -8,6 +8,9 @@ CRUD operations for Enum records via csdk CLI ```bash csdk enum list +csdk enum list --where.. --orderBy +csdk enum list --limit 10 --after +csdk enum find-first --where.. csdk enum get --id csdk enum create --databaseId --schemaId --name [--label ] [--description ] [--values ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] csdk enum update --id [--databaseId ] [--schemaId ] [--name ] [--label ] [--description ] [--values ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk enum delete --id ## Examples -### List all enum records +### List enum records ```bash csdk enum list ``` +### List enum records with pagination + +```bash +csdk enum list --limit 10 --offset 0 +``` + +### List enum records with cursor pagination + +```bash +csdk enum list --limit 10 --after +``` + +### Find first matching enum + +```bash +csdk enum find-first --where.id.equalTo +``` + +### List enum records with field selection + +```bash +csdk enum list --select id,id +``` + +### List enum records with filtering and ordering + +```bash +csdk enum list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a enum ```bash diff --git a/.agents/skills/cli-public/references/field.md b/.agents/skills/cli-public/references/field.md index 07b765589..f8815e63e 100644 --- a/.agents/skills/cli-public/references/field.md +++ b/.agents/skills/cli-public/references/field.md @@ -8,6 +8,9 @@ CRUD operations for Field records via csdk CLI ```bash csdk field list +csdk field list --where.. --orderBy +csdk field list --limit 10 --after +csdk field find-first --where.. csdk field get --id csdk field create --tableId --name --type [--databaseId ] [--label ] [--description ] [--smartTags ] [--isRequired ] [--apiRequired ] [--defaultValue ] [--defaultValueAst ] [--fieldOrder ] [--regexp ] [--chk ] [--chkExpr ] [--min ] [--max ] [--tags ] [--category ] [--module ] [--scope ] csdk field update --id [--databaseId ] [--tableId ] [--name ] [--label ] [--description ] [--smartTags ] [--isRequired ] [--apiRequired ] [--defaultValue ] [--defaultValueAst ] [--type ] [--fieldOrder ] [--regexp ] [--chk ] [--chkExpr ] [--min ] [--max ] [--tags ] [--category ] [--module ] [--scope ] @@ -16,12 +19,42 @@ csdk field delete --id ## Examples -### List all field records +### List field records ```bash csdk field list ``` +### List field records with pagination + +```bash +csdk field list --limit 10 --offset 0 +``` + +### List field records with cursor pagination + +```bash +csdk field list --limit 10 --after +``` + +### Find first matching field + +```bash +csdk field find-first --where.id.equalTo +``` + +### List field records with field selection + +```bash +csdk field list --select id,id +``` + +### List field records with filtering and ordering + +```bash +csdk field list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a field ```bash diff --git a/.agents/skills/cli-public/references/foreign-key-constraint.md b/.agents/skills/cli-public/references/foreign-key-constraint.md index d390a94b4..4dd8dd2ef 100644 --- a/.agents/skills/cli-public/references/foreign-key-constraint.md +++ b/.agents/skills/cli-public/references/foreign-key-constraint.md @@ -8,6 +8,9 @@ CRUD operations for ForeignKeyConstraint records via csdk CLI ```bash csdk foreign-key-constraint list +csdk foreign-key-constraint list --where.. --orderBy +csdk foreign-key-constraint list --limit 10 --after +csdk foreign-key-constraint find-first --where.. csdk foreign-key-constraint get --id csdk foreign-key-constraint create --tableId --fieldIds --refTableId --refFieldIds [--databaseId ] [--name ] [--description ] [--smartTags ] [--type ] [--deleteAction ] [--updateAction ] [--category ] [--module ] [--scope ] [--tags ] csdk foreign-key-constraint update --id [--databaseId ] [--tableId ] [--name ] [--description ] [--smartTags ] [--type ] [--fieldIds ] [--refTableId ] [--refFieldIds ] [--deleteAction ] [--updateAction ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk foreign-key-constraint delete --id ## Examples -### List all foreignKeyConstraint records +### List foreignKeyConstraint records ```bash csdk foreign-key-constraint list ``` +### List foreignKeyConstraint records with pagination + +```bash +csdk foreign-key-constraint list --limit 10 --offset 0 +``` + +### List foreignKeyConstraint records with cursor pagination + +```bash +csdk foreign-key-constraint list --limit 10 --after +``` + +### Find first matching foreignKeyConstraint + +```bash +csdk foreign-key-constraint find-first --where.id.equalTo +``` + +### List foreignKeyConstraint records with field selection + +```bash +csdk foreign-key-constraint list --select id,id +``` + +### List foreignKeyConstraint records with filtering and ordering + +```bash +csdk foreign-key-constraint list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a foreignKeyConstraint ```bash diff --git a/.agents/skills/cli-public/references/full-text-search.md b/.agents/skills/cli-public/references/full-text-search.md index c51839838..88f932621 100644 --- a/.agents/skills/cli-public/references/full-text-search.md +++ b/.agents/skills/cli-public/references/full-text-search.md @@ -8,6 +8,9 @@ CRUD operations for FullTextSearch records via csdk CLI ```bash csdk full-text-search list +csdk full-text-search list --where.. --orderBy +csdk full-text-search list --limit 10 --after +csdk full-text-search find-first --where.. csdk full-text-search get --id csdk full-text-search create --tableId --fieldId --fieldIds --weights --langs [--databaseId ] csdk full-text-search update --id [--databaseId ] [--tableId ] [--fieldId ] [--fieldIds ] [--weights ] [--langs ] @@ -16,12 +19,42 @@ csdk full-text-search delete --id ## Examples -### List all fullTextSearch records +### List fullTextSearch records ```bash csdk full-text-search list ``` +### List fullTextSearch records with pagination + +```bash +csdk full-text-search list --limit 10 --offset 0 +``` + +### List fullTextSearch records with cursor pagination + +```bash +csdk full-text-search list --limit 10 --after +``` + +### Find first matching fullTextSearch + +```bash +csdk full-text-search find-first --where.id.equalTo +``` + +### List fullTextSearch records with field selection + +```bash +csdk full-text-search list --select id,id +``` + +### List fullTextSearch records with filtering and ordering + +```bash +csdk full-text-search list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a fullTextSearch ```bash diff --git a/.agents/skills/cli-public/references/get-all-record.md b/.agents/skills/cli-public/references/get-all-record.md index 95294973c..b9b5a653d 100644 --- a/.agents/skills/cli-public/references/get-all-record.md +++ b/.agents/skills/cli-public/references/get-all-record.md @@ -8,6 +8,9 @@ CRUD operations for GetAllRecord records via csdk CLI ```bash csdk get-all-record list +csdk get-all-record list --where.. --orderBy +csdk get-all-record list --limit 10 --after +csdk get-all-record find-first --where.. csdk get-all-record get --id csdk get-all-record create --path --data csdk get-all-record update --id [--path ] [--data ] @@ -16,12 +19,42 @@ csdk get-all-record delete --id ## Examples -### List all getAllRecord records +### List getAllRecord records ```bash csdk get-all-record list ``` +### List getAllRecord records with pagination + +```bash +csdk get-all-record list --limit 10 --offset 0 +``` + +### List getAllRecord records with cursor pagination + +```bash +csdk get-all-record list --limit 10 --after +``` + +### Find first matching getAllRecord + +```bash +csdk get-all-record find-first --where.id.equalTo +``` + +### List getAllRecord records with field selection + +```bash +csdk get-all-record list --select id,id +``` + +### List getAllRecord records with filtering and ordering + +```bash +csdk get-all-record list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a getAllRecord ```bash diff --git a/.agents/skills/cli-public/references/hierarchy-module.md b/.agents/skills/cli-public/references/hierarchy-module.md index e40f6eb18..ab1a347ae 100644 --- a/.agents/skills/cli-public/references/hierarchy-module.md +++ b/.agents/skills/cli-public/references/hierarchy-module.md @@ -8,6 +8,9 @@ CRUD operations for HierarchyModule records via csdk CLI ```bash csdk hierarchy-module list +csdk hierarchy-module list --where.. --orderBy +csdk hierarchy-module list --limit 10 --after +csdk hierarchy-module find-first --where.. csdk hierarchy-module get --id csdk hierarchy-module create --databaseId --entityTableId --usersTableId [--schemaId ] [--privateSchemaId ] [--chartEdgesTableId ] [--chartEdgesTableName ] [--hierarchySprtTableId ] [--hierarchySprtTableName ] [--chartEdgeGrantsTableId ] [--chartEdgeGrantsTableName ] [--prefix ] [--privateSchemaName ] [--sprtTableName ] [--rebuildHierarchyFunction ] [--getSubordinatesFunction ] [--getManagersFunction ] [--isManagerOfFunction ] csdk hierarchy-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--chartEdgesTableId ] [--chartEdgesTableName ] [--hierarchySprtTableId ] [--hierarchySprtTableName ] [--chartEdgeGrantsTableId ] [--chartEdgeGrantsTableName ] [--entityTableId ] [--usersTableId ] [--prefix ] [--privateSchemaName ] [--sprtTableName ] [--rebuildHierarchyFunction ] [--getSubordinatesFunction ] [--getManagersFunction ] [--isManagerOfFunction ] @@ -16,12 +19,42 @@ csdk hierarchy-module delete --id ## Examples -### List all hierarchyModule records +### List hierarchyModule records ```bash csdk hierarchy-module list ``` +### List hierarchyModule records with pagination + +```bash +csdk hierarchy-module list --limit 10 --offset 0 +``` + +### List hierarchyModule records with cursor pagination + +```bash +csdk hierarchy-module list --limit 10 --after +``` + +### Find first matching hierarchyModule + +```bash +csdk hierarchy-module find-first --where.id.equalTo +``` + +### List hierarchyModule records with field selection + +```bash +csdk hierarchy-module list --select id,id +``` + +### List hierarchyModule records with filtering and ordering + +```bash +csdk hierarchy-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a hierarchyModule ```bash diff --git a/.agents/skills/cli-public/references/index.md b/.agents/skills/cli-public/references/index.md index 5490f3219..06ae4bee7 100644 --- a/.agents/skills/cli-public/references/index.md +++ b/.agents/skills/cli-public/references/index.md @@ -8,6 +8,9 @@ CRUD operations for Index records via csdk CLI ```bash csdk index list +csdk index list --where.. --orderBy +csdk index list --limit 10 --after +csdk index find-first --where.. csdk index get --id csdk index create --databaseId --tableId [--name ] [--fieldIds ] [--includeFieldIds ] [--accessMethod ] [--indexParams ] [--whereClause ] [--isUnique ] [--options ] [--opClasses ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] csdk index update --id [--databaseId ] [--tableId ] [--name ] [--fieldIds ] [--includeFieldIds ] [--accessMethod ] [--indexParams ] [--whereClause ] [--isUnique ] [--options ] [--opClasses ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk index delete --id ## Examples -### List all index records +### List index records ```bash csdk index list ``` +### List index records with pagination + +```bash +csdk index list --limit 10 --offset 0 +``` + +### List index records with cursor pagination + +```bash +csdk index list --limit 10 --after +``` + +### Find first matching index + +```bash +csdk index find-first --where.id.equalTo +``` + +### List index records with field selection + +```bash +csdk index list --select id,id +``` + +### List index records with filtering and ordering + +```bash +csdk index list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a index ```bash diff --git a/.agents/skills/cli-public/references/invite.md b/.agents/skills/cli-public/references/invite.md index c2f5ecced..640c18bd1 100644 --- a/.agents/skills/cli-public/references/invite.md +++ b/.agents/skills/cli-public/references/invite.md @@ -8,6 +8,9 @@ CRUD operations for Invite records via csdk CLI ```bash csdk invite list +csdk invite list --where.. --orderBy +csdk invite list --limit 10 --after +csdk invite find-first --where.. csdk invite get --id csdk invite create [--email ] [--senderId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] csdk invite update --id [--email ] [--senderId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] @@ -16,12 +19,42 @@ csdk invite delete --id ## Examples -### List all invite records +### List invite records ```bash csdk invite list ``` +### List invite records with pagination + +```bash +csdk invite list --limit 10 --offset 0 +``` + +### List invite records with cursor pagination + +```bash +csdk invite list --limit 10 --after +``` + +### Find first matching invite + +```bash +csdk invite find-first --where.id.equalTo +``` + +### List invite records with field selection + +```bash +csdk invite list --select id,id +``` + +### List invite records with filtering and ordering + +```bash +csdk invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a invite ```bash diff --git a/.agents/skills/cli-public/references/invites-module.md b/.agents/skills/cli-public/references/invites-module.md index 15e72225c..614d1350f 100644 --- a/.agents/skills/cli-public/references/invites-module.md +++ b/.agents/skills/cli-public/references/invites-module.md @@ -8,6 +8,9 @@ CRUD operations for InvitesModule records via csdk CLI ```bash csdk invites-module list +csdk invites-module list --where.. --orderBy +csdk invites-module list --limit 10 --after +csdk invites-module find-first --where.. csdk invites-module get --id csdk invites-module create --databaseId --membershipType [--schemaId ] [--privateSchemaId ] [--emailsTableId ] [--usersTableId ] [--invitesTableId ] [--claimedInvitesTableId ] [--invitesTableName ] [--claimedInvitesTableName ] [--submitInviteCodeFunction ] [--prefix ] [--entityTableId ] csdk invites-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--emailsTableId ] [--usersTableId ] [--invitesTableId ] [--claimedInvitesTableId ] [--invitesTableName ] [--claimedInvitesTableName ] [--submitInviteCodeFunction ] [--prefix ] [--membershipType ] [--entityTableId ] @@ -16,12 +19,42 @@ csdk invites-module delete --id ## Examples -### List all invitesModule records +### List invitesModule records ```bash csdk invites-module list ``` +### List invitesModule records with pagination + +```bash +csdk invites-module list --limit 10 --offset 0 +``` + +### List invitesModule records with cursor pagination + +```bash +csdk invites-module list --limit 10 --after +``` + +### Find first matching invitesModule + +```bash +csdk invites-module find-first --where.id.equalTo +``` + +### List invitesModule records with field selection + +```bash +csdk invites-module list --select id,id +``` + +### List invitesModule records with filtering and ordering + +```bash +csdk invites-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a invitesModule ```bash diff --git a/.agents/skills/cli-public/references/levels-module.md b/.agents/skills/cli-public/references/levels-module.md index ef9154a49..992fcd7ab 100644 --- a/.agents/skills/cli-public/references/levels-module.md +++ b/.agents/skills/cli-public/references/levels-module.md @@ -8,6 +8,9 @@ CRUD operations for LevelsModule records via csdk CLI ```bash csdk levels-module list +csdk levels-module list --where.. --orderBy +csdk levels-module list --limit 10 --after +csdk levels-module find-first --where.. csdk levels-module get --id csdk levels-module create --databaseId --membershipType [--schemaId ] [--privateSchemaId ] [--stepsTableId ] [--stepsTableName ] [--achievementsTableId ] [--achievementsTableName ] [--levelsTableId ] [--levelsTableName ] [--levelRequirementsTableId ] [--levelRequirementsTableName ] [--completedStep ] [--incompletedStep ] [--tgAchievement ] [--tgAchievementToggle ] [--tgAchievementToggleBoolean ] [--tgAchievementBoolean ] [--upsertAchievement ] [--tgUpdateAchievements ] [--stepsRequired ] [--levelAchieved ] [--prefix ] [--entityTableId ] [--actorTableId ] csdk levels-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--stepsTableId ] [--stepsTableName ] [--achievementsTableId ] [--achievementsTableName ] [--levelsTableId ] [--levelsTableName ] [--levelRequirementsTableId ] [--levelRequirementsTableName ] [--completedStep ] [--incompletedStep ] [--tgAchievement ] [--tgAchievementToggle ] [--tgAchievementToggleBoolean ] [--tgAchievementBoolean ] [--upsertAchievement ] [--tgUpdateAchievements ] [--stepsRequired ] [--levelAchieved ] [--prefix ] [--membershipType ] [--entityTableId ] [--actorTableId ] @@ -16,12 +19,42 @@ csdk levels-module delete --id ## Examples -### List all levelsModule records +### List levelsModule records ```bash csdk levels-module list ``` +### List levelsModule records with pagination + +```bash +csdk levels-module list --limit 10 --offset 0 +``` + +### List levelsModule records with cursor pagination + +```bash +csdk levels-module list --limit 10 --after +``` + +### Find first matching levelsModule + +```bash +csdk levels-module find-first --where.id.equalTo +``` + +### List levelsModule records with field selection + +```bash +csdk levels-module list --select id,id +``` + +### List levelsModule records with filtering and ordering + +```bash +csdk levels-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a levelsModule ```bash diff --git a/.agents/skills/cli-public/references/limits-module.md b/.agents/skills/cli-public/references/limits-module.md index 30bb19115..ff57e8c4c 100644 --- a/.agents/skills/cli-public/references/limits-module.md +++ b/.agents/skills/cli-public/references/limits-module.md @@ -8,6 +8,9 @@ CRUD operations for LimitsModule records via csdk CLI ```bash csdk limits-module list +csdk limits-module list --where.. --orderBy +csdk limits-module list --limit 10 --after +csdk limits-module find-first --where.. csdk limits-module get --id csdk limits-module create --databaseId --membershipType [--schemaId ] [--privateSchemaId ] [--tableId ] [--tableName ] [--defaultTableId ] [--defaultTableName ] [--limitIncrementFunction ] [--limitDecrementFunction ] [--limitIncrementTrigger ] [--limitDecrementTrigger ] [--limitUpdateTrigger ] [--limitCheckFunction ] [--prefix ] [--entityTableId ] [--actorTableId ] csdk limits-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--tableName ] [--defaultTableId ] [--defaultTableName ] [--limitIncrementFunction ] [--limitDecrementFunction ] [--limitIncrementTrigger ] [--limitDecrementTrigger ] [--limitUpdateTrigger ] [--limitCheckFunction ] [--prefix ] [--membershipType ] [--entityTableId ] [--actorTableId ] @@ -16,12 +19,42 @@ csdk limits-module delete --id ## Examples -### List all limitsModule records +### List limitsModule records ```bash csdk limits-module list ``` +### List limitsModule records with pagination + +```bash +csdk limits-module list --limit 10 --offset 0 +``` + +### List limitsModule records with cursor pagination + +```bash +csdk limits-module list --limit 10 --after +``` + +### Find first matching limitsModule + +```bash +csdk limits-module find-first --where.id.equalTo +``` + +### List limitsModule records with field selection + +```bash +csdk limits-module list --select id,id +``` + +### List limitsModule records with filtering and ordering + +```bash +csdk limits-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a limitsModule ```bash diff --git a/.agents/skills/cli-public/references/membership-type.md b/.agents/skills/cli-public/references/membership-type.md index d7d30e4da..657508364 100644 --- a/.agents/skills/cli-public/references/membership-type.md +++ b/.agents/skills/cli-public/references/membership-type.md @@ -8,6 +8,9 @@ CRUD operations for MembershipType records via csdk CLI ```bash csdk membership-type list +csdk membership-type list --where.. --orderBy +csdk membership-type list --limit 10 --after +csdk membership-type find-first --where.. csdk membership-type get --id csdk membership-type create --name --description --prefix csdk membership-type update --id [--name ] [--description ] [--prefix ] @@ -16,12 +19,42 @@ csdk membership-type delete --id ## Examples -### List all membershipType records +### List membershipType records ```bash csdk membership-type list ``` +### List membershipType records with pagination + +```bash +csdk membership-type list --limit 10 --offset 0 +``` + +### List membershipType records with cursor pagination + +```bash +csdk membership-type list --limit 10 --after +``` + +### Find first matching membershipType + +```bash +csdk membership-type find-first --where.id.equalTo +``` + +### List membershipType records with field selection + +```bash +csdk membership-type list --select id,id +``` + +### List membershipType records with filtering and ordering + +```bash +csdk membership-type list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a membershipType ```bash diff --git a/.agents/skills/cli-public/references/membership-types-module.md b/.agents/skills/cli-public/references/membership-types-module.md index 9005ef2f8..11b1c2042 100644 --- a/.agents/skills/cli-public/references/membership-types-module.md +++ b/.agents/skills/cli-public/references/membership-types-module.md @@ -8,6 +8,9 @@ CRUD operations for MembershipTypesModule records via csdk CLI ```bash csdk membership-types-module list +csdk membership-types-module list --where.. --orderBy +csdk membership-types-module list --limit 10 --after +csdk membership-types-module find-first --where.. csdk membership-types-module get --id csdk membership-types-module create --databaseId [--schemaId ] [--tableId ] [--tableName ] csdk membership-types-module update --id [--databaseId ] [--schemaId ] [--tableId ] [--tableName ] @@ -16,12 +19,42 @@ csdk membership-types-module delete --id ## Examples -### List all membershipTypesModule records +### List membershipTypesModule records ```bash csdk membership-types-module list ``` +### List membershipTypesModule records with pagination + +```bash +csdk membership-types-module list --limit 10 --offset 0 +``` + +### List membershipTypesModule records with cursor pagination + +```bash +csdk membership-types-module list --limit 10 --after +``` + +### Find first matching membershipTypesModule + +```bash +csdk membership-types-module find-first --where.id.equalTo +``` + +### List membershipTypesModule records with field selection + +```bash +csdk membership-types-module list --select id,id +``` + +### List membershipTypesModule records with filtering and ordering + +```bash +csdk membership-types-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a membershipTypesModule ```bash diff --git a/.agents/skills/cli-public/references/memberships-module.md b/.agents/skills/cli-public/references/memberships-module.md index b8cdb1ef1..cbbe91dfc 100644 --- a/.agents/skills/cli-public/references/memberships-module.md +++ b/.agents/skills/cli-public/references/memberships-module.md @@ -8,6 +8,9 @@ CRUD operations for MembershipsModule records via csdk CLI ```bash csdk memberships-module list +csdk memberships-module list --where.. --orderBy +csdk memberships-module list --limit 10 --after +csdk memberships-module find-first --where.. csdk memberships-module get --id csdk memberships-module create --databaseId --membershipType [--schemaId ] [--privateSchemaId ] [--membershipsTableId ] [--membershipsTableName ] [--membersTableId ] [--membersTableName ] [--membershipDefaultsTableId ] [--membershipDefaultsTableName ] [--grantsTableId ] [--grantsTableName ] [--actorTableId ] [--limitsTableId ] [--defaultLimitsTableId ] [--permissionsTableId ] [--defaultPermissionsTableId ] [--sprtTableId ] [--adminGrantsTableId ] [--adminGrantsTableName ] [--ownerGrantsTableId ] [--ownerGrantsTableName ] [--entityTableId ] [--entityTableOwnerId ] [--prefix ] [--actorMaskCheck ] [--actorPermCheck ] [--entityIdsByMask ] [--entityIdsByPerm ] [--entityIdsFunction ] csdk memberships-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--membershipsTableId ] [--membershipsTableName ] [--membersTableId ] [--membersTableName ] [--membershipDefaultsTableId ] [--membershipDefaultsTableName ] [--grantsTableId ] [--grantsTableName ] [--actorTableId ] [--limitsTableId ] [--defaultLimitsTableId ] [--permissionsTableId ] [--defaultPermissionsTableId ] [--sprtTableId ] [--adminGrantsTableId ] [--adminGrantsTableName ] [--ownerGrantsTableId ] [--ownerGrantsTableName ] [--membershipType ] [--entityTableId ] [--entityTableOwnerId ] [--prefix ] [--actorMaskCheck ] [--actorPermCheck ] [--entityIdsByMask ] [--entityIdsByPerm ] [--entityIdsFunction ] @@ -16,12 +19,42 @@ csdk memberships-module delete --id ## Examples -### List all membershipsModule records +### List membershipsModule records ```bash csdk memberships-module list ``` +### List membershipsModule records with pagination + +```bash +csdk memberships-module list --limit 10 --offset 0 +``` + +### List membershipsModule records with cursor pagination + +```bash +csdk memberships-module list --limit 10 --after +``` + +### Find first matching membershipsModule + +```bash +csdk memberships-module find-first --where.id.equalTo +``` + +### List membershipsModule records with field selection + +```bash +csdk memberships-module list --select id,id +``` + +### List membershipsModule records with filtering and ordering + +```bash +csdk memberships-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a membershipsModule ```bash diff --git a/.agents/skills/cli-public/references/migrate-file.md b/.agents/skills/cli-public/references/migrate-file.md index 91202d7db..9c3d27ab6 100644 --- a/.agents/skills/cli-public/references/migrate-file.md +++ b/.agents/skills/cli-public/references/migrate-file.md @@ -8,6 +8,9 @@ CRUD operations for MigrateFile records via csdk CLI ```bash csdk migrate-file list +csdk migrate-file list --where.. --orderBy +csdk migrate-file list --limit 10 --after +csdk migrate-file find-first --where.. csdk migrate-file get --id csdk migrate-file create [--databaseId ] [--upload ] csdk migrate-file update --id [--databaseId ] [--upload ] @@ -16,12 +19,42 @@ csdk migrate-file delete --id ## Examples -### List all migrateFile records +### List migrateFile records ```bash csdk migrate-file list ``` +### List migrateFile records with pagination + +```bash +csdk migrate-file list --limit 10 --offset 0 +``` + +### List migrateFile records with cursor pagination + +```bash +csdk migrate-file list --limit 10 --after +``` + +### Find first matching migrateFile + +```bash +csdk migrate-file find-first --where.id.equalTo +``` + +### List migrateFile records with field selection + +```bash +csdk migrate-file list --select id,id +``` + +### List migrateFile records with filtering and ordering + +```bash +csdk migrate-file list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a migrateFile ```bash diff --git a/.agents/skills/cli-public/references/node-type-registry.md b/.agents/skills/cli-public/references/node-type-registry.md index e297160ea..55019a4e4 100644 --- a/.agents/skills/cli-public/references/node-type-registry.md +++ b/.agents/skills/cli-public/references/node-type-registry.md @@ -8,24 +8,57 @@ CRUD operations for NodeTypeRegistry records via csdk CLI ```bash csdk node-type-registry list +csdk node-type-registry list --where.. --orderBy +csdk node-type-registry list --limit 10 --after +csdk node-type-registry find-first --where.. csdk node-type-registry get --name -csdk node-type-registry create --slug --category [--displayName ] [--description ] [--parameterSchema ] [--tags ] -csdk node-type-registry update --name [--slug ] [--category ] [--displayName ] [--description ] [--parameterSchema ] [--tags ] +csdk node-type-registry create --slug --category [--displayName ] [--description ] [--summary ] [--parameterSchema ] [--guidance ] [--tags ] +csdk node-type-registry update --name [--slug ] [--category ] [--displayName ] [--description ] [--summary ] [--parameterSchema ] [--guidance ] [--tags ] csdk node-type-registry delete --name ``` ## Examples -### List all nodeTypeRegistry records +### List nodeTypeRegistry records ```bash csdk node-type-registry list ``` +### List nodeTypeRegistry records with pagination + +```bash +csdk node-type-registry list --limit 10 --offset 0 +``` + +### List nodeTypeRegistry records with cursor pagination + +```bash +csdk node-type-registry list --limit 10 --after +``` + +### Find first matching nodeTypeRegistry + +```bash +csdk node-type-registry find-first --where.name.equalTo +``` + +### List nodeTypeRegistry records with field selection + +```bash +csdk node-type-registry list --select id,name +``` + +### List nodeTypeRegistry records with filtering and ordering + +```bash +csdk node-type-registry list --where.name.equalTo --orderBy NAME_ASC +``` + ### Create a nodeTypeRegistry ```bash -csdk node-type-registry create --slug --category [--displayName ] [--description ] [--parameterSchema ] [--tags ] +csdk node-type-registry create --slug --category [--displayName ] [--description ] [--summary ] [--parameterSchema ] [--guidance ] [--tags ] ``` ### Get a nodeTypeRegistry by name diff --git a/.agents/skills/cli-public/references/object.md b/.agents/skills/cli-public/references/object.md index fa82a724f..97a623855 100644 --- a/.agents/skills/cli-public/references/object.md +++ b/.agents/skills/cli-public/references/object.md @@ -8,6 +8,9 @@ CRUD operations for Object records via csdk CLI ```bash csdk object list +csdk object list --where.. --orderBy +csdk object list --limit 10 --after +csdk object find-first --where.. csdk object get --id csdk object create --databaseId [--kids ] [--ktree ] [--data ] [--frzn ] csdk object update --id [--databaseId ] [--kids ] [--ktree ] [--data ] [--frzn ] @@ -16,12 +19,42 @@ csdk object delete --id ## Examples -### List all object records +### List object records ```bash csdk object list ``` +### List object records with pagination + +```bash +csdk object list --limit 10 --offset 0 +``` + +### List object records with cursor pagination + +```bash +csdk object list --limit 10 --after +``` + +### Find first matching object + +```bash +csdk object find-first --where.id.equalTo +``` + +### List object records with field selection + +```bash +csdk object list --select id,id +``` + +### List object records with filtering and ordering + +```bash +csdk object list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a object ```bash diff --git a/.agents/skills/cli-public/references/org-admin-grant.md b/.agents/skills/cli-public/references/org-admin-grant.md index c218e0190..82488b55c 100644 --- a/.agents/skills/cli-public/references/org-admin-grant.md +++ b/.agents/skills/cli-public/references/org-admin-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgAdminGrant records via csdk CLI ```bash csdk org-admin-grant list +csdk org-admin-grant list --where.. --orderBy +csdk org-admin-grant list --limit 10 --after +csdk org-admin-grant find-first --where.. csdk org-admin-grant get --id csdk org-admin-grant create --actorId --entityId [--isGrant ] [--grantorId ] csdk org-admin-grant update --id [--isGrant ] [--actorId ] [--entityId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk org-admin-grant delete --id ## Examples -### List all orgAdminGrant records +### List orgAdminGrant records ```bash csdk org-admin-grant list ``` +### List orgAdminGrant records with pagination + +```bash +csdk org-admin-grant list --limit 10 --offset 0 +``` + +### List orgAdminGrant records with cursor pagination + +```bash +csdk org-admin-grant list --limit 10 --after +``` + +### Find first matching orgAdminGrant + +```bash +csdk org-admin-grant find-first --where.id.equalTo +``` + +### List orgAdminGrant records with field selection + +```bash +csdk org-admin-grant list --select id,id +``` + +### List orgAdminGrant records with filtering and ordering + +```bash +csdk org-admin-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgAdminGrant ```bash diff --git a/.agents/skills/cli-public/references/org-chart-edge-grant.md b/.agents/skills/cli-public/references/org-chart-edge-grant.md index 3cdca07be..008cc0452 100644 --- a/.agents/skills/cli-public/references/org-chart-edge-grant.md +++ b/.agents/skills/cli-public/references/org-chart-edge-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgChartEdgeGrant records via csdk CLI ```bash csdk org-chart-edge-grant list +csdk org-chart-edge-grant list --where.. --orderBy +csdk org-chart-edge-grant list --limit 10 --after +csdk org-chart-edge-grant find-first --where.. csdk org-chart-edge-grant get --id csdk org-chart-edge-grant create --entityId --childId [--parentId ] [--grantorId ] [--isGrant ] [--positionTitle ] [--positionLevel ] csdk org-chart-edge-grant update --id [--entityId ] [--childId ] [--parentId ] [--grantorId ] [--isGrant ] [--positionTitle ] [--positionLevel ] @@ -16,12 +19,42 @@ csdk org-chart-edge-grant delete --id ## Examples -### List all orgChartEdgeGrant records +### List orgChartEdgeGrant records ```bash csdk org-chart-edge-grant list ``` +### List orgChartEdgeGrant records with pagination + +```bash +csdk org-chart-edge-grant list --limit 10 --offset 0 +``` + +### List orgChartEdgeGrant records with cursor pagination + +```bash +csdk org-chart-edge-grant list --limit 10 --after +``` + +### Find first matching orgChartEdgeGrant + +```bash +csdk org-chart-edge-grant find-first --where.id.equalTo +``` + +### List orgChartEdgeGrant records with field selection + +```bash +csdk org-chart-edge-grant list --select id,id +``` + +### List orgChartEdgeGrant records with filtering and ordering + +```bash +csdk org-chart-edge-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgChartEdgeGrant ```bash diff --git a/.agents/skills/cli-public/references/org-chart-edge.md b/.agents/skills/cli-public/references/org-chart-edge.md index 324cd6f53..0153401f4 100644 --- a/.agents/skills/cli-public/references/org-chart-edge.md +++ b/.agents/skills/cli-public/references/org-chart-edge.md @@ -8,6 +8,9 @@ CRUD operations for OrgChartEdge records via csdk CLI ```bash csdk org-chart-edge list +csdk org-chart-edge list --where.. --orderBy +csdk org-chart-edge list --limit 10 --after +csdk org-chart-edge find-first --where.. csdk org-chart-edge get --id csdk org-chart-edge create --entityId --childId [--parentId ] [--positionTitle ] [--positionLevel ] csdk org-chart-edge update --id [--entityId ] [--childId ] [--parentId ] [--positionTitle ] [--positionLevel ] @@ -16,12 +19,42 @@ csdk org-chart-edge delete --id ## Examples -### List all orgChartEdge records +### List orgChartEdge records ```bash csdk org-chart-edge list ``` +### List orgChartEdge records with pagination + +```bash +csdk org-chart-edge list --limit 10 --offset 0 +``` + +### List orgChartEdge records with cursor pagination + +```bash +csdk org-chart-edge list --limit 10 --after +``` + +### Find first matching orgChartEdge + +```bash +csdk org-chart-edge find-first --where.id.equalTo +``` + +### List orgChartEdge records with field selection + +```bash +csdk org-chart-edge list --select id,id +``` + +### List orgChartEdge records with filtering and ordering + +```bash +csdk org-chart-edge list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgChartEdge ```bash diff --git a/.agents/skills/cli-public/references/org-claimed-invite.md b/.agents/skills/cli-public/references/org-claimed-invite.md index c5bbd2520..3ba4a9c08 100644 --- a/.agents/skills/cli-public/references/org-claimed-invite.md +++ b/.agents/skills/cli-public/references/org-claimed-invite.md @@ -8,6 +8,9 @@ CRUD operations for OrgClaimedInvite records via csdk CLI ```bash csdk org-claimed-invite list +csdk org-claimed-invite list --where.. --orderBy +csdk org-claimed-invite list --limit 10 --after +csdk org-claimed-invite find-first --where.. csdk org-claimed-invite get --id csdk org-claimed-invite create --entityId [--data ] [--senderId ] [--receiverId ] csdk org-claimed-invite update --id [--data ] [--senderId ] [--receiverId ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-claimed-invite delete --id ## Examples -### List all orgClaimedInvite records +### List orgClaimedInvite records ```bash csdk org-claimed-invite list ``` +### List orgClaimedInvite records with pagination + +```bash +csdk org-claimed-invite list --limit 10 --offset 0 +``` + +### List orgClaimedInvite records with cursor pagination + +```bash +csdk org-claimed-invite list --limit 10 --after +``` + +### Find first matching orgClaimedInvite + +```bash +csdk org-claimed-invite find-first --where.id.equalTo +``` + +### List orgClaimedInvite records with field selection + +```bash +csdk org-claimed-invite list --select id,id +``` + +### List orgClaimedInvite records with filtering and ordering + +```bash +csdk org-claimed-invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgClaimedInvite ```bash diff --git a/.agents/skills/cli-public/references/org-get-managers-record.md b/.agents/skills/cli-public/references/org-get-managers-record.md index 2ba1c77eb..46d21f702 100644 --- a/.agents/skills/cli-public/references/org-get-managers-record.md +++ b/.agents/skills/cli-public/references/org-get-managers-record.md @@ -8,6 +8,9 @@ CRUD operations for OrgGetManagersRecord records via csdk CLI ```bash csdk org-get-managers-record list +csdk org-get-managers-record list --where.. --orderBy +csdk org-get-managers-record list --limit 10 --after +csdk org-get-managers-record find-first --where.. csdk org-get-managers-record get --id csdk org-get-managers-record create --userId --depth csdk org-get-managers-record update --id [--userId ] [--depth ] @@ -16,12 +19,42 @@ csdk org-get-managers-record delete --id ## Examples -### List all orgGetManagersRecord records +### List orgGetManagersRecord records ```bash csdk org-get-managers-record list ``` +### List orgGetManagersRecord records with pagination + +```bash +csdk org-get-managers-record list --limit 10 --offset 0 +``` + +### List orgGetManagersRecord records with cursor pagination + +```bash +csdk org-get-managers-record list --limit 10 --after +``` + +### Find first matching orgGetManagersRecord + +```bash +csdk org-get-managers-record find-first --where.id.equalTo +``` + +### List orgGetManagersRecord records with field selection + +```bash +csdk org-get-managers-record list --select id,id +``` + +### List orgGetManagersRecord records with filtering and ordering + +```bash +csdk org-get-managers-record list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgGetManagersRecord ```bash diff --git a/.agents/skills/cli-public/references/org-get-subordinates-record.md b/.agents/skills/cli-public/references/org-get-subordinates-record.md index a2eba788a..0e36be169 100644 --- a/.agents/skills/cli-public/references/org-get-subordinates-record.md +++ b/.agents/skills/cli-public/references/org-get-subordinates-record.md @@ -8,6 +8,9 @@ CRUD operations for OrgGetSubordinatesRecord records via csdk CLI ```bash csdk org-get-subordinates-record list +csdk org-get-subordinates-record list --where.. --orderBy +csdk org-get-subordinates-record list --limit 10 --after +csdk org-get-subordinates-record find-first --where.. csdk org-get-subordinates-record get --id csdk org-get-subordinates-record create --userId --depth csdk org-get-subordinates-record update --id [--userId ] [--depth ] @@ -16,12 +19,42 @@ csdk org-get-subordinates-record delete --id ## Examples -### List all orgGetSubordinatesRecord records +### List orgGetSubordinatesRecord records ```bash csdk org-get-subordinates-record list ``` +### List orgGetSubordinatesRecord records with pagination + +```bash +csdk org-get-subordinates-record list --limit 10 --offset 0 +``` + +### List orgGetSubordinatesRecord records with cursor pagination + +```bash +csdk org-get-subordinates-record list --limit 10 --after +``` + +### Find first matching orgGetSubordinatesRecord + +```bash +csdk org-get-subordinates-record find-first --where.id.equalTo +``` + +### List orgGetSubordinatesRecord records with field selection + +```bash +csdk org-get-subordinates-record list --select id,id +``` + +### List orgGetSubordinatesRecord records with filtering and ordering + +```bash +csdk org-get-subordinates-record list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgGetSubordinatesRecord ```bash diff --git a/.agents/skills/cli-public/references/org-grant.md b/.agents/skills/cli-public/references/org-grant.md index 145753a49..b03e47787 100644 --- a/.agents/skills/cli-public/references/org-grant.md +++ b/.agents/skills/cli-public/references/org-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgGrant records via csdk CLI ```bash csdk org-grant list +csdk org-grant list --where.. --orderBy +csdk org-grant list --limit 10 --after +csdk org-grant find-first --where.. csdk org-grant get --id csdk org-grant create --actorId --entityId [--permissions ] [--isGrant ] [--grantorId ] csdk org-grant update --id [--permissions ] [--isGrant ] [--actorId ] [--entityId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk org-grant delete --id ## Examples -### List all orgGrant records +### List orgGrant records ```bash csdk org-grant list ``` +### List orgGrant records with pagination + +```bash +csdk org-grant list --limit 10 --offset 0 +``` + +### List orgGrant records with cursor pagination + +```bash +csdk org-grant list --limit 10 --after +``` + +### Find first matching orgGrant + +```bash +csdk org-grant find-first --where.id.equalTo +``` + +### List orgGrant records with field selection + +```bash +csdk org-grant list --select id,id +``` + +### List orgGrant records with filtering and ordering + +```bash +csdk org-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgGrant ```bash diff --git a/.agents/skills/cli-public/references/org-invite.md b/.agents/skills/cli-public/references/org-invite.md index 617044171..1f48d7b17 100644 --- a/.agents/skills/cli-public/references/org-invite.md +++ b/.agents/skills/cli-public/references/org-invite.md @@ -8,6 +8,9 @@ CRUD operations for OrgInvite records via csdk CLI ```bash csdk org-invite list +csdk org-invite list --where.. --orderBy +csdk org-invite list --limit 10 --after +csdk org-invite find-first --where.. csdk org-invite get --id csdk org-invite create --entityId [--email ] [--senderId ] [--receiverId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] csdk org-invite update --id [--email ] [--senderId ] [--receiverId ] [--inviteToken ] [--inviteValid ] [--inviteLimit ] [--inviteCount ] [--multiple ] [--data ] [--expiresAt ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-invite delete --id ## Examples -### List all orgInvite records +### List orgInvite records ```bash csdk org-invite list ``` +### List orgInvite records with pagination + +```bash +csdk org-invite list --limit 10 --offset 0 +``` + +### List orgInvite records with cursor pagination + +```bash +csdk org-invite list --limit 10 --after +``` + +### Find first matching orgInvite + +```bash +csdk org-invite find-first --where.id.equalTo +``` + +### List orgInvite records with field selection + +```bash +csdk org-invite list --select id,id +``` + +### List orgInvite records with filtering and ordering + +```bash +csdk org-invite list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgInvite ```bash diff --git a/.agents/skills/cli-public/references/org-limit-default.md b/.agents/skills/cli-public/references/org-limit-default.md index cd194fb49..017e51f53 100644 --- a/.agents/skills/cli-public/references/org-limit-default.md +++ b/.agents/skills/cli-public/references/org-limit-default.md @@ -8,6 +8,9 @@ CRUD operations for OrgLimitDefault records via csdk CLI ```bash csdk org-limit-default list +csdk org-limit-default list --where.. --orderBy +csdk org-limit-default list --limit 10 --after +csdk org-limit-default find-first --where.. csdk org-limit-default get --id csdk org-limit-default create --name [--max ] csdk org-limit-default update --id [--name ] [--max ] @@ -16,12 +19,42 @@ csdk org-limit-default delete --id ## Examples -### List all orgLimitDefault records +### List orgLimitDefault records ```bash csdk org-limit-default list ``` +### List orgLimitDefault records with pagination + +```bash +csdk org-limit-default list --limit 10 --offset 0 +``` + +### List orgLimitDefault records with cursor pagination + +```bash +csdk org-limit-default list --limit 10 --after +``` + +### Find first matching orgLimitDefault + +```bash +csdk org-limit-default find-first --where.id.equalTo +``` + +### List orgLimitDefault records with field selection + +```bash +csdk org-limit-default list --select id,id +``` + +### List orgLimitDefault records with filtering and ordering + +```bash +csdk org-limit-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgLimitDefault ```bash diff --git a/.agents/skills/cli-public/references/org-limit.md b/.agents/skills/cli-public/references/org-limit.md index 39759354c..e3ba12bd9 100644 --- a/.agents/skills/cli-public/references/org-limit.md +++ b/.agents/skills/cli-public/references/org-limit.md @@ -8,6 +8,9 @@ CRUD operations for OrgLimit records via csdk CLI ```bash csdk org-limit list +csdk org-limit list --where.. --orderBy +csdk org-limit list --limit 10 --after +csdk org-limit find-first --where.. csdk org-limit get --id csdk org-limit create --actorId --entityId [--name ] [--num ] [--max ] csdk org-limit update --id [--name ] [--actorId ] [--num ] [--max ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-limit delete --id ## Examples -### List all orgLimit records +### List orgLimit records ```bash csdk org-limit list ``` +### List orgLimit records with pagination + +```bash +csdk org-limit list --limit 10 --offset 0 +``` + +### List orgLimit records with cursor pagination + +```bash +csdk org-limit list --limit 10 --after +``` + +### Find first matching orgLimit + +```bash +csdk org-limit find-first --where.id.equalTo +``` + +### List orgLimit records with field selection + +```bash +csdk org-limit list --select id,id +``` + +### List orgLimit records with filtering and ordering + +```bash +csdk org-limit list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgLimit ```bash diff --git a/.agents/skills/cli-public/references/org-member.md b/.agents/skills/cli-public/references/org-member.md index 5b21dd4ad..c1019fee5 100644 --- a/.agents/skills/cli-public/references/org-member.md +++ b/.agents/skills/cli-public/references/org-member.md @@ -8,6 +8,9 @@ CRUD operations for OrgMember records via csdk CLI ```bash csdk org-member list +csdk org-member list --where.. --orderBy +csdk org-member list --limit 10 --after +csdk org-member find-first --where.. csdk org-member get --id csdk org-member create --actorId --entityId [--isAdmin ] csdk org-member update --id [--isAdmin ] [--actorId ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-member delete --id ## Examples -### List all orgMember records +### List orgMember records ```bash csdk org-member list ``` +### List orgMember records with pagination + +```bash +csdk org-member list --limit 10 --offset 0 +``` + +### List orgMember records with cursor pagination + +```bash +csdk org-member list --limit 10 --after +``` + +### Find first matching orgMember + +```bash +csdk org-member find-first --where.id.equalTo +``` + +### List orgMember records with field selection + +```bash +csdk org-member list --select id,id +``` + +### List orgMember records with filtering and ordering + +```bash +csdk org-member list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgMember ```bash diff --git a/.agents/skills/cli-public/references/org-membership-default.md b/.agents/skills/cli-public/references/org-membership-default.md index a76cae763..08862abd5 100644 --- a/.agents/skills/cli-public/references/org-membership-default.md +++ b/.agents/skills/cli-public/references/org-membership-default.md @@ -8,6 +8,9 @@ CRUD operations for OrgMembershipDefault records via csdk CLI ```bash csdk org-membership-default list +csdk org-membership-default list --where.. --orderBy +csdk org-membership-default list --limit 10 --after +csdk org-membership-default find-first --where.. csdk org-membership-default get --id csdk org-membership-default create --entityId [--createdBy ] [--updatedBy ] [--isApproved ] [--deleteMemberCascadeGroups ] [--createGroupsCascadeMembers ] csdk org-membership-default update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--entityId ] [--deleteMemberCascadeGroups ] [--createGroupsCascadeMembers ] @@ -16,12 +19,42 @@ csdk org-membership-default delete --id ## Examples -### List all orgMembershipDefault records +### List orgMembershipDefault records ```bash csdk org-membership-default list ``` +### List orgMembershipDefault records with pagination + +```bash +csdk org-membership-default list --limit 10 --offset 0 +``` + +### List orgMembershipDefault records with cursor pagination + +```bash +csdk org-membership-default list --limit 10 --after +``` + +### Find first matching orgMembershipDefault + +```bash +csdk org-membership-default find-first --where.id.equalTo +``` + +### List orgMembershipDefault records with field selection + +```bash +csdk org-membership-default list --select id,id +``` + +### List orgMembershipDefault records with filtering and ordering + +```bash +csdk org-membership-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgMembershipDefault ```bash diff --git a/.agents/skills/cli-public/references/org-membership.md b/.agents/skills/cli-public/references/org-membership.md index acae0207f..f8ea35463 100644 --- a/.agents/skills/cli-public/references/org-membership.md +++ b/.agents/skills/cli-public/references/org-membership.md @@ -8,6 +8,9 @@ CRUD operations for OrgMembership records via csdk CLI ```bash csdk org-membership list +csdk org-membership list --where.. --orderBy +csdk org-membership list --limit 10 --after +csdk org-membership find-first --where.. csdk org-membership get --id csdk org-membership create --actorId --entityId [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--profileId ] csdk org-membership update --id [--createdBy ] [--updatedBy ] [--isApproved ] [--isBanned ] [--isDisabled ] [--isActive ] [--isOwner ] [--isAdmin ] [--permissions ] [--granted ] [--actorId ] [--entityId ] [--profileId ] @@ -16,12 +19,42 @@ csdk org-membership delete --id ## Examples -### List all orgMembership records +### List orgMembership records ```bash csdk org-membership list ``` +### List orgMembership records with pagination + +```bash +csdk org-membership list --limit 10 --offset 0 +``` + +### List orgMembership records with cursor pagination + +```bash +csdk org-membership list --limit 10 --after +``` + +### Find first matching orgMembership + +```bash +csdk org-membership find-first --where.id.equalTo +``` + +### List orgMembership records with field selection + +```bash +csdk org-membership list --select id,id +``` + +### List orgMembership records with filtering and ordering + +```bash +csdk org-membership list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgMembership ```bash diff --git a/.agents/skills/cli-public/references/org-owner-grant.md b/.agents/skills/cli-public/references/org-owner-grant.md index 21431f91a..e354a4b4f 100644 --- a/.agents/skills/cli-public/references/org-owner-grant.md +++ b/.agents/skills/cli-public/references/org-owner-grant.md @@ -8,6 +8,9 @@ CRUD operations for OrgOwnerGrant records via csdk CLI ```bash csdk org-owner-grant list +csdk org-owner-grant list --where.. --orderBy +csdk org-owner-grant list --limit 10 --after +csdk org-owner-grant find-first --where.. csdk org-owner-grant get --id csdk org-owner-grant create --actorId --entityId [--isGrant ] [--grantorId ] csdk org-owner-grant update --id [--isGrant ] [--actorId ] [--entityId ] [--grantorId ] @@ -16,12 +19,42 @@ csdk org-owner-grant delete --id ## Examples -### List all orgOwnerGrant records +### List orgOwnerGrant records ```bash csdk org-owner-grant list ``` +### List orgOwnerGrant records with pagination + +```bash +csdk org-owner-grant list --limit 10 --offset 0 +``` + +### List orgOwnerGrant records with cursor pagination + +```bash +csdk org-owner-grant list --limit 10 --after +``` + +### Find first matching orgOwnerGrant + +```bash +csdk org-owner-grant find-first --where.id.equalTo +``` + +### List orgOwnerGrant records with field selection + +```bash +csdk org-owner-grant list --select id,id +``` + +### List orgOwnerGrant records with filtering and ordering + +```bash +csdk org-owner-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgOwnerGrant ```bash diff --git a/.agents/skills/cli-public/references/org-permission-default.md b/.agents/skills/cli-public/references/org-permission-default.md index cbbbcdb67..41e903345 100644 --- a/.agents/skills/cli-public/references/org-permission-default.md +++ b/.agents/skills/cli-public/references/org-permission-default.md @@ -8,6 +8,9 @@ CRUD operations for OrgPermissionDefault records via csdk CLI ```bash csdk org-permission-default list +csdk org-permission-default list --where.. --orderBy +csdk org-permission-default list --limit 10 --after +csdk org-permission-default find-first --where.. csdk org-permission-default get --id csdk org-permission-default create --entityId [--permissions ] csdk org-permission-default update --id [--permissions ] [--entityId ] @@ -16,12 +19,42 @@ csdk org-permission-default delete --id ## Examples -### List all orgPermissionDefault records +### List orgPermissionDefault records ```bash csdk org-permission-default list ``` +### List orgPermissionDefault records with pagination + +```bash +csdk org-permission-default list --limit 10 --offset 0 +``` + +### List orgPermissionDefault records with cursor pagination + +```bash +csdk org-permission-default list --limit 10 --after +``` + +### Find first matching orgPermissionDefault + +```bash +csdk org-permission-default find-first --where.id.equalTo +``` + +### List orgPermissionDefault records with field selection + +```bash +csdk org-permission-default list --select id,id +``` + +### List orgPermissionDefault records with filtering and ordering + +```bash +csdk org-permission-default list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgPermissionDefault ```bash diff --git a/.agents/skills/cli-public/references/org-permission.md b/.agents/skills/cli-public/references/org-permission.md index 623dba5e2..26b1805d2 100644 --- a/.agents/skills/cli-public/references/org-permission.md +++ b/.agents/skills/cli-public/references/org-permission.md @@ -8,6 +8,9 @@ CRUD operations for OrgPermission records via csdk CLI ```bash csdk org-permission list +csdk org-permission list --where.. --orderBy +csdk org-permission list --limit 10 --after +csdk org-permission find-first --where.. csdk org-permission get --id csdk org-permission create [--name ] [--bitnum ] [--bitstr ] [--description ] csdk org-permission update --id [--name ] [--bitnum ] [--bitstr ] [--description ] @@ -16,12 +19,42 @@ csdk org-permission delete --id ## Examples -### List all orgPermission records +### List orgPermission records ```bash csdk org-permission list ``` +### List orgPermission records with pagination + +```bash +csdk org-permission list --limit 10 --offset 0 +``` + +### List orgPermission records with cursor pagination + +```bash +csdk org-permission list --limit 10 --after +``` + +### Find first matching orgPermission + +```bash +csdk org-permission find-first --where.id.equalTo +``` + +### List orgPermission records with field selection + +```bash +csdk org-permission list --select id,id +``` + +### List orgPermission records with filtering and ordering + +```bash +csdk org-permission list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a orgPermission ```bash diff --git a/.agents/skills/cli-public/references/permissions-module.md b/.agents/skills/cli-public/references/permissions-module.md index ff52ac205..b65b770eb 100644 --- a/.agents/skills/cli-public/references/permissions-module.md +++ b/.agents/skills/cli-public/references/permissions-module.md @@ -8,6 +8,9 @@ CRUD operations for PermissionsModule records via csdk CLI ```bash csdk permissions-module list +csdk permissions-module list --where.. --orderBy +csdk permissions-module list --limit 10 --after +csdk permissions-module find-first --where.. csdk permissions-module get --id csdk permissions-module create --databaseId --membershipType [--schemaId ] [--privateSchemaId ] [--tableId ] [--tableName ] [--defaultTableId ] [--defaultTableName ] [--bitlen ] [--entityTableId ] [--actorTableId ] [--prefix ] [--getPaddedMask ] [--getMask ] [--getByMask ] [--getMaskByName ] csdk permissions-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--tableName ] [--defaultTableId ] [--defaultTableName ] [--bitlen ] [--membershipType ] [--entityTableId ] [--actorTableId ] [--prefix ] [--getPaddedMask ] [--getMask ] [--getByMask ] [--getMaskByName ] @@ -16,12 +19,42 @@ csdk permissions-module delete --id ## Examples -### List all permissionsModule records +### List permissionsModule records ```bash csdk permissions-module list ``` +### List permissionsModule records with pagination + +```bash +csdk permissions-module list --limit 10 --offset 0 +``` + +### List permissionsModule records with cursor pagination + +```bash +csdk permissions-module list --limit 10 --after +``` + +### Find first matching permissionsModule + +```bash +csdk permissions-module find-first --where.id.equalTo +``` + +### List permissionsModule records with field selection + +```bash +csdk permissions-module list --select id,id +``` + +### List permissionsModule records with filtering and ordering + +```bash +csdk permissions-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a permissionsModule ```bash diff --git a/.agents/skills/cli-public/references/phone-number.md b/.agents/skills/cli-public/references/phone-number.md index 9bb80c4b3..6243be4e5 100644 --- a/.agents/skills/cli-public/references/phone-number.md +++ b/.agents/skills/cli-public/references/phone-number.md @@ -8,6 +8,9 @@ CRUD operations for PhoneNumber records via csdk CLI ```bash csdk phone-number list +csdk phone-number list --where.. --orderBy +csdk phone-number list --limit 10 --after +csdk phone-number find-first --where.. csdk phone-number get --id csdk phone-number create --cc --number [--ownerId ] [--isVerified ] [--isPrimary ] csdk phone-number update --id [--ownerId ] [--cc ] [--number ] [--isVerified ] [--isPrimary ] @@ -16,12 +19,42 @@ csdk phone-number delete --id ## Examples -### List all phoneNumber records +### List phoneNumber records ```bash csdk phone-number list ``` +### List phoneNumber records with pagination + +```bash +csdk phone-number list --limit 10 --offset 0 +``` + +### List phoneNumber records with cursor pagination + +```bash +csdk phone-number list --limit 10 --after +``` + +### Find first matching phoneNumber + +```bash +csdk phone-number find-first --where.id.equalTo +``` + +### List phoneNumber records with field selection + +```bash +csdk phone-number list --select id,id +``` + +### List phoneNumber records with filtering and ordering + +```bash +csdk phone-number list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a phoneNumber ```bash diff --git a/.agents/skills/cli-public/references/phone-numbers-module.md b/.agents/skills/cli-public/references/phone-numbers-module.md index 0297cc43b..e1aee854d 100644 --- a/.agents/skills/cli-public/references/phone-numbers-module.md +++ b/.agents/skills/cli-public/references/phone-numbers-module.md @@ -8,6 +8,9 @@ CRUD operations for PhoneNumbersModule records via csdk CLI ```bash csdk phone-numbers-module list +csdk phone-numbers-module list --where.. --orderBy +csdk phone-numbers-module list --limit 10 --after +csdk phone-numbers-module find-first --where.. csdk phone-numbers-module get --id csdk phone-numbers-module create --databaseId --tableName [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] csdk phone-numbers-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] [--tableName ] @@ -16,12 +19,42 @@ csdk phone-numbers-module delete --id ## Examples -### List all phoneNumbersModule records +### List phoneNumbersModule records ```bash csdk phone-numbers-module list ``` +### List phoneNumbersModule records with pagination + +```bash +csdk phone-numbers-module list --limit 10 --offset 0 +``` + +### List phoneNumbersModule records with cursor pagination + +```bash +csdk phone-numbers-module list --limit 10 --after +``` + +### Find first matching phoneNumbersModule + +```bash +csdk phone-numbers-module find-first --where.id.equalTo +``` + +### List phoneNumbersModule records with field selection + +```bash +csdk phone-numbers-module list --select id,id +``` + +### List phoneNumbersModule records with filtering and ordering + +```bash +csdk phone-numbers-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a phoneNumbersModule ```bash diff --git a/.agents/skills/cli-public/references/policy.md b/.agents/skills/cli-public/references/policy.md index e07022a27..db7ce17a5 100644 --- a/.agents/skills/cli-public/references/policy.md +++ b/.agents/skills/cli-public/references/policy.md @@ -8,6 +8,9 @@ CRUD operations for Policy records via csdk CLI ```bash csdk policy list +csdk policy list --where.. --orderBy +csdk policy list --limit 10 --after +csdk policy find-first --where.. csdk policy get --id csdk policy create --tableId [--databaseId ] [--name ] [--granteeName ] [--privilege ] [--permissive ] [--disabled ] [--policyType ] [--data ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] csdk policy update --id [--databaseId ] [--tableId ] [--name ] [--granteeName ] [--privilege ] [--permissive ] [--disabled ] [--policyType ] [--data ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk policy delete --id ## Examples -### List all policy records +### List policy records ```bash csdk policy list ``` +### List policy records with pagination + +```bash +csdk policy list --limit 10 --offset 0 +``` + +### List policy records with cursor pagination + +```bash +csdk policy list --limit 10 --after +``` + +### Find first matching policy + +```bash +csdk policy find-first --where.id.equalTo +``` + +### List policy records with field selection + +```bash +csdk policy list --select id,id +``` + +### List policy records with filtering and ordering + +```bash +csdk policy list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a policy ```bash diff --git a/.agents/skills/cli-public/references/primary-key-constraint.md b/.agents/skills/cli-public/references/primary-key-constraint.md index 4b638baac..9980cec19 100644 --- a/.agents/skills/cli-public/references/primary-key-constraint.md +++ b/.agents/skills/cli-public/references/primary-key-constraint.md @@ -8,6 +8,9 @@ CRUD operations for PrimaryKeyConstraint records via csdk CLI ```bash csdk primary-key-constraint list +csdk primary-key-constraint list --where.. --orderBy +csdk primary-key-constraint list --limit 10 --after +csdk primary-key-constraint find-first --where.. csdk primary-key-constraint get --id csdk primary-key-constraint create --tableId --fieldIds [--databaseId ] [--name ] [--type ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] csdk primary-key-constraint update --id [--databaseId ] [--tableId ] [--name ] [--type ] [--fieldIds ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk primary-key-constraint delete --id ## Examples -### List all primaryKeyConstraint records +### List primaryKeyConstraint records ```bash csdk primary-key-constraint list ``` +### List primaryKeyConstraint records with pagination + +```bash +csdk primary-key-constraint list --limit 10 --offset 0 +``` + +### List primaryKeyConstraint records with cursor pagination + +```bash +csdk primary-key-constraint list --limit 10 --after +``` + +### Find first matching primaryKeyConstraint + +```bash +csdk primary-key-constraint find-first --where.id.equalTo +``` + +### List primaryKeyConstraint records with field selection + +```bash +csdk primary-key-constraint list --select id,id +``` + +### List primaryKeyConstraint records with filtering and ordering + +```bash +csdk primary-key-constraint list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a primaryKeyConstraint ```bash diff --git a/.agents/skills/cli-public/references/profiles-module.md b/.agents/skills/cli-public/references/profiles-module.md index 66f8794ae..d26c4ca4c 100644 --- a/.agents/skills/cli-public/references/profiles-module.md +++ b/.agents/skills/cli-public/references/profiles-module.md @@ -8,6 +8,9 @@ CRUD operations for ProfilesModule records via csdk CLI ```bash csdk profiles-module list +csdk profiles-module list --where.. --orderBy +csdk profiles-module list --limit 10 --after +csdk profiles-module find-first --where.. csdk profiles-module get --id csdk profiles-module create --databaseId --membershipType [--schemaId ] [--privateSchemaId ] [--tableId ] [--tableName ] [--profilePermissionsTableId ] [--profilePermissionsTableName ] [--profileGrantsTableId ] [--profileGrantsTableName ] [--profileDefinitionGrantsTableId ] [--profileDefinitionGrantsTableName ] [--entityTableId ] [--actorTableId ] [--permissionsTableId ] [--membershipsTableId ] [--prefix ] csdk profiles-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--tableName ] [--profilePermissionsTableId ] [--profilePermissionsTableName ] [--profileGrantsTableId ] [--profileGrantsTableName ] [--profileDefinitionGrantsTableId ] [--profileDefinitionGrantsTableName ] [--membershipType ] [--entityTableId ] [--actorTableId ] [--permissionsTableId ] [--membershipsTableId ] [--prefix ] @@ -16,12 +19,42 @@ csdk profiles-module delete --id ## Examples -### List all profilesModule records +### List profilesModule records ```bash csdk profiles-module list ``` +### List profilesModule records with pagination + +```bash +csdk profiles-module list --limit 10 --offset 0 +``` + +### List profilesModule records with cursor pagination + +```bash +csdk profiles-module list --limit 10 --after +``` + +### Find first matching profilesModule + +```bash +csdk profiles-module find-first --where.id.equalTo +``` + +### List profilesModule records with field selection + +```bash +csdk profiles-module list --select id,id +``` + +### List profilesModule records with filtering and ordering + +```bash +csdk profiles-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a profilesModule ```bash diff --git a/.agents/skills/cli-public/references/ref.md b/.agents/skills/cli-public/references/ref.md index 7603bfe61..5369e7520 100644 --- a/.agents/skills/cli-public/references/ref.md +++ b/.agents/skills/cli-public/references/ref.md @@ -8,6 +8,9 @@ CRUD operations for Ref records via csdk CLI ```bash csdk ref list +csdk ref list --where.. --orderBy +csdk ref list --limit 10 --after +csdk ref find-first --where.. csdk ref get --id csdk ref create --name --databaseId --storeId [--commitId ] csdk ref update --id [--name ] [--databaseId ] [--storeId ] [--commitId ] @@ -16,12 +19,42 @@ csdk ref delete --id ## Examples -### List all ref records +### List ref records ```bash csdk ref list ``` +### List ref records with pagination + +```bash +csdk ref list --limit 10 --offset 0 +``` + +### List ref records with cursor pagination + +```bash +csdk ref list --limit 10 --after +``` + +### Find first matching ref + +```bash +csdk ref find-first --where.id.equalTo +``` + +### List ref records with field selection + +```bash +csdk ref list --select id,id +``` + +### List ref records with filtering and ordering + +```bash +csdk ref list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a ref ```bash diff --git a/.agents/skills/cli-public/references/relation-provision.md b/.agents/skills/cli-public/references/relation-provision.md index 0eef0be3d..b24892601 100644 --- a/.agents/skills/cli-public/references/relation-provision.md +++ b/.agents/skills/cli-public/references/relation-provision.md @@ -8,6 +8,9 @@ CRUD operations for RelationProvision records via csdk CLI ```bash csdk relation-provision list +csdk relation-provision list --where.. --orderBy +csdk relation-provision list --limit 10 --after +csdk relation-provision find-first --where.. csdk relation-provision get --id csdk relation-provision create --databaseId --relationType --sourceTableId --targetTableId [--fieldName ] [--deleteAction ] [--isRequired ] [--apiRequired ] [--junctionTableId ] [--junctionTableName ] [--junctionSchemaId ] [--sourceFieldName ] [--targetFieldName ] [--useCompositeKey ] [--createIndex ] [--exposeInApi ] [--nodeType ] [--nodeData ] [--grantRoles ] [--grantPrivileges ] [--policyType ] [--policyPrivileges ] [--policyRole ] [--policyPermissive ] [--policyName ] [--policyData ] [--outFieldId ] [--outJunctionTableId ] [--outSourceFieldId ] [--outTargetFieldId ] csdk relation-provision update --id [--databaseId ] [--relationType ] [--sourceTableId ] [--targetTableId ] [--fieldName ] [--deleteAction ] [--isRequired ] [--apiRequired ] [--junctionTableId ] [--junctionTableName ] [--junctionSchemaId ] [--sourceFieldName ] [--targetFieldName ] [--useCompositeKey ] [--createIndex ] [--exposeInApi ] [--nodeType ] [--nodeData ] [--grantRoles ] [--grantPrivileges ] [--policyType ] [--policyPrivileges ] [--policyRole ] [--policyPermissive ] [--policyName ] [--policyData ] [--outFieldId ] [--outJunctionTableId ] [--outSourceFieldId ] [--outTargetFieldId ] @@ -16,12 +19,42 @@ csdk relation-provision delete --id ## Examples -### List all relationProvision records +### List relationProvision records ```bash csdk relation-provision list ``` +### List relationProvision records with pagination + +```bash +csdk relation-provision list --limit 10 --offset 0 +``` + +### List relationProvision records with cursor pagination + +```bash +csdk relation-provision list --limit 10 --after +``` + +### Find first matching relationProvision + +```bash +csdk relation-provision find-first --where.id.equalTo +``` + +### List relationProvision records with field selection + +```bash +csdk relation-provision list --select id,id +``` + +### List relationProvision records with filtering and ordering + +```bash +csdk relation-provision list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a relationProvision ```bash diff --git a/.agents/skills/cli-public/references/rls-module.md b/.agents/skills/cli-public/references/rls-module.md index 5eb557c06..cd52c3683 100644 --- a/.agents/skills/cli-public/references/rls-module.md +++ b/.agents/skills/cli-public/references/rls-module.md @@ -8,6 +8,9 @@ CRUD operations for RlsModule records via csdk CLI ```bash csdk rls-module list +csdk rls-module list --where.. --orderBy +csdk rls-module list --limit 10 --after +csdk rls-module find-first --where.. csdk rls-module get --id csdk rls-module create --databaseId [--schemaId ] [--privateSchemaId ] [--sessionCredentialsTableId ] [--sessionsTableId ] [--usersTableId ] [--authenticate ] [--authenticateStrict ] [--currentRole ] [--currentRoleId ] csdk rls-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--sessionCredentialsTableId ] [--sessionsTableId ] [--usersTableId ] [--authenticate ] [--authenticateStrict ] [--currentRole ] [--currentRoleId ] @@ -16,12 +19,42 @@ csdk rls-module delete --id ## Examples -### List all rlsModule records +### List rlsModule records ```bash csdk rls-module list ``` +### List rlsModule records with pagination + +```bash +csdk rls-module list --limit 10 --offset 0 +``` + +### List rlsModule records with cursor pagination + +```bash +csdk rls-module list --limit 10 --after +``` + +### Find first matching rlsModule + +```bash +csdk rls-module find-first --where.id.equalTo +``` + +### List rlsModule records with field selection + +```bash +csdk rls-module list --select id,id +``` + +### List rlsModule records with filtering and ordering + +```bash +csdk rls-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a rlsModule ```bash diff --git a/.agents/skills/cli-public/references/role-type.md b/.agents/skills/cli-public/references/role-type.md index 0ac32c001..e21f127bc 100644 --- a/.agents/skills/cli-public/references/role-type.md +++ b/.agents/skills/cli-public/references/role-type.md @@ -8,6 +8,9 @@ CRUD operations for RoleType records via csdk CLI ```bash csdk role-type list +csdk role-type list --where.. --orderBy +csdk role-type list --limit 10 --after +csdk role-type find-first --where.. csdk role-type get --id csdk role-type create --name csdk role-type update --id [--name ] @@ -16,12 +19,42 @@ csdk role-type delete --id ## Examples -### List all roleType records +### List roleType records ```bash csdk role-type list ``` +### List roleType records with pagination + +```bash +csdk role-type list --limit 10 --offset 0 +``` + +### List roleType records with cursor pagination + +```bash +csdk role-type list --limit 10 --after +``` + +### Find first matching roleType + +```bash +csdk role-type find-first --where.id.equalTo +``` + +### List roleType records with field selection + +```bash +csdk role-type list --select id,id +``` + +### List roleType records with filtering and ordering + +```bash +csdk role-type list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a roleType ```bash diff --git a/.agents/skills/cli-public/references/schema-grant.md b/.agents/skills/cli-public/references/schema-grant.md index 2ca316f25..b0f94f8d4 100644 --- a/.agents/skills/cli-public/references/schema-grant.md +++ b/.agents/skills/cli-public/references/schema-grant.md @@ -8,6 +8,9 @@ CRUD operations for SchemaGrant records via csdk CLI ```bash csdk schema-grant list +csdk schema-grant list --where.. --orderBy +csdk schema-grant list --limit 10 --after +csdk schema-grant find-first --where.. csdk schema-grant get --id csdk schema-grant create --schemaId --granteeName [--databaseId ] csdk schema-grant update --id [--databaseId ] [--schemaId ] [--granteeName ] @@ -16,12 +19,42 @@ csdk schema-grant delete --id ## Examples -### List all schemaGrant records +### List schemaGrant records ```bash csdk schema-grant list ``` +### List schemaGrant records with pagination + +```bash +csdk schema-grant list --limit 10 --offset 0 +``` + +### List schemaGrant records with cursor pagination + +```bash +csdk schema-grant list --limit 10 --after +``` + +### Find first matching schemaGrant + +```bash +csdk schema-grant find-first --where.id.equalTo +``` + +### List schemaGrant records with field selection + +```bash +csdk schema-grant list --select id,id +``` + +### List schemaGrant records with filtering and ordering + +```bash +csdk schema-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a schemaGrant ```bash diff --git a/.agents/skills/cli-public/references/schema.md b/.agents/skills/cli-public/references/schema.md index ffb69cc0f..6f0473ac7 100644 --- a/.agents/skills/cli-public/references/schema.md +++ b/.agents/skills/cli-public/references/schema.md @@ -8,6 +8,9 @@ CRUD operations for Schema records via csdk CLI ```bash csdk schema list +csdk schema list --where.. --orderBy +csdk schema list --limit 10 --after +csdk schema find-first --where.. csdk schema get --id csdk schema create --databaseId --name --schemaName [--label ] [--description ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] [--isPublic ] csdk schema update --id [--databaseId ] [--name ] [--schemaName ] [--label ] [--description ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] [--isPublic ] @@ -16,12 +19,42 @@ csdk schema delete --id ## Examples -### List all schema records +### List schema records ```bash csdk schema list ``` +### List schema records with pagination + +```bash +csdk schema list --limit 10 --offset 0 +``` + +### List schema records with cursor pagination + +```bash +csdk schema list --limit 10 --after +``` + +### Find first matching schema + +```bash +csdk schema find-first --where.id.equalTo +``` + +### List schema records with field selection + +```bash +csdk schema list --select id,id +``` + +### List schema records with filtering and ordering + +```bash +csdk schema list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a schema ```bash diff --git a/.agents/skills/cli-public/references/secrets-module.md b/.agents/skills/cli-public/references/secrets-module.md index af8924e8d..4e4153bda 100644 --- a/.agents/skills/cli-public/references/secrets-module.md +++ b/.agents/skills/cli-public/references/secrets-module.md @@ -8,6 +8,9 @@ CRUD operations for SecretsModule records via csdk CLI ```bash csdk secrets-module list +csdk secrets-module list --where.. --orderBy +csdk secrets-module list --limit 10 --after +csdk secrets-module find-first --where.. csdk secrets-module get --id csdk secrets-module create --databaseId [--schemaId ] [--tableId ] [--tableName ] csdk secrets-module update --id [--databaseId ] [--schemaId ] [--tableId ] [--tableName ] @@ -16,12 +19,42 @@ csdk secrets-module delete --id ## Examples -### List all secretsModule records +### List secretsModule records ```bash csdk secrets-module list ``` +### List secretsModule records with pagination + +```bash +csdk secrets-module list --limit 10 --offset 0 +``` + +### List secretsModule records with cursor pagination + +```bash +csdk secrets-module list --limit 10 --after +``` + +### Find first matching secretsModule + +```bash +csdk secrets-module find-first --where.id.equalTo +``` + +### List secretsModule records with field selection + +```bash +csdk secrets-module list --select id,id +``` + +### List secretsModule records with filtering and ordering + +```bash +csdk secrets-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a secretsModule ```bash diff --git a/.agents/skills/cli-public/references/secure-table-provision.md b/.agents/skills/cli-public/references/secure-table-provision.md index a0f71bb4b..a59895557 100644 --- a/.agents/skills/cli-public/references/secure-table-provision.md +++ b/.agents/skills/cli-public/references/secure-table-provision.md @@ -8,6 +8,9 @@ CRUD operations for SecureTableProvision records via csdk CLI ```bash csdk secure-table-provision list +csdk secure-table-provision list --where.. --orderBy +csdk secure-table-provision list --limit 10 --after +csdk secure-table-provision find-first --where.. csdk secure-table-provision get --id csdk secure-table-provision create --databaseId [--schemaId ] [--tableId ] [--tableName ] [--nodeType ] [--useRls ] [--nodeData ] [--fields ] [--grantRoles ] [--grantPrivileges ] [--policyType ] [--policyPrivileges ] [--policyRole ] [--policyPermissive ] [--policyName ] [--policyData ] [--outFields ] csdk secure-table-provision update --id [--databaseId ] [--schemaId ] [--tableId ] [--tableName ] [--nodeType ] [--useRls ] [--nodeData ] [--fields ] [--grantRoles ] [--grantPrivileges ] [--policyType ] [--policyPrivileges ] [--policyRole ] [--policyPermissive ] [--policyName ] [--policyData ] [--outFields ] @@ -16,12 +19,42 @@ csdk secure-table-provision delete --id ## Examples -### List all secureTableProvision records +### List secureTableProvision records ```bash csdk secure-table-provision list ``` +### List secureTableProvision records with pagination + +```bash +csdk secure-table-provision list --limit 10 --offset 0 +``` + +### List secureTableProvision records with cursor pagination + +```bash +csdk secure-table-provision list --limit 10 --after +``` + +### Find first matching secureTableProvision + +```bash +csdk secure-table-provision find-first --where.id.equalTo +``` + +### List secureTableProvision records with field selection + +```bash +csdk secure-table-provision list --select id,id +``` + +### List secureTableProvision records with filtering and ordering + +```bash +csdk secure-table-provision list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a secureTableProvision ```bash diff --git a/.agents/skills/cli-public/references/sessions-module.md b/.agents/skills/cli-public/references/sessions-module.md index e794c175e..6fb1cd668 100644 --- a/.agents/skills/cli-public/references/sessions-module.md +++ b/.agents/skills/cli-public/references/sessions-module.md @@ -8,6 +8,9 @@ CRUD operations for SessionsModule records via csdk CLI ```bash csdk sessions-module list +csdk sessions-module list --where.. --orderBy +csdk sessions-module list --limit 10 --after +csdk sessions-module find-first --where.. csdk sessions-module get --id csdk sessions-module create --databaseId [--schemaId ] [--sessionsTableId ] [--sessionCredentialsTableId ] [--authSettingsTableId ] [--usersTableId ] [--sessionsDefaultExpiration ] [--sessionsTable ] [--sessionCredentialsTable ] [--authSettingsTable ] csdk sessions-module update --id [--databaseId ] [--schemaId ] [--sessionsTableId ] [--sessionCredentialsTableId ] [--authSettingsTableId ] [--usersTableId ] [--sessionsDefaultExpiration ] [--sessionsTable ] [--sessionCredentialsTable ] [--authSettingsTable ] @@ -16,12 +19,42 @@ csdk sessions-module delete --id ## Examples -### List all sessionsModule records +### List sessionsModule records ```bash csdk sessions-module list ``` +### List sessionsModule records with pagination + +```bash +csdk sessions-module list --limit 10 --offset 0 +``` + +### List sessionsModule records with cursor pagination + +```bash +csdk sessions-module list --limit 10 --after +``` + +### Find first matching sessionsModule + +```bash +csdk sessions-module find-first --where.id.equalTo +``` + +### List sessionsModule records with field selection + +```bash +csdk sessions-module list --select id,id +``` + +### List sessionsModule records with filtering and ordering + +```bash +csdk sessions-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a sessionsModule ```bash diff --git a/.agents/skills/cli-public/references/site-metadatum.md b/.agents/skills/cli-public/references/site-metadatum.md index 5747795ac..99a57f565 100644 --- a/.agents/skills/cli-public/references/site-metadatum.md +++ b/.agents/skills/cli-public/references/site-metadatum.md @@ -8,6 +8,9 @@ CRUD operations for SiteMetadatum records via csdk CLI ```bash csdk site-metadatum list +csdk site-metadatum list --where.. --orderBy +csdk site-metadatum list --limit 10 --after +csdk site-metadatum find-first --where.. csdk site-metadatum get --id csdk site-metadatum create --databaseId --siteId [--title ] [--description ] [--ogImage ] csdk site-metadatum update --id [--databaseId ] [--siteId ] [--title ] [--description ] [--ogImage ] @@ -16,12 +19,42 @@ csdk site-metadatum delete --id ## Examples -### List all siteMetadatum records +### List siteMetadatum records ```bash csdk site-metadatum list ``` +### List siteMetadatum records with pagination + +```bash +csdk site-metadatum list --limit 10 --offset 0 +``` + +### List siteMetadatum records with cursor pagination + +```bash +csdk site-metadatum list --limit 10 --after +``` + +### Find first matching siteMetadatum + +```bash +csdk site-metadatum find-first --where.id.equalTo +``` + +### List siteMetadatum records with field selection + +```bash +csdk site-metadatum list --select id,id +``` + +### List siteMetadatum records with filtering and ordering + +```bash +csdk site-metadatum list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a siteMetadatum ```bash diff --git a/.agents/skills/cli-public/references/site-module.md b/.agents/skills/cli-public/references/site-module.md index 552136505..b57c3c4ec 100644 --- a/.agents/skills/cli-public/references/site-module.md +++ b/.agents/skills/cli-public/references/site-module.md @@ -8,6 +8,9 @@ CRUD operations for SiteModule records via csdk CLI ```bash csdk site-module list +csdk site-module list --where.. --orderBy +csdk site-module list --limit 10 --after +csdk site-module find-first --where.. csdk site-module get --id csdk site-module create --databaseId --siteId --name --data csdk site-module update --id [--databaseId ] [--siteId ] [--name ] [--data ] @@ -16,12 +19,42 @@ csdk site-module delete --id ## Examples -### List all siteModule records +### List siteModule records ```bash csdk site-module list ``` +### List siteModule records with pagination + +```bash +csdk site-module list --limit 10 --offset 0 +``` + +### List siteModule records with cursor pagination + +```bash +csdk site-module list --limit 10 --after +``` + +### Find first matching siteModule + +```bash +csdk site-module find-first --where.id.equalTo +``` + +### List siteModule records with field selection + +```bash +csdk site-module list --select id,id +``` + +### List siteModule records with filtering and ordering + +```bash +csdk site-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a siteModule ```bash diff --git a/.agents/skills/cli-public/references/site-theme.md b/.agents/skills/cli-public/references/site-theme.md index c2f31be48..0431a151c 100644 --- a/.agents/skills/cli-public/references/site-theme.md +++ b/.agents/skills/cli-public/references/site-theme.md @@ -8,6 +8,9 @@ CRUD operations for SiteTheme records via csdk CLI ```bash csdk site-theme list +csdk site-theme list --where.. --orderBy +csdk site-theme list --limit 10 --after +csdk site-theme find-first --where.. csdk site-theme get --id csdk site-theme create --databaseId --siteId --theme csdk site-theme update --id [--databaseId ] [--siteId ] [--theme ] @@ -16,12 +19,42 @@ csdk site-theme delete --id ## Examples -### List all siteTheme records +### List siteTheme records ```bash csdk site-theme list ``` +### List siteTheme records with pagination + +```bash +csdk site-theme list --limit 10 --offset 0 +``` + +### List siteTheme records with cursor pagination + +```bash +csdk site-theme list --limit 10 --after +``` + +### Find first matching siteTheme + +```bash +csdk site-theme find-first --where.id.equalTo +``` + +### List siteTheme records with field selection + +```bash +csdk site-theme list --select id,id +``` + +### List siteTheme records with filtering and ordering + +```bash +csdk site-theme list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a siteTheme ```bash diff --git a/.agents/skills/cli-public/references/site.md b/.agents/skills/cli-public/references/site.md index cb0ccd2bb..922a98605 100644 --- a/.agents/skills/cli-public/references/site.md +++ b/.agents/skills/cli-public/references/site.md @@ -8,6 +8,9 @@ CRUD operations for Site records via csdk CLI ```bash csdk site list +csdk site list --where.. --orderBy +csdk site list --limit 10 --after +csdk site find-first --where.. csdk site get --id csdk site create --databaseId [--title ] [--description ] [--ogImage ] [--favicon ] [--appleTouchIcon ] [--logo ] [--dbname ] csdk site update --id [--databaseId ] [--title ] [--description ] [--ogImage ] [--favicon ] [--appleTouchIcon ] [--logo ] [--dbname ] @@ -16,12 +19,42 @@ csdk site delete --id ## Examples -### List all site records +### List site records ```bash csdk site list ``` +### List site records with pagination + +```bash +csdk site list --limit 10 --offset 0 +``` + +### List site records with cursor pagination + +```bash +csdk site list --limit 10 --after +``` + +### Find first matching site + +```bash +csdk site find-first --where.id.equalTo +``` + +### List site records with field selection + +```bash +csdk site list --select id,id +``` + +### List site records with filtering and ordering + +```bash +csdk site list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a site ```bash diff --git a/.agents/skills/cli-public/references/sql-action.md b/.agents/skills/cli-public/references/sql-action.md index e1023339d..26493191f 100644 --- a/.agents/skills/cli-public/references/sql-action.md +++ b/.agents/skills/cli-public/references/sql-action.md @@ -8,6 +8,9 @@ CRUD operations for SqlAction records via csdk CLI ```bash csdk sql-action list +csdk sql-action list --where.. --orderBy +csdk sql-action list --limit 10 --after +csdk sql-action find-first --where.. csdk sql-action get --id csdk sql-action create [--name ] [--databaseId ] [--deploy ] [--deps ] [--payload ] [--content ] [--revert ] [--verify ] [--action ] [--actionId ] [--actorId ] csdk sql-action update --id [--name ] [--databaseId ] [--deploy ] [--deps ] [--payload ] [--content ] [--revert ] [--verify ] [--action ] [--actionId ] [--actorId ] @@ -16,12 +19,42 @@ csdk sql-action delete --id ## Examples -### List all sqlAction records +### List sqlAction records ```bash csdk sql-action list ``` +### List sqlAction records with pagination + +```bash +csdk sql-action list --limit 10 --offset 0 +``` + +### List sqlAction records with cursor pagination + +```bash +csdk sql-action list --limit 10 --after +``` + +### Find first matching sqlAction + +```bash +csdk sql-action find-first --where.id.equalTo +``` + +### List sqlAction records with field selection + +```bash +csdk sql-action list --select id,id +``` + +### List sqlAction records with filtering and ordering + +```bash +csdk sql-action list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a sqlAction ```bash diff --git a/.agents/skills/cli-public/references/store.md b/.agents/skills/cli-public/references/store.md index 18c71e259..25b76714d 100644 --- a/.agents/skills/cli-public/references/store.md +++ b/.agents/skills/cli-public/references/store.md @@ -8,6 +8,9 @@ CRUD operations for Store records via csdk CLI ```bash csdk store list +csdk store list --where.. --orderBy +csdk store list --limit 10 --after +csdk store find-first --where.. csdk store get --id csdk store create --name --databaseId [--hash ] csdk store update --id [--name ] [--databaseId ] [--hash ] @@ -16,12 +19,42 @@ csdk store delete --id ## Examples -### List all store records +### List store records ```bash csdk store list ``` +### List store records with pagination + +```bash +csdk store list --limit 10 --offset 0 +``` + +### List store records with cursor pagination + +```bash +csdk store list --limit 10 --after +``` + +### Find first matching store + +```bash +csdk store find-first --where.id.equalTo +``` + +### List store records with field selection + +```bash +csdk store list --select id,id +``` + +### List store records with filtering and ordering + +```bash +csdk store list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a store ```bash diff --git a/.agents/skills/cli-public/references/table-grant.md b/.agents/skills/cli-public/references/table-grant.md index d3e274dde..636691a67 100644 --- a/.agents/skills/cli-public/references/table-grant.md +++ b/.agents/skills/cli-public/references/table-grant.md @@ -8,6 +8,9 @@ CRUD operations for TableGrant records via csdk CLI ```bash csdk table-grant list +csdk table-grant list --where.. --orderBy +csdk table-grant list --limit 10 --after +csdk table-grant find-first --where.. csdk table-grant get --id csdk table-grant create --tableId --privilege --granteeName [--databaseId ] [--fieldIds ] [--isGrant ] csdk table-grant update --id [--databaseId ] [--tableId ] [--privilege ] [--granteeName ] [--fieldIds ] [--isGrant ] @@ -16,12 +19,42 @@ csdk table-grant delete --id ## Examples -### List all tableGrant records +### List tableGrant records ```bash csdk table-grant list ``` +### List tableGrant records with pagination + +```bash +csdk table-grant list --limit 10 --offset 0 +``` + +### List tableGrant records with cursor pagination + +```bash +csdk table-grant list --limit 10 --after +``` + +### Find first matching tableGrant + +```bash +csdk table-grant find-first --where.id.equalTo +``` + +### List tableGrant records with field selection + +```bash +csdk table-grant list --select id,id +``` + +### List tableGrant records with filtering and ordering + +```bash +csdk table-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a tableGrant ```bash diff --git a/.agents/skills/cli-public/references/table-template-module.md b/.agents/skills/cli-public/references/table-template-module.md index c81bc6da2..9901c7933 100644 --- a/.agents/skills/cli-public/references/table-template-module.md +++ b/.agents/skills/cli-public/references/table-template-module.md @@ -8,6 +8,9 @@ CRUD operations for TableTemplateModule records via csdk CLI ```bash csdk table-template-module list +csdk table-template-module list --where.. --orderBy +csdk table-template-module list --limit 10 --after +csdk table-template-module find-first --where.. csdk table-template-module get --id csdk table-template-module create --databaseId --tableName --nodeType [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] [--data ] csdk table-template-module update --id [--databaseId ] [--schemaId ] [--privateSchemaId ] [--tableId ] [--ownerTableId ] [--tableName ] [--nodeType ] [--data ] @@ -16,12 +19,42 @@ csdk table-template-module delete --id ## Examples -### List all tableTemplateModule records +### List tableTemplateModule records ```bash csdk table-template-module list ``` +### List tableTemplateModule records with pagination + +```bash +csdk table-template-module list --limit 10 --offset 0 +``` + +### List tableTemplateModule records with cursor pagination + +```bash +csdk table-template-module list --limit 10 --after +``` + +### Find first matching tableTemplateModule + +```bash +csdk table-template-module find-first --where.id.equalTo +``` + +### List tableTemplateModule records with field selection + +```bash +csdk table-template-module list --select id,id +``` + +### List tableTemplateModule records with filtering and ordering + +```bash +csdk table-template-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a tableTemplateModule ```bash diff --git a/.agents/skills/cli-public/references/table.md b/.agents/skills/cli-public/references/table.md index 4ec1eb43f..eacec729f 100644 --- a/.agents/skills/cli-public/references/table.md +++ b/.agents/skills/cli-public/references/table.md @@ -8,6 +8,9 @@ CRUD operations for Table records via csdk CLI ```bash csdk table list +csdk table list --where.. --orderBy +csdk table list --limit 10 --after +csdk table find-first --where.. csdk table get --id csdk table create --schemaId --name [--databaseId ] [--label ] [--description ] [--smartTags ] [--category ] [--module ] [--scope ] [--useRls ] [--timestamps ] [--peoplestamps ] [--pluralName ] [--singularName ] [--tags ] [--inheritsId ] csdk table update --id [--databaseId ] [--schemaId ] [--name ] [--label ] [--description ] [--smartTags ] [--category ] [--module ] [--scope ] [--useRls ] [--timestamps ] [--peoplestamps ] [--pluralName ] [--singularName ] [--tags ] [--inheritsId ] @@ -16,12 +19,42 @@ csdk table delete --id ## Examples -### List all table records +### List table records ```bash csdk table list ``` +### List table records with pagination + +```bash +csdk table list --limit 10 --offset 0 +``` + +### List table records with cursor pagination + +```bash +csdk table list --limit 10 --after +``` + +### Find first matching table + +```bash +csdk table find-first --where.id.equalTo +``` + +### List table records with field selection + +```bash +csdk table list --select id,id +``` + +### List table records with filtering and ordering + +```bash +csdk table list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a table ```bash diff --git a/.agents/skills/cli-public/references/trigger-function.md b/.agents/skills/cli-public/references/trigger-function.md index d9bc7784d..5e5415172 100644 --- a/.agents/skills/cli-public/references/trigger-function.md +++ b/.agents/skills/cli-public/references/trigger-function.md @@ -8,6 +8,9 @@ CRUD operations for TriggerFunction records via csdk CLI ```bash csdk trigger-function list +csdk trigger-function list --where.. --orderBy +csdk trigger-function list --limit 10 --after +csdk trigger-function find-first --where.. csdk trigger-function get --id csdk trigger-function create --databaseId --name [--code ] csdk trigger-function update --id [--databaseId ] [--name ] [--code ] @@ -16,12 +19,42 @@ csdk trigger-function delete --id ## Examples -### List all triggerFunction records +### List triggerFunction records ```bash csdk trigger-function list ``` +### List triggerFunction records with pagination + +```bash +csdk trigger-function list --limit 10 --offset 0 +``` + +### List triggerFunction records with cursor pagination + +```bash +csdk trigger-function list --limit 10 --after +``` + +### Find first matching triggerFunction + +```bash +csdk trigger-function find-first --where.id.equalTo +``` + +### List triggerFunction records with field selection + +```bash +csdk trigger-function list --select id,id +``` + +### List triggerFunction records with filtering and ordering + +```bash +csdk trigger-function list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a triggerFunction ```bash diff --git a/.agents/skills/cli-public/references/trigger.md b/.agents/skills/cli-public/references/trigger.md index 30b5beeba..cb296d914 100644 --- a/.agents/skills/cli-public/references/trigger.md +++ b/.agents/skills/cli-public/references/trigger.md @@ -8,6 +8,9 @@ CRUD operations for Trigger records via csdk CLI ```bash csdk trigger list +csdk trigger list --where.. --orderBy +csdk trigger list --limit 10 --after +csdk trigger find-first --where.. csdk trigger get --id csdk trigger create --tableId --name [--databaseId ] [--event ] [--functionName ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] csdk trigger update --id [--databaseId ] [--tableId ] [--name ] [--event ] [--functionName ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk trigger delete --id ## Examples -### List all trigger records +### List trigger records ```bash csdk trigger list ``` +### List trigger records with pagination + +```bash +csdk trigger list --limit 10 --offset 0 +``` + +### List trigger records with cursor pagination + +```bash +csdk trigger list --limit 10 --after +``` + +### Find first matching trigger + +```bash +csdk trigger find-first --where.id.equalTo +``` + +### List trigger records with field selection + +```bash +csdk trigger list --select id,id +``` + +### List trigger records with filtering and ordering + +```bash +csdk trigger list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a trigger ```bash diff --git a/.agents/skills/cli-public/references/unique-constraint.md b/.agents/skills/cli-public/references/unique-constraint.md index bb758c72d..042d6dabb 100644 --- a/.agents/skills/cli-public/references/unique-constraint.md +++ b/.agents/skills/cli-public/references/unique-constraint.md @@ -8,6 +8,9 @@ CRUD operations for UniqueConstraint records via csdk CLI ```bash csdk unique-constraint list +csdk unique-constraint list --where.. --orderBy +csdk unique-constraint list --limit 10 --after +csdk unique-constraint find-first --where.. csdk unique-constraint get --id csdk unique-constraint create --tableId --fieldIds [--databaseId ] [--name ] [--description ] [--smartTags ] [--type ] [--category ] [--module ] [--scope ] [--tags ] csdk unique-constraint update --id [--databaseId ] [--tableId ] [--name ] [--description ] [--smartTags ] [--type ] [--fieldIds ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk unique-constraint delete --id ## Examples -### List all uniqueConstraint records +### List uniqueConstraint records ```bash csdk unique-constraint list ``` +### List uniqueConstraint records with pagination + +```bash +csdk unique-constraint list --limit 10 --offset 0 +``` + +### List uniqueConstraint records with cursor pagination + +```bash +csdk unique-constraint list --limit 10 --after +``` + +### Find first matching uniqueConstraint + +```bash +csdk unique-constraint find-first --where.id.equalTo +``` + +### List uniqueConstraint records with field selection + +```bash +csdk unique-constraint list --select id,id +``` + +### List uniqueConstraint records with filtering and ordering + +```bash +csdk unique-constraint list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a uniqueConstraint ```bash diff --git a/.agents/skills/cli-public/references/user-auth-module.md b/.agents/skills/cli-public/references/user-auth-module.md index 615adba37..c635256eb 100644 --- a/.agents/skills/cli-public/references/user-auth-module.md +++ b/.agents/skills/cli-public/references/user-auth-module.md @@ -8,6 +8,9 @@ CRUD operations for UserAuthModule records via csdk CLI ```bash csdk user-auth-module list +csdk user-auth-module list --where.. --orderBy +csdk user-auth-module list --limit 10 --after +csdk user-auth-module find-first --where.. csdk user-auth-module get --id csdk user-auth-module create --databaseId [--schemaId ] [--emailsTableId ] [--usersTableId ] [--secretsTableId ] [--encryptedTableId ] [--sessionsTableId ] [--sessionCredentialsTableId ] [--auditsTableId ] [--auditsTableName ] [--signInFunction ] [--signUpFunction ] [--signOutFunction ] [--setPasswordFunction ] [--resetPasswordFunction ] [--forgotPasswordFunction ] [--sendVerificationEmailFunction ] [--verifyEmailFunction ] [--verifyPasswordFunction ] [--checkPasswordFunction ] [--sendAccountDeletionEmailFunction ] [--deleteAccountFunction ] [--signInOneTimeTokenFunction ] [--oneTimeTokenFunction ] [--extendTokenExpires ] csdk user-auth-module update --id [--databaseId ] [--schemaId ] [--emailsTableId ] [--usersTableId ] [--secretsTableId ] [--encryptedTableId ] [--sessionsTableId ] [--sessionCredentialsTableId ] [--auditsTableId ] [--auditsTableName ] [--signInFunction ] [--signUpFunction ] [--signOutFunction ] [--setPasswordFunction ] [--resetPasswordFunction ] [--forgotPasswordFunction ] [--sendVerificationEmailFunction ] [--verifyEmailFunction ] [--verifyPasswordFunction ] [--checkPasswordFunction ] [--sendAccountDeletionEmailFunction ] [--deleteAccountFunction ] [--signInOneTimeTokenFunction ] [--oneTimeTokenFunction ] [--extendTokenExpires ] @@ -16,12 +19,42 @@ csdk user-auth-module delete --id ## Examples -### List all userAuthModule records +### List userAuthModule records ```bash csdk user-auth-module list ``` +### List userAuthModule records with pagination + +```bash +csdk user-auth-module list --limit 10 --offset 0 +``` + +### List userAuthModule records with cursor pagination + +```bash +csdk user-auth-module list --limit 10 --after +``` + +### Find first matching userAuthModule + +```bash +csdk user-auth-module find-first --where.id.equalTo +``` + +### List userAuthModule records with field selection + +```bash +csdk user-auth-module list --select id,id +``` + +### List userAuthModule records with filtering and ordering + +```bash +csdk user-auth-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a userAuthModule ```bash diff --git a/.agents/skills/cli-public/references/user.md b/.agents/skills/cli-public/references/user.md index fbe78b595..6c0e4081d 100644 --- a/.agents/skills/cli-public/references/user.md +++ b/.agents/skills/cli-public/references/user.md @@ -4,13 +4,17 @@ CRUD operations for User records via csdk CLI -**Unified Search API fields:** `displayNameTrgmSimilarity`, `searchScore` +**Unified Search API fields:** `searchTsv`, `displayNameTrgmSimilarity`, `searchScore` Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. ## Usage ```bash csdk user list +csdk user list --where.. --orderBy +csdk user list --limit 10 --after +csdk user find-first --where.. +csdk user search csdk user get --id csdk user create [--username ] [--displayName ] [--profilePicture ] [--type ] csdk user update --id [--username ] [--displayName ] [--profilePicture ] [--type ] @@ -19,12 +23,67 @@ csdk user delete --id ## Examples -### List all user records +### List user records ```bash csdk user list ``` +### List user records with pagination + +```bash +csdk user list --limit 10 --offset 0 +``` + +### List user records with cursor pagination + +```bash +csdk user list --limit 10 --after +``` + +### Find first matching user + +```bash +csdk user find-first --where.id.equalTo +``` + +### List user records with field selection + +```bash +csdk user list --select id,id +``` + +### List user records with filtering and ordering + +```bash +csdk user list --where.id.equalTo --orderBy ID_ASC +``` + +### Full-text search via tsvector (`searchTsv`) + +```bash +csdk user list --where.searchTsv "search query" --select title,tsvRank +``` + +### Fuzzy search via trigram similarity (`trgmDisplayName`) + +```bash +csdk user list --where.trgmDisplayName.value "approximate query" --where.trgmDisplayName.threshold 0.3 --select title,displayNameTrgmSimilarity +``` + +### Composite search (fullTextSearch dispatches to all text adapters) + +```bash +csdk user list --where.fullTextSearch "search query" --select title,tsvRank,displayNameTrgmSimilarity,searchScore +``` + +### Search with pagination and field projection + +```bash +csdk user list --where.fullTextSearch "query" --limit 10 --select id,title,searchScore +csdk user search "query" --limit 10 --select id,title,searchScore +``` + ### Create a user ```bash diff --git a/.agents/skills/cli-public/references/users-module.md b/.agents/skills/cli-public/references/users-module.md index 3158259ee..00fef3bc6 100644 --- a/.agents/skills/cli-public/references/users-module.md +++ b/.agents/skills/cli-public/references/users-module.md @@ -8,6 +8,9 @@ CRUD operations for UsersModule records via csdk CLI ```bash csdk users-module list +csdk users-module list --where.. --orderBy +csdk users-module list --limit 10 --after +csdk users-module find-first --where.. csdk users-module get --id csdk users-module create --databaseId [--schemaId ] [--tableId ] [--tableName ] [--typeTableId ] [--typeTableName ] csdk users-module update --id [--databaseId ] [--schemaId ] [--tableId ] [--tableName ] [--typeTableId ] [--typeTableName ] @@ -16,12 +19,42 @@ csdk users-module delete --id ## Examples -### List all usersModule records +### List usersModule records ```bash csdk users-module list ``` +### List usersModule records with pagination + +```bash +csdk users-module list --limit 10 --offset 0 +``` + +### List usersModule records with cursor pagination + +```bash +csdk users-module list --limit 10 --after +``` + +### Find first matching usersModule + +```bash +csdk users-module find-first --where.id.equalTo +``` + +### List usersModule records with field selection + +```bash +csdk users-module list --select id,id +``` + +### List usersModule records with filtering and ordering + +```bash +csdk users-module list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a usersModule ```bash diff --git a/.agents/skills/cli-public/references/view-grant.md b/.agents/skills/cli-public/references/view-grant.md index 6f23e3033..d824d66f9 100644 --- a/.agents/skills/cli-public/references/view-grant.md +++ b/.agents/skills/cli-public/references/view-grant.md @@ -8,6 +8,9 @@ CRUD operations for ViewGrant records via csdk CLI ```bash csdk view-grant list +csdk view-grant list --where.. --orderBy +csdk view-grant list --limit 10 --after +csdk view-grant find-first --where.. csdk view-grant get --id csdk view-grant create --viewId --granteeName --privilege [--databaseId ] [--withGrantOption ] [--isGrant ] csdk view-grant update --id [--databaseId ] [--viewId ] [--granteeName ] [--privilege ] [--withGrantOption ] [--isGrant ] @@ -16,12 +19,42 @@ csdk view-grant delete --id ## Examples -### List all viewGrant records +### List viewGrant records ```bash csdk view-grant list ``` +### List viewGrant records with pagination + +```bash +csdk view-grant list --limit 10 --offset 0 +``` + +### List viewGrant records with cursor pagination + +```bash +csdk view-grant list --limit 10 --after +``` + +### Find first matching viewGrant + +```bash +csdk view-grant find-first --where.id.equalTo +``` + +### List viewGrant records with field selection + +```bash +csdk view-grant list --select id,id +``` + +### List viewGrant records with filtering and ordering + +```bash +csdk view-grant list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a viewGrant ```bash diff --git a/.agents/skills/cli-public/references/view-rule.md b/.agents/skills/cli-public/references/view-rule.md index 38c1f4aee..2d6894efe 100644 --- a/.agents/skills/cli-public/references/view-rule.md +++ b/.agents/skills/cli-public/references/view-rule.md @@ -8,6 +8,9 @@ CRUD operations for ViewRule records via csdk CLI ```bash csdk view-rule list +csdk view-rule list --where.. --orderBy +csdk view-rule list --limit 10 --after +csdk view-rule find-first --where.. csdk view-rule get --id csdk view-rule create --viewId --name --event [--databaseId ] [--action ] csdk view-rule update --id [--databaseId ] [--viewId ] [--name ] [--event ] [--action ] @@ -16,12 +19,42 @@ csdk view-rule delete --id ## Examples -### List all viewRule records +### List viewRule records ```bash csdk view-rule list ``` +### List viewRule records with pagination + +```bash +csdk view-rule list --limit 10 --offset 0 +``` + +### List viewRule records with cursor pagination + +```bash +csdk view-rule list --limit 10 --after +``` + +### Find first matching viewRule + +```bash +csdk view-rule find-first --where.id.equalTo +``` + +### List viewRule records with field selection + +```bash +csdk view-rule list --select id,id +``` + +### List viewRule records with filtering and ordering + +```bash +csdk view-rule list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a viewRule ```bash diff --git a/.agents/skills/cli-public/references/view-table.md b/.agents/skills/cli-public/references/view-table.md index 7be588c2d..1e3697cef 100644 --- a/.agents/skills/cli-public/references/view-table.md +++ b/.agents/skills/cli-public/references/view-table.md @@ -8,6 +8,9 @@ CRUD operations for ViewTable records via csdk CLI ```bash csdk view-table list +csdk view-table list --where.. --orderBy +csdk view-table list --limit 10 --after +csdk view-table find-first --where.. csdk view-table get --id csdk view-table create --viewId --tableId [--joinOrder ] csdk view-table update --id [--viewId ] [--tableId ] [--joinOrder ] @@ -16,12 +19,42 @@ csdk view-table delete --id ## Examples -### List all viewTable records +### List viewTable records ```bash csdk view-table list ``` +### List viewTable records with pagination + +```bash +csdk view-table list --limit 10 --offset 0 +``` + +### List viewTable records with cursor pagination + +```bash +csdk view-table list --limit 10 --after +``` + +### Find first matching viewTable + +```bash +csdk view-table find-first --where.id.equalTo +``` + +### List viewTable records with field selection + +```bash +csdk view-table list --select id,id +``` + +### List viewTable records with filtering and ordering + +```bash +csdk view-table list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a viewTable ```bash diff --git a/.agents/skills/cli-public/references/view.md b/.agents/skills/cli-public/references/view.md index 7d1cf1b3c..faca52a5a 100644 --- a/.agents/skills/cli-public/references/view.md +++ b/.agents/skills/cli-public/references/view.md @@ -8,6 +8,9 @@ CRUD operations for View records via csdk CLI ```bash csdk view list +csdk view list --where.. --orderBy +csdk view list --limit 10 --after +csdk view find-first --where.. csdk view get --id csdk view create --schemaId --name --viewType [--databaseId ] [--tableId ] [--data ] [--filterType ] [--filterData ] [--securityInvoker ] [--isReadOnly ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] csdk view update --id [--databaseId ] [--schemaId ] [--name ] [--tableId ] [--viewType ] [--data ] [--filterType ] [--filterData ] [--securityInvoker ] [--isReadOnly ] [--smartTags ] [--category ] [--module ] [--scope ] [--tags ] @@ -16,12 +19,42 @@ csdk view delete --id ## Examples -### List all view records +### List view records ```bash csdk view list ``` +### List view records with pagination + +```bash +csdk view list --limit 10 --offset 0 +``` + +### List view records with cursor pagination + +```bash +csdk view list --limit 10 --after +``` + +### Find first matching view + +```bash +csdk view find-first --where.id.equalTo +``` + +### List view records with field selection + +```bash +csdk view list --select id,id +``` + +### List view records with filtering and ordering + +```bash +csdk view list --where.id.equalTo --orderBy ID_ASC +``` + ### Create a view ```bash diff --git a/.agents/skills/hooks-public/SKILL.md b/.agents/skills/hooks-public/SKILL.md index c5e022e0f..f4baebe38 100644 --- a/.agents/skills/hooks-public/SKILL.md +++ b/.agents/skills/hooks-public/SKILL.md @@ -133,11 +133,11 @@ See the `references/` directory for detailed per-entity API documentation: - [migrate-file](references/migrate-file.md) - [app-limit-default](references/app-limit-default.md) - [org-limit-default](references/org-limit-default.md) -- [node-type-registry](references/node-type-registry.md) - [membership-type](references/membership-type.md) - [commit](references/commit.md) - [app-membership-default](references/app-membership-default.md) - [rls-module](references/rls-module.md) +- [node-type-registry](references/node-type-registry.md) - [org-membership-default](references/org-membership-default.md) - [sql-action](references/sql-action.md) - [user](references/user.md) diff --git a/.agents/skills/hooks-public/references/node-type-registry.md b/.agents/skills/hooks-public/references/node-type-registry.md index 0ddabc0f0..1ba771d83 100644 --- a/.agents/skills/hooks-public/references/node-type-registry.md +++ b/.agents/skills/hooks-public/references/node-type-registry.md @@ -7,8 +7,8 @@ Registry of high-level semantic AST node types using domain-prefixed naming. The ## Usage ```typescript -useNodeTypeRegistriesQuery({ selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } } }) -useNodeTypeRegistryQuery({ name: '', selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } } }) +useNodeTypeRegistriesQuery({ selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } } }) +useNodeTypeRegistryQuery({ name: '', selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } } }) useCreateNodeTypeRegistryMutation({ selection: { fields: { name: true } } }) useUpdateNodeTypeRegistryMutation({ selection: { fields: { name: true } } }) useDeleteNodeTypeRegistryMutation({}) @@ -20,7 +20,7 @@ useDeleteNodeTypeRegistryMutation({}) ```typescript const { data, isLoading } = useNodeTypeRegistriesQuery({ - selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }, + selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }, }); ``` @@ -30,5 +30,5 @@ const { data, isLoading } = useNodeTypeRegistriesQuery({ const { mutate } = useCreateNodeTypeRegistryMutation({ selection: { fields: { name: true } }, }); -mutate({ slug: '', category: '', displayName: '', description: '', parameterSchema: '', tags: '' }); +mutate({ slug: '', category: '', displayName: '', description: '', summary: '', parameterSchema: '', guidance: '', tags: '' }); ``` diff --git a/.agents/skills/orm-auth/references/user.md b/.agents/skills/orm-auth/references/user.md index 50adaa602..2d8a3cb41 100644 --- a/.agents/skills/orm-auth/references/user.md +++ b/.agents/skills/orm-auth/references/user.md @@ -4,6 +4,9 @@ ORM operations for User records +**Unified Search API fields:** `searchTsv` +Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ## Usage ```typescript diff --git a/.agents/skills/orm-public/SKILL.md b/.agents/skills/orm-public/SKILL.md index 71123312d..b8c69eff8 100644 --- a/.agents/skills/orm-public/SKILL.md +++ b/.agents/skills/orm-public/SKILL.md @@ -133,11 +133,11 @@ See the `references/` directory for detailed per-entity API documentation: - [migrate-file](references/migrate-file.md) - [app-limit-default](references/app-limit-default.md) - [org-limit-default](references/org-limit-default.md) -- [node-type-registry](references/node-type-registry.md) - [membership-type](references/membership-type.md) - [commit](references/commit.md) - [app-membership-default](references/app-membership-default.md) - [rls-module](references/rls-module.md) +- [node-type-registry](references/node-type-registry.md) - [org-membership-default](references/org-membership-default.md) - [sql-action](references/sql-action.md) - [user](references/user.md) diff --git a/.agents/skills/orm-public/references/node-type-registry.md b/.agents/skills/orm-public/references/node-type-registry.md index f67cbb82c..686e24a85 100644 --- a/.agents/skills/orm-public/references/node-type-registry.md +++ b/.agents/skills/orm-public/references/node-type-registry.md @@ -9,7 +9,7 @@ Registry of high-level semantic AST node types using domain-prefixed naming. The ```typescript db.nodeTypeRegistry.findMany({ select: { id: true } }).execute() db.nodeTypeRegistry.findOne({ name: '', select: { id: true } }).execute() -db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', parameterSchema: '', tags: '' }, select: { id: true } }).execute() +db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', summary: '', parameterSchema: '', guidance: '', tags: '' }, select: { id: true } }).execute() db.nodeTypeRegistry.update({ where: { name: '' }, data: { slug: '' }, select: { id: true } }).execute() db.nodeTypeRegistry.delete({ where: { name: '' } }).execute() ``` @@ -28,7 +28,7 @@ const items = await db.nodeTypeRegistry.findMany({ ```typescript const item = await db.nodeTypeRegistry.create({ - data: { slug: '', category: '', displayName: '', description: '', parameterSchema: '', tags: '' }, + data: { slug: '', category: '', displayName: '', description: '', summary: '', parameterSchema: '', guidance: '', tags: '' }, select: { name: true } }).execute(); ``` diff --git a/.agents/skills/orm-public/references/user.md b/.agents/skills/orm-public/references/user.md index 50adaa602..2d8a3cb41 100644 --- a/.agents/skills/orm-public/references/user.md +++ b/.agents/skills/orm-public/references/user.md @@ -4,6 +4,9 @@ ORM operations for User records +**Unified Search API fields:** `searchTsv` +Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ## Usage ```typescript diff --git a/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap b/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap index 3787efdea..b6a64b76e 100644 --- a/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap +++ b/graphql/codegen/src/__tests__/codegen/__snapshots__/cli-generator.test.ts.snap @@ -697,7 +697,8 @@ import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../executor"; import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from "../utils"; import type { FieldSchema } from "../utils"; -import type { CreateCarInput, CarPatch } from "../../orm/input-types"; +import type { CreateCarInput, CarPatch, CarSelect, CarFilter, CarsOrderBy } from "../../orm/input-types"; +import type { FindManyArgs, FindFirstArgs } from "../../orm/select-types"; const fieldSchema: FieldSchema = { id: "uuid", make: "string", @@ -756,7 +757,9 @@ async function handleList(argv: Partial>, _prompter: Inq isElectric: true, createdAt: true }; - const findManyArgs = parseFindManyArgs(argv, defaultSelect); + const findManyArgs = parseFindManyArgs & { + select: CarSelect; + }>(argv, defaultSelect); const client = getClient(); const result = await client.car.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -778,7 +781,9 @@ async function handleFindFirst(argv: Partial>, _prompter isElectric: true, createdAt: true }; - const findFirstArgs = parseFindFirstArgs(argv, defaultSelect); + const findFirstArgs = parseFindFirstArgs & { + select: CarSelect; + }>(argv, defaultSelect); const client = getClient(); const result = await client.car.findFirst(findFirstArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -1160,7 +1165,8 @@ import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../executor"; import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from "../utils"; import type { FieldSchema } from "../utils"; -import type { CreateDriverInput, DriverPatch } from "../../orm/input-types"; +import type { CreateDriverInput, DriverPatch, DriverSelect, DriverFilter, DriversOrderBy } from "../../orm/input-types"; +import type { FindManyArgs, FindFirstArgs } from "../../orm/select-types"; const fieldSchema: FieldSchema = { id: "uuid", name: "string", @@ -1213,7 +1219,9 @@ async function handleList(argv: Partial>, _prompter: Inq name: true, licenseNumber: true }; - const findManyArgs = parseFindManyArgs(argv, defaultSelect); + const findManyArgs = parseFindManyArgs & { + select: DriverSelect; + }>(argv, defaultSelect); const client = getClient(); const result = await client.driver.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -1232,7 +1240,9 @@ async function handleFindFirst(argv: Partial>, _prompter name: true, licenseNumber: true }; - const findFirstArgs = parseFindFirstArgs(argv, defaultSelect); + const findFirstArgs = parseFindFirstArgs & { + select: DriverSelect; + }>(argv, defaultSelect); const client = getClient(); const result = await client.driver.findFirst(findFirstArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -3191,7 +3201,8 @@ import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../../executor"; import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from "../../utils"; import type { FieldSchema } from "../../utils"; -import type { CreateUserInput, UserPatch } from "../../../orm/input-types"; +import type { CreateUserInput, UserPatch, UserSelect, UserFilter, UsersOrderBy } from "../../../orm/input-types"; +import type { FindManyArgs, FindFirstArgs } from "../../../orm/select-types"; const fieldSchema: FieldSchema = { id: "uuid", email: "string", @@ -3244,7 +3255,9 @@ async function handleList(argv: Partial>, _prompter: Inq email: true, name: true }; - const findManyArgs = parseFindManyArgs(argv, defaultSelect); + const findManyArgs = parseFindManyArgs & { + select: UserSelect; + }>(argv, defaultSelect); const client = getClient("auth"); const result = await client.user.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -3263,7 +3276,9 @@ async function handleFindFirst(argv: Partial>, _prompter email: true, name: true }; - const findFirstArgs = parseFindFirstArgs(argv, defaultSelect); + const findFirstArgs = parseFindFirstArgs & { + select: UserSelect; + }>(argv, defaultSelect); const client = getClient("auth"); const result = await client.user.findFirst(findFirstArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -3420,7 +3435,8 @@ import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../../executor"; import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from "../../utils"; import type { FieldSchema } from "../../utils"; -import type { CreateMemberInput, MemberPatch } from "../../../orm/input-types"; +import type { CreateMemberInput, MemberPatch, MemberSelect, MemberFilter, MembersOrderBy } from "../../../orm/input-types"; +import type { FindManyArgs, FindFirstArgs } from "../../../orm/select-types"; const fieldSchema: FieldSchema = { id: "uuid", role: "string" @@ -3471,7 +3487,9 @@ async function handleList(argv: Partial>, _prompter: Inq id: true, role: true }; - const findManyArgs = parseFindManyArgs(argv, defaultSelect); + const findManyArgs = parseFindManyArgs & { + select: MemberSelect; + }>(argv, defaultSelect); const client = getClient("members"); const result = await client.member.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -3489,7 +3507,9 @@ async function handleFindFirst(argv: Partial>, _prompter id: true, role: true }; - const findFirstArgs = parseFindFirstArgs(argv, defaultSelect); + const findFirstArgs = parseFindFirstArgs & { + select: MemberSelect; + }>(argv, defaultSelect); const client = getClient("members"); const result = await client.member.findFirst(findFirstArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -3631,7 +3651,8 @@ import { CLIOptions, Inquirerer, extractFirst } from "inquirerer"; import { getClient } from "../../executor"; import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from "../../utils"; import type { FieldSchema } from "../../utils"; -import type { CreateCarInput, CarPatch } from "../../../orm/input-types"; +import type { CreateCarInput, CarPatch, CarSelect, CarFilter, CarsOrderBy } from "../../../orm/input-types"; +import type { FindManyArgs, FindFirstArgs } from "../../../orm/select-types"; const fieldSchema: FieldSchema = { id: "uuid", make: "string", @@ -3690,7 +3711,9 @@ async function handleList(argv: Partial>, _prompter: Inq isElectric: true, createdAt: true }; - const findManyArgs = parseFindManyArgs(argv, defaultSelect); + const findManyArgs = parseFindManyArgs & { + select: CarSelect; + }>(argv, defaultSelect); const client = getClient("app"); const result = await client.car.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); @@ -3712,7 +3735,9 @@ async function handleFindFirst(argv: Partial>, _prompter isElectric: true, createdAt: true }; - const findFirstArgs = parseFindFirstArgs(argv, defaultSelect); + const findFirstArgs = parseFindFirstArgs & { + select: CarSelect; + }>(argv, defaultSelect); const client = getClient("app"); const result = await client.car.findFirst(findFirstArgs).execute(); console.log(JSON.stringify(result, null, 2)); diff --git a/graphql/codegen/src/__tests__/codegen/__snapshots__/input-types-generator.test.ts.snap b/graphql/codegen/src/__tests__/codegen/__snapshots__/input-types-generator.test.ts.snap index c90ff15df..dca52f449 100644 --- a/graphql/codegen/src/__tests__/codegen/__snapshots__/input-types-generator.test.ts.snap +++ b/graphql/codegen/src/__tests__/codegen/__snapshots__/input-types-generator.test.ts.snap @@ -373,31 +373,6 @@ export interface CommentFilter { or?: CommentFilter[]; not?: CommentFilter; } -// ============ Table Condition Types ============ -export interface UserCondition { - id?: string | null; - email?: string | null; - name?: string | null; - age?: number | null; - isActive?: boolean | null; - createdAt?: string | null; - metadata?: unknown | null; -} -export interface PostCondition { - id?: string | null; - title?: string | null; - content?: string | null; - authorId?: string | null; - publishedAt?: string | null; - tags?: string | null; -} -export interface CommentCondition { - id?: string | null; - body?: string | null; - postId?: string | null; - authorId?: string | null; - createdAt?: string | null; -} // ============ OrderBy Types ============ export type UsersOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "EMAIL_ASC" | "EMAIL_DESC" | "NAME_ASC" | "NAME_DESC" | "AGE_ASC" | "AGE_DESC" | "IS_ACTIVE_ASC" | "IS_ACTIVE_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "METADATA_ASC" | "METADATA_DESC"; export type PostsOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "TITLE_ASC" | "TITLE_DESC" | "CONTENT_ASC" | "CONTENT_DESC" | "AUTHOR_ID_ASC" | "AUTHOR_ID_DESC" | "PUBLISHED_AT_ASC" | "PUBLISHED_AT_DESC" | "TAGS_ASC" | "TAGS_DESC"; @@ -771,16 +746,6 @@ export interface UserFilter { or?: UserFilter[]; not?: UserFilter; } -// ============ Table Condition Types ============ -export interface UserCondition { - id?: string | null; - email?: string | null; - name?: string | null; - age?: number | null; - isActive?: boolean | null; - createdAt?: string | null; - metadata?: unknown | null; -} // ============ OrderBy Types ============ export type UsersOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "EMAIL_ASC" | "EMAIL_DESC" | "NAME_ASC" | "NAME_DESC" | "AGE_ASC" | "AGE_DESC" | "IS_ACTIVE_ASC" | "IS_ACTIVE_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "METADATA_ASC" | "METADATA_DESC"; // ============ CRUD Input Types ============ @@ -1096,16 +1061,6 @@ export interface UserFilter { or?: UserFilter[]; not?: UserFilter; } -// ============ Table Condition Types ============ -export interface UserCondition { - id?: string | null; - email?: string | null; - name?: string | null; - age?: number | null; - isActive?: boolean | null; - createdAt?: string | null; - metadata?: unknown | null; -} // ============ OrderBy Types ============ export type UsersOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "EMAIL_ASC" | "EMAIL_DESC" | "NAME_ASC" | "NAME_DESC" | "AGE_ASC" | "AGE_DESC" | "IS_ACTIVE_ASC" | "IS_ACTIVE_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "METADATA_ASC" | "METADATA_DESC"; // ============ CRUD Input Types ============ @@ -1433,16 +1388,6 @@ export interface UserFilter { or?: UserFilter[]; not?: UserFilter; } -// ============ Table Condition Types ============ -export interface UserCondition { - id?: string | null; - email?: string | null; - name?: string | null; - age?: number | null; - isActive?: boolean | null; - createdAt?: string | null; - metadata?: unknown | null; -} // ============ OrderBy Types ============ export type UsersOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "EMAIL_ASC" | "EMAIL_DESC" | "NAME_ASC" | "NAME_DESC" | "AGE_ASC" | "AGE_DESC" | "IS_ACTIVE_ASC" | "IS_ACTIVE_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "METADATA_ASC" | "METADATA_DESC"; // ============ CRUD Input Types ============ @@ -1815,22 +1760,6 @@ export interface ProfileFilter { or?: ProfileFilter[]; not?: ProfileFilter; } -// ============ Table Condition Types ============ -export interface UserCondition { - id?: string | null; - email?: string | null; - name?: string | null; - age?: number | null; - isActive?: boolean | null; - createdAt?: string | null; - metadata?: unknown | null; -} -export interface ProfileCondition { - id?: string | null; - bio?: string | null; - userId?: string | null; - avatarUrl?: string | null; -} // ============ OrderBy Types ============ export type UsersOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "EMAIL_ASC" | "EMAIL_DESC" | "NAME_ASC" | "NAME_DESC" | "AGE_ASC" | "AGE_DESC" | "IS_ACTIVE_ASC" | "IS_ACTIVE_DESC" | "CREATED_AT_ASC" | "CREATED_AT_DESC" | "METADATA_ASC" | "METADATA_DESC"; export type ProfilesOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "BIO_ASC" | "BIO_DESC" | "USER_ID_ASC" | "USER_ID_DESC" | "AVATAR_URL_ASC" | "AVATAR_URL_DESC"; @@ -2210,20 +2139,6 @@ export interface CategoryFilter { or?: CategoryFilter[]; not?: CategoryFilter; } -// ============ Table Condition Types ============ -export interface PostCondition { - id?: string | null; - title?: string | null; - content?: string | null; - authorId?: string | null; - publishedAt?: string | null; - tags?: string | null; -} -export interface CategoryCondition { - id?: string | null; - name?: string | null; - slug?: string | null; -} // ============ OrderBy Types ============ export type PostsOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "TITLE_ASC" | "TITLE_DESC" | "CONTENT_ASC" | "CONTENT_DESC" | "AUTHOR_ID_ASC" | "AUTHOR_ID_DESC" | "PUBLISHED_AT_ASC" | "PUBLISHED_AT_DESC" | "TAGS_ASC" | "TAGS_DESC"; export type CategoriesOrderBy = "PRIMARY_KEY_ASC" | "PRIMARY_KEY_DESC" | "NATURAL" | "ID_ASC" | "ID_DESC" | "NAME_ASC" | "NAME_DESC" | "SLUG_ASC" | "SLUG_DESC"; diff --git a/graphql/codegen/src/__tests__/codegen/__snapshots__/model-generator.test.ts.snap b/graphql/codegen/src/__tests__/codegen/__snapshots__/model-generator.test.ts.snap index 4153840aa..18824756c 100644 --- a/graphql/codegen/src/__tests__/codegen/__snapshots__/model-generator.test.ts.snap +++ b/graphql/codegen/src/__tests__/codegen/__snapshots__/model-generator.test.ts.snap @@ -9,11 +9,11 @@ exports[`model-generator generates model with all CRUD methods 1`] = ` import { OrmClient } from "../client"; import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument } from "../query-builder"; import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, UpdateArgs, DeleteArgs, InferSelectResult, StrictSelect } from "../select-types"; -import type { User, UserWithRelations, UserSelect, UserFilter, UserCondition, UsersOrderBy, CreateUserInput, UpdateUserInput, UserPatch } from "../input-types"; +import type { User, UserWithRelations, UserSelect, UserFilter, UsersOrderBy, CreateUserInput, UpdateUserInput, UserPatch } from "../input-types"; import { connectionFieldsMap } from "../input-types"; export class UserModel { constructor(private client: OrmClient) {} - findMany(args: FindManyArgs & { + findMany(args: FindManyArgs & { select: S; } & StrictSelect): QueryBuilder<{ users: ConnectionResult>; @@ -23,14 +23,13 @@ export class UserModel { variables } = buildFindManyDocument("User", "users", args.select, { where: args?.where, - condition: args?.condition, orderBy: args?.orderBy as string[] | undefined, first: args?.first, last: args?.last, after: args?.after, before: args?.before, offset: args?.offset - }, "UserFilter", "UsersOrderBy", connectionFieldsMap, "UserCondition"); + }, "UserFilter", "UsersOrderBy", connectionFieldsMap); return new QueryBuilder({ client: this.client, operation: "query", @@ -40,7 +39,7 @@ export class UserModel { variables }); } - findFirst(args: FindFirstArgs & { + findFirst(args: FindFirstArgs & { select: S; } & StrictSelect): QueryBuilder<{ users: { @@ -51,9 +50,8 @@ export class UserModel { document, variables } = buildFindFirstDocument("User", "users", args.select, { - where: args?.where, - condition: args?.condition - }, "UserFilter", connectionFieldsMap, "UserCondition"); + where: args?.where + }, "UserFilter", connectionFieldsMap); return new QueryBuilder({ client: this.client, operation: "query", @@ -160,11 +158,11 @@ exports[`model-generator generates model without update/delete when not availabl import { OrmClient } from "../client"; import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument } from "../query-builder"; import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, UpdateArgs, DeleteArgs, InferSelectResult, StrictSelect } from "../select-types"; -import type { AuditLog, AuditLogWithRelations, AuditLogSelect, AuditLogFilter, AuditLogCondition, AuditLogsOrderBy, CreateAuditLogInput, UpdateAuditLogInput, AuditLogPatch } from "../input-types"; +import type { AuditLog, AuditLogWithRelations, AuditLogSelect, AuditLogFilter, AuditLogsOrderBy, CreateAuditLogInput, UpdateAuditLogInput, AuditLogPatch } from "../input-types"; import { connectionFieldsMap } from "../input-types"; export class AuditLogModel { constructor(private client: OrmClient) {} - findMany(args: FindManyArgs & { + findMany(args: FindManyArgs & { select: S; } & StrictSelect): QueryBuilder<{ auditLogs: ConnectionResult>; @@ -174,14 +172,13 @@ export class AuditLogModel { variables } = buildFindManyDocument("AuditLog", "auditLogs", args.select, { where: args?.where, - condition: args?.condition, orderBy: args?.orderBy as string[] | undefined, first: args?.first, last: args?.last, after: args?.after, before: args?.before, offset: args?.offset - }, "AuditLogFilter", "AuditLogsOrderBy", connectionFieldsMap, "AuditLogCondition"); + }, "AuditLogFilter", "AuditLogsOrderBy", connectionFieldsMap); return new QueryBuilder({ client: this.client, operation: "query", @@ -191,7 +188,7 @@ export class AuditLogModel { variables }); } - findFirst(args: FindFirstArgs & { + findFirst(args: FindFirstArgs & { select: S; } & StrictSelect): QueryBuilder<{ auditLogs: { @@ -202,9 +199,8 @@ export class AuditLogModel { document, variables } = buildFindFirstDocument("AuditLog", "auditLogs", args.select, { - where: args?.where, - condition: args?.condition - }, "AuditLogFilter", connectionFieldsMap, "AuditLogCondition"); + where: args?.where + }, "AuditLogFilter", connectionFieldsMap); return new QueryBuilder({ client: this.client, operation: "query", @@ -265,11 +261,11 @@ exports[`model-generator handles custom query/mutation names 1`] = ` import { OrmClient } from "../client"; import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument } from "../query-builder"; import type { ConnectionResult, FindManyArgs, FindFirstArgs, CreateArgs, UpdateArgs, DeleteArgs, InferSelectResult, StrictSelect } from "../select-types"; -import type { Organization, OrganizationWithRelations, OrganizationSelect, OrganizationFilter, OrganizationCondition, OrganizationsOrderBy, CreateOrganizationInput, UpdateOrganizationInput, OrganizationPatch } from "../input-types"; +import type { Organization, OrganizationWithRelations, OrganizationSelect, OrganizationFilter, OrganizationsOrderBy, CreateOrganizationInput, UpdateOrganizationInput, OrganizationPatch } from "../input-types"; import { connectionFieldsMap } from "../input-types"; export class OrganizationModel { constructor(private client: OrmClient) {} - findMany(args: FindManyArgs & { + findMany(args: FindManyArgs & { select: S; } & StrictSelect): QueryBuilder<{ allOrganizations: ConnectionResult>; @@ -279,14 +275,13 @@ export class OrganizationModel { variables } = buildFindManyDocument("Organization", "allOrganizations", args.select, { where: args?.where, - condition: args?.condition, orderBy: args?.orderBy as string[] | undefined, first: args?.first, last: args?.last, after: args?.after, before: args?.before, offset: args?.offset - }, "OrganizationFilter", "OrganizationsOrderBy", connectionFieldsMap, "OrganizationCondition"); + }, "OrganizationFilter", "OrganizationsOrderBy", connectionFieldsMap); return new QueryBuilder({ client: this.client, operation: "query", @@ -296,7 +291,7 @@ export class OrganizationModel { variables }); } - findFirst(args: FindFirstArgs & { + findFirst(args: FindFirstArgs & { select: S; } & StrictSelect): QueryBuilder<{ allOrganizations: { @@ -307,9 +302,8 @@ export class OrganizationModel { document, variables } = buildFindFirstDocument("Organization", "allOrganizations", args.select, { - where: args?.where, - condition: args?.condition - }, "OrganizationFilter", connectionFieldsMap, "OrganizationCondition"); + where: args?.where + }, "OrganizationFilter", connectionFieldsMap); return new QueryBuilder({ client: this.client, operation: "query", diff --git a/graphql/codegen/src/__tests__/codegen/__snapshots__/react-query-hooks.test.ts.snap b/graphql/codegen/src/__tests__/codegen/__snapshots__/react-query-hooks.test.ts.snap index 1ed497d76..16ed2c736 100644 --- a/graphql/codegen/src/__tests__/codegen/__snapshots__/react-query-hooks.test.ts.snap +++ b/graphql/codegen/src/__tests__/codegen/__snapshots__/react-query-hooks.test.ts.snap @@ -1436,9 +1436,9 @@ import { getClient } from "../client"; import { buildListSelectionArgs } from "../selection"; import type { ListSelectionConfig } from "../selection"; import { userKeys } from "../query-keys"; -import type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy, UserCondition } from "../../orm/input-types"; +import type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy } from "../../orm/input-types"; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect } from "../../orm/select-types"; -export type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy, UserCondition } from "../../orm/input-types"; +export type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy } from "../../orm/input-types"; /** Query key factory - re-exported from query-keys.ts */ export const usersQueryKey = userKeys.list; /** @@ -1545,9 +1545,9 @@ import { buildListSelectionArgs } from "../selection"; import type { ListSelectionConfig } from "../selection"; import { postKeys } from "../query-keys"; import type { PostScope } from "../query-keys"; -import type { PostSelect, PostWithRelations, PostFilter, PostsOrderBy, PostCondition } from "../../orm/input-types"; +import type { PostSelect, PostWithRelations, PostFilter, PostsOrderBy } from "../../orm/input-types"; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect } from "../../orm/select-types"; -export type { PostSelect, PostWithRelations, PostFilter, PostsOrderBy, PostCondition } from "../../orm/input-types"; +export type { PostSelect, PostWithRelations, PostFilter, PostsOrderBy } from "../../orm/input-types"; /** Query key factory - re-exported from query-keys.ts */ export const postsQueryKey = postKeys.list; /** @@ -1669,10 +1669,10 @@ import type { UseQueryOptions, UseQueryResult, QueryClient } from "@tanstack/rea import { getClient } from "../client"; import { buildListSelectionArgs } from "../selection"; import type { ListSelectionConfig } from "../selection"; -import type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy, UserCondition } from "../../orm/input-types"; +import type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy } from "../../orm/input-types"; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect } from "../../orm/select-types"; -export type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy, UserCondition } from "../../orm/input-types"; -export const usersQueryKey = (variables?: FindManyArgs) => ["user", "list", variables] as const; +export type { UserSelect, UserWithRelations, UserFilter, UsersOrderBy } from "../../orm/input-types"; +export const usersQueryKey = (variables?: FindManyArgs) => ["user", "list", variables] as const; /** * Query hook for fetching User list * diff --git a/graphql/codegen/src/__tests__/codegen/input-types-generator.test.ts b/graphql/codegen/src/__tests__/codegen/input-types-generator.test.ts index 89cc8fed4..995b80767 100644 --- a/graphql/codegen/src/__tests__/codegen/input-types-generator.test.ts +++ b/graphql/codegen/src/__tests__/codegen/input-types-generator.test.ts @@ -965,7 +965,7 @@ describe('plugin-injected condition fields', () => { }, }); - const result = generateInputTypesFile(registry, new Set(), [contactTable]); + const result = generateInputTypesFile(registry, new Set(), [contactTable], undefined, true, { condition: true }); // Regular table column fields should still be present expect(result.content).toContain('export interface ContactCondition {'); @@ -1025,7 +1025,7 @@ describe('plugin-injected condition fields', () => { }, }); - const result = generateInputTypesFile(registry, new Set(), [contactTable]); + const result = generateInputTypesFile(registry, new Set(), [contactTable], undefined, true, { condition: true }); // VectorNearbyInput should be generated (follows *Input pattern) expect(result.content).toContain('export interface VectorNearbyInput {'); @@ -1051,7 +1051,7 @@ describe('plugin-injected condition fields', () => { }, }); - const result = generateInputTypesFile(registry, new Set(), [contactTable]); + const result = generateInputTypesFile(registry, new Set(), [contactTable], undefined, true, { condition: true }); // Count occurrences of 'id?' in the ContactCondition interface const conditionMatch = result.content.match( @@ -1102,7 +1102,7 @@ describe('plugin-injected condition fields', () => { it('works without typeRegistry (backwards compatible)', () => { // When no typeRegistry has the condition type, only table columns are used - const result = generateInputTypesFile(new Map(), new Set(), [contactTable]); + const result = generateInputTypesFile(new Map(), new Set(), [contactTable], undefined, true, { condition: true }); expect(result.content).toContain('export interface ContactCondition {'); expect(result.content).toContain('id?: string | null;'); diff --git a/graphql/codegen/src/__tests__/codegen/model-generator.test.ts b/graphql/codegen/src/__tests__/codegen/model-generator.test.ts index b2efd99c8..8b111ebad 100644 --- a/graphql/codegen/src/__tests__/codegen/model-generator.test.ts +++ b/graphql/codegen/src/__tests__/codegen/model-generator.test.ts @@ -249,7 +249,7 @@ describe('model-generator', () => { }, }); - const result = generateModelFile(table, false); + const result = generateModelFile(table, false, { condition: true }); // Condition type should be imported expect(result.content).toContain('ContactCondition'); diff --git a/graphql/codegen/src/core/codegen/cli/index.ts b/graphql/codegen/src/core/codegen/cli/index.ts index 9e107db1a..fb47040a4 100644 --- a/graphql/codegen/src/core/codegen/cli/index.ts +++ b/graphql/codegen/src/core/codegen/cli/index.ts @@ -78,9 +78,12 @@ export function generateCli(options: GenerateCliOptions): GenerateCliResult { const authFile = generateAuthCommand(toolName); files.push(authFile); + const conditionEnabled = config.codegen?.condition === true; + for (const table of tables) { const tableFile = generateTableCommand(table, { typeRegistry: options.typeRegistry, + condition: conditionEnabled, }); files.push(tableFile); } @@ -143,6 +146,8 @@ export interface GenerateMultiTargetCliOptions { nodeHttpAdapter?: boolean; /** Generate a runnable index.ts entry point */ entryPoint?: boolean; + /** Whether PostGraphile condition types are enabled (default: true) */ + condition?: boolean; } export function resolveBuiltinNames( @@ -170,6 +175,7 @@ export function generateMultiTargetCli( options: GenerateMultiTargetCliOptions, ): GenerateCliResult { const { toolName, targets } = options; + const conditionEnabled = options.condition === true; const files: GeneratedFile[] = []; const targetNames = targets.map((t) => t.name); @@ -244,6 +250,7 @@ export function generateMultiTargetCli( targetName: target.name, executorImportPath: '../../executor', typeRegistry: target.typeRegistry, + condition: conditionEnabled, }); files.push(tableFile); } diff --git a/graphql/codegen/src/core/codegen/cli/table-command-generator.ts b/graphql/codegen/src/core/codegen/cli/table-command-generator.ts index 9bb158724..fa159a11a 100644 --- a/graphql/codegen/src/core/codegen/cli/table-command-generator.ts +++ b/graphql/codegen/src/core/codegen/cli/table-command-generator.ts @@ -15,6 +15,9 @@ import { toPascalCase, getCreateInputTypeName, getPatchTypeName, + getFilterTypeName, + getOrderByTypeName, + getConditionTypeName, } from '../utils'; import type { Table, TypeRegistry } from '../../../types/schema'; import type { GeneratedFile } from './executor-generator'; @@ -480,7 +483,84 @@ function buildAutoEmbedInputBlock( ); } -function buildListHandler(table: Table, vectorFieldNames: string[], targetName?: string, typeRegistry?: TypeRegistry): t.FunctionDeclaration { +/** + * Build the FindManyArgs type instantiation for a table: + * FindManyArgs & { select: SelectType } + * + * The intersection with { select: SelectType } makes select required, + * matching what the ORM's findMany method expects. parseFindManyArgs + * always sets select at runtime (from defaultSelect or --select flag). + */ +function buildFindManyArgsType(table: Table, conditionEnabled: boolean): t.TSType { + const { typeName } = getTableNames(table); + const selectTypeName = `${typeName}Select`; + const whereTypeName = getFilterTypeName(table); + const conditionTypeName = conditionEnabled ? getConditionTypeName(table) : undefined; + const orderByTypeName = getOrderByTypeName(table); + const findManyType = t.tsTypeReference( + t.identifier('FindManyArgs'), + t.tsTypeParameterInstantiation([ + t.tsTypeReference(t.identifier(selectTypeName)), + t.tsTypeReference(t.identifier(whereTypeName)), + conditionTypeName + ? t.tsTypeReference(t.identifier(conditionTypeName)) + : t.tsNeverKeyword(), + t.tsTypeReference(t.identifier(orderByTypeName)), + ]), + ); + // Intersect with { select: SelectType } to make select required + return t.tsIntersectionType([ + findManyType, + t.tsTypeLiteral([ + Object.assign( + t.tsPropertySignature( + t.identifier('select'), + t.tsTypeAnnotation(t.tsTypeReference(t.identifier(selectTypeName))), + ), + { optional: false }, + ), + ]), + ]); +} + +/** + * Build the FindFirstArgs type instantiation for a table: + * FindFirstArgs & { select: SelectType } + * + * The intersection with { select: SelectType } makes select required, + * matching what the ORM's findFirst method expects. + */ +function buildFindFirstArgsType(table: Table, conditionEnabled: boolean): t.TSType { + const { typeName } = getTableNames(table); + const selectTypeName = `${typeName}Select`; + const whereTypeName = getFilterTypeName(table); + const conditionTypeName = conditionEnabled ? getConditionTypeName(table) : undefined; + const findFirstType = t.tsTypeReference( + t.identifier('FindFirstArgs'), + t.tsTypeParameterInstantiation([ + t.tsTypeReference(t.identifier(selectTypeName)), + t.tsTypeReference(t.identifier(whereTypeName)), + conditionTypeName + ? t.tsTypeReference(t.identifier(conditionTypeName)) + : t.tsNeverKeyword(), + ]), + ); + // Intersect with { select: SelectType } to make select required + return t.tsIntersectionType([ + findFirstType, + t.tsTypeLiteral([ + Object.assign( + t.tsPropertySignature( + t.identifier('select'), + t.tsTypeAnnotation(t.tsTypeReference(t.identifier(selectTypeName))), + ), + { optional: false }, + ), + ]), + ]); +} + +function buildListHandler(table: Table, vectorFieldNames: string[], targetName?: string, typeRegistry?: TypeRegistry, conditionEnabled = false): t.FunctionDeclaration { const { singularName } = getTableNames(table); const defaultSelectObj = buildSelectObject(table, typeRegistry); @@ -494,18 +574,21 @@ function buildListHandler(table: Table, vectorFieldNames: string[], targetName?: ]), ); - // const findManyArgs = parseFindManyArgs(argv, defaultSelect); - tryBody.push( - t.variableDeclaration('const', [ - t.variableDeclarator( - t.identifier('findManyArgs'), - t.callExpression(t.identifier('parseFindManyArgs'), [ - t.identifier('argv'), - t.identifier('defaultSelect'), - ]), - ), - ]), - ); + // const findManyArgs = parseFindManyArgs>(argv, defaultSelect); + { + const callExpr = t.callExpression(t.identifier('parseFindManyArgs'), [ + t.identifier('argv'), + t.identifier('defaultSelect'), + ]); + callExpr.typeParameters = t.tsTypeParameterInstantiation([ + buildFindManyArgsType(table, conditionEnabled), + ]); + tryBody.push( + t.variableDeclaration('const', [ + t.variableDeclarator(t.identifier('findManyArgs'), callExpr), + ]), + ); + } // Auto-embed vector fields in the where clause when --auto-embed is passed if (vectorFieldNames.length > 0) { @@ -575,7 +658,7 @@ function buildListHandler(table: Table, vectorFieldNames: string[], targetName?: * Accepts --select, --where.., --condition.. flags. * Internally calls findMany with first:1 and returns a single record (or null). */ -function buildFindFirstHandler(table: Table, targetName?: string, typeRegistry?: TypeRegistry): t.FunctionDeclaration { +function buildFindFirstHandler(table: Table, targetName?: string, typeRegistry?: TypeRegistry, conditionEnabled = false): t.FunctionDeclaration { const { singularName } = getTableNames(table); const defaultSelectObj = buildSelectObject(table, typeRegistry); @@ -588,18 +671,21 @@ function buildFindFirstHandler(table: Table, targetName?: string, typeRegistry?: ]), ); - // const findFirstArgs = parseFindFirstArgs(argv, defaultSelect); - tryBody.push( - t.variableDeclaration('const', [ - t.variableDeclarator( - t.identifier('findFirstArgs'), - t.callExpression(t.identifier('parseFindFirstArgs'), [ - t.identifier('argv'), - t.identifier('defaultSelect'), - ]), - ), - ]), - ); + // const findFirstArgs = parseFindFirstArgs>(argv, defaultSelect); + { + const callExpr = t.callExpression(t.identifier('parseFindFirstArgs'), [ + t.identifier('argv'), + t.identifier('defaultSelect'), + ]); + callExpr.typeParameters = t.tsTypeParameterInstantiation([ + buildFindFirstArgsType(table, conditionEnabled), + ]); + tryBody.push( + t.variableDeclaration('const', [ + t.variableDeclarator(t.identifier('findFirstArgs'), callExpr), + ]), + ); + } tryBody.push(buildGetClientStatement(targetName)); @@ -662,6 +748,7 @@ function buildSearchHandler( vectorFieldNames: string[], targetName?: string, typeRegistry?: TypeRegistry, + conditionEnabled = false, ): t.FunctionDeclaration { const { singularName } = getTableNames(table); const defaultSelectObj = buildSelectObject(table, typeRegistry); @@ -808,19 +895,22 @@ function buildSearchHandler( ]), ); - // const findManyArgs = parseFindManyArgs(argv, defaultSelect, searchWhere); - tryBody.push( - t.variableDeclaration('const', [ - t.variableDeclarator( - t.identifier('findManyArgs'), - t.callExpression(t.identifier('parseFindManyArgs'), [ - t.identifier('argv'), - t.identifier('defaultSelect'), - t.identifier('searchWhere'), - ]), - ), - ]), - ); + // const findManyArgs = parseFindManyArgs>(argv, defaultSelect, searchWhere); + { + const callExpr = t.callExpression(t.identifier('parseFindManyArgs'), [ + t.identifier('argv'), + t.identifier('defaultSelect'), + t.identifier('searchWhere'), + ]); + callExpr.typeParameters = t.tsTypeParameterInstantiation([ + buildFindManyArgsType(table, conditionEnabled), + ]); + tryBody.push( + t.variableDeclaration('const', [ + t.variableDeclarator(t.identifier('findManyArgs'), callExpr), + ]), + ); + } tryBody.push(buildGetClientStatement(targetName)); @@ -1247,10 +1337,12 @@ export interface TableCommandOptions { executorImportPath?: string; /** TypeRegistry from introspection, used to check field defaults */ typeRegistry?: TypeRegistry; + /** Whether PostGraphile condition types are enabled (default: true) */ + condition?: boolean; } export function generateTableCommand(table: Table, options?: TableCommandOptions): GeneratedFile { - const { singularName } = getTableNames(table); + const { singularName, typeName } = getTableNames(table); const commandName = toKebabCase(singularName); const statements: t.Statement[] = []; const executorPath = options?.executorImportPath ?? '../executor'; @@ -1286,8 +1378,29 @@ export function generateTableCommand(table: Table, options?: TableCommandOptions const inputTypesPath = options?.targetName ? `../../../orm/input-types` : `../../orm/input-types`; + // Import table-specific ORM types for generic type parameters on parseFindManyArgs/parseFindFirstArgs + const selectTypeName = `${typeName}Select`; + const whereTypeName = getFilterTypeName(table); + const orderByTypeName = getOrderByTypeName(table); + const conditionEnabled = options?.condition === true; + const conditionTypeName = conditionEnabled ? getConditionTypeName(table) : undefined; + statements.push( + createImportDeclaration(inputTypesPath, [ + createInputTypeName, + patchTypeName, + selectTypeName, + whereTypeName, + ...(conditionTypeName ? [conditionTypeName] : []), + orderByTypeName, + ], true), + ); + + // Import FindManyArgs/FindFirstArgs from select-types for proper generic typing + const selectTypesPath = options?.targetName + ? `../../../orm/select-types` + : `../../orm/select-types`; statements.push( - createImportDeclaration(inputTypesPath, [createInputTypeName, patchTypeName], true), + createImportDeclaration(selectTypesPath, ['FindManyArgs', 'FindFirstArgs'], true), ); // Generate field schema for type coercion @@ -1579,9 +1692,9 @@ export function generateTableCommand(table: Table, options?: TableCommandOptions const tn = options?.targetName; const ormTypes = { createInputTypeName, patchTypeName, innerFieldName }; - statements.push(buildListHandler(table, vectorFieldNames, tn, options?.typeRegistry)); - statements.push(buildFindFirstHandler(table, tn, options?.typeRegistry)); - if (hasSearchFields) statements.push(buildSearchHandler(table, specialGroups, vectorFieldNames, tn, options?.typeRegistry)); + statements.push(buildListHandler(table, vectorFieldNames, tn, options?.typeRegistry, conditionEnabled)); + statements.push(buildFindFirstHandler(table, tn, options?.typeRegistry, conditionEnabled)); + if (hasSearchFields) statements.push(buildSearchHandler(table, specialGroups, vectorFieldNames, tn, options?.typeRegistry, conditionEnabled)); if (hasGet) statements.push(buildGetHandler(table, tn, options?.typeRegistry)); statements.push(buildMutationHandler(table, 'create', vectorFieldNames, tn, options?.typeRegistry, ormTypes)); if (hasUpdate) statements.push(buildMutationHandler(table, 'update', vectorFieldNames, tn, options?.typeRegistry, ormTypes)); diff --git a/graphql/codegen/src/core/codegen/index.ts b/graphql/codegen/src/core/codegen/index.ts index d8960c2b5..d51a0260d 100644 --- a/graphql/codegen/src/core/codegen/index.ts +++ b/graphql/codegen/src/core/codegen/index.ts @@ -191,7 +191,7 @@ export function generate(options: GenerateOptions): GenerateResult { } // Condition types (PostGraphile simple equality filters) - const conditionEnabled = config.codegen?.condition !== false; + const conditionEnabled = config.codegen?.condition === true; // 4. Generate table-based query hooks (queries/*.ts) const queryHooks = generateAllQueryHooks(tables, { diff --git a/graphql/codegen/src/core/codegen/orm/index.ts b/graphql/codegen/src/core/codegen/orm/index.ts index aa0d1b87e..b46f28f60 100644 --- a/graphql/codegen/src/core/codegen/orm/index.ts +++ b/graphql/codegen/src/core/codegen/orm/index.ts @@ -66,7 +66,7 @@ export interface GenerateOrmResult { export function generateOrm(options: GenerateOrmOptions): GenerateOrmResult { const { tables, customOperations, sharedTypesPath } = options; const commentsEnabled = options.config.codegen?.comments !== false; - const conditionEnabled = options.config.codegen?.condition !== false; + const conditionEnabled = options.config.codegen?.condition === true; const files: GeneratedFile[] = []; // Use shared types when a sharedTypesPath is provided (unified output mode) diff --git a/graphql/codegen/src/core/codegen/orm/input-types-generator.ts b/graphql/codegen/src/core/codegen/orm/input-types-generator.ts index 071a8ad15..84d6c2c3e 100644 --- a/graphql/codegen/src/core/codegen/orm/input-types-generator.ts +++ b/graphql/codegen/src/core/codegen/orm/input-types-generator.ts @@ -2093,7 +2093,7 @@ export function generateInputTypesFile( comments: boolean = true, options?: { condition?: boolean }, ): GeneratedInputTypesFile { - const conditionEnabled = options?.condition !== false; + const conditionEnabled = options?.condition === true; const statements: t.Statement[] = []; const tablesList = tables ?? []; const hasTables = tablesList.length > 0; diff --git a/graphql/codegen/src/core/codegen/orm/model-generator.ts b/graphql/codegen/src/core/codegen/orm/model-generator.ts index d50fdcd7c..8d971b58d 100644 --- a/graphql/codegen/src/core/codegen/orm/model-generator.ts +++ b/graphql/codegen/src/core/codegen/orm/model-generator.ts @@ -174,7 +174,7 @@ export function generateModelFile( options?: { condition?: boolean }, allTables?: Table[], ): GeneratedModelFile { - const conditionEnabled = options?.condition !== false; + const conditionEnabled = options?.condition === true; const { typeName, singularName, pluralName } = getTableNames(table); const modelName = `${typeName}Model`; const baseFileName = lcFirst(typeName); diff --git a/graphql/codegen/src/core/codegen/queries.ts b/graphql/codegen/src/core/codegen/queries.ts index 1b43251c2..326ba4519 100644 --- a/graphql/codegen/src/core/codegen/queries.ts +++ b/graphql/codegen/src/core/codegen/queries.ts @@ -87,7 +87,7 @@ export function generateListQueryHook( reactQueryEnabled = true, useCentralizedKeys = true, hasRelationships = false, - condition: conditionEnabled = true, + condition: conditionEnabled = false, } = options; const { typeName, pluralName, singularName } = getTableNames(table); const hookName = getListQueryHookName(table); diff --git a/graphql/codegen/src/core/codegen/templates/cli-utils.ts b/graphql/codegen/src/core/codegen/templates/cli-utils.ts index 3a8cac99f..fd0170d43 100644 --- a/graphql/codegen/src/core/codegen/templates/cli-utils.ts +++ b/graphql/codegen/src/core/codegen/templates/cli-utils.ts @@ -252,11 +252,11 @@ export function parseSelectFlag( * const findManyArgs = parseFindManyArgs(argv, { id: true, name: true }); * const result = await client.user.findMany(findManyArgs).execute(); */ -export function parseFindManyArgs( +export function parseFindManyArgs>( argv: Record, defaultSelect: Record, extraWhere?: Record, -): Record { +): T { const limit = parseIntFlag(argv, 'limit'); const last = parseIntFlag(argv, 'last'); const offset = parseIntFlag(argv, 'offset'); @@ -280,7 +280,7 @@ export function parseFindManyArgs( ...(where !== undefined ? { where } : {}), ...(condition !== undefined ? { condition } : {}), ...(orderBy !== undefined ? { orderBy } : {}), - }; + } as unknown as T; } /** @@ -288,10 +288,10 @@ export function parseFindManyArgs( * Like parseFindManyArgs but only includes select, where, and condition * (no pagination flags — findFirst returns the first matching record). */ -export function parseFindFirstArgs( +export function parseFindFirstArgs>( argv: Record, defaultSelect: Record, -): Record { +): T { const select = parseSelectFlag(argv, defaultSelect); const parsed = unflattenDotNotation(argv); const where = parsed.where; @@ -301,7 +301,7 @@ export function parseFindFirstArgs( select, ...(where !== undefined ? { where } : {}), ...(condition !== undefined ? { condition } : {}), - }; + } as unknown as T; } export function buildSelectFromPaths( diff --git a/graphql/codegen/src/core/generate.ts b/graphql/codegen/src/core/generate.ts index f2f760991..cf4e4be5e 100644 --- a/graphql/codegen/src/core/generate.ts +++ b/graphql/codegen/src/core/generate.ts @@ -714,12 +714,14 @@ export async function generateMulti( firstTargetConfig?.nodeHttpAdapter === true || (firstTargetConfig?.nodeHttpAdapter !== false); + const multiConditionEnabled = firstTargetConfig?.codegen?.condition === true; const { files } = generateMultiTargetCli({ toolName, builtinNames: cliConfig.builtinNames, targets: cliTargets, nodeHttpAdapter: multiNodeHttpAdapter, entryPoint: cliConfig.entryPoint, + condition: multiConditionEnabled, }); const cliFilesToWrite = files.map((file) => ({ diff --git a/sdk/constructive-cli/src/admin/cli/README.md b/sdk/constructive-cli/src/admin/cli/README.md index 681c5ed19..97b7c802d 100644 --- a/sdk/constructive-cli/src/admin/cli/README.md +++ b/sdk/constructive-cli/src/admin/cli/README.md @@ -120,6 +120,7 @@ CRUD operations for OrgGetManagersRecord records. | Subcommand | Description | |------------|-------------| | `list` | List all orgGetManagersRecord records | +| `find-first` | Find first matching orgGetManagersRecord record | | `get` | Get a orgGetManagersRecord by id | | `create` | Create a new orgGetManagersRecord | | `update` | Update an existing orgGetManagersRecord | @@ -141,6 +142,7 @@ CRUD operations for OrgGetSubordinatesRecord records. | Subcommand | Description | |------------|-------------| | `list` | List all orgGetSubordinatesRecord records | +| `find-first` | Find first matching orgGetSubordinatesRecord record | | `get` | Get a orgGetSubordinatesRecord by id | | `create` | Create a new orgGetSubordinatesRecord | | `update` | Update an existing orgGetSubordinatesRecord | @@ -162,6 +164,7 @@ CRUD operations for AppPermission records. | Subcommand | Description | |------------|-------------| | `list` | List all appPermission records | +| `find-first` | Find first matching appPermission record | | `get` | Get a appPermission by id | | `create` | Create a new appPermission | | `update` | Update an existing appPermission | @@ -186,6 +189,7 @@ CRUD operations for OrgPermission records. | Subcommand | Description | |------------|-------------| | `list` | List all orgPermission records | +| `find-first` | Find first matching orgPermission record | | `get` | Get a orgPermission by id | | `create` | Create a new orgPermission | | `update` | Update an existing orgPermission | @@ -210,6 +214,7 @@ CRUD operations for AppLevelRequirement records. | Subcommand | Description | |------------|-------------| | `list` | List all appLevelRequirement records | +| `find-first` | Find first matching appLevelRequirement record | | `get` | Get a appLevelRequirement by id | | `create` | Create a new appLevelRequirement | | `update` | Update an existing appLevelRequirement | @@ -238,6 +243,7 @@ CRUD operations for OrgMember records. | Subcommand | Description | |------------|-------------| | `list` | List all orgMember records | +| `find-first` | Find first matching orgMember record | | `get` | Get a orgMember by id | | `create` | Create a new orgMember | | `update` | Update an existing orgMember | @@ -262,6 +268,7 @@ CRUD operations for AppPermissionDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all appPermissionDefault records | +| `find-first` | Find first matching appPermissionDefault record | | `get` | Get a appPermissionDefault by id | | `create` | Create a new appPermissionDefault | | `update` | Update an existing appPermissionDefault | @@ -283,6 +290,7 @@ CRUD operations for OrgPermissionDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all orgPermissionDefault records | +| `find-first` | Find first matching orgPermissionDefault record | | `get` | Get a orgPermissionDefault by id | | `create` | Create a new orgPermissionDefault | | `update` | Update an existing orgPermissionDefault | @@ -306,6 +314,7 @@ CRUD operations for AppAdminGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all appAdminGrant records | +| `find-first` | Find first matching appAdminGrant record | | `get` | Get a appAdminGrant by id | | `create` | Create a new appAdminGrant | | `update` | Update an existing appAdminGrant | @@ -332,6 +341,7 @@ CRUD operations for AppOwnerGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all appOwnerGrant records | +| `find-first` | Find first matching appOwnerGrant record | | `get` | Get a appOwnerGrant by id | | `create` | Create a new appOwnerGrant | | `update` | Update an existing appOwnerGrant | @@ -358,6 +368,7 @@ CRUD operations for OrgAdminGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgAdminGrant records | +| `find-first` | Find first matching orgAdminGrant record | | `get` | Get a orgAdminGrant by id | | `create` | Create a new orgAdminGrant | | `update` | Update an existing orgAdminGrant | @@ -385,6 +396,7 @@ CRUD operations for OrgOwnerGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgOwnerGrant records | +| `find-first` | Find first matching orgOwnerGrant record | | `get` | Get a orgOwnerGrant by id | | `create` | Create a new orgOwnerGrant | | `update` | Update an existing orgOwnerGrant | @@ -412,6 +424,7 @@ CRUD operations for AppLimitDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all appLimitDefault records | +| `find-first` | Find first matching appLimitDefault record | | `get` | Get a appLimitDefault by id | | `create` | Create a new appLimitDefault | | `update` | Update an existing appLimitDefault | @@ -435,6 +448,7 @@ CRUD operations for OrgLimitDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all orgLimitDefault records | +| `find-first` | Find first matching orgLimitDefault record | | `get` | Get a orgLimitDefault by id | | `create` | Create a new orgLimitDefault | | `update` | Update an existing orgLimitDefault | @@ -458,6 +472,7 @@ CRUD operations for OrgChartEdgeGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgChartEdgeGrant records | +| `find-first` | Find first matching orgChartEdgeGrant record | | `get` | Get a orgChartEdgeGrant by id | | `create` | Create a new orgChartEdgeGrant | | `update` | Update an existing orgChartEdgeGrant | @@ -487,6 +502,7 @@ CRUD operations for MembershipType records. | Subcommand | Description | |------------|-------------| | `list` | List all membershipType records | +| `find-first` | Find first matching membershipType record | | `get` | Get a membershipType by id | | `create` | Create a new membershipType | | `update` | Update an existing membershipType | @@ -510,6 +526,7 @@ CRUD operations for AppLimit records. | Subcommand | Description | |------------|-------------| | `list` | List all appLimit records | +| `find-first` | Find first matching appLimit record | | `get` | Get a appLimit by id | | `create` | Create a new appLimit | | `update` | Update an existing appLimit | @@ -535,6 +552,7 @@ CRUD operations for AppAchievement records. | Subcommand | Description | |------------|-------------| | `list` | List all appAchievement records | +| `find-first` | Find first matching appAchievement record | | `get` | Get a appAchievement by id | | `create` | Create a new appAchievement | | `update` | Update an existing appAchievement | @@ -561,6 +579,7 @@ CRUD operations for AppStep records. | Subcommand | Description | |------------|-------------| | `list` | List all appStep records | +| `find-first` | Find first matching appStep record | | `get` | Get a appStep by id | | `create` | Create a new appStep | | `update` | Update an existing appStep | @@ -587,6 +606,7 @@ CRUD operations for ClaimedInvite records. | Subcommand | Description | |------------|-------------| | `list` | List all claimedInvite records | +| `find-first` | Find first matching claimedInvite record | | `get` | Get a claimedInvite by id | | `create` | Create a new claimedInvite | | `update` | Update an existing claimedInvite | @@ -612,6 +632,7 @@ CRUD operations for AppGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all appGrant records | +| `find-first` | Find first matching appGrant record | | `get` | Get a appGrant by id | | `create` | Create a new appGrant | | `update` | Update an existing appGrant | @@ -639,6 +660,7 @@ CRUD operations for AppMembershipDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all appMembershipDefault records | +| `find-first` | Find first matching appMembershipDefault record | | `get` | Get a appMembershipDefault by id | | `create` | Create a new appMembershipDefault | | `update` | Update an existing appMembershipDefault | @@ -665,6 +687,7 @@ CRUD operations for OrgLimit records. | Subcommand | Description | |------------|-------------| | `list` | List all orgLimit records | +| `find-first` | Find first matching orgLimit record | | `get` | Get a orgLimit by id | | `create` | Create a new orgLimit | | `update` | Update an existing orgLimit | @@ -691,6 +714,7 @@ CRUD operations for OrgClaimedInvite records. | Subcommand | Description | |------------|-------------| | `list` | List all orgClaimedInvite records | +| `find-first` | Find first matching orgClaimedInvite record | | `get` | Get a orgClaimedInvite by id | | `create` | Create a new orgClaimedInvite | | `update` | Update an existing orgClaimedInvite | @@ -718,6 +742,7 @@ CRUD operations for OrgGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgGrant records | +| `find-first` | Find first matching orgGrant record | | `get` | Get a orgGrant by id | | `create` | Create a new orgGrant | | `update` | Update an existing orgGrant | @@ -746,6 +771,7 @@ CRUD operations for OrgChartEdge records. | Subcommand | Description | |------------|-------------| | `list` | List all orgChartEdge records | +| `find-first` | Find first matching orgChartEdge record | | `get` | Get a orgChartEdge by id | | `create` | Create a new orgChartEdge | | `update` | Update an existing orgChartEdge | @@ -774,6 +800,7 @@ CRUD operations for OrgMembershipDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all orgMembershipDefault records | +| `find-first` | Find first matching orgMembershipDefault record | | `get` | Get a orgMembershipDefault by id | | `create` | Create a new orgMembershipDefault | | `update` | Update an existing orgMembershipDefault | @@ -803,6 +830,7 @@ CRUD operations for AppMembership records. | Subcommand | Description | |------------|-------------| | `list` | List all appMembership records | +| `find-first` | Find first matching appMembership record | | `get` | Get a appMembership by id | | `create` | Create a new appMembership | | `update` | Update an existing appMembership | @@ -839,6 +867,7 @@ CRUD operations for OrgMembership records. | Subcommand | Description | |------------|-------------| | `list` | List all orgMembership records | +| `find-first` | Find first matching orgMembership record | | `get` | Get a orgMembership by id | | `create` | Create a new orgMembership | | `update` | Update an existing orgMembership | @@ -875,6 +904,7 @@ CRUD operations for Invite records. | Subcommand | Description | |------------|-------------| | `list` | List all invite records | +| `find-first` | Find first matching invite record | | `get` | Get a invite by id | | `create` | Create a new invite | | `update` | Update an existing invite | @@ -906,6 +936,7 @@ CRUD operations for AppLevel records. | Subcommand | Description | |------------|-------------| | `list` | List all appLevel records | +| `find-first` | Find first matching appLevel record | | `get` | Get a appLevel by id | | `create` | Create a new appLevel | | `update` | Update an existing appLevel | @@ -933,6 +964,7 @@ CRUD operations for OrgInvite records. | Subcommand | Description | |------------|-------------| | `list` | List all orgInvite records | +| `find-first` | Find first matching orgInvite record | | `get` | Get a orgInvite by id | | `create` | Create a new orgInvite | | `update` | Update an existing orgInvite | diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts b/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts index c80cf7a91..103d9d6aa 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-achievement.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppAchievementInput, AppAchievementPatch } from '../../orm/input-types'; +import type { + CreateAppAchievementInput, + AppAchievementPatch, + AppAchievementSelect, + AppAchievementFilter, + AppAchievementOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-achievement \n\nCommands:\n list List all appAchievement records\n get Get a appAchievement by ID\n create Create a new appAchievement\n update Update an existing appAchievement\n delete Delete a appAchievement\n\n --help, -h Show this help message\n'; + '\napp-achievement \n\nCommands:\n list List appAchievement records\n find-first Find first matching appAchievement record\n get Get a appAchievement by ID\n create Create a new appAchievement\n update Update an existing appAchievement\n delete Delete a appAchievement\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppAchievementSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appAchievement - .findMany({ - select: { - id: true, - actorId: true, - name: true, - count: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appAchievement.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppAchievementSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appAchievement.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts index f0c6375a8..502b8b80b 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-admin-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppAdminGrantInput, AppAdminGrantPatch } from '../../orm/input-types'; +import type { + CreateAppAdminGrantInput, + AppAdminGrantPatch, + AppAdminGrantSelect, + AppAdminGrantFilter, + AppAdminGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-admin-grant \n\nCommands:\n list List all appAdminGrant records\n get Get a appAdminGrant by ID\n create Create a new appAdminGrant\n update Update an existing appAdminGrant\n delete Delete a appAdminGrant\n\n --help, -h Show this help message\n'; + '\napp-admin-grant \n\nCommands:\n list List appAdminGrant records\n find-first Find first matching appAdminGrant record\n get Get a appAdminGrant by ID\n create Create a new appAdminGrant\n update Update an existing appAdminGrant\n delete Delete a appAdminGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppAdminGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appAdminGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appAdminGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppAdminGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appAdminGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts index 10e06e142..5d49497b5 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppGrantInput, AppGrantPatch } from '../../orm/input-types'; +import type { + CreateAppGrantInput, + AppGrantPatch, + AppGrantSelect, + AppGrantFilter, + AppGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-grant \n\nCommands:\n list List all appGrant records\n get Get a appGrant by ID\n create Create a new appGrant\n update Update an existing appGrant\n delete Delete a appGrant\n\n --help, -h Show this help message\n'; + '\napp-grant \n\nCommands:\n list List appGrant records\n find-first Find first matching appGrant record\n get Get a appGrant by ID\n create Create a new appGrant\n update Update an existing appGrant\n delete Delete a appGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appGrant - .findMany({ - select: { - id: true, - permissions: true, - isGrant: true, - actorId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts b/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts index 1e6781802..09a1ca603 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-level-requirement.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateAppLevelRequirementInput, AppLevelRequirementPatch, + AppLevelRequirementSelect, + AppLevelRequirementFilter, + AppLevelRequirementOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -22,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-level-requirement \n\nCommands:\n list List all appLevelRequirement records\n get Get a appLevelRequirement by ID\n create Create a new appLevelRequirement\n update Update an existing appLevelRequirement\n delete Delete a appLevelRequirement\n\n --help, -h Show this help message\n'; + '\napp-level-requirement \n\nCommands:\n list List appLevelRequirement records\n find-first Find first matching appLevelRequirement record\n get Get a appLevelRequirement by ID\n create Create a new appLevelRequirement\n update Update an existing appLevelRequirement\n delete Delete a appLevelRequirement\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -54,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -67,23 +73,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + level: true, + description: true, + requiredCount: true, + priority: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + AppLevelRequirementSelect, + AppLevelRequirementFilter, + never, + AppLevelRequirementOrderBy + > & { + select: AppLevelRequirementSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLevelRequirement - .findMany({ - select: { - id: true, - name: true, - level: true, - description: true, - requiredCount: true, - priority: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appLevelRequirement.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -93,6 +106,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + level: true, + description: true, + requiredCount: true, + priority: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLevelRequirementSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLevelRequirement.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-level.ts b/sdk/constructive-cli/src/admin/cli/commands/app-level.ts index 346ad0c7f..5f5cadf30 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-level.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-level.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppLevelInput, AppLevelPatch } from '../../orm/input-types'; +import type { + CreateAppLevelInput, + AppLevelPatch, + AppLevelSelect, + AppLevelFilter, + AppLevelOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-level \n\nCommands:\n list List all appLevel records\n get Get a appLevel by ID\n create Create a new appLevel\n update Update an existing appLevel\n delete Delete a appLevel\n\n --help, -h Show this help message\n'; + '\napp-level \n\nCommands:\n list List appLevel records\n find-first Find first matching appLevel record\n get Get a appLevel by ID\n create Create a new appLevel\n update Update an existing appLevel\n delete Delete a appLevel\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + description: true, + image: true, + ownerId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppLevelSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLevel - .findMany({ - select: { - id: true, - name: true, - description: true, - image: true, - ownerId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appLevel.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + description: true, + image: true, + ownerId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLevelSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLevel.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts b/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts index 462093eec..6894a28e4 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-limit-default.ts @@ -5,16 +5,23 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppLimitDefaultInput, AppLimitDefaultPatch } from '../../orm/input-types'; +import type { + CreateAppLimitDefaultInput, + AppLimitDefaultPatch, + AppLimitDefaultSelect, + AppLimitDefaultFilter, + AppLimitDefaultOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', }; const usage = - '\napp-limit-default \n\nCommands:\n list List all appLimitDefault records\n get Get a appLimitDefault by ID\n create Create a new appLimitDefault\n update Update an existing appLimitDefault\n delete Delete a appLimitDefault\n\n --help, -h Show this help message\n'; + '\napp-limit-default \n\nCommands:\n list List appLimitDefault records\n find-first Find first matching appLimitDefault record\n get Get a appLimitDefault by ID\n create Create a new appLimitDefault\n update Update an existing appLimitDefault\n delete Delete a appLimitDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -31,7 +38,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -46,6 +53,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -59,18 +68,20 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppLimitDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLimitDefault - .findMany({ - select: { - id: true, - name: true, - max: true, - }, - }) - .execute(); + const result = await client.appLimitDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -80,6 +91,29 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLimitDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLimitDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts b/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts index a7dc6b161..715ec43b7 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-limit.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppLimitInput, AppLimitPatch } from '../../orm/input-types'; +import type { + CreateAppLimitInput, + AppLimitPatch, + AppLimitSelect, + AppLimitFilter, + AppLimitOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { max: 'int', }; const usage = - '\napp-limit \n\nCommands:\n list List all appLimit records\n get Get a appLimit by ID\n create Create a new appLimit\n update Update an existing appLimit\n delete Delete a appLimit\n\n --help, -h Show this help message\n'; + '\napp-limit \n\nCommands:\n list List appLimit records\n find-first Find first matching appLimit record\n get Get a appLimit by ID\n create Create a new appLimit\n update Update an existing appLimit\n delete Delete a appLimit\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppLimitSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLimit - .findMany({ - select: { - id: true, - name: true, - actorId: true, - num: true, - max: true, - }, - }) - .execute(); + const result = await client.appLimit.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLimitSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLimit.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts b/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts index d739ca433..ca4257671 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-membership-default.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateAppMembershipDefaultInput, AppMembershipDefaultPatch, + AppMembershipDefaultSelect, + AppMembershipDefaultFilter, + AppMembershipDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -21,7 +25,7 @@ const fieldSchema: FieldSchema = { isVerified: 'boolean', }; const usage = - '\napp-membership-default \n\nCommands:\n list List all appMembershipDefault records\n get Get a appMembershipDefault by ID\n create Create a new appMembershipDefault\n update Update an existing appMembershipDefault\n delete Delete a appMembershipDefault\n\n --help, -h Show this help message\n'; + '\napp-membership-default \n\nCommands:\n list List appMembershipDefault records\n find-first Find first matching appMembershipDefault record\n get Get a appMembershipDefault by ID\n create Create a new appMembershipDefault\n update Update an existing appMembershipDefault\n delete Delete a appMembershipDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -38,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -53,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -66,22 +72,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isVerified: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + AppMembershipDefaultSelect, + AppMembershipDefaultFilter, + never, + AppMembershipDefaultOrderBy + > & { + select: AppMembershipDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appMembershipDefault - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - isVerified: true, - }, - }) - .execute(); + const result = await client.appMembershipDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -91,6 +104,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isVerified: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppMembershipDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appMembershipDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts b/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts index b85cb2d00..8d960a914 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-membership.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppMembershipInput, AppMembershipPatch } from '../../orm/input-types'; +import type { + CreateAppMembershipInput, + AppMembershipPatch, + AppMembershipSelect, + AppMembershipFilter, + AppMembershipOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -27,7 +34,7 @@ const fieldSchema: FieldSchema = { profileId: 'uuid', }; const usage = - '\napp-membership \n\nCommands:\n list List all appMembership records\n get Get a appMembership by ID\n create Create a new appMembership\n update Update an existing appMembership\n delete Delete a appMembership\n\n --help, -h Show this help message\n'; + '\napp-membership \n\nCommands:\n list List appMembership records\n find-first Find first matching appMembership record\n get Get a appMembership by ID\n create Create a new appMembership\n update Update an existing appMembership\n delete Delete a appMembership\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -44,7 +51,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -59,6 +66,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -72,31 +81,33 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isVerified: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + profileId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppMembershipSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appMembership - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - isBanned: true, - isDisabled: true, - isVerified: true, - isActive: true, - isOwner: true, - isAdmin: true, - permissions: true, - granted: true, - actorId: true, - profileId: true, - }, - }) - .execute(); + const result = await client.appMembership.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -106,6 +117,42 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isVerified: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + profileId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppMembershipSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appMembership.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts index 936434685..c459e0a07 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-owner-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppOwnerGrantInput, AppOwnerGrantPatch } from '../../orm/input-types'; +import type { + CreateAppOwnerGrantInput, + AppOwnerGrantPatch, + AppOwnerGrantSelect, + AppOwnerGrantFilter, + AppOwnerGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-owner-grant \n\nCommands:\n list List all appOwnerGrant records\n get Get a appOwnerGrant by ID\n create Create a new appOwnerGrant\n update Update an existing appOwnerGrant\n delete Delete a appOwnerGrant\n\n --help, -h Show this help message\n'; + '\napp-owner-grant \n\nCommands:\n list List appOwnerGrant records\n find-first Find first matching appOwnerGrant record\n get Get a appOwnerGrant by ID\n create Create a new appOwnerGrant\n update Update an existing appOwnerGrant\n delete Delete a appOwnerGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppOwnerGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appOwnerGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appOwnerGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppOwnerGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appOwnerGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts index 75f8427a6..c25b842a3 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permission-default.ts @@ -5,18 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateAppPermissionDefaultInput, AppPermissionDefaultPatch, + AppPermissionDefaultSelect, + AppPermissionDefaultFilter, + AppPermissionDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', }; const usage = - '\napp-permission-default \n\nCommands:\n list List all appPermissionDefault records\n get Get a appPermissionDefault by ID\n create Create a new appPermissionDefault\n update Update an existing appPermissionDefault\n delete Delete a appPermissionDefault\n\n --help, -h Show this help message\n'; + '\napp-permission-default \n\nCommands:\n list List appPermissionDefault records\n find-first Find first matching appPermissionDefault record\n get Get a appPermissionDefault by ID\n create Create a new appPermissionDefault\n update Update an existing appPermissionDefault\n delete Delete a appPermissionDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,17 +67,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + AppPermissionDefaultSelect, + AppPermissionDefaultFilter, + never, + AppPermissionDefaultOrderBy + > & { + select: AppPermissionDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appPermissionDefault - .findMany({ - select: { - id: true, - permissions: true, - }, - }) - .execute(); + const result = await client.appPermissionDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -81,6 +94,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppPermissionDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appPermissionDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts b/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts index 61f8849ca..7a354db18 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-permission.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppPermissionInput, AppPermissionPatch } from '../../orm/input-types'; +import type { + CreateAppPermissionInput, + AppPermissionPatch, + AppPermissionSelect, + AppPermissionFilter, + AppPermissionOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { description: 'string', }; const usage = - '\napp-permission \n\nCommands:\n list List all appPermission records\n get Get a appPermission by ID\n create Create a new appPermission\n update Update an existing appPermission\n delete Delete a appPermission\n\n --help, -h Show this help message\n'; + '\napp-permission \n\nCommands:\n list List appPermission records\n find-first Find first matching appPermission record\n get Get a appPermission by ID\n create Create a new appPermission\n update Update an existing appPermission\n delete Delete a appPermission\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppPermissionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appPermission - .findMany({ - select: { - id: true, - name: true, - bitnum: true, - bitstr: true, - description: true, - }, - }) - .execute(); + const result = await client.appPermission.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppPermissionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appPermission.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/app-step.ts b/sdk/constructive-cli/src/admin/cli/commands/app-step.ts index 3b5a4d8b6..daf16cc8f 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/app-step.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/app-step.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppStepInput, AppStepPatch } from '../../orm/input-types'; +import type { + CreateAppStepInput, + AppStepPatch, + AppStepSelect, + AppStepFilter, + AppStepOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-step \n\nCommands:\n list List all appStep records\n get Get a appStep by ID\n create Create a new appStep\n update Update an existing appStep\n delete Delete a appStep\n\n --help, -h Show this help message\n'; + '\napp-step \n\nCommands:\n list List appStep records\n find-first Find first matching appStep record\n get Get a appStep by ID\n create Create a new appStep\n update Update an existing appStep\n delete Delete a appStep\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppStepSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appStep - .findMany({ - select: { - id: true, - actorId: true, - name: true, - count: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appStep.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppStepSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appStep.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts b/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts index 79266c155..f0f106228 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/claimed-invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateClaimedInviteInput, ClaimedInvitePatch } from '../../orm/input-types'; +import type { + CreateClaimedInviteInput, + ClaimedInvitePatch, + ClaimedInviteSelect, + ClaimedInviteFilter, + ClaimedInviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nclaimed-invite \n\nCommands:\n list List all claimedInvite records\n get Get a claimedInvite by ID\n create Create a new claimedInvite\n update Update an existing claimedInvite\n delete Delete a claimedInvite\n\n --help, -h Show this help message\n'; + '\nclaimed-invite \n\nCommands:\n list List claimedInvite records\n find-first Find first matching claimedInvite record\n get Get a claimedInvite by ID\n create Create a new claimedInvite\n update Update an existing claimedInvite\n delete Delete a claimedInvite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ClaimedInviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.claimedInvite - .findMany({ - select: { - id: true, - data: true, - senderId: true, - receiverId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.claimedInvite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ClaimedInviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.claimedInvite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/invite.ts b/sdk/constructive-cli/src/admin/cli/commands/invite.ts index 7d243bdd3..c7c10081f 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateInviteInput, InvitePatch } from '../../orm/input-types'; +import type { + CreateInviteInput, + InvitePatch, + InviteSelect, + InviteFilter, + InviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', @@ -23,7 +30,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ninvite \n\nCommands:\n list List all invite records\n get Get a invite by ID\n create Create a new invite\n update Update an existing invite\n delete Delete a invite\n\n --help, -h Show this help message\n'; + '\ninvite \n\nCommands:\n list List invite records\n find-first Find first matching invite record\n get Get a invite by ID\n create Create a new invite\n update Update an existing invite\n delete Delete a invite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,7 +47,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -55,6 +62,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -68,27 +77,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: InviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.invite - .findMany({ - select: { - id: true, - email: true, - senderId: true, - inviteToken: true, - inviteValid: true, - inviteLimit: true, - inviteCount: true, - multiple: true, - data: true, - expiresAt: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.invite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -98,6 +109,38 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: InviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.invite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts b/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts index 118aade21..056b84cd3 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/membership-type.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateMembershipTypeInput, MembershipTypePatch } from '../../orm/input-types'; +import type { + CreateMembershipTypeInput, + MembershipTypePatch, + MembershipTypeSelect, + MembershipTypeFilter, + MembershipTypeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'int', name: 'string', @@ -15,7 +22,7 @@ const fieldSchema: FieldSchema = { prefix: 'string', }; const usage = - '\nmembership-type \n\nCommands:\n list List all membershipType records\n get Get a membershipType by ID\n create Create a new membershipType\n update Update an existing membershipType\n delete Delete a membershipType\n\n --help, -h Show this help message\n'; + '\nmembership-type \n\nCommands:\n list List membershipType records\n find-first Find first matching membershipType record\n get Get a membershipType by ID\n create Create a new membershipType\n update Update an existing membershipType\n delete Delete a membershipType\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -32,7 +39,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -47,6 +54,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -60,19 +69,21 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + description: true, + prefix: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: MembershipTypeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.membershipType - .findMany({ - select: { - id: true, - name: true, - description: true, - prefix: true, - }, - }) - .execute(); + const result = await client.membershipType.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -82,6 +93,30 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + description: true, + prefix: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: MembershipTypeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.membershipType.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts index 4f17a70cb..e9d41e5ed 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-admin-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgAdminGrantInput, OrgAdminGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgAdminGrantInput, + OrgAdminGrantPatch, + OrgAdminGrantSelect, + OrgAdminGrantFilter, + OrgAdminGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\norg-admin-grant \n\nCommands:\n list List all orgAdminGrant records\n get Get a orgAdminGrant by ID\n create Create a new orgAdminGrant\n update Update an existing orgAdminGrant\n delete Delete a orgAdminGrant\n\n --help, -h Show this help message\n'; + '\norg-admin-grant \n\nCommands:\n list List orgAdminGrant records\n find-first Find first matching orgAdminGrant record\n get Get a orgAdminGrant by ID\n create Create a new orgAdminGrant\n update Update an existing orgAdminGrant\n delete Delete a orgAdminGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgAdminGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgAdminGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - entityId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.orgAdminGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgAdminGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgAdminGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts index fc388684a..537be47af 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgChartEdgeGrantInput, OrgChartEdgeGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgChartEdgeGrantInput, + OrgChartEdgeGrantPatch, + OrgChartEdgeGrantSelect, + OrgChartEdgeGrantFilter, + OrgChartEdgeGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', entityId: 'uuid', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\norg-chart-edge-grant \n\nCommands:\n list List all orgChartEdgeGrant records\n get Get a orgChartEdgeGrant by ID\n create Create a new orgChartEdgeGrant\n update Update an existing orgChartEdgeGrant\n delete Delete a orgChartEdgeGrant\n\n --help, -h Show this help message\n'; + '\norg-chart-edge-grant \n\nCommands:\n list List orgChartEdgeGrant records\n find-first Find first matching orgChartEdgeGrant record\n get Get a orgChartEdgeGrant by ID\n create Create a new orgChartEdgeGrant\n update Update an existing orgChartEdgeGrant\n delete Delete a orgChartEdgeGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + entityId: true, + childId: true, + parentId: true, + grantorId: true, + isGrant: true, + positionTitle: true, + positionLevel: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgChartEdgeGrantSelect, + OrgChartEdgeGrantFilter, + never, + OrgChartEdgeGrantOrderBy + > & { + select: OrgChartEdgeGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgChartEdgeGrant - .findMany({ - select: { - id: true, - entityId: true, - childId: true, - parentId: true, - grantorId: true, - isGrant: true, - positionTitle: true, - positionLevel: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.orgChartEdgeGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +108,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + entityId: true, + childId: true, + parentId: true, + grantorId: true, + isGrant: true, + positionTitle: true, + positionLevel: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgChartEdgeGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgChartEdgeGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts index 72fa13a5e..410d4f84f 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-chart-edge.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgChartEdgeInput, OrgChartEdgePatch } from '../../orm/input-types'; +import type { + CreateOrgChartEdgeInput, + OrgChartEdgePatch, + OrgChartEdgeSelect, + OrgChartEdgeFilter, + OrgChartEdgeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { positionLevel: 'int', }; const usage = - '\norg-chart-edge \n\nCommands:\n list List all orgChartEdge records\n get Get a orgChartEdge by ID\n create Create a new orgChartEdge\n update Update an existing orgChartEdge\n delete Delete a orgChartEdge\n\n --help, -h Show this help message\n'; + '\norg-chart-edge \n\nCommands:\n list List orgChartEdge records\n find-first Find first matching orgChartEdge record\n get Get a orgChartEdge by ID\n create Create a new orgChartEdge\n update Update an existing orgChartEdge\n delete Delete a orgChartEdge\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + entityId: true, + childId: true, + parentId: true, + positionTitle: true, + positionLevel: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgChartEdgeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgChartEdge - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - entityId: true, - childId: true, - parentId: true, - positionTitle: true, - positionLevel: true, - }, - }) - .execute(); + const result = await client.orgChartEdge.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + entityId: true, + childId: true, + parentId: true, + positionTitle: true, + positionLevel: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgChartEdgeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgChartEdge.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts b/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts index 13e7b5133..ddf858e3c 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-claimed-invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgClaimedInviteInput, OrgClaimedInvitePatch } from '../../orm/input-types'; +import type { + CreateOrgClaimedInviteInput, + OrgClaimedInvitePatch, + OrgClaimedInviteSelect, + OrgClaimedInviteFilter, + OrgClaimedInviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-claimed-invite \n\nCommands:\n list List all orgClaimedInvite records\n get Get a orgClaimedInvite by ID\n create Create a new orgClaimedInvite\n update Update an existing orgClaimedInvite\n delete Delete a orgClaimedInvite\n\n --help, -h Show this help message\n'; + '\norg-claimed-invite \n\nCommands:\n list List orgClaimedInvite records\n find-first Find first matching orgClaimedInvite record\n get Get a orgClaimedInvite by ID\n create Create a new orgClaimedInvite\n update Update an existing orgClaimedInvite\n delete Delete a orgClaimedInvite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgClaimedInviteSelect, + OrgClaimedInviteFilter, + never, + OrgClaimedInviteOrderBy + > & { + select: OrgClaimedInviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgClaimedInvite - .findMany({ - select: { - id: true, - data: true, - senderId: true, - receiverId: true, - createdAt: true, - updatedAt: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgClaimedInvite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +104,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgClaimedInviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgClaimedInvite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts b/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts index 665a15560..8a3595b5e 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-get-managers-record.ts @@ -5,18 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgGetManagersRecordInput, OrgGetManagersRecordPatch, + OrgGetManagersRecordSelect, + OrgGetManagersRecordFilter, + OrgGetManagersRecordsOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-managers-record \n\nCommands:\n list List all orgGetManagersRecord records\n create Create a new orgGetManagersRecord\n\n --help, -h Show this help message\n'; + '\norg-get-managers-record \n\nCommands:\n list List orgGetManagersRecord records\n find-first Find first matching orgGetManagersRecord record\n create Create a new orgGetManagersRecord\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -55,17 +61,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgGetManagersRecordSelect, + OrgGetManagersRecordFilter, + never, + OrgGetManagersRecordsOrderBy + > & { + select: OrgGetManagersRecordSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgGetManagersRecord - .findMany({ - select: { - userId: true, - depth: true, - }, - }) - .execute(); + const result = await client.orgGetManagersRecord.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -75,6 +88,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgGetManagersRecordSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgGetManagersRecord.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts b/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts index 3bcb09aca..64eff3fef 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-get-subordinates-record.ts @@ -5,18 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgGetSubordinatesRecordInput, OrgGetSubordinatesRecordPatch, + OrgGetSubordinatesRecordSelect, + OrgGetSubordinatesRecordFilter, + OrgGetSubordinatesRecordsOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-subordinates-record \n\nCommands:\n list List all orgGetSubordinatesRecord records\n create Create a new orgGetSubordinatesRecord\n\n --help, -h Show this help message\n'; + '\norg-get-subordinates-record \n\nCommands:\n list List orgGetSubordinatesRecord records\n find-first Find first matching orgGetSubordinatesRecord record\n create Create a new orgGetSubordinatesRecord\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -55,17 +61,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgGetSubordinatesRecordSelect, + OrgGetSubordinatesRecordFilter, + never, + OrgGetSubordinatesRecordsOrderBy + > & { + select: OrgGetSubordinatesRecordSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .findMany({ - select: { - userId: true, - depth: true, - }, - }) - .execute(); + const result = await client.orgGetSubordinatesRecord.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -75,6 +88,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgGetSubordinatesRecordSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgGetSubordinatesRecord.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts index 9bc5f5be8..a538aa1c2 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgGrantInput, OrgGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgGrantInput, + OrgGrantPatch, + OrgGrantSelect, + OrgGrantFilter, + OrgGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\norg-grant \n\nCommands:\n list List all orgGrant records\n get Get a orgGrant by ID\n create Create a new orgGrant\n update Update an existing orgGrant\n delete Delete a orgGrant\n\n --help, -h Show this help message\n'; + '\norg-grant \n\nCommands:\n list List orgGrant records\n find-first Find first matching orgGrant record\n get Get a orgGrant by ID\n create Create a new orgGrant\n update Update an existing orgGrant\n delete Delete a orgGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgGrant - .findMany({ - select: { - id: true, - permissions: true, - isGrant: true, - actorId: true, - entityId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.orgGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts b/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts index 9b512b138..85aeda86c 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgInviteInput, OrgInvitePatch } from '../../orm/input-types'; +import type { + CreateOrgInviteInput, + OrgInvitePatch, + OrgInviteSelect, + OrgInviteFilter, + OrgInviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-invite \n\nCommands:\n list List all orgInvite records\n get Get a orgInvite by ID\n create Create a new orgInvite\n update Update an existing orgInvite\n delete Delete a orgInvite\n\n --help, -h Show this help message\n'; + '\norg-invite \n\nCommands:\n list List orgInvite records\n find-first Find first matching orgInvite record\n get Get a orgInvite by ID\n create Create a new orgInvite\n update Update an existing orgInvite\n delete Delete a orgInvite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + receiverId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgInviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgInvite - .findMany({ - select: { - id: true, - email: true, - senderId: true, - receiverId: true, - inviteToken: true, - inviteValid: true, - inviteLimit: true, - inviteCount: true, - multiple: true, - data: true, - expiresAt: true, - createdAt: true, - updatedAt: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgInvite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +113,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + receiverId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgInviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgInvite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts b/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts index 87b6dd4bc..88d800132 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-limit-default.ts @@ -5,16 +5,23 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgLimitDefaultInput, OrgLimitDefaultPatch } from '../../orm/input-types'; +import type { + CreateOrgLimitDefaultInput, + OrgLimitDefaultPatch, + OrgLimitDefaultSelect, + OrgLimitDefaultFilter, + OrgLimitDefaultOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', }; const usage = - '\norg-limit-default \n\nCommands:\n list List all orgLimitDefault records\n get Get a orgLimitDefault by ID\n create Create a new orgLimitDefault\n update Update an existing orgLimitDefault\n delete Delete a orgLimitDefault\n\n --help, -h Show this help message\n'; + '\norg-limit-default \n\nCommands:\n list List orgLimitDefault records\n find-first Find first matching orgLimitDefault record\n get Get a orgLimitDefault by ID\n create Create a new orgLimitDefault\n update Update an existing orgLimitDefault\n delete Delete a orgLimitDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -31,7 +38,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -46,6 +53,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -59,18 +68,20 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgLimitDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgLimitDefault - .findMany({ - select: { - id: true, - name: true, - max: true, - }, - }) - .execute(); + const result = await client.orgLimitDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -80,6 +91,29 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgLimitDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgLimitDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts b/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts index f790325cc..3428c1ea9 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-limit.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgLimitInput, OrgLimitPatch } from '../../orm/input-types'; +import type { + CreateOrgLimitInput, + OrgLimitPatch, + OrgLimitSelect, + OrgLimitFilter, + OrgLimitOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-limit \n\nCommands:\n list List all orgLimit records\n get Get a orgLimit by ID\n create Create a new orgLimit\n update Update an existing orgLimit\n delete Delete a orgLimit\n\n --help, -h Show this help message\n'; + '\norg-limit \n\nCommands:\n list List orgLimit records\n find-first Find first matching orgLimit record\n get Get a orgLimit by ID\n create Create a new orgLimit\n update Update an existing orgLimit\n delete Delete a orgLimit\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgLimitSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgLimit - .findMany({ - select: { - id: true, - name: true, - actorId: true, - num: true, - max: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgLimit.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgLimitSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgLimit.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-member.ts b/sdk/constructive-cli/src/admin/cli/commands/org-member.ts index 93f48ca68..c3c831dcb 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-member.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-member.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgMemberInput, OrgMemberPatch } from '../../orm/input-types'; +import type { + CreateOrgMemberInput, + OrgMemberPatch, + OrgMemberSelect, + OrgMemberFilter, + OrgMemberOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isAdmin: 'boolean', @@ -15,7 +22,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-member \n\nCommands:\n list List all orgMember records\n get Get a orgMember by ID\n create Create a new orgMember\n update Update an existing orgMember\n delete Delete a orgMember\n\n --help, -h Show this help message\n'; + '\norg-member \n\nCommands:\n list List orgMember records\n find-first Find first matching orgMember record\n get Get a orgMember by ID\n create Create a new orgMember\n update Update an existing orgMember\n delete Delete a orgMember\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -32,7 +39,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -47,6 +54,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -60,19 +69,21 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isAdmin: true, + actorId: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgMemberSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgMember - .findMany({ - select: { - id: true, - isAdmin: true, - actorId: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgMember.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -82,6 +93,30 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isAdmin: true, + actorId: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgMemberSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgMember.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts b/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts index ff2ef05a9..a0d1bc6dc 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-membership-default.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgMembershipDefaultInput, OrgMembershipDefaultPatch, + OrgMembershipDefaultSelect, + OrgMembershipDefaultFilter, + OrgMembershipDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -23,7 +27,7 @@ const fieldSchema: FieldSchema = { createGroupsCascadeMembers: 'boolean', }; const usage = - '\norg-membership-default \n\nCommands:\n list List all orgMembershipDefault records\n get Get a orgMembershipDefault by ID\n create Create a new orgMembershipDefault\n update Update an existing orgMembershipDefault\n delete Delete a orgMembershipDefault\n\n --help, -h Show this help message\n'; + '\norg-membership-default \n\nCommands:\n list List orgMembershipDefault records\n find-first Find first matching orgMembershipDefault record\n get Get a orgMembershipDefault by ID\n create Create a new orgMembershipDefault\n update Update an existing orgMembershipDefault\n delete Delete a orgMembershipDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -55,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -68,24 +74,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + entityId: true, + deleteMemberCascadeGroups: true, + createGroupsCascadeMembers: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgMembershipDefaultSelect, + OrgMembershipDefaultFilter, + never, + OrgMembershipDefaultOrderBy + > & { + select: OrgMembershipDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgMembershipDefault - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - entityId: true, - deleteMemberCascadeGroups: true, - createGroupsCascadeMembers: true, - }, - }) - .execute(); + const result = await client.orgMembershipDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -95,6 +108,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + entityId: true, + deleteMemberCascadeGroups: true, + createGroupsCascadeMembers: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgMembershipDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgMembershipDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts b/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts index 0c3e13f3b..0e9b312b2 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-membership.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgMembershipInput, OrgMembershipPatch } from '../../orm/input-types'; +import type { + CreateOrgMembershipInput, + OrgMembershipPatch, + OrgMembershipSelect, + OrgMembershipFilter, + OrgMembershipOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -27,7 +34,7 @@ const fieldSchema: FieldSchema = { profileId: 'uuid', }; const usage = - '\norg-membership \n\nCommands:\n list List all orgMembership records\n get Get a orgMembership by ID\n create Create a new orgMembership\n update Update an existing orgMembership\n delete Delete a orgMembership\n\n --help, -h Show this help message\n'; + '\norg-membership \n\nCommands:\n list List orgMembership records\n find-first Find first matching orgMembership record\n get Get a orgMembership by ID\n create Create a new orgMembership\n update Update an existing orgMembership\n delete Delete a orgMembership\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -44,7 +51,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -59,6 +66,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -72,31 +81,33 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + entityId: true, + profileId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgMembershipSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgMembership - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - isBanned: true, - isDisabled: true, - isActive: true, - isOwner: true, - isAdmin: true, - permissions: true, - granted: true, - actorId: true, - entityId: true, - profileId: true, - }, - }) - .execute(); + const result = await client.orgMembership.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -106,6 +117,42 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + entityId: true, + profileId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgMembershipSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgMembership.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts b/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts index 2d157665e..15ed00359 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-owner-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgOwnerGrantInput, OrgOwnerGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgOwnerGrantInput, + OrgOwnerGrantPatch, + OrgOwnerGrantSelect, + OrgOwnerGrantFilter, + OrgOwnerGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\norg-owner-grant \n\nCommands:\n list List all orgOwnerGrant records\n get Get a orgOwnerGrant by ID\n create Create a new orgOwnerGrant\n update Update an existing orgOwnerGrant\n delete Delete a orgOwnerGrant\n\n --help, -h Show this help message\n'; + '\norg-owner-grant \n\nCommands:\n list List orgOwnerGrant records\n find-first Find first matching orgOwnerGrant record\n get Get a orgOwnerGrant by ID\n create Create a new orgOwnerGrant\n update Update an existing orgOwnerGrant\n delete Delete a orgOwnerGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgOwnerGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgOwnerGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - entityId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.orgOwnerGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgOwnerGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgOwnerGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts index 02856e484..9eeee8a17 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permission-default.ts @@ -5,19 +5,23 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgPermissionDefaultInput, OrgPermissionDefaultPatch, + OrgPermissionDefaultSelect, + OrgPermissionDefaultFilter, + OrgPermissionDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', entityId: 'uuid', }; const usage = - '\norg-permission-default \n\nCommands:\n list List all orgPermissionDefault records\n get Get a orgPermissionDefault by ID\n create Create a new orgPermissionDefault\n update Update an existing orgPermissionDefault\n delete Delete a orgPermissionDefault\n\n --help, -h Show this help message\n'; + '\norg-permission-default \n\nCommands:\n list List orgPermissionDefault records\n find-first Find first matching orgPermissionDefault record\n get Get a orgPermissionDefault by ID\n create Create a new orgPermissionDefault\n update Update an existing orgPermissionDefault\n delete Delete a orgPermissionDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +38,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +53,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,18 +68,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgPermissionDefaultSelect, + OrgPermissionDefaultFilter, + never, + OrgPermissionDefaultOrderBy + > & { + select: OrgPermissionDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgPermissionDefault - .findMany({ - select: { - id: true, - permissions: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgPermissionDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -83,6 +96,29 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgPermissionDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgPermissionDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts b/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts index 91a56140e..f1a175a20 100644 --- a/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts +++ b/sdk/constructive-cli/src/admin/cli/commands/org-permission.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgPermissionInput, OrgPermissionPatch } from '../../orm/input-types'; +import type { + CreateOrgPermissionInput, + OrgPermissionPatch, + OrgPermissionSelect, + OrgPermissionFilter, + OrgPermissionOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { description: 'string', }; const usage = - '\norg-permission \n\nCommands:\n list List all orgPermission records\n get Get a orgPermission by ID\n create Create a new orgPermission\n update Update an existing orgPermission\n delete Delete a orgPermission\n\n --help, -h Show this help message\n'; + '\norg-permission \n\nCommands:\n list List orgPermission records\n find-first Find first matching orgPermission record\n get Get a orgPermission by ID\n create Create a new orgPermission\n update Update an existing orgPermission\n delete Delete a orgPermission\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgPermissionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgPermission - .findMany({ - select: { - id: true, - name: true, - bitnum: true, - bitstr: true, - description: true, - }, - }) - .execute(); + const result = await client.orgPermission.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgPermissionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgPermission.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/admin/cli/utils.ts b/sdk/constructive-cli/src/admin/cli/utils.ts index 612b4a801..7d8d25ac8 100644 --- a/sdk/constructive-cli/src/admin/cli/utils.ts +++ b/sdk/constructive-cli/src/admin/cli/utils.ts @@ -168,6 +168,114 @@ export function unflattenDotNotation(answers: Record): Record, name: string): number | undefined { + const val = argv[name]; + if (typeof val === 'number') return val; + if (typeof val === 'string') { + const n = parseInt(val, 10); + return isNaN(n) ? undefined : n; + } + return undefined; +} + +/** + * Parse a CLI flag as a string. + * Returns undefined when the flag is missing or not a string. + */ +export function parseStringFlag(argv: Record, name: string): string | undefined { + const val = argv[name]; + return typeof val === 'string' ? val : undefined; +} + +/** + * Parse --orderBy flag as a comma-separated list of enum values. + * e.g. --orderBy NAME_ASC,CREATED_AT_DESC → ['NAME_ASC', 'CREATED_AT_DESC'] + */ +export function parseOrderByFlag(argv: Record): string[] | undefined { + const val = argv.orderBy; + return typeof val === 'string' ? val.split(',') : undefined; +} + +/** + * Parse --select flag into a select object, falling back to a default. + * e.g. --select id,name → { id: true, name: true } + */ +export function parseSelectFlag( + argv: Record, + defaultSelect: Record +): Record { + const raw = argv.select; + return typeof raw === 'string' ? buildSelectFromPaths(raw) : defaultSelect; +} + +/** + * Build the full findManyArgs object from CLI argv. + * Parses all pagination, filtering, ordering, and field selection flags + * in one call. Accepts an optional `extraWhere` to merge with dot-notation + * --where flags (used by the search handler to inject search clauses). + * + * @example + * const findManyArgs = parseFindManyArgs(argv, { id: true, name: true }); + * const result = await client.user.findMany(findManyArgs).execute(); + */ +export function parseFindManyArgs>( + argv: Record, + defaultSelect: Record, + extraWhere?: Record +): T { + const limit = parseIntFlag(argv, 'limit'); + const last = parseIntFlag(argv, 'last'); + const offset = parseIntFlag(argv, 'offset'); + const after = parseStringFlag(argv, 'after'); + const before = parseStringFlag(argv, 'before'); + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = + (parsed.where ?? extraWhere) + ? { ...(extraWhere ?? {}), ...((parsed.where as Record) ?? {}) } + : undefined; + const condition = parsed.condition; + const orderBy = parseOrderByFlag(argv); + + return { + select, + ...(limit !== undefined ? { first: limit } : {}), + ...(after !== undefined ? { after } : {}), + ...(last !== undefined ? { last } : {}), + ...(before !== undefined ? { before } : {}), + ...(offset !== undefined ? { offset } : {}), + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + ...(orderBy !== undefined ? { orderBy } : {}), + } as unknown as T; +} + +/** + * Build findFirst args from CLI argv. + * Like parseFindManyArgs but only includes select, where, and condition + * (no pagination flags — findFirst returns the first matching record). + */ +export function parseFindFirstArgs>( + argv: Record, + defaultSelect: Record +): T { + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = parsed.where; + const condition = parsed.condition; + + return { + select, + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + } as unknown as T; +} + export function buildSelectFromPaths(paths: string): Record { const result: Record = {}; const trimmedPaths = paths diff --git a/sdk/constructive-cli/src/auth/cli/README.md b/sdk/constructive-cli/src/auth/cli/README.md index c53262f43..af7930255 100644 --- a/sdk/constructive-cli/src/auth/cli/README.md +++ b/sdk/constructive-cli/src/auth/cli/README.md @@ -102,6 +102,7 @@ CRUD operations for Email records. | Subcommand | Description | |------------|-------------| | `list` | List all email records | +| `find-first` | Find first matching email record | | `get` | Get a email by id | | `create` | Create a new email | | `update` | Update an existing email | @@ -129,6 +130,7 @@ CRUD operations for PhoneNumber records. | Subcommand | Description | |------------|-------------| | `list` | List all phoneNumber records | +| `find-first` | Find first matching phoneNumber record | | `get` | Get a phoneNumber by id | | `create` | Create a new phoneNumber | | `update` | Update an existing phoneNumber | @@ -157,6 +159,7 @@ CRUD operations for CryptoAddress records. | Subcommand | Description | |------------|-------------| | `list` | List all cryptoAddress records | +| `find-first` | Find first matching cryptoAddress record | | `get` | Get a cryptoAddress by id | | `create` | Create a new cryptoAddress | | `update` | Update an existing cryptoAddress | @@ -184,6 +187,7 @@ CRUD operations for ConnectedAccount records. | Subcommand | Description | |------------|-------------| | `list` | List all connectedAccount records | +| `find-first` | Find first matching connectedAccount record | | `get` | Get a connectedAccount by id | | `create` | Create a new connectedAccount | | `update` | Update an existing connectedAccount | @@ -212,6 +216,7 @@ CRUD operations for AuditLog records. | Subcommand | Description | |------------|-------------| | `list` | List all auditLog records | +| `find-first` | Find first matching auditLog record | | `get` | Get a auditLog by id | | `create` | Create a new auditLog | | `update` | Update an existing auditLog | @@ -240,6 +245,7 @@ CRUD operations for RoleType records. | Subcommand | Description | |------------|-------------| | `list` | List all roleType records | +| `find-first` | Find first matching roleType record | | `get` | Get a roleType by id | | `create` | Create a new roleType | | `update` | Update an existing roleType | @@ -261,6 +267,8 @@ CRUD operations for User records. | Subcommand | Description | |------------|-------------| | `list` | List all user records | +| `find-first` | Find first matching user record | +| `search ` | Search user records | | `get` | Get a user by id | | `create` | Create a new user | | `update` | Update an existing user | @@ -283,9 +291,32 @@ CRUD operations for User records. | `searchScore` | Float | **Optional create fields (backend defaults):** `username`, `displayName`, `profilePicture`, `type` -> **Unified Search API fields:** `displayNameTrgmSimilarity`, `searchScore` +> **Unified Search API fields:** `searchTsv`, `displayNameTrgmSimilarity`, `searchScore` > Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. +**Search Examples:** + +*Full-text search via tsvector (`searchTsv`):* +```bash +csdk user list --where.searchTsv "search query" --select title,tsvRank +``` + +*Fuzzy search via trigram similarity (`trgmDisplayName`):* +```bash +csdk user list --where.trgmDisplayName.value "approximate query" --where.trgmDisplayName.threshold 0.3 --select title,displayNameTrgmSimilarity +``` + +*Composite search (fullTextSearch dispatches to all text adapters):* +```bash +csdk user list --where.fullTextSearch "search query" --select title,tsvRank,displayNameTrgmSimilarity,searchScore +``` + +*Search with pagination and field projection:* +```bash +csdk user list --where.fullTextSearch "query" --limit 10 --select id,title,searchScore +csdk user search "query" --limit 10 --select id,title,searchScore +``` + ## Custom Operations diff --git a/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts b/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts index d4e2566ef..79a5c1b1c 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/audit-log.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAuditLogInput, AuditLogPatch } from '../../orm/input-types'; +import type { + CreateAuditLogInput, + AuditLogPatch, + AuditLogSelect, + AuditLogFilter, + AuditLogOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', event: 'string', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\naudit-log \n\nCommands:\n list List all auditLog records\n get Get a auditLog by ID\n create Create a new auditLog\n update Update an existing auditLog\n delete Delete a auditLog\n\n --help, -h Show this help message\n'; + '\naudit-log \n\nCommands:\n list List auditLog records\n find-first Find first matching auditLog record\n get Get a auditLog by ID\n create Create a new auditLog\n update Update an existing auditLog\n delete Delete a auditLog\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + event: true, + actorId: true, + origin: true, + userAgent: true, + ipAddress: true, + success: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AuditLogSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.auditLog - .findMany({ - select: { - id: true, - event: true, - actorId: true, - origin: true, - userAgent: true, - ipAddress: true, - success: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.auditLog.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + event: true, + actorId: true, + origin: true, + userAgent: true, + ipAddress: true, + success: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AuditLogSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.auditLog.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts b/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts index 373ce17f3..5b0ea5d96 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/connected-account.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateConnectedAccountInput, ConnectedAccountPatch } from '../../orm/input-types'; +import type { + CreateConnectedAccountInput, + ConnectedAccountPatch, + ConnectedAccountSelect, + ConnectedAccountFilter, + ConnectedAccountOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nconnected-account \n\nCommands:\n list List all connectedAccount records\n get Get a connectedAccount by ID\n create Create a new connectedAccount\n update Update an existing connectedAccount\n delete Delete a connectedAccount\n\n --help, -h Show this help message\n'; + '\nconnected-account \n\nCommands:\n list List connectedAccount records\n find-first Find first matching connectedAccount record\n get Get a connectedAccount by ID\n create Create a new connectedAccount\n update Update an existing connectedAccount\n delete Delete a connectedAccount\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + service: true, + identifier: true, + details: true, + isVerified: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + ConnectedAccountSelect, + ConnectedAccountFilter, + never, + ConnectedAccountOrderBy + > & { + select: ConnectedAccountSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.connectedAccount - .findMany({ - select: { - id: true, - ownerId: true, - service: true, - identifier: true, - details: true, - isVerified: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.connectedAccount.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +106,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + service: true, + identifier: true, + details: true, + isVerified: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ConnectedAccountSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.connectedAccount.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts b/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts index a4d171639..8b3902d0e 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/crypto-address.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateCryptoAddressInput, CryptoAddressPatch } from '../../orm/input-types'; +import type { + CreateCryptoAddressInput, + CryptoAddressPatch, + CryptoAddressSelect, + CryptoAddressFilter, + CryptoAddressOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ncrypto-address \n\nCommands:\n list List all cryptoAddress records\n get Get a cryptoAddress by ID\n create Create a new cryptoAddress\n update Update an existing cryptoAddress\n delete Delete a cryptoAddress\n\n --help, -h Show this help message\n'; + '\ncrypto-address \n\nCommands:\n list List cryptoAddress records\n find-first Find first matching cryptoAddress record\n get Get a cryptoAddress by ID\n create Create a new cryptoAddress\n update Update an existing cryptoAddress\n delete Delete a cryptoAddress\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + address: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: CryptoAddressSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.cryptoAddress - .findMany({ - select: { - id: true, - ownerId: true, - address: true, - isVerified: true, - isPrimary: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.cryptoAddress.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + address: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: CryptoAddressSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.cryptoAddress.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/auth/cli/commands/email.ts b/sdk/constructive-cli/src/auth/cli/commands/email.ts index 2eb218c73..b21c9e87a 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/email.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/email.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateEmailInput, EmailPatch } from '../../orm/input-types'; +import type { + CreateEmailInput, + EmailPatch, + EmailSelect, + EmailFilter, + EmailOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nemail \n\nCommands:\n list List all email records\n get Get a email by ID\n create Create a new email\n update Update an existing email\n delete Delete a email\n\n --help, -h Show this help message\n'; + '\nemail \n\nCommands:\n list List email records\n find-first Find first matching email record\n get Get a email by ID\n create Create a new email\n update Update an existing email\n delete Delete a email\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + email: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: EmailSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.email - .findMany({ - select: { - id: true, - ownerId: true, - email: true, - isVerified: true, - isPrimary: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.email.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + email: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: EmailSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.email.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts b/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts index 80e0b5a76..984aeec18 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/phone-number.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreatePhoneNumberInput, PhoneNumberPatch } from '../../orm/input-types'; +import type { + CreatePhoneNumberInput, + PhoneNumberPatch, + PhoneNumberSelect, + PhoneNumberFilter, + PhoneNumberOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nphone-number \n\nCommands:\n list List all phoneNumber records\n get Get a phoneNumber by ID\n create Create a new phoneNumber\n update Update an existing phoneNumber\n delete Delete a phoneNumber\n\n --help, -h Show this help message\n'; + '\nphone-number \n\nCommands:\n list List phoneNumber records\n find-first Find first matching phoneNumber record\n get Get a phoneNumber by ID\n create Create a new phoneNumber\n update Update an existing phoneNumber\n delete Delete a phoneNumber\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + cc: true, + number: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: PhoneNumberSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.phoneNumber - .findMany({ - select: { - id: true, - ownerId: true, - cc: true, - number: true, - isVerified: true, - isPrimary: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.phoneNumber.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + cc: true, + number: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: PhoneNumberSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.phoneNumber.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/auth/cli/commands/role-type.ts b/sdk/constructive-cli/src/auth/cli/commands/role-type.ts index dc6e319c0..30724bbfe 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/role-type.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/role-type.ts @@ -5,15 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateRoleTypeInput, RoleTypePatch } from '../../orm/input-types'; +import type { + CreateRoleTypeInput, + RoleTypePatch, + RoleTypeSelect, + RoleTypeFilter, + RoleTypeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'int', name: 'string', }; const usage = - '\nrole-type \n\nCommands:\n list List all roleType records\n get Get a roleType by ID\n create Create a new roleType\n update Update an existing roleType\n delete Delete a roleType\n\n --help, -h Show this help message\n'; + '\nrole-type \n\nCommands:\n list List roleType records\n find-first Find first matching roleType record\n get Get a roleType by ID\n create Create a new roleType\n update Update an existing roleType\n delete Delete a roleType\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -45,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -58,17 +67,19 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: RoleTypeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.roleType - .findMany({ - select: { - id: true, - name: true, - }, - }) - .execute(); + const result = await client.roleType.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -78,6 +89,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: RoleTypeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.roleType.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/auth/cli/commands/user.ts b/sdk/constructive-cli/src/auth/cli/commands/user.ts index 9bc46685a..cc49c77ce 100644 --- a/sdk/constructive-cli/src/auth/cli/commands/user.ts +++ b/sdk/constructive-cli/src/auth/cli/commands/user.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateUserInput, UserPatch } from '../../orm/input-types'; +import type { + CreateUserInput, + UserPatch, + UserSelect, + UserFilter, + UserOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', username: 'string', @@ -22,7 +29,7 @@ const fieldSchema: FieldSchema = { searchScore: 'float', }; const usage = - '\nuser \n\nCommands:\n list List all user records\n get Get a user by ID\n create Create a new user\n update Update an existing user\n delete Delete a user\n\n --help, -h Show this help message\n'; + '\nuser \n\nCommands:\n list List user records\n find-first Find first matching user record\n search Search user records\n get Get a user by ID\n create Create a new user\n update Update an existing user\n delete Delete a user\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\nSearch Options:\n Search query string (required)\n --limit Max number of records to return\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --orderBy Comma-separated list of ordering values\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +46,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'search', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -54,6 +61,10 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); + case 'search': + return handleSearch(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -67,22 +78,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + username: true, + displayName: true, + profilePicture: true, + type: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: UserSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.user - .findMany({ - select: { - id: true, - username: true, - displayName: true, - profilePicture: true, - type: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.user.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +105,74 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + username: true, + displayName: true, + profilePicture: true, + type: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: UserSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.user.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} +async function handleSearch(argv: Partial>, _prompter: Inquirerer) { + try { + const query = Array.isArray(argv._) && argv._.length > 0 ? String(argv._[0]) : undefined; + if (!query) { + console.error('Error: search requires a argument'); + process.exit(1); + } + const searchWhere = { + searchTsv: { + query, + }, + trgmDisplayName: { + value: query, + threshold: 0.3, + }, + }; + const defaultSelect = { + id: true, + username: true, + displayName: true, + profilePicture: true, + type: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: UserSelect; + } + >(argv, defaultSelect, searchWhere); + const client = getClient(); + const result = await client.user.findMany(findManyArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to search records.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/auth/cli/utils.ts b/sdk/constructive-cli/src/auth/cli/utils.ts index 612b4a801..7d8d25ac8 100644 --- a/sdk/constructive-cli/src/auth/cli/utils.ts +++ b/sdk/constructive-cli/src/auth/cli/utils.ts @@ -168,6 +168,114 @@ export function unflattenDotNotation(answers: Record): Record, name: string): number | undefined { + const val = argv[name]; + if (typeof val === 'number') return val; + if (typeof val === 'string') { + const n = parseInt(val, 10); + return isNaN(n) ? undefined : n; + } + return undefined; +} + +/** + * Parse a CLI flag as a string. + * Returns undefined when the flag is missing or not a string. + */ +export function parseStringFlag(argv: Record, name: string): string | undefined { + const val = argv[name]; + return typeof val === 'string' ? val : undefined; +} + +/** + * Parse --orderBy flag as a comma-separated list of enum values. + * e.g. --orderBy NAME_ASC,CREATED_AT_DESC → ['NAME_ASC', 'CREATED_AT_DESC'] + */ +export function parseOrderByFlag(argv: Record): string[] | undefined { + const val = argv.orderBy; + return typeof val === 'string' ? val.split(',') : undefined; +} + +/** + * Parse --select flag into a select object, falling back to a default. + * e.g. --select id,name → { id: true, name: true } + */ +export function parseSelectFlag( + argv: Record, + defaultSelect: Record +): Record { + const raw = argv.select; + return typeof raw === 'string' ? buildSelectFromPaths(raw) : defaultSelect; +} + +/** + * Build the full findManyArgs object from CLI argv. + * Parses all pagination, filtering, ordering, and field selection flags + * in one call. Accepts an optional `extraWhere` to merge with dot-notation + * --where flags (used by the search handler to inject search clauses). + * + * @example + * const findManyArgs = parseFindManyArgs(argv, { id: true, name: true }); + * const result = await client.user.findMany(findManyArgs).execute(); + */ +export function parseFindManyArgs>( + argv: Record, + defaultSelect: Record, + extraWhere?: Record +): T { + const limit = parseIntFlag(argv, 'limit'); + const last = parseIntFlag(argv, 'last'); + const offset = parseIntFlag(argv, 'offset'); + const after = parseStringFlag(argv, 'after'); + const before = parseStringFlag(argv, 'before'); + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = + (parsed.where ?? extraWhere) + ? { ...(extraWhere ?? {}), ...((parsed.where as Record) ?? {}) } + : undefined; + const condition = parsed.condition; + const orderBy = parseOrderByFlag(argv); + + return { + select, + ...(limit !== undefined ? { first: limit } : {}), + ...(after !== undefined ? { after } : {}), + ...(last !== undefined ? { last } : {}), + ...(before !== undefined ? { before } : {}), + ...(offset !== undefined ? { offset } : {}), + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + ...(orderBy !== undefined ? { orderBy } : {}), + } as unknown as T; +} + +/** + * Build findFirst args from CLI argv. + * Like parseFindManyArgs but only includes select, where, and condition + * (no pagination flags — findFirst returns the first matching record). + */ +export function parseFindFirstArgs>( + argv: Record, + defaultSelect: Record +): T { + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = parsed.where; + const condition = parsed.condition; + + return { + select, + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + } as unknown as T; +} + export function buildSelectFromPaths(paths: string): Record { const result: Record = {}; const trimmedPaths = paths diff --git a/sdk/constructive-cli/src/auth/orm/README.md b/sdk/constructive-cli/src/auth/orm/README.md index ef3b0c06e..745af4158 100644 --- a/sdk/constructive-cli/src/auth/orm/README.md +++ b/sdk/constructive-cli/src/auth/orm/README.md @@ -278,6 +278,9 @@ const updated = await db.user.update({ where: { id: '' }, data: { username const deleted = await db.user.delete({ where: { id: '' } }).execute(); ``` +> **Unified Search API fields:** `searchTsv` +> Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ## Custom Operations ### `db.query.currentIpAddress` diff --git a/sdk/constructive-cli/src/objects/cli/README.md b/sdk/constructive-cli/src/objects/cli/README.md index 37db0defc..2714d14c8 100644 --- a/sdk/constructive-cli/src/objects/cli/README.md +++ b/sdk/constructive-cli/src/objects/cli/README.md @@ -92,6 +92,7 @@ CRUD operations for GetAllRecord records. | Subcommand | Description | |------------|-------------| | `list` | List all getAllRecord records | +| `find-first` | Find first matching getAllRecord record | | `get` | Get a getAllRecord by id | | `create` | Create a new getAllRecord | | `update` | Update an existing getAllRecord | @@ -113,6 +114,7 @@ CRUD operations for Object records. | Subcommand | Description | |------------|-------------| | `list` | List all object records | +| `find-first` | Find first matching object record | | `get` | Get a object by id | | `create` | Create a new object | | `update` | Update an existing object | @@ -141,6 +143,7 @@ CRUD operations for Ref records. | Subcommand | Description | |------------|-------------| | `list` | List all ref records | +| `find-first` | Find first matching ref record | | `get` | Get a ref by id | | `create` | Create a new ref | | `update` | Update an existing ref | @@ -166,6 +169,7 @@ CRUD operations for Store records. | Subcommand | Description | |------------|-------------| | `list` | List all store records | +| `find-first` | Find first matching store record | | `get` | Get a store by id | | `create` | Create a new store | | `update` | Update an existing store | @@ -191,6 +195,7 @@ CRUD operations for Commit records. | Subcommand | Description | |------------|-------------| | `list` | List all commit records | +| `find-first` | Find first matching commit record | | `get` | Get a commit by id | | `create` | Create a new commit | | `update` | Update an existing commit | diff --git a/sdk/constructive-cli/src/objects/cli/commands/commit.ts b/sdk/constructive-cli/src/objects/cli/commands/commit.ts index 41e83a4f2..cbea0bc89 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/commit.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/commit.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateCommitInput, CommitPatch } from '../../orm/input-types'; +import type { + CreateCommitInput, + CommitPatch, + CommitSelect, + CommitFilter, + CommitOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', message: 'string', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { date: 'string', }; const usage = - '\ncommit \n\nCommands:\n list List all commit records\n get Get a commit by ID\n create Create a new commit\n update Update an existing commit\n delete Delete a commit\n\n --help, -h Show this help message\n'; + '\ncommit \n\nCommands:\n list List commit records\n find-first Find first matching commit record\n get Get a commit by ID\n create Create a new commit\n update Update an existing commit\n delete Delete a commit\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,26 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + message: true, + databaseId: true, + storeId: true, + parentIds: true, + authorId: true, + committerId: true, + treeId: true, + date: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: CommitSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.commit - .findMany({ - select: { - id: true, - message: true, - databaseId: true, - storeId: true, - parentIds: true, - authorId: true, - committerId: true, - treeId: true, - date: true, - }, - }) - .execute(); + const result = await client.commit.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +103,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + message: true, + databaseId: true, + storeId: true, + parentIds: true, + authorId: true, + committerId: true, + treeId: true, + date: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: CommitSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.commit.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts b/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts index 96f8537f6..5ef092f6c 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/get-all-record.ts @@ -5,15 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateGetAllRecordInput, GetAllRecordPatch } from '../../orm/input-types'; +import type { + CreateGetAllRecordInput, + GetAllRecordPatch, + GetAllRecordSelect, + GetAllRecordFilter, + GetAllRecordsOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { path: 'string', data: 'json', }; const usage = - '\nget-all-record \n\nCommands:\n list List all getAllRecord records\n create Create a new getAllRecord\n\n --help, -h Show this help message\n'; + '\nget-all-record \n\nCommands:\n list List getAllRecord records\n find-first Find first matching getAllRecord record\n create Create a new getAllRecord\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -45,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -52,17 +61,19 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + path: true, + data: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: GetAllRecordSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.getAllRecord - .findMany({ - select: { - path: true, - data: true, - }, - }) - .execute(); + const result = await client.getAllRecord.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -72,6 +83,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + path: true, + data: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: GetAllRecordSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.getAllRecord.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/objects/cli/commands/object.ts b/sdk/constructive-cli/src/objects/cli/commands/object.ts index 098b310d5..a6293a397 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/object.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/object.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateObjectInput, ObjectPatch } from '../../orm/input-types'; +import type { + CreateObjectInput, + ObjectPatch, + ObjectSelect, + ObjectFilter, + ObjectOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { hashUuid: 'uuid', id: 'uuid', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\nobject \n\nCommands:\n list List all object records\n get Get a object by ID\n create Create a new object\n update Update an existing object\n delete Delete a object\n\n --help, -h Show this help message\n'; + '\nobject \n\nCommands:\n list List object records\n find-first Find first matching object record\n get Get a object by ID\n create Create a new object\n update Update an existing object\n delete Delete a object\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,22 +73,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + kids: true, + ktree: true, + data: true, + frzn: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ObjectSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.object - .findMany({ - select: { - id: true, - databaseId: true, - kids: true, - ktree: true, - data: true, - frzn: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.object.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -89,6 +100,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + kids: true, + ktree: true, + data: true, + frzn: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ObjectSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.object.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/objects/cli/commands/ref.ts b/sdk/constructive-cli/src/objects/cli/commands/ref.ts index 7ad388281..e511ebe7d 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/ref.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/ref.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateRefInput, RefPatch } from '../../orm/input-types'; +import type { + CreateRefInput, + RefPatch, + RefSelect, + RefFilter, + RefOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { commitId: 'uuid', }; const usage = - '\nref \n\nCommands:\n list List all ref records\n get Get a ref by ID\n create Create a new ref\n update Update an existing ref\n delete Delete a ref\n\n --help, -h Show this help message\n'; + '\nref \n\nCommands:\n list List ref records\n find-first Find first matching ref record\n get Get a ref by ID\n create Create a new ref\n update Update an existing ref\n delete Delete a ref\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + storeId: true, + commitId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: RefSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.ref - .findMany({ - select: { - id: true, - name: true, - databaseId: true, - storeId: true, - commitId: true, - }, - }) - .execute(); + const result = await client.ref.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + storeId: true, + commitId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: RefSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.ref.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/objects/cli/commands/store.ts b/sdk/constructive-cli/src/objects/cli/commands/store.ts index 2ca10cb6d..206779c0f 100644 --- a/sdk/constructive-cli/src/objects/cli/commands/store.ts +++ b/sdk/constructive-cli/src/objects/cli/commands/store.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateStoreInput, StorePatch } from '../../orm/input-types'; +import type { + CreateStoreInput, + StorePatch, + StoreSelect, + StoreFilter, + StoreOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\nstore \n\nCommands:\n list List all store records\n get Get a store by ID\n create Create a new store\n update Update an existing store\n delete Delete a store\n\n --help, -h Show this help message\n'; + '\nstore \n\nCommands:\n list List store records\n find-first Find first matching store record\n get Get a store by ID\n create Create a new store\n update Update an existing store\n delete Delete a store\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + hash: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: StoreSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.store - .findMany({ - select: { - id: true, - name: true, - databaseId: true, - hash: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.store.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + hash: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: StoreSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.store.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/objects/cli/utils.ts b/sdk/constructive-cli/src/objects/cli/utils.ts index 612b4a801..7d8d25ac8 100644 --- a/sdk/constructive-cli/src/objects/cli/utils.ts +++ b/sdk/constructive-cli/src/objects/cli/utils.ts @@ -168,6 +168,114 @@ export function unflattenDotNotation(answers: Record): Record, name: string): number | undefined { + const val = argv[name]; + if (typeof val === 'number') return val; + if (typeof val === 'string') { + const n = parseInt(val, 10); + return isNaN(n) ? undefined : n; + } + return undefined; +} + +/** + * Parse a CLI flag as a string. + * Returns undefined when the flag is missing or not a string. + */ +export function parseStringFlag(argv: Record, name: string): string | undefined { + const val = argv[name]; + return typeof val === 'string' ? val : undefined; +} + +/** + * Parse --orderBy flag as a comma-separated list of enum values. + * e.g. --orderBy NAME_ASC,CREATED_AT_DESC → ['NAME_ASC', 'CREATED_AT_DESC'] + */ +export function parseOrderByFlag(argv: Record): string[] | undefined { + const val = argv.orderBy; + return typeof val === 'string' ? val.split(',') : undefined; +} + +/** + * Parse --select flag into a select object, falling back to a default. + * e.g. --select id,name → { id: true, name: true } + */ +export function parseSelectFlag( + argv: Record, + defaultSelect: Record +): Record { + const raw = argv.select; + return typeof raw === 'string' ? buildSelectFromPaths(raw) : defaultSelect; +} + +/** + * Build the full findManyArgs object from CLI argv. + * Parses all pagination, filtering, ordering, and field selection flags + * in one call. Accepts an optional `extraWhere` to merge with dot-notation + * --where flags (used by the search handler to inject search clauses). + * + * @example + * const findManyArgs = parseFindManyArgs(argv, { id: true, name: true }); + * const result = await client.user.findMany(findManyArgs).execute(); + */ +export function parseFindManyArgs>( + argv: Record, + defaultSelect: Record, + extraWhere?: Record +): T { + const limit = parseIntFlag(argv, 'limit'); + const last = parseIntFlag(argv, 'last'); + const offset = parseIntFlag(argv, 'offset'); + const after = parseStringFlag(argv, 'after'); + const before = parseStringFlag(argv, 'before'); + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = + (parsed.where ?? extraWhere) + ? { ...(extraWhere ?? {}), ...((parsed.where as Record) ?? {}) } + : undefined; + const condition = parsed.condition; + const orderBy = parseOrderByFlag(argv); + + return { + select, + ...(limit !== undefined ? { first: limit } : {}), + ...(after !== undefined ? { after } : {}), + ...(last !== undefined ? { last } : {}), + ...(before !== undefined ? { before } : {}), + ...(offset !== undefined ? { offset } : {}), + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + ...(orderBy !== undefined ? { orderBy } : {}), + } as unknown as T; +} + +/** + * Build findFirst args from CLI argv. + * Like parseFindManyArgs but only includes select, where, and condition + * (no pagination flags — findFirst returns the first matching record). + */ +export function parseFindFirstArgs>( + argv: Record, + defaultSelect: Record +): T { + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = parsed.where; + const condition = parsed.condition; + + return { + select, + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + } as unknown as T; +} + export function buildSelectFromPaths(paths: string): Record { const result: Record = {}; const trimmedPaths = paths diff --git a/sdk/constructive-cli/src/public/cli/README.md b/sdk/constructive-cli/src/public/cli/README.md index 329582e5b..2f04b173e 100644 --- a/sdk/constructive-cli/src/public/cli/README.md +++ b/sdk/constructive-cli/src/public/cli/README.md @@ -122,11 +122,11 @@ csdk auth set-token | `migrate-file` | migrateFile CRUD operations | | `app-limit-default` | appLimitDefault CRUD operations | | `org-limit-default` | orgLimitDefault CRUD operations | -| `node-type-registry` | nodeTypeRegistry CRUD operations | | `membership-type` | membershipType CRUD operations | | `commit` | commit CRUD operations | | `app-membership-default` | appMembershipDefault CRUD operations | | `rls-module` | rlsModule CRUD operations | +| `node-type-registry` | nodeTypeRegistry CRUD operations | | `org-membership-default` | orgMembershipDefault CRUD operations | | `sql-action` | sqlAction CRUD operations | | `user` | user CRUD operations | @@ -253,6 +253,7 @@ CRUD operations for GetAllRecord records. | Subcommand | Description | |------------|-------------| | `list` | List all getAllRecord records | +| `find-first` | Find first matching getAllRecord record | | `get` | Get a getAllRecord by id | | `create` | Create a new getAllRecord | | `update` | Update an existing getAllRecord | @@ -274,6 +275,7 @@ CRUD operations for OrgGetManagersRecord records. | Subcommand | Description | |------------|-------------| | `list` | List all orgGetManagersRecord records | +| `find-first` | Find first matching orgGetManagersRecord record | | `get` | Get a orgGetManagersRecord by id | | `create` | Create a new orgGetManagersRecord | | `update` | Update an existing orgGetManagersRecord | @@ -295,6 +297,7 @@ CRUD operations for OrgGetSubordinatesRecord records. | Subcommand | Description | |------------|-------------| | `list` | List all orgGetSubordinatesRecord records | +| `find-first` | Find first matching orgGetSubordinatesRecord record | | `get` | Get a orgGetSubordinatesRecord by id | | `create` | Create a new orgGetSubordinatesRecord | | `update` | Update an existing orgGetSubordinatesRecord | @@ -316,6 +319,7 @@ CRUD operations for Object records. | Subcommand | Description | |------------|-------------| | `list` | List all object records | +| `find-first` | Find first matching object record | | `get` | Get a object by id | | `create` | Create a new object | | `update` | Update an existing object | @@ -344,6 +348,7 @@ CRUD operations for AppPermission records. | Subcommand | Description | |------------|-------------| | `list` | List all appPermission records | +| `find-first` | Find first matching appPermission record | | `get` | Get a appPermission by id | | `create` | Create a new appPermission | | `update` | Update an existing appPermission | @@ -368,6 +373,7 @@ CRUD operations for OrgPermission records. | Subcommand | Description | |------------|-------------| | `list` | List all orgPermission records | +| `find-first` | Find first matching orgPermission record | | `get` | Get a orgPermission by id | | `create` | Create a new orgPermission | | `update` | Update an existing orgPermission | @@ -392,6 +398,7 @@ CRUD operations for AppLevelRequirement records. | Subcommand | Description | |------------|-------------| | `list` | List all appLevelRequirement records | +| `find-first` | Find first matching appLevelRequirement record | | `get` | Get a appLevelRequirement by id | | `create` | Create a new appLevelRequirement | | `update` | Update an existing appLevelRequirement | @@ -420,6 +427,7 @@ CRUD operations for Database records. | Subcommand | Description | |------------|-------------| | `list` | List all database records | +| `find-first` | Find first matching database record | | `get` | Get a database by id | | `create` | Create a new database | | `update` | Update an existing database | @@ -447,6 +455,7 @@ CRUD operations for Schema records. | Subcommand | Description | |------------|-------------| | `list` | List all schema records | +| `find-first` | Find first matching schema record | | `get` | Get a schema by id | | `create` | Create a new schema | | `update` | Update an existing schema | @@ -481,6 +490,7 @@ CRUD operations for Table records. | Subcommand | Description | |------------|-------------| | `list` | List all table records | +| `find-first` | Find first matching table record | | `get` | Get a table by id | | `create` | Create a new table | | `update` | Update an existing table | @@ -520,6 +530,7 @@ CRUD operations for CheckConstraint records. | Subcommand | Description | |------------|-------------| | `list` | List all checkConstraint records | +| `find-first` | Find first matching checkConstraint record | | `get` | Get a checkConstraint by id | | `create` | Create a new checkConstraint | | `update` | Update an existing checkConstraint | @@ -554,6 +565,7 @@ CRUD operations for Field records. | Subcommand | Description | |------------|-------------| | `list` | List all field records | +| `find-first` | Find first matching field record | | `get` | Get a field by id | | `create` | Create a new field | | `update` | Update an existing field | @@ -598,6 +610,7 @@ CRUD operations for ForeignKeyConstraint records. | Subcommand | Description | |------------|-------------| | `list` | List all foreignKeyConstraint records | +| `find-first` | Find first matching foreignKeyConstraint record | | `get` | Get a foreignKeyConstraint by id | | `create` | Create a new foreignKeyConstraint | | `update` | Update an existing foreignKeyConstraint | @@ -636,6 +649,7 @@ CRUD operations for FullTextSearch records. | Subcommand | Description | |------------|-------------| | `list` | List all fullTextSearch records | +| `find-first` | Find first matching fullTextSearch record | | `get` | Get a fullTextSearch by id | | `create` | Create a new fullTextSearch | | `update` | Update an existing fullTextSearch | @@ -665,6 +679,7 @@ CRUD operations for Index records. | Subcommand | Description | |------------|-------------| | `list` | List all index records | +| `find-first` | Find first matching index record | | `get` | Get a index by id | | `create` | Create a new index | | `update` | Update an existing index | @@ -704,6 +719,7 @@ CRUD operations for Policy records. | Subcommand | Description | |------------|-------------| | `list` | List all policy records | +| `find-first` | Find first matching policy record | | `get` | Get a policy by id | | `create` | Create a new policy | | `update` | Update an existing policy | @@ -741,6 +757,7 @@ CRUD operations for PrimaryKeyConstraint records. | Subcommand | Description | |------------|-------------| | `list` | List all primaryKeyConstraint records | +| `find-first` | Find first matching primaryKeyConstraint record | | `get` | Get a primaryKeyConstraint by id | | `create` | Create a new primaryKeyConstraint | | `update` | Update an existing primaryKeyConstraint | @@ -774,6 +791,7 @@ CRUD operations for TableGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all tableGrant records | +| `find-first` | Find first matching tableGrant record | | `get` | Get a tableGrant by id | | `create` | Create a new tableGrant | | `update` | Update an existing tableGrant | @@ -803,6 +821,7 @@ CRUD operations for Trigger records. | Subcommand | Description | |------------|-------------| | `list` | List all trigger records | +| `find-first` | Find first matching trigger record | | `get` | Get a trigger by id | | `create` | Create a new trigger | | `update` | Update an existing trigger | @@ -836,6 +855,7 @@ CRUD operations for UniqueConstraint records. | Subcommand | Description | |------------|-------------| | `list` | List all uniqueConstraint records | +| `find-first` | Find first matching uniqueConstraint record | | `get` | Get a uniqueConstraint by id | | `create` | Create a new uniqueConstraint | | `update` | Update an existing uniqueConstraint | @@ -870,6 +890,7 @@ CRUD operations for View records. | Subcommand | Description | |------------|-------------| | `list` | List all view records | +| `find-first` | Find first matching view record | | `get` | Get a view by id | | `create` | Create a new view | | `update` | Update an existing view | @@ -906,6 +927,7 @@ CRUD operations for ViewTable records. | Subcommand | Description | |------------|-------------| | `list` | List all viewTable records | +| `find-first` | Find first matching viewTable record | | `get` | Get a viewTable by id | | `create` | Create a new viewTable | | `update` | Update an existing viewTable | @@ -930,6 +952,7 @@ CRUD operations for ViewGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all viewGrant records | +| `find-first` | Find first matching viewGrant record | | `get` | Get a viewGrant by id | | `create` | Create a new viewGrant | | `update` | Update an existing viewGrant | @@ -957,6 +980,7 @@ CRUD operations for ViewRule records. | Subcommand | Description | |------------|-------------| | `list` | List all viewRule records | +| `find-first` | Find first matching viewRule record | | `get` | Get a viewRule by id | | `create` | Create a new viewRule | | `update` | Update an existing viewRule | @@ -983,6 +1007,7 @@ CRUD operations for EmbeddingChunk records. | Subcommand | Description | |------------|-------------| | `list` | List all embeddingChunk records | +| `find-first` | Find first matching embeddingChunk record | | `get` | Get a embeddingChunk by id | | `create` | Create a new embeddingChunk | | `update` | Update an existing embeddingChunk | @@ -1021,6 +1046,7 @@ CRUD operations for TableTemplateModule records. | Subcommand | Description | |------------|-------------| | `list` | List all tableTemplateModule records | +| `find-first` | Find first matching tableTemplateModule record | | `get` | Get a tableTemplateModule by id | | `create` | Create a new tableTemplateModule | | `update` | Update an existing tableTemplateModule | @@ -1050,6 +1076,7 @@ CRUD operations for SecureTableProvision records. | Subcommand | Description | |------------|-------------| | `list` | List all secureTableProvision records | +| `find-first` | Find first matching secureTableProvision record | | `get` | Get a secureTableProvision by id | | `create` | Create a new secureTableProvision | | `update` | Update an existing secureTableProvision | @@ -1088,6 +1115,7 @@ CRUD operations for RelationProvision records. | Subcommand | Description | |------------|-------------| | `list` | List all relationProvision records | +| `find-first` | Find first matching relationProvision record | | `get` | Get a relationProvision by id | | `create` | Create a new relationProvision | | `update` | Update an existing relationProvision | @@ -1139,6 +1167,7 @@ CRUD operations for SchemaGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all schemaGrant records | +| `find-first` | Find first matching schemaGrant record | | `get` | Get a schemaGrant by id | | `create` | Create a new schemaGrant | | `update` | Update an existing schemaGrant | @@ -1165,6 +1194,7 @@ CRUD operations for DefaultPrivilege records. | Subcommand | Description | |------------|-------------| | `list` | List all defaultPrivilege records | +| `find-first` | Find first matching defaultPrivilege record | | `get` | Get a defaultPrivilege by id | | `create` | Create a new defaultPrivilege | | `update` | Update an existing defaultPrivilege | @@ -1192,6 +1222,7 @@ CRUD operations for Enum records. | Subcommand | Description | |------------|-------------| | `list` | List all enum records | +| `find-first` | Find first matching enum record | | `get` | Get a enum by id | | `create` | Create a new enum | | `update` | Update an existing enum | @@ -1224,6 +1255,7 @@ CRUD operations for ApiSchema records. | Subcommand | Description | |------------|-------------| | `list` | List all apiSchema records | +| `find-first` | Find first matching apiSchema record | | `get` | Get a apiSchema by id | | `create` | Create a new apiSchema | | `update` | Update an existing apiSchema | @@ -1247,6 +1279,7 @@ CRUD operations for ApiModule records. | Subcommand | Description | |------------|-------------| | `list` | List all apiModule records | +| `find-first` | Find first matching apiModule record | | `get` | Get a apiModule by id | | `create` | Create a new apiModule | | `update` | Update an existing apiModule | @@ -1271,6 +1304,7 @@ CRUD operations for Domain records. | Subcommand | Description | |------------|-------------| | `list` | List all domain records | +| `find-first` | Find first matching domain record | | `get` | Get a domain by id | | `create` | Create a new domain | | `update` | Update an existing domain | @@ -1297,6 +1331,7 @@ CRUD operations for SiteMetadatum records. | Subcommand | Description | |------------|-------------| | `list` | List all siteMetadatum records | +| `find-first` | Find first matching siteMetadatum record | | `get` | Get a siteMetadatum by id | | `create` | Create a new siteMetadatum | | `update` | Update an existing siteMetadatum | @@ -1323,6 +1358,7 @@ CRUD operations for SiteModule records. | Subcommand | Description | |------------|-------------| | `list` | List all siteModule records | +| `find-first` | Find first matching siteModule record | | `get` | Get a siteModule by id | | `create` | Create a new siteModule | | `update` | Update an existing siteModule | @@ -1347,6 +1383,7 @@ CRUD operations for SiteTheme records. | Subcommand | Description | |------------|-------------| | `list` | List all siteTheme records | +| `find-first` | Find first matching siteTheme record | | `get` | Get a siteTheme by id | | `create` | Create a new siteTheme | | `update` | Update an existing siteTheme | @@ -1370,6 +1407,7 @@ CRUD operations for TriggerFunction records. | Subcommand | Description | |------------|-------------| | `list` | List all triggerFunction records | +| `find-first` | Find first matching triggerFunction record | | `get` | Get a triggerFunction by id | | `create` | Create a new triggerFunction | | `update` | Update an existing triggerFunction | @@ -1396,6 +1434,7 @@ CRUD operations for DatabaseTransfer records. | Subcommand | Description | |------------|-------------| | `list` | List all databaseTransfer records | +| `find-first` | Find first matching databaseTransfer record | | `get` | Get a databaseTransfer by id | | `create` | Create a new databaseTransfer | | `update` | Update an existing databaseTransfer | @@ -1430,6 +1469,7 @@ CRUD operations for Api records. | Subcommand | Description | |------------|-------------| | `list` | List all api records | +| `find-first` | Find first matching api record | | `get` | Get a api by id | | `create` | Create a new api | | `update` | Update an existing api | @@ -1457,6 +1497,7 @@ CRUD operations for Site records. | Subcommand | Description | |------------|-------------| | `list` | List all site records | +| `find-first` | Find first matching site record | | `get` | Get a site by id | | `create` | Create a new site | | `update` | Update an existing site | @@ -1486,6 +1527,7 @@ CRUD operations for App records. | Subcommand | Description | |------------|-------------| | `list` | List all app records | +| `find-first` | Find first matching app record | | `get` | Get a app by id | | `create` | Create a new app | | `update` | Update an existing app | @@ -1515,6 +1557,7 @@ CRUD operations for ConnectedAccountsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all connectedAccountsModule records | +| `find-first` | Find first matching connectedAccountsModule record | | `get` | Get a connectedAccountsModule by id | | `create` | Create a new connectedAccountsModule | | `update` | Update an existing connectedAccountsModule | @@ -1542,6 +1585,7 @@ CRUD operations for CryptoAddressesModule records. | Subcommand | Description | |------------|-------------| | `list` | List all cryptoAddressesModule records | +| `find-first` | Find first matching cryptoAddressesModule record | | `get` | Get a cryptoAddressesModule by id | | `create` | Create a new cryptoAddressesModule | | `update` | Update an existing cryptoAddressesModule | @@ -1570,6 +1614,7 @@ CRUD operations for CryptoAuthModule records. | Subcommand | Description | |------------|-------------| | `list` | List all cryptoAuthModule records | +| `find-first` | Find first matching cryptoAuthModule record | | `get` | Get a cryptoAuthModule by id | | `create` | Create a new cryptoAuthModule | | `update` | Update an existing cryptoAuthModule | @@ -1604,6 +1649,7 @@ CRUD operations for DefaultIdsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all defaultIdsModule records | +| `find-first` | Find first matching defaultIdsModule record | | `get` | Get a defaultIdsModule by id | | `create` | Create a new defaultIdsModule | | `update` | Update an existing defaultIdsModule | @@ -1625,6 +1671,7 @@ CRUD operations for DenormalizedTableField records. | Subcommand | Description | |------------|-------------| | `list` | List all denormalizedTableField records | +| `find-first` | Find first matching denormalizedTableField record | | `get` | Get a denormalizedTableField by id | | `create` | Create a new denormalizedTableField | | `update` | Update an existing denormalizedTableField | @@ -1657,6 +1704,7 @@ CRUD operations for EmailsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all emailsModule records | +| `find-first` | Find first matching emailsModule record | | `get` | Get a emailsModule by id | | `create` | Create a new emailsModule | | `update` | Update an existing emailsModule | @@ -1684,6 +1732,7 @@ CRUD operations for EncryptedSecretsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all encryptedSecretsModule records | +| `find-first` | Find first matching encryptedSecretsModule record | | `get` | Get a encryptedSecretsModule by id | | `create` | Create a new encryptedSecretsModule | | `update` | Update an existing encryptedSecretsModule | @@ -1709,6 +1758,7 @@ CRUD operations for InvitesModule records. | Subcommand | Description | |------------|-------------| | `list` | List all invitesModule records | +| `find-first` | Find first matching invitesModule record | | `get` | Get a invitesModule by id | | `create` | Create a new invitesModule | | `update` | Update an existing invitesModule | @@ -1743,6 +1793,7 @@ CRUD operations for LevelsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all levelsModule records | +| `find-first` | Find first matching levelsModule record | | `get` | Get a levelsModule by id | | `create` | Create a new levelsModule | | `update` | Update an existing levelsModule | @@ -1789,6 +1840,7 @@ CRUD operations for LimitsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all limitsModule records | +| `find-first` | Find first matching limitsModule record | | `get` | Get a limitsModule by id | | `create` | Create a new limitsModule | | `update` | Update an existing limitsModule | @@ -1827,6 +1879,7 @@ CRUD operations for MembershipTypesModule records. | Subcommand | Description | |------------|-------------| | `list` | List all membershipTypesModule records | +| `find-first` | Find first matching membershipTypesModule record | | `get` | Get a membershipTypesModule by id | | `create` | Create a new membershipTypesModule | | `update` | Update an existing membershipTypesModule | @@ -1852,6 +1905,7 @@ CRUD operations for MembershipsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all membershipsModule records | +| `find-first` | Find first matching membershipsModule record | | `get` | Get a membershipsModule by id | | `create` | Create a new membershipsModule | | `update` | Update an existing membershipsModule | @@ -1903,6 +1957,7 @@ CRUD operations for PermissionsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all permissionsModule records | +| `find-first` | Find first matching permissionsModule record | | `get` | Get a permissionsModule by id | | `create` | Create a new permissionsModule | | `update` | Update an existing permissionsModule | @@ -1940,6 +1995,7 @@ CRUD operations for PhoneNumbersModule records. | Subcommand | Description | |------------|-------------| | `list` | List all phoneNumbersModule records | +| `find-first` | Find first matching phoneNumbersModule record | | `get` | Get a phoneNumbersModule by id | | `create` | Create a new phoneNumbersModule | | `update` | Update an existing phoneNumbersModule | @@ -1967,6 +2023,7 @@ CRUD operations for ProfilesModule records. | Subcommand | Description | |------------|-------------| | `list` | List all profilesModule records | +| `find-first` | Find first matching profilesModule record | | `get` | Get a profilesModule by id | | `create` | Create a new profilesModule | | `update` | Update an existing profilesModule | @@ -2005,6 +2062,7 @@ CRUD operations for SecretsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all secretsModule records | +| `find-first` | Find first matching secretsModule record | | `get` | Get a secretsModule by id | | `create` | Create a new secretsModule | | `update` | Update an existing secretsModule | @@ -2030,6 +2088,7 @@ CRUD operations for SessionsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all sessionsModule records | +| `find-first` | Find first matching sessionsModule record | | `get` | Get a sessionsModule by id | | `create` | Create a new sessionsModule | | `update` | Update an existing sessionsModule | @@ -2061,6 +2120,7 @@ CRUD operations for UserAuthModule records. | Subcommand | Description | |------------|-------------| | `list` | List all userAuthModule records | +| `find-first` | Find first matching userAuthModule record | | `get` | Get a userAuthModule by id | | `create` | Create a new userAuthModule | | `update` | Update an existing userAuthModule | @@ -2107,6 +2167,7 @@ CRUD operations for UsersModule records. | Subcommand | Description | |------------|-------------| | `list` | List all usersModule records | +| `find-first` | Find first matching usersModule record | | `get` | Get a usersModule by id | | `create` | Create a new usersModule | | `update` | Update an existing usersModule | @@ -2134,6 +2195,7 @@ CRUD operations for Blueprint records. | Subcommand | Description | |------------|-------------| | `list` | List all blueprint records | +| `find-first` | Find first matching blueprint record | | `get` | Get a blueprint by id | | `create` | Create a new blueprint | | `update` | Update an existing blueprint | @@ -2171,6 +2233,7 @@ CRUD operations for BlueprintTemplate records. | Subcommand | Description | |------------|-------------| | `list` | List all blueprintTemplate records | +| `find-first` | Find first matching blueprintTemplate record | | `get` | Get a blueprintTemplate by id | | `create` | Create a new blueprintTemplate | | `update` | Update an existing blueprintTemplate | @@ -2211,6 +2274,7 @@ CRUD operations for DatabaseProvisionModule records. | Subcommand | Description | |------------|-------------| | `list` | List all databaseProvisionModule records | +| `find-first` | Find first matching databaseProvisionModule record | | `get` | Get a databaseProvisionModule by id | | `create` | Create a new databaseProvisionModule | | `update` | Update an existing databaseProvisionModule | @@ -2245,6 +2309,7 @@ CRUD operations for AppAdminGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all appAdminGrant records | +| `find-first` | Find first matching appAdminGrant record | | `get` | Get a appAdminGrant by id | | `create` | Create a new appAdminGrant | | `update` | Update an existing appAdminGrant | @@ -2271,6 +2336,7 @@ CRUD operations for AppOwnerGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all appOwnerGrant records | +| `find-first` | Find first matching appOwnerGrant record | | `get` | Get a appOwnerGrant by id | | `create` | Create a new appOwnerGrant | | `update` | Update an existing appOwnerGrant | @@ -2297,6 +2363,7 @@ CRUD operations for AppGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all appGrant records | +| `find-first` | Find first matching appGrant record | | `get` | Get a appGrant by id | | `create` | Create a new appGrant | | `update` | Update an existing appGrant | @@ -2324,6 +2391,7 @@ CRUD operations for OrgMembership records. | Subcommand | Description | |------------|-------------| | `list` | List all orgMembership records | +| `find-first` | Find first matching orgMembership record | | `get` | Get a orgMembership by id | | `create` | Create a new orgMembership | | `update` | Update an existing orgMembership | @@ -2360,6 +2428,7 @@ CRUD operations for OrgMember records. | Subcommand | Description | |------------|-------------| | `list` | List all orgMember records | +| `find-first` | Find first matching orgMember record | | `get` | Get a orgMember by id | | `create` | Create a new orgMember | | `update` | Update an existing orgMember | @@ -2384,6 +2453,7 @@ CRUD operations for OrgAdminGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgAdminGrant records | +| `find-first` | Find first matching orgAdminGrant record | | `get` | Get a orgAdminGrant by id | | `create` | Create a new orgAdminGrant | | `update` | Update an existing orgAdminGrant | @@ -2411,6 +2481,7 @@ CRUD operations for OrgOwnerGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgOwnerGrant records | +| `find-first` | Find first matching orgOwnerGrant record | | `get` | Get a orgOwnerGrant by id | | `create` | Create a new orgOwnerGrant | | `update` | Update an existing orgOwnerGrant | @@ -2438,6 +2509,7 @@ CRUD operations for OrgGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgGrant records | +| `find-first` | Find first matching orgGrant record | | `get` | Get a orgGrant by id | | `create` | Create a new orgGrant | | `update` | Update an existing orgGrant | @@ -2466,6 +2538,7 @@ CRUD operations for OrgChartEdge records. | Subcommand | Description | |------------|-------------| | `list` | List all orgChartEdge records | +| `find-first` | Find first matching orgChartEdge record | | `get` | Get a orgChartEdge by id | | `create` | Create a new orgChartEdge | | `update` | Update an existing orgChartEdge | @@ -2494,6 +2567,7 @@ CRUD operations for OrgChartEdgeGrant records. | Subcommand | Description | |------------|-------------| | `list` | List all orgChartEdgeGrant records | +| `find-first` | Find first matching orgChartEdgeGrant record | | `get` | Get a orgChartEdgeGrant by id | | `create` | Create a new orgChartEdgeGrant | | `update` | Update an existing orgChartEdgeGrant | @@ -2523,6 +2597,7 @@ CRUD operations for OrgPermissionDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all orgPermissionDefault records | +| `find-first` | Find first matching orgPermissionDefault record | | `get` | Get a orgPermissionDefault by id | | `create` | Create a new orgPermissionDefault | | `update` | Update an existing orgPermissionDefault | @@ -2546,6 +2621,7 @@ CRUD operations for AppLimit records. | Subcommand | Description | |------------|-------------| | `list` | List all appLimit records | +| `find-first` | Find first matching appLimit record | | `get` | Get a appLimit by id | | `create` | Create a new appLimit | | `update` | Update an existing appLimit | @@ -2571,6 +2647,7 @@ CRUD operations for OrgLimit records. | Subcommand | Description | |------------|-------------| | `list` | List all orgLimit records | +| `find-first` | Find first matching orgLimit record | | `get` | Get a orgLimit by id | | `create` | Create a new orgLimit | | `update` | Update an existing orgLimit | @@ -2597,6 +2674,7 @@ CRUD operations for AppStep records. | Subcommand | Description | |------------|-------------| | `list` | List all appStep records | +| `find-first` | Find first matching appStep record | | `get` | Get a appStep by id | | `create` | Create a new appStep | | `update` | Update an existing appStep | @@ -2623,6 +2701,7 @@ CRUD operations for AppAchievement records. | Subcommand | Description | |------------|-------------| | `list` | List all appAchievement records | +| `find-first` | Find first matching appAchievement record | | `get` | Get a appAchievement by id | | `create` | Create a new appAchievement | | `update` | Update an existing appAchievement | @@ -2649,6 +2728,7 @@ CRUD operations for AppLevel records. | Subcommand | Description | |------------|-------------| | `list` | List all appLevel records | +| `find-first` | Find first matching appLevel record | | `get` | Get a appLevel by id | | `create` | Create a new appLevel | | `update` | Update an existing appLevel | @@ -2676,6 +2756,7 @@ CRUD operations for Email records. | Subcommand | Description | |------------|-------------| | `list` | List all email records | +| `find-first` | Find first matching email record | | `get` | Get a email by id | | `create` | Create a new email | | `update` | Update an existing email | @@ -2703,6 +2784,7 @@ CRUD operations for PhoneNumber records. | Subcommand | Description | |------------|-------------| | `list` | List all phoneNumber records | +| `find-first` | Find first matching phoneNumber record | | `get` | Get a phoneNumber by id | | `create` | Create a new phoneNumber | | `update` | Update an existing phoneNumber | @@ -2731,6 +2813,7 @@ CRUD operations for CryptoAddress records. | Subcommand | Description | |------------|-------------| | `list` | List all cryptoAddress records | +| `find-first` | Find first matching cryptoAddress record | | `get` | Get a cryptoAddress by id | | `create` | Create a new cryptoAddress | | `update` | Update an existing cryptoAddress | @@ -2758,6 +2841,7 @@ CRUD operations for ConnectedAccount records. | Subcommand | Description | |------------|-------------| | `list` | List all connectedAccount records | +| `find-first` | Find first matching connectedAccount record | | `get` | Get a connectedAccount by id | | `create` | Create a new connectedAccount | | `update` | Update an existing connectedAccount | @@ -2786,6 +2870,7 @@ CRUD operations for Invite records. | Subcommand | Description | |------------|-------------| | `list` | List all invite records | +| `find-first` | Find first matching invite record | | `get` | Get a invite by id | | `create` | Create a new invite | | `update` | Update an existing invite | @@ -2817,6 +2902,7 @@ CRUD operations for ClaimedInvite records. | Subcommand | Description | |------------|-------------| | `list` | List all claimedInvite records | +| `find-first` | Find first matching claimedInvite record | | `get` | Get a claimedInvite by id | | `create` | Create a new claimedInvite | | `update` | Update an existing claimedInvite | @@ -2842,6 +2928,7 @@ CRUD operations for OrgInvite records. | Subcommand | Description | |------------|-------------| | `list` | List all orgInvite records | +| `find-first` | Find first matching orgInvite record | | `get` | Get a orgInvite by id | | `create` | Create a new orgInvite | | `update` | Update an existing orgInvite | @@ -2876,6 +2963,7 @@ CRUD operations for OrgClaimedInvite records. | Subcommand | Description | |------------|-------------| | `list` | List all orgClaimedInvite records | +| `find-first` | Find first matching orgClaimedInvite record | | `get` | Get a orgClaimedInvite by id | | `create` | Create a new orgClaimedInvite | | `update` | Update an existing orgClaimedInvite | @@ -2903,6 +2991,7 @@ CRUD operations for AuditLog records. | Subcommand | Description | |------------|-------------| | `list` | List all auditLog records | +| `find-first` | Find first matching auditLog record | | `get` | Get a auditLog by id | | `create` | Create a new auditLog | | `update` | Update an existing auditLog | @@ -2931,6 +3020,7 @@ CRUD operations for Ref records. | Subcommand | Description | |------------|-------------| | `list` | List all ref records | +| `find-first` | Find first matching ref record | | `get` | Get a ref by id | | `create` | Create a new ref | | `update` | Update an existing ref | @@ -2956,6 +3046,7 @@ CRUD operations for Store records. | Subcommand | Description | |------------|-------------| | `list` | List all store records | +| `find-first` | Find first matching store record | | `get` | Get a store by id | | `create` | Create a new store | | `update` | Update an existing store | @@ -2981,6 +3072,7 @@ CRUD operations for AppPermissionDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all appPermissionDefault records | +| `find-first` | Find first matching appPermissionDefault record | | `get` | Get a appPermissionDefault by id | | `create` | Create a new appPermissionDefault | | `update` | Update an existing appPermissionDefault | @@ -3002,6 +3094,7 @@ CRUD operations for RoleType records. | Subcommand | Description | |------------|-------------| | `list` | List all roleType records | +| `find-first` | Find first matching roleType record | | `get` | Get a roleType by id | | `create` | Create a new roleType | | `update` | Update an existing roleType | @@ -3023,6 +3116,7 @@ CRUD operations for MigrateFile records. | Subcommand | Description | |------------|-------------| | `list` | List all migrateFile records | +| `find-first` | Find first matching migrateFile record | | `get` | Get a migrateFile by id | | `create` | Create a new migrateFile | | `update` | Update an existing migrateFile | @@ -3045,6 +3139,7 @@ CRUD operations for AppLimitDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all appLimitDefault records | +| `find-first` | Find first matching appLimitDefault record | | `get` | Get a appLimitDefault by id | | `create` | Create a new appLimitDefault | | `update` | Update an existing appLimitDefault | @@ -3068,6 +3163,7 @@ CRUD operations for OrgLimitDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all orgLimitDefault records | +| `find-first` | Find first matching orgLimitDefault record | | `get` | Get a orgLimitDefault by id | | `create` | Create a new orgLimitDefault | | `update` | Update an existing orgLimitDefault | @@ -3084,35 +3180,6 @@ CRUD operations for OrgLimitDefault records. **Required create fields:** `name` **Optional create fields (backend defaults):** `max` -### `node-type-registry` - -CRUD operations for NodeTypeRegistry records. - -| Subcommand | Description | -|------------|-------------| -| `list` | List all nodeTypeRegistry records | -| `get` | Get a nodeTypeRegistry by name | -| `create` | Create a new nodeTypeRegistry | -| `update` | Update an existing nodeTypeRegistry | -| `delete` | Delete a nodeTypeRegistry | - -**Fields:** - -| Field | Type | -|-------|------| -| `name` | String | -| `slug` | String | -| `category` | String | -| `displayName` | String | -| `description` | String | -| `parameterSchema` | JSON | -| `tags` | String | -| `createdAt` | Datetime | -| `updatedAt` | Datetime | - -**Required create fields:** `slug`, `category` -**Optional create fields (backend defaults):** `displayName`, `description`, `parameterSchema`, `tags` - ### `membership-type` CRUD operations for MembershipType records. @@ -3120,6 +3187,7 @@ CRUD operations for MembershipType records. | Subcommand | Description | |------------|-------------| | `list` | List all membershipType records | +| `find-first` | Find first matching membershipType record | | `get` | Get a membershipType by id | | `create` | Create a new membershipType | | `update` | Update an existing membershipType | @@ -3143,6 +3211,7 @@ CRUD operations for Commit records. | Subcommand | Description | |------------|-------------| | `list` | List all commit records | +| `find-first` | Find first matching commit record | | `get` | Get a commit by id | | `create` | Create a new commit | | `update` | Update an existing commit | @@ -3172,6 +3241,7 @@ CRUD operations for AppMembershipDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all appMembershipDefault records | +| `find-first` | Find first matching appMembershipDefault record | | `get` | Get a appMembershipDefault by id | | `create` | Create a new appMembershipDefault | | `update` | Update an existing appMembershipDefault | @@ -3198,6 +3268,7 @@ CRUD operations for RlsModule records. | Subcommand | Description | |------------|-------------| | `list` | List all rlsModule records | +| `find-first` | Find first matching rlsModule record | | `get` | Get a rlsModule by id | | `create` | Create a new rlsModule | | `update` | Update an existing rlsModule | @@ -3222,6 +3293,38 @@ CRUD operations for RlsModule records. **Required create fields:** `databaseId` **Optional create fields (backend defaults):** `schemaId`, `privateSchemaId`, `sessionCredentialsTableId`, `sessionsTableId`, `usersTableId`, `authenticate`, `authenticateStrict`, `currentRole`, `currentRoleId` +### `node-type-registry` + +CRUD operations for NodeTypeRegistry records. + +| Subcommand | Description | +|------------|-------------| +| `list` | List all nodeTypeRegistry records | +| `find-first` | Find first matching nodeTypeRegistry record | +| `get` | Get a nodeTypeRegistry by name | +| `create` | Create a new nodeTypeRegistry | +| `update` | Update an existing nodeTypeRegistry | +| `delete` | Delete a nodeTypeRegistry | + +**Fields:** + +| Field | Type | +|-------|------| +| `name` | String | +| `slug` | String | +| `category` | String | +| `displayName` | String | +| `description` | String | +| `summary` | String | +| `parameterSchema` | JSON | +| `guidance` | JSON | +| `tags` | String | +| `createdAt` | Datetime | +| `updatedAt` | Datetime | + +**Required create fields:** `slug`, `category` +**Optional create fields (backend defaults):** `displayName`, `description`, `summary`, `parameterSchema`, `guidance`, `tags` + ### `org-membership-default` CRUD operations for OrgMembershipDefault records. @@ -3229,6 +3332,7 @@ CRUD operations for OrgMembershipDefault records. | Subcommand | Description | |------------|-------------| | `list` | List all orgMembershipDefault records | +| `find-first` | Find first matching orgMembershipDefault record | | `get` | Get a orgMembershipDefault by id | | `create` | Create a new orgMembershipDefault | | `update` | Update an existing orgMembershipDefault | @@ -3258,6 +3362,7 @@ CRUD operations for SqlAction records. | Subcommand | Description | |------------|-------------| | `list` | List all sqlAction records | +| `find-first` | Find first matching sqlAction record | | `get` | Get a sqlAction by id | | `create` | Create a new sqlAction | | `update` | Update an existing sqlAction | @@ -3290,6 +3395,8 @@ CRUD operations for User records. | Subcommand | Description | |------------|-------------| | `list` | List all user records | +| `find-first` | Find first matching user record | +| `search ` | Search user records | | `get` | Get a user by id | | `create` | Create a new user | | `update` | Update an existing user | @@ -3312,9 +3419,32 @@ CRUD operations for User records. | `searchScore` | Float | **Optional create fields (backend defaults):** `username`, `displayName`, `profilePicture`, `type` -> **Unified Search API fields:** `displayNameTrgmSimilarity`, `searchScore` +> **Unified Search API fields:** `searchTsv`, `displayNameTrgmSimilarity`, `searchScore` > Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. +**Search Examples:** + +*Full-text search via tsvector (`searchTsv`):* +```bash +csdk user list --where.searchTsv "search query" --select title,tsvRank +``` + +*Fuzzy search via trigram similarity (`trgmDisplayName`):* +```bash +csdk user list --where.trgmDisplayName.value "approximate query" --where.trgmDisplayName.threshold 0.3 --select title,displayNameTrgmSimilarity +``` + +*Composite search (fullTextSearch dispatches to all text adapters):* +```bash +csdk user list --where.fullTextSearch "search query" --select title,tsvRank,displayNameTrgmSimilarity,searchScore +``` + +*Search with pagination and field projection:* +```bash +csdk user list --where.fullTextSearch "query" --limit 10 --select id,title,searchScore +csdk user search "query" --limit 10 --select id,title,searchScore +``` + ### `ast-migration` @@ -3323,6 +3453,7 @@ CRUD operations for AstMigration records. | Subcommand | Description | |------------|-------------| | `list` | List all astMigration records | +| `find-first` | Find first matching astMigration record | | `get` | Get a astMigration by id | | `create` | Create a new astMigration | | `update` | Update an existing astMigration | @@ -3355,6 +3486,7 @@ CRUD operations for AppMembership records. | Subcommand | Description | |------------|-------------| | `list` | List all appMembership records | +| `find-first` | Find first matching appMembership record | | `get` | Get a appMembership by id | | `create` | Create a new appMembership | | `update` | Update an existing appMembership | @@ -3391,6 +3523,7 @@ CRUD operations for HierarchyModule records. | Subcommand | Description | |------------|-------------| | `list` | List all hierarchyModule records | +| `find-first` | Find first matching hierarchyModule record | | `get` | Get a hierarchyModule by id | | `create` | Create a new hierarchyModule | | `update` | Update an existing hierarchyModule | diff --git a/sdk/constructive-cli/src/public/cli/commands.ts b/sdk/constructive-cli/src/public/cli/commands.ts index 92cee5045..86839474b 100644 --- a/sdk/constructive-cli/src/public/cli/commands.ts +++ b/sdk/constructive-cli/src/public/cli/commands.ts @@ -102,11 +102,11 @@ import roleTypeCmd from './commands/role-type'; import migrateFileCmd from './commands/migrate-file'; import appLimitDefaultCmd from './commands/app-limit-default'; import orgLimitDefaultCmd from './commands/org-limit-default'; -import nodeTypeRegistryCmd from './commands/node-type-registry'; import membershipTypeCmd from './commands/membership-type'; import commitCmd from './commands/commit'; import appMembershipDefaultCmd from './commands/app-membership-default'; import rlsModuleCmd from './commands/rls-module'; +import nodeTypeRegistryCmd from './commands/node-type-registry'; import orgMembershipDefaultCmd from './commands/org-membership-default'; import sqlActionCmd from './commands/sql-action'; import userCmd from './commands/user'; @@ -274,11 +274,11 @@ const createCommandMap: () => Record< 'migrate-file': migrateFileCmd, 'app-limit-default': appLimitDefaultCmd, 'org-limit-default': orgLimitDefaultCmd, - 'node-type-registry': nodeTypeRegistryCmd, 'membership-type': membershipTypeCmd, commit: commitCmd, 'app-membership-default': appMembershipDefaultCmd, 'rls-module': rlsModuleCmd, + 'node-type-registry': nodeTypeRegistryCmd, 'org-membership-default': orgMembershipDefaultCmd, 'sql-action': sqlActionCmd, user: userCmd, @@ -342,7 +342,7 @@ const createCommandMap: () => Record< 'verify-totp': verifyTotpCmd, }); const usage = - "\ncsdk \n\nCommands:\n context Manage API contexts\n auth Manage authentication\n get-all-record getAllRecord CRUD operations\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n object object CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n table-template-module tableTemplateModule CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n org-limit orgLimit CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n connected-account connectedAccount CRUD operations\n invite invite CRUD operations\n claimed-invite claimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n role-type roleType CRUD operations\n migrate-file migrateFile CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n node-type-registry nodeTypeRegistry CRUD operations\n membership-type membershipType CRUD operations\n commit commit CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n rls-module rlsModule CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n sql-action sqlAction CRUD operations\n user user CRUD operations\n ast-migration astMigration CRUD operations\n app-membership appMembership CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-ip-address currentIpAddress\n current-user-agent currentUserAgent\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n submit-invite-code submitInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a draft blueprint definition. Four phases: (1) create tables with nodes[], fields, and policies[], (2) create relations between tables, (3) create indexes on table fields (supports BTREE, HNSW, GIN, GIST, BM25, etc.), (4) create full-text search configurations with weighted multi-field TSVector support. nodes[] entries can be strings or {$type, data} objects. Relations use $type for relation_type with junction config in data. Indexes reference table_ref + column name(s) and are resolved to field_ids. Full-text searches reference table_ref + tsvector field + source fields with weights/langs. Builds a ref_map of local ref names to created table UUIDs. Updates blueprint status to constructed (or failed with error_details). Returns the ref_map.\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n provision-database-with-user provisionDatabaseWithUser\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n apply-rls applyRls\n sign-in-one-time-token signInOneTimeToken\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n sign-in signIn\n sign-up signUp\n one-time-token oneTimeToken\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n verify-password verifyPassword\n verify-totp verifyTotp\n\n --help, -h Show this help message\n --version, -v Show version\n"; + "\ncsdk \n\nCommands:\n context Manage API contexts\n auth Manage authentication\n get-all-record getAllRecord CRUD operations\n org-get-managers-record orgGetManagersRecord CRUD operations\n org-get-subordinates-record orgGetSubordinatesRecord CRUD operations\n object object CRUD operations\n app-permission appPermission CRUD operations\n org-permission orgPermission CRUD operations\n app-level-requirement appLevelRequirement CRUD operations\n database database CRUD operations\n schema schema CRUD operations\n table table CRUD operations\n check-constraint checkConstraint CRUD operations\n field field CRUD operations\n foreign-key-constraint foreignKeyConstraint CRUD operations\n full-text-search fullTextSearch CRUD operations\n index index CRUD operations\n policy policy CRUD operations\n primary-key-constraint primaryKeyConstraint CRUD operations\n table-grant tableGrant CRUD operations\n trigger trigger CRUD operations\n unique-constraint uniqueConstraint CRUD operations\n view view CRUD operations\n view-table viewTable CRUD operations\n view-grant viewGrant CRUD operations\n view-rule viewRule CRUD operations\n embedding-chunk embeddingChunk CRUD operations\n table-template-module tableTemplateModule CRUD operations\n secure-table-provision secureTableProvision CRUD operations\n relation-provision relationProvision CRUD operations\n schema-grant schemaGrant CRUD operations\n default-privilege defaultPrivilege CRUD operations\n enum enum CRUD operations\n api-schema apiSchema CRUD operations\n api-module apiModule CRUD operations\n domain domain CRUD operations\n site-metadatum siteMetadatum CRUD operations\n site-module siteModule CRUD operations\n site-theme siteTheme CRUD operations\n trigger-function triggerFunction CRUD operations\n database-transfer databaseTransfer CRUD operations\n api api CRUD operations\n site site CRUD operations\n app app CRUD operations\n connected-accounts-module connectedAccountsModule CRUD operations\n crypto-addresses-module cryptoAddressesModule CRUD operations\n crypto-auth-module cryptoAuthModule CRUD operations\n default-ids-module defaultIdsModule CRUD operations\n denormalized-table-field denormalizedTableField CRUD operations\n emails-module emailsModule CRUD operations\n encrypted-secrets-module encryptedSecretsModule CRUD operations\n invites-module invitesModule CRUD operations\n levels-module levelsModule CRUD operations\n limits-module limitsModule CRUD operations\n membership-types-module membershipTypesModule CRUD operations\n memberships-module membershipsModule CRUD operations\n permissions-module permissionsModule CRUD operations\n phone-numbers-module phoneNumbersModule CRUD operations\n profiles-module profilesModule CRUD operations\n secrets-module secretsModule CRUD operations\n sessions-module sessionsModule CRUD operations\n user-auth-module userAuthModule CRUD operations\n users-module usersModule CRUD operations\n blueprint blueprint CRUD operations\n blueprint-template blueprintTemplate CRUD operations\n database-provision-module databaseProvisionModule CRUD operations\n app-admin-grant appAdminGrant CRUD operations\n app-owner-grant appOwnerGrant CRUD operations\n app-grant appGrant CRUD operations\n org-membership orgMembership CRUD operations\n org-member orgMember CRUD operations\n org-admin-grant orgAdminGrant CRUD operations\n org-owner-grant orgOwnerGrant CRUD operations\n org-grant orgGrant CRUD operations\n org-chart-edge orgChartEdge CRUD operations\n org-chart-edge-grant orgChartEdgeGrant CRUD operations\n org-permission-default orgPermissionDefault CRUD operations\n app-limit appLimit CRUD operations\n org-limit orgLimit CRUD operations\n app-step appStep CRUD operations\n app-achievement appAchievement CRUD operations\n app-level appLevel CRUD operations\n email email CRUD operations\n phone-number phoneNumber CRUD operations\n crypto-address cryptoAddress CRUD operations\n connected-account connectedAccount CRUD operations\n invite invite CRUD operations\n claimed-invite claimedInvite CRUD operations\n org-invite orgInvite CRUD operations\n org-claimed-invite orgClaimedInvite CRUD operations\n audit-log auditLog CRUD operations\n ref ref CRUD operations\n store store CRUD operations\n app-permission-default appPermissionDefault CRUD operations\n role-type roleType CRUD operations\n migrate-file migrateFile CRUD operations\n app-limit-default appLimitDefault CRUD operations\n org-limit-default orgLimitDefault CRUD operations\n membership-type membershipType CRUD operations\n commit commit CRUD operations\n app-membership-default appMembershipDefault CRUD operations\n rls-module rlsModule CRUD operations\n node-type-registry nodeTypeRegistry CRUD operations\n org-membership-default orgMembershipDefault CRUD operations\n sql-action sqlAction CRUD operations\n user user CRUD operations\n ast-migration astMigration CRUD operations\n app-membership appMembership CRUD operations\n hierarchy-module hierarchyModule CRUD operations\n current-user-id currentUserId\n current-ip-address currentIpAddress\n current-user-agent currentUserAgent\n app-permissions-get-padded-mask appPermissionsGetPaddedMask\n org-permissions-get-padded-mask orgPermissionsGetPaddedMask\n steps-achieved stepsAchieved\n rev-parse revParse\n org-is-manager-of orgIsManagerOf\n app-permissions-get-mask appPermissionsGetMask\n org-permissions-get-mask orgPermissionsGetMask\n app-permissions-get-mask-by-names appPermissionsGetMaskByNames\n org-permissions-get-mask-by-names orgPermissionsGetMaskByNames\n get-all-objects-from-root Reads and enables pagination through a set of `Object`.\n get-path-objects-from-root Reads and enables pagination through a set of `Object`.\n get-object-at-path getObjectAtPath\n app-permissions-get-by-mask Reads and enables pagination through a set of `AppPermission`.\n org-permissions-get-by-mask Reads and enables pagination through a set of `OrgPermission`.\n steps-required Reads and enables pagination through a set of `AppLevelRequirement`.\n current-user currentUser\n send-account-deletion-email sendAccountDeletionEmail\n sign-out signOut\n accept-database-transfer acceptDatabaseTransfer\n cancel-database-transfer cancelDatabaseTransfer\n reject-database-transfer rejectDatabaseTransfer\n submit-invite-code submitInviteCode\n submit-org-invite-code submitOrgInviteCode\n check-password checkPassword\n confirm-delete-account confirmDeleteAccount\n set-password setPassword\n verify-email verifyEmail\n freeze-objects freezeObjects\n init-empty-repo initEmptyRepo\n construct-blueprint Executes a draft blueprint definition. Four phases: (1) create tables with nodes[], fields, and policies[], (2) create relations between tables, (3) create indexes on table fields (supports BTREE, HNSW, GIN, GIST, BM25, etc.), (4) create full-text search configurations with weighted multi-field TSVector support. nodes[] entries can be strings or {$type, data} objects. Relations use $type for relation_type with junction config in data. Indexes reference table_ref + column name(s) and are resolved to field_ids. Full-text searches reference table_ref + tsvector field + source fields with weights/langs. Builds a ref_map of local ref names to created table UUIDs. Updates blueprint status to constructed (or failed with error_details). Returns the ref_map.\n reset-password resetPassword\n remove-node-at-path removeNodeAtPath\n set-data-at-path setDataAtPath\n set-props-and-commit setPropsAndCommit\n copy-template-to-blueprint Creates a new blueprint by copying a template definition. Checks visibility: owners can always copy their own templates, others require public visibility. Increments the template copy_count. Returns the new blueprint ID.\n provision-database-with-user provisionDatabaseWithUser\n bootstrap-user bootstrapUser\n set-field-order setFieldOrder\n insert-node-at-path insertNodeAtPath\n update-node-at-path updateNodeAtPath\n set-and-commit setAndCommit\n apply-rls applyRls\n sign-in-one-time-token signInOneTimeToken\n create-user-database Creates a new user database with all required modules, permissions, and RLS policies.\n\nParameters:\n - database_name: Name for the new database (required)\n - owner_id: UUID of the owner user (required)\n - include_invites: Include invite system (default: true)\n - include_groups: Include group-level memberships (default: false)\n - include_levels: Include levels/achievements (default: false)\n - bitlen: Bit length for permission masks (default: 64)\n - tokens_expiration: Token expiration interval (default: 30 days)\n\nReturns the database_id UUID of the newly created database.\n\nExample usage:\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid);\n SELECT metaschema_public.create_user_database('my_app', 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'::uuid, true, true); -- with invites and groups\n\n extend-token-expires extendTokenExpires\n sign-in signIn\n sign-up signUp\n one-time-token oneTimeToken\n send-verification-email sendVerificationEmail\n forgot-password forgotPassword\n verify-password verifyPassword\n verify-totp verifyTotp\n\n --help, -h Show this help message\n --version, -v Show version\n"; export const commands = async ( argv: Partial>, prompter: Inquirerer, diff --git a/sdk/constructive-cli/src/public/cli/commands/api-module.ts b/sdk/constructive-cli/src/public/cli/commands/api-module.ts index 1131ae3fa..934971a10 100644 --- a/sdk/constructive-cli/src/public/cli/commands/api-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/api-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateApiModuleInput, ApiModulePatch } from '../../orm/input-types'; +import type { + CreateApiModuleInput, + ApiModulePatch, + ApiModuleSelect, + ApiModuleFilter, + ApiModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { data: 'json', }; const usage = - '\napi-module \n\nCommands:\n list List all apiModule records\n get Get a apiModule by ID\n create Create a new apiModule\n update Update an existing apiModule\n delete Delete a apiModule\n\n --help, -h Show this help message\n'; + '\napi-module \n\nCommands:\n list List apiModule records\n find-first Find first matching apiModule record\n get Get a apiModule by ID\n create Create a new apiModule\n update Update an existing apiModule\n delete Delete a apiModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + apiId: true, + name: true, + data: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ApiModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.apiModule - .findMany({ - select: { - id: true, - databaseId: true, - apiId: true, - name: true, - data: true, - }, - }) - .execute(); + const result = await client.apiModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + apiId: true, + name: true, + data: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ApiModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.apiModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/api-schema.ts b/sdk/constructive-cli/src/public/cli/commands/api-schema.ts index 0154cded7..aa060f650 100644 --- a/sdk/constructive-cli/src/public/cli/commands/api-schema.ts +++ b/sdk/constructive-cli/src/public/cli/commands/api-schema.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateApiSchemaInput, ApiSchemaPatch } from '../../orm/input-types'; +import type { + CreateApiSchemaInput, + ApiSchemaPatch, + ApiSchemaSelect, + ApiSchemaFilter, + ApiSchemaOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -15,7 +22,7 @@ const fieldSchema: FieldSchema = { apiId: 'uuid', }; const usage = - '\napi-schema \n\nCommands:\n list List all apiSchema records\n get Get a apiSchema by ID\n create Create a new apiSchema\n update Update an existing apiSchema\n delete Delete a apiSchema\n\n --help, -h Show this help message\n'; + '\napi-schema \n\nCommands:\n list List apiSchema records\n find-first Find first matching apiSchema record\n get Get a apiSchema by ID\n create Create a new apiSchema\n update Update an existing apiSchema\n delete Delete a apiSchema\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -32,7 +39,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -47,6 +54,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -60,19 +69,21 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + apiId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ApiSchemaSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.apiSchema - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - apiId: true, - }, - }) - .execute(); + const result = await client.apiSchema.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -82,6 +93,30 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + apiId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ApiSchemaSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.apiSchema.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/api.ts b/sdk/constructive-cli/src/public/cli/commands/api.ts index cdb904246..46113cd37 100644 --- a/sdk/constructive-cli/src/public/cli/commands/api.ts +++ b/sdk/constructive-cli/src/public/cli/commands/api.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateApiInput, ApiPatch } from '../../orm/input-types'; +import type { + CreateApiInput, + ApiPatch, + ApiSelect, + ApiFilter, + ApiOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { isPublic: 'boolean', }; const usage = - '\napi \n\nCommands:\n list List all api records\n get Get a api by ID\n create Create a new api\n update Update an existing api\n delete Delete a api\n\n --help, -h Show this help message\n'; + '\napi \n\nCommands:\n list List api records\n find-first Find first matching api record\n get Get a api by ID\n create Create a new api\n update Update an existing api\n delete Delete a api\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + dbname: true, + roleName: true, + anonRole: true, + isPublic: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ApiSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.api - .findMany({ - select: { - id: true, - databaseId: true, - name: true, - dbname: true, - roleName: true, - anonRole: true, - isPublic: true, - }, - }) - .execute(); + const result = await client.api.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + dbname: true, + roleName: true, + anonRole: true, + isPublic: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ApiSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.api.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts b/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts index c80cf7a91..103d9d6aa 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-achievement.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppAchievementInput, AppAchievementPatch } from '../../orm/input-types'; +import type { + CreateAppAchievementInput, + AppAchievementPatch, + AppAchievementSelect, + AppAchievementFilter, + AppAchievementOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-achievement \n\nCommands:\n list List all appAchievement records\n get Get a appAchievement by ID\n create Create a new appAchievement\n update Update an existing appAchievement\n delete Delete a appAchievement\n\n --help, -h Show this help message\n'; + '\napp-achievement \n\nCommands:\n list List appAchievement records\n find-first Find first matching appAchievement record\n get Get a appAchievement by ID\n create Create a new appAchievement\n update Update an existing appAchievement\n delete Delete a appAchievement\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppAchievementSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appAchievement - .findMany({ - select: { - id: true, - actorId: true, - name: true, - count: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appAchievement.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppAchievementSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appAchievement.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts b/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts index f0c6375a8..502b8b80b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-admin-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppAdminGrantInput, AppAdminGrantPatch } from '../../orm/input-types'; +import type { + CreateAppAdminGrantInput, + AppAdminGrantPatch, + AppAdminGrantSelect, + AppAdminGrantFilter, + AppAdminGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-admin-grant \n\nCommands:\n list List all appAdminGrant records\n get Get a appAdminGrant by ID\n create Create a new appAdminGrant\n update Update an existing appAdminGrant\n delete Delete a appAdminGrant\n\n --help, -h Show this help message\n'; + '\napp-admin-grant \n\nCommands:\n list List appAdminGrant records\n find-first Find first matching appAdminGrant record\n get Get a appAdminGrant by ID\n create Create a new appAdminGrant\n update Update an existing appAdminGrant\n delete Delete a appAdminGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppAdminGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appAdminGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appAdminGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppAdminGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appAdminGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-grant.ts b/sdk/constructive-cli/src/public/cli/commands/app-grant.ts index 10e06e142..5d49497b5 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppGrantInput, AppGrantPatch } from '../../orm/input-types'; +import type { + CreateAppGrantInput, + AppGrantPatch, + AppGrantSelect, + AppGrantFilter, + AppGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-grant \n\nCommands:\n list List all appGrant records\n get Get a appGrant by ID\n create Create a new appGrant\n update Update an existing appGrant\n delete Delete a appGrant\n\n --help, -h Show this help message\n'; + '\napp-grant \n\nCommands:\n list List appGrant records\n find-first Find first matching appGrant record\n get Get a appGrant by ID\n create Create a new appGrant\n update Update an existing appGrant\n delete Delete a appGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appGrant - .findMany({ - select: { - id: true, - permissions: true, - isGrant: true, - actorId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts b/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts index 1e6781802..09a1ca603 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-level-requirement.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateAppLevelRequirementInput, AppLevelRequirementPatch, + AppLevelRequirementSelect, + AppLevelRequirementFilter, + AppLevelRequirementOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -22,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-level-requirement \n\nCommands:\n list List all appLevelRequirement records\n get Get a appLevelRequirement by ID\n create Create a new appLevelRequirement\n update Update an existing appLevelRequirement\n delete Delete a appLevelRequirement\n\n --help, -h Show this help message\n'; + '\napp-level-requirement \n\nCommands:\n list List appLevelRequirement records\n find-first Find first matching appLevelRequirement record\n get Get a appLevelRequirement by ID\n create Create a new appLevelRequirement\n update Update an existing appLevelRequirement\n delete Delete a appLevelRequirement\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -54,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -67,23 +73,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + level: true, + description: true, + requiredCount: true, + priority: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + AppLevelRequirementSelect, + AppLevelRequirementFilter, + never, + AppLevelRequirementOrderBy + > & { + select: AppLevelRequirementSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLevelRequirement - .findMany({ - select: { - id: true, - name: true, - level: true, - description: true, - requiredCount: true, - priority: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appLevelRequirement.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -93,6 +106,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + level: true, + description: true, + requiredCount: true, + priority: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLevelRequirementSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLevelRequirement.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-level.ts b/sdk/constructive-cli/src/public/cli/commands/app-level.ts index 346ad0c7f..5f5cadf30 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-level.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-level.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppLevelInput, AppLevelPatch } from '../../orm/input-types'; +import type { + CreateAppLevelInput, + AppLevelPatch, + AppLevelSelect, + AppLevelFilter, + AppLevelOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-level \n\nCommands:\n list List all appLevel records\n get Get a appLevel by ID\n create Create a new appLevel\n update Update an existing appLevel\n delete Delete a appLevel\n\n --help, -h Show this help message\n'; + '\napp-level \n\nCommands:\n list List appLevel records\n find-first Find first matching appLevel record\n get Get a appLevel by ID\n create Create a new appLevel\n update Update an existing appLevel\n delete Delete a appLevel\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + description: true, + image: true, + ownerId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppLevelSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLevel - .findMany({ - select: { - id: true, - name: true, - description: true, - image: true, - ownerId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appLevel.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + description: true, + image: true, + ownerId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLevelSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLevel.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts b/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts index 462093eec..6894a28e4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-limit-default.ts @@ -5,16 +5,23 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppLimitDefaultInput, AppLimitDefaultPatch } from '../../orm/input-types'; +import type { + CreateAppLimitDefaultInput, + AppLimitDefaultPatch, + AppLimitDefaultSelect, + AppLimitDefaultFilter, + AppLimitDefaultOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', }; const usage = - '\napp-limit-default \n\nCommands:\n list List all appLimitDefault records\n get Get a appLimitDefault by ID\n create Create a new appLimitDefault\n update Update an existing appLimitDefault\n delete Delete a appLimitDefault\n\n --help, -h Show this help message\n'; + '\napp-limit-default \n\nCommands:\n list List appLimitDefault records\n find-first Find first matching appLimitDefault record\n get Get a appLimitDefault by ID\n create Create a new appLimitDefault\n update Update an existing appLimitDefault\n delete Delete a appLimitDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -31,7 +38,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -46,6 +53,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -59,18 +68,20 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppLimitDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLimitDefault - .findMany({ - select: { - id: true, - name: true, - max: true, - }, - }) - .execute(); + const result = await client.appLimitDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -80,6 +91,29 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLimitDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLimitDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-limit.ts b/sdk/constructive-cli/src/public/cli/commands/app-limit.ts index a7dc6b161..715ec43b7 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-limit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-limit.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppLimitInput, AppLimitPatch } from '../../orm/input-types'; +import type { + CreateAppLimitInput, + AppLimitPatch, + AppLimitSelect, + AppLimitFilter, + AppLimitOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { max: 'int', }; const usage = - '\napp-limit \n\nCommands:\n list List all appLimit records\n get Get a appLimit by ID\n create Create a new appLimit\n update Update an existing appLimit\n delete Delete a appLimit\n\n --help, -h Show this help message\n'; + '\napp-limit \n\nCommands:\n list List appLimit records\n find-first Find first matching appLimit record\n get Get a appLimit by ID\n create Create a new appLimit\n update Update an existing appLimit\n delete Delete a appLimit\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppLimitSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appLimit - .findMany({ - select: { - id: true, - name: true, - actorId: true, - num: true, - max: true, - }, - }) - .execute(); + const result = await client.appLimit.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppLimitSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appLimit.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts b/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts index d739ca433..ca4257671 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-membership-default.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateAppMembershipDefaultInput, AppMembershipDefaultPatch, + AppMembershipDefaultSelect, + AppMembershipDefaultFilter, + AppMembershipDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -21,7 +25,7 @@ const fieldSchema: FieldSchema = { isVerified: 'boolean', }; const usage = - '\napp-membership-default \n\nCommands:\n list List all appMembershipDefault records\n get Get a appMembershipDefault by ID\n create Create a new appMembershipDefault\n update Update an existing appMembershipDefault\n delete Delete a appMembershipDefault\n\n --help, -h Show this help message\n'; + '\napp-membership-default \n\nCommands:\n list List appMembershipDefault records\n find-first Find first matching appMembershipDefault record\n get Get a appMembershipDefault by ID\n create Create a new appMembershipDefault\n update Update an existing appMembershipDefault\n delete Delete a appMembershipDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -38,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -53,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -66,22 +72,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isVerified: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + AppMembershipDefaultSelect, + AppMembershipDefaultFilter, + never, + AppMembershipDefaultOrderBy + > & { + select: AppMembershipDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appMembershipDefault - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - isVerified: true, - }, - }) - .execute(); + const result = await client.appMembershipDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -91,6 +104,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isVerified: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppMembershipDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appMembershipDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-membership.ts b/sdk/constructive-cli/src/public/cli/commands/app-membership.ts index b85cb2d00..8d960a914 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-membership.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-membership.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppMembershipInput, AppMembershipPatch } from '../../orm/input-types'; +import type { + CreateAppMembershipInput, + AppMembershipPatch, + AppMembershipSelect, + AppMembershipFilter, + AppMembershipOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -27,7 +34,7 @@ const fieldSchema: FieldSchema = { profileId: 'uuid', }; const usage = - '\napp-membership \n\nCommands:\n list List all appMembership records\n get Get a appMembership by ID\n create Create a new appMembership\n update Update an existing appMembership\n delete Delete a appMembership\n\n --help, -h Show this help message\n'; + '\napp-membership \n\nCommands:\n list List appMembership records\n find-first Find first matching appMembership record\n get Get a appMembership by ID\n create Create a new appMembership\n update Update an existing appMembership\n delete Delete a appMembership\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -44,7 +51,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -59,6 +66,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -72,31 +81,33 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isVerified: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + profileId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppMembershipSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appMembership - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - isBanned: true, - isDisabled: true, - isVerified: true, - isActive: true, - isOwner: true, - isAdmin: true, - permissions: true, - granted: true, - actorId: true, - profileId: true, - }, - }) - .execute(); + const result = await client.appMembership.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -106,6 +117,42 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isVerified: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + profileId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppMembershipSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appMembership.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts b/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts index 936434685..c459e0a07 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-owner-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppOwnerGrantInput, AppOwnerGrantPatch } from '../../orm/input-types'; +import type { + CreateAppOwnerGrantInput, + AppOwnerGrantPatch, + AppOwnerGrantSelect, + AppOwnerGrantFilter, + AppOwnerGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-owner-grant \n\nCommands:\n list List all appOwnerGrant records\n get Get a appOwnerGrant by ID\n create Create a new appOwnerGrant\n update Update an existing appOwnerGrant\n delete Delete a appOwnerGrant\n\n --help, -h Show this help message\n'; + '\napp-owner-grant \n\nCommands:\n list List appOwnerGrant records\n find-first Find first matching appOwnerGrant record\n get Get a appOwnerGrant by ID\n create Create a new appOwnerGrant\n update Update an existing appOwnerGrant\n delete Delete a appOwnerGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppOwnerGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appOwnerGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appOwnerGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppOwnerGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appOwnerGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts b/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts index 75f8427a6..c25b842a3 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permission-default.ts @@ -5,18 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateAppPermissionDefaultInput, AppPermissionDefaultPatch, + AppPermissionDefaultSelect, + AppPermissionDefaultFilter, + AppPermissionDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', }; const usage = - '\napp-permission-default \n\nCommands:\n list List all appPermissionDefault records\n get Get a appPermissionDefault by ID\n create Create a new appPermissionDefault\n update Update an existing appPermissionDefault\n delete Delete a appPermissionDefault\n\n --help, -h Show this help message\n'; + '\napp-permission-default \n\nCommands:\n list List appPermissionDefault records\n find-first Find first matching appPermissionDefault record\n get Get a appPermissionDefault by ID\n create Create a new appPermissionDefault\n update Update an existing appPermissionDefault\n delete Delete a appPermissionDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,17 +67,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + AppPermissionDefaultSelect, + AppPermissionDefaultFilter, + never, + AppPermissionDefaultOrderBy + > & { + select: AppPermissionDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appPermissionDefault - .findMany({ - select: { - id: true, - permissions: true, - }, - }) - .execute(); + const result = await client.appPermissionDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -81,6 +94,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppPermissionDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appPermissionDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-permission.ts b/sdk/constructive-cli/src/public/cli/commands/app-permission.ts index 61f8849ca..7a354db18 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-permission.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-permission.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppPermissionInput, AppPermissionPatch } from '../../orm/input-types'; +import type { + CreateAppPermissionInput, + AppPermissionPatch, + AppPermissionSelect, + AppPermissionFilter, + AppPermissionOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { description: 'string', }; const usage = - '\napp-permission \n\nCommands:\n list List all appPermission records\n get Get a appPermission by ID\n create Create a new appPermission\n update Update an existing appPermission\n delete Delete a appPermission\n\n --help, -h Show this help message\n'; + '\napp-permission \n\nCommands:\n list List appPermission records\n find-first Find first matching appPermission record\n get Get a appPermission by ID\n create Create a new appPermission\n update Update an existing appPermission\n delete Delete a appPermission\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppPermissionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appPermission - .findMany({ - select: { - id: true, - name: true, - bitnum: true, - bitstr: true, - description: true, - }, - }) - .execute(); + const result = await client.appPermission.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppPermissionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appPermission.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app-step.ts b/sdk/constructive-cli/src/public/cli/commands/app-step.ts index 3b5a4d8b6..daf16cc8f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app-step.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app-step.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppStepInput, AppStepPatch } from '../../orm/input-types'; +import type { + CreateAppStepInput, + AppStepPatch, + AppStepSelect, + AppStepFilter, + AppStepOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', actorId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\napp-step \n\nCommands:\n list List all appStep records\n get Get a appStep by ID\n create Create a new appStep\n update Update an existing appStep\n delete Delete a appStep\n\n --help, -h Show this help message\n'; + '\napp-step \n\nCommands:\n list List appStep records\n find-first Find first matching appStep record\n get Get a appStep by ID\n create Create a new appStep\n update Update an existing appStep\n delete Delete a appStep\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppStepSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.appStep - .findMany({ - select: { - id: true, - actorId: true, - name: true, - count: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.appStep.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + actorId: true, + name: true, + count: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppStepSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.appStep.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/app.ts b/sdk/constructive-cli/src/public/cli/commands/app.ts index 33d9b5c1b..4f5c4772f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/app.ts +++ b/sdk/constructive-cli/src/public/cli/commands/app.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAppInput, AppPatch } from '../../orm/input-types'; +import type { + CreateAppInput, + AppPatch, + AppSelect, + AppFilter, + AppOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { playStoreLink: 'string', }; const usage = - '\napp \n\nCommands:\n list List all app records\n get Get a app by ID\n create Create a new app\n update Update an existing app\n delete Delete a app\n\n --help, -h Show this help message\n'; + '\napp \n\nCommands:\n list List app records\n find-first Find first matching app record\n get Get a app by ID\n create Create a new app\n update Update an existing app\n delete Delete a app\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,26 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + name: true, + appImage: true, + appStoreLink: true, + appStoreId: true, + appIdPrefix: true, + playStoreLink: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AppSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.app - .findMany({ - select: { - id: true, - databaseId: true, - siteId: true, - name: true, - appImage: true, - appStoreLink: true, - appStoreId: true, - appIdPrefix: true, - playStoreLink: true, - }, - }) - .execute(); + const result = await client.app.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +103,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + name: true, + appImage: true, + appStoreLink: true, + appStoreId: true, + appIdPrefix: true, + playStoreLink: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AppSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.app.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts b/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts index 3ef3cc590..e754f9166 100644 --- a/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts +++ b/sdk/constructive-cli/src/public/cli/commands/ast-migration.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAstMigrationInput, AstMigrationPatch } from '../../orm/input-types'; +import type { + CreateAstMigrationInput, + AstMigrationPatch, + AstMigrationSelect, + AstMigrationFilter, + AstMigrationOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'int', databaseId: 'uuid', @@ -24,7 +31,7 @@ const fieldSchema: FieldSchema = { actorId: 'uuid', }; const usage = - '\nast-migration \n\nCommands:\n list List all astMigration records\n create Create a new astMigration\n\n --help, -h Show this help message\n'; + '\nast-migration \n\nCommands:\n list List astMigration records\n find-first Find first matching astMigration record\n create Create a new astMigration\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -41,7 +48,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -56,6 +63,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -63,28 +72,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + requires: true, + payload: true, + deploys: true, + deploy: true, + revert: true, + verify: true, + createdAt: true, + action: true, + actionId: true, + actorId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AstMigrationSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.astMigration - .findMany({ - select: { - id: true, - databaseId: true, - name: true, - requires: true, - payload: true, - deploys: true, - deploy: true, - revert: true, - verify: true, - createdAt: true, - action: true, - actionId: true, - actorId: true, - }, - }) - .execute(); + const result = await client.astMigration.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -94,6 +105,39 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + requires: true, + payload: true, + deploys: true, + deploy: true, + revert: true, + verify: true, + createdAt: true, + action: true, + actionId: true, + actorId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AstMigrationSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.astMigration.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/audit-log.ts b/sdk/constructive-cli/src/public/cli/commands/audit-log.ts index d4e2566ef..79a5c1b1c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/audit-log.ts +++ b/sdk/constructive-cli/src/public/cli/commands/audit-log.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateAuditLogInput, AuditLogPatch } from '../../orm/input-types'; +import type { + CreateAuditLogInput, + AuditLogPatch, + AuditLogSelect, + AuditLogFilter, + AuditLogOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', event: 'string', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\naudit-log \n\nCommands:\n list List all auditLog records\n get Get a auditLog by ID\n create Create a new auditLog\n update Update an existing auditLog\n delete Delete a auditLog\n\n --help, -h Show this help message\n'; + '\naudit-log \n\nCommands:\n list List auditLog records\n find-first Find first matching auditLog record\n get Get a auditLog by ID\n create Create a new auditLog\n update Update an existing auditLog\n delete Delete a auditLog\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + event: true, + actorId: true, + origin: true, + userAgent: true, + ipAddress: true, + success: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: AuditLogSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.auditLog - .findMany({ - select: { - id: true, - event: true, - actorId: true, - origin: true, - userAgent: true, - ipAddress: true, - success: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.auditLog.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + event: true, + actorId: true, + origin: true, + userAgent: true, + ipAddress: true, + success: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: AuditLogSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.auditLog.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/blueprint-template.ts b/sdk/constructive-cli/src/public/cli/commands/blueprint-template.ts index 61af9e01c..614f62cc2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/blueprint-template.ts +++ b/sdk/constructive-cli/src/public/cli/commands/blueprint-template.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateBlueprintTemplateInput, BlueprintTemplatePatch } from '../../orm/input-types'; +import type { + CreateBlueprintTemplateInput, + BlueprintTemplatePatch, + BlueprintTemplateSelect, + BlueprintTemplateFilter, + BlueprintTemplateOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -31,7 +38,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nblueprint-template \n\nCommands:\n list List all blueprintTemplate records\n get Get a blueprintTemplate by ID\n create Create a new blueprintTemplate\n update Update an existing blueprintTemplate\n delete Delete a blueprintTemplate\n\n --help, -h Show this help message\n'; + '\nblueprint-template \n\nCommands:\n list List blueprintTemplate records\n find-first Find first matching blueprintTemplate record\n get Get a blueprintTemplate by ID\n create Create a new blueprintTemplate\n update Update an existing blueprintTemplate\n delete Delete a blueprintTemplate\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -48,7 +55,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -63,6 +70,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -76,35 +85,42 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + version: true, + displayName: true, + description: true, + ownerId: true, + visibility: true, + categories: true, + tags: true, + definition: true, + definitionSchemaVersion: true, + source: true, + complexity: true, + copyCount: true, + forkCount: true, + forkedFromId: true, + definitionHash: true, + tableHashes: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + BlueprintTemplateSelect, + BlueprintTemplateFilter, + never, + BlueprintTemplateOrderBy + > & { + select: BlueprintTemplateSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.blueprintTemplate - .findMany({ - select: { - id: true, - name: true, - version: true, - displayName: true, - description: true, - ownerId: true, - visibility: true, - categories: true, - tags: true, - definition: true, - definitionSchemaVersion: true, - source: true, - complexity: true, - copyCount: true, - forkCount: true, - forkedFromId: true, - definitionHash: true, - tableHashes: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.blueprintTemplate.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -114,6 +130,46 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + version: true, + displayName: true, + description: true, + ownerId: true, + visibility: true, + categories: true, + tags: true, + definition: true, + definitionSchemaVersion: true, + source: true, + complexity: true, + copyCount: true, + forkCount: true, + forkedFromId: true, + definitionHash: true, + tableHashes: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: BlueprintTemplateSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.blueprintTemplate.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/blueprint.ts b/sdk/constructive-cli/src/public/cli/commands/blueprint.ts index 7d31d30a5..73b202c42 100644 --- a/sdk/constructive-cli/src/public/cli/commands/blueprint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/blueprint.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateBlueprintInput, BlueprintPatch } from '../../orm/input-types'; +import type { + CreateBlueprintInput, + BlueprintPatch, + BlueprintSelect, + BlueprintFilter, + BlueprintOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -28,7 +35,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nblueprint \n\nCommands:\n list List all blueprint records\n get Get a blueprint by ID\n create Create a new blueprint\n update Update an existing blueprint\n delete Delete a blueprint\n\n --help, -h Show this help message\n'; + '\nblueprint \n\nCommands:\n list List blueprint records\n find-first Find first matching blueprint record\n get Get a blueprint by ID\n create Create a new blueprint\n update Update an existing blueprint\n delete Delete a blueprint\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -45,7 +52,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -60,6 +67,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -73,32 +82,34 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + databaseId: true, + name: true, + displayName: true, + description: true, + definition: true, + templateId: true, + status: true, + constructedAt: true, + errorDetails: true, + refMap: true, + constructedDefinition: true, + definitionHash: true, + tableHashes: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: BlueprintSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.blueprint - .findMany({ - select: { - id: true, - ownerId: true, - databaseId: true, - name: true, - displayName: true, - description: true, - definition: true, - templateId: true, - status: true, - constructedAt: true, - errorDetails: true, - refMap: true, - constructedDefinition: true, - definitionHash: true, - tableHashes: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.blueprint.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -108,6 +119,43 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + databaseId: true, + name: true, + displayName: true, + description: true, + definition: true, + templateId: true, + status: true, + constructedAt: true, + errorDetails: true, + refMap: true, + constructedDefinition: true, + definitionHash: true, + tableHashes: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: BlueprintSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.blueprint.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts index 27e7683c9..ae29dc80d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/check-constraint.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateCheckConstraintInput, CheckConstraintPatch } from '../../orm/input-types'; +import type { + CreateCheckConstraintInput, + CheckConstraintPatch, + CheckConstraintSelect, + CheckConstraintFilter, + CheckConstraintOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ncheck-constraint \n\nCommands:\n list List all checkConstraint records\n get Get a checkConstraint by ID\n create Create a new checkConstraint\n update Update an existing checkConstraint\n delete Delete a checkConstraint\n\n --help, -h Show this help message\n'; + '\ncheck-constraint \n\nCommands:\n list List checkConstraint records\n find-first Find first matching checkConstraint record\n get Get a checkConstraint by ID\n create Create a new checkConstraint\n update Update an existing checkConstraint\n delete Delete a checkConstraint\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + type: true, + fieldIds: true, + expr: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: CheckConstraintSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.checkConstraint - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - type: true, - fieldIds: true, - expr: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.checkConstraint.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +113,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + type: true, + fieldIds: true, + expr: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: CheckConstraintSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.checkConstraint.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts b/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts index 79266c155..f0f106228 100644 --- a/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/claimed-invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateClaimedInviteInput, ClaimedInvitePatch } from '../../orm/input-types'; +import type { + CreateClaimedInviteInput, + ClaimedInvitePatch, + ClaimedInviteSelect, + ClaimedInviteFilter, + ClaimedInviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nclaimed-invite \n\nCommands:\n list List all claimedInvite records\n get Get a claimedInvite by ID\n create Create a new claimedInvite\n update Update an existing claimedInvite\n delete Delete a claimedInvite\n\n --help, -h Show this help message\n'; + '\nclaimed-invite \n\nCommands:\n list List claimedInvite records\n find-first Find first matching claimedInvite record\n get Get a claimedInvite by ID\n create Create a new claimedInvite\n update Update an existing claimedInvite\n delete Delete a claimedInvite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ClaimedInviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.claimedInvite - .findMany({ - select: { - id: true, - data: true, - senderId: true, - receiverId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.claimedInvite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ClaimedInviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.claimedInvite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/commit.ts b/sdk/constructive-cli/src/public/cli/commands/commit.ts index 41e83a4f2..cbea0bc89 100644 --- a/sdk/constructive-cli/src/public/cli/commands/commit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/commit.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateCommitInput, CommitPatch } from '../../orm/input-types'; +import type { + CreateCommitInput, + CommitPatch, + CommitSelect, + CommitFilter, + CommitOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', message: 'string', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { date: 'string', }; const usage = - '\ncommit \n\nCommands:\n list List all commit records\n get Get a commit by ID\n create Create a new commit\n update Update an existing commit\n delete Delete a commit\n\n --help, -h Show this help message\n'; + '\ncommit \n\nCommands:\n list List commit records\n find-first Find first matching commit record\n get Get a commit by ID\n create Create a new commit\n update Update an existing commit\n delete Delete a commit\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,26 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + message: true, + databaseId: true, + storeId: true, + parentIds: true, + authorId: true, + committerId: true, + treeId: true, + date: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: CommitSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.commit - .findMany({ - select: { - id: true, - message: true, - databaseId: true, - storeId: true, - parentIds: true, - authorId: true, - committerId: true, - treeId: true, - date: true, - }, - }) - .execute(); + const result = await client.commit.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +103,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + message: true, + databaseId: true, + storeId: true, + parentIds: true, + authorId: true, + committerId: true, + treeId: true, + date: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: CommitSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.commit.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/connected-account.ts b/sdk/constructive-cli/src/public/cli/commands/connected-account.ts index 373ce17f3..5b0ea5d96 100644 --- a/sdk/constructive-cli/src/public/cli/commands/connected-account.ts +++ b/sdk/constructive-cli/src/public/cli/commands/connected-account.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateConnectedAccountInput, ConnectedAccountPatch } from '../../orm/input-types'; +import type { + CreateConnectedAccountInput, + ConnectedAccountPatch, + ConnectedAccountSelect, + ConnectedAccountFilter, + ConnectedAccountOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nconnected-account \n\nCommands:\n list List all connectedAccount records\n get Get a connectedAccount by ID\n create Create a new connectedAccount\n update Update an existing connectedAccount\n delete Delete a connectedAccount\n\n --help, -h Show this help message\n'; + '\nconnected-account \n\nCommands:\n list List connectedAccount records\n find-first Find first matching connectedAccount record\n get Get a connectedAccount by ID\n create Create a new connectedAccount\n update Update an existing connectedAccount\n delete Delete a connectedAccount\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + service: true, + identifier: true, + details: true, + isVerified: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + ConnectedAccountSelect, + ConnectedAccountFilter, + never, + ConnectedAccountOrderBy + > & { + select: ConnectedAccountSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.connectedAccount - .findMany({ - select: { - id: true, - ownerId: true, - service: true, - identifier: true, - details: true, - isVerified: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.connectedAccount.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +106,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + service: true, + identifier: true, + details: true, + isVerified: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ConnectedAccountSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.connectedAccount.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts b/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts index eda2d569e..79f27f73f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/connected-accounts-module.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateConnectedAccountsModuleInput, ConnectedAccountsModulePatch, + ConnectedAccountsModuleSelect, + ConnectedAccountsModuleFilter, + ConnectedAccountsModuleOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -21,7 +25,7 @@ const fieldSchema: FieldSchema = { tableName: 'string', }; const usage = - '\nconnected-accounts-module \n\nCommands:\n list List all connectedAccountsModule records\n get Get a connectedAccountsModule by ID\n create Create a new connectedAccountsModule\n update Update an existing connectedAccountsModule\n delete Delete a connectedAccountsModule\n\n --help, -h Show this help message\n'; + '\nconnected-accounts-module \n\nCommands:\n list List connectedAccountsModule records\n find-first Find first matching connectedAccountsModule record\n get Get a connectedAccountsModule by ID\n create Create a new connectedAccountsModule\n update Update an existing connectedAccountsModule\n delete Delete a connectedAccountsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -38,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -53,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -66,22 +72,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + ConnectedAccountsModuleSelect, + ConnectedAccountsModuleFilter, + never, + ConnectedAccountsModuleOrderBy + > & { + select: ConnectedAccountsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.connectedAccountsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - ownerTableId: true, - tableName: true, - }, - }) - .execute(); + const result = await client.connectedAccountsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -91,6 +104,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ConnectedAccountsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.connectedAccountsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts b/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts index a4d171639..8b3902d0e 100644 --- a/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts +++ b/sdk/constructive-cli/src/public/cli/commands/crypto-address.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateCryptoAddressInput, CryptoAddressPatch } from '../../orm/input-types'; +import type { + CreateCryptoAddressInput, + CryptoAddressPatch, + CryptoAddressSelect, + CryptoAddressFilter, + CryptoAddressOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ncrypto-address \n\nCommands:\n list List all cryptoAddress records\n get Get a cryptoAddress by ID\n create Create a new cryptoAddress\n update Update an existing cryptoAddress\n delete Delete a cryptoAddress\n\n --help, -h Show this help message\n'; + '\ncrypto-address \n\nCommands:\n list List cryptoAddress records\n find-first Find first matching cryptoAddress record\n get Get a cryptoAddress by ID\n create Create a new cryptoAddress\n update Update an existing cryptoAddress\n delete Delete a cryptoAddress\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + address: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: CryptoAddressSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.cryptoAddress - .findMany({ - select: { - id: true, - ownerId: true, - address: true, - isVerified: true, - isPrimary: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.cryptoAddress.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + address: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: CryptoAddressSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.cryptoAddress.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts b/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts index e444c2331..fc598c9be 100644 --- a/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/crypto-addresses-module.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateCryptoAddressesModuleInput, CryptoAddressesModulePatch, + CryptoAddressesModuleSelect, + CryptoAddressesModuleFilter, + CryptoAddressesModuleOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -22,7 +26,7 @@ const fieldSchema: FieldSchema = { cryptoNetwork: 'string', }; const usage = - '\ncrypto-addresses-module \n\nCommands:\n list List all cryptoAddressesModule records\n get Get a cryptoAddressesModule by ID\n create Create a new cryptoAddressesModule\n update Update an existing cryptoAddressesModule\n delete Delete a cryptoAddressesModule\n\n --help, -h Show this help message\n'; + '\ncrypto-addresses-module \n\nCommands:\n list List cryptoAddressesModule records\n find-first Find first matching cryptoAddressesModule record\n get Get a cryptoAddressesModule by ID\n create Create a new cryptoAddressesModule\n update Update an existing cryptoAddressesModule\n delete Delete a cryptoAddressesModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -54,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -67,23 +73,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + cryptoNetwork: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + CryptoAddressesModuleSelect, + CryptoAddressesModuleFilter, + never, + CryptoAddressesModuleOrderBy + > & { + select: CryptoAddressesModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.cryptoAddressesModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - ownerTableId: true, - tableName: true, - cryptoNetwork: true, - }, - }) - .execute(); + const result = await client.cryptoAddressesModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -93,6 +106,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + cryptoNetwork: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: CryptoAddressesModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.cryptoAddressesModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts b/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts index e86a195d1..85c1e39df 100644 --- a/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/crypto-auth-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateCryptoAuthModuleInput, CryptoAuthModulePatch } from '../../orm/input-types'; +import type { + CreateCryptoAuthModuleInput, + CryptoAuthModulePatch, + CryptoAuthModuleSelect, + CryptoAuthModuleFilter, + CryptoAuthModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { signInWithChallenge: 'string', }; const usage = - '\ncrypto-auth-module \n\nCommands:\n list List all cryptoAuthModule records\n get Get a cryptoAuthModule by ID\n create Create a new cryptoAuthModule\n update Update an existing cryptoAuthModule\n delete Delete a cryptoAuthModule\n\n --help, -h Show this help message\n'; + '\ncrypto-auth-module \n\nCommands:\n list List cryptoAuthModule records\n find-first Find first matching cryptoAuthModule record\n get Get a cryptoAuthModule by ID\n create Create a new cryptoAuthModule\n update Update an existing cryptoAuthModule\n delete Delete a cryptoAuthModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,36 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + usersTableId: true, + secretsTableId: true, + sessionsTableId: true, + sessionCredentialsTableId: true, + addressesTableId: true, + userField: true, + cryptoNetwork: true, + signInRequestChallenge: true, + signInRecordFailure: true, + signUpWithKey: true, + signInWithChallenge: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + CryptoAuthModuleSelect, + CryptoAuthModuleFilter, + never, + CryptoAuthModuleOrderBy + > & { + select: CryptoAuthModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.cryptoAuthModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - usersTableId: true, - secretsTableId: true, - sessionsTableId: true, - sessionCredentialsTableId: true, - addressesTableId: true, - userField: true, - cryptoNetwork: true, - signInRequestChallenge: true, - signInRecordFailure: true, - signUpWithKey: true, - signInWithChallenge: true, - }, - }) - .execute(); + const result = await client.cryptoAuthModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +118,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + usersTableId: true, + secretsTableId: true, + sessionsTableId: true, + sessionCredentialsTableId: true, + addressesTableId: true, + userField: true, + cryptoNetwork: true, + signInRequestChallenge: true, + signInRecordFailure: true, + signUpWithKey: true, + signInWithChallenge: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: CryptoAuthModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.cryptoAuthModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts b/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts index e1ad016a3..ddcfaa058 100644 --- a/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/database-provision-module.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateDatabaseProvisionModuleInput, DatabaseProvisionModulePatch, + DatabaseProvisionModuleSelect, + DatabaseProvisionModuleFilter, + DatabaseProvisionModuleOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseName: 'string', @@ -28,7 +32,7 @@ const fieldSchema: FieldSchema = { completedAt: 'string', }; const usage = - '\ndatabase-provision-module \n\nCommands:\n list List all databaseProvisionModule records\n get Get a databaseProvisionModule by ID\n create Create a new databaseProvisionModule\n update Update an existing databaseProvisionModule\n delete Delete a databaseProvisionModule\n\n --help, -h Show this help message\n'; + '\ndatabase-provision-module \n\nCommands:\n list List databaseProvisionModule records\n find-first Find first matching databaseProvisionModule record\n get Get a databaseProvisionModule by ID\n create Create a new databaseProvisionModule\n update Update an existing databaseProvisionModule\n delete Delete a databaseProvisionModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -45,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -60,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -73,29 +79,36 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseName: true, + ownerId: true, + subdomain: true, + domain: true, + modules: true, + options: true, + bootstrapUser: true, + status: true, + errorMessage: true, + databaseId: true, + createdAt: true, + updatedAt: true, + completedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + DatabaseProvisionModuleSelect, + DatabaseProvisionModuleFilter, + never, + DatabaseProvisionModuleOrderBy + > & { + select: DatabaseProvisionModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.databaseProvisionModule - .findMany({ - select: { - id: true, - databaseName: true, - ownerId: true, - subdomain: true, - domain: true, - modules: true, - options: true, - bootstrapUser: true, - status: true, - errorMessage: true, - databaseId: true, - createdAt: true, - updatedAt: true, - completedAt: true, - }, - }) - .execute(); + const result = await client.databaseProvisionModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -105,6 +118,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseName: true, + ownerId: true, + subdomain: true, + domain: true, + modules: true, + options: true, + bootstrapUser: true, + status: true, + errorMessage: true, + databaseId: true, + createdAt: true, + updatedAt: true, + completedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: DatabaseProvisionModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.databaseProvisionModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/database-transfer.ts b/sdk/constructive-cli/src/public/cli/commands/database-transfer.ts index 5ff49a374..d307df67c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/database-transfer.ts +++ b/sdk/constructive-cli/src/public/cli/commands/database-transfer.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateDatabaseTransferInput, DatabaseTransferPatch } from '../../orm/input-types'; +import type { + CreateDatabaseTransferInput, + DatabaseTransferPatch, + DatabaseTransferSelect, + DatabaseTransferFilter, + DatabaseTransferOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { completedAt: 'string', }; const usage = - '\ndatabase-transfer \n\nCommands:\n list List all databaseTransfer records\n get Get a databaseTransfer by ID\n create Create a new databaseTransfer\n update Update an existing databaseTransfer\n delete Delete a databaseTransfer\n\n --help, -h Show this help message\n'; + '\ndatabase-transfer \n\nCommands:\n list List databaseTransfer records\n find-first Find first matching databaseTransfer record\n get Get a databaseTransfer by ID\n create Create a new databaseTransfer\n update Update an existing databaseTransfer\n delete Delete a databaseTransfer\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,36 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + targetOwnerId: true, + sourceApproved: true, + targetApproved: true, + sourceApprovedAt: true, + targetApprovedAt: true, + status: true, + initiatedBy: true, + notes: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + completedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + DatabaseTransferSelect, + DatabaseTransferFilter, + never, + DatabaseTransferOrderBy + > & { + select: DatabaseTransferSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.databaseTransfer - .findMany({ - select: { - id: true, - databaseId: true, - targetOwnerId: true, - sourceApproved: true, - targetApproved: true, - sourceApprovedAt: true, - targetApprovedAt: true, - status: true, - initiatedBy: true, - notes: true, - expiresAt: true, - createdAt: true, - updatedAt: true, - completedAt: true, - }, - }) - .execute(); + const result = await client.databaseTransfer.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +118,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + targetOwnerId: true, + sourceApproved: true, + targetApproved: true, + sourceApprovedAt: true, + targetApprovedAt: true, + status: true, + initiatedBy: true, + notes: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + completedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: DatabaseTransferSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.databaseTransfer.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/database.ts b/sdk/constructive-cli/src/public/cli/commands/database.ts index 012a358c8..1d98d4f2c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/database.ts +++ b/sdk/constructive-cli/src/public/cli/commands/database.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateDatabaseInput, DatabasePatch } from '../../orm/input-types'; +import type { + CreateDatabaseInput, + DatabasePatch, + DatabaseSelect, + DatabaseFilter, + DatabaseOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ndatabase \n\nCommands:\n list List all database records\n get Get a database by ID\n create Create a new database\n update Update an existing database\n delete Delete a database\n\n --help, -h Show this help message\n'; + '\ndatabase \n\nCommands:\n list List database records\n find-first Find first matching database record\n get Get a database by ID\n create Create a new database\n update Update an existing database\n delete Delete a database\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + schemaHash: true, + name: true, + label: true, + hash: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: DatabaseSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.database - .findMany({ - select: { - id: true, - ownerId: true, - schemaHash: true, - name: true, - label: true, - hash: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.database.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + schemaHash: true, + name: true, + label: true, + hash: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: DatabaseSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.database.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts b/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts index 575f4f41f..3752c91c2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/default-ids-module.ts @@ -5,15 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateDefaultIdsModuleInput, DefaultIdsModulePatch } from '../../orm/input-types'; +import type { + CreateDefaultIdsModuleInput, + DefaultIdsModulePatch, + DefaultIdsModuleSelect, + DefaultIdsModuleFilter, + DefaultIdsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', }; const usage = - '\ndefault-ids-module \n\nCommands:\n list List all defaultIdsModule records\n get Get a defaultIdsModule by ID\n create Create a new defaultIdsModule\n update Update an existing defaultIdsModule\n delete Delete a defaultIdsModule\n\n --help, -h Show this help message\n'; + '\ndefault-ids-module \n\nCommands:\n list List defaultIdsModule records\n find-first Find first matching defaultIdsModule record\n get Get a defaultIdsModule by ID\n create Create a new defaultIdsModule\n update Update an existing defaultIdsModule\n delete Delete a defaultIdsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -45,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -58,17 +67,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + DefaultIdsModuleSelect, + DefaultIdsModuleFilter, + never, + DefaultIdsModuleOrderBy + > & { + select: DefaultIdsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.defaultIdsModule - .findMany({ - select: { - id: true, - databaseId: true, - }, - }) - .execute(); + const result = await client.defaultIdsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -78,6 +94,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: DefaultIdsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.defaultIdsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts b/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts index 8a30d6a43..3137ddcba 100644 --- a/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts +++ b/sdk/constructive-cli/src/public/cli/commands/default-privilege.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateDefaultPrivilegeInput, DefaultPrivilegePatch } from '../../orm/input-types'; +import type { + CreateDefaultPrivilegeInput, + DefaultPrivilegePatch, + DefaultPrivilegeSelect, + DefaultPrivilegeFilter, + DefaultPrivilegeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { isGrant: 'boolean', }; const usage = - '\ndefault-privilege \n\nCommands:\n list List all defaultPrivilege records\n get Get a defaultPrivilege by ID\n create Create a new defaultPrivilege\n update Update an existing defaultPrivilege\n delete Delete a defaultPrivilege\n\n --help, -h Show this help message\n'; + '\ndefault-privilege \n\nCommands:\n list List defaultPrivilege records\n find-first Find first matching defaultPrivilege record\n get Get a defaultPrivilege by ID\n create Create a new defaultPrivilege\n update Update an existing defaultPrivilege\n delete Delete a defaultPrivilege\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + objectType: true, + privilege: true, + granteeName: true, + isGrant: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + DefaultPrivilegeSelect, + DefaultPrivilegeFilter, + never, + DefaultPrivilegeOrderBy + > & { + select: DefaultPrivilegeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.defaultPrivilege - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - objectType: true, - privilege: true, - granteeName: true, - isGrant: true, - }, - }) - .execute(); + const result = await client.defaultPrivilege.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +104,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + objectType: true, + privilege: true, + granteeName: true, + isGrant: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: DefaultPrivilegeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.defaultPrivilege.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts b/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts index e372f5669..4fe8aaed5 100644 --- a/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts +++ b/sdk/constructive-cli/src/public/cli/commands/denormalized-table-field.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateDenormalizedTableFieldInput, DenormalizedTableFieldPatch, + DenormalizedTableFieldSelect, + DenormalizedTableFieldFilter, + DenormalizedTableFieldOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -26,7 +30,7 @@ const fieldSchema: FieldSchema = { funcOrder: 'int', }; const usage = - '\ndenormalized-table-field \n\nCommands:\n list List all denormalizedTableField records\n get Get a denormalizedTableField by ID\n create Create a new denormalizedTableField\n update Update an existing denormalizedTableField\n delete Delete a denormalizedTableField\n\n --help, -h Show this help message\n'; + '\ndenormalized-table-field \n\nCommands:\n list List denormalizedTableField records\n find-first Find first matching denormalizedTableField record\n get Get a denormalizedTableField by ID\n create Create a new denormalizedTableField\n update Update an existing denormalizedTableField\n delete Delete a denormalizedTableField\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -43,7 +47,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -58,6 +62,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -71,27 +77,34 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + fieldId: true, + setIds: true, + refTableId: true, + refFieldId: true, + refIds: true, + useUpdates: true, + updateDefaults: true, + funcName: true, + funcOrder: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + DenormalizedTableFieldSelect, + DenormalizedTableFieldFilter, + never, + DenormalizedTableFieldOrderBy + > & { + select: DenormalizedTableFieldSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.denormalizedTableField - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - fieldId: true, - setIds: true, - refTableId: true, - refFieldId: true, - refIds: true, - useUpdates: true, - updateDefaults: true, - funcName: true, - funcOrder: true, - }, - }) - .execute(); + const result = await client.denormalizedTableField.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -101,6 +114,38 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + fieldId: true, + setIds: true, + refTableId: true, + refFieldId: true, + refIds: true, + useUpdates: true, + updateDefaults: true, + funcName: true, + funcOrder: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: DenormalizedTableFieldSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.denormalizedTableField.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/domain.ts b/sdk/constructive-cli/src/public/cli/commands/domain.ts index 3c096eaa2..1f760775e 100644 --- a/sdk/constructive-cli/src/public/cli/commands/domain.ts +++ b/sdk/constructive-cli/src/public/cli/commands/domain.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateDomainInput, DomainPatch } from '../../orm/input-types'; +import type { + CreateDomainInput, + DomainPatch, + DomainSelect, + DomainFilter, + DomainOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { domain: 'string', }; const usage = - '\ndomain \n\nCommands:\n list List all domain records\n get Get a domain by ID\n create Create a new domain\n update Update an existing domain\n delete Delete a domain\n\n --help, -h Show this help message\n'; + '\ndomain \n\nCommands:\n list List domain records\n find-first Find first matching domain record\n get Get a domain by ID\n create Create a new domain\n update Update an existing domain\n delete Delete a domain\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + apiId: true, + siteId: true, + subdomain: true, + domain: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: DomainSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.domain - .findMany({ - select: { - id: true, - databaseId: true, - apiId: true, - siteId: true, - subdomain: true, - domain: true, - }, - }) - .execute(); + const result = await client.domain.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + apiId: true, + siteId: true, + subdomain: true, + domain: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: DomainSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.domain.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/email.ts b/sdk/constructive-cli/src/public/cli/commands/email.ts index 2eb218c73..b21c9e87a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/email.ts +++ b/sdk/constructive-cli/src/public/cli/commands/email.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateEmailInput, EmailPatch } from '../../orm/input-types'; +import type { + CreateEmailInput, + EmailPatch, + EmailSelect, + EmailFilter, + EmailOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nemail \n\nCommands:\n list List all email records\n get Get a email by ID\n create Create a new email\n update Update an existing email\n delete Delete a email\n\n --help, -h Show this help message\n'; + '\nemail \n\nCommands:\n list List email records\n find-first Find first matching email record\n get Get a email by ID\n create Create a new email\n update Update an existing email\n delete Delete a email\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + email: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: EmailSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.email - .findMany({ - select: { - id: true, - ownerId: true, - email: true, - isVerified: true, - isPrimary: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.email.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + email: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: EmailSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.email.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/emails-module.ts b/sdk/constructive-cli/src/public/cli/commands/emails-module.ts index 2c36361cf..82a559e17 100644 --- a/sdk/constructive-cli/src/public/cli/commands/emails-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/emails-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateEmailsModuleInput, EmailsModulePatch } from '../../orm/input-types'; +import type { + CreateEmailsModuleInput, + EmailsModulePatch, + EmailsModuleSelect, + EmailsModuleFilter, + EmailsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { tableName: 'string', }; const usage = - '\nemails-module \n\nCommands:\n list List all emailsModule records\n get Get a emailsModule by ID\n create Create a new emailsModule\n update Update an existing emailsModule\n delete Delete a emailsModule\n\n --help, -h Show this help message\n'; + '\nemails-module \n\nCommands:\n list List emailsModule records\n find-first Find first matching emailsModule record\n get Get a emailsModule by ID\n create Create a new emailsModule\n update Update an existing emailsModule\n delete Delete a emailsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: EmailsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.emailsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - ownerTableId: true, - tableName: true, - }, - }) - .execute(); + const result = await client.emailsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: EmailsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.emailsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/embedding-chunk.ts b/sdk/constructive-cli/src/public/cli/commands/embedding-chunk.ts index 118879203..67175415d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/embedding-chunk.ts +++ b/sdk/constructive-cli/src/public/cli/commands/embedding-chunk.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateEmbeddingChunkInput, EmbeddingChunkPatch } from '../../orm/input-types'; +import type { + CreateEmbeddingChunkInput, + EmbeddingChunkPatch, + EmbeddingChunkSelect, + EmbeddingChunkFilter, + EmbeddingChunkOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -29,7 +36,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nembedding-chunk \n\nCommands:\n list List all embeddingChunk records\n get Get a embeddingChunk by ID\n create Create a new embeddingChunk\n update Update an existing embeddingChunk\n delete Delete a embeddingChunk\n\n --help, -h Show this help message\n'; + '\nembedding-chunk \n\nCommands:\n list List embeddingChunk records\n find-first Find first matching embeddingChunk record\n get Get a embeddingChunk by ID\n create Create a new embeddingChunk\n update Update an existing embeddingChunk\n delete Delete a embeddingChunk\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -46,7 +53,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -61,6 +68,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -74,33 +83,35 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + embeddingFieldId: true, + chunksTableId: true, + chunksTableName: true, + contentFieldName: true, + dimensions: true, + metric: true, + chunkSize: true, + chunkOverlap: true, + chunkStrategy: true, + metadataFields: true, + enqueueChunkingJob: true, + chunkingTaskName: true, + parentFkFieldId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: EmbeddingChunkSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.embeddingChunk - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - embeddingFieldId: true, - chunksTableId: true, - chunksTableName: true, - contentFieldName: true, - dimensions: true, - metric: true, - chunkSize: true, - chunkOverlap: true, - chunkStrategy: true, - metadataFields: true, - enqueueChunkingJob: true, - chunkingTaskName: true, - parentFkFieldId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.embeddingChunk.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -110,6 +121,44 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + embeddingFieldId: true, + chunksTableId: true, + chunksTableName: true, + contentFieldName: true, + dimensions: true, + metric: true, + chunkSize: true, + chunkOverlap: true, + chunkStrategy: true, + metadataFields: true, + enqueueChunkingJob: true, + chunkingTaskName: true, + parentFkFieldId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: EmbeddingChunkSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.embeddingChunk.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts b/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts index e40046902..9e0dcc443 100644 --- a/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/encrypted-secrets-module.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateEncryptedSecretsModuleInput, EncryptedSecretsModulePatch, + EncryptedSecretsModuleSelect, + EncryptedSecretsModuleFilter, + EncryptedSecretsModuleOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -19,7 +23,7 @@ const fieldSchema: FieldSchema = { tableName: 'string', }; const usage = - '\nencrypted-secrets-module \n\nCommands:\n list List all encryptedSecretsModule records\n get Get a encryptedSecretsModule by ID\n create Create a new encryptedSecretsModule\n update Update an existing encryptedSecretsModule\n delete Delete a encryptedSecretsModule\n\n --help, -h Show this help message\n'; + '\nencrypted-secrets-module \n\nCommands:\n list List encryptedSecretsModule records\n find-first Find first matching encryptedSecretsModule record\n get Get a encryptedSecretsModule by ID\n create Create a new encryptedSecretsModule\n update Update an existing encryptedSecretsModule\n delete Delete a encryptedSecretsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,20 +70,27 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + EncryptedSecretsModuleSelect, + EncryptedSecretsModuleFilter, + never, + EncryptedSecretsModuleOrderBy + > & { + select: EncryptedSecretsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.encryptedSecretsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - tableId: true, - tableName: true, - }, - }) - .execute(); + const result = await client.encryptedSecretsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -87,6 +100,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: EncryptedSecretsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.encryptedSecretsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/enum.ts b/sdk/constructive-cli/src/public/cli/commands/enum.ts index a2de3b3c4..3784bd955 100644 --- a/sdk/constructive-cli/src/public/cli/commands/enum.ts +++ b/sdk/constructive-cli/src/public/cli/commands/enum.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateEnumInput, EnumPatch } from '../../orm/input-types'; +import type { + CreateEnumInput, + EnumPatch, + EnumSelect, + EnumFilter, + EnumOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -23,7 +30,7 @@ const fieldSchema: FieldSchema = { tags: 'string', }; const usage = - '\nenum \n\nCommands:\n list List all enum records\n get Get a enum by ID\n create Create a new enum\n update Update an existing enum\n delete Delete a enum\n\n --help, -h Show this help message\n'; + '\nenum \n\nCommands:\n list List enum records\n find-first Find first matching enum record\n get Get a enum by ID\n create Create a new enum\n update Update an existing enum\n delete Delete a enum\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,7 +47,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -55,6 +62,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -68,27 +77,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + name: true, + label: true, + description: true, + values: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: EnumSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.enum - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - name: true, - label: true, - description: true, - values: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - }, - }) - .execute(); + const result = await client.enum.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -98,6 +109,38 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + name: true, + label: true, + description: true, + values: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: EnumSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.enum.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/field.ts b/sdk/constructive-cli/src/public/cli/commands/field.ts index 8dcdd28ef..51bf112ee 100644 --- a/sdk/constructive-cli/src/public/cli/commands/field.ts +++ b/sdk/constructive-cli/src/public/cli/commands/field.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateFieldInput, FieldPatch } from '../../orm/input-types'; +import type { + CreateFieldInput, + FieldPatch, + FieldSelect, + FieldFilter, + FieldOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -35,7 +42,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nfield \n\nCommands:\n list List all field records\n get Get a field by ID\n create Create a new field\n update Update an existing field\n delete Delete a field\n\n --help, -h Show this help message\n'; + '\nfield \n\nCommands:\n list List field records\n find-first Find first matching field record\n get Get a field by ID\n create Create a new field\n update Update an existing field\n delete Delete a field\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -52,7 +59,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -67,6 +74,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -80,39 +89,41 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + label: true, + description: true, + smartTags: true, + isRequired: true, + apiRequired: true, + defaultValue: true, + defaultValueAst: true, + type: true, + fieldOrder: true, + regexp: true, + chk: true, + chkExpr: true, + min: true, + max: true, + tags: true, + category: true, + module: true, + scope: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: FieldSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.field - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - label: true, - description: true, - smartTags: true, - isRequired: true, - apiRequired: true, - defaultValue: true, - defaultValueAst: true, - type: true, - fieldOrder: true, - regexp: true, - chk: true, - chkExpr: true, - min: true, - max: true, - tags: true, - category: true, - module: true, - scope: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.field.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -122,6 +133,50 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + label: true, + description: true, + smartTags: true, + isRequired: true, + apiRequired: true, + defaultValue: true, + defaultValueAst: true, + type: true, + fieldOrder: true, + regexp: true, + chk: true, + chkExpr: true, + min: true, + max: true, + tags: true, + category: true, + module: true, + scope: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: FieldSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.field.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts index 168394874..0eecd5e98 100644 --- a/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/foreign-key-constraint.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateForeignKeyConstraintInput, ForeignKeyConstraintPatch, + ForeignKeyConstraintSelect, + ForeignKeyConstraintFilter, + ForeignKeyConstraintOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -32,7 +36,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nforeign-key-constraint \n\nCommands:\n list List all foreignKeyConstraint records\n get Get a foreignKeyConstraint by ID\n create Create a new foreignKeyConstraint\n update Update an existing foreignKeyConstraint\n delete Delete a foreignKeyConstraint\n\n --help, -h Show this help message\n'; + '\nforeign-key-constraint \n\nCommands:\n list List foreignKeyConstraint records\n find-first Find first matching foreignKeyConstraint record\n get Get a foreignKeyConstraint by ID\n create Create a new foreignKeyConstraint\n update Update an existing foreignKeyConstraint\n delete Delete a foreignKeyConstraint\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -49,7 +53,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -64,6 +68,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -77,33 +83,40 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + description: true, + smartTags: true, + type: true, + fieldIds: true, + refTableId: true, + refFieldIds: true, + deleteAction: true, + updateAction: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + ForeignKeyConstraintSelect, + ForeignKeyConstraintFilter, + never, + ForeignKeyConstraintOrderBy + > & { + select: ForeignKeyConstraintSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.foreignKeyConstraint - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - description: true, - smartTags: true, - type: true, - fieldIds: true, - refTableId: true, - refFieldIds: true, - deleteAction: true, - updateAction: true, - category: true, - module: true, - scope: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.foreignKeyConstraint.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -113,6 +126,44 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + description: true, + smartTags: true, + type: true, + fieldIds: true, + refTableId: true, + refFieldIds: true, + deleteAction: true, + updateAction: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ForeignKeyConstraintSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.foreignKeyConstraint.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts b/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts index 0bb1755f0..d418f178c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts +++ b/sdk/constructive-cli/src/public/cli/commands/full-text-search.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateFullTextSearchInput, FullTextSearchPatch } from '../../orm/input-types'; +import type { + CreateFullTextSearchInput, + FullTextSearchPatch, + FullTextSearchSelect, + FullTextSearchFilter, + FullTextSearchOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nfull-text-search \n\nCommands:\n list List all fullTextSearch records\n get Get a fullTextSearch by ID\n create Create a new fullTextSearch\n update Update an existing fullTextSearch\n delete Delete a fullTextSearch\n\n --help, -h Show this help message\n'; + '\nfull-text-search \n\nCommands:\n list List fullTextSearch records\n find-first Find first matching fullTextSearch record\n get Get a fullTextSearch by ID\n create Create a new fullTextSearch\n update Update an existing fullTextSearch\n delete Delete a fullTextSearch\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,26 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + fieldId: true, + fieldIds: true, + weights: true, + langs: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: FullTextSearchSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.fullTextSearch - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - fieldId: true, - fieldIds: true, - weights: true, - langs: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.fullTextSearch.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +103,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + fieldId: true, + fieldIds: true, + weights: true, + langs: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: FullTextSearchSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.fullTextSearch.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts b/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts index 96f8537f6..5ef092f6c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts +++ b/sdk/constructive-cli/src/public/cli/commands/get-all-record.ts @@ -5,15 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateGetAllRecordInput, GetAllRecordPatch } from '../../orm/input-types'; +import type { + CreateGetAllRecordInput, + GetAllRecordPatch, + GetAllRecordSelect, + GetAllRecordFilter, + GetAllRecordsOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { path: 'string', data: 'json', }; const usage = - '\nget-all-record \n\nCommands:\n list List all getAllRecord records\n create Create a new getAllRecord\n\n --help, -h Show this help message\n'; + '\nget-all-record \n\nCommands:\n list List getAllRecord records\n find-first Find first matching getAllRecord record\n create Create a new getAllRecord\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -45,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -52,17 +61,19 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + path: true, + data: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: GetAllRecordSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.getAllRecord - .findMany({ - select: { - path: true, - data: true, - }, - }) - .execute(); + const result = await client.getAllRecord.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -72,6 +83,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + path: true, + data: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: GetAllRecordSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.getAllRecord.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts b/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts index d009ea620..78ad03714 100644 --- a/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/hierarchy-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateHierarchyModuleInput, HierarchyModulePatch } from '../../orm/input-types'; +import type { + CreateHierarchyModuleInput, + HierarchyModulePatch, + HierarchyModuleSelect, + HierarchyModuleFilter, + HierarchyModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -31,7 +38,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\nhierarchy-module \n\nCommands:\n list List all hierarchyModule records\n get Get a hierarchyModule by ID\n create Create a new hierarchyModule\n update Update an existing hierarchyModule\n delete Delete a hierarchyModule\n\n --help, -h Show this help message\n'; + '\nhierarchy-module \n\nCommands:\n list List hierarchyModule records\n find-first Find first matching hierarchyModule record\n get Get a hierarchyModule by ID\n create Create a new hierarchyModule\n update Update an existing hierarchyModule\n delete Delete a hierarchyModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -48,7 +55,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -63,6 +70,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -76,35 +85,37 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + chartEdgesTableId: true, + chartEdgesTableName: true, + hierarchySprtTableId: true, + hierarchySprtTableName: true, + chartEdgeGrantsTableId: true, + chartEdgeGrantsTableName: true, + entityTableId: true, + usersTableId: true, + prefix: true, + privateSchemaName: true, + sprtTableName: true, + rebuildHierarchyFunction: true, + getSubordinatesFunction: true, + getManagersFunction: true, + isManagerOfFunction: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: HierarchyModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.hierarchyModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - chartEdgesTableId: true, - chartEdgesTableName: true, - hierarchySprtTableId: true, - hierarchySprtTableName: true, - chartEdgeGrantsTableId: true, - chartEdgeGrantsTableName: true, - entityTableId: true, - usersTableId: true, - prefix: true, - privateSchemaName: true, - sprtTableName: true, - rebuildHierarchyFunction: true, - getSubordinatesFunction: true, - getManagersFunction: true, - isManagerOfFunction: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.hierarchyModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -114,6 +125,46 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + chartEdgesTableId: true, + chartEdgesTableName: true, + hierarchySprtTableId: true, + hierarchySprtTableName: true, + chartEdgeGrantsTableId: true, + chartEdgeGrantsTableName: true, + entityTableId: true, + usersTableId: true, + prefix: true, + privateSchemaName: true, + sprtTableName: true, + rebuildHierarchyFunction: true, + getSubordinatesFunction: true, + getManagersFunction: true, + isManagerOfFunction: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: HierarchyModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.hierarchyModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/index.ts b/sdk/constructive-cli/src/public/cli/commands/index.ts index 71a6ee132..af4910f91 100644 --- a/sdk/constructive-cli/src/public/cli/commands/index.ts +++ b/sdk/constructive-cli/src/public/cli/commands/index.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateIndexInput, IndexPatch } from '../../orm/input-types'; +import type { + CreateIndexInput, + IndexPatch, + IndexSelect, + IndexFilter, + IndexOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -30,7 +37,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nindex \n\nCommands:\n list List all index records\n get Get a index by ID\n create Create a new index\n update Update an existing index\n delete Delete a index\n\n --help, -h Show this help message\n'; + '\nindex \n\nCommands:\n list List index records\n find-first Find first matching index record\n get Get a index by ID\n create Create a new index\n update Update an existing index\n delete Delete a index\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -47,7 +54,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -62,6 +69,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -75,34 +84,36 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + fieldIds: true, + includeFieldIds: true, + accessMethod: true, + indexParams: true, + whereClause: true, + isUnique: true, + options: true, + opClasses: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: IndexSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.index - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - fieldIds: true, - includeFieldIds: true, - accessMethod: true, - indexParams: true, - whereClause: true, - isUnique: true, - options: true, - opClasses: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.index.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -112,6 +123,45 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + fieldIds: true, + includeFieldIds: true, + accessMethod: true, + indexParams: true, + whereClause: true, + isUnique: true, + options: true, + opClasses: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: IndexSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.index.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/invite.ts b/sdk/constructive-cli/src/public/cli/commands/invite.ts index 7d243bdd3..c7c10081f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateInviteInput, InvitePatch } from '../../orm/input-types'; +import type { + CreateInviteInput, + InvitePatch, + InviteSelect, + InviteFilter, + InviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', @@ -23,7 +30,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ninvite \n\nCommands:\n list List all invite records\n get Get a invite by ID\n create Create a new invite\n update Update an existing invite\n delete Delete a invite\n\n --help, -h Show this help message\n'; + '\ninvite \n\nCommands:\n list List invite records\n find-first Find first matching invite record\n get Get a invite by ID\n create Create a new invite\n update Update an existing invite\n delete Delete a invite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,7 +47,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -55,6 +62,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -68,27 +77,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: InviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.invite - .findMany({ - select: { - id: true, - email: true, - senderId: true, - inviteToken: true, - inviteValid: true, - inviteLimit: true, - inviteCount: true, - multiple: true, - data: true, - expiresAt: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.invite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -98,6 +109,38 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: InviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.invite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/invites-module.ts b/sdk/constructive-cli/src/public/cli/commands/invites-module.ts index 299bcadcd..c94ad08cc 100644 --- a/sdk/constructive-cli/src/public/cli/commands/invites-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/invites-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateInvitesModuleInput, InvitesModulePatch } from '../../orm/input-types'; +import type { + CreateInvitesModuleInput, + InvitesModulePatch, + InvitesModuleSelect, + InvitesModuleFilter, + InvitesModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { entityTableId: 'uuid', }; const usage = - '\ninvites-module \n\nCommands:\n list List all invitesModule records\n get Get a invitesModule by ID\n create Create a new invitesModule\n update Update an existing invitesModule\n delete Delete a invitesModule\n\n --help, -h Show this help message\n'; + '\ninvites-module \n\nCommands:\n list List invitesModule records\n find-first Find first matching invitesModule record\n get Get a invitesModule by ID\n create Create a new invitesModule\n update Update an existing invitesModule\n delete Delete a invitesModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + emailsTableId: true, + usersTableId: true, + invitesTableId: true, + claimedInvitesTableId: true, + invitesTableName: true, + claimedInvitesTableName: true, + submitInviteCodeFunction: true, + prefix: true, + membershipType: true, + entityTableId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: InvitesModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.invitesModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - emailsTableId: true, - usersTableId: true, - invitesTableId: true, - claimedInvitesTableId: true, - invitesTableName: true, - claimedInvitesTableName: true, - submitInviteCodeFunction: true, - prefix: true, - membershipType: true, - entityTableId: true, - }, - }) - .execute(); + const result = await client.invitesModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +113,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + emailsTableId: true, + usersTableId: true, + invitesTableId: true, + claimedInvitesTableId: true, + invitesTableName: true, + claimedInvitesTableName: true, + submitInviteCodeFunction: true, + prefix: true, + membershipType: true, + entityTableId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: InvitesModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.invitesModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/levels-module.ts b/sdk/constructive-cli/src/public/cli/commands/levels-module.ts index 0c932d1e6..0cbde8a52 100644 --- a/sdk/constructive-cli/src/public/cli/commands/levels-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/levels-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateLevelsModuleInput, LevelsModulePatch } from '../../orm/input-types'; +import type { + CreateLevelsModuleInput, + LevelsModulePatch, + LevelsModuleSelect, + LevelsModuleFilter, + LevelsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -37,7 +44,7 @@ const fieldSchema: FieldSchema = { actorTableId: 'uuid', }; const usage = - '\nlevels-module \n\nCommands:\n list List all levelsModule records\n get Get a levelsModule by ID\n create Create a new levelsModule\n update Update an existing levelsModule\n delete Delete a levelsModule\n\n --help, -h Show this help message\n'; + '\nlevels-module \n\nCommands:\n list List levelsModule records\n find-first Find first matching levelsModule record\n get Get a levelsModule by ID\n create Create a new levelsModule\n update Update an existing levelsModule\n delete Delete a levelsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -54,7 +61,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -69,6 +76,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -82,41 +91,43 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + stepsTableId: true, + stepsTableName: true, + achievementsTableId: true, + achievementsTableName: true, + levelsTableId: true, + levelsTableName: true, + levelRequirementsTableId: true, + levelRequirementsTableName: true, + completedStep: true, + incompletedStep: true, + tgAchievement: true, + tgAchievementToggle: true, + tgAchievementToggleBoolean: true, + tgAchievementBoolean: true, + upsertAchievement: true, + tgUpdateAchievements: true, + stepsRequired: true, + levelAchieved: true, + prefix: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: LevelsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.levelsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - stepsTableId: true, - stepsTableName: true, - achievementsTableId: true, - achievementsTableName: true, - levelsTableId: true, - levelsTableName: true, - levelRequirementsTableId: true, - levelRequirementsTableName: true, - completedStep: true, - incompletedStep: true, - tgAchievement: true, - tgAchievementToggle: true, - tgAchievementToggleBoolean: true, - tgAchievementBoolean: true, - upsertAchievement: true, - tgUpdateAchievements: true, - stepsRequired: true, - levelAchieved: true, - prefix: true, - membershipType: true, - entityTableId: true, - actorTableId: true, - }, - }) - .execute(); + const result = await client.levelsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -126,6 +137,52 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + stepsTableId: true, + stepsTableName: true, + achievementsTableId: true, + achievementsTableName: true, + levelsTableId: true, + levelsTableName: true, + levelRequirementsTableId: true, + levelRequirementsTableName: true, + completedStep: true, + incompletedStep: true, + tgAchievement: true, + tgAchievementToggle: true, + tgAchievementToggleBoolean: true, + tgAchievementBoolean: true, + upsertAchievement: true, + tgUpdateAchievements: true, + stepsRequired: true, + levelAchieved: true, + prefix: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: LevelsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.levelsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/limits-module.ts b/sdk/constructive-cli/src/public/cli/commands/limits-module.ts index f1eb9e2e5..e087004e4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/limits-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/limits-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateLimitsModuleInput, LimitsModulePatch } from '../../orm/input-types'; +import type { + CreateLimitsModuleInput, + LimitsModulePatch, + LimitsModuleSelect, + LimitsModuleFilter, + LimitsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -29,7 +36,7 @@ const fieldSchema: FieldSchema = { actorTableId: 'uuid', }; const usage = - '\nlimits-module \n\nCommands:\n list List all limitsModule records\n get Get a limitsModule by ID\n create Create a new limitsModule\n update Update an existing limitsModule\n delete Delete a limitsModule\n\n --help, -h Show this help message\n'; + '\nlimits-module \n\nCommands:\n list List limitsModule records\n find-first Find first matching limitsModule record\n get Get a limitsModule by ID\n create Create a new limitsModule\n update Update an existing limitsModule\n delete Delete a limitsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -46,7 +53,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -61,6 +68,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -74,33 +83,35 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + tableName: true, + defaultTableId: true, + defaultTableName: true, + limitIncrementFunction: true, + limitDecrementFunction: true, + limitIncrementTrigger: true, + limitDecrementTrigger: true, + limitUpdateTrigger: true, + limitCheckFunction: true, + prefix: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: LimitsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.limitsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - tableName: true, - defaultTableId: true, - defaultTableName: true, - limitIncrementFunction: true, - limitDecrementFunction: true, - limitIncrementTrigger: true, - limitDecrementTrigger: true, - limitUpdateTrigger: true, - limitCheckFunction: true, - prefix: true, - membershipType: true, - entityTableId: true, - actorTableId: true, - }, - }) - .execute(); + const result = await client.limitsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -110,6 +121,44 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + tableName: true, + defaultTableId: true, + defaultTableName: true, + limitIncrementFunction: true, + limitDecrementFunction: true, + limitIncrementTrigger: true, + limitDecrementTrigger: true, + limitUpdateTrigger: true, + limitCheckFunction: true, + prefix: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: LimitsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.limitsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/membership-type.ts b/sdk/constructive-cli/src/public/cli/commands/membership-type.ts index 118aade21..056b84cd3 100644 --- a/sdk/constructive-cli/src/public/cli/commands/membership-type.ts +++ b/sdk/constructive-cli/src/public/cli/commands/membership-type.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateMembershipTypeInput, MembershipTypePatch } from '../../orm/input-types'; +import type { + CreateMembershipTypeInput, + MembershipTypePatch, + MembershipTypeSelect, + MembershipTypeFilter, + MembershipTypeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'int', name: 'string', @@ -15,7 +22,7 @@ const fieldSchema: FieldSchema = { prefix: 'string', }; const usage = - '\nmembership-type \n\nCommands:\n list List all membershipType records\n get Get a membershipType by ID\n create Create a new membershipType\n update Update an existing membershipType\n delete Delete a membershipType\n\n --help, -h Show this help message\n'; + '\nmembership-type \n\nCommands:\n list List membershipType records\n find-first Find first matching membershipType record\n get Get a membershipType by ID\n create Create a new membershipType\n update Update an existing membershipType\n delete Delete a membershipType\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -32,7 +39,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -47,6 +54,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -60,19 +69,21 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + description: true, + prefix: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: MembershipTypeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.membershipType - .findMany({ - select: { - id: true, - name: true, - description: true, - prefix: true, - }, - }) - .execute(); + const result = await client.membershipType.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -82,6 +93,30 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + description: true, + prefix: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: MembershipTypeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.membershipType.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts b/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts index 420be0778..d1e3b4b06 100644 --- a/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/membership-types-module.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateMembershipTypesModuleInput, MembershipTypesModulePatch, + MembershipTypesModuleSelect, + MembershipTypesModuleFilter, + MembershipTypesModuleOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -19,7 +23,7 @@ const fieldSchema: FieldSchema = { tableName: 'string', }; const usage = - '\nmembership-types-module \n\nCommands:\n list List all membershipTypesModule records\n get Get a membershipTypesModule by ID\n create Create a new membershipTypesModule\n update Update an existing membershipTypesModule\n delete Delete a membershipTypesModule\n\n --help, -h Show this help message\n'; + '\nmembership-types-module \n\nCommands:\n list List membershipTypesModule records\n find-first Find first matching membershipTypesModule record\n get Get a membershipTypesModule by ID\n create Create a new membershipTypesModule\n update Update an existing membershipTypesModule\n delete Delete a membershipTypesModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,20 +70,27 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + MembershipTypesModuleSelect, + MembershipTypesModuleFilter, + never, + MembershipTypesModuleOrderBy + > & { + select: MembershipTypesModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.membershipTypesModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - tableId: true, - tableName: true, - }, - }) - .execute(); + const result = await client.membershipTypesModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -87,6 +100,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: MembershipTypesModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.membershipTypesModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts b/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts index 30413fae3..12d998450 100644 --- a/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/memberships-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateMembershipsModuleInput, MembershipsModulePatch } from '../../orm/input-types'; +import type { + CreateMembershipsModuleInput, + MembershipsModulePatch, + MembershipsModuleSelect, + MembershipsModuleFilter, + MembershipsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -42,7 +49,7 @@ const fieldSchema: FieldSchema = { entityIdsFunction: 'string', }; const usage = - '\nmemberships-module \n\nCommands:\n list List all membershipsModule records\n get Get a membershipsModule by ID\n create Create a new membershipsModule\n update Update an existing membershipsModule\n delete Delete a membershipsModule\n\n --help, -h Show this help message\n'; + '\nmemberships-module \n\nCommands:\n list List membershipsModule records\n find-first Find first matching membershipsModule record\n get Get a membershipsModule by ID\n create Create a new membershipsModule\n update Update an existing membershipsModule\n delete Delete a membershipsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -59,7 +66,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -74,6 +81,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -87,46 +96,53 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + membershipsTableId: true, + membershipsTableName: true, + membersTableId: true, + membersTableName: true, + membershipDefaultsTableId: true, + membershipDefaultsTableName: true, + grantsTableId: true, + grantsTableName: true, + actorTableId: true, + limitsTableId: true, + defaultLimitsTableId: true, + permissionsTableId: true, + defaultPermissionsTableId: true, + sprtTableId: true, + adminGrantsTableId: true, + adminGrantsTableName: true, + ownerGrantsTableId: true, + ownerGrantsTableName: true, + membershipType: true, + entityTableId: true, + entityTableOwnerId: true, + prefix: true, + actorMaskCheck: true, + actorPermCheck: true, + entityIdsByMask: true, + entityIdsByPerm: true, + entityIdsFunction: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + MembershipsModuleSelect, + MembershipsModuleFilter, + never, + MembershipsModuleOrderBy + > & { + select: MembershipsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.membershipsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - membershipsTableId: true, - membershipsTableName: true, - membersTableId: true, - membersTableName: true, - membershipDefaultsTableId: true, - membershipDefaultsTableName: true, - grantsTableId: true, - grantsTableName: true, - actorTableId: true, - limitsTableId: true, - defaultLimitsTableId: true, - permissionsTableId: true, - defaultPermissionsTableId: true, - sprtTableId: true, - adminGrantsTableId: true, - adminGrantsTableName: true, - ownerGrantsTableId: true, - ownerGrantsTableName: true, - membershipType: true, - entityTableId: true, - entityTableOwnerId: true, - prefix: true, - actorMaskCheck: true, - actorPermCheck: true, - entityIdsByMask: true, - entityIdsByPerm: true, - entityIdsFunction: true, - }, - }) - .execute(); + const result = await client.membershipsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -136,6 +152,57 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + membershipsTableId: true, + membershipsTableName: true, + membersTableId: true, + membersTableName: true, + membershipDefaultsTableId: true, + membershipDefaultsTableName: true, + grantsTableId: true, + grantsTableName: true, + actorTableId: true, + limitsTableId: true, + defaultLimitsTableId: true, + permissionsTableId: true, + defaultPermissionsTableId: true, + sprtTableId: true, + adminGrantsTableId: true, + adminGrantsTableName: true, + ownerGrantsTableId: true, + ownerGrantsTableName: true, + membershipType: true, + entityTableId: true, + entityTableOwnerId: true, + prefix: true, + actorMaskCheck: true, + actorPermCheck: true, + entityIdsByMask: true, + entityIdsByPerm: true, + entityIdsFunction: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: MembershipsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.membershipsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/migrate-file.ts b/sdk/constructive-cli/src/public/cli/commands/migrate-file.ts index 936aef9fb..c6a44d3b1 100644 --- a/sdk/constructive-cli/src/public/cli/commands/migrate-file.ts +++ b/sdk/constructive-cli/src/public/cli/commands/migrate-file.ts @@ -5,16 +5,23 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateMigrateFileInput, MigrateFilePatch } from '../../orm/input-types'; +import type { + CreateMigrateFileInput, + MigrateFilePatch, + MigrateFileSelect, + MigrateFileFilter, + MigrateFileOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', upload: 'string', }; const usage = - '\nmigrate-file \n\nCommands:\n list List all migrateFile records\n create Create a new migrateFile\n\n --help, -h Show this help message\n'; + '\nmigrate-file \n\nCommands:\n list List migrateFile records\n find-first Find first matching migrateFile record\n create Create a new migrateFile\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -31,7 +38,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -46,6 +53,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -53,18 +62,20 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + upload: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: MigrateFileSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.migrateFile - .findMany({ - select: { - id: true, - databaseId: true, - upload: true, - }, - }) - .execute(); + const result = await client.migrateFile.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -74,6 +85,29 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + upload: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: MigrateFileSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.migrateFile.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts b/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts index 2e69f9b20..b356f8a41 100644 --- a/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts +++ b/sdk/constructive-cli/src/public/cli/commands/node-type-registry.ts @@ -5,22 +5,31 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateNodeTypeRegistryInput, NodeTypeRegistryPatch } from '../../orm/input-types'; +import type { + CreateNodeTypeRegistryInput, + NodeTypeRegistryPatch, + NodeTypeRegistrySelect, + NodeTypeRegistryFilter, + NodeTypeRegistryOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { name: 'string', slug: 'string', category: 'string', displayName: 'string', description: 'string', + summary: 'string', parameterSchema: 'json', + guidance: 'json', tags: 'string', createdAt: 'string', updatedAt: 'string', }; const usage = - '\nnode-type-registry \n\nCommands:\n list List all nodeTypeRegistry records\n get Get a nodeTypeRegistry by ID\n create Create a new nodeTypeRegistry\n update Update an existing nodeTypeRegistry\n delete Delete a nodeTypeRegistry\n\n --help, -h Show this help message\n'; + '\nnode-type-registry \n\nCommands:\n list List nodeTypeRegistry records\n find-first Find first matching nodeTypeRegistry record\n get Get a nodeTypeRegistry by ID\n create Create a new nodeTypeRegistry\n update Update an existing nodeTypeRegistry\n delete Delete a nodeTypeRegistry\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +46,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +61,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +76,33 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + name: true, + slug: true, + category: true, + displayName: true, + description: true, + summary: true, + parameterSchema: true, + guidance: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + NodeTypeRegistrySelect, + NodeTypeRegistryFilter, + never, + NodeTypeRegistryOrderBy + > & { + select: NodeTypeRegistrySelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.nodeTypeRegistry - .findMany({ - select: { - name: true, - slug: true, - category: true, - displayName: true, - description: true, - parameterSchema: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.nodeTypeRegistry.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +112,37 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + name: true, + slug: true, + category: true, + displayName: true, + description: true, + summary: true, + parameterSchema: true, + guidance: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: NodeTypeRegistrySelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.nodeTypeRegistry.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ @@ -112,7 +163,9 @@ async function handleGet(argv: Partial>, prompter: Inqui category: true, displayName: true, description: true, + summary: true, parameterSchema: true, + guidance: true, tags: true, createdAt: true, updatedAt: true, @@ -163,6 +216,13 @@ async function handleCreate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'text', + name: 'summary', + message: 'summary', + required: false, + skipPrompt: true, + }, { type: 'json', name: 'parameterSchema', @@ -170,6 +230,13 @@ async function handleCreate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'json', + name: 'guidance', + message: 'guidance', + required: false, + skipPrompt: true, + }, { type: 'text', name: 'tags', @@ -192,7 +259,9 @@ async function handleCreate(argv: Partial>, prompter: In category: cleanedData.category, displayName: cleanedData.displayName, description: cleanedData.description, + summary: cleanedData.summary, parameterSchema: cleanedData.parameterSchema, + guidance: cleanedData.guidance, tags: cleanedData.tags, }, select: { @@ -201,7 +270,9 @@ async function handleCreate(argv: Partial>, prompter: In category: true, displayName: true, description: true, + summary: true, parameterSchema: true, + guidance: true, tags: true, createdAt: true, updatedAt: true, @@ -252,6 +323,13 @@ async function handleUpdate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'text', + name: 'summary', + message: 'summary', + required: false, + skipPrompt: true, + }, { type: 'json', name: 'parameterSchema', @@ -259,6 +337,13 @@ async function handleUpdate(argv: Partial>, prompter: In required: false, skipPrompt: true, }, + { + type: 'json', + name: 'guidance', + message: 'guidance', + required: false, + skipPrompt: true, + }, { type: 'text', name: 'tags', @@ -280,7 +365,9 @@ async function handleUpdate(argv: Partial>, prompter: In category: cleanedData.category, displayName: cleanedData.displayName, description: cleanedData.description, + summary: cleanedData.summary, parameterSchema: cleanedData.parameterSchema, + guidance: cleanedData.guidance, tags: cleanedData.tags, }, select: { @@ -289,7 +376,9 @@ async function handleUpdate(argv: Partial>, prompter: In category: true, displayName: true, description: true, + summary: true, parameterSchema: true, + guidance: true, tags: true, createdAt: true, updatedAt: true, diff --git a/sdk/constructive-cli/src/public/cli/commands/object.ts b/sdk/constructive-cli/src/public/cli/commands/object.ts index 098b310d5..a6293a397 100644 --- a/sdk/constructive-cli/src/public/cli/commands/object.ts +++ b/sdk/constructive-cli/src/public/cli/commands/object.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateObjectInput, ObjectPatch } from '../../orm/input-types'; +import type { + CreateObjectInput, + ObjectPatch, + ObjectSelect, + ObjectFilter, + ObjectOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { hashUuid: 'uuid', id: 'uuid', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\nobject \n\nCommands:\n list List all object records\n get Get a object by ID\n create Create a new object\n update Update an existing object\n delete Delete a object\n\n --help, -h Show this help message\n'; + '\nobject \n\nCommands:\n list List object records\n find-first Find first matching object record\n get Get a object by ID\n create Create a new object\n update Update an existing object\n delete Delete a object\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,22 +73,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + kids: true, + ktree: true, + data: true, + frzn: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ObjectSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.object - .findMany({ - select: { - id: true, - databaseId: true, - kids: true, - ktree: true, - data: true, - frzn: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.object.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -89,6 +100,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + kids: true, + ktree: true, + data: true, + frzn: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ObjectSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.object.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts index 4f17a70cb..e9d41e5ed 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-admin-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgAdminGrantInput, OrgAdminGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgAdminGrantInput, + OrgAdminGrantPatch, + OrgAdminGrantSelect, + OrgAdminGrantFilter, + OrgAdminGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\norg-admin-grant \n\nCommands:\n list List all orgAdminGrant records\n get Get a orgAdminGrant by ID\n create Create a new orgAdminGrant\n update Update an existing orgAdminGrant\n delete Delete a orgAdminGrant\n\n --help, -h Show this help message\n'; + '\norg-admin-grant \n\nCommands:\n list List orgAdminGrant records\n find-first Find first matching orgAdminGrant record\n get Get a orgAdminGrant by ID\n create Create a new orgAdminGrant\n update Update an existing orgAdminGrant\n delete Delete a orgAdminGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgAdminGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgAdminGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - entityId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.orgAdminGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgAdminGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgAdminGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts index fc388684a..537be47af 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgChartEdgeGrantInput, OrgChartEdgeGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgChartEdgeGrantInput, + OrgChartEdgeGrantPatch, + OrgChartEdgeGrantSelect, + OrgChartEdgeGrantFilter, + OrgChartEdgeGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', entityId: 'uuid', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\norg-chart-edge-grant \n\nCommands:\n list List all orgChartEdgeGrant records\n get Get a orgChartEdgeGrant by ID\n create Create a new orgChartEdgeGrant\n update Update an existing orgChartEdgeGrant\n delete Delete a orgChartEdgeGrant\n\n --help, -h Show this help message\n'; + '\norg-chart-edge-grant \n\nCommands:\n list List orgChartEdgeGrant records\n find-first Find first matching orgChartEdgeGrant record\n get Get a orgChartEdgeGrant by ID\n create Create a new orgChartEdgeGrant\n update Update an existing orgChartEdgeGrant\n delete Delete a orgChartEdgeGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + entityId: true, + childId: true, + parentId: true, + grantorId: true, + isGrant: true, + positionTitle: true, + positionLevel: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgChartEdgeGrantSelect, + OrgChartEdgeGrantFilter, + never, + OrgChartEdgeGrantOrderBy + > & { + select: OrgChartEdgeGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgChartEdgeGrant - .findMany({ - select: { - id: true, - entityId: true, - childId: true, - parentId: true, - grantorId: true, - isGrant: true, - positionTitle: true, - positionLevel: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.orgChartEdgeGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +108,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + entityId: true, + childId: true, + parentId: true, + grantorId: true, + isGrant: true, + positionTitle: true, + positionLevel: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgChartEdgeGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgChartEdgeGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts index 72fa13a5e..410d4f84f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-chart-edge.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgChartEdgeInput, OrgChartEdgePatch } from '../../orm/input-types'; +import type { + CreateOrgChartEdgeInput, + OrgChartEdgePatch, + OrgChartEdgeSelect, + OrgChartEdgeFilter, + OrgChartEdgeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { positionLevel: 'int', }; const usage = - '\norg-chart-edge \n\nCommands:\n list List all orgChartEdge records\n get Get a orgChartEdge by ID\n create Create a new orgChartEdge\n update Update an existing orgChartEdge\n delete Delete a orgChartEdge\n\n --help, -h Show this help message\n'; + '\norg-chart-edge \n\nCommands:\n list List orgChartEdge records\n find-first Find first matching orgChartEdge record\n get Get a orgChartEdge by ID\n create Create a new orgChartEdge\n update Update an existing orgChartEdge\n delete Delete a orgChartEdge\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + entityId: true, + childId: true, + parentId: true, + positionTitle: true, + positionLevel: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgChartEdgeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgChartEdge - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - entityId: true, - childId: true, - parentId: true, - positionTitle: true, - positionLevel: true, - }, - }) - .execute(); + const result = await client.orgChartEdge.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + entityId: true, + childId: true, + parentId: true, + positionTitle: true, + positionLevel: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgChartEdgeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgChartEdge.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts b/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts index 13e7b5133..ddf858e3c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-claimed-invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgClaimedInviteInput, OrgClaimedInvitePatch } from '../../orm/input-types'; +import type { + CreateOrgClaimedInviteInput, + OrgClaimedInvitePatch, + OrgClaimedInviteSelect, + OrgClaimedInviteFilter, + OrgClaimedInviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', data: 'json', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-claimed-invite \n\nCommands:\n list List all orgClaimedInvite records\n get Get a orgClaimedInvite by ID\n create Create a new orgClaimedInvite\n update Update an existing orgClaimedInvite\n delete Delete a orgClaimedInvite\n\n --help, -h Show this help message\n'; + '\norg-claimed-invite \n\nCommands:\n list List orgClaimedInvite records\n find-first Find first matching orgClaimedInvite record\n get Get a orgClaimedInvite by ID\n create Create a new orgClaimedInvite\n update Update an existing orgClaimedInvite\n delete Delete a orgClaimedInvite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgClaimedInviteSelect, + OrgClaimedInviteFilter, + never, + OrgClaimedInviteOrderBy + > & { + select: OrgClaimedInviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgClaimedInvite - .findMany({ - select: { - id: true, - data: true, - senderId: true, - receiverId: true, - createdAt: true, - updatedAt: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgClaimedInvite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +104,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + data: true, + senderId: true, + receiverId: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgClaimedInviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgClaimedInvite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts b/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts index 665a15560..8a3595b5e 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-get-managers-record.ts @@ -5,18 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgGetManagersRecordInput, OrgGetManagersRecordPatch, + OrgGetManagersRecordSelect, + OrgGetManagersRecordFilter, + OrgGetManagersRecordsOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-managers-record \n\nCommands:\n list List all orgGetManagersRecord records\n create Create a new orgGetManagersRecord\n\n --help, -h Show this help message\n'; + '\norg-get-managers-record \n\nCommands:\n list List orgGetManagersRecord records\n find-first Find first matching orgGetManagersRecord record\n create Create a new orgGetManagersRecord\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -55,17 +61,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgGetManagersRecordSelect, + OrgGetManagersRecordFilter, + never, + OrgGetManagersRecordsOrderBy + > & { + select: OrgGetManagersRecordSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgGetManagersRecord - .findMany({ - select: { - userId: true, - depth: true, - }, - }) - .execute(); + const result = await client.orgGetManagersRecord.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -75,6 +88,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgGetManagersRecordSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgGetManagersRecord.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts b/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts index 3bcb09aca..64eff3fef 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-get-subordinates-record.ts @@ -5,18 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgGetSubordinatesRecordInput, OrgGetSubordinatesRecordPatch, + OrgGetSubordinatesRecordSelect, + OrgGetSubordinatesRecordFilter, + OrgGetSubordinatesRecordsOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { userId: 'uuid', depth: 'int', }; const usage = - '\norg-get-subordinates-record \n\nCommands:\n list List all orgGetSubordinatesRecord records\n create Create a new orgGetSubordinatesRecord\n\n --help, -h Show this help message\n'; + '\norg-get-subordinates-record \n\nCommands:\n list List orgGetSubordinatesRecord records\n find-first Find first matching orgGetSubordinatesRecord record\n create Create a new orgGetSubordinatesRecord\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -55,17 +61,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgGetSubordinatesRecordSelect, + OrgGetSubordinatesRecordFilter, + never, + OrgGetSubordinatesRecordsOrderBy + > & { + select: OrgGetSubordinatesRecordSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgGetSubordinatesRecord - .findMany({ - select: { - userId: true, - depth: true, - }, - }) - .execute(); + const result = await client.orgGetSubordinatesRecord.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -75,6 +88,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + userId: true, + depth: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgGetSubordinatesRecordSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgGetSubordinatesRecord.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-grant.ts index 9bc5f5be8..a538aa1c2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgGrantInput, OrgGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgGrantInput, + OrgGrantPatch, + OrgGrantSelect, + OrgGrantFilter, + OrgGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\norg-grant \n\nCommands:\n list List all orgGrant records\n get Get a orgGrant by ID\n create Create a new orgGrant\n update Update an existing orgGrant\n delete Delete a orgGrant\n\n --help, -h Show this help message\n'; + '\norg-grant \n\nCommands:\n list List orgGrant records\n find-first Find first matching orgGrant record\n get Get a orgGrant by ID\n create Create a new orgGrant\n update Update an existing orgGrant\n delete Delete a orgGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgGrant - .findMany({ - select: { - id: true, - permissions: true, - isGrant: true, - actorId: true, - entityId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.orgGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-invite.ts b/sdk/constructive-cli/src/public/cli/commands/org-invite.ts index 9b512b138..85aeda86c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-invite.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-invite.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgInviteInput, OrgInvitePatch } from '../../orm/input-types'; +import type { + CreateOrgInviteInput, + OrgInvitePatch, + OrgInviteSelect, + OrgInviteFilter, + OrgInviteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', email: 'string', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-invite \n\nCommands:\n list List all orgInvite records\n get Get a orgInvite by ID\n create Create a new orgInvite\n update Update an existing orgInvite\n delete Delete a orgInvite\n\n --help, -h Show this help message\n'; + '\norg-invite \n\nCommands:\n list List orgInvite records\n find-first Find first matching orgInvite record\n get Get a orgInvite by ID\n create Create a new orgInvite\n update Update an existing orgInvite\n delete Delete a orgInvite\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + receiverId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgInviteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgInvite - .findMany({ - select: { - id: true, - email: true, - senderId: true, - receiverId: true, - inviteToken: true, - inviteValid: true, - inviteLimit: true, - inviteCount: true, - multiple: true, - data: true, - expiresAt: true, - createdAt: true, - updatedAt: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgInvite.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +113,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + email: true, + senderId: true, + receiverId: true, + inviteToken: true, + inviteValid: true, + inviteLimit: true, + inviteCount: true, + multiple: true, + data: true, + expiresAt: true, + createdAt: true, + updatedAt: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgInviteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgInvite.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts b/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts index 87b6dd4bc..88d800132 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-limit-default.ts @@ -5,16 +5,23 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgLimitDefaultInput, OrgLimitDefaultPatch } from '../../orm/input-types'; +import type { + CreateOrgLimitDefaultInput, + OrgLimitDefaultPatch, + OrgLimitDefaultSelect, + OrgLimitDefaultFilter, + OrgLimitDefaultOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', max: 'int', }; const usage = - '\norg-limit-default \n\nCommands:\n list List all orgLimitDefault records\n get Get a orgLimitDefault by ID\n create Create a new orgLimitDefault\n update Update an existing orgLimitDefault\n delete Delete a orgLimitDefault\n\n --help, -h Show this help message\n'; + '\norg-limit-default \n\nCommands:\n list List orgLimitDefault records\n find-first Find first matching orgLimitDefault record\n get Get a orgLimitDefault by ID\n create Create a new orgLimitDefault\n update Update an existing orgLimitDefault\n delete Delete a orgLimitDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -31,7 +38,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -46,6 +53,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -59,18 +68,20 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgLimitDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgLimitDefault - .findMany({ - select: { - id: true, - name: true, - max: true, - }, - }) - .execute(); + const result = await client.orgLimitDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -80,6 +91,29 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + max: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgLimitDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgLimitDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-limit.ts b/sdk/constructive-cli/src/public/cli/commands/org-limit.ts index f790325cc..3428c1ea9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-limit.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-limit.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgLimitInput, OrgLimitPatch } from '../../orm/input-types'; +import type { + CreateOrgLimitInput, + OrgLimitPatch, + OrgLimitSelect, + OrgLimitFilter, + OrgLimitOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-limit \n\nCommands:\n list List all orgLimit records\n get Get a orgLimit by ID\n create Create a new orgLimit\n update Update an existing orgLimit\n delete Delete a orgLimit\n\n --help, -h Show this help message\n'; + '\norg-limit \n\nCommands:\n list List orgLimit records\n find-first Find first matching orgLimit record\n get Get a orgLimit by ID\n create Create a new orgLimit\n update Update an existing orgLimit\n delete Delete a orgLimit\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgLimitSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgLimit - .findMany({ - select: { - id: true, - name: true, - actorId: true, - num: true, - max: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgLimit.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + actorId: true, + num: true, + max: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgLimitSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgLimit.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-member.ts b/sdk/constructive-cli/src/public/cli/commands/org-member.ts index 93f48ca68..c3c831dcb 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-member.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-member.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgMemberInput, OrgMemberPatch } from '../../orm/input-types'; +import type { + CreateOrgMemberInput, + OrgMemberPatch, + OrgMemberSelect, + OrgMemberFilter, + OrgMemberOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isAdmin: 'boolean', @@ -15,7 +22,7 @@ const fieldSchema: FieldSchema = { entityId: 'uuid', }; const usage = - '\norg-member \n\nCommands:\n list List all orgMember records\n get Get a orgMember by ID\n create Create a new orgMember\n update Update an existing orgMember\n delete Delete a orgMember\n\n --help, -h Show this help message\n'; + '\norg-member \n\nCommands:\n list List orgMember records\n find-first Find first matching orgMember record\n get Get a orgMember by ID\n create Create a new orgMember\n update Update an existing orgMember\n delete Delete a orgMember\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -32,7 +39,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -47,6 +54,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -60,19 +69,21 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isAdmin: true, + actorId: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgMemberSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgMember - .findMany({ - select: { - id: true, - isAdmin: true, - actorId: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgMember.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -82,6 +93,30 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isAdmin: true, + actorId: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgMemberSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgMember.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts b/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts index ff2ef05a9..a0d1bc6dc 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-membership-default.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgMembershipDefaultInput, OrgMembershipDefaultPatch, + OrgMembershipDefaultSelect, + OrgMembershipDefaultFilter, + OrgMembershipDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -23,7 +27,7 @@ const fieldSchema: FieldSchema = { createGroupsCascadeMembers: 'boolean', }; const usage = - '\norg-membership-default \n\nCommands:\n list List all orgMembershipDefault records\n get Get a orgMembershipDefault by ID\n create Create a new orgMembershipDefault\n update Update an existing orgMembershipDefault\n delete Delete a orgMembershipDefault\n\n --help, -h Show this help message\n'; + '\norg-membership-default \n\nCommands:\n list List orgMembershipDefault records\n find-first Find first matching orgMembershipDefault record\n get Get a orgMembershipDefault by ID\n create Create a new orgMembershipDefault\n update Update an existing orgMembershipDefault\n delete Delete a orgMembershipDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -55,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -68,24 +74,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + entityId: true, + deleteMemberCascadeGroups: true, + createGroupsCascadeMembers: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgMembershipDefaultSelect, + OrgMembershipDefaultFilter, + never, + OrgMembershipDefaultOrderBy + > & { + select: OrgMembershipDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgMembershipDefault - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - entityId: true, - deleteMemberCascadeGroups: true, - createGroupsCascadeMembers: true, - }, - }) - .execute(); + const result = await client.orgMembershipDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -95,6 +108,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + entityId: true, + deleteMemberCascadeGroups: true, + createGroupsCascadeMembers: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgMembershipDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgMembershipDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-membership.ts b/sdk/constructive-cli/src/public/cli/commands/org-membership.ts index 0c3e13f3b..0e9b312b2 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-membership.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-membership.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgMembershipInput, OrgMembershipPatch } from '../../orm/input-types'; +import type { + CreateOrgMembershipInput, + OrgMembershipPatch, + OrgMembershipSelect, + OrgMembershipFilter, + OrgMembershipOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', createdAt: 'string', @@ -27,7 +34,7 @@ const fieldSchema: FieldSchema = { profileId: 'uuid', }; const usage = - '\norg-membership \n\nCommands:\n list List all orgMembership records\n get Get a orgMembership by ID\n create Create a new orgMembership\n update Update an existing orgMembership\n delete Delete a orgMembership\n\n --help, -h Show this help message\n'; + '\norg-membership \n\nCommands:\n list List orgMembership records\n find-first Find first matching orgMembership record\n get Get a orgMembership by ID\n create Create a new orgMembership\n update Update an existing orgMembership\n delete Delete a orgMembership\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -44,7 +51,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -59,6 +66,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -72,31 +81,33 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + entityId: true, + profileId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgMembershipSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgMembership - .findMany({ - select: { - id: true, - createdAt: true, - updatedAt: true, - createdBy: true, - updatedBy: true, - isApproved: true, - isBanned: true, - isDisabled: true, - isActive: true, - isOwner: true, - isAdmin: true, - permissions: true, - granted: true, - actorId: true, - entityId: true, - profileId: true, - }, - }) - .execute(); + const result = await client.orgMembership.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -106,6 +117,42 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + createdAt: true, + updatedAt: true, + createdBy: true, + updatedBy: true, + isApproved: true, + isBanned: true, + isDisabled: true, + isActive: true, + isOwner: true, + isAdmin: true, + permissions: true, + granted: true, + actorId: true, + entityId: true, + profileId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgMembershipSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgMembership.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts b/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts index 2d157665e..15ed00359 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-owner-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgOwnerGrantInput, OrgOwnerGrantPatch } from '../../orm/input-types'; +import type { + CreateOrgOwnerGrantInput, + OrgOwnerGrantPatch, + OrgOwnerGrantSelect, + OrgOwnerGrantFilter, + OrgOwnerGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', isGrant: 'boolean', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\norg-owner-grant \n\nCommands:\n list List all orgOwnerGrant records\n get Get a orgOwnerGrant by ID\n create Create a new orgOwnerGrant\n update Update an existing orgOwnerGrant\n delete Delete a orgOwnerGrant\n\n --help, -h Show this help message\n'; + '\norg-owner-grant \n\nCommands:\n list List orgOwnerGrant records\n find-first Find first matching orgOwnerGrant record\n get Get a orgOwnerGrant by ID\n create Create a new orgOwnerGrant\n update Update an existing orgOwnerGrant\n delete Delete a orgOwnerGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgOwnerGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgOwnerGrant - .findMany({ - select: { - id: true, - isGrant: true, - actorId: true, - entityId: true, - grantorId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.orgOwnerGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + isGrant: true, + actorId: true, + entityId: true, + grantorId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgOwnerGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgOwnerGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts b/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts index 02856e484..9eeee8a17 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permission-default.ts @@ -5,19 +5,23 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateOrgPermissionDefaultInput, OrgPermissionDefaultPatch, + OrgPermissionDefaultSelect, + OrgPermissionDefaultFilter, + OrgPermissionDefaultOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', permissions: 'string', entityId: 'uuid', }; const usage = - '\norg-permission-default \n\nCommands:\n list List all orgPermissionDefault records\n get Get a orgPermissionDefault by ID\n create Create a new orgPermissionDefault\n update Update an existing orgPermissionDefault\n delete Delete a orgPermissionDefault\n\n --help, -h Show this help message\n'; + '\norg-permission-default \n\nCommands:\n list List orgPermissionDefault records\n find-first Find first matching orgPermissionDefault record\n get Get a orgPermissionDefault by ID\n create Create a new orgPermissionDefault\n update Update an existing orgPermissionDefault\n delete Delete a orgPermissionDefault\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +38,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +53,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,18 +68,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + permissions: true, + entityId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + OrgPermissionDefaultSelect, + OrgPermissionDefaultFilter, + never, + OrgPermissionDefaultOrderBy + > & { + select: OrgPermissionDefaultSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgPermissionDefault - .findMany({ - select: { - id: true, - permissions: true, - entityId: true, - }, - }) - .execute(); + const result = await client.orgPermissionDefault.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -83,6 +96,29 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + permissions: true, + entityId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgPermissionDefaultSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgPermissionDefault.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/org-permission.ts b/sdk/constructive-cli/src/public/cli/commands/org-permission.ts index 91a56140e..f1a175a20 100644 --- a/sdk/constructive-cli/src/public/cli/commands/org-permission.ts +++ b/sdk/constructive-cli/src/public/cli/commands/org-permission.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateOrgPermissionInput, OrgPermissionPatch } from '../../orm/input-types'; +import type { + CreateOrgPermissionInput, + OrgPermissionPatch, + OrgPermissionSelect, + OrgPermissionFilter, + OrgPermissionOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { description: 'string', }; const usage = - '\norg-permission \n\nCommands:\n list List all orgPermission records\n get Get a orgPermission by ID\n create Create a new orgPermission\n update Update an existing orgPermission\n delete Delete a orgPermission\n\n --help, -h Show this help message\n'; + '\norg-permission \n\nCommands:\n list List orgPermission records\n find-first Find first matching orgPermission record\n get Get a orgPermission by ID\n create Create a new orgPermission\n update Update an existing orgPermission\n delete Delete a orgPermission\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: OrgPermissionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.orgPermission - .findMany({ - select: { - id: true, - name: true, - bitnum: true, - bitstr: true, - description: true, - }, - }) - .execute(); + const result = await client.orgPermission.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + bitnum: true, + bitstr: true, + description: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: OrgPermissionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.orgPermission.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts b/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts index b9eadb294..20187523c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/permissions-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreatePermissionsModuleInput, PermissionsModulePatch } from '../../orm/input-types'; +import type { + CreatePermissionsModuleInput, + PermissionsModulePatch, + PermissionsModuleSelect, + PermissionsModuleFilter, + PermissionsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -28,7 +35,7 @@ const fieldSchema: FieldSchema = { getMaskByName: 'string', }; const usage = - '\npermissions-module \n\nCommands:\n list List all permissionsModule records\n get Get a permissionsModule by ID\n create Create a new permissionsModule\n update Update an existing permissionsModule\n delete Delete a permissionsModule\n\n --help, -h Show this help message\n'; + '\npermissions-module \n\nCommands:\n list List permissionsModule records\n find-first Find first matching permissionsModule record\n get Get a permissionsModule by ID\n create Create a new permissionsModule\n update Update an existing permissionsModule\n delete Delete a permissionsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -45,7 +52,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -60,6 +67,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -73,32 +82,39 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + tableName: true, + defaultTableId: true, + defaultTableName: true, + bitlen: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + prefix: true, + getPaddedMask: true, + getMask: true, + getByMask: true, + getMaskByName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + PermissionsModuleSelect, + PermissionsModuleFilter, + never, + PermissionsModuleOrderBy + > & { + select: PermissionsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.permissionsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - tableName: true, - defaultTableId: true, - defaultTableName: true, - bitlen: true, - membershipType: true, - entityTableId: true, - actorTableId: true, - prefix: true, - getPaddedMask: true, - getMask: true, - getByMask: true, - getMaskByName: true, - }, - }) - .execute(); + const result = await client.permissionsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -108,6 +124,43 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + tableName: true, + defaultTableId: true, + defaultTableName: true, + bitlen: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + prefix: true, + getPaddedMask: true, + getMask: true, + getByMask: true, + getMaskByName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: PermissionsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.permissionsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/phone-number.ts b/sdk/constructive-cli/src/public/cli/commands/phone-number.ts index 80e0b5a76..984aeec18 100644 --- a/sdk/constructive-cli/src/public/cli/commands/phone-number.ts +++ b/sdk/constructive-cli/src/public/cli/commands/phone-number.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreatePhoneNumberInput, PhoneNumberPatch } from '../../orm/input-types'; +import type { + CreatePhoneNumberInput, + PhoneNumberPatch, + PhoneNumberSelect, + PhoneNumberFilter, + PhoneNumberOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', ownerId: 'uuid', @@ -19,7 +26,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nphone-number \n\nCommands:\n list List all phoneNumber records\n get Get a phoneNumber by ID\n create Create a new phoneNumber\n update Update an existing phoneNumber\n delete Delete a phoneNumber\n\n --help, -h Show this help message\n'; + '\nphone-number \n\nCommands:\n list List phoneNumber records\n find-first Find first matching phoneNumber record\n get Get a phoneNumber by ID\n create Create a new phoneNumber\n update Update an existing phoneNumber\n delete Delete a phoneNumber\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -36,7 +43,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -51,6 +58,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -64,23 +73,25 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + ownerId: true, + cc: true, + number: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: PhoneNumberSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.phoneNumber - .findMany({ - select: { - id: true, - ownerId: true, - cc: true, - number: true, - isVerified: true, - isPrimary: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.phoneNumber.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -90,6 +101,34 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + ownerId: true, + cc: true, + number: true, + isVerified: true, + isPrimary: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: PhoneNumberSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.phoneNumber.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts b/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts index a9bf30c6c..a563d45f3 100644 --- a/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/phone-numbers-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreatePhoneNumbersModuleInput, PhoneNumbersModulePatch } from '../../orm/input-types'; +import type { + CreatePhoneNumbersModuleInput, + PhoneNumbersModulePatch, + PhoneNumbersModuleSelect, + PhoneNumbersModuleFilter, + PhoneNumbersModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { tableName: 'string', }; const usage = - '\nphone-numbers-module \n\nCommands:\n list List all phoneNumbersModule records\n get Get a phoneNumbersModule by ID\n create Create a new phoneNumbersModule\n update Update an existing phoneNumbersModule\n delete Delete a phoneNumbersModule\n\n --help, -h Show this help message\n'; + '\nphone-numbers-module \n\nCommands:\n list List phoneNumbersModule records\n find-first Find first matching phoneNumbersModule record\n get Get a phoneNumbersModule by ID\n create Create a new phoneNumbersModule\n update Update an existing phoneNumbersModule\n delete Delete a phoneNumbersModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,29 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + PhoneNumbersModuleSelect, + PhoneNumbersModuleFilter, + never, + PhoneNumbersModuleOrderBy + > & { + select: PhoneNumbersModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.phoneNumbersModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - ownerTableId: true, - tableName: true, - }, - }) - .execute(); + const result = await client.phoneNumbersModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +104,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: PhoneNumbersModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.phoneNumbersModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/policy.ts b/sdk/constructive-cli/src/public/cli/commands/policy.ts index 008fce8d4..93f78c8df 100644 --- a/sdk/constructive-cli/src/public/cli/commands/policy.ts +++ b/sdk/constructive-cli/src/public/cli/commands/policy.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreatePolicyInput, PolicyPatch } from '../../orm/input-types'; +import type { + CreatePolicyInput, + PolicyPatch, + PolicySelect, + PolicyFilter, + PolicyOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -28,7 +35,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\npolicy \n\nCommands:\n list List all policy records\n get Get a policy by ID\n create Create a new policy\n update Update an existing policy\n delete Delete a policy\n\n --help, -h Show this help message\n'; + '\npolicy \n\nCommands:\n list List policy records\n find-first Find first matching policy record\n get Get a policy by ID\n create Create a new policy\n update Update an existing policy\n delete Delete a policy\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -45,7 +52,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -60,6 +67,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -73,32 +82,34 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + granteeName: true, + privilege: true, + permissive: true, + disabled: true, + policyType: true, + data: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: PolicySelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.policy - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - granteeName: true, - privilege: true, - permissive: true, - disabled: true, - policyType: true, - data: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.policy.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -108,6 +119,43 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + granteeName: true, + privilege: true, + permissive: true, + disabled: true, + policyType: true, + data: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: PolicySelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.policy.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts index 5e2c830cb..16129f89d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/primary-key-constraint.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreatePrimaryKeyConstraintInput, PrimaryKeyConstraintPatch, + PrimaryKeyConstraintSelect, + PrimaryKeyConstraintFilter, + PrimaryKeyConstraintOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -27,7 +31,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nprimary-key-constraint \n\nCommands:\n list List all primaryKeyConstraint records\n get Get a primaryKeyConstraint by ID\n create Create a new primaryKeyConstraint\n update Update an existing primaryKeyConstraint\n delete Delete a primaryKeyConstraint\n\n --help, -h Show this help message\n'; + '\nprimary-key-constraint \n\nCommands:\n list List primaryKeyConstraint records\n find-first Find first matching primaryKeyConstraint record\n get Get a primaryKeyConstraint by ID\n create Create a new primaryKeyConstraint\n update Update an existing primaryKeyConstraint\n delete Delete a primaryKeyConstraint\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -44,7 +48,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -59,6 +63,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -72,28 +78,35 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + type: true, + fieldIds: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + PrimaryKeyConstraintSelect, + PrimaryKeyConstraintFilter, + never, + PrimaryKeyConstraintOrderBy + > & { + select: PrimaryKeyConstraintSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.primaryKeyConstraint - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - type: true, - fieldIds: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.primaryKeyConstraint.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -103,6 +116,39 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + type: true, + fieldIds: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: PrimaryKeyConstraintSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.primaryKeyConstraint.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts b/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts index edc7e345e..dfb452856 100644 --- a/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/profiles-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateProfilesModuleInput, ProfilesModulePatch } from '../../orm/input-types'; +import type { + CreateProfilesModuleInput, + ProfilesModulePatch, + ProfilesModuleSelect, + ProfilesModuleFilter, + ProfilesModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -29,7 +36,7 @@ const fieldSchema: FieldSchema = { prefix: 'string', }; const usage = - '\nprofiles-module \n\nCommands:\n list List all profilesModule records\n get Get a profilesModule by ID\n create Create a new profilesModule\n update Update an existing profilesModule\n delete Delete a profilesModule\n\n --help, -h Show this help message\n'; + '\nprofiles-module \n\nCommands:\n list List profilesModule records\n find-first Find first matching profilesModule record\n get Get a profilesModule by ID\n create Create a new profilesModule\n update Update an existing profilesModule\n delete Delete a profilesModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -46,7 +53,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -61,6 +68,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -74,33 +83,35 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + tableName: true, + profilePermissionsTableId: true, + profilePermissionsTableName: true, + profileGrantsTableId: true, + profileGrantsTableName: true, + profileDefinitionGrantsTableId: true, + profileDefinitionGrantsTableName: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + permissionsTableId: true, + membershipsTableId: true, + prefix: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ProfilesModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.profilesModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - tableName: true, - profilePermissionsTableId: true, - profilePermissionsTableName: true, - profileGrantsTableId: true, - profileGrantsTableName: true, - profileDefinitionGrantsTableId: true, - profileDefinitionGrantsTableName: true, - membershipType: true, - entityTableId: true, - actorTableId: true, - permissionsTableId: true, - membershipsTableId: true, - prefix: true, - }, - }) - .execute(); + const result = await client.profilesModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -110,6 +121,44 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + tableName: true, + profilePermissionsTableId: true, + profilePermissionsTableName: true, + profileGrantsTableId: true, + profileGrantsTableName: true, + profileDefinitionGrantsTableId: true, + profileDefinitionGrantsTableName: true, + membershipType: true, + entityTableId: true, + actorTableId: true, + permissionsTableId: true, + membershipsTableId: true, + prefix: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ProfilesModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.profilesModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/ref.ts b/sdk/constructive-cli/src/public/cli/commands/ref.ts index 7ad388281..e511ebe7d 100644 --- a/sdk/constructive-cli/src/public/cli/commands/ref.ts +++ b/sdk/constructive-cli/src/public/cli/commands/ref.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateRefInput, RefPatch } from '../../orm/input-types'; +import type { + CreateRefInput, + RefPatch, + RefSelect, + RefFilter, + RefOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { commitId: 'uuid', }; const usage = - '\nref \n\nCommands:\n list List all ref records\n get Get a ref by ID\n create Create a new ref\n update Update an existing ref\n delete Delete a ref\n\n --help, -h Show this help message\n'; + '\nref \n\nCommands:\n list List ref records\n find-first Find first matching ref record\n get Get a ref by ID\n create Create a new ref\n update Update an existing ref\n delete Delete a ref\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + storeId: true, + commitId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: RefSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.ref - .findMany({ - select: { - id: true, - name: true, - databaseId: true, - storeId: true, - commitId: true, - }, - }) - .execute(); + const result = await client.ref.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + storeId: true, + commitId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: RefSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.ref.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts b/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts index a569049ab..8b1477e7c 100644 --- a/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts +++ b/sdk/constructive-cli/src/public/cli/commands/relation-provision.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateRelationProvisionInput, RelationProvisionPatch } from '../../orm/input-types'; +import type { + CreateRelationProvisionInput, + RelationProvisionPatch, + RelationProvisionSelect, + RelationProvisionFilter, + RelationProvisionOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -42,7 +49,7 @@ const fieldSchema: FieldSchema = { outTargetFieldId: 'uuid', }; const usage = - '\nrelation-provision \n\nCommands:\n list List all relationProvision records\n get Get a relationProvision by ID\n create Create a new relationProvision\n update Update an existing relationProvision\n delete Delete a relationProvision\n\n --help, -h Show this help message\n'; + '\nrelation-provision \n\nCommands:\n list List relationProvision records\n find-first Find first matching relationProvision record\n get Get a relationProvision by ID\n create Create a new relationProvision\n update Update an existing relationProvision\n delete Delete a relationProvision\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -59,7 +66,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -74,6 +81,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -87,46 +96,53 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + relationType: true, + sourceTableId: true, + targetTableId: true, + fieldName: true, + deleteAction: true, + isRequired: true, + apiRequired: true, + junctionTableId: true, + junctionTableName: true, + junctionSchemaId: true, + sourceFieldName: true, + targetFieldName: true, + useCompositeKey: true, + createIndex: true, + exposeInApi: true, + nodeType: true, + nodeData: true, + grantRoles: true, + grantPrivileges: true, + policyType: true, + policyPrivileges: true, + policyRole: true, + policyPermissive: true, + policyName: true, + policyData: true, + outFieldId: true, + outJunctionTableId: true, + outSourceFieldId: true, + outTargetFieldId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + RelationProvisionSelect, + RelationProvisionFilter, + never, + RelationProvisionOrderBy + > & { + select: RelationProvisionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.relationProvision - .findMany({ - select: { - id: true, - databaseId: true, - relationType: true, - sourceTableId: true, - targetTableId: true, - fieldName: true, - deleteAction: true, - isRequired: true, - apiRequired: true, - junctionTableId: true, - junctionTableName: true, - junctionSchemaId: true, - sourceFieldName: true, - targetFieldName: true, - useCompositeKey: true, - createIndex: true, - exposeInApi: true, - nodeType: true, - nodeData: true, - grantRoles: true, - grantPrivileges: true, - policyType: true, - policyPrivileges: true, - policyRole: true, - policyPermissive: true, - policyName: true, - policyData: true, - outFieldId: true, - outJunctionTableId: true, - outSourceFieldId: true, - outTargetFieldId: true, - }, - }) - .execute(); + const result = await client.relationProvision.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -136,6 +152,57 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + relationType: true, + sourceTableId: true, + targetTableId: true, + fieldName: true, + deleteAction: true, + isRequired: true, + apiRequired: true, + junctionTableId: true, + junctionTableName: true, + junctionSchemaId: true, + sourceFieldName: true, + targetFieldName: true, + useCompositeKey: true, + createIndex: true, + exposeInApi: true, + nodeType: true, + nodeData: true, + grantRoles: true, + grantPrivileges: true, + policyType: true, + policyPrivileges: true, + policyRole: true, + policyPermissive: true, + policyName: true, + policyData: true, + outFieldId: true, + outJunctionTableId: true, + outSourceFieldId: true, + outTargetFieldId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: RelationProvisionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.relationProvision.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/rls-module.ts b/sdk/constructive-cli/src/public/cli/commands/rls-module.ts index 8d95893dc..ff7c6e449 100644 --- a/sdk/constructive-cli/src/public/cli/commands/rls-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/rls-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateRlsModuleInput, RlsModulePatch } from '../../orm/input-types'; +import type { + CreateRlsModuleInput, + RlsModulePatch, + RlsModuleSelect, + RlsModuleFilter, + RlsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -22,7 +29,7 @@ const fieldSchema: FieldSchema = { currentRoleId: 'string', }; const usage = - '\nrls-module \n\nCommands:\n list List all rlsModule records\n get Get a rlsModule by ID\n create Create a new rlsModule\n update Update an existing rlsModule\n delete Delete a rlsModule\n\n --help, -h Show this help message\n'; + '\nrls-module \n\nCommands:\n list List rlsModule records\n find-first Find first matching rlsModule record\n get Get a rlsModule by ID\n create Create a new rlsModule\n update Update an existing rlsModule\n delete Delete a rlsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +46,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -54,6 +61,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -67,26 +76,28 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + sessionCredentialsTableId: true, + sessionsTableId: true, + usersTableId: true, + authenticate: true, + authenticateStrict: true, + currentRole: true, + currentRoleId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: RlsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.rlsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - sessionCredentialsTableId: true, - sessionsTableId: true, - usersTableId: true, - authenticate: true, - authenticateStrict: true, - currentRole: true, - currentRoleId: true, - }, - }) - .execute(); + const result = await client.rlsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -96,6 +107,37 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + sessionCredentialsTableId: true, + sessionsTableId: true, + usersTableId: true, + authenticate: true, + authenticateStrict: true, + currentRole: true, + currentRoleId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: RlsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.rlsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/role-type.ts b/sdk/constructive-cli/src/public/cli/commands/role-type.ts index dc6e319c0..30724bbfe 100644 --- a/sdk/constructive-cli/src/public/cli/commands/role-type.ts +++ b/sdk/constructive-cli/src/public/cli/commands/role-type.ts @@ -5,15 +5,22 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateRoleTypeInput, RoleTypePatch } from '../../orm/input-types'; +import type { + CreateRoleTypeInput, + RoleTypePatch, + RoleTypeSelect, + RoleTypeFilter, + RoleTypeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'int', name: 'string', }; const usage = - '\nrole-type \n\nCommands:\n list List all roleType records\n get Get a roleType by ID\n create Create a new roleType\n update Update an existing roleType\n delete Delete a roleType\n\n --help, -h Show this help message\n'; + '\nrole-type \n\nCommands:\n list List roleType records\n find-first Find first matching roleType record\n get Get a roleType by ID\n create Create a new roleType\n update Update an existing roleType\n delete Delete a roleType\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -30,7 +37,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -45,6 +52,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -58,17 +67,19 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: RoleTypeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.roleType - .findMany({ - select: { - id: true, - name: true, - }, - }) - .execute(); + const result = await client.roleType.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -78,6 +89,28 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: RoleTypeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.roleType.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts b/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts index c0b7ad62f..20098cbcd 100644 --- a/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/schema-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSchemaGrantInput, SchemaGrantPatch } from '../../orm/input-types'; +import type { + CreateSchemaGrantInput, + SchemaGrantPatch, + SchemaGrantSelect, + SchemaGrantFilter, + SchemaGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nschema-grant \n\nCommands:\n list List all schemaGrant records\n get Get a schemaGrant by ID\n create Create a new schemaGrant\n update Update an existing schemaGrant\n delete Delete a schemaGrant\n\n --help, -h Show this help message\n'; + '\nschema-grant \n\nCommands:\n list List schemaGrant records\n find-first Find first matching schemaGrant record\n get Get a schemaGrant by ID\n create Create a new schemaGrant\n update Update an existing schemaGrant\n delete Delete a schemaGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + granteeName: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SchemaGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.schemaGrant - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - granteeName: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.schemaGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + granteeName: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SchemaGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.schemaGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/schema.ts b/sdk/constructive-cli/src/public/cli/commands/schema.ts index cd4fe21d0..a4b9b529f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/schema.ts +++ b/sdk/constructive-cli/src/public/cli/commands/schema.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSchemaInput, SchemaPatch } from '../../orm/input-types'; +import type { + CreateSchemaInput, + SchemaPatch, + SchemaSelect, + SchemaFilter, + SchemaOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nschema \n\nCommands:\n list List all schema records\n get Get a schema by ID\n create Create a new schema\n update Update an existing schema\n delete Delete a schema\n\n --help, -h Show this help message\n'; + '\nschema \n\nCommands:\n list List schema records\n find-first Find first matching schema record\n get Get a schema by ID\n create Create a new schema\n update Update an existing schema\n delete Delete a schema\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + schemaName: true, + label: true, + description: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + isPublic: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SchemaSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.schema - .findMany({ - select: { - id: true, - databaseId: true, - name: true, - schemaName: true, - label: true, - description: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - isPublic: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.schema.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +113,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + schemaName: true, + label: true, + description: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + isPublic: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SchemaSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.schema.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts b/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts index 15995ece2..c5203f4b8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/secrets-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSecretsModuleInput, SecretsModulePatch } from '../../orm/input-types'; +import type { + CreateSecretsModuleInput, + SecretsModulePatch, + SecretsModuleSelect, + SecretsModuleFilter, + SecretsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { tableName: 'string', }; const usage = - '\nsecrets-module \n\nCommands:\n list List all secretsModule records\n get Get a secretsModule by ID\n create Create a new secretsModule\n update Update an existing secretsModule\n delete Delete a secretsModule\n\n --help, -h Show this help message\n'; + '\nsecrets-module \n\nCommands:\n list List secretsModule records\n find-first Find first matching secretsModule record\n get Get a secretsModule by ID\n create Create a new secretsModule\n update Update an existing secretsModule\n delete Delete a secretsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SecretsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.secretsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - tableId: true, - tableName: true, - }, - }) - .execute(); + const result = await client.secretsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SecretsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.secretsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts b/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts index 50a780319..80c6d8a22 100644 --- a/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts +++ b/sdk/constructive-cli/src/public/cli/commands/secure-table-provision.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateSecureTableProvisionInput, SecureTableProvisionPatch, + SecureTableProvisionSelect, + SecureTableProvisionFilter, + SecureTableProvisionOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -32,7 +36,7 @@ const fieldSchema: FieldSchema = { outFields: 'uuid', }; const usage = - '\nsecure-table-provision \n\nCommands:\n list List all secureTableProvision records\n get Get a secureTableProvision by ID\n create Create a new secureTableProvision\n update Update an existing secureTableProvision\n delete Delete a secureTableProvision\n\n --help, -h Show this help message\n'; + '\nsecure-table-provision \n\nCommands:\n list List secureTableProvision records\n find-first Find first matching secureTableProvision record\n get Get a secureTableProvision by ID\n create Create a new secureTableProvision\n update Update an existing secureTableProvision\n delete Delete a secureTableProvision\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -49,7 +53,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -64,6 +68,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -77,33 +83,40 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + nodeType: true, + useRls: true, + nodeData: true, + fields: true, + grantRoles: true, + grantPrivileges: true, + policyType: true, + policyPrivileges: true, + policyRole: true, + policyPermissive: true, + policyName: true, + policyData: true, + outFields: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + SecureTableProvisionSelect, + SecureTableProvisionFilter, + never, + SecureTableProvisionOrderBy + > & { + select: SecureTableProvisionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.secureTableProvision - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - tableId: true, - tableName: true, - nodeType: true, - useRls: true, - nodeData: true, - fields: true, - grantRoles: true, - grantPrivileges: true, - policyType: true, - policyPrivileges: true, - policyRole: true, - policyPermissive: true, - policyName: true, - policyData: true, - outFields: true, - }, - }) - .execute(); + const result = await client.secureTableProvision.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -113,6 +126,44 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + nodeType: true, + useRls: true, + nodeData: true, + fields: true, + grantRoles: true, + grantPrivileges: true, + policyType: true, + policyPrivileges: true, + policyRole: true, + policyPermissive: true, + policyName: true, + policyData: true, + outFields: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SecureTableProvisionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.secureTableProvision.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts b/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts index c346bee74..662601161 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sessions-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSessionsModuleInput, SessionsModulePatch } from '../../orm/input-types'; +import type { + CreateSessionsModuleInput, + SessionsModulePatch, + SessionsModuleSelect, + SessionsModuleFilter, + SessionsModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -22,7 +29,7 @@ const fieldSchema: FieldSchema = { authSettingsTable: 'string', }; const usage = - '\nsessions-module \n\nCommands:\n list List all sessionsModule records\n get Get a sessionsModule by ID\n create Create a new sessionsModule\n update Update an existing sessionsModule\n delete Delete a sessionsModule\n\n --help, -h Show this help message\n'; + '\nsessions-module \n\nCommands:\n list List sessionsModule records\n find-first Find first matching sessionsModule record\n get Get a sessionsModule by ID\n create Create a new sessionsModule\n update Update an existing sessionsModule\n delete Delete a sessionsModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +46,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -54,6 +61,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -67,26 +76,28 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + sessionsTableId: true, + sessionCredentialsTableId: true, + authSettingsTableId: true, + usersTableId: true, + sessionsDefaultExpiration: true, + sessionsTable: true, + sessionCredentialsTable: true, + authSettingsTable: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SessionsModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.sessionsModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - sessionsTableId: true, - sessionCredentialsTableId: true, - authSettingsTableId: true, - usersTableId: true, - sessionsDefaultExpiration: true, - sessionsTable: true, - sessionCredentialsTable: true, - authSettingsTable: true, - }, - }) - .execute(); + const result = await client.sessionsModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -96,6 +107,37 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + sessionsTableId: true, + sessionCredentialsTableId: true, + authSettingsTableId: true, + usersTableId: true, + sessionsDefaultExpiration: true, + sessionsTable: true, + sessionCredentialsTable: true, + authSettingsTable: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SessionsModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.sessionsModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts b/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts index ef98d4816..76461ace0 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site-metadatum.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSiteMetadatumInput, SiteMetadatumPatch } from '../../orm/input-types'; +import type { + CreateSiteMetadatumInput, + SiteMetadatumPatch, + SiteMetadatumSelect, + SiteMetadatumFilter, + SiteMetadatumOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { ogImage: 'string', }; const usage = - '\nsite-metadatum \n\nCommands:\n list List all siteMetadatum records\n get Get a siteMetadatum by ID\n create Create a new siteMetadatum\n update Update an existing siteMetadatum\n delete Delete a siteMetadatum\n\n --help, -h Show this help message\n'; + '\nsite-metadatum \n\nCommands:\n list List siteMetadatum records\n find-first Find first matching siteMetadatum record\n get Get a siteMetadatum by ID\n create Create a new siteMetadatum\n update Update an existing siteMetadatum\n delete Delete a siteMetadatum\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + title: true, + description: true, + ogImage: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SiteMetadatumSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.siteMetadatum - .findMany({ - select: { - id: true, - databaseId: true, - siteId: true, - title: true, - description: true, - ogImage: true, - }, - }) - .execute(); + const result = await client.siteMetadatum.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + title: true, + description: true, + ogImage: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SiteMetadatumSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.siteMetadatum.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/site-module.ts b/sdk/constructive-cli/src/public/cli/commands/site-module.ts index 20c3c40eb..582180d61 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSiteModuleInput, SiteModulePatch } from '../../orm/input-types'; +import type { + CreateSiteModuleInput, + SiteModulePatch, + SiteModuleSelect, + SiteModuleFilter, + SiteModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { data: 'json', }; const usage = - '\nsite-module \n\nCommands:\n list List all siteModule records\n get Get a siteModule by ID\n create Create a new siteModule\n update Update an existing siteModule\n delete Delete a siteModule\n\n --help, -h Show this help message\n'; + '\nsite-module \n\nCommands:\n list List siteModule records\n find-first Find first matching siteModule record\n get Get a siteModule by ID\n create Create a new siteModule\n update Update an existing siteModule\n delete Delete a siteModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + name: true, + data: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SiteModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.siteModule - .findMany({ - select: { - id: true, - databaseId: true, - siteId: true, - name: true, - data: true, - }, - }) - .execute(); + const result = await client.siteModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + name: true, + data: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SiteModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.siteModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/site-theme.ts b/sdk/constructive-cli/src/public/cli/commands/site-theme.ts index f229b1b4d..091e4cf66 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site-theme.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site-theme.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSiteThemeInput, SiteThemePatch } from '../../orm/input-types'; +import type { + CreateSiteThemeInput, + SiteThemePatch, + SiteThemeSelect, + SiteThemeFilter, + SiteThemeOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -15,7 +22,7 @@ const fieldSchema: FieldSchema = { theme: 'json', }; const usage = - '\nsite-theme \n\nCommands:\n list List all siteTheme records\n get Get a siteTheme by ID\n create Create a new siteTheme\n update Update an existing siteTheme\n delete Delete a siteTheme\n\n --help, -h Show this help message\n'; + '\nsite-theme \n\nCommands:\n list List siteTheme records\n find-first Find first matching siteTheme record\n get Get a siteTheme by ID\n create Create a new siteTheme\n update Update an existing siteTheme\n delete Delete a siteTheme\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -32,7 +39,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -47,6 +54,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -60,19 +69,21 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + theme: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SiteThemeSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.siteTheme - .findMany({ - select: { - id: true, - databaseId: true, - siteId: true, - theme: true, - }, - }) - .execute(); + const result = await client.siteTheme.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -82,6 +93,30 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + siteId: true, + theme: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SiteThemeSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.siteTheme.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/site.ts b/sdk/constructive-cli/src/public/cli/commands/site.ts index 846a631a5..12de496a1 100644 --- a/sdk/constructive-cli/src/public/cli/commands/site.ts +++ b/sdk/constructive-cli/src/public/cli/commands/site.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSiteInput, SitePatch } from '../../orm/input-types'; +import type { + CreateSiteInput, + SitePatch, + SiteSelect, + SiteFilter, + SiteOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { dbname: 'string', }; const usage = - '\nsite \n\nCommands:\n list List all site records\n get Get a site by ID\n create Create a new site\n update Update an existing site\n delete Delete a site\n\n --help, -h Show this help message\n'; + '\nsite \n\nCommands:\n list List site records\n find-first Find first matching site record\n get Get a site by ID\n create Create a new site\n update Update an existing site\n delete Delete a site\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,26 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + title: true, + description: true, + ogImage: true, + favicon: true, + appleTouchIcon: true, + logo: true, + dbname: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SiteSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.site - .findMany({ - select: { - id: true, - databaseId: true, - title: true, - description: true, - ogImage: true, - favicon: true, - appleTouchIcon: true, - logo: true, - dbname: true, - }, - }) - .execute(); + const result = await client.site.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +103,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + title: true, + description: true, + ogImage: true, + favicon: true, + appleTouchIcon: true, + logo: true, + dbname: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SiteSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.site.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/sql-action.ts b/sdk/constructive-cli/src/public/cli/commands/sql-action.ts index 0656fb962..58ef657b8 100644 --- a/sdk/constructive-cli/src/public/cli/commands/sql-action.ts +++ b/sdk/constructive-cli/src/public/cli/commands/sql-action.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateSqlActionInput, SqlActionPatch } from '../../orm/input-types'; +import type { + CreateSqlActionInput, + SqlActionPatch, + SqlActionSelect, + SqlActionFilter, + SqlActionOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'int', name: 'string', @@ -24,7 +31,7 @@ const fieldSchema: FieldSchema = { actorId: 'uuid', }; const usage = - '\nsql-action \n\nCommands:\n list List all sqlAction records\n create Create a new sqlAction\n\n --help, -h Show this help message\n'; + '\nsql-action \n\nCommands:\n list List sqlAction records\n find-first Find first matching sqlAction record\n create Create a new sqlAction\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -41,7 +48,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'create'], + options: ['list', 'find-first', 'create'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -56,6 +63,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'create': return handleCreate(argv, prompter); default: @@ -63,28 +72,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + deploy: true, + deps: true, + payload: true, + content: true, + revert: true, + verify: true, + createdAt: true, + action: true, + actionId: true, + actorId: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: SqlActionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.sqlAction - .findMany({ - select: { - id: true, - name: true, - databaseId: true, - deploy: true, - deps: true, - payload: true, - content: true, - revert: true, - verify: true, - createdAt: true, - action: true, - actionId: true, - actorId: true, - }, - }) - .execute(); + const result = await client.sqlAction.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -94,6 +105,39 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + deploy: true, + deps: true, + payload: true, + content: true, + revert: true, + verify: true, + createdAt: true, + action: true, + actionId: true, + actorId: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: SqlActionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.sqlAction.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleCreate(argv: Partial>, prompter: Inquirerer) { try { const rawAnswers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/store.ts b/sdk/constructive-cli/src/public/cli/commands/store.ts index 2ca10cb6d..206779c0f 100644 --- a/sdk/constructive-cli/src/public/cli/commands/store.ts +++ b/sdk/constructive-cli/src/public/cli/commands/store.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateStoreInput, StorePatch } from '../../orm/input-types'; +import type { + CreateStoreInput, + StorePatch, + StoreSelect, + StoreFilter, + StoreOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', name: 'string', @@ -16,7 +23,7 @@ const fieldSchema: FieldSchema = { createdAt: 'string', }; const usage = - '\nstore \n\nCommands:\n list List all store records\n get Get a store by ID\n create Create a new store\n update Update an existing store\n delete Delete a store\n\n --help, -h Show this help message\n'; + '\nstore \n\nCommands:\n list List store records\n find-first Find first matching store record\n get Get a store by ID\n create Create a new store\n update Update an existing store\n delete Delete a store\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -33,7 +40,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -48,6 +55,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -61,20 +70,22 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + hash: true, + createdAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: StoreSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.store - .findMany({ - select: { - id: true, - name: true, - databaseId: true, - hash: true, - createdAt: true, - }, - }) - .execute(); + const result = await client.store.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -84,6 +95,31 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + name: true, + databaseId: true, + hash: true, + createdAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: StoreSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.store.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/table-grant.ts b/sdk/constructive-cli/src/public/cli/commands/table-grant.ts index bcb916b5b..6019663df 100644 --- a/sdk/constructive-cli/src/public/cli/commands/table-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/table-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateTableGrantInput, TableGrantPatch } from '../../orm/input-types'; +import type { + CreateTableGrantInput, + TableGrantPatch, + TableGrantSelect, + TableGrantFilter, + TableGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -20,7 +27,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ntable-grant \n\nCommands:\n list List all tableGrant records\n get Get a tableGrant by ID\n create Create a new tableGrant\n update Update an existing tableGrant\n delete Delete a tableGrant\n\n --help, -h Show this help message\n'; + '\ntable-grant \n\nCommands:\n list List tableGrant records\n find-first Find first matching tableGrant record\n get Get a tableGrant by ID\n create Create a new tableGrant\n update Update an existing tableGrant\n delete Delete a tableGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -37,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -52,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -65,24 +74,26 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + privilege: true, + granteeName: true, + fieldIds: true, + isGrant: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: TableGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.tableGrant - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - privilege: true, - granteeName: true, - fieldIds: true, - isGrant: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.tableGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +103,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + privilege: true, + granteeName: true, + fieldIds: true, + isGrant: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: TableGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.tableGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts b/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts index a98d2ff63..40d4273d4 100644 --- a/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/table-template-module.ts @@ -5,12 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; import type { CreateTableTemplateModuleInput, TableTemplateModulePatch, + TableTemplateModuleSelect, + TableTemplateModuleFilter, + TableTemplateModuleOrderBy, } from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -23,7 +27,7 @@ const fieldSchema: FieldSchema = { data: 'json', }; const usage = - '\ntable-template-module \n\nCommands:\n list List all tableTemplateModule records\n get Get a tableTemplateModule by ID\n create Create a new tableTemplateModule\n update Update an existing tableTemplateModule\n delete Delete a tableTemplateModule\n\n --help, -h Show this help message\n'; + '\ntable-template-module \n\nCommands:\n list List tableTemplateModule records\n find-first Find first matching tableTemplateModule record\n get Get a tableTemplateModule by ID\n create Create a new tableTemplateModule\n update Update an existing tableTemplateModule\n delete Delete a tableTemplateModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -40,7 +44,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -55,6 +59,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -68,24 +74,31 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + nodeType: true, + data: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + TableTemplateModuleSelect, + TableTemplateModuleFilter, + never, + TableTemplateModuleOrderBy + > & { + select: TableTemplateModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.tableTemplateModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - privateSchemaId: true, - tableId: true, - ownerTableId: true, - tableName: true, - nodeType: true, - data: true, - }, - }) - .execute(); + const result = await client.tableTemplateModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -95,6 +108,35 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + privateSchemaId: true, + tableId: true, + ownerTableId: true, + tableName: true, + nodeType: true, + data: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: TableTemplateModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.tableTemplateModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/table.ts b/sdk/constructive-cli/src/public/cli/commands/table.ts index 4efc0a267..76ea1d1c9 100644 --- a/sdk/constructive-cli/src/public/cli/commands/table.ts +++ b/sdk/constructive-cli/src/public/cli/commands/table.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateTableInput, TablePatch } from '../../orm/input-types'; +import type { + CreateTableInput, + TablePatch, + TableSelect, + TableFilter, + TableOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -30,7 +37,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ntable \n\nCommands:\n list List all table records\n get Get a table by ID\n create Create a new table\n update Update an existing table\n delete Delete a table\n\n --help, -h Show this help message\n'; + '\ntable \n\nCommands:\n list List table records\n find-first Find first matching table record\n get Get a table by ID\n create Create a new table\n update Update an existing table\n delete Delete a table\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -47,7 +54,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -62,6 +69,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -75,34 +84,36 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + name: true, + label: true, + description: true, + smartTags: true, + category: true, + module: true, + scope: true, + useRls: true, + timestamps: true, + peoplestamps: true, + pluralName: true, + singularName: true, + tags: true, + inheritsId: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: TableSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.table - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - name: true, - label: true, - description: true, - smartTags: true, - category: true, - module: true, - scope: true, - useRls: true, - timestamps: true, - peoplestamps: true, - pluralName: true, - singularName: true, - tags: true, - inheritsId: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.table.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -112,6 +123,45 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + name: true, + label: true, + description: true, + smartTags: true, + category: true, + module: true, + scope: true, + useRls: true, + timestamps: true, + peoplestamps: true, + pluralName: true, + singularName: true, + tags: true, + inheritsId: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: TableSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.table.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts b/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts index 64b204c31..99b6084ca 100644 --- a/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts +++ b/sdk/constructive-cli/src/public/cli/commands/trigger-function.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateTriggerFunctionInput, TriggerFunctionPatch } from '../../orm/input-types'; +import type { + CreateTriggerFunctionInput, + TriggerFunctionPatch, + TriggerFunctionSelect, + TriggerFunctionFilter, + TriggerFunctionOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ntrigger-function \n\nCommands:\n list List all triggerFunction records\n get Get a triggerFunction by ID\n create Create a new triggerFunction\n update Update an existing triggerFunction\n delete Delete a triggerFunction\n\n --help, -h Show this help message\n'; + '\ntrigger-function \n\nCommands:\n list List triggerFunction records\n find-first Find first matching triggerFunction record\n get Get a triggerFunction by ID\n create Create a new triggerFunction\n update Update an existing triggerFunction\n delete Delete a triggerFunction\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + code: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: TriggerFunctionSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.triggerFunction - .findMany({ - select: { - id: true, - databaseId: true, - name: true, - code: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.triggerFunction.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + name: true, + code: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: TriggerFunctionSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.triggerFunction.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/trigger.ts b/sdk/constructive-cli/src/public/cli/commands/trigger.ts index ca97022b7..8de102263 100644 --- a/sdk/constructive-cli/src/public/cli/commands/trigger.ts +++ b/sdk/constructive-cli/src/public/cli/commands/trigger.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateTriggerInput, TriggerPatch } from '../../orm/input-types'; +import type { + CreateTriggerInput, + TriggerPatch, + TriggerSelect, + TriggerFilter, + TriggerOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -24,7 +31,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\ntrigger \n\nCommands:\n list List all trigger records\n get Get a trigger by ID\n create Create a new trigger\n update Update an existing trigger\n delete Delete a trigger\n\n --help, -h Show this help message\n'; + '\ntrigger \n\nCommands:\n list List trigger records\n find-first Find first matching trigger record\n get Get a trigger by ID\n create Create a new trigger\n update Update an existing trigger\n delete Delete a trigger\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -41,7 +48,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -56,6 +63,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -69,28 +78,30 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + event: true, + functionName: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: TriggerSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.trigger - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - event: true, - functionName: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.trigger.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -100,6 +111,39 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + event: true, + functionName: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: TriggerSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.trigger.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts b/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts index 5ce4f0450..969ffb71a 100644 --- a/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts +++ b/sdk/constructive-cli/src/public/cli/commands/unique-constraint.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateUniqueConstraintInput, UniqueConstraintPatch } from '../../orm/input-types'; +import type { + CreateUniqueConstraintInput, + UniqueConstraintPatch, + UniqueConstraintSelect, + UniqueConstraintFilter, + UniqueConstraintOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -25,7 +32,7 @@ const fieldSchema: FieldSchema = { updatedAt: 'string', }; const usage = - '\nunique-constraint \n\nCommands:\n list List all uniqueConstraint records\n get Get a uniqueConstraint by ID\n create Create a new uniqueConstraint\n update Update an existing uniqueConstraint\n delete Delete a uniqueConstraint\n\n --help, -h Show this help message\n'; + '\nunique-constraint \n\nCommands:\n list List uniqueConstraint records\n find-first Find first matching uniqueConstraint record\n get Get a uniqueConstraint by ID\n create Create a new uniqueConstraint\n update Update an existing uniqueConstraint\n delete Delete a uniqueConstraint\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -42,7 +49,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -57,6 +64,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -70,29 +79,36 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + description: true, + smartTags: true, + type: true, + fieldIds: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs< + UniqueConstraintSelect, + UniqueConstraintFilter, + never, + UniqueConstraintOrderBy + > & { + select: UniqueConstraintSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.uniqueConstraint - .findMany({ - select: { - id: true, - databaseId: true, - tableId: true, - name: true, - description: true, - smartTags: true, - type: true, - fieldIds: true, - category: true, - module: true, - scope: true, - tags: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.uniqueConstraint.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -102,6 +118,40 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + tableId: true, + name: true, + description: true, + smartTags: true, + type: true, + fieldIds: true, + category: true, + module: true, + scope: true, + tags: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: UniqueConstraintSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.uniqueConstraint.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts b/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts index 0bb6a404f..155b1f64b 100644 --- a/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/user-auth-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateUserAuthModuleInput, UserAuthModulePatch } from '../../orm/input-types'; +import type { + CreateUserAuthModuleInput, + UserAuthModulePatch, + UserAuthModuleSelect, + UserAuthModuleFilter, + UserAuthModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -37,7 +44,7 @@ const fieldSchema: FieldSchema = { extendTokenExpires: 'string', }; const usage = - '\nuser-auth-module \n\nCommands:\n list List all userAuthModule records\n get Get a userAuthModule by ID\n create Create a new userAuthModule\n update Update an existing userAuthModule\n delete Delete a userAuthModule\n\n --help, -h Show this help message\n'; + '\nuser-auth-module \n\nCommands:\n list List userAuthModule records\n find-first Find first matching userAuthModule record\n get Get a userAuthModule by ID\n create Create a new userAuthModule\n update Update an existing userAuthModule\n delete Delete a userAuthModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -54,7 +61,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -69,6 +76,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -82,41 +91,43 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + emailsTableId: true, + usersTableId: true, + secretsTableId: true, + encryptedTableId: true, + sessionsTableId: true, + sessionCredentialsTableId: true, + auditsTableId: true, + auditsTableName: true, + signInFunction: true, + signUpFunction: true, + signOutFunction: true, + setPasswordFunction: true, + resetPasswordFunction: true, + forgotPasswordFunction: true, + sendVerificationEmailFunction: true, + verifyEmailFunction: true, + verifyPasswordFunction: true, + checkPasswordFunction: true, + sendAccountDeletionEmailFunction: true, + deleteAccountFunction: true, + signInOneTimeTokenFunction: true, + oneTimeTokenFunction: true, + extendTokenExpires: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: UserAuthModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.userAuthModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - emailsTableId: true, - usersTableId: true, - secretsTableId: true, - encryptedTableId: true, - sessionsTableId: true, - sessionCredentialsTableId: true, - auditsTableId: true, - auditsTableName: true, - signInFunction: true, - signUpFunction: true, - signOutFunction: true, - setPasswordFunction: true, - resetPasswordFunction: true, - forgotPasswordFunction: true, - sendVerificationEmailFunction: true, - verifyEmailFunction: true, - verifyPasswordFunction: true, - checkPasswordFunction: true, - sendAccountDeletionEmailFunction: true, - deleteAccountFunction: true, - signInOneTimeTokenFunction: true, - oneTimeTokenFunction: true, - extendTokenExpires: true, - }, - }) - .execute(); + const result = await client.userAuthModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -126,6 +137,52 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + emailsTableId: true, + usersTableId: true, + secretsTableId: true, + encryptedTableId: true, + sessionsTableId: true, + sessionCredentialsTableId: true, + auditsTableId: true, + auditsTableName: true, + signInFunction: true, + signUpFunction: true, + signOutFunction: true, + setPasswordFunction: true, + resetPasswordFunction: true, + forgotPasswordFunction: true, + sendVerificationEmailFunction: true, + verifyEmailFunction: true, + verifyPasswordFunction: true, + checkPasswordFunction: true, + sendAccountDeletionEmailFunction: true, + deleteAccountFunction: true, + signInOneTimeTokenFunction: true, + oneTimeTokenFunction: true, + extendTokenExpires: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: UserAuthModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.userAuthModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/user.ts b/sdk/constructive-cli/src/public/cli/commands/user.ts index 9bc46685a..cc49c77ce 100644 --- a/sdk/constructive-cli/src/public/cli/commands/user.ts +++ b/sdk/constructive-cli/src/public/cli/commands/user.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateUserInput, UserPatch } from '../../orm/input-types'; +import type { + CreateUserInput, + UserPatch, + UserSelect, + UserFilter, + UserOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', username: 'string', @@ -22,7 +29,7 @@ const fieldSchema: FieldSchema = { searchScore: 'float', }; const usage = - '\nuser \n\nCommands:\n list List all user records\n get Get a user by ID\n create Create a new user\n update Update an existing user\n delete Delete a user\n\n --help, -h Show this help message\n'; + '\nuser \n\nCommands:\n list List user records\n find-first Find first matching user record\n search Search user records\n get Get a user by ID\n create Create a new user\n update Update an existing user\n delete Delete a user\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\nSearch Options:\n Search query string (required)\n --limit Max number of records to return\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --orderBy Comma-separated list of ordering values\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -39,7 +46,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'search', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -54,6 +61,10 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); + case 'search': + return handleSearch(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -67,22 +78,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + username: true, + displayName: true, + profilePicture: true, + type: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: UserSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.user - .findMany({ - select: { - id: true, - username: true, - displayName: true, - profilePicture: true, - type: true, - createdAt: true, - updatedAt: true, - }, - }) - .execute(); + const result = await client.user.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -92,6 +105,74 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + username: true, + displayName: true, + profilePicture: true, + type: true, + createdAt: true, + updatedAt: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: UserSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.user.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} +async function handleSearch(argv: Partial>, _prompter: Inquirerer) { + try { + const query = Array.isArray(argv._) && argv._.length > 0 ? String(argv._[0]) : undefined; + if (!query) { + console.error('Error: search requires a argument'); + process.exit(1); + } + const searchWhere = { + searchTsv: { + query, + }, + trgmDisplayName: { + value: query, + threshold: 0.3, + }, + }; + const defaultSelect = { + id: true, + username: true, + displayName: true, + profilePicture: true, + type: true, + createdAt: true, + updatedAt: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: UserSelect; + } + >(argv, defaultSelect, searchWhere); + const client = getClient(); + const result = await client.user.findMany(findManyArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to search records.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/users-module.ts b/sdk/constructive-cli/src/public/cli/commands/users-module.ts index 29c270530..fa93a25c6 100644 --- a/sdk/constructive-cli/src/public/cli/commands/users-module.ts +++ b/sdk/constructive-cli/src/public/cli/commands/users-module.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateUsersModuleInput, UsersModulePatch } from '../../orm/input-types'; +import type { + CreateUsersModuleInput, + UsersModulePatch, + UsersModuleSelect, + UsersModuleFilter, + UsersModuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { typeTableName: 'string', }; const usage = - '\nusers-module \n\nCommands:\n list List all usersModule records\n get Get a usersModule by ID\n create Create a new usersModule\n update Update an existing usersModule\n delete Delete a usersModule\n\n --help, -h Show this help message\n'; + '\nusers-module \n\nCommands:\n list List usersModule records\n find-first Find first matching usersModule record\n get Get a usersModule by ID\n create Create a new usersModule\n update Update an existing usersModule\n delete Delete a usersModule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + typeTableId: true, + typeTableName: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: UsersModuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.usersModule - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - tableId: true, - tableName: true, - typeTableId: true, - typeTableName: true, - }, - }) - .execute(); + const result = await client.usersModule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + tableId: true, + tableName: true, + typeTableId: true, + typeTableName: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: UsersModuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.usersModule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/view-grant.ts b/sdk/constructive-cli/src/public/cli/commands/view-grant.ts index b38000dd3..3f449ec68 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view-grant.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view-grant.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateViewGrantInput, ViewGrantPatch } from '../../orm/input-types'; +import type { + CreateViewGrantInput, + ViewGrantPatch, + ViewGrantSelect, + ViewGrantFilter, + ViewGrantOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -18,7 +25,7 @@ const fieldSchema: FieldSchema = { isGrant: 'boolean', }; const usage = - '\nview-grant \n\nCommands:\n list List all viewGrant records\n get Get a viewGrant by ID\n create Create a new viewGrant\n update Update an existing viewGrant\n delete Delete a viewGrant\n\n --help, -h Show this help message\n'; + '\nview-grant \n\nCommands:\n list List viewGrant records\n find-first Find first matching viewGrant record\n get Get a viewGrant by ID\n create Create a new viewGrant\n update Update an existing viewGrant\n delete Delete a viewGrant\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -35,7 +42,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -50,6 +57,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -63,22 +72,24 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + viewId: true, + granteeName: true, + privilege: true, + withGrantOption: true, + isGrant: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ViewGrantSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.viewGrant - .findMany({ - select: { - id: true, - databaseId: true, - viewId: true, - granteeName: true, - privilege: true, - withGrantOption: true, - isGrant: true, - }, - }) - .execute(); + const result = await client.viewGrant.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -88,6 +99,33 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + viewId: true, + granteeName: true, + privilege: true, + withGrantOption: true, + isGrant: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ViewGrantSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.viewGrant.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/view-rule.ts b/sdk/constructive-cli/src/public/cli/commands/view-rule.ts index 19b6407f9..c50a16009 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view-rule.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view-rule.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateViewRuleInput, ViewRulePatch } from '../../orm/input-types'; +import type { + CreateViewRuleInput, + ViewRulePatch, + ViewRuleSelect, + ViewRuleFilter, + ViewRuleOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -17,7 +24,7 @@ const fieldSchema: FieldSchema = { action: 'string', }; const usage = - '\nview-rule \n\nCommands:\n list List all viewRule records\n get Get a viewRule by ID\n create Create a new viewRule\n update Update an existing viewRule\n delete Delete a viewRule\n\n --help, -h Show this help message\n'; + '\nview-rule \n\nCommands:\n list List viewRule records\n find-first Find first matching viewRule record\n get Get a viewRule by ID\n create Create a new viewRule\n update Update an existing viewRule\n delete Delete a viewRule\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -34,7 +41,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -49,6 +56,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -62,21 +71,23 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + viewId: true, + name: true, + event: true, + action: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ViewRuleSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.viewRule - .findMany({ - select: { - id: true, - databaseId: true, - viewId: true, - name: true, - event: true, - action: true, - }, - }) - .execute(); + const result = await client.viewRule.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -86,6 +97,32 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + viewId: true, + name: true, + event: true, + action: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ViewRuleSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.viewRule.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/view-table.ts b/sdk/constructive-cli/src/public/cli/commands/view-table.ts index 2a47523a8..505f5c97e 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view-table.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view-table.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateViewTableInput, ViewTablePatch } from '../../orm/input-types'; +import type { + CreateViewTableInput, + ViewTablePatch, + ViewTableSelect, + ViewTableFilter, + ViewTableOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', viewId: 'uuid', @@ -15,7 +22,7 @@ const fieldSchema: FieldSchema = { joinOrder: 'int', }; const usage = - '\nview-table \n\nCommands:\n list List all viewTable records\n get Get a viewTable by ID\n create Create a new viewTable\n update Update an existing viewTable\n delete Delete a viewTable\n\n --help, -h Show this help message\n'; + '\nview-table \n\nCommands:\n list List viewTable records\n find-first Find first matching viewTable record\n get Get a viewTable by ID\n create Create a new viewTable\n update Update an existing viewTable\n delete Delete a viewTable\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -32,7 +39,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -47,6 +54,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -60,19 +69,21 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + viewId: true, + tableId: true, + joinOrder: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ViewTableSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.viewTable - .findMany({ - select: { - id: true, - viewId: true, - tableId: true, - joinOrder: true, - }, - }) - .execute(); + const result = await client.viewTable.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -82,6 +93,30 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + viewId: true, + tableId: true, + joinOrder: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ViewTableSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.viewTable.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/commands/view.ts b/sdk/constructive-cli/src/public/cli/commands/view.ts index c7b6424e5..0ea707092 100644 --- a/sdk/constructive-cli/src/public/cli/commands/view.ts +++ b/sdk/constructive-cli/src/public/cli/commands/view.ts @@ -5,9 +5,16 @@ */ import { CLIOptions, Inquirerer, extractFirst } from 'inquirerer'; import { getClient } from '../executor'; -import { coerceAnswers, stripUndefined } from '../utils'; +import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils'; import type { FieldSchema } from '../utils'; -import type { CreateViewInput, ViewPatch } from '../../orm/input-types'; +import type { + CreateViewInput, + ViewPatch, + ViewSelect, + ViewFilter, + ViewOrderBy, +} from '../../orm/input-types'; +import type { FindManyArgs, FindFirstArgs } from '../../orm/select-types'; const fieldSchema: FieldSchema = { id: 'uuid', databaseId: 'uuid', @@ -27,7 +34,7 @@ const fieldSchema: FieldSchema = { tags: 'string', }; const usage = - '\nview \n\nCommands:\n list List all view records\n get Get a view by ID\n create Create a new view\n update Update an existing view\n delete Delete a view\n\n --help, -h Show this help message\n'; + '\nview \n\nCommands:\n list List view records\n find-first Find first matching view record\n get Get a view by ID\n create Create a new view\n update Update an existing view\n delete Delete a view\n\nList Options:\n --limit Max number of records to return (forward pagination)\n --last Number of records from the end (backward pagination)\n --after Cursor for forward pagination\n --before Cursor for backward pagination\n --offset Number of records to skip\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.. Condition filter (dot-notation)\n --orderBy Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select Comma-separated list of fields to return\n --where.. Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.. Condition filter (dot-notation)\n\n --help, -h Show this help message\n'; export default async ( argv: Partial>, prompter: Inquirerer, @@ -44,7 +51,7 @@ export default async ( type: 'autocomplete', name: 'subcommand', message: 'What do you want to do?', - options: ['list', 'get', 'create', 'update', 'delete'], + options: ['list', 'find-first', 'get', 'create', 'update', 'delete'], }, ]); return handleTableSubcommand(answer.subcommand as string, newArgv, prompter); @@ -59,6 +66,8 @@ async function handleTableSubcommand( switch (subcommand) { case 'list': return handleList(argv, prompter); + case 'find-first': + return handleFindFirst(argv, prompter); case 'get': return handleGet(argv, prompter); case 'create': @@ -72,31 +81,33 @@ async function handleTableSubcommand( process.exit(1); } } -async function handleList(_argv: Partial>, _prompter: Inquirerer) { +async function handleList(argv: Partial>, _prompter: Inquirerer) { try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + name: true, + tableId: true, + viewType: true, + data: true, + filterType: true, + filterData: true, + securityInvoker: true, + isReadOnly: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + }; + const findManyArgs = parseFindManyArgs< + FindManyArgs & { + select: ViewSelect; + } + >(argv, defaultSelect); const client = getClient(); - const result = await client.view - .findMany({ - select: { - id: true, - databaseId: true, - schemaId: true, - name: true, - tableId: true, - viewType: true, - data: true, - filterType: true, - filterData: true, - securityInvoker: true, - isReadOnly: true, - smartTags: true, - category: true, - module: true, - scope: true, - tags: true, - }, - }) - .execute(); + const result = await client.view.findMany(findManyArgs).execute(); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error('Failed to list records.'); @@ -106,6 +117,42 @@ async function handleList(_argv: Partial>, _prompter: In process.exit(1); } } +async function handleFindFirst(argv: Partial>, _prompter: Inquirerer) { + try { + const defaultSelect = { + id: true, + databaseId: true, + schemaId: true, + name: true, + tableId: true, + viewType: true, + data: true, + filterType: true, + filterData: true, + securityInvoker: true, + isReadOnly: true, + smartTags: true, + category: true, + module: true, + scope: true, + tags: true, + }; + const findFirstArgs = parseFindFirstArgs< + FindFirstArgs & { + select: ViewSelect; + } + >(argv, defaultSelect); + const client = getClient(); + const result = await client.view.findFirst(findFirstArgs).execute(); + console.log(JSON.stringify(result, null, 2)); + } catch (error) { + console.error('Failed to find record.'); + if (error instanceof Error) { + console.error(error.message); + } + process.exit(1); + } +} async function handleGet(argv: Partial>, prompter: Inquirerer) { try { const answers = await prompter.prompt(argv, [ diff --git a/sdk/constructive-cli/src/public/cli/utils.ts b/sdk/constructive-cli/src/public/cli/utils.ts index 612b4a801..7d8d25ac8 100644 --- a/sdk/constructive-cli/src/public/cli/utils.ts +++ b/sdk/constructive-cli/src/public/cli/utils.ts @@ -168,6 +168,114 @@ export function unflattenDotNotation(answers: Record): Record, name: string): number | undefined { + const val = argv[name]; + if (typeof val === 'number') return val; + if (typeof val === 'string') { + const n = parseInt(val, 10); + return isNaN(n) ? undefined : n; + } + return undefined; +} + +/** + * Parse a CLI flag as a string. + * Returns undefined when the flag is missing or not a string. + */ +export function parseStringFlag(argv: Record, name: string): string | undefined { + const val = argv[name]; + return typeof val === 'string' ? val : undefined; +} + +/** + * Parse --orderBy flag as a comma-separated list of enum values. + * e.g. --orderBy NAME_ASC,CREATED_AT_DESC → ['NAME_ASC', 'CREATED_AT_DESC'] + */ +export function parseOrderByFlag(argv: Record): string[] | undefined { + const val = argv.orderBy; + return typeof val === 'string' ? val.split(',') : undefined; +} + +/** + * Parse --select flag into a select object, falling back to a default. + * e.g. --select id,name → { id: true, name: true } + */ +export function parseSelectFlag( + argv: Record, + defaultSelect: Record +): Record { + const raw = argv.select; + return typeof raw === 'string' ? buildSelectFromPaths(raw) : defaultSelect; +} + +/** + * Build the full findManyArgs object from CLI argv. + * Parses all pagination, filtering, ordering, and field selection flags + * in one call. Accepts an optional `extraWhere` to merge with dot-notation + * --where flags (used by the search handler to inject search clauses). + * + * @example + * const findManyArgs = parseFindManyArgs(argv, { id: true, name: true }); + * const result = await client.user.findMany(findManyArgs).execute(); + */ +export function parseFindManyArgs>( + argv: Record, + defaultSelect: Record, + extraWhere?: Record +): T { + const limit = parseIntFlag(argv, 'limit'); + const last = parseIntFlag(argv, 'last'); + const offset = parseIntFlag(argv, 'offset'); + const after = parseStringFlag(argv, 'after'); + const before = parseStringFlag(argv, 'before'); + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = + (parsed.where ?? extraWhere) + ? { ...(extraWhere ?? {}), ...((parsed.where as Record) ?? {}) } + : undefined; + const condition = parsed.condition; + const orderBy = parseOrderByFlag(argv); + + return { + select, + ...(limit !== undefined ? { first: limit } : {}), + ...(after !== undefined ? { after } : {}), + ...(last !== undefined ? { last } : {}), + ...(before !== undefined ? { before } : {}), + ...(offset !== undefined ? { offset } : {}), + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + ...(orderBy !== undefined ? { orderBy } : {}), + } as unknown as T; +} + +/** + * Build findFirst args from CLI argv. + * Like parseFindManyArgs but only includes select, where, and condition + * (no pagination flags — findFirst returns the first matching record). + */ +export function parseFindFirstArgs>( + argv: Record, + defaultSelect: Record +): T { + const select = parseSelectFlag(argv, defaultSelect); + const parsed = unflattenDotNotation(argv); + const where = parsed.where; + const condition = parsed.condition; + + return { + select, + ...(where !== undefined ? { where } : {}), + ...(condition !== undefined ? { condition } : {}), + } as unknown as T; +} + export function buildSelectFromPaths(paths: string): Record { const result: Record = {}; const trimmedPaths = paths diff --git a/sdk/constructive-cli/src/public/orm/README.md b/sdk/constructive-cli/src/public/orm/README.md index 4ad719003..50a2fcc00 100644 --- a/sdk/constructive-cli/src/public/orm/README.md +++ b/sdk/constructive-cli/src/public/orm/README.md @@ -117,11 +117,11 @@ const db = createClient({ | `migrateFile` | findMany, findOne, create, update, delete | | `appLimitDefault` | findMany, findOne, create, update, delete | | `orgLimitDefault` | findMany, findOne, create, update, delete | -| `nodeTypeRegistry` | findMany, findOne, create, update, delete | | `membershipType` | findMany, findOne, create, update, delete | | `commit` | findMany, findOne, create, update, delete | | `appMembershipDefault` | findMany, findOne, create, update, delete | | `rlsModule` | findMany, findOne, create, update, delete | +| `nodeTypeRegistry` | findMany, findOne, create, update, delete | | `orgMembershipDefault` | findMany, findOne, create, update, delete | | `sqlAction` | findMany, findOne, create, update, delete | | `user` | findMany, findOne, create, update, delete | @@ -3753,43 +3753,6 @@ const updated = await db.orgLimitDefault.update({ where: { id: '' }, data: const deleted = await db.orgLimitDefault.delete({ where: { id: '' } }).execute(); ``` -### `db.nodeTypeRegistry` - -CRUD operations for NodeTypeRegistry records. - -**Fields:** - -| Field | Type | Editable | -|-------|------|----------| -| `name` | String | No | -| `slug` | String | Yes | -| `category` | String | Yes | -| `displayName` | String | Yes | -| `description` | String | Yes | -| `parameterSchema` | JSON | Yes | -| `tags` | String | Yes | -| `createdAt` | Datetime | No | -| `updatedAt` | Datetime | No | - -**Operations:** - -```typescript -// List all nodeTypeRegistry records -const items = await db.nodeTypeRegistry.findMany({ select: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }).execute(); - -// Get one by name -const item = await db.nodeTypeRegistry.findOne({ name: '', select: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }).execute(); - -// Create -const created = await db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', parameterSchema: '', tags: '' }, select: { name: true } }).execute(); - -// Update -const updated = await db.nodeTypeRegistry.update({ where: { name: '' }, data: { slug: '' }, select: { name: true } }).execute(); - -// Delete -const deleted = await db.nodeTypeRegistry.delete({ where: { name: '' } }).execute(); -``` - ### `db.membershipType` CRUD operations for MembershipType records. @@ -3933,6 +3896,45 @@ const updated = await db.rlsModule.update({ where: { id: '' }, data: { dat const deleted = await db.rlsModule.delete({ where: { id: '' } }).execute(); ``` +### `db.nodeTypeRegistry` + +CRUD operations for NodeTypeRegistry records. + +**Fields:** + +| Field | Type | Editable | +|-------|------|----------| +| `name` | String | No | +| `slug` | String | Yes | +| `category` | String | Yes | +| `displayName` | String | Yes | +| `description` | String | Yes | +| `summary` | String | Yes | +| `parameterSchema` | JSON | Yes | +| `guidance` | JSON | Yes | +| `tags` | String | Yes | +| `createdAt` | Datetime | No | +| `updatedAt` | Datetime | No | + +**Operations:** + +```typescript +// List all nodeTypeRegistry records +const items = await db.nodeTypeRegistry.findMany({ select: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }).execute(); + +// Get one by name +const item = await db.nodeTypeRegistry.findOne({ name: '', select: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }).execute(); + +// Create +const created = await db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', summary: '', parameterSchema: '', guidance: '', tags: '' }, select: { name: true } }).execute(); + +// Update +const updated = await db.nodeTypeRegistry.update({ where: { name: '' }, data: { slug: '' }, select: { name: true } }).execute(); + +// Delete +const deleted = await db.nodeTypeRegistry.delete({ where: { name: '' } }).execute(); +``` + ### `db.orgMembershipDefault` CRUD operations for OrgMembershipDefault records. @@ -4050,6 +4052,9 @@ const updated = await db.user.update({ where: { id: '' }, data: { username const deleted = await db.user.delete({ where: { id: '' } }).execute(); ``` +> **Unified Search API fields:** `searchTsv` +> Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ### `db.astMigration` CRUD operations for AstMigration records. diff --git a/sdk/constructive-cli/src/public/orm/index.ts b/sdk/constructive-cli/src/public/orm/index.ts index 9068882eb..510f740b9 100644 --- a/sdk/constructive-cli/src/public/orm/index.ts +++ b/sdk/constructive-cli/src/public/orm/index.ts @@ -101,11 +101,11 @@ import { RoleTypeModel } from './models/roleType'; import { MigrateFileModel } from './models/migrateFile'; import { AppLimitDefaultModel } from './models/appLimitDefault'; import { OrgLimitDefaultModel } from './models/orgLimitDefault'; -import { NodeTypeRegistryModel } from './models/nodeTypeRegistry'; import { MembershipTypeModel } from './models/membershipType'; import { CommitModel } from './models/commit'; import { AppMembershipDefaultModel } from './models/appMembershipDefault'; import { RlsModuleModel } from './models/rlsModule'; +import { NodeTypeRegistryModel } from './models/nodeTypeRegistry'; import { OrgMembershipDefaultModel } from './models/orgMembershipDefault'; import { SqlActionModel } from './models/sqlAction'; import { UserModel } from './models/user'; @@ -244,11 +244,11 @@ export function createClient(config: OrmClientConfig) { migrateFile: new MigrateFileModel(client), appLimitDefault: new AppLimitDefaultModel(client), orgLimitDefault: new OrgLimitDefaultModel(client), - nodeTypeRegistry: new NodeTypeRegistryModel(client), membershipType: new MembershipTypeModel(client), commit: new CommitModel(client), appMembershipDefault: new AppMembershipDefaultModel(client), rlsModule: new RlsModuleModel(client), + nodeTypeRegistry: new NodeTypeRegistryModel(client), orgMembershipDefault: new OrgMembershipDefaultModel(client), sqlAction: new SqlActionModel(client), user: new UserModel(client), diff --git a/sdk/constructive-cli/src/public/orm/input-types.ts b/sdk/constructive-cli/src/public/orm/input-types.ts index 817a485e5..5d9eed7f1 100644 --- a/sdk/constructive-cli/src/public/orm/input-types.ts +++ b/sdk/constructive-cli/src/public/orm/input-types.ts @@ -1796,25 +1796,6 @@ export interface OrgLimitDefault { /** Default maximum usage allowed for this limit */ max?: number | null; } -/** Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). */ -export interface NodeTypeRegistry { - /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ - name?: string | null; - /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ - slug?: string | null; - /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ - category?: string | null; - /** Human-readable display name for UI */ - displayName?: string | null; - /** Description of what this node type does */ - description?: string | null; - /** JSON Schema defining valid parameters for this node type */ - parameterSchema?: Record | null; - /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ - tags?: string[] | null; - createdAt?: string | null; - updatedAt?: string | null; -} /** Defines the different scopes of membership (e.g. App Member, Organization Member, Group Member) */ export interface MembershipType { /** Integer identifier for the membership type (1=App, 2=Organization, 3=Group) */ @@ -1870,6 +1851,29 @@ export interface RlsModule { currentRole?: string | null; currentRoleId?: string | null; } +/** Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). */ +export interface NodeTypeRegistry { + /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ + name?: string | null; + /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ + slug?: string | null; + /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ + category?: string | null; + /** Human-readable display name for UI */ + displayName?: string | null; + /** Description of what this node type does */ + description?: string | null; + /** Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. */ + summary?: string | null; + /** JSON Schema defining valid parameters for this node type */ + parameterSchema?: Record | null; + /** Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples */ + guidance?: Record | null; + /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ + tags?: string[] | null; + createdAt?: string | null; + updatedAt?: string | null; +} /** Default membership settings per entity, controlling initial approval and verification state for new members */ export interface OrgMembershipDefault { id: string; @@ -2514,7 +2518,6 @@ export interface RoleTypeRelations {} export interface MigrateFileRelations {} export interface AppLimitDefaultRelations {} export interface OrgLimitDefaultRelations {} -export interface NodeTypeRegistryRelations {} export interface MembershipTypeRelations {} export interface CommitRelations {} export interface AppMembershipDefaultRelations {} @@ -2526,6 +2529,7 @@ export interface RlsModuleRelations { sessionsTable?: Table | null; usersTable?: Table | null; } +export interface NodeTypeRegistryRelations {} export interface OrgMembershipDefaultRelations { entity?: User | null; } @@ -2707,12 +2711,12 @@ export type RoleTypeWithRelations = RoleType & RoleTypeRelations; export type MigrateFileWithRelations = MigrateFile & MigrateFileRelations; export type AppLimitDefaultWithRelations = AppLimitDefault & AppLimitDefaultRelations; export type OrgLimitDefaultWithRelations = OrgLimitDefault & OrgLimitDefaultRelations; -export type NodeTypeRegistryWithRelations = NodeTypeRegistry & NodeTypeRegistryRelations; export type MembershipTypeWithRelations = MembershipType & MembershipTypeRelations; export type CommitWithRelations = Commit & CommitRelations; export type AppMembershipDefaultWithRelations = AppMembershipDefault & AppMembershipDefaultRelations; export type RlsModuleWithRelations = RlsModule & RlsModuleRelations; +export type NodeTypeRegistryWithRelations = NodeTypeRegistry & NodeTypeRegistryRelations; export type OrgMembershipDefaultWithRelations = OrgMembershipDefault & OrgMembershipDefaultRelations; export type SqlActionWithRelations = SqlAction & SqlActionRelations; @@ -5146,17 +5150,6 @@ export type OrgLimitDefaultSelect = { name?: boolean; max?: boolean; }; -export type NodeTypeRegistrySelect = { - name?: boolean; - slug?: boolean; - category?: boolean; - displayName?: boolean; - description?: boolean; - parameterSchema?: boolean; - tags?: boolean; - createdAt?: boolean; - updatedAt?: boolean; -}; export type MembershipTypeSelect = { id?: boolean; name?: boolean; @@ -5214,6 +5207,19 @@ export type RlsModuleSelect = { select: TableSelect; }; }; +export type NodeTypeRegistrySelect = { + name?: boolean; + slug?: boolean; + category?: boolean; + displayName?: boolean; + description?: boolean; + summary?: boolean; + parameterSchema?: boolean; + guidance?: boolean; + tags?: boolean; + createdAt?: boolean; + updatedAt?: boolean; +}; export type OrgMembershipDefaultSelect = { id?: boolean; createdAt?: boolean; @@ -9183,32 +9189,6 @@ export interface OrgLimitDefaultFilter { /** Negates the expression. */ not?: OrgLimitDefaultFilter; } -export interface NodeTypeRegistryFilter { - /** Filter by the object’s `name` field. */ - name?: StringFilter; - /** Filter by the object’s `slug` field. */ - slug?: StringFilter; - /** Filter by the object’s `category` field. */ - category?: StringFilter; - /** Filter by the object’s `displayName` field. */ - displayName?: StringFilter; - /** Filter by the object’s `description` field. */ - description?: StringFilter; - /** Filter by the object’s `parameterSchema` field. */ - parameterSchema?: JSONFilter; - /** Filter by the object’s `tags` field. */ - tags?: StringListFilter; - /** Filter by the object’s `createdAt` field. */ - createdAt?: DatetimeFilter; - /** Filter by the object’s `updatedAt` field. */ - updatedAt?: DatetimeFilter; - /** Checks for all expressions in this list. */ - and?: NodeTypeRegistryFilter[]; - /** Checks for any expressions in this list. */ - or?: NodeTypeRegistryFilter[]; - /** Negates the expression. */ - not?: NodeTypeRegistryFilter; -} export interface MembershipTypeFilter { /** Filter by the object’s `id` field. */ id?: IntFilter; @@ -9315,6 +9295,36 @@ export interface RlsModuleFilter { /** Filter by the object’s `usersTable` relation. */ usersTable?: TableFilter; } +export interface NodeTypeRegistryFilter { + /** Filter by the object’s `name` field. */ + name?: StringFilter; + /** Filter by the object’s `slug` field. */ + slug?: StringFilter; + /** Filter by the object’s `category` field. */ + category?: StringFilter; + /** Filter by the object’s `displayName` field. */ + displayName?: StringFilter; + /** Filter by the object’s `description` field. */ + description?: StringFilter; + /** Filter by the object’s `summary` field. */ + summary?: StringFilter; + /** Filter by the object’s `parameterSchema` field. */ + parameterSchema?: JSONFilter; + /** Filter by the object’s `guidance` field. */ + guidance?: JSONFilter; + /** Filter by the object’s `tags` field. */ + tags?: StringListFilter; + /** Filter by the object’s `createdAt` field. */ + createdAt?: DatetimeFilter; + /** Filter by the object’s `updatedAt` field. */ + updatedAt?: DatetimeFilter; + /** Checks for all expressions in this list. */ + and?: NodeTypeRegistryFilter[]; + /** Checks for any expressions in this list. */ + or?: NodeTypeRegistryFilter[]; + /** Negates the expression. */ + not?: NodeTypeRegistryFilter; +} export interface OrgMembershipDefaultFilter { /** Filter by the object’s `id` field. */ id?: UUIDFilter; @@ -10931,16 +10941,6 @@ export type OrgLimitDefaultOrderBy = | 'ID_DESC' | 'NAME_ASC' | 'NAME_DESC'; -export type NodeTypeRegistryOrderBy = - | 'NATURAL' - | 'PRIMARY_KEY_ASC' - | 'PRIMARY_KEY_DESC' - | 'NAME_ASC' - | 'NAME_DESC' - | 'SLUG_ASC' - | 'SLUG_DESC' - | 'CATEGORY_ASC' - | 'CATEGORY_DESC'; export type MembershipTypeOrderBy = | 'NATURAL' | 'PRIMARY_KEY_ASC' @@ -10979,6 +10979,16 @@ export type RlsModuleOrderBy = | 'ID_DESC' | 'DATABASE_ID_ASC' | 'DATABASE_ID_DESC'; +export type NodeTypeRegistryOrderBy = + | 'NATURAL' + | 'PRIMARY_KEY_ASC' + | 'PRIMARY_KEY_DESC' + | 'NAME_ASC' + | 'NAME_DESC' + | 'SLUG_ASC' + | 'SLUG_DESC' + | 'CATEGORY_ASC' + | 'CATEGORY_DESC'; export type OrgMembershipDefaultOrderBy = | 'NATURAL' | 'PRIMARY_KEY_ASC' @@ -14141,36 +14151,6 @@ export interface DeleteOrgLimitDefaultInput { clientMutationId?: string; id: string; } -export interface CreateNodeTypeRegistryInput { - clientMutationId?: string; - nodeTypeRegistry: { - name: string; - slug: string; - category: string; - displayName?: string; - description?: string; - parameterSchema?: Record; - tags?: string[]; - }; -} -export interface NodeTypeRegistryPatch { - name?: string | null; - slug?: string | null; - category?: string | null; - displayName?: string | null; - description?: string | null; - parameterSchema?: Record | null; - tags?: string[] | null; -} -export interface UpdateNodeTypeRegistryInput { - clientMutationId?: string; - name: string; - nodeTypeRegistryPatch: NodeTypeRegistryPatch; -} -export interface DeleteNodeTypeRegistryInput { - clientMutationId?: string; - name: string; -} export interface CreateMembershipTypeInput { clientMutationId?: string; membershipType: { @@ -14285,6 +14265,40 @@ export interface DeleteRlsModuleInput { clientMutationId?: string; id: string; } +export interface CreateNodeTypeRegistryInput { + clientMutationId?: string; + nodeTypeRegistry: { + name: string; + slug: string; + category: string; + displayName?: string; + description?: string; + summary?: string; + parameterSchema?: Record; + guidance?: Record; + tags?: string[]; + }; +} +export interface NodeTypeRegistryPatch { + name?: string | null; + slug?: string | null; + category?: string | null; + displayName?: string | null; + description?: string | null; + summary?: string | null; + parameterSchema?: Record | null; + guidance?: Record | null; + tags?: string[] | null; +} +export interface UpdateNodeTypeRegistryInput { + clientMutationId?: string; + name: string; + nodeTypeRegistryPatch: NodeTypeRegistryPatch; +} +export interface DeleteNodeTypeRegistryInput { + clientMutationId?: string; + name: string; +} export interface CreateOrgMembershipDefaultInput { clientMutationId?: string; orgMembershipDefault: { @@ -25335,51 +25349,6 @@ export type DeleteOrgLimitDefaultPayloadSelect = { select: OrgLimitDefaultEdgeSelect; }; }; -export interface CreateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was created by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type CreateNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; -export interface UpdateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was updated by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type UpdateNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; -export interface DeleteNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was deleted by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type DeleteNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; export interface CreateMembershipTypePayload { clientMutationId?: string | null; /** The `MembershipType` that was created by this mutation. */ @@ -25560,6 +25529,51 @@ export type DeleteRlsModulePayloadSelect = { select: RlsModuleEdgeSelect; }; }; +export interface CreateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was created by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type CreateNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; +export interface UpdateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was updated by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type UpdateNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; +export interface DeleteNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was deleted by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type DeleteNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; export interface CreateOrgMembershipDefaultPayload { clientMutationId?: string | null; /** The `OrgMembershipDefault` that was created by this mutation. */ @@ -27013,18 +27027,6 @@ export type OrgLimitDefaultEdgeSelect = { select: OrgLimitDefaultSelect; }; }; -/** A `NodeTypeRegistry` edge in the connection. */ -export interface NodeTypeRegistryEdge { - cursor?: string | null; - /** The `NodeTypeRegistry` at the end of the edge. */ - node?: NodeTypeRegistry | null; -} -export type NodeTypeRegistryEdgeSelect = { - cursor?: boolean; - node?: { - select: NodeTypeRegistrySelect; - }; -}; /** A `MembershipType` edge in the connection. */ export interface MembershipTypeEdge { cursor?: string | null; @@ -27073,6 +27075,18 @@ export type RlsModuleEdgeSelect = { select: RlsModuleSelect; }; }; +/** A `NodeTypeRegistry` edge in the connection. */ +export interface NodeTypeRegistryEdge { + cursor?: string | null; + /** The `NodeTypeRegistry` at the end of the edge. */ + node?: NodeTypeRegistry | null; +} +export type NodeTypeRegistryEdgeSelect = { + cursor?: boolean; + node?: { + select: NodeTypeRegistrySelect; + }; +}; /** A `OrgMembershipDefault` edge in the connection. */ export interface OrgMembershipDefaultEdge { cursor?: string | null; diff --git a/sdk/constructive-cli/src/public/orm/models/index.ts b/sdk/constructive-cli/src/public/orm/models/index.ts index c0d113bd7..68efecd05 100644 --- a/sdk/constructive-cli/src/public/orm/models/index.ts +++ b/sdk/constructive-cli/src/public/orm/models/index.ts @@ -99,11 +99,11 @@ export { RoleTypeModel } from './roleType'; export { MigrateFileModel } from './migrateFile'; export { AppLimitDefaultModel } from './appLimitDefault'; export { OrgLimitDefaultModel } from './orgLimitDefault'; -export { NodeTypeRegistryModel } from './nodeTypeRegistry'; export { MembershipTypeModel } from './membershipType'; export { CommitModel } from './commit'; export { AppMembershipDefaultModel } from './appMembershipDefault'; export { RlsModuleModel } from './rlsModule'; +export { NodeTypeRegistryModel } from './nodeTypeRegistry'; export { OrgMembershipDefaultModel } from './orgMembershipDefault'; export { SqlActionModel } from './sqlAction'; export { UserModel } from './user'; diff --git a/sdk/constructive-react/src/admin/schema-types.ts b/sdk/constructive-react/src/admin/schema-types.ts index 17d443892..17c62e5a8 100644 --- a/sdk/constructive-react/src/admin/schema-types.ts +++ b/sdk/constructive-react/src/admin/schema-types.ts @@ -3618,6 +3618,9 @@ export interface MetaField { type: MetaType; isNotNull: boolean; hasDefault: boolean; + isPrimaryKey: boolean; + isForeignKey: boolean; + description?: string | null; } /** Information about a database index */ export interface MetaIndex { diff --git a/sdk/constructive-react/src/auth/orm/README.md b/sdk/constructive-react/src/auth/orm/README.md index ef3b0c06e..745af4158 100644 --- a/sdk/constructive-react/src/auth/orm/README.md +++ b/sdk/constructive-react/src/auth/orm/README.md @@ -278,6 +278,9 @@ const updated = await db.user.update({ where: { id: '' }, data: { username const deleted = await db.user.delete({ where: { id: '' } }).execute(); ``` +> **Unified Search API fields:** `searchTsv` +> Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ## Custom Operations ### `db.query.currentIpAddress` diff --git a/sdk/constructive-react/src/auth/schema-types.ts b/sdk/constructive-react/src/auth/schema-types.ts index 6f7abcf6c..8b371acc8 100644 --- a/sdk/constructive-react/src/auth/schema-types.ts +++ b/sdk/constructive-react/src/auth/schema-types.ts @@ -1413,6 +1413,9 @@ export interface MetaField { type: MetaType; isNotNull: boolean; hasDefault: boolean; + isPrimaryKey: boolean; + isForeignKey: boolean; + description?: string | null; } /** Information about a database index */ export interface MetaIndex { diff --git a/sdk/constructive-react/src/objects/schema-types.ts b/sdk/constructive-react/src/objects/schema-types.ts index af6b2c3a5..cabea4012 100644 --- a/sdk/constructive-react/src/objects/schema-types.ts +++ b/sdk/constructive-react/src/objects/schema-types.ts @@ -593,6 +593,9 @@ export interface MetaField { type: MetaType; isNotNull: boolean; hasDefault: boolean; + isPrimaryKey: boolean; + isForeignKey: boolean; + description?: string | null; } /** Information about a database index */ export interface MetaIndex { diff --git a/sdk/constructive-react/src/public/hooks/README.md b/sdk/constructive-react/src/public/hooks/README.md index 5791a7344..bdd46f70b 100644 --- a/sdk/constructive-react/src/public/hooks/README.md +++ b/sdk/constructive-react/src/public/hooks/README.md @@ -538,11 +538,6 @@ function App() { | `useCreateOrgLimitDefaultMutation` | Mutation | Default maximum values for each named limit, applied when no per-actor override exists | | `useUpdateOrgLimitDefaultMutation` | Mutation | Default maximum values for each named limit, applied when no per-actor override exists | | `useDeleteOrgLimitDefaultMutation` | Mutation | Default maximum values for each named limit, applied when no per-actor override exists | -| `useNodeTypeRegistriesQuery` | Query | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | -| `useNodeTypeRegistryQuery` | Query | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | -| `useCreateNodeTypeRegistryMutation` | Mutation | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | -| `useUpdateNodeTypeRegistryMutation` | Mutation | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | -| `useDeleteNodeTypeRegistryMutation` | Mutation | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | | `useMembershipTypesQuery` | Query | Defines the different scopes of membership (e.g. App Member, Organization Member, Group Member) | | `useMembershipTypeQuery` | Query | Defines the different scopes of membership (e.g. App Member, Organization Member, Group Member) | | `useCreateMembershipTypeMutation` | Mutation | Defines the different scopes of membership (e.g. App Member, Organization Member, Group Member) | @@ -563,6 +558,11 @@ function App() { | `useCreateRlsModuleMutation` | Mutation | Create a rlsModule | | `useUpdateRlsModuleMutation` | Mutation | Update a rlsModule | | `useDeleteRlsModuleMutation` | Mutation | Delete a rlsModule | +| `useNodeTypeRegistriesQuery` | Query | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | +| `useNodeTypeRegistryQuery` | Query | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | +| `useCreateNodeTypeRegistryMutation` | Mutation | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | +| `useUpdateNodeTypeRegistryMutation` | Mutation | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | +| `useDeleteNodeTypeRegistryMutation` | Mutation | Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). | | `useOrgMembershipDefaultsQuery` | Query | Default membership settings per entity, controlling initial approval and verification state for new members | | `useOrgMembershipDefaultQuery` | Query | Default membership settings per entity, controlling initial approval and verification state for new members | | `useCreateOrgMembershipDefaultMutation` | Mutation | Default membership settings per entity, controlling initial approval and verification state for new members | @@ -2665,27 +2665,6 @@ const { mutate: create } = useCreateOrgLimitDefaultMutation({ create({ name: '', max: '' }); ``` -### NodeTypeRegistry - -```typescript -// List all nodeTypeRegistries -const { data, isLoading } = useNodeTypeRegistriesQuery({ - selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }, -}); - -// Get one nodeTypeRegistry -const { data: item } = useNodeTypeRegistryQuery({ - name: '', - selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }, -}); - -// Create a nodeTypeRegistry -const { mutate: create } = useCreateNodeTypeRegistryMutation({ - selection: { fields: { name: true } }, -}); -create({ slug: '', category: '', displayName: '', description: '', parameterSchema: '', tags: '' }); -``` - ### MembershipType ```typescript @@ -2770,6 +2749,27 @@ const { mutate: create } = useCreateRlsModuleMutation({ create({ databaseId: '', schemaId: '', privateSchemaId: '', sessionCredentialsTableId: '', sessionsTableId: '', usersTableId: '', authenticate: '', authenticateStrict: '', currentRole: '', currentRoleId: '' }); ``` +### NodeTypeRegistry + +```typescript +// List all nodeTypeRegistries +const { data, isLoading } = useNodeTypeRegistriesQuery({ + selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }, +}); + +// Get one nodeTypeRegistry +const { data: item } = useNodeTypeRegistryQuery({ + name: '', + selection: { fields: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }, +}); + +// Create a nodeTypeRegistry +const { mutate: create } = useCreateNodeTypeRegistryMutation({ + selection: { fields: { name: true } }, +}); +create({ slug: '', category: '', displayName: '', description: '', summary: '', parameterSchema: '', guidance: '', tags: '' }); +``` + ### OrgMembershipDefault ```typescript diff --git a/sdk/constructive-react/src/public/hooks/index.ts b/sdk/constructive-react/src/public/hooks/index.ts index e3c9acd93..d025ae67c 100644 --- a/sdk/constructive-react/src/public/hooks/index.ts +++ b/sdk/constructive-react/src/public/hooks/index.ts @@ -2,7 +2,7 @@ * GraphQL SDK * @generated by @constructive-io/graphql-codegen * - * Tables: GetAllRecord, OrgGetManagersRecord, OrgGetSubordinatesRecord, Object, AppPermission, OrgPermission, AppLevelRequirement, Database, Schema, Table, CheckConstraint, Field, ForeignKeyConstraint, FullTextSearch, Index, Policy, PrimaryKeyConstraint, TableGrant, Trigger, UniqueConstraint, View, ViewTable, ViewGrant, ViewRule, EmbeddingChunk, TableTemplateModule, SecureTableProvision, RelationProvision, SchemaGrant, DefaultPrivilege, Enum, ApiSchema, ApiModule, Domain, SiteMetadatum, SiteModule, SiteTheme, TriggerFunction, DatabaseTransfer, Api, Site, App, ConnectedAccountsModule, CryptoAddressesModule, CryptoAuthModule, DefaultIdsModule, DenormalizedTableField, EmailsModule, EncryptedSecretsModule, InvitesModule, LevelsModule, LimitsModule, MembershipTypesModule, MembershipsModule, PermissionsModule, PhoneNumbersModule, ProfilesModule, SecretsModule, SessionsModule, UserAuthModule, UsersModule, Blueprint, BlueprintTemplate, DatabaseProvisionModule, AppAdminGrant, AppOwnerGrant, AppGrant, OrgMembership, OrgMember, OrgAdminGrant, OrgOwnerGrant, OrgGrant, OrgChartEdge, OrgChartEdgeGrant, OrgPermissionDefault, AppLimit, OrgLimit, AppStep, AppAchievement, AppLevel, Email, PhoneNumber, CryptoAddress, ConnectedAccount, Invite, ClaimedInvite, OrgInvite, OrgClaimedInvite, AuditLog, Ref, Store, AppPermissionDefault, RoleType, MigrateFile, AppLimitDefault, OrgLimitDefault, NodeTypeRegistry, MembershipType, Commit, AppMembershipDefault, RlsModule, OrgMembershipDefault, SqlAction, User, AstMigration, AppMembership, HierarchyModule + * Tables: GetAllRecord, OrgGetManagersRecord, OrgGetSubordinatesRecord, Object, AppPermission, OrgPermission, AppLevelRequirement, Database, Schema, Table, CheckConstraint, Field, ForeignKeyConstraint, FullTextSearch, Index, Policy, PrimaryKeyConstraint, TableGrant, Trigger, UniqueConstraint, View, ViewTable, ViewGrant, ViewRule, EmbeddingChunk, TableTemplateModule, SecureTableProvision, RelationProvision, SchemaGrant, DefaultPrivilege, Enum, ApiSchema, ApiModule, Domain, SiteMetadatum, SiteModule, SiteTheme, TriggerFunction, DatabaseTransfer, Api, Site, App, ConnectedAccountsModule, CryptoAddressesModule, CryptoAuthModule, DefaultIdsModule, DenormalizedTableField, EmailsModule, EncryptedSecretsModule, InvitesModule, LevelsModule, LimitsModule, MembershipTypesModule, MembershipsModule, PermissionsModule, PhoneNumbersModule, ProfilesModule, SecretsModule, SessionsModule, UserAuthModule, UsersModule, Blueprint, BlueprintTemplate, DatabaseProvisionModule, AppAdminGrant, AppOwnerGrant, AppGrant, OrgMembership, OrgMember, OrgAdminGrant, OrgOwnerGrant, OrgGrant, OrgChartEdge, OrgChartEdgeGrant, OrgPermissionDefault, AppLimit, OrgLimit, AppStep, AppAchievement, AppLevel, Email, PhoneNumber, CryptoAddress, ConnectedAccount, Invite, ClaimedInvite, OrgInvite, OrgClaimedInvite, AuditLog, Ref, Store, AppPermissionDefault, RoleType, MigrateFile, AppLimitDefault, OrgLimitDefault, MembershipType, Commit, AppMembershipDefault, RlsModule, NodeTypeRegistry, OrgMembershipDefault, SqlAction, User, AstMigration, AppMembership, HierarchyModule * * Usage: * diff --git a/sdk/constructive-react/src/public/hooks/invalidation.ts b/sdk/constructive-react/src/public/hooks/invalidation.ts index 803433c10..715948b41 100644 --- a/sdk/constructive-react/src/public/hooks/invalidation.ts +++ b/sdk/constructive-react/src/public/hooks/invalidation.ts @@ -111,11 +111,11 @@ import { migrateFileKeys, appLimitDefaultKeys, orgLimitDefaultKeys, - nodeTypeRegistryKeys, membershipTypeKeys, commitKeys, appMembershipDefaultKeys, rlsModuleKeys, + nodeTypeRegistryKeys, orgMembershipDefaultKeys, sqlActionKeys, userKeys, @@ -1694,23 +1694,6 @@ export const invalidate = { queryKey: orgLimitDefaultKeys.detail(id), }), }, - /** Invalidate nodeTypeRegistry queries */ nodeTypeRegistry: { - /** Invalidate all nodeTypeRegistry queries */ all: (queryClient: QueryClient) => - queryClient.invalidateQueries({ - queryKey: nodeTypeRegistryKeys.all, - }), - /** Invalidate nodeTypeRegistry list queries */ lists: (queryClient: QueryClient) => - queryClient.invalidateQueries({ - queryKey: nodeTypeRegistryKeys.lists(), - }), - /** Invalidate a specific nodeTypeRegistry */ detail: ( - queryClient: QueryClient, - id: string | number - ) => - queryClient.invalidateQueries({ - queryKey: nodeTypeRegistryKeys.detail(id), - }), - }, /** Invalidate membershipType queries */ membershipType: { /** Invalidate all membershipType queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ @@ -1776,6 +1759,23 @@ export const invalidate = { queryKey: rlsModuleKeys.detail(id), }), }, + /** Invalidate nodeTypeRegistry queries */ nodeTypeRegistry: { + /** Invalidate all nodeTypeRegistry queries */ all: (queryClient: QueryClient) => + queryClient.invalidateQueries({ + queryKey: nodeTypeRegistryKeys.all, + }), + /** Invalidate nodeTypeRegistry list queries */ lists: (queryClient: QueryClient) => + queryClient.invalidateQueries({ + queryKey: nodeTypeRegistryKeys.lists(), + }), + /** Invalidate a specific nodeTypeRegistry */ detail: ( + queryClient: QueryClient, + id: string | number + ) => + queryClient.invalidateQueries({ + queryKey: nodeTypeRegistryKeys.detail(id), + }), + }, /** Invalidate orgMembershipDefault queries */ orgMembershipDefault: { /** Invalidate all orgMembershipDefault queries */ all: (queryClient: QueryClient) => queryClient.invalidateQueries({ @@ -2551,14 +2551,6 @@ export const remove = { queryKey: orgLimitDefaultKeys.detail(id), }); }, - /** Remove nodeTypeRegistry from cache */ nodeTypeRegistry: ( - queryClient: QueryClient, - id: string | number - ) => { - queryClient.removeQueries({ - queryKey: nodeTypeRegistryKeys.detail(id), - }); - }, /** Remove membershipType from cache */ membershipType: ( queryClient: QueryClient, id: string | number @@ -2585,6 +2577,14 @@ export const remove = { queryKey: rlsModuleKeys.detail(id), }); }, + /** Remove nodeTypeRegistry from cache */ nodeTypeRegistry: ( + queryClient: QueryClient, + id: string | number + ) => { + queryClient.removeQueries({ + queryKey: nodeTypeRegistryKeys.detail(id), + }); + }, /** Remove orgMembershipDefault from cache */ orgMembershipDefault: ( queryClient: QueryClient, id: string | number diff --git a/sdk/constructive-react/src/public/hooks/mutation-keys.ts b/sdk/constructive-react/src/public/hooks/mutation-keys.ts index ad6c5e24d..e72759f1a 100644 --- a/sdk/constructive-react/src/public/hooks/mutation-keys.ts +++ b/sdk/constructive-react/src/public/hooks/mutation-keys.ts @@ -866,15 +866,6 @@ export const orgLimitDefaultMutationKeys = { /** Delete orgLimitDefault mutation key */ delete: (id: string | number) => ['mutation', 'orglimitdefault', 'delete', id] as const, } as const; -export const nodeTypeRegistryMutationKeys = { - /** All nodeTypeRegistry mutation keys */ all: ['mutation', 'nodetyperegistry'] as const, - /** Create nodeTypeRegistry mutation key */ create: () => - ['mutation', 'nodetyperegistry', 'create'] as const, - /** Update nodeTypeRegistry mutation key */ update: (id: string | number) => - ['mutation', 'nodetyperegistry', 'update', id] as const, - /** Delete nodeTypeRegistry mutation key */ delete: (id: string | number) => - ['mutation', 'nodetyperegistry', 'delete', id] as const, -} as const; export const membershipTypeMutationKeys = { /** All membershipType mutation keys */ all: ['mutation', 'membershiptype'] as const, /** Create membershipType mutation key */ create: () => @@ -909,6 +900,15 @@ export const rlsModuleMutationKeys = { /** Delete rlsModule mutation key */ delete: (id: string | number) => ['mutation', 'rlsmodule', 'delete', id] as const, } as const; +export const nodeTypeRegistryMutationKeys = { + /** All nodeTypeRegistry mutation keys */ all: ['mutation', 'nodetyperegistry'] as const, + /** Create nodeTypeRegistry mutation key */ create: () => + ['mutation', 'nodetyperegistry', 'create'] as const, + /** Update nodeTypeRegistry mutation key */ update: (id: string | number) => + ['mutation', 'nodetyperegistry', 'update', id] as const, + /** Delete nodeTypeRegistry mutation key */ delete: (id: string | number) => + ['mutation', 'nodetyperegistry', 'delete', id] as const, +} as const; export const orgMembershipDefaultMutationKeys = { /** All orgMembershipDefault mutation keys */ all: ['mutation', 'orgmembershipdefault'] as const, /** Create orgMembershipDefault mutation key */ create: () => @@ -1231,11 +1231,11 @@ export const mutationKeys = { migrateFile: migrateFileMutationKeys, appLimitDefault: appLimitDefaultMutationKeys, orgLimitDefault: orgLimitDefaultMutationKeys, - nodeTypeRegistry: nodeTypeRegistryMutationKeys, membershipType: membershipTypeMutationKeys, commit: commitMutationKeys, appMembershipDefault: appMembershipDefaultMutationKeys, rlsModule: rlsModuleMutationKeys, + nodeTypeRegistry: nodeTypeRegistryMutationKeys, orgMembershipDefault: orgMembershipDefaultMutationKeys, sqlAction: sqlActionMutationKeys, user: userMutationKeys, diff --git a/sdk/constructive-react/src/public/hooks/mutations/index.ts b/sdk/constructive-react/src/public/hooks/mutations/index.ts index 79dd92890..59f298f34 100644 --- a/sdk/constructive-react/src/public/hooks/mutations/index.ts +++ b/sdk/constructive-react/src/public/hooks/mutations/index.ts @@ -283,9 +283,6 @@ export * from './useDeleteAppLimitDefaultMutation'; export * from './useCreateOrgLimitDefaultMutation'; export * from './useUpdateOrgLimitDefaultMutation'; export * from './useDeleteOrgLimitDefaultMutation'; -export * from './useCreateNodeTypeRegistryMutation'; -export * from './useUpdateNodeTypeRegistryMutation'; -export * from './useDeleteNodeTypeRegistryMutation'; export * from './useCreateMembershipTypeMutation'; export * from './useUpdateMembershipTypeMutation'; export * from './useDeleteMembershipTypeMutation'; @@ -298,6 +295,9 @@ export * from './useDeleteAppMembershipDefaultMutation'; export * from './useCreateRlsModuleMutation'; export * from './useUpdateRlsModuleMutation'; export * from './useDeleteRlsModuleMutation'; +export * from './useCreateNodeTypeRegistryMutation'; +export * from './useUpdateNodeTypeRegistryMutation'; +export * from './useDeleteNodeTypeRegistryMutation'; export * from './useCreateOrgMembershipDefaultMutation'; export * from './useUpdateOrgMembershipDefaultMutation'; export * from './useDeleteOrgMembershipDefaultMutation'; diff --git a/sdk/constructive-react/src/public/hooks/queries/index.ts b/sdk/constructive-react/src/public/hooks/queries/index.ts index b9b98b1a9..2c06497e0 100644 --- a/sdk/constructive-react/src/public/hooks/queries/index.ts +++ b/sdk/constructive-react/src/public/hooks/queries/index.ts @@ -192,8 +192,6 @@ export * from './useAppLimitDefaultsQuery'; export * from './useAppLimitDefaultQuery'; export * from './useOrgLimitDefaultsQuery'; export * from './useOrgLimitDefaultQuery'; -export * from './useNodeTypeRegistriesQuery'; -export * from './useNodeTypeRegistryQuery'; export * from './useMembershipTypesQuery'; export * from './useMembershipTypeQuery'; export * from './useCommitsQuery'; @@ -202,6 +200,8 @@ export * from './useAppMembershipDefaultsQuery'; export * from './useAppMembershipDefaultQuery'; export * from './useRlsModulesQuery'; export * from './useRlsModuleQuery'; +export * from './useNodeTypeRegistriesQuery'; +export * from './useNodeTypeRegistryQuery'; export * from './useOrgMembershipDefaultsQuery'; export * from './useOrgMembershipDefaultQuery'; export * from './useSqlActionsQuery'; diff --git a/sdk/constructive-react/src/public/hooks/query-keys.ts b/sdk/constructive-react/src/public/hooks/query-keys.ts index 8496a8ff5..095cd6973 100644 --- a/sdk/constructive-react/src/public/hooks/query-keys.ts +++ b/sdk/constructive-react/src/public/hooks/query-keys.ts @@ -883,15 +883,6 @@ export const orgLimitDefaultKeys = { /** Detail query key for specific item */ detail: (id: string | number) => [...orgLimitDefaultKeys.details(), id] as const, } as const; -export const nodeTypeRegistryKeys = { - /** All nodeTypeRegistry queries */ all: ['nodetyperegistry'] as const, - /** List query keys */ lists: () => [...nodeTypeRegistryKeys.all, 'list'] as const, - /** List query key with variables */ list: (variables?: object) => - [...nodeTypeRegistryKeys.lists(), variables] as const, - /** Detail query keys */ details: () => [...nodeTypeRegistryKeys.all, 'detail'] as const, - /** Detail query key for specific item */ detail: (id: string | number) => - [...nodeTypeRegistryKeys.details(), id] as const, -} as const; export const membershipTypeKeys = { /** All membershipType queries */ all: ['membershiptype'] as const, /** List query keys */ lists: () => [...membershipTypeKeys.all, 'list'] as const, @@ -928,6 +919,15 @@ export const rlsModuleKeys = { /** Detail query key for specific item */ detail: (id: string | number) => [...rlsModuleKeys.details(), id] as const, } as const; +export const nodeTypeRegistryKeys = { + /** All nodeTypeRegistry queries */ all: ['nodetyperegistry'] as const, + /** List query keys */ lists: () => [...nodeTypeRegistryKeys.all, 'list'] as const, + /** List query key with variables */ list: (variables?: object) => + [...nodeTypeRegistryKeys.lists(), variables] as const, + /** Detail query keys */ details: () => [...nodeTypeRegistryKeys.all, 'detail'] as const, + /** Detail query key for specific item */ detail: (id: string | number) => + [...nodeTypeRegistryKeys.details(), id] as const, +} as const; export const orgMembershipDefaultKeys = { /** All orgMembershipDefault queries */ all: ['orgmembershipdefault'] as const, /** List query keys */ lists: () => [...orgMembershipDefaultKeys.all, 'list'] as const, @@ -1145,11 +1145,11 @@ export const queryKeys = { migrateFile: migrateFileKeys, appLimitDefault: appLimitDefaultKeys, orgLimitDefault: orgLimitDefaultKeys, - nodeTypeRegistry: nodeTypeRegistryKeys, membershipType: membershipTypeKeys, commit: commitKeys, appMembershipDefault: appMembershipDefaultKeys, rlsModule: rlsModuleKeys, + nodeTypeRegistry: nodeTypeRegistryKeys, orgMembershipDefault: orgMembershipDefaultKeys, sqlAction: sqlActionKeys, user: userKeys, diff --git a/sdk/constructive-react/src/public/orm/README.md b/sdk/constructive-react/src/public/orm/README.md index 4ad719003..50a2fcc00 100644 --- a/sdk/constructive-react/src/public/orm/README.md +++ b/sdk/constructive-react/src/public/orm/README.md @@ -117,11 +117,11 @@ const db = createClient({ | `migrateFile` | findMany, findOne, create, update, delete | | `appLimitDefault` | findMany, findOne, create, update, delete | | `orgLimitDefault` | findMany, findOne, create, update, delete | -| `nodeTypeRegistry` | findMany, findOne, create, update, delete | | `membershipType` | findMany, findOne, create, update, delete | | `commit` | findMany, findOne, create, update, delete | | `appMembershipDefault` | findMany, findOne, create, update, delete | | `rlsModule` | findMany, findOne, create, update, delete | +| `nodeTypeRegistry` | findMany, findOne, create, update, delete | | `orgMembershipDefault` | findMany, findOne, create, update, delete | | `sqlAction` | findMany, findOne, create, update, delete | | `user` | findMany, findOne, create, update, delete | @@ -3753,43 +3753,6 @@ const updated = await db.orgLimitDefault.update({ where: { id: '' }, data: const deleted = await db.orgLimitDefault.delete({ where: { id: '' } }).execute(); ``` -### `db.nodeTypeRegistry` - -CRUD operations for NodeTypeRegistry records. - -**Fields:** - -| Field | Type | Editable | -|-------|------|----------| -| `name` | String | No | -| `slug` | String | Yes | -| `category` | String | Yes | -| `displayName` | String | Yes | -| `description` | String | Yes | -| `parameterSchema` | JSON | Yes | -| `tags` | String | Yes | -| `createdAt` | Datetime | No | -| `updatedAt` | Datetime | No | - -**Operations:** - -```typescript -// List all nodeTypeRegistry records -const items = await db.nodeTypeRegistry.findMany({ select: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }).execute(); - -// Get one by name -const item = await db.nodeTypeRegistry.findOne({ name: '', select: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }).execute(); - -// Create -const created = await db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', parameterSchema: '', tags: '' }, select: { name: true } }).execute(); - -// Update -const updated = await db.nodeTypeRegistry.update({ where: { name: '' }, data: { slug: '' }, select: { name: true } }).execute(); - -// Delete -const deleted = await db.nodeTypeRegistry.delete({ where: { name: '' } }).execute(); -``` - ### `db.membershipType` CRUD operations for MembershipType records. @@ -3933,6 +3896,45 @@ const updated = await db.rlsModule.update({ where: { id: '' }, data: { dat const deleted = await db.rlsModule.delete({ where: { id: '' } }).execute(); ``` +### `db.nodeTypeRegistry` + +CRUD operations for NodeTypeRegistry records. + +**Fields:** + +| Field | Type | Editable | +|-------|------|----------| +| `name` | String | No | +| `slug` | String | Yes | +| `category` | String | Yes | +| `displayName` | String | Yes | +| `description` | String | Yes | +| `summary` | String | Yes | +| `parameterSchema` | JSON | Yes | +| `guidance` | JSON | Yes | +| `tags` | String | Yes | +| `createdAt` | Datetime | No | +| `updatedAt` | Datetime | No | + +**Operations:** + +```typescript +// List all nodeTypeRegistry records +const items = await db.nodeTypeRegistry.findMany({ select: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }).execute(); + +// Get one by name +const item = await db.nodeTypeRegistry.findOne({ name: '', select: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }).execute(); + +// Create +const created = await db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', summary: '', parameterSchema: '', guidance: '', tags: '' }, select: { name: true } }).execute(); + +// Update +const updated = await db.nodeTypeRegistry.update({ where: { name: '' }, data: { slug: '' }, select: { name: true } }).execute(); + +// Delete +const deleted = await db.nodeTypeRegistry.delete({ where: { name: '' } }).execute(); +``` + ### `db.orgMembershipDefault` CRUD operations for OrgMembershipDefault records. @@ -4050,6 +4052,9 @@ const updated = await db.user.update({ where: { id: '' }, data: { username const deleted = await db.user.delete({ where: { id: '' } }).execute(); ``` +> **Unified Search API fields:** `searchTsv` +> Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ### `db.astMigration` CRUD operations for AstMigration records. diff --git a/sdk/constructive-react/src/public/orm/index.ts b/sdk/constructive-react/src/public/orm/index.ts index 79daa9193..9ab27b1d8 100644 --- a/sdk/constructive-react/src/public/orm/index.ts +++ b/sdk/constructive-react/src/public/orm/index.ts @@ -101,11 +101,11 @@ import { RoleTypeModel } from './models/roleType'; import { MigrateFileModel } from './models/migrateFile'; import { AppLimitDefaultModel } from './models/appLimitDefault'; import { OrgLimitDefaultModel } from './models/orgLimitDefault'; -import { NodeTypeRegistryModel } from './models/nodeTypeRegistry'; import { MembershipTypeModel } from './models/membershipType'; import { CommitModel } from './models/commit'; import { AppMembershipDefaultModel } from './models/appMembershipDefault'; import { RlsModuleModel } from './models/rlsModule'; +import { NodeTypeRegistryModel } from './models/nodeTypeRegistry'; import { OrgMembershipDefaultModel } from './models/orgMembershipDefault'; import { SqlActionModel } from './models/sqlAction'; import { UserModel } from './models/user'; @@ -243,11 +243,11 @@ export function createClient(config: OrmClientConfig) { migrateFile: new MigrateFileModel(client), appLimitDefault: new AppLimitDefaultModel(client), orgLimitDefault: new OrgLimitDefaultModel(client), - nodeTypeRegistry: new NodeTypeRegistryModel(client), membershipType: new MembershipTypeModel(client), commit: new CommitModel(client), appMembershipDefault: new AppMembershipDefaultModel(client), rlsModule: new RlsModuleModel(client), + nodeTypeRegistry: new NodeTypeRegistryModel(client), orgMembershipDefault: new OrgMembershipDefaultModel(client), sqlAction: new SqlActionModel(client), user: new UserModel(client), diff --git a/sdk/constructive-react/src/public/orm/input-types.ts b/sdk/constructive-react/src/public/orm/input-types.ts index 817a485e5..5d9eed7f1 100644 --- a/sdk/constructive-react/src/public/orm/input-types.ts +++ b/sdk/constructive-react/src/public/orm/input-types.ts @@ -1796,25 +1796,6 @@ export interface OrgLimitDefault { /** Default maximum usage allowed for this limit */ max?: number | null; } -/** Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). */ -export interface NodeTypeRegistry { - /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ - name?: string | null; - /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ - slug?: string | null; - /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ - category?: string | null; - /** Human-readable display name for UI */ - displayName?: string | null; - /** Description of what this node type does */ - description?: string | null; - /** JSON Schema defining valid parameters for this node type */ - parameterSchema?: Record | null; - /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ - tags?: string[] | null; - createdAt?: string | null; - updatedAt?: string | null; -} /** Defines the different scopes of membership (e.g. App Member, Organization Member, Group Member) */ export interface MembershipType { /** Integer identifier for the membership type (1=App, 2=Organization, 3=Group) */ @@ -1870,6 +1851,29 @@ export interface RlsModule { currentRole?: string | null; currentRoleId?: string | null; } +/** Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). */ +export interface NodeTypeRegistry { + /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ + name?: string | null; + /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ + slug?: string | null; + /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ + category?: string | null; + /** Human-readable display name for UI */ + displayName?: string | null; + /** Description of what this node type does */ + description?: string | null; + /** Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. */ + summary?: string | null; + /** JSON Schema defining valid parameters for this node type */ + parameterSchema?: Record | null; + /** Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples */ + guidance?: Record | null; + /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ + tags?: string[] | null; + createdAt?: string | null; + updatedAt?: string | null; +} /** Default membership settings per entity, controlling initial approval and verification state for new members */ export interface OrgMembershipDefault { id: string; @@ -2514,7 +2518,6 @@ export interface RoleTypeRelations {} export interface MigrateFileRelations {} export interface AppLimitDefaultRelations {} export interface OrgLimitDefaultRelations {} -export interface NodeTypeRegistryRelations {} export interface MembershipTypeRelations {} export interface CommitRelations {} export interface AppMembershipDefaultRelations {} @@ -2526,6 +2529,7 @@ export interface RlsModuleRelations { sessionsTable?: Table | null; usersTable?: Table | null; } +export interface NodeTypeRegistryRelations {} export interface OrgMembershipDefaultRelations { entity?: User | null; } @@ -2707,12 +2711,12 @@ export type RoleTypeWithRelations = RoleType & RoleTypeRelations; export type MigrateFileWithRelations = MigrateFile & MigrateFileRelations; export type AppLimitDefaultWithRelations = AppLimitDefault & AppLimitDefaultRelations; export type OrgLimitDefaultWithRelations = OrgLimitDefault & OrgLimitDefaultRelations; -export type NodeTypeRegistryWithRelations = NodeTypeRegistry & NodeTypeRegistryRelations; export type MembershipTypeWithRelations = MembershipType & MembershipTypeRelations; export type CommitWithRelations = Commit & CommitRelations; export type AppMembershipDefaultWithRelations = AppMembershipDefault & AppMembershipDefaultRelations; export type RlsModuleWithRelations = RlsModule & RlsModuleRelations; +export type NodeTypeRegistryWithRelations = NodeTypeRegistry & NodeTypeRegistryRelations; export type OrgMembershipDefaultWithRelations = OrgMembershipDefault & OrgMembershipDefaultRelations; export type SqlActionWithRelations = SqlAction & SqlActionRelations; @@ -5146,17 +5150,6 @@ export type OrgLimitDefaultSelect = { name?: boolean; max?: boolean; }; -export type NodeTypeRegistrySelect = { - name?: boolean; - slug?: boolean; - category?: boolean; - displayName?: boolean; - description?: boolean; - parameterSchema?: boolean; - tags?: boolean; - createdAt?: boolean; - updatedAt?: boolean; -}; export type MembershipTypeSelect = { id?: boolean; name?: boolean; @@ -5214,6 +5207,19 @@ export type RlsModuleSelect = { select: TableSelect; }; }; +export type NodeTypeRegistrySelect = { + name?: boolean; + slug?: boolean; + category?: boolean; + displayName?: boolean; + description?: boolean; + summary?: boolean; + parameterSchema?: boolean; + guidance?: boolean; + tags?: boolean; + createdAt?: boolean; + updatedAt?: boolean; +}; export type OrgMembershipDefaultSelect = { id?: boolean; createdAt?: boolean; @@ -9183,32 +9189,6 @@ export interface OrgLimitDefaultFilter { /** Negates the expression. */ not?: OrgLimitDefaultFilter; } -export interface NodeTypeRegistryFilter { - /** Filter by the object’s `name` field. */ - name?: StringFilter; - /** Filter by the object’s `slug` field. */ - slug?: StringFilter; - /** Filter by the object’s `category` field. */ - category?: StringFilter; - /** Filter by the object’s `displayName` field. */ - displayName?: StringFilter; - /** Filter by the object’s `description` field. */ - description?: StringFilter; - /** Filter by the object’s `parameterSchema` field. */ - parameterSchema?: JSONFilter; - /** Filter by the object’s `tags` field. */ - tags?: StringListFilter; - /** Filter by the object’s `createdAt` field. */ - createdAt?: DatetimeFilter; - /** Filter by the object’s `updatedAt` field. */ - updatedAt?: DatetimeFilter; - /** Checks for all expressions in this list. */ - and?: NodeTypeRegistryFilter[]; - /** Checks for any expressions in this list. */ - or?: NodeTypeRegistryFilter[]; - /** Negates the expression. */ - not?: NodeTypeRegistryFilter; -} export interface MembershipTypeFilter { /** Filter by the object’s `id` field. */ id?: IntFilter; @@ -9315,6 +9295,36 @@ export interface RlsModuleFilter { /** Filter by the object’s `usersTable` relation. */ usersTable?: TableFilter; } +export interface NodeTypeRegistryFilter { + /** Filter by the object’s `name` field. */ + name?: StringFilter; + /** Filter by the object’s `slug` field. */ + slug?: StringFilter; + /** Filter by the object’s `category` field. */ + category?: StringFilter; + /** Filter by the object’s `displayName` field. */ + displayName?: StringFilter; + /** Filter by the object’s `description` field. */ + description?: StringFilter; + /** Filter by the object’s `summary` field. */ + summary?: StringFilter; + /** Filter by the object’s `parameterSchema` field. */ + parameterSchema?: JSONFilter; + /** Filter by the object’s `guidance` field. */ + guidance?: JSONFilter; + /** Filter by the object’s `tags` field. */ + tags?: StringListFilter; + /** Filter by the object’s `createdAt` field. */ + createdAt?: DatetimeFilter; + /** Filter by the object’s `updatedAt` field. */ + updatedAt?: DatetimeFilter; + /** Checks for all expressions in this list. */ + and?: NodeTypeRegistryFilter[]; + /** Checks for any expressions in this list. */ + or?: NodeTypeRegistryFilter[]; + /** Negates the expression. */ + not?: NodeTypeRegistryFilter; +} export interface OrgMembershipDefaultFilter { /** Filter by the object’s `id` field. */ id?: UUIDFilter; @@ -10931,16 +10941,6 @@ export type OrgLimitDefaultOrderBy = | 'ID_DESC' | 'NAME_ASC' | 'NAME_DESC'; -export type NodeTypeRegistryOrderBy = - | 'NATURAL' - | 'PRIMARY_KEY_ASC' - | 'PRIMARY_KEY_DESC' - | 'NAME_ASC' - | 'NAME_DESC' - | 'SLUG_ASC' - | 'SLUG_DESC' - | 'CATEGORY_ASC' - | 'CATEGORY_DESC'; export type MembershipTypeOrderBy = | 'NATURAL' | 'PRIMARY_KEY_ASC' @@ -10979,6 +10979,16 @@ export type RlsModuleOrderBy = | 'ID_DESC' | 'DATABASE_ID_ASC' | 'DATABASE_ID_DESC'; +export type NodeTypeRegistryOrderBy = + | 'NATURAL' + | 'PRIMARY_KEY_ASC' + | 'PRIMARY_KEY_DESC' + | 'NAME_ASC' + | 'NAME_DESC' + | 'SLUG_ASC' + | 'SLUG_DESC' + | 'CATEGORY_ASC' + | 'CATEGORY_DESC'; export type OrgMembershipDefaultOrderBy = | 'NATURAL' | 'PRIMARY_KEY_ASC' @@ -14141,36 +14151,6 @@ export interface DeleteOrgLimitDefaultInput { clientMutationId?: string; id: string; } -export interface CreateNodeTypeRegistryInput { - clientMutationId?: string; - nodeTypeRegistry: { - name: string; - slug: string; - category: string; - displayName?: string; - description?: string; - parameterSchema?: Record; - tags?: string[]; - }; -} -export interface NodeTypeRegistryPatch { - name?: string | null; - slug?: string | null; - category?: string | null; - displayName?: string | null; - description?: string | null; - parameterSchema?: Record | null; - tags?: string[] | null; -} -export interface UpdateNodeTypeRegistryInput { - clientMutationId?: string; - name: string; - nodeTypeRegistryPatch: NodeTypeRegistryPatch; -} -export interface DeleteNodeTypeRegistryInput { - clientMutationId?: string; - name: string; -} export interface CreateMembershipTypeInput { clientMutationId?: string; membershipType: { @@ -14285,6 +14265,40 @@ export interface DeleteRlsModuleInput { clientMutationId?: string; id: string; } +export interface CreateNodeTypeRegistryInput { + clientMutationId?: string; + nodeTypeRegistry: { + name: string; + slug: string; + category: string; + displayName?: string; + description?: string; + summary?: string; + parameterSchema?: Record; + guidance?: Record; + tags?: string[]; + }; +} +export interface NodeTypeRegistryPatch { + name?: string | null; + slug?: string | null; + category?: string | null; + displayName?: string | null; + description?: string | null; + summary?: string | null; + parameterSchema?: Record | null; + guidance?: Record | null; + tags?: string[] | null; +} +export interface UpdateNodeTypeRegistryInput { + clientMutationId?: string; + name: string; + nodeTypeRegistryPatch: NodeTypeRegistryPatch; +} +export interface DeleteNodeTypeRegistryInput { + clientMutationId?: string; + name: string; +} export interface CreateOrgMembershipDefaultInput { clientMutationId?: string; orgMembershipDefault: { @@ -25335,51 +25349,6 @@ export type DeleteOrgLimitDefaultPayloadSelect = { select: OrgLimitDefaultEdgeSelect; }; }; -export interface CreateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was created by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type CreateNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; -export interface UpdateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was updated by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type UpdateNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; -export interface DeleteNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was deleted by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type DeleteNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; export interface CreateMembershipTypePayload { clientMutationId?: string | null; /** The `MembershipType` that was created by this mutation. */ @@ -25560,6 +25529,51 @@ export type DeleteRlsModulePayloadSelect = { select: RlsModuleEdgeSelect; }; }; +export interface CreateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was created by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type CreateNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; +export interface UpdateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was updated by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type UpdateNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; +export interface DeleteNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was deleted by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type DeleteNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; export interface CreateOrgMembershipDefaultPayload { clientMutationId?: string | null; /** The `OrgMembershipDefault` that was created by this mutation. */ @@ -27013,18 +27027,6 @@ export type OrgLimitDefaultEdgeSelect = { select: OrgLimitDefaultSelect; }; }; -/** A `NodeTypeRegistry` edge in the connection. */ -export interface NodeTypeRegistryEdge { - cursor?: string | null; - /** The `NodeTypeRegistry` at the end of the edge. */ - node?: NodeTypeRegistry | null; -} -export type NodeTypeRegistryEdgeSelect = { - cursor?: boolean; - node?: { - select: NodeTypeRegistrySelect; - }; -}; /** A `MembershipType` edge in the connection. */ export interface MembershipTypeEdge { cursor?: string | null; @@ -27073,6 +27075,18 @@ export type RlsModuleEdgeSelect = { select: RlsModuleSelect; }; }; +/** A `NodeTypeRegistry` edge in the connection. */ +export interface NodeTypeRegistryEdge { + cursor?: string | null; + /** The `NodeTypeRegistry` at the end of the edge. */ + node?: NodeTypeRegistry | null; +} +export type NodeTypeRegistryEdgeSelect = { + cursor?: boolean; + node?: { + select: NodeTypeRegistrySelect; + }; +}; /** A `OrgMembershipDefault` edge in the connection. */ export interface OrgMembershipDefaultEdge { cursor?: string | null; diff --git a/sdk/constructive-react/src/public/orm/models/index.ts b/sdk/constructive-react/src/public/orm/models/index.ts index c0d113bd7..68efecd05 100644 --- a/sdk/constructive-react/src/public/orm/models/index.ts +++ b/sdk/constructive-react/src/public/orm/models/index.ts @@ -99,11 +99,11 @@ export { RoleTypeModel } from './roleType'; export { MigrateFileModel } from './migrateFile'; export { AppLimitDefaultModel } from './appLimitDefault'; export { OrgLimitDefaultModel } from './orgLimitDefault'; -export { NodeTypeRegistryModel } from './nodeTypeRegistry'; export { MembershipTypeModel } from './membershipType'; export { CommitModel } from './commit'; export { AppMembershipDefaultModel } from './appMembershipDefault'; export { RlsModuleModel } from './rlsModule'; +export { NodeTypeRegistryModel } from './nodeTypeRegistry'; export { OrgMembershipDefaultModel } from './orgMembershipDefault'; export { SqlActionModel } from './sqlAction'; export { UserModel } from './user'; diff --git a/sdk/constructive-react/src/public/schema-types.ts b/sdk/constructive-react/src/public/schema-types.ts index f33ed3ba3..833b1afb1 100644 --- a/sdk/constructive-react/src/public/schema-types.ts +++ b/sdk/constructive-react/src/public/schema-types.ts @@ -1335,17 +1335,6 @@ export type OrgLimitDefaultOrderBy = | 'ID_DESC' | 'NAME_ASC' | 'NAME_DESC'; -/** Methods to use when ordering `NodeTypeRegistry`. */ -export type NodeTypeRegistryOrderBy = - | 'NATURAL' - | 'PRIMARY_KEY_ASC' - | 'PRIMARY_KEY_DESC' - | 'NAME_ASC' - | 'NAME_DESC' - | 'SLUG_ASC' - | 'SLUG_DESC' - | 'CATEGORY_ASC' - | 'CATEGORY_DESC'; /** Methods to use when ordering `MembershipType`. */ export type MembershipTypeOrderBy = | 'NATURAL' @@ -1421,6 +1410,17 @@ export type RlsModuleOrderBy = | 'ID_DESC' | 'DATABASE_ID_ASC' | 'DATABASE_ID_DESC'; +/** Methods to use when ordering `NodeTypeRegistry`. */ +export type NodeTypeRegistryOrderBy = + | 'NATURAL' + | 'PRIMARY_KEY_ASC' + | 'PRIMARY_KEY_DESC' + | 'NAME_ASC' + | 'NAME_DESC' + | 'SLUG_ASC' + | 'SLUG_DESC' + | 'CATEGORY_ASC' + | 'CATEGORY_DESC'; /** Methods to use when ordering `OrgMembershipDefault`. */ export type OrgMembershipDefaultOrderBy = | 'NATURAL' @@ -7187,33 +7187,6 @@ export interface OrgLimitDefaultFilter { /** Negates the expression. */ not?: OrgLimitDefaultFilter; } -/** A filter to be used against `NodeTypeRegistry` object types. All fields are combined with a logical ‘and.’ */ -export interface NodeTypeRegistryFilter { - /** Filter by the object’s `name` field. */ - name?: StringFilter; - /** Filter by the object’s `slug` field. */ - slug?: StringFilter; - /** Filter by the object’s `category` field. */ - category?: StringFilter; - /** Filter by the object’s `displayName` field. */ - displayName?: StringFilter; - /** Filter by the object’s `description` field. */ - description?: StringFilter; - /** Filter by the object’s `parameterSchema` field. */ - parameterSchema?: JSONFilter; - /** Filter by the object’s `tags` field. */ - tags?: StringListFilter; - /** Filter by the object’s `createdAt` field. */ - createdAt?: DatetimeFilter; - /** Filter by the object’s `updatedAt` field. */ - updatedAt?: DatetimeFilter; - /** Checks for all expressions in this list. */ - and?: NodeTypeRegistryFilter[]; - /** Checks for any expressions in this list. */ - or?: NodeTypeRegistryFilter[]; - /** Negates the expression. */ - not?: NodeTypeRegistryFilter; -} /** A filter to be used against `MembershipType` object types. All fields are combined with a logical ‘and.’ */ export interface MembershipTypeFilter { /** Filter by the object’s `id` field. */ @@ -7342,6 +7315,37 @@ export interface AppMembershipDefaultFilter { /** Negates the expression. */ not?: AppMembershipDefaultFilter; } +/** A filter to be used against `NodeTypeRegistry` object types. All fields are combined with a logical ‘and.’ */ +export interface NodeTypeRegistryFilter { + /** Filter by the object’s `name` field. */ + name?: StringFilter; + /** Filter by the object’s `slug` field. */ + slug?: StringFilter; + /** Filter by the object’s `category` field. */ + category?: StringFilter; + /** Filter by the object’s `displayName` field. */ + displayName?: StringFilter; + /** Filter by the object’s `description` field. */ + description?: StringFilter; + /** Filter by the object’s `summary` field. */ + summary?: StringFilter; + /** Filter by the object’s `parameterSchema` field. */ + parameterSchema?: JSONFilter; + /** Filter by the object’s `guidance` field. */ + guidance?: JSONFilter; + /** Filter by the object’s `tags` field. */ + tags?: StringListFilter; + /** Filter by the object’s `createdAt` field. */ + createdAt?: DatetimeFilter; + /** Filter by the object’s `updatedAt` field. */ + updatedAt?: DatetimeFilter; + /** Checks for all expressions in this list. */ + and?: NodeTypeRegistryFilter[]; + /** Checks for any expressions in this list. */ + or?: NodeTypeRegistryFilter[]; + /** Negates the expression. */ + not?: NodeTypeRegistryFilter; +} /** A filter to be used against `AppLevelRequirement` object types. All fields are combined with a logical ‘and.’ */ export interface AppLevelRequirementFilter { /** Filter by the object’s `id` field. */ @@ -8268,30 +8272,6 @@ export interface OrgChartEdgeGrantInput { /** Timestamp when this grant or revocation was recorded */ createdAt?: string; } -export interface CreateNodeTypeRegistryInput { - clientMutationId?: string; - /** The `NodeTypeRegistry` to be created by this mutation. */ - nodeTypeRegistry: NodeTypeRegistryInput; -} -/** An input for mutations affecting `NodeTypeRegistry` */ -export interface NodeTypeRegistryInput { - /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ - name: string; - /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ - slug: string; - /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ - category: string; - /** Human-readable display name for UI */ - displayName?: string; - /** Description of what this node type does */ - description?: string; - /** JSON Schema defining valid parameters for this node type */ - parameterSchema?: unknown; - /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ - tags?: string[]; - createdAt?: string; - updatedAt?: string; -} export interface CreateMembershipTypeInput { clientMutationId?: string; /** The `MembershipType` to be created by this mutation. */ @@ -8539,6 +8519,34 @@ export interface SessionsModuleInput { sessionCredentialsTable?: string; authSettingsTable?: string; } +export interface CreateNodeTypeRegistryInput { + clientMutationId?: string; + /** The `NodeTypeRegistry` to be created by this mutation. */ + nodeTypeRegistry: NodeTypeRegistryInput; +} +/** An input for mutations affecting `NodeTypeRegistry` */ +export interface NodeTypeRegistryInput { + /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ + name: string; + /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ + slug: string; + /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ + category: string; + /** Human-readable display name for UI */ + displayName?: string; + /** Description of what this node type does */ + description?: string; + /** Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. */ + summary?: string; + /** JSON Schema defining valid parameters for this node type */ + parameterSchema?: unknown; + /** Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples */ + guidance?: unknown; + /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ + tags?: string[]; + createdAt?: string; + updatedAt?: string; +} export interface CreateOrgLimitInput { clientMutationId?: string; /** The `OrgLimit` to be created by this mutation. */ @@ -10586,32 +10594,6 @@ export interface OrgChartEdgeGrantPatch { /** Timestamp when this grant or revocation was recorded */ createdAt?: string; } -export interface UpdateNodeTypeRegistryInput { - clientMutationId?: string; - /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ - name: string; - /** An object where the defined keys will be set on the `NodeTypeRegistry` being updated. */ - nodeTypeRegistryPatch: NodeTypeRegistryPatch; -} -/** Represents an update to a `NodeTypeRegistry`. Fields that are set will be updated. */ -export interface NodeTypeRegistryPatch { - /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ - name?: string; - /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ - slug?: string; - /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ - category?: string; - /** Human-readable display name for UI */ - displayName?: string; - /** Description of what this node type does */ - description?: string; - /** JSON Schema defining valid parameters for this node type */ - parameterSchema?: unknown; - /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ - tags?: string[]; - createdAt?: string; - updatedAt?: string; -} export interface UpdateMembershipTypeInput { clientMutationId?: string; /** Integer identifier for the membership type (1=App, 2=Organization, 3=Group) */ @@ -10881,6 +10863,36 @@ export interface SessionsModulePatch { sessionCredentialsTable?: string; authSettingsTable?: string; } +export interface UpdateNodeTypeRegistryInput { + clientMutationId?: string; + /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ + name: string; + /** An object where the defined keys will be set on the `NodeTypeRegistry` being updated. */ + nodeTypeRegistryPatch: NodeTypeRegistryPatch; +} +/** Represents an update to a `NodeTypeRegistry`. Fields that are set will be updated. */ +export interface NodeTypeRegistryPatch { + /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ + name?: string; + /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ + slug?: string; + /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ + category?: string; + /** Human-readable display name for UI */ + displayName?: string; + /** Description of what this node type does */ + description?: string; + /** Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. */ + summary?: string; + /** JSON Schema defining valid parameters for this node type */ + parameterSchema?: unknown; + /** Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples */ + guidance?: unknown; + /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ + tags?: string[]; + createdAt?: string; + updatedAt?: string; +} export interface UpdateOrgLimitInput { clientMutationId?: string; id: string; @@ -12462,11 +12474,6 @@ export interface DeleteOrgChartEdgeGrantInput { clientMutationId?: string; id: string; } -export interface DeleteNodeTypeRegistryInput { - clientMutationId?: string; - /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ - name: string; -} export interface DeleteMembershipTypeInput { clientMutationId?: string; /** Integer identifier for the membership type (1=App, 2=Organization, 3=Group) */ @@ -12529,6 +12536,11 @@ export interface DeleteSessionsModuleInput { clientMutationId?: string; id: string; } +export interface DeleteNodeTypeRegistryInput { + clientMutationId?: string; + /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ + name: string; +} export interface DeleteOrgLimitInput { clientMutationId?: string; id: string; @@ -13053,13 +13065,6 @@ export interface OrgChartEdgeGrantConnection { pageInfo: PageInfo; totalCount: number; } -/** A connection to a list of `NodeTypeRegistry` values. */ -export interface NodeTypeRegistryConnection { - nodes: NodeTypeRegistry[]; - edges: NodeTypeRegistryEdge[]; - pageInfo: PageInfo; - totalCount: number; -} /** A connection to a list of `MembershipType` values. */ export interface MembershipTypeConnection { nodes: MembershipType[]; @@ -13137,6 +13142,13 @@ export interface SessionsModuleConnection { pageInfo: PageInfo; totalCount: number; } +/** A connection to a list of `NodeTypeRegistry` values. */ +export interface NodeTypeRegistryConnection { + nodes: NodeTypeRegistry[]; + edges: NodeTypeRegistryEdge[]; + pageInfo: PageInfo; + totalCount: number; +} /** A connection to a list of `OrgLimit` values. */ export interface OrgLimitConnection { nodes: OrgLimit[]; @@ -13853,12 +13865,6 @@ export interface CreateOrgChartEdgeGrantPayload { orgChartEdgeGrant?: OrgChartEdgeGrant | null; orgChartEdgeGrantEdge?: OrgChartEdgeGrantEdge | null; } -export interface CreateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was created by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} export interface CreateMembershipTypePayload { clientMutationId?: string | null; /** The `MembershipType` that was created by this mutation. */ @@ -13943,6 +13949,12 @@ export interface CreateSessionsModulePayload { sessionsModule?: SessionsModule | null; sessionsModuleEdge?: SessionsModuleEdge | null; } +export interface CreateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was created by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} export interface CreateOrgLimitPayload { clientMutationId?: string | null; /** The `OrgLimit` that was created by this mutation. */ @@ -14469,12 +14481,6 @@ export interface UpdateOrgChartEdgeGrantPayload { orgChartEdgeGrant?: OrgChartEdgeGrant | null; orgChartEdgeGrantEdge?: OrgChartEdgeGrantEdge | null; } -export interface UpdateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was updated by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} export interface UpdateMembershipTypePayload { clientMutationId?: string | null; /** The `MembershipType` that was updated by this mutation. */ @@ -14559,6 +14565,12 @@ export interface UpdateSessionsModulePayload { sessionsModule?: SessionsModule | null; sessionsModuleEdge?: SessionsModuleEdge | null; } +export interface UpdateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was updated by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} export interface UpdateOrgLimitPayload { clientMutationId?: string | null; /** The `OrgLimit` that was updated by this mutation. */ @@ -15075,12 +15087,6 @@ export interface DeleteOrgChartEdgeGrantPayload { orgChartEdgeGrant?: OrgChartEdgeGrant | null; orgChartEdgeGrantEdge?: OrgChartEdgeGrantEdge | null; } -export interface DeleteNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was deleted by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} export interface DeleteMembershipTypePayload { clientMutationId?: string | null; /** The `MembershipType` that was deleted by this mutation. */ @@ -15165,6 +15171,12 @@ export interface DeleteSessionsModulePayload { sessionsModule?: SessionsModule | null; sessionsModuleEdge?: SessionsModuleEdge | null; } +export interface DeleteNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was deleted by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} export interface DeleteOrgLimitPayload { clientMutationId?: string | null; /** The `OrgLimit` that was deleted by this mutation. */ @@ -15740,12 +15752,6 @@ export interface OrgChartEdgeGrantEdge { /** The `OrgChartEdgeGrant` at the end of the edge. */ node?: OrgChartEdgeGrant | null; } -/** A `NodeTypeRegistry` edge in the connection. */ -export interface NodeTypeRegistryEdge { - cursor?: string | null; - /** The `NodeTypeRegistry` at the end of the edge. */ - node?: NodeTypeRegistry | null; -} /** A `MembershipType` edge in the connection. */ export interface MembershipTypeEdge { cursor?: string | null; @@ -15812,6 +15818,12 @@ export interface SessionsModuleEdge { /** The `SessionsModule` at the end of the edge. */ node?: SessionsModule | null; } +/** A `NodeTypeRegistry` edge in the connection. */ +export interface NodeTypeRegistryEdge { + cursor?: string | null; + /** The `NodeTypeRegistry` at the end of the edge. */ + node?: NodeTypeRegistry | null; +} /** A `OrgLimit` edge in the connection. */ export interface OrgLimitEdge { cursor?: string | null; @@ -16191,6 +16203,9 @@ export interface MetaField { type: MetaType; isNotNull: boolean; hasDefault: boolean; + isPrimaryKey: boolean; + isForeignKey: boolean; + description?: string | null; } /** Information about a database index */ export interface MetaIndex { diff --git a/sdk/constructive-react/src/public/types.ts b/sdk/constructive-react/src/public/types.ts index efb806d0e..96f4d7707 100644 --- a/sdk/constructive-react/src/public/types.ts +++ b/sdk/constructive-react/src/public/types.ts @@ -1137,17 +1137,6 @@ export interface OrgLimitDefault { name: string | null; max: number | null; } -export interface NodeTypeRegistry { - name: string | null; - slug: string | null; - category: string | null; - displayName: string | null; - description: string | null; - parameterSchema: unknown | null; - tags: string[] | null; - createdAt: string | null; - updatedAt: string | null; -} export interface MembershipType { id: number | null; name: string | null; @@ -1187,6 +1176,19 @@ export interface RlsModule { currentRole: string | null; currentRoleId: string | null; } +export interface NodeTypeRegistry { + name: string | null; + slug: string | null; + category: string | null; + displayName: string | null; + description: string | null; + summary: string | null; + parameterSchema: unknown | null; + guidance: unknown | null; + tags: string[] | null; + createdAt: string | null; + updatedAt: string | null; +} export interface OrgMembershipDefault { id: string | null; createdAt: string | null; diff --git a/sdk/constructive-sdk/schemas/admin.graphql b/sdk/constructive-sdk/schemas/admin.graphql index bd26022e5..055f4eee4 100644 --- a/sdk/constructive-sdk/schemas/admin.graphql +++ b/sdk/constructive-sdk/schemas/admin.graphql @@ -4653,6 +4653,9 @@ type MetaField { type: MetaType! isNotNull: Boolean! hasDefault: Boolean! + isPrimaryKey: Boolean! + isForeignKey: Boolean! + description: String } """Information about a PostgreSQL type""" diff --git a/sdk/constructive-sdk/schemas/app.graphql b/sdk/constructive-sdk/schemas/app.graphql index f29764a68..a82cd6509 100644 --- a/sdk/constructive-sdk/schemas/app.graphql +++ b/sdk/constructive-sdk/schemas/app.graphql @@ -32,6 +32,9 @@ type MetaField { type: MetaType! isNotNull: Boolean! hasDefault: Boolean! + isPrimaryKey: Boolean! + isForeignKey: Boolean! + description: String } """Information about a PostgreSQL type""" diff --git a/sdk/constructive-sdk/schemas/auth.graphql b/sdk/constructive-sdk/schemas/auth.graphql index 96741450b..6b2eee63b 100644 --- a/sdk/constructive-sdk/schemas/auth.graphql +++ b/sdk/constructive-sdk/schemas/auth.graphql @@ -2194,6 +2194,9 @@ type MetaField { type: MetaType! isNotNull: Boolean! hasDefault: Boolean! + isPrimaryKey: Boolean! + isForeignKey: Boolean! + description: String } """Information about a PostgreSQL type""" diff --git a/sdk/constructive-sdk/schemas/objects.graphql b/sdk/constructive-sdk/schemas/objects.graphql index 1874f9c38..8f107728f 100644 --- a/sdk/constructive-sdk/schemas/objects.graphql +++ b/sdk/constructive-sdk/schemas/objects.graphql @@ -1067,6 +1067,9 @@ type MetaField { type: MetaType! isNotNull: Boolean! hasDefault: Boolean! + isPrimaryKey: Boolean! + isForeignKey: Boolean! + description: String } """Information about a PostgreSQL type""" diff --git a/sdk/constructive-sdk/schemas/public.graphql b/sdk/constructive-sdk/schemas/public.graphql index c54b394b1..1b6f329e8 100644 --- a/sdk/constructive-sdk/schemas/public.graphql +++ b/sdk/constructive-sdk/schemas/public.graphql @@ -1327,35 +1327,6 @@ type Query { orderBy: [OrgChartEdgeGrantOrderBy!] = [PRIMARY_KEY_ASC] ): OrgChartEdgeGrantConnection - """Reads and enables pagination through a set of `NodeTypeRegistry`.""" - nodeTypeRegistries( - """Only read the first `n` values of the set.""" - first: Int - - """Only read the last `n` values of the set.""" - last: Int - - """ - Skip the first `n` values from our `after` cursor, an alternative to cursor - based pagination. May not be used with `last`. - """ - offset: Int - - """Read all values in the set before (above) this cursor.""" - before: Cursor - - """Read all values in the set after (below) this cursor.""" - after: Cursor - - """ - A filter to be used in determining which values should be returned by the collection. - """ - where: NodeTypeRegistryFilter - - """The method to use when ordering `NodeTypeRegistry`.""" - orderBy: [NodeTypeRegistryOrderBy!] = [PRIMARY_KEY_ASC] - ): NodeTypeRegistryConnection - """Reads and enables pagination through a set of `MembershipType`.""" membershipTypes( """Only read the first `n` values of the set.""" @@ -1762,6 +1733,35 @@ type Query { orderBy: [SessionsModuleOrderBy!] = [PRIMARY_KEY_ASC] ): SessionsModuleConnection + """Reads and enables pagination through a set of `NodeTypeRegistry`.""" + nodeTypeRegistries( + """Only read the first `n` values of the set.""" + first: Int + + """Only read the last `n` values of the set.""" + last: Int + + """ + Skip the first `n` values from our `after` cursor, an alternative to cursor + based pagination. May not be used with `last`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """ + A filter to be used in determining which values should be returned by the collection. + """ + where: NodeTypeRegistryFilter + + """The method to use when ordering `NodeTypeRegistry`.""" + orderBy: [NodeTypeRegistryOrderBy!] = [PRIMARY_KEY_ASC] + ): NodeTypeRegistryConnection + """Reads and enables pagination through a set of `OrgLimit`.""" orgLimits( """Only read the first `n` values of the set.""" @@ -23794,124 +23794,6 @@ enum OrgLimitDefaultOrderBy { NAME_DESC } -"""A connection to a list of `NodeTypeRegistry` values.""" -type NodeTypeRegistryConnection { - """A list of `NodeTypeRegistry` objects.""" - nodes: [NodeTypeRegistry]! - - """ - A list of edges which contains the `NodeTypeRegistry` and cursor to aid in pagination. - """ - edges: [NodeTypeRegistryEdge]! - - """Information to aid in pagination.""" - pageInfo: PageInfo! - - """ - The count of *all* `NodeTypeRegistry` you could get from the connection. - """ - totalCount: Int! -} - -""" -Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). -""" -type NodeTypeRegistry { - """ - PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) - """ - name: String! - - """ - snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) - """ - slug: String! - - """ - Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) - """ - category: String! - - """Human-readable display name for UI""" - displayName: String - - """Description of what this node type does""" - description: String - - """JSON Schema defining valid parameters for this node type""" - parameterSchema: JSON - - """ - Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) - """ - tags: [String]! - createdAt: Datetime! - updatedAt: Datetime! -} - -"""A `NodeTypeRegistry` edge in the connection.""" -type NodeTypeRegistryEdge { - """A cursor for use in pagination.""" - cursor: Cursor - - """The `NodeTypeRegistry` at the end of the edge.""" - node: NodeTypeRegistry -} - -""" -A filter to be used against `NodeTypeRegistry` object types. All fields are combined with a logical ‘and.’ -""" -input NodeTypeRegistryFilter { - """Filter by the object’s `name` field.""" - name: StringFilter - - """Filter by the object’s `slug` field.""" - slug: StringFilter - - """Filter by the object’s `category` field.""" - category: StringFilter - - """Filter by the object’s `displayName` field.""" - displayName: StringFilter - - """Filter by the object’s `description` field.""" - description: StringFilter - - """Filter by the object’s `parameterSchema` field.""" - parameterSchema: JSONFilter - - """Filter by the object’s `tags` field.""" - tags: StringListFilter - - """Filter by the object’s `createdAt` field.""" - createdAt: DatetimeFilter - - """Filter by the object’s `updatedAt` field.""" - updatedAt: DatetimeFilter - - """Checks for all expressions in this list.""" - and: [NodeTypeRegistryFilter!] - - """Checks for any expressions in this list.""" - or: [NodeTypeRegistryFilter!] - - """Negates the expression.""" - not: NodeTypeRegistryFilter -} - -"""Methods to use when ordering `NodeTypeRegistry`.""" -enum NodeTypeRegistryOrderBy { - NATURAL - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC - NAME_ASC - NAME_DESC - SLUG_ASC - SLUG_DESC - CATEGORY_ASC - CATEGORY_DESC -} - """A connection to a list of `MembershipType` values.""" type MembershipTypeConnection { """A list of `MembershipType` objects.""" @@ -24366,6 +24248,140 @@ enum RlsModuleOrderBy { DATABASE_ID_DESC } +"""A connection to a list of `NodeTypeRegistry` values.""" +type NodeTypeRegistryConnection { + """A list of `NodeTypeRegistry` objects.""" + nodes: [NodeTypeRegistry]! + + """ + A list of edges which contains the `NodeTypeRegistry` and cursor to aid in pagination. + """ + edges: [NodeTypeRegistryEdge]! + + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """ + The count of *all* `NodeTypeRegistry` you could get from the connection. + """ + totalCount: Int! +} + +""" +Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). +""" +type NodeTypeRegistry { + """ + PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) + """ + name: String! + + """ + snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) + """ + slug: String! + + """ + Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) + """ + category: String! + + """Human-readable display name for UI""" + displayName: String + + """Description of what this node type does""" + description: String + + """ + Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. + """ + summary: String + + """JSON Schema defining valid parameters for this node type""" + parameterSchema: JSON + + """ + Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples + """ + guidance: JSON! + + """ + Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) + """ + tags: [String]! + createdAt: Datetime! + updatedAt: Datetime! +} + +"""A `NodeTypeRegistry` edge in the connection.""" +type NodeTypeRegistryEdge { + """A cursor for use in pagination.""" + cursor: Cursor + + """The `NodeTypeRegistry` at the end of the edge.""" + node: NodeTypeRegistry +} + +""" +A filter to be used against `NodeTypeRegistry` object types. All fields are combined with a logical ‘and.’ +""" +input NodeTypeRegistryFilter { + """Filter by the object’s `name` field.""" + name: StringFilter + + """Filter by the object’s `slug` field.""" + slug: StringFilter + + """Filter by the object’s `category` field.""" + category: StringFilter + + """Filter by the object’s `displayName` field.""" + displayName: StringFilter + + """Filter by the object’s `description` field.""" + description: StringFilter + + """Filter by the object’s `summary` field.""" + summary: StringFilter + + """Filter by the object’s `parameterSchema` field.""" + parameterSchema: JSONFilter + + """Filter by the object’s `guidance` field.""" + guidance: JSONFilter + + """Filter by the object’s `tags` field.""" + tags: StringListFilter + + """Filter by the object’s `createdAt` field.""" + createdAt: DatetimeFilter + + """Filter by the object’s `updatedAt` field.""" + updatedAt: DatetimeFilter + + """Checks for all expressions in this list.""" + and: [NodeTypeRegistryFilter!] + + """Checks for any expressions in this list.""" + or: [NodeTypeRegistryFilter!] + + """Negates the expression.""" + not: NodeTypeRegistryFilter +} + +"""Methods to use when ordering `NodeTypeRegistry`.""" +enum NodeTypeRegistryOrderBy { + NATURAL + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC + NAME_ASC + NAME_DESC + SLUG_ASC + SLUG_DESC + CATEGORY_ASC + CATEGORY_DESC +} + """A connection to a list of `OrgMembershipDefault` values.""" type OrgMembershipDefaultConnection { """A list of `OrgMembershipDefault` objects.""" @@ -24868,6 +24884,9 @@ type MetaField { type: MetaType! isNotNull: Boolean! hasDefault: Boolean! + isPrimaryKey: Boolean! + isForeignKey: Boolean! + description: String } """Information about a PostgreSQL type""" @@ -25539,14 +25558,6 @@ type Mutation { input: CreateOrgChartEdgeGrantInput! ): CreateOrgChartEdgeGrantPayload - """Creates a single `NodeTypeRegistry`.""" - createNodeTypeRegistry( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreateNodeTypeRegistryInput! - ): CreateNodeTypeRegistryPayload - """Creates a single `MembershipType`.""" createMembershipType( """ @@ -25659,6 +25670,14 @@ type Mutation { input: CreateSessionsModuleInput! ): CreateSessionsModulePayload + """Creates a single `NodeTypeRegistry`.""" + createNodeTypeRegistry( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateNodeTypeRegistryInput! + ): CreateNodeTypeRegistryPayload + """Creates a single `OrgLimit`.""" createOrgLimit( """ @@ -26375,14 +26394,6 @@ type Mutation { input: UpdateOrgChartEdgeGrantInput! ): UpdateOrgChartEdgeGrantPayload - """Updates a single `NodeTypeRegistry` using a unique key and a patch.""" - updateNodeTypeRegistry( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateNodeTypeRegistryInput! - ): UpdateNodeTypeRegistryPayload - """Updates a single `MembershipType` using a unique key and a patch.""" updateMembershipType( """ @@ -26497,6 +26508,14 @@ type Mutation { input: UpdateSessionsModuleInput! ): UpdateSessionsModulePayload + """Updates a single `NodeTypeRegistry` using a unique key and a patch.""" + updateNodeTypeRegistry( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateNodeTypeRegistryInput! + ): UpdateNodeTypeRegistryPayload + """Updates a single `OrgLimit` using a unique key and a patch.""" updateOrgLimit( """ @@ -27197,14 +27216,6 @@ type Mutation { input: DeleteOrgChartEdgeGrantInput! ): DeleteOrgChartEdgeGrantPayload - """Deletes a single `NodeTypeRegistry` using a unique key.""" - deleteNodeTypeRegistry( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteNodeTypeRegistryInput! - ): DeleteNodeTypeRegistryPayload - """Deletes a single `MembershipType` using a unique key.""" deleteMembershipType( """ @@ -27317,6 +27328,14 @@ type Mutation { input: DeleteSessionsModuleInput! ): DeleteSessionsModulePayload + """Deletes a single `NodeTypeRegistry` using a unique key.""" + deleteNodeTypeRegistry( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteNodeTypeRegistryInput! + ): DeleteNodeTypeRegistryPayload + """Deletes a single `OrgLimit` using a unique key.""" deleteOrgLimit( """ @@ -30684,75 +30703,6 @@ input OrgChartEdgeGrantInput { createdAt: Datetime } -"""The output of our create `NodeTypeRegistry` mutation.""" -type CreateNodeTypeRegistryPayload { - """ - The exact same `clientMutationId` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String - - """The `NodeTypeRegistry` that was created by this mutation.""" - nodeTypeRegistry: NodeTypeRegistry - - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query - - """An edge for our `NodeTypeRegistry`. May be used by Relay 1.""" - nodeTypeRegistryEdge( - """The method to use when ordering `NodeTypeRegistry`.""" - orderBy: [NodeTypeRegistryOrderBy!]! = [PRIMARY_KEY_ASC] - ): NodeTypeRegistryEdge -} - -"""All input for the create `NodeTypeRegistry` mutation.""" -input CreateNodeTypeRegistryInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """The `NodeTypeRegistry` to be created by this mutation.""" - nodeTypeRegistry: NodeTypeRegistryInput! -} - -"""An input for mutations affecting `NodeTypeRegistry`""" -input NodeTypeRegistryInput { - """ - PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) - """ - name: String! - - """ - snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) - """ - slug: String! - - """ - Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) - """ - category: String! - - """Human-readable display name for UI""" - displayName: String - - """Description of what this node type does""" - description: String - - """JSON Schema defining valid parameters for this node type""" - parameterSchema: JSON - - """ - Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) - """ - tags: [String] - createdAt: Datetime - updatedAt: Datetime -} - """The output of our create `MembershipType` mutation.""" type CreateMembershipTypePayload { """ @@ -31481,6 +31431,85 @@ input SessionsModuleInput { authSettingsTable: String } +"""The output of our create `NodeTypeRegistry` mutation.""" +type CreateNodeTypeRegistryPayload { + """ + The exact same `clientMutationId` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The `NodeTypeRegistry` that was created by this mutation.""" + nodeTypeRegistry: NodeTypeRegistry + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our `NodeTypeRegistry`. May be used by Relay 1.""" + nodeTypeRegistryEdge( + """The method to use when ordering `NodeTypeRegistry`.""" + orderBy: [NodeTypeRegistryOrderBy!]! = [PRIMARY_KEY_ASC] + ): NodeTypeRegistryEdge +} + +"""All input for the create `NodeTypeRegistry` mutation.""" +input CreateNodeTypeRegistryInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """The `NodeTypeRegistry` to be created by this mutation.""" + nodeTypeRegistry: NodeTypeRegistryInput! +} + +"""An input for mutations affecting `NodeTypeRegistry`""" +input NodeTypeRegistryInput { + """ + PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) + """ + name: String! + + """ + snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) + """ + slug: String! + + """ + Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) + """ + category: String! + + """Human-readable display name for UI""" + displayName: String + + """Description of what this node type does""" + description: String + + """ + Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. + """ + summary: String + + """JSON Schema defining valid parameters for this node type""" + parameterSchema: JSON + + """ + Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples + """ + guidance: JSON + + """ + Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) + """ + tags: [String] + createdAt: Datetime + updatedAt: Datetime +} + """The output of our create `OrgLimit` mutation.""" type CreateOrgLimitPayload { """ @@ -36803,84 +36832,6 @@ input OrgChartEdgeGrantPatch { createdAt: Datetime } -"""The output of our update `NodeTypeRegistry` mutation.""" -type UpdateNodeTypeRegistryPayload { - """ - The exact same `clientMutationId` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String - - """The `NodeTypeRegistry` that was updated by this mutation.""" - nodeTypeRegistry: NodeTypeRegistry - - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query - - """An edge for our `NodeTypeRegistry`. May be used by Relay 1.""" - nodeTypeRegistryEdge( - """The method to use when ordering `NodeTypeRegistry`.""" - orderBy: [NodeTypeRegistryOrderBy!]! = [PRIMARY_KEY_ASC] - ): NodeTypeRegistryEdge -} - -"""All input for the `updateNodeTypeRegistry` mutation.""" -input UpdateNodeTypeRegistryInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """ - PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) - """ - name: String! - - """ - An object where the defined keys will be set on the `NodeTypeRegistry` being updated. - """ - nodeTypeRegistryPatch: NodeTypeRegistryPatch! -} - -""" -Represents an update to a `NodeTypeRegistry`. Fields that are set will be updated. -""" -input NodeTypeRegistryPatch { - """ - PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) - """ - name: String - - """ - snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) - """ - slug: String - - """ - Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) - """ - category: String - - """Human-readable display name for UI""" - displayName: String - - """Description of what this node type does""" - description: String - - """JSON Schema defining valid parameters for this node type""" - parameterSchema: JSON - - """ - Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) - """ - tags: [String] - createdAt: Datetime - updatedAt: Datetime -} - """The output of our update `MembershipType` mutation.""" type UpdateMembershipTypePayload { """ @@ -37697,6 +37648,94 @@ input SessionsModulePatch { authSettingsTable: String } +"""The output of our update `NodeTypeRegistry` mutation.""" +type UpdateNodeTypeRegistryPayload { + """ + The exact same `clientMutationId` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The `NodeTypeRegistry` that was updated by this mutation.""" + nodeTypeRegistry: NodeTypeRegistry + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our `NodeTypeRegistry`. May be used by Relay 1.""" + nodeTypeRegistryEdge( + """The method to use when ordering `NodeTypeRegistry`.""" + orderBy: [NodeTypeRegistryOrderBy!]! = [PRIMARY_KEY_ASC] + ): NodeTypeRegistryEdge +} + +"""All input for the `updateNodeTypeRegistry` mutation.""" +input UpdateNodeTypeRegistryInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) + """ + name: String! + + """ + An object where the defined keys will be set on the `NodeTypeRegistry` being updated. + """ + nodeTypeRegistryPatch: NodeTypeRegistryPatch! +} + +""" +Represents an update to a `NodeTypeRegistry`. Fields that are set will be updated. +""" +input NodeTypeRegistryPatch { + """ + PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) + """ + name: String + + """ + snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) + """ + slug: String + + """ + Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) + """ + category: String + + """Human-readable display name for UI""" + displayName: String + + """Description of what this node type does""" + description: String + + """ + Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. + """ + summary: String + + """JSON Schema defining valid parameters for this node type""" + parameterSchema: JSON + + """ + Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples + """ + guidance: JSON + + """ + Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) + """ + tags: [String] + createdAt: Datetime + updatedAt: Datetime +} + """The output of our update `OrgLimit` mutation.""" type UpdateOrgLimitPayload { """ @@ -42394,43 +42433,6 @@ input DeleteOrgChartEdgeGrantInput { id: UUID! } -"""The output of our delete `NodeTypeRegistry` mutation.""" -type DeleteNodeTypeRegistryPayload { - """ - The exact same `clientMutationId` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String - - """The `NodeTypeRegistry` that was deleted by this mutation.""" - nodeTypeRegistry: NodeTypeRegistry - - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query - - """An edge for our `NodeTypeRegistry`. May be used by Relay 1.""" - nodeTypeRegistryEdge( - """The method to use when ordering `NodeTypeRegistry`.""" - orderBy: [NodeTypeRegistryOrderBy!]! = [PRIMARY_KEY_ASC] - ): NodeTypeRegistryEdge -} - -"""All input for the `deleteNodeTypeRegistry` mutation.""" -input DeleteNodeTypeRegistryInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """ - PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) - """ - name: String! -} - """The output of our delete `MembershipType` mutation.""" type DeleteMembershipTypePayload { """ @@ -42905,6 +42907,43 @@ input DeleteSessionsModuleInput { id: UUID! } +"""The output of our delete `NodeTypeRegistry` mutation.""" +type DeleteNodeTypeRegistryPayload { + """ + The exact same `clientMutationId` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The `NodeTypeRegistry` that was deleted by this mutation.""" + nodeTypeRegistry: NodeTypeRegistry + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our `NodeTypeRegistry`. May be used by Relay 1.""" + nodeTypeRegistryEdge( + """The method to use when ordering `NodeTypeRegistry`.""" + orderBy: [NodeTypeRegistryOrderBy!]! = [PRIMARY_KEY_ASC] + ): NodeTypeRegistryEdge +} + +"""All input for the `deleteNodeTypeRegistry` mutation.""" +input DeleteNodeTypeRegistryInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) + """ + name: String! +} + """The output of our delete `OrgLimit` mutation.""" type DeleteOrgLimitPayload { """ diff --git a/sdk/constructive-sdk/src/auth/orm/README.md b/sdk/constructive-sdk/src/auth/orm/README.md index ef3b0c06e..745af4158 100644 --- a/sdk/constructive-sdk/src/auth/orm/README.md +++ b/sdk/constructive-sdk/src/auth/orm/README.md @@ -278,6 +278,9 @@ const updated = await db.user.update({ where: { id: '' }, data: { username const deleted = await db.user.delete({ where: { id: '' } }).execute(); ``` +> **Unified Search API fields:** `searchTsv` +> Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ## Custom Operations ### `db.query.currentIpAddress` diff --git a/sdk/constructive-sdk/src/public/orm/README.md b/sdk/constructive-sdk/src/public/orm/README.md index 4ad719003..50a2fcc00 100644 --- a/sdk/constructive-sdk/src/public/orm/README.md +++ b/sdk/constructive-sdk/src/public/orm/README.md @@ -117,11 +117,11 @@ const db = createClient({ | `migrateFile` | findMany, findOne, create, update, delete | | `appLimitDefault` | findMany, findOne, create, update, delete | | `orgLimitDefault` | findMany, findOne, create, update, delete | -| `nodeTypeRegistry` | findMany, findOne, create, update, delete | | `membershipType` | findMany, findOne, create, update, delete | | `commit` | findMany, findOne, create, update, delete | | `appMembershipDefault` | findMany, findOne, create, update, delete | | `rlsModule` | findMany, findOne, create, update, delete | +| `nodeTypeRegistry` | findMany, findOne, create, update, delete | | `orgMembershipDefault` | findMany, findOne, create, update, delete | | `sqlAction` | findMany, findOne, create, update, delete | | `user` | findMany, findOne, create, update, delete | @@ -3753,43 +3753,6 @@ const updated = await db.orgLimitDefault.update({ where: { id: '' }, data: const deleted = await db.orgLimitDefault.delete({ where: { id: '' } }).execute(); ``` -### `db.nodeTypeRegistry` - -CRUD operations for NodeTypeRegistry records. - -**Fields:** - -| Field | Type | Editable | -|-------|------|----------| -| `name` | String | No | -| `slug` | String | Yes | -| `category` | String | Yes | -| `displayName` | String | Yes | -| `description` | String | Yes | -| `parameterSchema` | JSON | Yes | -| `tags` | String | Yes | -| `createdAt` | Datetime | No | -| `updatedAt` | Datetime | No | - -**Operations:** - -```typescript -// List all nodeTypeRegistry records -const items = await db.nodeTypeRegistry.findMany({ select: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }).execute(); - -// Get one by name -const item = await db.nodeTypeRegistry.findOne({ name: '', select: { name: true, slug: true, category: true, displayName: true, description: true, parameterSchema: true, tags: true, createdAt: true, updatedAt: true } }).execute(); - -// Create -const created = await db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', parameterSchema: '', tags: '' }, select: { name: true } }).execute(); - -// Update -const updated = await db.nodeTypeRegistry.update({ where: { name: '' }, data: { slug: '' }, select: { name: true } }).execute(); - -// Delete -const deleted = await db.nodeTypeRegistry.delete({ where: { name: '' } }).execute(); -``` - ### `db.membershipType` CRUD operations for MembershipType records. @@ -3933,6 +3896,45 @@ const updated = await db.rlsModule.update({ where: { id: '' }, data: { dat const deleted = await db.rlsModule.delete({ where: { id: '' } }).execute(); ``` +### `db.nodeTypeRegistry` + +CRUD operations for NodeTypeRegistry records. + +**Fields:** + +| Field | Type | Editable | +|-------|------|----------| +| `name` | String | No | +| `slug` | String | Yes | +| `category` | String | Yes | +| `displayName` | String | Yes | +| `description` | String | Yes | +| `summary` | String | Yes | +| `parameterSchema` | JSON | Yes | +| `guidance` | JSON | Yes | +| `tags` | String | Yes | +| `createdAt` | Datetime | No | +| `updatedAt` | Datetime | No | + +**Operations:** + +```typescript +// List all nodeTypeRegistry records +const items = await db.nodeTypeRegistry.findMany({ select: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }).execute(); + +// Get one by name +const item = await db.nodeTypeRegistry.findOne({ name: '', select: { name: true, slug: true, category: true, displayName: true, description: true, summary: true, parameterSchema: true, guidance: true, tags: true, createdAt: true, updatedAt: true } }).execute(); + +// Create +const created = await db.nodeTypeRegistry.create({ data: { slug: '', category: '', displayName: '', description: '', summary: '', parameterSchema: '', guidance: '', tags: '' }, select: { name: true } }).execute(); + +// Update +const updated = await db.nodeTypeRegistry.update({ where: { name: '' }, data: { slug: '' }, select: { name: true } }).execute(); + +// Delete +const deleted = await db.nodeTypeRegistry.delete({ where: { name: '' } }).execute(); +``` + ### `db.orgMembershipDefault` CRUD operations for OrgMembershipDefault records. @@ -4050,6 +4052,9 @@ const updated = await db.user.update({ where: { id: '' }, data: { username const deleted = await db.user.delete({ where: { id: '' } }).execute(); ``` +> **Unified Search API fields:** `searchTsv` +> Fields provided by the Unified Search plugin. Includes full-text search (tsvector/BM25), trigram similarity scores, and the combined searchScore. Computed fields are read-only and cannot be set in create/update operations. + ### `db.astMigration` CRUD operations for AstMigration records. diff --git a/sdk/constructive-sdk/src/public/orm/index.ts b/sdk/constructive-sdk/src/public/orm/index.ts index 79daa9193..9ab27b1d8 100644 --- a/sdk/constructive-sdk/src/public/orm/index.ts +++ b/sdk/constructive-sdk/src/public/orm/index.ts @@ -101,11 +101,11 @@ import { RoleTypeModel } from './models/roleType'; import { MigrateFileModel } from './models/migrateFile'; import { AppLimitDefaultModel } from './models/appLimitDefault'; import { OrgLimitDefaultModel } from './models/orgLimitDefault'; -import { NodeTypeRegistryModel } from './models/nodeTypeRegistry'; import { MembershipTypeModel } from './models/membershipType'; import { CommitModel } from './models/commit'; import { AppMembershipDefaultModel } from './models/appMembershipDefault'; import { RlsModuleModel } from './models/rlsModule'; +import { NodeTypeRegistryModel } from './models/nodeTypeRegistry'; import { OrgMembershipDefaultModel } from './models/orgMembershipDefault'; import { SqlActionModel } from './models/sqlAction'; import { UserModel } from './models/user'; @@ -243,11 +243,11 @@ export function createClient(config: OrmClientConfig) { migrateFile: new MigrateFileModel(client), appLimitDefault: new AppLimitDefaultModel(client), orgLimitDefault: new OrgLimitDefaultModel(client), - nodeTypeRegistry: new NodeTypeRegistryModel(client), membershipType: new MembershipTypeModel(client), commit: new CommitModel(client), appMembershipDefault: new AppMembershipDefaultModel(client), rlsModule: new RlsModuleModel(client), + nodeTypeRegistry: new NodeTypeRegistryModel(client), orgMembershipDefault: new OrgMembershipDefaultModel(client), sqlAction: new SqlActionModel(client), user: new UserModel(client), diff --git a/sdk/constructive-sdk/src/public/orm/input-types.ts b/sdk/constructive-sdk/src/public/orm/input-types.ts index 817a485e5..5d9eed7f1 100644 --- a/sdk/constructive-sdk/src/public/orm/input-types.ts +++ b/sdk/constructive-sdk/src/public/orm/input-types.ts @@ -1796,25 +1796,6 @@ export interface OrgLimitDefault { /** Default maximum usage allowed for this limit */ max?: number | null; } -/** Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). */ -export interface NodeTypeRegistry { - /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ - name?: string | null; - /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ - slug?: string | null; - /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ - category?: string | null; - /** Human-readable display name for UI */ - displayName?: string | null; - /** Description of what this node type does */ - description?: string | null; - /** JSON Schema defining valid parameters for this node type */ - parameterSchema?: Record | null; - /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ - tags?: string[] | null; - createdAt?: string | null; - updatedAt?: string | null; -} /** Defines the different scopes of membership (e.g. App Member, Organization Member, Group Member) */ export interface MembershipType { /** Integer identifier for the membership type (1=App, 2=Organization, 3=Group) */ @@ -1870,6 +1851,29 @@ export interface RlsModule { currentRole?: string | null; currentRoleId?: string | null; } +/** Registry of high-level semantic AST node types using domain-prefixed naming. These IR nodes compile to multiple targets (Postgres RLS, egress, ingress, etc.). */ +export interface NodeTypeRegistry { + /** PascalCase domain-prefixed node type name (e.g., AuthzDirectOwner, DataTimestamps, DataImmutableFields) */ + name?: string | null; + /** snake_case slug for use in code and configuration (e.g., authz_direct_owner, data_timestamps) */ + slug?: string | null; + /** Node type category: authz (authorization semantics), data (table-level behaviors), view (view query types), relation (relational structure between tables) */ + category?: string | null; + /** Human-readable display name for UI */ + displayName?: string | null; + /** Description of what this node type does */ + description?: string | null; + /** Casual, approachable marketing description for onboarding UIs. Explains what the node type does and when you would use it in plain language. */ + summary?: string | null; + /** JSON Schema defining valid parameters for this node type */ + parameterSchema?: Record | null; + /** Machine-readable usage guidance: privilege recommendations, combination patterns, warnings, anti-patterns. All fields optional. Keys: recommended_privileges, privilege_note, standalone_ok, suggested_companions, combination_note, typical_pattern, status, status_note, alternatives, warnings, anti_patterns, performance_note, requires, decision_semantics, related_nodes, examples */ + guidance?: Record | null; + /** Tags for categorization and filtering (e.g., ownership, membership, temporal, rls) */ + tags?: string[] | null; + createdAt?: string | null; + updatedAt?: string | null; +} /** Default membership settings per entity, controlling initial approval and verification state for new members */ export interface OrgMembershipDefault { id: string; @@ -2514,7 +2518,6 @@ export interface RoleTypeRelations {} export interface MigrateFileRelations {} export interface AppLimitDefaultRelations {} export interface OrgLimitDefaultRelations {} -export interface NodeTypeRegistryRelations {} export interface MembershipTypeRelations {} export interface CommitRelations {} export interface AppMembershipDefaultRelations {} @@ -2526,6 +2529,7 @@ export interface RlsModuleRelations { sessionsTable?: Table | null; usersTable?: Table | null; } +export interface NodeTypeRegistryRelations {} export interface OrgMembershipDefaultRelations { entity?: User | null; } @@ -2707,12 +2711,12 @@ export type RoleTypeWithRelations = RoleType & RoleTypeRelations; export type MigrateFileWithRelations = MigrateFile & MigrateFileRelations; export type AppLimitDefaultWithRelations = AppLimitDefault & AppLimitDefaultRelations; export type OrgLimitDefaultWithRelations = OrgLimitDefault & OrgLimitDefaultRelations; -export type NodeTypeRegistryWithRelations = NodeTypeRegistry & NodeTypeRegistryRelations; export type MembershipTypeWithRelations = MembershipType & MembershipTypeRelations; export type CommitWithRelations = Commit & CommitRelations; export type AppMembershipDefaultWithRelations = AppMembershipDefault & AppMembershipDefaultRelations; export type RlsModuleWithRelations = RlsModule & RlsModuleRelations; +export type NodeTypeRegistryWithRelations = NodeTypeRegistry & NodeTypeRegistryRelations; export type OrgMembershipDefaultWithRelations = OrgMembershipDefault & OrgMembershipDefaultRelations; export type SqlActionWithRelations = SqlAction & SqlActionRelations; @@ -5146,17 +5150,6 @@ export type OrgLimitDefaultSelect = { name?: boolean; max?: boolean; }; -export type NodeTypeRegistrySelect = { - name?: boolean; - slug?: boolean; - category?: boolean; - displayName?: boolean; - description?: boolean; - parameterSchema?: boolean; - tags?: boolean; - createdAt?: boolean; - updatedAt?: boolean; -}; export type MembershipTypeSelect = { id?: boolean; name?: boolean; @@ -5214,6 +5207,19 @@ export type RlsModuleSelect = { select: TableSelect; }; }; +export type NodeTypeRegistrySelect = { + name?: boolean; + slug?: boolean; + category?: boolean; + displayName?: boolean; + description?: boolean; + summary?: boolean; + parameterSchema?: boolean; + guidance?: boolean; + tags?: boolean; + createdAt?: boolean; + updatedAt?: boolean; +}; export type OrgMembershipDefaultSelect = { id?: boolean; createdAt?: boolean; @@ -9183,32 +9189,6 @@ export interface OrgLimitDefaultFilter { /** Negates the expression. */ not?: OrgLimitDefaultFilter; } -export interface NodeTypeRegistryFilter { - /** Filter by the object’s `name` field. */ - name?: StringFilter; - /** Filter by the object’s `slug` field. */ - slug?: StringFilter; - /** Filter by the object’s `category` field. */ - category?: StringFilter; - /** Filter by the object’s `displayName` field. */ - displayName?: StringFilter; - /** Filter by the object’s `description` field. */ - description?: StringFilter; - /** Filter by the object’s `parameterSchema` field. */ - parameterSchema?: JSONFilter; - /** Filter by the object’s `tags` field. */ - tags?: StringListFilter; - /** Filter by the object’s `createdAt` field. */ - createdAt?: DatetimeFilter; - /** Filter by the object’s `updatedAt` field. */ - updatedAt?: DatetimeFilter; - /** Checks for all expressions in this list. */ - and?: NodeTypeRegistryFilter[]; - /** Checks for any expressions in this list. */ - or?: NodeTypeRegistryFilter[]; - /** Negates the expression. */ - not?: NodeTypeRegistryFilter; -} export interface MembershipTypeFilter { /** Filter by the object’s `id` field. */ id?: IntFilter; @@ -9315,6 +9295,36 @@ export interface RlsModuleFilter { /** Filter by the object’s `usersTable` relation. */ usersTable?: TableFilter; } +export interface NodeTypeRegistryFilter { + /** Filter by the object’s `name` field. */ + name?: StringFilter; + /** Filter by the object’s `slug` field. */ + slug?: StringFilter; + /** Filter by the object’s `category` field. */ + category?: StringFilter; + /** Filter by the object’s `displayName` field. */ + displayName?: StringFilter; + /** Filter by the object’s `description` field. */ + description?: StringFilter; + /** Filter by the object’s `summary` field. */ + summary?: StringFilter; + /** Filter by the object’s `parameterSchema` field. */ + parameterSchema?: JSONFilter; + /** Filter by the object’s `guidance` field. */ + guidance?: JSONFilter; + /** Filter by the object’s `tags` field. */ + tags?: StringListFilter; + /** Filter by the object’s `createdAt` field. */ + createdAt?: DatetimeFilter; + /** Filter by the object’s `updatedAt` field. */ + updatedAt?: DatetimeFilter; + /** Checks for all expressions in this list. */ + and?: NodeTypeRegistryFilter[]; + /** Checks for any expressions in this list. */ + or?: NodeTypeRegistryFilter[]; + /** Negates the expression. */ + not?: NodeTypeRegistryFilter; +} export interface OrgMembershipDefaultFilter { /** Filter by the object’s `id` field. */ id?: UUIDFilter; @@ -10931,16 +10941,6 @@ export type OrgLimitDefaultOrderBy = | 'ID_DESC' | 'NAME_ASC' | 'NAME_DESC'; -export type NodeTypeRegistryOrderBy = - | 'NATURAL' - | 'PRIMARY_KEY_ASC' - | 'PRIMARY_KEY_DESC' - | 'NAME_ASC' - | 'NAME_DESC' - | 'SLUG_ASC' - | 'SLUG_DESC' - | 'CATEGORY_ASC' - | 'CATEGORY_DESC'; export type MembershipTypeOrderBy = | 'NATURAL' | 'PRIMARY_KEY_ASC' @@ -10979,6 +10979,16 @@ export type RlsModuleOrderBy = | 'ID_DESC' | 'DATABASE_ID_ASC' | 'DATABASE_ID_DESC'; +export type NodeTypeRegistryOrderBy = + | 'NATURAL' + | 'PRIMARY_KEY_ASC' + | 'PRIMARY_KEY_DESC' + | 'NAME_ASC' + | 'NAME_DESC' + | 'SLUG_ASC' + | 'SLUG_DESC' + | 'CATEGORY_ASC' + | 'CATEGORY_DESC'; export type OrgMembershipDefaultOrderBy = | 'NATURAL' | 'PRIMARY_KEY_ASC' @@ -14141,36 +14151,6 @@ export interface DeleteOrgLimitDefaultInput { clientMutationId?: string; id: string; } -export interface CreateNodeTypeRegistryInput { - clientMutationId?: string; - nodeTypeRegistry: { - name: string; - slug: string; - category: string; - displayName?: string; - description?: string; - parameterSchema?: Record; - tags?: string[]; - }; -} -export interface NodeTypeRegistryPatch { - name?: string | null; - slug?: string | null; - category?: string | null; - displayName?: string | null; - description?: string | null; - parameterSchema?: Record | null; - tags?: string[] | null; -} -export interface UpdateNodeTypeRegistryInput { - clientMutationId?: string; - name: string; - nodeTypeRegistryPatch: NodeTypeRegistryPatch; -} -export interface DeleteNodeTypeRegistryInput { - clientMutationId?: string; - name: string; -} export interface CreateMembershipTypeInput { clientMutationId?: string; membershipType: { @@ -14285,6 +14265,40 @@ export interface DeleteRlsModuleInput { clientMutationId?: string; id: string; } +export interface CreateNodeTypeRegistryInput { + clientMutationId?: string; + nodeTypeRegistry: { + name: string; + slug: string; + category: string; + displayName?: string; + description?: string; + summary?: string; + parameterSchema?: Record; + guidance?: Record; + tags?: string[]; + }; +} +export interface NodeTypeRegistryPatch { + name?: string | null; + slug?: string | null; + category?: string | null; + displayName?: string | null; + description?: string | null; + summary?: string | null; + parameterSchema?: Record | null; + guidance?: Record | null; + tags?: string[] | null; +} +export interface UpdateNodeTypeRegistryInput { + clientMutationId?: string; + name: string; + nodeTypeRegistryPatch: NodeTypeRegistryPatch; +} +export interface DeleteNodeTypeRegistryInput { + clientMutationId?: string; + name: string; +} export interface CreateOrgMembershipDefaultInput { clientMutationId?: string; orgMembershipDefault: { @@ -25335,51 +25349,6 @@ export type DeleteOrgLimitDefaultPayloadSelect = { select: OrgLimitDefaultEdgeSelect; }; }; -export interface CreateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was created by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type CreateNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; -export interface UpdateNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was updated by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type UpdateNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; -export interface DeleteNodeTypeRegistryPayload { - clientMutationId?: string | null; - /** The `NodeTypeRegistry` that was deleted by this mutation. */ - nodeTypeRegistry?: NodeTypeRegistry | null; - nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; -} -export type DeleteNodeTypeRegistryPayloadSelect = { - clientMutationId?: boolean; - nodeTypeRegistry?: { - select: NodeTypeRegistrySelect; - }; - nodeTypeRegistryEdge?: { - select: NodeTypeRegistryEdgeSelect; - }; -}; export interface CreateMembershipTypePayload { clientMutationId?: string | null; /** The `MembershipType` that was created by this mutation. */ @@ -25560,6 +25529,51 @@ export type DeleteRlsModulePayloadSelect = { select: RlsModuleEdgeSelect; }; }; +export interface CreateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was created by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type CreateNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; +export interface UpdateNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was updated by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type UpdateNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; +export interface DeleteNodeTypeRegistryPayload { + clientMutationId?: string | null; + /** The `NodeTypeRegistry` that was deleted by this mutation. */ + nodeTypeRegistry?: NodeTypeRegistry | null; + nodeTypeRegistryEdge?: NodeTypeRegistryEdge | null; +} +export type DeleteNodeTypeRegistryPayloadSelect = { + clientMutationId?: boolean; + nodeTypeRegistry?: { + select: NodeTypeRegistrySelect; + }; + nodeTypeRegistryEdge?: { + select: NodeTypeRegistryEdgeSelect; + }; +}; export interface CreateOrgMembershipDefaultPayload { clientMutationId?: string | null; /** The `OrgMembershipDefault` that was created by this mutation. */ @@ -27013,18 +27027,6 @@ export type OrgLimitDefaultEdgeSelect = { select: OrgLimitDefaultSelect; }; }; -/** A `NodeTypeRegistry` edge in the connection. */ -export interface NodeTypeRegistryEdge { - cursor?: string | null; - /** The `NodeTypeRegistry` at the end of the edge. */ - node?: NodeTypeRegistry | null; -} -export type NodeTypeRegistryEdgeSelect = { - cursor?: boolean; - node?: { - select: NodeTypeRegistrySelect; - }; -}; /** A `MembershipType` edge in the connection. */ export interface MembershipTypeEdge { cursor?: string | null; @@ -27073,6 +27075,18 @@ export type RlsModuleEdgeSelect = { select: RlsModuleSelect; }; }; +/** A `NodeTypeRegistry` edge in the connection. */ +export interface NodeTypeRegistryEdge { + cursor?: string | null; + /** The `NodeTypeRegistry` at the end of the edge. */ + node?: NodeTypeRegistry | null; +} +export type NodeTypeRegistryEdgeSelect = { + cursor?: boolean; + node?: { + select: NodeTypeRegistrySelect; + }; +}; /** A `OrgMembershipDefault` edge in the connection. */ export interface OrgMembershipDefaultEdge { cursor?: string | null; diff --git a/sdk/constructive-sdk/src/public/orm/models/index.ts b/sdk/constructive-sdk/src/public/orm/models/index.ts index c0d113bd7..68efecd05 100644 --- a/sdk/constructive-sdk/src/public/orm/models/index.ts +++ b/sdk/constructive-sdk/src/public/orm/models/index.ts @@ -99,11 +99,11 @@ export { RoleTypeModel } from './roleType'; export { MigrateFileModel } from './migrateFile'; export { AppLimitDefaultModel } from './appLimitDefault'; export { OrgLimitDefaultModel } from './orgLimitDefault'; -export { NodeTypeRegistryModel } from './nodeTypeRegistry'; export { MembershipTypeModel } from './membershipType'; export { CommitModel } from './commit'; export { AppMembershipDefaultModel } from './appMembershipDefault'; export { RlsModuleModel } from './rlsModule'; +export { NodeTypeRegistryModel } from './nodeTypeRegistry'; export { OrgMembershipDefaultModel } from './orgMembershipDefault'; export { SqlActionModel } from './sqlAction'; export { UserModel } from './user'; diff --git a/sdk/migrate-client/schemas/migrate.graphql b/sdk/migrate-client/schemas/migrate.graphql index cdf154f16..5c985957c 100644 --- a/sdk/migrate-client/schemas/migrate.graphql +++ b/sdk/migrate-client/schemas/migrate.graphql @@ -676,6 +676,9 @@ type MetaField { type: MetaType! isNotNull: Boolean! hasDefault: Boolean! + isPrimaryKey: Boolean! + isForeignKey: Boolean! + description: String } """Information about a PostgreSQL type"""