- Implement folder account options helper for filtering access items based on person ID and date. - Create FolderAccessAccountField component for selecting accounts with profile integration. - Develop AssetLocalIdentities component for managing local identities associated with assets. - Introduce LocalIdentityOwner component to display and manage local identity ownership. - Add LocalIdentityEditor for creating, associating, and retiring local identities. - Implement local identity API for fetching and executing local identity commands. - Create tests for local identity UI components to ensure functionality and correctness. - Add NetworkShareOptions class for structured and paginated SMB selection. - Introduce NetworkShareAddress component for displaying and copying network share addresses. - Create RemoteOptionList and RemoteOptionPicker components for remote option selection with pagination and search. - Add tests for RemoteOptionList to validate rendering and behavior under various states.
91 lines
3.0 KiB
TypeScript
91 lines
3.0 KiB
TypeScript
import {
|
|
RelationshipDefinitionSchema,
|
|
RelationshipPageSchema,
|
|
SummaryResolutionSchema,
|
|
} from "@metis/relationship-contracts";
|
|
import { z } from "zod/v4";
|
|
|
|
export const NETWORK_SHARE_PUBLICATION_TYPE_ID = "assets:network-share-publication";
|
|
|
|
export const NETWORK_SHARE_PUBLICATION_DEFINITION = RelationshipDefinitionSchema.parse({
|
|
typeId: NETWORK_SHARE_PUBLICATION_TYPE_ID,
|
|
ownerProviderId: "assets",
|
|
source: { entityType: "assets:asset" },
|
|
target: { entityType: "resources:resource", requiredCapability: "network:smb-share" },
|
|
direction: "directed",
|
|
forwardLabelKey: "assets:networkSharePublication.resources",
|
|
inverseLabelKey: "assets:networkSharePublication.publisher",
|
|
activeCardinality: { maxTargetsPerSource: null, maxSourcesPerTarget: 1 },
|
|
representation: "record",
|
|
history: "lifecycle",
|
|
writeMode: "owner-command",
|
|
});
|
|
|
|
const id = z.uuid().transform((value) => value.toLowerCase());
|
|
|
|
export const NetworkSharePublicationCommandSchema = z.discriminatedUnion("action", [
|
|
z.strictObject({ action: z.literal("publish"), assetId: id, resourceId: id }),
|
|
z.strictObject({ action: z.literal("end"), publicationId: id }),
|
|
z.strictObject({ action: z.literal("transfer"), publicationId: id, assetId: id }),
|
|
]);
|
|
|
|
export type NetworkSharePublicationCommand = z.infer<typeof NetworkSharePublicationCommandSchema>;
|
|
|
|
export const NetworkSharePublicationSchema = z.strictObject({
|
|
id,
|
|
companyId: id,
|
|
assetId: id,
|
|
resourceId: id,
|
|
predecessorId: id.nullable(),
|
|
startedAt: z.iso.datetime(),
|
|
startedBy: id,
|
|
endedAt: z.iso.datetime().nullable(),
|
|
endedBy: id.nullable(),
|
|
});
|
|
|
|
export type NetworkSharePublicationDTO = z.infer<typeof NetworkSharePublicationSchema>;
|
|
|
|
export const NetworkSharePublicationQuerySchema = z.strictObject({
|
|
assetId: id.optional(),
|
|
resourceId: id.optional(),
|
|
includeEnded: z.enum(["true", "false"]).default("false"),
|
|
pageSize: z.coerce.number().int().min(1).max(100).default(50),
|
|
cursor: z.string().min(1).max(2048).optional(),
|
|
});
|
|
|
|
export type NetworkSharePublicationQuery = z.infer<typeof NetworkSharePublicationQuerySchema>;
|
|
|
|
export const NetworkSharePublicationPageSchema = z.strictObject({
|
|
publications: z.array(NetworkSharePublicationSchema).max(100),
|
|
nextCursor: z.string().nullable(),
|
|
});
|
|
|
|
export const NetworkShareRelationshipResponseSchema = z.strictObject({
|
|
page: RelationshipPageSchema,
|
|
summaries: z.array(SummaryResolutionSchema).max(100),
|
|
publications: z.array(NetworkSharePublicationSchema).max(100),
|
|
});
|
|
|
|
export type NetworkShareRelationshipResponse = z.infer<
|
|
typeof NetworkShareRelationshipResponseSchema
|
|
>;
|
|
|
|
export const PublicationOptionQuerySchema = z.strictObject({
|
|
search: z.string().trim().max(100).default(""),
|
|
cursor: z.uuid().optional(),
|
|
});
|
|
|
|
export const PublicationAssetOptionsSchema = z.strictObject({
|
|
items: z
|
|
.array(
|
|
z.strictObject({
|
|
id: z.uuid(),
|
|
name: z.string(),
|
|
templateName: z.string(),
|
|
status: z.string(),
|
|
})
|
|
)
|
|
.max(20),
|
|
nextCursor: z.string().nullable(),
|
|
});
|