@isi-ui7/bos7-shared 0.2.8 → 0.2.9

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.
@@ -51,6 +51,12 @@ export type CrudCustomActionSchema = {
51
51
  /** API endpoint — string or function receiving row id. */
52
52
  apiPath: string | ((id: string) => string);
53
53
  method?: "POST" | "PATCH" | "PUT";
54
+ /**
55
+ * Direct action (no workflow): endpoint mengembalikan 2xx langsung (bukan
56
+ * 202 + instance_id). Tabel di-refresh segera tanpa workflow tracking.
57
+ * Dipakai untuk aksi operasional seperti employee terminate/reactivate.
58
+ */
59
+ direct?: boolean;
54
60
  };
55
61
  export type CrudListSchema = {
56
62
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isi-ui7/bos7-shared",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "Shared auth7 and layout primitives for bos7 applications.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -100,8 +100,8 @@
100
100
  "@carbon/react": "^1.97.0",
101
101
  "@carbon/icons-react": "^11.71.0",
102
102
  "@isi-ui7/corporate-themes": "0.2.4",
103
- "@isi-ui7/ui-shell": "0.2.4",
104
103
  "@isi-ui7/i18n": "0.2.1",
104
+ "@isi-ui7/ui-shell": "0.2.4",
105
105
  "@isi-ui7/modal-manager": "0.2.2",
106
106
  "@isi-ui7/realtime": "0.2.3",
107
107
  "@isi-ui7/data-table": "0.2.3",
@@ -188,11 +188,27 @@ export function CrudSchemaListPage<TData extends Record<string, unknown>>({
188
188
  setCustomActioning(true);
189
189
  setCustomActionError(null);
190
190
  try {
191
- const instanceId = await submitWorkflowForm(path, schema.method ?? "POST", {});
192
- setCustomActionId(null);
193
- setCustomActionRow(null);
194
- setTableKey((v) => v + 1);
195
- tracker.track(instanceId);
191
+ if (schema.direct) {
192
+ // Direct action (no workflow): endpoint returns 2xx immediately.
193
+ const res = await fetch(path, {
194
+ method: schema.method ?? "POST",
195
+ headers: { "Content-Type": "application/json" },
196
+ body: JSON.stringify({}),
197
+ });
198
+ if (!res.ok) {
199
+ const body = (await res.json().catch(() => ({}))) as { error?: string };
200
+ throw new Error(body.error ?? `Gagal (HTTP ${res.status})`);
201
+ }
202
+ setCustomActionId(null);
203
+ setCustomActionRow(null);
204
+ setTableKey((v) => v + 1);
205
+ } else {
206
+ const instanceId = await submitWorkflowForm(path, schema.method ?? "POST", {});
207
+ setCustomActionId(null);
208
+ setCustomActionRow(null);
209
+ setTableKey((v) => v + 1);
210
+ tracker.track(instanceId);
211
+ }
196
212
  } catch (e: unknown) {
197
213
  setCustomActionError(e instanceof Error ? e.message : String(e));
198
214
  } finally {
package/src/crud-types.ts CHANGED
@@ -31,6 +31,12 @@ export type CrudCustomActionSchema = {
31
31
  /** API endpoint — string or function receiving row id. */
32
32
  apiPath: string | ((id: string) => string);
33
33
  method?: "POST" | "PATCH" | "PUT";
34
+ /**
35
+ * Direct action (no workflow): endpoint mengembalikan 2xx langsung (bukan
36
+ * 202 + instance_id). Tabel di-refresh segera tanpa workflow tracking.
37
+ * Dipakai untuk aksi operasional seperti employee terminate/reactivate.
38
+ */
39
+ direct?: boolean;
34
40
  };
35
41
 
36
42
  export type CrudListSchema = {