@payload-cc/payload-collection-cli 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,22 @@
1
1
  # payload-collection-cli
2
2
 
3
+ [![CI](https://github.com/payload-cc/payload-collection-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/payload-cc/payload-collection-cli/actions/workflows/ci.yml)
4
+ [![NPM Version](https://img.shields.io/npm/v/@payload-cc/payload-collection-cli)](https://www.npmjs.com/package/@payload-cc/payload-collection-cli)
5
+ [![License](https://img.shields.io/github/license/payload-cc/payload-collection-cli)](LICENSE)
6
+ [![Documentation](https://img.shields.io/badge/docs-VitePress-blue)](https://payload-cc.github.io/payload-collection-cli/)
7
+
3
8
  **The missing CLI for Payload 3.0. Manage collections without writing boilerplate scripts.**
4
9
 
10
+ <p align="center">
11
+ <img src="docs/public/logo.png" alt="Payload Collection CLI Logo" width="200"/>
12
+ </p>
13
+
14
+ <p align="center">
15
+ 🚀 <strong><a href="https://payload-cc.github.io/payload-collection-cli/">Official Guide</a></strong>
16
+ &nbsp;&nbsp;•&nbsp;&nbsp;
17
+ 🤖 <strong><a href="https://payload-cc.github.io/payload-collection-cli/ai.html">AI Context Page</a></strong>
18
+ </p>
19
+
5
20
  ---
6
21
 
7
22
  ## Why?
@@ -16,11 +31,6 @@ Payload 3.0 is powerful, but performing simple data operations often requires wr
16
31
  - ⚙️ **Configurable:** Define your lookup logic in a simple external config.
17
32
  - 🛡 **Native Performance:** Uses Local API to ensure all Hooks and Validations run.
18
33
 
19
- ## 📖 Documentation
20
-
21
- - **🚀 [Official Guide](https://payload-cc.github.io/payload-collection-cli/)**
22
- - **🤖 [AI Context Page](https://payload-cc.github.io/payload-collection-cli/ai.html)** (One-file summary for coding agents)
23
-
24
34
  ## Installation
25
35
 
26
36
  ```bash
package/dist/bin.cjs CHANGED
@@ -100,6 +100,7 @@ async function processSingle(payload, collection, action, data, config) {
100
100
  const resolved = await resolveRelations(payload, collection, data, config);
101
101
  switch (action) {
102
102
  case "create":
103
+ console.log(`\u{1F4DD} [executor] Creating record in "${collection}" with resolved data:`, JSON.stringify(resolved, null, 2));
103
104
  return await payload.create({ collection, data: resolved });
104
105
  case "upsert":
105
106
  if (data[lookupField] === void 0) {
@@ -148,7 +149,7 @@ async function execute(payload, collection, action, input, config) {
148
149
  }
149
150
 
150
151
  // src/bin.ts
151
- var jiti = (0, import_jiti.createJiti)(importMetaUrl, { moduleCache: false, fsCache: false });
152
+ var jiti = (0, import_jiti.createJiti)(importMetaUrl);
152
153
  var MappingConfigSchema = import_zod.z.object({
153
154
  lookupField: import_zod.z.string().default("id"),
154
155
  onNotFound: import_zod.z.enum(["error", "ignore", "create"]).default("error"),
@@ -177,7 +178,8 @@ async function run() {
177
178
  describe: "The name of the export to use from the configuration file.",
178
179
  default: "cliConfig"
179
180
  }
180
- }).pkgConf("payload-collection-cli").demandCommand(3, "Collection slug, operation, and input are required.").help().parse();
181
+ }).pkgConf("payload-collection-cli").demandCommand(3, "Collection slug, operation, and input are required.").help().parseSync();
182
+ console.log("\u{1F4CA} Parsed arguments:", JSON.stringify(argv, null, 2));
181
183
  const { configFile, configJson, configExportName, _: [collection, action, input] } = argv;
182
184
  let rawConfig = { mappings: {} };
183
185
  if (configJson) {
@@ -218,6 +220,7 @@ async function run() {
218
220
  console.error("\u274C Error: payload.config.ts not found.");
219
221
  process.exit(1);
220
222
  }
223
+ console.log(`\u{1F4D6} Loading payload config from: ${configPath}`);
221
224
  const { default: payloadConfig } = await jiti.import(configPath);
222
225
  const payload = await (0, import_payload.getPayload)({ config: payloadConfig });
223
226
  console.log("\u2705 Connected to Payload");
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  execute
4
- } from "./chunk-D5RS7XAO.js";
4
+ } from "./chunk-IU4EF26D.js";
5
5
 
6
6
  // src/bin.ts
7
7
  import { getPayload } from "payload";
@@ -11,7 +11,7 @@ import fs from "fs";
11
11
  import yargs from "yargs/yargs";
12
12
  import { hideBin } from "yargs/helpers";
13
13
  import { z } from "zod";
14
- var jiti = createJiti(import.meta.url, { moduleCache: false, fsCache: false });
14
+ var jiti = createJiti(import.meta.url);
15
15
  var MappingConfigSchema = z.object({
16
16
  lookupField: z.string().default("id"),
17
17
  onNotFound: z.enum(["error", "ignore", "create"]).default("error"),
@@ -40,7 +40,8 @@ async function run() {
40
40
  describe: "The name of the export to use from the configuration file.",
41
41
  default: "cliConfig"
42
42
  }
43
- }).pkgConf("payload-collection-cli").demandCommand(3, "Collection slug, operation, and input are required.").help().parse();
43
+ }).pkgConf("payload-collection-cli").demandCommand(3, "Collection slug, operation, and input are required.").help().parseSync();
44
+ console.log("\u{1F4CA} Parsed arguments:", JSON.stringify(argv, null, 2));
44
45
  const { configFile, configJson, configExportName, _: [collection, action, input] } = argv;
45
46
  let rawConfig = { mappings: {} };
46
47
  if (configJson) {
@@ -81,6 +82,7 @@ async function run() {
81
82
  console.error("\u274C Error: payload.config.ts not found.");
82
83
  process.exit(1);
83
84
  }
85
+ console.log(`\u{1F4D6} Loading payload config from: ${configPath}`);
84
86
  const { default: payloadConfig } = await jiti.import(configPath);
85
87
  const payload = await getPayload({ config: payloadConfig });
86
88
  console.log("\u2705 Connected to Payload");
@@ -60,6 +60,7 @@ async function processSingle(payload, collection, action, data, config) {
60
60
  const resolved = await resolveRelations(payload, collection, data, config);
61
61
  switch (action) {
62
62
  case "create":
63
+ console.log(`\u{1F4DD} [executor] Creating record in "${collection}" with resolved data:`, JSON.stringify(resolved, null, 2));
63
64
  return await payload.create({ collection, data: resolved });
64
65
  case "upsert":
65
66
  if (data[lookupField] === void 0) {
package/dist/index.cjs CHANGED
@@ -97,6 +97,7 @@ async function processSingle(payload, collection, action, data, config) {
97
97
  const resolved = await resolveRelations(payload, collection, data, config);
98
98
  switch (action) {
99
99
  case "create":
100
+ console.log(`\u{1F4DD} [executor] Creating record in "${collection}" with resolved data:`, JSON.stringify(resolved, null, 2));
100
101
  return await payload.create({ collection, data: resolved });
101
102
  case "upsert":
102
103
  if (data[lookupField] === void 0) {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  execute,
3
3
  resolveRelations
4
- } from "./chunk-D5RS7XAO.js";
4
+ } from "./chunk-IU4EF26D.js";
5
5
  export {
6
6
  execute,
7
7
  resolveRelations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payload-cc/payload-collection-cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "description": "Functional CLI for Payload 3.0 collection management",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "build": "tsup src/index.ts src/bin.ts --format cjs,esm --dts --clean --shims && chmod +x dist/bin.js",
25
25
  "release": "pnpm build && pnpm publish --access public",
26
26
  "test": "vitest run tests/*",
27
- "test:e2e": "vitest run e2e-tests/scenarios/ --no-file-parallelism",
27
+ "test:e2e": "vitest run e2e-tests/scenarios/ --no-file-parallelism --test-timeout 300000",
28
28
  "docs:dev": "vitepress dev docs",
29
29
  "docs:build": "vitepress build docs",
30
30
  "docs:preview": "vitepress preview docs"
@@ -48,7 +48,7 @@
48
48
  "devDependencies": {
49
49
  "@types/node": "^25.5.0",
50
50
  "@types/yargs": "^17.0.35",
51
- "payload": "^3.79.1",
51
+ "payload": "^3.80.0",
52
52
  "tsup": "^8.5.1",
53
53
  "typescript": "^5.9.3",
54
54
  "vitepress": "^1.6.4",