d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
179 lines
5.8 KiB
TypeScript
179 lines
5.8 KiB
TypeScript
import type { OutputType } from '@/tools/types'
|
|
|
|
/** Transforms a raw FullItem API response into our standardized output. */
|
|
export function transformFullItem(data: any) {
|
|
return {
|
|
id: data.id ?? null,
|
|
title: data.title ?? null,
|
|
vault: data.vault ?? null,
|
|
category: data.category ?? null,
|
|
urls: (data.urls ?? []).map((url: any) => ({
|
|
href: url.href ?? null,
|
|
label: url.label ?? null,
|
|
primary: url.primary ?? false,
|
|
})),
|
|
favorite: data.favorite ?? false,
|
|
tags: data.tags ?? [],
|
|
version: data.version ?? 0,
|
|
state: data.state ?? null,
|
|
fields: (data.fields ?? []).map((field: any) => ({
|
|
id: field.id ?? null,
|
|
label: field.label ?? null,
|
|
type: field.type ?? 'STRING',
|
|
purpose: field.purpose ?? '',
|
|
value: field.value ?? null,
|
|
section: field.section ?? null,
|
|
generate: field.generate ?? false,
|
|
recipe: field.recipe
|
|
? {
|
|
length: field.recipe.length ?? null,
|
|
characterSets: field.recipe.characterSets ?? [],
|
|
excludeCharacters: field.recipe.excludeCharacters ?? null,
|
|
}
|
|
: null,
|
|
entropy: field.entropy ?? null,
|
|
})),
|
|
sections: (data.sections ?? []).map((section: any) => ({
|
|
id: section.id ?? null,
|
|
label: section.label ?? null,
|
|
})),
|
|
files: (data.files ?? []).map((file: any) => ({
|
|
id: file.id ?? null,
|
|
name: file.name ?? null,
|
|
size: file.size ?? 0,
|
|
section: file.section ?? null,
|
|
})),
|
|
createdAt: data.createdAt ?? null,
|
|
updatedAt: data.updatedAt ?? null,
|
|
lastEditedBy: data.lastEditedBy ?? null,
|
|
}
|
|
}
|
|
|
|
/** Shared output schema for FullItem responses (get_item, create_item, update_item). */
|
|
export const FULL_ITEM_OUTPUTS: Record<
|
|
string,
|
|
{
|
|
type: OutputType
|
|
description: string
|
|
optional?: boolean
|
|
properties?: Record<string, any>
|
|
items?: { type: OutputType; description?: string; properties?: Record<string, any> }
|
|
}
|
|
> = {
|
|
id: { type: 'string', description: 'Item ID' },
|
|
title: { type: 'string', description: 'Item title' },
|
|
vault: {
|
|
type: 'object',
|
|
description: 'Vault reference',
|
|
properties: {
|
|
id: { type: 'string', description: 'Vault ID' },
|
|
},
|
|
},
|
|
category: {
|
|
type: 'string',
|
|
description: 'Item category (e.g., LOGIN, API_CREDENTIAL, SECURE_NOTE)',
|
|
},
|
|
urls: {
|
|
type: 'array',
|
|
description: 'URLs associated with the item',
|
|
optional: true,
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
href: { type: 'string', description: 'URL' },
|
|
label: { type: 'string', description: 'URL label', optional: true },
|
|
primary: { type: 'boolean', description: 'Whether this is the primary URL' },
|
|
},
|
|
},
|
|
},
|
|
favorite: { type: 'boolean', description: 'Whether the item is favorited' },
|
|
tags: { type: 'array', description: 'Item tags' },
|
|
version: { type: 'number', description: 'Item version number' },
|
|
state: {
|
|
type: 'string',
|
|
description: 'Item state (ARCHIVED, or absent/null when active)',
|
|
optional: true,
|
|
},
|
|
fields: {
|
|
type: 'array',
|
|
description: 'Item fields including secrets',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
id: { type: 'string', description: 'Field ID' },
|
|
label: { type: 'string', description: 'Field label', optional: true },
|
|
type: {
|
|
type: 'string',
|
|
description: 'Field type (STRING, EMAIL, CONCEALED, URL, TOTP, DATE, MONTH_YEAR, MENU)',
|
|
},
|
|
purpose: {
|
|
type: 'string',
|
|
description: 'Field purpose (USERNAME, PASSWORD, NOTES, or empty)',
|
|
},
|
|
value: { type: 'string', description: 'Field value', optional: true },
|
|
section: {
|
|
type: 'object',
|
|
description: 'Section reference this field belongs to',
|
|
optional: true,
|
|
properties: {
|
|
id: { type: 'string', description: 'Section ID' },
|
|
},
|
|
},
|
|
generate: { type: 'boolean', description: 'Whether the field value should be generated' },
|
|
recipe: {
|
|
type: 'object',
|
|
description: 'Password generation recipe',
|
|
optional: true,
|
|
properties: {
|
|
length: { type: 'number', description: 'Generated password length', optional: true },
|
|
characterSets: {
|
|
type: 'array',
|
|
description: 'Character sets (LETTERS, DIGITS, SYMBOLS)',
|
|
},
|
|
excludeCharacters: {
|
|
type: 'string',
|
|
description: 'Characters to exclude',
|
|
optional: true,
|
|
},
|
|
},
|
|
},
|
|
entropy: { type: 'number', description: 'Password entropy score', optional: true },
|
|
},
|
|
},
|
|
},
|
|
sections: {
|
|
type: 'array',
|
|
description: 'Item sections',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
id: { type: 'string', description: 'Section ID' },
|
|
label: { type: 'string', description: 'Section label', optional: true },
|
|
},
|
|
},
|
|
},
|
|
files: {
|
|
type: 'array',
|
|
description: 'Files attached to the item (fetch content with Get Item File)',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
id: { type: 'string', description: 'File ID' },
|
|
name: { type: 'string', description: 'File name' },
|
|
size: { type: 'number', description: 'File size in bytes' },
|
|
section: {
|
|
type: 'object',
|
|
description: 'Section reference this file belongs to',
|
|
optional: true,
|
|
properties: {
|
|
id: { type: 'string', description: 'Section ID' },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
|
updatedAt: { type: 'string', description: 'Last update timestamp', optional: true },
|
|
lastEditedBy: { type: 'string', description: 'ID of the last editor', optional: true },
|
|
}
|