{"id":18561224,"url":"https://github.com/apostrophecms/piece-type-importer","last_synced_at":"2025-10-29T09:32:57.001Z","repository":{"id":44880926,"uuid":"426195178","full_name":"apostrophecms/piece-type-importer","owner":"apostrophecms","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-10T18:53:28.000Z","size":51,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T18:48:39.379Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apostrophecms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-09T11:02:58.000Z","updated_at":"2024-07-10T18:53:24.000Z","dependencies_parsed_at":"2024-11-06T22:06:39.029Z","dependency_job_id":"1fa76508-dd47-41c1-84e5-837a776e8f16","html_url":"https://github.com/apostrophecms/piece-type-importer","commit_stats":{"total_commits":47,"total_committers":7,"mean_commits":6.714285714285714,"dds":"0.36170212765957444","last_synced_commit":"55a345a738f38414b8c3a05ae046b2d62732b6d9"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/apostrophecms/piece-type-importer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-importer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-importer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-importer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-importer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostrophecms","download_url":"https://codeload.github.com/apostrophecms/piece-type-importer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fpiece-type-importer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281599366,"owners_count":26528894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-29T02:00:06.901Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T22:06:15.087Z","updated_at":"2025-10-29T09:32:56.981Z","avatar_url":"https://github.com/apostrophecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/apostrophecms/piece-type-importer/tree/main.svg?style=svg)](https://circleci.com/gh/apostrophecms/piece-type-importer/tree/main)\n[![Chat on Discord](https://img.shields.io/discord/517772094482677790.svg)](https://chat.apostrophecms.org)\n\n# Apostrophe Pieces Importer\n\n\u003e ⚠️ **NOTE:** This module is deprecated, its functionality has been incorporated into [@apostrophecms/import-export](https://github.com/apostrophecms/import-export).\n\nThis module adds an optional import feature to all piece type modules in an [Apostrophe](https://apostrophecms.com) project. This feature enables importing pieces from CSV files where it is configured. Requires Apostrophe 3.\n\n## Installation\n\n```bash\nnpm install @apostrophecms/piece-type-importer\n```\n\n## Use\n\n### Initialization\n\nEnable `@apostrophecms/piece-type-importer` in `app.js`.\n\n```javascript\nrequire('apostrophe')({\n  shortName: 'my-project',\n  modules: {\n    // The Importer module\n    '@apostrophecms/piece-type-importer': {},\n    // A piece type that allows imports (see below)\n    'article': {}\n    }\n  }\n});\n```\n\nThe Pieces Importer module improves all piece types in the site to add import functionality to them. To enable that functionality, **you must add the `import: true` option on the appropriate piece type(s)**. The example above demonstrates doing this in the `app.js` file. More often it will be preferable to set this option in the module's `index.js` file.\n\n```javascript\n// modules/article/index.js\nmodule.exports = {\n  extend: '@apostrophecms/piece-type',\n  options: {\n    label: 'Article',\n    pluralLabel: 'Articles',\n    import: true // 👈 Adding the import option.\n  },\n  // Other properties...\n}\n```\n\n## Updating existing pieces\n\nYou can also update existing pieces via this module.\n\nTo do that, you will need one (and only one) **key column** in your file. This column's name **must be exactly the name of the existing field** that uniquely identifies each row as an update of a specific existing piece, **followed by `:key`**.\n\nFor instance, if you need to change the usernames of users in bulk, you might prepare a CSV file like this:\n\n```\nusername:key,username\nbobsmith,bob.smith\njanedoe,jane.doe\n```\n\nThe key column is the *old value*. You may optionally also present a *new value* for that same column in a separate column without `:key`. You may also include other columns, as you see fit. The important thing is that you must have one and only one `:key` column in order to carry out updates.\n\n## Mixing inserts and updates\n\nIf a row has no value for your `:key` column, it is treated as an insert, rather than an update.\n\n## Importing rich text (HTML) rather than plaintext\n\nBy default, if you create a column in your CSV file for a field of type `area`, it will be imported as plaintext. Any special characters like `\u003c` and `\u003e` will be escaped so the user can see them. HTML is not supported.\n\nTo import areas as rich text HTML markup, add the `importAsRichText: true` option to\nthe `area` field in your schema.\n\n## Roadmap\n\n|Feature |Status  |\n--- | ---\n|Create mixin to define standard props for modals used in the context of utility operations| TODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fpiece-type-importer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostrophecms%2Fpiece-type-importer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fpiece-type-importer/lists"}