empuno 1.1.1 → 1.2.0

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.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/empuno.mjs +31 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -38,6 +38,7 @@ empuno leave-requests.approve 123
38
38
  empuno leave-requests.reject 124 --rejection_reason "Yoğun dönem"
39
39
  empuno employees.documents.store 45 --document_type is_sozlesmesi --file file=./sozlesme.pdf
40
40
  empuno leave-reports.download 12 --output ./rapor.pdf
41
+ empuno reference sgk_exit_codes # bir alanın geçerli değerleri
41
42
  empuno call POST /manager/leave-requests/123/approve # ham çağrı
42
43
  empuno api leaves --status approved # salt-okuma Company API
43
44
  ```
@@ -50,6 +51,9 @@ komutu CLI güncellemesi olmadan görünür.
50
51
  - `--alan @dosya` ya da `--file alan=dosya` → multipart yükleme.
51
52
  - `--json '{…}'` / `--json @govde.json`, `--dry-run`, `--output yol`,
52
53
  `--profile ad` (birden çok firma).
54
+ - Listeler `--per_page` (≤100) ve `--page` alır; yeni kaydın kimliği yanıtta
55
+ `flash.created` ya da `redirect.params` içindedir.
56
+ - Geçmiş veri aktarımı (`data-migration.*`) davet/e-posta/bildirim göndermez.
53
57
 
54
58
  ## Talepler (empuno ekibine)
55
59
 
package/empuno.mjs CHANGED
@@ -21,7 +21,7 @@ import os from 'node:os';
21
21
  import path from 'node:path';
22
22
  import crypto from 'node:crypto';
23
23
 
24
- const VERSION = '1.1.1'; // EMPUNO_CLI_VERSION — config/agent_api.php cli_version + package.json ile aynı tutulur
24
+ const VERSION = '1.2.0'; // EMPUNO_CLI_VERSION — config/agent_api.php cli_version + package.json ile aynı tutulur
25
25
  const NPM_PACKAGE = 'empuno';
26
26
  const DEFAULT_URL = 'https://empuno.com';
27
27
  const CATALOG_TTL_MS = 10 * 60 * 1000;
@@ -234,7 +234,7 @@ function compareVersions(a, b) {
234
234
  return 0;
235
235
  }
236
236
 
237
- async function request(auth, method, urlPath, { query = {}, body = null, files = [], output = null, dryRun = false } = {}) {
237
+ async function request(auth, method, urlPath, { query = {}, body = null, files = [], output = null, dryRun = false, headers: extraHeaders = {} } = {}) {
238
238
  const url = new URL(urlPath.startsWith('http') ? urlPath : auth.url + urlPath);
239
239
  for (const [k, v] of Object.entries(query)) {
240
240
  if (Array.isArray(v)) v.forEach((item) => url.searchParams.append(`${k}[]`, String(item)));
@@ -246,6 +246,7 @@ async function request(auth, method, urlPath, { query = {}, body = null, files =
246
246
  Accept: 'application/json',
247
247
  'User-Agent': `empuno-cli/${VERSION} node/${process.versions.node}`,
248
248
  'X-Empuno-Cli': VERSION,
249
+ ...extraHeaders,
249
250
  };
250
251
 
251
252
  let sendMethod = method;
@@ -647,6 +648,23 @@ function installedViaNpm() {
647
648
  }
648
649
  }
649
650
 
651
+ async function cmdReference(args) {
652
+ const auth = resolveAuth(args.flags);
653
+ requireKey(auth);
654
+ const name = args.positional[0];
655
+ const { ok, result } = await request(auth, 'GET', `/api/company/v1/reference${name ? `/${encodeURIComponent(name)}` : ''}`);
656
+ if (wantsText() && ok && name && Array.isArray(result?.data)) {
657
+ for (const row of result.data) {
658
+ const key = row.code ?? row.value ?? row.id;
659
+ const label = row.label ?? row.name ?? '';
660
+ process.stdout.write(`${String(key).padEnd(24)} ${label}\n`);
661
+ }
662
+ return 0;
663
+ }
664
+ print(result);
665
+ return ok ? 0 : 1;
666
+ }
667
+
650
668
  async function cmdUpdate(args) {
651
669
  if (installedViaNpm()) {
652
670
  // npm'in yönettiği dosyanın üzerine yazmak sürüm kaydını bozar.
@@ -760,8 +778,8 @@ async function cmdTickets(args) {
760
778
  const auth = resolveAuth(flags);
761
779
  requireKey(auth);
762
780
 
763
- const send = async (method, urlPath, body = null, query = {}) => {
764
- const response = await request(auth, method, urlPath, { body, query, dryRun: flags['dry-run'] });
781
+ const send = async (method, urlPath, body = null, query = {}, headers = {}) => {
782
+ const response = await request(auth, method, urlPath, { body, query, headers, dryRun: flags['dry-run'] });
765
783
  return response;
766
784
  };
767
785
 
@@ -789,7 +807,10 @@ async function cmdTickets(args) {
789
807
  }
790
808
  let context = opts.context ? readJsonArg(String(opts.context)) : {};
791
809
  if (opts.command) context = { ...context, command: String(opts.command) };
792
- const r = await send('POST', base, { title: String(title), kind, body, priority: opts.priority, context: Object.keys(context).length ? context : undefined });
810
+ // Aynı içerik → aynı anahtar: betik yeniden denese de ikinci talep açılmaz
811
+ // (sunucu mevcut talebi duplicate=true ile döner).
812
+ const idem = crypto.createHash('sha256').update(`${title}|${kind}|${body}`).digest('hex').slice(0, 40);
813
+ const r = await send('POST', base, { title: String(title), kind, body, priority: opts.priority, context: Object.keys(context).length ? context : undefined }, {}, { 'Idempotency-Key': opts['idempotency-key'] ? String(opts['idempotency-key']) : idem });
793
814
  if (r.dryRun) return print(r.result), 0;
794
815
  print(r.result);
795
816
  return r.ok ? 0 : 1;
@@ -928,7 +949,8 @@ KURULUM
928
949
  KEŞİF
929
950
  empuno whoami # firma, anahtar türü, kimin adına çalıştığı
930
951
  empuno commands [ara] [--module leaves] [--writes|--reads] [--all] [--full]
931
- empuno describe <komut> # yöntem, yol, yol parametreleri, alanlar/kurallar, gereken yetki
952
+ empuno describe <komut> # yöntem, yol, yol parametreleri, alanlar/kurallar, gereken yetki, hız sınırı
953
+ empuno reference [ad] # geçerli değerler: sgk_exit_codes, employee_document_types, departments, branches, leave_types…
932
954
 
933
955
  ÇALIŞTIRMA (komut = panel rotası; listeden)
934
956
  empuno leave-requests.index --status pending --per_page 50
@@ -1016,6 +1038,9 @@ async function main() {
1016
1038
  case 'tickets':
1017
1039
  case 'ticket':
1018
1040
  return cmdTickets(args);
1041
+ case 'reference':
1042
+ case 'ref':
1043
+ return cmdReference(args);
1019
1044
  case 'support':
1020
1045
  return cmdSupport(args);
1021
1046
  case 'run':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "empuno",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "empuno İK platformunun komut satırı: yönetim panelindeki tüm işlemleri (izin, bordro, vardiya, PDKS, zimmet, masraf, işe alım) yapay zekâ ajanlarına ve otomasyonlara açar.",
5
5
  "type": "module",
6
6
  "bin": {