@smartive/graphql-magic 23.11.0-next.1 → 24.0.0-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1 @@
1
- ## [23.11.0-next.1](https://github.com/smartive/graphql-magic/compare/v23.10.0...v23.11.0-next.1) (2026-03-16)
2
-
3
- ### Features
4
-
5
- * Enable mutation args ([6f67ed4](https://github.com/smartive/graphql-magic/commit/6f67ed48eb539c52c7374078b72ff6cdf9fe6f2c))
1
+ ## [24.0.0-next.1](https://github.com/smartive/graphql-magic/compare/v23.11.0-next.1...v24.0.0-next.1) (2026-03-16)
package/dist/bin/gqm.cjs CHANGED
@@ -41,27 +41,39 @@ var import_graphql = require("graphql");
41
41
  // src/client/mutations.ts
42
42
  var import_upperCase = __toESM(require("lodash/upperCase"), 1);
43
43
  var constantCase = (str) => (0, import_upperCase.default)(str).replace(/ /g, "_");
44
+ var argTypeStr = (field) => {
45
+ const base = field.list ? `[${field.type}!]` : field.type;
46
+ return field.nonNull ? `${base}!` : base;
47
+ };
48
+ var argsToVariables = (args2) => args2.map((a) => `$${a.name}: ${argTypeStr(a)}`).join(", ");
49
+ var argsToMutationArgs = (args2) => args2.map((a) => `${a.name}: $${a.name}`).join(", ");
44
50
  var generateMutations = (models) => {
45
51
  const parts = [];
46
52
  for (const { name: name2, creatable, updatable, deletable } of models.entities.filter(not(isRootModel))) {
47
53
  if (creatable) {
54
+ const extraArgs = creatable !== true && creatable.args ? creatable.args : [];
55
+ const variables = extraArgs.length ? `$data: Create${name2}!, ${argsToVariables(extraArgs)}` : `$data: Create${name2}!`;
56
+ const mutationArgs = extraArgs.length ? `data: $data, ${argsToMutationArgs(extraArgs)}` : `data: $data`;
48
57
  parts.push(
49
58
  `export const CREATE_${constantCase(
50
59
  name2
51
60
  )} = gql\`
52
- mutation Create${name2}Mutation($data: Create${name2}!) {
53
- create${name2}(data: $data) { id }
61
+ mutation Create${name2}Mutation(${variables}) {
62
+ create${name2}(${mutationArgs}) { id }
54
63
  }
55
64
  \`;`
56
65
  );
57
66
  }
58
67
  if (updatable) {
68
+ const extraArgs = updatable !== true && updatable.args ? updatable.args : [];
69
+ const variables = extraArgs.length ? `$id: ID!, $data: Update${name2}!, ${argsToVariables(extraArgs)}` : `$id: ID!, $data: Update${name2}!`;
70
+ const mutationArgs = extraArgs.length ? `where: { id: $id }, data: $data, ${argsToMutationArgs(extraArgs)}` : `where: { id: $id }, data: $data`;
59
71
  parts.push(
60
72
  `export const UPDATE_${constantCase(
61
73
  name2
62
74
  )} = gql\`
63
- mutation Update${name2}Mutation($id: ID!, $data: Update${name2}!) {
64
- update${name2}(where: { id: $id }, data: $data) { id }
75
+ mutation Update${name2}Mutation(${variables}) {
76
+ update${name2}(${mutationArgs}) { id }
65
77
  }
66
78
  \`;`
67
79
  );
@@ -1884,11 +1896,7 @@ var MigrationGenerator = class _MigrationGenerator {
1884
1896
  }
1885
1897
  return -1;
1886
1898
  }
1887
- static TRIGGER_EVENT_ORDER = [
1888
- "INSERT",
1889
- "UPDATE",
1890
- "DELETE"
1891
- ];
1899
+ static TRIGGER_EVENT_ORDER = ["INSERT", "UPDATE", "DELETE"];
1892
1900
  static sortTriggerEvents(events) {
1893
1901
  return [...events].sort(
1894
1902
  (a, b) => _MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(a) - _MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(b)
@@ -1896,7 +1904,9 @@ var MigrationGenerator = class _MigrationGenerator {
1896
1904
  }
1897
1905
  normalizeTriggerDef(def) {
1898
1906
  let s = def.replace(/\s+/g, " ").replace(/\s*\(\s*/g, "(").replace(/\s*\)\s*/g, ")").replace(/\bON\s+[a-zA-Z_][a-zA-Z0-9_]*\./gi, "ON ").trim();
1899
- const eventsMatch = s.match(/\b(AFTER|BEFORE)\s+((?:INSERT|UPDATE|DELETE)(?:\s+OR\s+(?:INSERT|UPDATE|DELETE))+)\s+ON\b/i);
1907
+ const eventsMatch = s.match(
1908
+ /\b(AFTER|BEFORE)\s+((?:INSERT|UPDATE|DELETE)(?:\s+OR\s+(?:INSERT|UPDATE|DELETE))+)\s+ON\b/i
1909
+ );
1900
1910
  if (eventsMatch) {
1901
1911
  const events = eventsMatch[2].split(/\s+OR\s+/).map((e) => e.toUpperCase());
1902
1912
  const sorted = [...events].sort(
@@ -307,27 +307,39 @@ var gql = (chunks, ...variables) => {
307
307
  // src/client/mutations.ts
308
308
  var import_upperCase = __toESM(require("lodash/upperCase"), 1);
309
309
  var constantCase = (str) => (0, import_upperCase.default)(str).replace(/ /g, "_");
310
+ var argTypeStr = (field) => {
311
+ const base = field.list ? `[${field.type}!]` : field.type;
312
+ return field.nonNull ? `${base}!` : base;
313
+ };
314
+ var argsToVariables = (args2) => args2.map((a) => `$${a.name}: ${argTypeStr(a)}`).join(", ");
315
+ var argsToMutationArgs = (args2) => args2.map((a) => `${a.name}: $${a.name}`).join(", ");
310
316
  var generateMutations = (models) => {
311
317
  const parts = [];
312
318
  for (const { name: name2, creatable, updatable, deletable } of models.entities.filter(not(isRootModel))) {
313
319
  if (creatable) {
320
+ const extraArgs = creatable !== true && creatable.args ? creatable.args : [];
321
+ const variables = extraArgs.length ? `$data: Create${name2}!, ${argsToVariables(extraArgs)}` : `$data: Create${name2}!`;
322
+ const mutationArgs = extraArgs.length ? `data: $data, ${argsToMutationArgs(extraArgs)}` : `data: $data`;
314
323
  parts.push(
315
324
  `export const CREATE_${constantCase(
316
325
  name2
317
326
  )} = gql\`
318
- mutation Create${name2}Mutation($data: Create${name2}!) {
319
- create${name2}(data: $data) { id }
327
+ mutation Create${name2}Mutation(${variables}) {
328
+ create${name2}(${mutationArgs}) { id }
320
329
  }
321
330
  \`;`
322
331
  );
323
332
  }
324
333
  if (updatable) {
334
+ const extraArgs = updatable !== true && updatable.args ? updatable.args : [];
335
+ const variables = extraArgs.length ? `$id: ID!, $data: Update${name2}!, ${argsToVariables(extraArgs)}` : `$id: ID!, $data: Update${name2}!`;
336
+ const mutationArgs = extraArgs.length ? `where: { id: $id }, data: $data, ${argsToMutationArgs(extraArgs)}` : `where: { id: $id }, data: $data`;
325
337
  parts.push(
326
338
  `export const UPDATE_${constantCase(
327
339
  name2
328
340
  )} = gql\`
329
- mutation Update${name2}Mutation($id: ID!, $data: Update${name2}!) {
330
- update${name2}(where: { id: $id }, data: $data) { id }
341
+ mutation Update${name2}Mutation(${variables}) {
342
+ update${name2}(${mutationArgs}) { id }
331
343
  }
332
344
  \`;`
333
345
  );
@@ -2337,30 +2349,31 @@ var mutationResolver = async (_parent, args2, partialCtx, info) => withTransacti
2337
2349
  const [, mutation, modelName] = it(info.fieldName.match(/^(create|update|delete|restore)(.+)$/));
2338
2350
  switch (mutation) {
2339
2351
  case "create": {
2340
- const id = await createEntity(modelName, args2.data, { ...ctx, args: args2 }, "mutation");
2352
+ const id = await createEntity(modelName, args2.data, ctx, { trigger: "mutation", args: args2 });
2341
2353
  return await resolve(ctx, id);
2342
2354
  }
2343
2355
  case "update": {
2344
2356
  const id = args2.where.id;
2345
- await updateEntity(modelName, id, args2.data, { ...ctx, args: args2 }, "mutation");
2357
+ await updateEntity(modelName, id, args2.data, ctx, { trigger: "mutation", args: args2 });
2346
2358
  return await resolve(ctx, id);
2347
2359
  }
2348
2360
  case "delete": {
2349
2361
  const id = args2.where.id;
2350
2362
  await deleteEntity(modelName, id, ctx, {
2351
2363
  dryRun: args2.dryRun,
2352
- trigger: "mutation"
2364
+ trigger: "mutation",
2365
+ args: args2
2353
2366
  });
2354
2367
  return id;
2355
2368
  }
2356
2369
  case "restore": {
2357
2370
  const id = args2.where.id;
2358
- await restoreEntity(modelName, id, ctx, "mutation");
2371
+ await restoreEntity(modelName, id, ctx, { trigger: "mutation", args: args2 });
2359
2372
  return id;
2360
2373
  }
2361
2374
  }
2362
2375
  });
2363
- var createEntity = async (modelName, input2, ctx, trigger = "direct-call") => withTransaction(ctx, async (ctx2) => {
2376
+ var createEntity = async (modelName, input2, ctx, { args: args2, trigger = "direct-call" } = {}) => withTransaction(ctx, async (ctx2) => {
2364
2377
  const model = ctx2.models.getModel(modelName, "entity");
2365
2378
  const normalizedInput = { ...input2 };
2366
2379
  if (!normalizedInput.id) {
@@ -2384,7 +2397,7 @@ var createEntity = async (modelName, input2, ctx, trigger = "direct-call") => wi
2384
2397
  trigger,
2385
2398
  when: "before",
2386
2399
  data: { prev: {}, input: input2, normalizedInput, next: normalizedInput },
2387
- args: ctx2.args ?? {},
2400
+ args: args2,
2388
2401
  ctx: ctx2
2389
2402
  });
2390
2403
  if (model.parent) {
@@ -2417,18 +2430,18 @@ var createEntity = async (modelName, input2, ctx, trigger = "direct-call") => wi
2417
2430
  trigger,
2418
2431
  when: "after",
2419
2432
  data: { prev: {}, input: input2, normalizedInput, next: normalizedInput },
2420
- args: ctx2.args ?? {},
2433
+ args: args2,
2421
2434
  ctx: ctx2
2422
2435
  });
2423
2436
  return normalizedInput.id;
2424
2437
  });
2425
- var updateEntities = async (modelName, where, updateFields, ctx) => withTransaction(ctx, async (ctx2) => {
2438
+ var updateEntities = async (modelName, where, updateFields, ctx, { args: args2 } = {}) => withTransaction(ctx, async (ctx2) => {
2426
2439
  const entities = await ctx2.knex(modelName).where(where).select("id");
2427
2440
  for (const entity of entities) {
2428
- await updateEntity(modelName, entity.id, updateFields, ctx2);
2441
+ await updateEntity(modelName, entity.id, updateFields, ctx2, args2);
2429
2442
  }
2430
2443
  });
2431
- var updateEntity = async (modelName, id, input2, ctx, trigger = "direct-call") => withTransaction(ctx, async (ctx2) => {
2444
+ var updateEntity = async (modelName, id, input2, ctx, { args: args2, trigger = "direct-call" } = {}) => withTransaction(ctx, async (ctx2) => {
2432
2445
  const model = ctx2.models.getModel(modelName, "entity");
2433
2446
  const normalizedInput = { ...input2 };
2434
2447
  sanitize(ctx2, model, normalizedInput);
@@ -2446,7 +2459,7 @@ var updateEntity = async (modelName, id, input2, ctx, trigger = "direct-call") =
2446
2459
  trigger,
2447
2460
  when: "before",
2448
2461
  data: { prev: currentEntity, input: input2, normalizedInput, next: { ...currentEntity, ...normalizedInput } },
2449
- args: ctx2.args ?? {},
2462
+ args: args2,
2450
2463
  ctx: ctx2
2451
2464
  });
2452
2465
  await doUpdate(model, currentEntity, normalizedInput, ctx2);
@@ -2456,16 +2469,17 @@ var updateEntity = async (modelName, id, input2, ctx, trigger = "direct-call") =
2456
2469
  trigger,
2457
2470
  when: "after",
2458
2471
  data: { prev: currentEntity, input: input2, normalizedInput, next: { ...currentEntity, ...normalizedInput } },
2459
- args: ctx2.args ?? {},
2472
+ args: args2,
2460
2473
  ctx: ctx2
2461
2474
  });
2462
2475
  }
2463
2476
  });
2464
- var deleteEntities = async (modelName, where, ctx) => withTransaction(ctx, async (ctx2) => {
2477
+ var deleteEntities = async (modelName, where, ctx, args2) => withTransaction(ctx, async (ctx2) => {
2465
2478
  const entities = await ctx2.knex(modelName).where(where).select("id");
2466
2479
  for (const entity of entities) {
2467
2480
  await deleteEntity(modelName, entity.id, ctx2, {
2468
- trigger: "direct-call"
2481
+ trigger: "direct-call",
2482
+ args: args2
2469
2483
  });
2470
2484
  }
2471
2485
  });
@@ -2486,7 +2500,7 @@ var deleteEntity = async (modelName, id, ctx, {
2486
2500
  const mutations = [];
2487
2501
  const afterHooks = [];
2488
2502
  const mutationHook = ctx2.mutationHook;
2489
- const deleteCascade = async (currentModel, currentEntity, currentTrigger) => {
2503
+ const deleteCascade = async (currentModel, currentEntity, currentTrigger, args2) => {
2490
2504
  if (!(currentModel.name in toDelete)) {
2491
2505
  toDelete[currentModel.name] = {};
2492
2506
  }
@@ -2510,6 +2524,7 @@ var deleteEntity = async (modelName, id, ctx, {
2510
2524
  trigger: currentTrigger,
2511
2525
  when: "before",
2512
2526
  data: { prev: currentEntity, input: {}, normalizedInput, next: { ...currentEntity, ...normalizedInput } },
2527
+ args: args2,
2513
2528
  ctx: ctx2
2514
2529
  });
2515
2530
  });
@@ -2525,6 +2540,7 @@ var deleteEntity = async (modelName, id, ctx, {
2525
2540
  trigger: currentTrigger,
2526
2541
  when: "after",
2527
2542
  data: { prev: currentEntity, input: {}, normalizedInput, next: { ...currentEntity, ...normalizedInput } },
2543
+ args: args2,
2528
2544
  ctx: ctx2
2529
2545
  });
2530
2546
  });
@@ -2565,6 +2581,7 @@ var deleteEntity = async (modelName, id, ctx, {
2565
2581
  trigger: "set-null",
2566
2582
  when: "before",
2567
2583
  data: { prev: descendant, input: {}, normalizedInput, next: { ...descendant, ...normalizedInput } },
2584
+ args: args2,
2568
2585
  ctx: ctx2
2569
2586
  });
2570
2587
  });
@@ -2580,6 +2597,7 @@ var deleteEntity = async (modelName, id, ctx, {
2580
2597
  trigger: "set-null",
2581
2598
  when: "after",
2582
2599
  data: { prev: descendant, input: {}, normalizedInput, next: { ...descendant, ...normalizedInput } },
2600
+ args: args2,
2583
2601
  ctx: ctx2
2584
2602
  });
2585
2603
  });
@@ -2646,7 +2664,7 @@ var deleteEntity = async (modelName, id, ctx, {
2646
2664
  });
2647
2665
  }
2648
2666
  });
2649
- var restoreEntity = async (modelName, id, ctx, trigger = "direct-call") => withTransaction(ctx, async (ctx2) => {
2667
+ var restoreEntity = async (modelName, id, ctx, { args: args2, trigger = "direct-call" } = {}) => withTransaction(ctx, async (ctx2) => {
2650
2668
  const model = ctx2.models.getModel(modelName, "entity");
2651
2669
  const rootModel = model.rootModel;
2652
2670
  const entity = await getEntityToMutate(ctx2, rootModel, { id }, "RESTORE");
@@ -2691,6 +2709,7 @@ var restoreEntity = async (modelName, id, ctx, trigger = "direct-call") => withT
2691
2709
  trigger: currentTrigger,
2692
2710
  when: "before",
2693
2711
  data: { prev: currentEntity, input: {}, normalizedInput, next: { ...currentEntity, ...normalizedInput } },
2712
+ args: args2,
2694
2713
  ctx: ctx2
2695
2714
  });
2696
2715
  });
@@ -2721,6 +2740,7 @@ var restoreEntity = async (modelName, id, ctx, trigger = "direct-call") => withT
2721
2740
  trigger: currentTrigger,
2722
2741
  when: "after",
2723
2742
  data: { prev: currentEntity, input: {}, normalizedInput, next: { ...currentEntity, ...normalizedInput } },
2743
+ args: args2,
2724
2744
  ctx: ctx2
2725
2745
  });
2726
2746
  });
@@ -3903,11 +3923,7 @@ var MigrationGenerator = class _MigrationGenerator {
3903
3923
  }
3904
3924
  return -1;
3905
3925
  }
