{"version":3,"file":"Asset.cjs","names":[],"sources":["../../../src/types/migration/Asset.ts"],"sourcesContent":["import type { Asset } from \"../api/asset/asset\"\nimport type { FilledImageFieldImage } from \"../value/image\"\nimport type { LinkToMediaField } from \"../value/linkToMedia\"\nimport { type RTImageNode } from \"../value/richText\"\nimport type { InjectMigrationSpecificTypes } from \"./Document\"\n\n/** An asset to be uploaded to Prismic media library. */\nexport type MigrationAssetConfig = {\n\t/**\n\t * ID the assets is indexed with on the migration instance.\n\t *\n\t * @remarks\n\t *   This property's value is not necessarily the same as the as the one in the `file` property.\n\t *   It is mainly used for deduplication within a `Migration` instance.\n\t */\n\tid: string | URL | File | NonNullable<ConstructorParameters<typeof File>[0]>[0]\n\n\t/** File to be uploaded as an asset. */\n\tfile: string | URL | File | NonNullable<ConstructorParameters<typeof File>[0]>[0]\n\n\t/** Filename of the asset. */\n\tfilename: string\n\n\t/** Notes about the asset. Notes are private and only visible in Prismic media library. */\n\tnotes?: string\n\n\t/** Credits and copyright for the asset if any. */\n\tcredits?: string\n\n\t/** Alternate text for the asset. */\n\talt?: string\n\n\t/**\n\t * Tags associated with the asset.\n\t *\n\t * @remarks\n\t *   Tags should be at least 3 characters long and 20 characters at most.\n\t */\n\ttags?: string[]\n}\n\n/** An image field in a migration. */\nexport type MigrationImage =\n\t| PrismicMigrationAsset\n\t| ({\n\t\t\t/** A reference to the migration asset used to resolve the image field's value. */\n\t\t\tid: PrismicMigrationAsset\n\t  } & Record<string, PrismicMigrationAsset>)\n\n/** A link to media field in a migration. */\nexport type MigrationLinkToMedia = Pick<LinkToMediaField<\"filled\">, \"link_type\" | \"text\"> & {\n\t/** A reference to the migration asset used to resolve the link to media field's value. */\n\tid: PrismicMigrationAsset\n}\n\n/**\n * The minimum amount of information needed to represent a link to media field with the migration\n * API.\n */\nexport type MigrationLinkToMediaField =\n\t| Pick<LinkToMediaField<\"filled\">, \"link_type\" | \"id\" | \"text\">\n\t| LinkToMediaField<\"empty\">\n\n/** A rich text image node in a migration. */\nexport type MigrationRTImageNode = InjectMigrationSpecificTypes<\n\tPick<RTImageNode, \"type\" | \"linkTo\">\n> & {\n\t/** A reference to the migration asset used to resolve the rich text image node's value. */\n\tid: PrismicMigrationAsset\n}\n\n/** A migration asset used with the Prismic Migration API. */\nexport class PrismicMigrationAsset {\n\t/** Asset object from Prismic, available once created. */\n\tasset?: Asset\n\n\t/** Configuration of the asset. */\n\tconfig: MigrationAssetConfig\n\n\t/** The initial field value this migration field was created with. */\n\toriginalField?: FilledImageFieldImage | LinkToMediaField<\"filled\"> | RTImageNode\n\n\t/**\n\t * Creates a migration asset used with the Prismic Migration API.\n\t *\n\t * @param config - Configuration of the asset.\n\t * @param initialField - The initial field value if any.\n\t * @returns A migration asset instance.\n\t */\n\tconstructor(\n\t\tconfig: MigrationAssetConfig,\n\t\tinitialField?: FilledImageFieldImage | LinkToMediaField<\"filled\"> | RTImageNode,\n\t) {\n\t\tthis.config = config\n\t\tthis.originalField = initialField\n\t}\n}\n"],"mappings":";;AAwEA,IAAa,wBAAb,MAAmC;;CAElC;;CAGA;;CAGA;;;;;;;;CASA,YACC,QACA,cACC;AACD,OAAK,SAAS;AACd,OAAK,gBAAgB"}