3906
- static TRIGGER_EVENT_ORDER = [
3907
- "INSERT",
3908
- "UPDATE",
3909
- "DELETE"
3910
- ];
3926
+ static TRIGGER_EVENT_ORDER = ["INSERT", "UPDATE", "DELETE"];
3911
3927
  static sortTriggerEvents(events) {
3912
3928
  return [...events].sort(
3913
3929
  (a, b) => _MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(a) - _MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(b)
@@ -3915,7 +3931,9 @@ var MigrationGenerator = class _MigrationGenerator {
3915
3931
  }
3916
3932
  normalizeTriggerDef(def) {
3917
3933
  let s = def.replace(/\s+/g, " ").replace(/\s*\(\s*/g, "(").replace(/\s*\)\s*/g, ")").replace(/\bON\s+[a-zA-Z_][a-zA-Z0-9_]*\./gi, "ON ").trim();
3918
- const eventsMatch = s.match(/\b(AFTER|BEFORE)\s+((?:INSERT|UPDATE|DELETE)(?:\s+OR\s+(?:INSERT|UPDATE|DELETE))+)\s+ON\b/i);
3934
+ const eventsMatch = s.match(
3935
+ /\b(AFTER|BEFORE)\s+((?:INSERT|UPDATE|DELETE)(?:\s+OR\s+(?:INSERT|UPDATE|DELETE))+)\s+ON\b/i
3936
+ );
3919
3937
  if (eventsMatch) {
3920
3938
  const events = eventsMatch[2].split(/\s+OR\s+/).map((e) => e.toUpperCase());
3921
3939
  const sorted = [...events].sort(
@@ -1,14 +1,30 @@
1
1
  import upperCase from 'lodash/upperCase';
2
2
  import { isRootModel, not } from '..';
3
3
  const constantCase = (str) => upperCase(str).replace(/ /g, '_');
4
+ const argTypeStr = (field) => {
5
+ const base = field.list ? `[${field.type}!]` : field.type;
6
+ return field.nonNull ? `${base}!` : base;
7
+ };
8
+ const argsToVariables = (args) => args.map((a) => `$${a.name}: ${argTypeStr(a)}`).join(', ');
9
+ const argsToMutationArgs = (args) => args.map((a) => `${a.name}: $${a.name}`).join(', ');
4
10
  export const generateMutations = (models) => {
5
11
  const parts = [];
6
12
  for (const { name, creatable, updatable, deletable } of models.entities.filter(not(isRootModel))) {
7
13
  if (creatable) {
8
- parts.push(`export const CREATE_${constantCase(name)} = gql\`\n mutation Create${name}Mutation($data: Create${name}!) {\n create${name}(data: $data) { id }\n }\n\`;`);
14
+ const extraArgs = creatable !== true && creatable.args ? creatable.args : [];
15
+ const variables = extraArgs.length ? `$data: Create${name}!, ${argsToVariables(extraArgs)}` : `$data: Create${name}!`;
16
+ const mutationArgs = extraArgs.length ? `data: $data, ${argsToMutationArgs(extraArgs)}` : `data: $data`;
17
+ parts.push(`export const CREATE_${constantCase(name)} = gql\`\n mutation Create${name}Mutation(${variables}) {\n create${name}(${mutationArgs}) { id }\n }\n\`;`);
9
18
  }
10
19
  if (updatable) {
11
- parts.push(`export const UPDATE_${constantCase(name)} = gql\`\n mutation Update${name}Mutation($id: ID!, $data: Update${name}!) {\n update${name}(where: { id: $id }, data: $data) { id }\n }\n\`;`);
20
+ const extraArgs = updatable !== true && updatable.args ? updatable.args : [];
21
+ const variables = extraArgs.length
22
+ ? `$id: ID!, $data: Update${name}!, ${argsToVariables(extraArgs)}`
23
+ : `$id: ID!, $data: Update${name}!`;
24
+ const mutationArgs = extraArgs.length
25
+ ? `where: { id: $id }, data: $data, ${argsToMutationArgs(extraArgs)}`
26
+ : `where: { id: $id }, data: $data`;
27
+ parts.push(`export const UPDATE_${constantCase(name)} = gql\`\n mutation Update${name}Mutation(${variables}) {\n update${name}(${mutationArgs}) { id }\n }\n\`;`);
12
28
  }
13
29
  if (deletable) {
14
30
  parts.push(`export const DELETE_${constantCase(name)} = gql\`\n mutation Delete${name}Mutation($id: ID!) {\n delete${name}(where: { id: $id })\n }\n\`;`);
@@ -1 +1 @@
1
-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;QACJ,CAAC;QAED,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,CAAC,IAAI,CACR,uBAAuB,YAAY,CACjC,IAAI,CACL,8BAA8B,IAAI,mCAAmC,IAAI,gCAAgC,CAC3G,CAAC;YAEF,KAAK,CAAC,IAAI,CACR,wBAAwB,YAAY,CAClC,IAAI,CACL,+BAA+B,IAAI,oCAAoC,IAAI,gCAAgC,CAC7G,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,mCAAmC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACjE,CAAC,CAAC"}
@@ -801,14 +801,9 @@ export class MigrationGenerator {
801
801
  }
802
802
  return -1;
803
803
  }
804
- static TRIGGER_EVENT_ORDER = [
805
- 'INSERT',
806
- 'UPDATE',
807
- 'DELETE',
808
- ];
804
+ static TRIGGER_EVENT_ORDER = ['INSERT', 'UPDATE', 'DELETE'];
809
805
  static sortTriggerEvents(events) {
810
- return [...events].sort((a, b) => MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(a) -
811
- MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(b));
806
+ return [...events].sort((a, b) => MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(a) - MigrationGenerator.TRIGGER_EVENT_ORDER.indexOf(b));
812
807
  }
813
808
  normalizeTriggerDef(def) {
814
809
  let s = def