@memberjunction/cli 6.2.0-edge.2 → 6.2.0-edge.4

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 (124) hide show
  1. package/README.md +9 -0
  2. package/dist/commands/artifacts/reclassify.d.ts.map +1 -1
  3. package/dist/commands/artifacts/reclassify.js +4 -2
  4. package/dist/commands/artifacts/reclassify.js.map +1 -1
  5. package/dist/commands/cache/clear.d.ts +25 -0
  6. package/dist/commands/cache/clear.d.ts.map +1 -0
  7. package/dist/commands/cache/clear.js +79 -0
  8. package/dist/commands/cache/clear.js.map +1 -0
  9. package/dist/commands/cache/usage.d.ts +7 -0
  10. package/dist/commands/cache/usage.d.ts.map +1 -0
  11. package/dist/commands/cache/usage.js +10 -0
  12. package/dist/commands/cache/usage.js.map +1 -0
  13. package/dist/commands/codegen/index.d.ts +15 -6
  14. package/dist/commands/codegen/index.d.ts.map +1 -1
  15. package/dist/commands/codegen/index.js +35 -4
  16. package/dist/commands/codegen/index.js.map +1 -1
  17. package/dist/commands/install/index.d.ts.map +1 -1
  18. package/dist/commands/install/index.js +7 -1
  19. package/dist/commands/install/index.js.map +1 -1
  20. package/dist/commands/migrate/index.d.ts +10 -0
  21. package/dist/commands/migrate/index.d.ts.map +1 -1
  22. package/dist/commands/migrate/index.js +42 -0
  23. package/dist/commands/migrate/index.js.map +1 -1
  24. package/dist/commands/queue/backlog.d.ts +11 -0
  25. package/dist/commands/queue/backlog.d.ts.map +1 -0
  26. package/dist/commands/queue/backlog.js +32 -0
  27. package/dist/commands/queue/backlog.js.map +1 -0
  28. package/dist/commands/queue/dead-letters.d.ts +13 -0
  29. package/dist/commands/queue/dead-letters.d.ts.map +1 -0
  30. package/dist/commands/queue/dead-letters.js +35 -0
  31. package/dist/commands/queue/dead-letters.js.map +1 -0
  32. package/dist/commands/queue/discard.d.ts +12 -0
  33. package/dist/commands/queue/discard.d.ts.map +1 -0
  34. package/dist/commands/queue/discard.js +45 -0
  35. package/dist/commands/queue/discard.js.map +1 -0
  36. package/dist/commands/queue/export-topology.d.ts +12 -0
  37. package/dist/commands/queue/export-topology.d.ts.map +1 -0
  38. package/dist/commands/queue/export-topology.js +40 -0
  39. package/dist/commands/queue/export-topology.js.map +1 -0
  40. package/dist/commands/queue/import-bindings.d.ts +14 -0
  41. package/dist/commands/queue/import-bindings.d.ts.map +1 -0
  42. package/dist/commands/queue/import-bindings.js +41 -0
  43. package/dist/commands/queue/import-bindings.js.map +1 -0
  44. package/dist/commands/queue/index.d.ts +7 -0
  45. package/dist/commands/queue/index.d.ts.map +1 -0
  46. package/dist/commands/queue/index.js +25 -0
  47. package/dist/commands/queue/index.js.map +1 -0
  48. package/dist/commands/queue/partitions.d.ts +14 -0
  49. package/dist/commands/queue/partitions.d.ts.map +1 -0
  50. package/dist/commands/queue/partitions.js +36 -0
  51. package/dist/commands/queue/partitions.js.map +1 -0
  52. package/dist/commands/queue/publish.d.ts +35 -0
  53. package/dist/commands/queue/publish.d.ts.map +1 -0
  54. package/dist/commands/queue/publish.js +94 -0
  55. package/dist/commands/queue/publish.js.map +1 -0
  56. package/dist/commands/queue/replay.d.ts +12 -0
  57. package/dist/commands/queue/replay.d.ts.map +1 -0
  58. package/dist/commands/queue/replay.js +42 -0
  59. package/dist/commands/queue/replay.js.map +1 -0
  60. package/dist/commands/queue/stats.d.ts +11 -0
  61. package/dist/commands/queue/stats.d.ts.map +1 -0
  62. package/dist/commands/queue/stats.js +35 -0
  63. package/dist/commands/queue/stats.js.map +1 -0
  64. package/dist/commands/queue/usage.d.ts +7 -0
  65. package/dist/commands/queue/usage.d.ts.map +1 -0
  66. package/dist/commands/queue/usage.js +10 -0
  67. package/dist/commands/queue/usage.js.map +1 -0
  68. package/dist/commands/queue/validate-bindings.d.ts +12 -0
  69. package/dist/commands/queue/validate-bindings.d.ts.map +1 -0
  70. package/dist/commands/queue/validate-bindings.js +37 -0
  71. package/dist/commands/queue/validate-bindings.js.map +1 -0
  72. package/dist/commands/queue/work.d.ts +20 -0
  73. package/dist/commands/queue/work.d.ts.map +1 -0
  74. package/dist/commands/queue/work.js +77 -0
  75. package/dist/commands/queue/work.js.map +1 -0
  76. package/dist/commands/rubric/evaluate.d.ts +3 -0
  77. package/dist/commands/rubric/evaluate.d.ts.map +1 -1
  78. package/dist/commands/rubric/evaluate.js +9 -2
  79. package/dist/commands/rubric/evaluate.js.map +1 -1
  80. package/dist/commands/sync/push.d.ts +33 -8
  81. package/dist/commands/sync/push.d.ts.map +1 -1
  82. package/dist/commands/sync/push.js +94 -6
  83. package/dist/commands/sync/push.js.map +1 -1
  84. package/dist/commands/user/clone.d.ts +27 -0
  85. package/dist/commands/user/clone.d.ts.map +1 -0
  86. package/dist/commands/user/clone.js +106 -0
  87. package/dist/commands/user/clone.js.map +1 -0
  88. package/dist/hooks/postrun.d.ts +1 -1
  89. package/dist/hooks/prerun.d.ts.map +1 -1
  90. package/dist/hooks/prerun.js +9 -0
  91. package/dist/hooks/prerun.js.map +1 -1
  92. package/dist/lib/domain-profiles.d.ts.map +1 -1
  93. package/dist/lib/domain-profiles.js +8 -0
  94. package/dist/lib/domain-profiles.js.map +1 -1
  95. package/dist/lib/keep-awake.d.ts +45 -0
  96. package/dist/lib/keep-awake.d.ts.map +1 -0
  97. package/dist/lib/keep-awake.js +71 -0
  98. package/dist/lib/keep-awake.js.map +1 -0
  99. package/dist/lib/shared-cache.d.ts +84 -0
  100. package/dist/lib/shared-cache.d.ts.map +1 -0
  101. package/dist/lib/shared-cache.js +160 -0
  102. package/dist/lib/shared-cache.js.map +1 -0
  103. package/dist/lib/work-queue/queue-format.d.ts +17 -0
  104. package/dist/lib/work-queue/queue-format.d.ts.map +1 -0
  105. package/dist/lib/work-queue/queue-format.js +125 -0
  106. package/dist/lib/work-queue/queue-format.js.map +1 -0
  107. package/dist/lib/work-queue/queue-session.d.ts +9 -0
  108. package/dist/lib/work-queue/queue-session.d.ts.map +1 -0
  109. package/dist/lib/work-queue/queue-session.js +8 -0
  110. package/dist/lib/work-queue/queue-session.js.map +1 -0
  111. package/dist/lib/work-queue/queue-worker.d.ts +24 -0
  112. package/dist/lib/work-queue/queue-worker.d.ts.map +1 -0
  113. package/dist/lib/work-queue/queue-worker.js +50 -0
  114. package/dist/lib/work-queue/queue-worker.js.map +1 -0
  115. package/dist/light-commands.d.ts +8 -0
  116. package/dist/light-commands.d.ts.map +1 -1
  117. package/dist/light-commands.js +36 -0
  118. package/dist/light-commands.js.map +1 -1
  119. package/dist/utils/open-app-context.d.ts +6 -0
  120. package/dist/utils/open-app-context.d.ts.map +1 -1
  121. package/dist/utils/open-app-context.js +3 -3
  122. package/dist/utils/open-app-context.js.map +1 -1
  123. package/oclif.manifest.json +2041 -1155
  124. package/package.json +29 -25
@@ -0,0 +1,106 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import chalk from 'chalk';
3
+ import { CompositeKey, RunView } from '@memberjunction/core';
4
+ import { RecordCloneEngine } from '@memberjunction/record-cloning';
5
+ import { BuildContextUser, EnsureProviderInitialized } from '../../utils/open-app-context.js';
6
+ /**
7
+ * CLI command: `mj user clone`.
8
+ *
9
+ * Creates a new user as a copy of an existing one through the `MJ: Users` clone configuration. From a
10
+ * template user (IsTemplate) the default `template` preset copies everything the template was set up
11
+ * with, dashboards and conversations included; from an ordinary user, choose one of the other presets.
12
+ * Runs as the system user, so it needs no sign-in; it is meant for administrators and install scripts
13
+ * (an app's post-install hook pre-provisions the person who will sign in).
14
+ */
15
+ export default class UserClone extends Command {
16
+ static { this.description = 'Create a user as a copy of another (a template user by default)'; }
17
+ static { this.examples = [
18
+ '<%= config.bin %> user clone --from demo.user@example.org --email jane@example.com --first Jane --last Doe',
19
+ '<%= config.bin %> user clone --from alice@example.com --email bob@example.com --first Bob --last Lee --preset with-settings',
20
+ '<%= config.bin %> user clone --from demo.user@example.org --email jane@example.com --first Jane --last Doe --dry-run',
21
+ ]; }
22
+ static { this.flags = {
23
+ from: Flags.string({ description: 'Email of the user to copy', required: true }),
24
+ email: Flags.string({ description: 'Email of the new user (the identity they sign in with)', required: true }),
25
+ first: Flags.string({ description: 'First name of the new user', required: true }),
26
+ last: Flags.string({ description: 'Last name of the new user', required: true }),
27
+ preset: Flags.string({
28
+ description: "MJ: Users clone preset: 'template' (template users only), 'with-views', 'with-settings', or none for the base copy",
29
+ default: 'template',
30
+ }),
31
+ inactive: Flags.boolean({ description: 'Leave the new user inactive for review instead of activating it', default: false }),
32
+ 'dry-run': Flags.boolean({ description: 'Show what would be copied without creating anything', default: false }),
33
+ }; }
34
+ async run() {
35
+ const { flags } = await this.parse(UserClone);
36
+ try {
37
+ const provider = await EnsureProviderInitialized();
38
+ const contextUser = await BuildContextUser();
39
+ const source = await this.findUser(flags.from, contextUser);
40
+ if (!source)
41
+ this.error(`No user has the email ${flags.from}.`);
42
+ if (await this.findUser(flags.email, contextUser)) {
43
+ this.error(`A user with the email ${flags.email} already exists. Cloning creates a new user; choose another email.`);
44
+ }
45
+ const preset = flags.preset === 'none' ? undefined : flags.preset;
46
+ if (preset === 'template' && !source.IsTemplate) {
47
+ this.error(`${flags.from} is not a template user. Mark it IsTemplate, or pass --preset with-views, with-settings or none.`);
48
+ }
49
+ const result = await new RecordCloneEngine(provider).Clone({
50
+ EntityName: 'MJ: Users',
51
+ SourceRecordKey: CompositeKey.FromID(source.ID),
52
+ Preset: preset,
53
+ PromptedValues: { Email: flags.email, FirstName: flags.first, LastName: flags.last },
54
+ Options: { DryRun: flags['dry-run'], Reason: `mj user clone from ${flags.from}` },
55
+ }, contextUser);
56
+ for (const w of result.Warnings.filter((w) => w.Severity !== 'Info')) {
57
+ this.log(chalk[w.Severity === 'Error' ? 'red' : 'yellow'](` ${w.Severity}: ${w.Message}`));
58
+ }
59
+ if (!result.Success) {
60
+ this.error(`Clone ${result.ResultCode === 'BLOCKED' ? 'was blocked' : 'failed'}${result.ErrorMessage ? `: ${result.ErrorMessage}` : ''}.`);
61
+ }
62
+ // A dry run reports the plan's counts; a real run, the rows it actually created.
63
+ const byEntity = new Map();
64
+ if (flags['dry-run']) {
65
+ for (const [entity, counts] of Object.entries(result.Counts?.ByEntity ?? {}))
66
+ byEntity.set(entity, counts.Create);
67
+ }
68
+ else {
69
+ for (const row of result.Created ?? [])
70
+ byEntity.set(row.EntityName, (byEntity.get(row.EntityName) ?? 0) + 1);
71
+ }
72
+ this.log(chalk.bold(flags['dry-run'] ? '\nWould copy:' : '\nCopied:'));
73
+ for (const [entity, count] of byEntity) {
74
+ if (count > 0)
75
+ this.log(` ${String(count).padStart(5)} ${entity}`);
76
+ }
77
+ if (flags['dry-run'])
78
+ return;
79
+ const newID = result.Roots?.[0]?.TargetKey.KeyValuePairs.find((kvp) => kvp.FieldName === 'ID')?.Value;
80
+ if (!flags.inactive && newID) {
81
+ const user = await provider.GetEntityObject('MJ: Users', contextUser);
82
+ if (!(await user.Load(String(newID))))
83
+ this.error(`The new user ${flags.email} was created but could not be loaded to activate it.`);
84
+ user.IsActive = true;
85
+ if (!(await user.Save()))
86
+ this.error(`The new user ${flags.email} was created but not activated: ${user.LatestResult?.CompleteMessage ?? 'unknown error'}`);
87
+ }
88
+ this.log(chalk.green(`\n✓ Created ${flags.email} from ${flags.from}${flags.inactive ? ' (inactive: activate it after review)' : ''}.`));
89
+ }
90
+ catch (error) {
91
+ this.error(error instanceof Error ? error.message : String(error));
92
+ }
93
+ }
94
+ /** The user with this email, if any. */
95
+ async findUser(email, contextUser) {
96
+ const result = await new RunView().RunView({
97
+ EntityName: 'MJ: Users',
98
+ ExtraFilter: `Email = '${email.replace(/'/g, "''")}'`,
99
+ Fields: ['ID', 'Email', 'IsTemplate'],
100
+ ResultType: 'simple',
101
+ MaxRows: 1,
102
+ }, contextUser);
103
+ return result.Success ? result.Results[0] : undefined;
104
+ }
105
+ }
106
+ //# sourceMappingURL=clone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone.js","sourceRoot":"","sources":["../../../src/commands/user/clone.ts"],"names":[],"mappings":"AAAA,OAAO,EA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mC,IAAI,CAAC,YAAY,EAAE,eAAe,IAAI,eAAe,EAAE,CAAC,CAAC;YAC9J,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,KAAK,CAAC,KAAK,SAAS,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC1I,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED,wCAAwC;IAChC,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,WAAqB;QACzD,MAAM,MAAM,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC,OAAO,CACxC;YACE,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,YAAY,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG;YACrD,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC;YACrC,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,CAAC;SACX,EACD,WAAW,CACZ,CAAC;QACF,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxD,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * Cleanup hook that runs after any command completes.
3
3
  *
4
4
  * Only `mj app *` commands open an mssql connection pool (through
5
- * `ensureProviderInitialized` in utils/open-app-context.ts). The pool keeps
5
+ * `EnsureProviderInitialized` in utils/open-app-context.ts). The pool keeps
6
6
  * sockets alive, which pins the Node event loop open and makes the CLI appear
7
7
  * to hang after the command finishes printing its output — so for those
8
8
  * commands we close it here.
@@ -1 +1 @@
1
- {"version":3,"file":"prerun.d.ts","sourceRoot":"","sources":["../../src/hooks/prerun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAKnC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AA6BnE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,QAAQ,CAqFxB,CAAC;AA0BF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"prerun.d.ts","sourceRoot":"","sources":["../../src/hooks/prerun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAOnC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AA6BnE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,QAAQ,CA6FxB,CAAC;AA0BF,eAAe,IAAI,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import figlet from 'figlet';
2
2
  import { INTERACTIVE_ENV, ResolveOutputFormat, ShouldSuppressChrome } from '@memberjunction/cli-core';
3
3
  import { LIGHT_COMMANDS } from '../light-commands.js';
4
+ import chalk from 'chalk';
5
+ import { KeepAwakeForCommand, SleepNoticeForCommand } from '../lib/keep-awake.js';
4
6
  /**
5
7
  * Mirror of `DYNAMIC_PACKAGES_MODE_ENV_VAR` from @memberjunction/dynamic-packages, inlined so
6
8
  * LIGHT commands (version, help, migrate, …) do not pay for that package — and its cosmiconfig
@@ -35,6 +37,8 @@ function readFormatArg(argv) {
35
37
  }
36
38
  const hook = async function (options) {
37
39
  const argv = options.argv ?? [];
40
+ // Long database commands must not be interrupted by the machine sleeping — see keep-awake.ts.
41
+ const keptAwake = KeepAwakeForCommand(options.Command.id ?? '');
38
42
  // `--interactive` / `--no-interactive` override the terminal detection that decides
39
43
  // whether a command may prompt. Like `--no-banner` they must work on every command,
40
44
  // including the ~80 that don't declare them, so they are consumed here and forwarded
@@ -106,6 +110,11 @@ const hook = async function (options) {
106
110
  if (options.Command.id !== 'version' && !isUsageCommand) {
107
111
  options.context.log(options.config.userAgent + '\n');
108
112
  }
113
+ // Said once, up front, while the user is still watching. stderr, so it never mixes into output.
114
+ const sleepNotice = SleepNoticeForCommand(options.Command.id ?? '', keptAwake);
115
+ if (sleepNotice) {
116
+ process.stderr.write(chalk.yellow(`\u26a0 ${sleepNotice}\n\n`));
117
+ }
109
118
  await maybeLoadBootstrap(options, verbose);
110
119
  };
111
120
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"prerun.js","sourceRoot":"","sources":["../../src/hooks/prerun.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAEnE;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,IAAc,EAAE,IAAY;IAClD,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4FAA4F;AAC5F,SAAS,aAAa,CAAC,IAAc;IACnC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IACvD,IAAI,EAAE;Q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CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CA6FnE,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D"}
1
+ {"version":3,"file":"domain-profiles.d.ts","sourceRoot":"","sources":["../../src/lib/domain-profiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAqGnE,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAE9D"}
@@ -34,6 +34,10 @@ export const DOMAIN_PROFILES = {
34
34
  Summary: 'Run and inspect AI agents, prompts, and actions from the terminal.',
35
35
  Runtime: { class: 'variable', note: 'a listing is instant; an agent run is bounded only by the agent itself' },
36
36
  },
37
+ queue: {
38
+ Summary: 'Operate the durable work queue — stats, backlog, dead letters, replay and discard, container-job workers, cloud bindings.',
39
+ Runtime: { class: 'moderate', typicalSeconds: 15, note: 'dominated by MJ bootstrap; each operation is a few queries or cloud API calls' },
40
+ },
37
41
  app: {
38
42
  Summary: 'Install, upgrade, enable, and remove Open Apps.',
39
43
  Runtime: { class: 'slow', typicalSeconds: 180, note: 'installs run migrations and package installs' },
@@ -54,6 +58,10 @@ export const DOMAIN_PROFILES = {
54
58
  Summary: 'Bundle interactive component source for distribution.',
55
59
  Runtime: { class: 'moderate', typicalSeconds: 20 },
56
60
  },
61
+ cache: {
62
+ Summary: 'Inspect and clear the shared (Redis) server cache.',
63
+ Runtime: { class: 'fast', note: 'one SCAN per category; scales with the Redis keyspace' },
64
+ },
57
65
  clean: {
58
66
  Summary: 'Remove build artifacts and generated output.',
59
67
  Runtime: { class: 'fast' },
@@ -1 +1 @@
1
- {"version":3,"file":"domain-profiles.js","sourceRoot":"","sources":["../../src/lib/domain-profiles.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,OAAO,EAAE,qDAAqD;IAC9D,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,6CAA6C,EAAE;CACpF,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAA4C;IACtE,OAAO,EAAE;QACP,OAAO,EAAE,uEAAuE;QAChF,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,+DAA+D,EAAE;KACvH;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,mFAAmF;QAC5F,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,iEAAiE,EAAE;KACxG;IACD,GAAG,EAAE;QACH,OAAO,EAAE,+EAA+E;QACxF,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,gDAAgD,EAAE;KACvF;IACD,EAAE,EAAE;QACF,OAAO,EAAE,oEAAoE;QAC7E,OAAO,EAAE,EAAE,KAAK,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,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,EAAE,IAAI,EAAE,4CAA4C,EAAE;KACvG;IACD,KAAK,EAAE;QACL,OAAO,EAAE,uEAAuE;QAChF,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;KAC3B;CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,sBAAsB,CAAC;AAC3D,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Keeps the machine awake while a long-running database command runs.
3
+ *
4
+ * `mj install` and `mj app install` run for many minutes, and a laptop left alone in that time
5
+ * idles into sleep. Sleep pauses everything at once — the CLI, the local database (often a Docker
6
+ * VM), and every socket between them — and on wake each in-flight request's timer fires together:
7
+ * a migration batch that was doing nothing wrong reports `Timeout: Request failed to complete in
8
+ * 300000ms`, a GitHub download reports `read ECONNRESET`, and the app being installed is rolled
9
+ * back. Clean end-user installs of MJ + a multi-app Open App chain failed this way repeatedly.
10
+ *
11
+ * On macOS this holds a `caffeinate` assertion tied to the CLI's own pid, so it ends the moment
12
+ * the command does — no cleanup, nothing left behind. Elsewhere it is a no-op. Set
13
+ * {@link KEEP_AWAKE_OPT_OUT_ENV_VAR} to opt out.
14
+ *
15
+ * Either way, {@link SleepNoticeForCommand} tells the user at the start: no assertion survives
16
+ * a closed lid, and on Windows and Linux nothing holds the machine awake at all.
17
+ */
18
+ import { spawn } from 'node:child_process';
19
+ /** Set to `1` (or `true`) to let the machine sleep during long commands. */
20
+ export declare const KEEP_AWAKE_OPT_OUT_ENV_VAR = "MJ_ALLOW_SLEEP";
21
+ /** Commands long and database-bound enough that sleeping mid-run breaks them. */
22
+ export declare const KEEP_AWAKE_COMMANDS: ReadonlySet<string>;
23
+ /** The pieces of the environment this depends on, injectable for tests. */
24
+ export interface KeepAwakeEnvironment {
25
+ Platform: NodeJS.Platform;
26
+ Env: NodeJS.ProcessEnv;
27
+ Pid: number;
28
+ Spawn: typeof spawn;
29
+ }
30
+ /**
31
+ * Starts the keep-awake assertion for `commandId` when it applies.
32
+ *
33
+ * @returns true when an assertion was started. Never throws: failing to keep the machine awake
34
+ * must not fail the command it was meant to protect.
35
+ */
36
+ export declare function KeepAwakeForCommand(commandId: string, environment?: KeepAwakeEnvironment): boolean;
37
+ /**
38
+ * The one-line warning to show when a long database command starts, or `undefined` for commands
39
+ * that are not long enough to need it.
40
+ *
41
+ * @param commandId - The oclif command id.
42
+ * @param keptAwake - Whether {@link KeepAwakeForCommand} started an assertion for this run.
43
+ */
44
+ export declare function SleepNoticeForCommand(commandId: string, keptAwake: boolean): string | undefined;
45
+ //# sourceMappingURL=keep-awake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keep-awake.d.ts","sourceRoot":"","sources":["../../src/lib/keep-awake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAE3D,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAKlD,CAAC;AAEH,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB;AASD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,GAAE,oBAA0C,GAAG,OAAO,CAavH;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK/F"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Keeps the machine awake while a long-running database command runs.
3
+ *
4
+ * `mj install` and `mj app install` run for many minutes, and a laptop left alone in that time
5
+ * idles into sleep. Sleep pauses everything at once — the CLI, the local database (often a Docker
6
+ * VM), and every socket between them — and on wake each in-flight request's timer fires together:
7
+ * a migration batch that was doing nothing wrong reports `Timeout: Request failed to complete in
8
+ * 300000ms`, a GitHub download reports `read ECONNRESET`, and the app being installed is rolled
9
+ * back. Clean end-user installs of MJ + a multi-app Open App chain failed this way repeatedly.
10
+ *
11
+ * On macOS this holds a `caffeinate` assertion tied to the CLI's own pid, so it ends the moment
12
+ * the command does — no cleanup, nothing left behind. Elsewhere it is a no-op. Set
13
+ * {@link KEEP_AWAKE_OPT_OUT_ENV_VAR} to opt out.
14
+ *
15
+ * Either way, {@link SleepNoticeForCommand} tells the user at the start: no assertion survives
16
+ * a closed lid, and on Windows and Linux nothing holds the machine awake at all.
17
+ */
18
+ import { spawn } from 'node:child_process';
19
+ /** Set to `1` (or `true`) to let the machine sleep during long commands. */
20
+ export const KEEP_AWAKE_OPT_OUT_ENV_VAR = 'MJ_ALLOW_SLEEP';
21
+ /** Commands long and database-bound enough that sleeping mid-run breaks them. */
22
+ export const KEEP_AWAKE_COMMANDS = new Set([
23
+ 'install',
24
+ 'app:install',
25
+ 'app:upgrade',
26
+ 'migrate',
27
+ ]);
28
+ const DEFAULT_ENVIRONMENT = {
29
+ Platform: process.platform,
30
+ Env: process.env,
31
+ Pid: process.pid,
32
+ Spawn: spawn,
33
+ };
34
+ /**
35
+ * Starts the keep-awake assertion for `commandId` when it applies.
36
+ *
37
+ * @returns true when an assertion was started. Never throws: failing to keep the machine awake
38
+ * must not fail the command it was meant to protect.
39
+ */
40
+ export function KeepAwakeForCommand(commandId, environment = DEFAULT_ENVIRONMENT) {
41
+ if (!KEEP_AWAKE_COMMANDS.has(commandId) || environment.Platform !== 'darwin')
42
+ return false;
43
+ const optOut = (environment.Env[KEEP_AWAKE_OPT_OUT_ENV_VAR] ?? '').trim().toLowerCase();
44
+ if (optOut === '1' || optOut === 'true')
45
+ return false;
46
+ try {
47
+ // -i: no idle sleep. -s: no system sleep while on AC power. -w: exit when the CLI exits.
48
+ const child = environment.Spawn('caffeinate', ['-i', '-s', '-w', String(environment.Pid)], { stdio: 'ignore' });
49
+ child.on('error', () => undefined); // caffeinate missing or refused — carry on without it
50
+ child.unref(); // never keep the CLI alive for its sake
51
+ return true;
52
+ }
53
+ catch {
54
+ return false;
55
+ }
56
+ }
57
+ /**
58
+ * The one-line warning to show when a long database command starts, or `undefined` for commands
59
+ * that are not long enough to need it.
60
+ *
61
+ * @param commandId - The oclif command id.
62
+ * @param keptAwake - Whether {@link KeepAwakeForCommand} started an assertion for this run.
63
+ */
64
+ export function SleepNoticeForCommand(commandId, keptAwake) {
65
+ if (!KEEP_AWAKE_COMMANDS.has(commandId))
66
+ return undefined;
67
+ return keptAwake
68
+ ? 'This can take 15 minutes or more. MJ is keeping this Mac awake until it finishes, but closing the lid will still put it to sleep and can make the command fail partway.'
69
+ : "This can take 15 minutes or more. Don't let this machine sleep until it finishes: sleep pauses the database connection and can make the command fail partway.";
70
+ }
71
+ //# sourceMappingURL=keep-awake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keep-awake.js","sourceRoot":"","sources":["../../src/lib/keep-awake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE3D,iFAAiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC;IAC9D,SAAS;IACT,aAAa;IACb,aAAa;IACb,SAAS;CACV,CAAC,CAAC;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yKAAyK;QAC3K,CAAC,CAAC,+JAA+J,CAAC;AACtK,CAAC"}
@@ -0,0 +1,84 @@
1
+ import type { RedisProviderConfig, SharedCacheCategoryClear } from '@memberjunction/redis-provider';
2
+ /** Setting this to `1`/`true` disables the automatic clear (the explicit command still works). */
3
+ export declare const SKIP_CACHE_CLEAR_ENV = "MJ_SKIP_SHARED_CACHE_CLEAR";
4
+ /** What the user asked to clear, mapped onto the names the cache actually uses. */
5
+ export type ResolvedCacheCategories = {
6
+ /** Canonical category names, safe to hand to the store. */
7
+ Categories: string[];
8
+ /** Anything that matched no known category, in the spelling the user gave. */
9
+ Unknown: string[];
10
+ };
11
+ /**
12
+ * Maps requested category names onto their canonical spelling.
13
+ *
14
+ * Names are accepted case-insensitively because nobody should have to remember that it is
15
+ * `RunViewCache` and not `runviewcache`. But Redis keys ARE case-sensitive, so accepting a
16
+ * spelling and then using it verbatim scanned `{prefix}:runviewcache:*`, matched nothing, and
17
+ * reported a successful clear of 0 keys — the operator is told the fleet will reload and it never
18
+ * does. Accept the spelling, then hand the store the canonical name.
19
+ */
20
+ export declare function ResolveCacheCategories(requested: readonly string[] | undefined): ResolvedCacheCategories;
21
+ /** What a `mj migrate` run did, as far as the command can tell. */
22
+ export type MigrationOutcome = {
23
+ /** The migration engine threw instead of returning a result. */
24
+ Threw: boolean;
25
+ /** The run reported success. */
26
+ Succeeded: boolean;
27
+ /** Migrations the run reports as applied. Meaningful only on success. */
28
+ MigrationsApplied: number;
29
+ /** At least one migration began executing — the only reliable "the database may have changed". */
30
+ StartedApplying: boolean;
31
+ };
32
+ /**
33
+ * Whether a migration run may have changed the database, and so whether the fleet's cache is stale.
34
+ *
35
+ * On success the count is authoritative: a run that found nothing pending must NOT make every server
36
+ * drop its cache and reload every engine for nothing.
37
+ *
38
+ * On a failure — including one that threw rather than returning — the count is not trustworthy and
39
+ * neither is the detail list, which can be empty precisely because the run died before assembling
40
+ * it. What IS known is whether a migration started executing. DDL is not transactional across
41
+ * batches on SQL Server, so a migration that began and failed can still have committed statements;
42
+ * a run that never started one cannot have. That makes "did anything start" the honest gate: a bad
43
+ * connection string or a config error leaves the fleet alone, and anything that touched the database
44
+ * clears.
45
+ */
46
+ export declare function MigrationChangedDatabase(outcome: MigrationOutcome): boolean;
47
+ /** The category names a clear can be asked for, for error messages and help text. */
48
+ export declare function KnownCacheCategories(): string[];
49
+ /** The shared cache the environment points at, or null when none is configured. */
50
+ export interface SharedCacheTarget {
51
+ Connection: RedisProviderConfig;
52
+ /** Host, port and key prefix — never credentials. For messages. */
53
+ Description: string;
54
+ }
55
+ /** What an automatic clear did, for the command's log and result. */
56
+ export interface SharedCacheClearReport {
57
+ Ok: boolean;
58
+ Message: string;
59
+ Categories: SharedCacheCategoryClear[];
60
+ }
61
+ /** Resolves the shared cache from `REDIS_URL` / `REDIS_KEY_PREFIX`, the variables MJAPI reads. */
62
+ export declare function ResolveSharedCacheTarget(env?: NodeJS.ProcessEnv): SharedCacheTarget | null;
63
+ /** `host:port/db` of a Redis URL, without user or password. */
64
+ export declare function DescribeRedisUrl(url: string): string;
65
+ /** True when the automatic clear has been switched off by flag or environment. */
66
+ export declare function IsAutomaticClearDisabled(skipFlag: boolean | undefined, env?: NodeJS.ProcessEnv): boolean;
67
+ /**
68
+ * Clears the shared cache after `commandName` changed the database. Returns null when there is
69
+ * nothing to do (no `REDIS_URL`, or disabled).
70
+ */
71
+ export declare function ClearSharedCacheAfterWrite(commandName: string, skipFlag?: boolean): Promise<SharedCacheClearReport | null>;
72
+ /** The subset of the CLI runtime host a clear report is logged through. */
73
+ export interface SharedCacheReportSink {
74
+ Log(message: string, level?: 'info' | 'warn' | 'error'): void;
75
+ }
76
+ /**
77
+ * Logs a clear report and folds it into a plugin command's result: `data.sharedCacheClear`
78
+ * always, and a warning when the clear failed. Returns the result unchanged when there is no report.
79
+ */
80
+ export declare function AppendSharedCacheClear<R extends {
81
+ data?: Record<string, unknown>;
82
+ warnings?: string[];
83
+ }>(result: R, report: SharedCacheClearReport | null, sink: SharedCacheReportSink): R;
84
+ //# sourceMappingURL=shared-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-cache.d.ts","sourceRoot":"","sources":["../../src/lib/shared-cache.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAEpG,kGAAkG;AAClG,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AAKjE,mFAAmF;AACnF,MAAM,MAAM,uBAAuB,GAAG;IAClC,2DAA2D;IAC3D,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,uBAAuB,CAiBxG;AAED,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GAAG;IAC3B,gEAAgE;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,gCAAgC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kGAAkG;IAClG,eAAe,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAK3E;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,mBAAmB,CAAC;IAChC,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,qEAAqE;AACrE,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,wBAAwB,EAAE,CAAC;CAC1C;AAED,kGAAkG;AAClG,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,iBAAiB,GAAG,IAAI,CAOvG;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAMrH;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAuChI;AAED,2EAA2E;AAC3E,MAAM,WAAW,qBAAqB;IAClC,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACjE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EACpG,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,sBAAsB,GAAG,IAAI,EACrC,IAAI,EAAE,qBAAqB,GAC5B,CAAC,CAWH"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Clearing the shared (Redis) cache after the CLI changes the database.
3
+ *
4
+ * `mj sync push`, `mj codegen` and `mj migrate` write to the database from a process that is not
5
+ * part of the server fleet's cache, so no server hears about the change and each keeps serving what
6
+ * it cached before — indefinitely, because server-side cache hits are never re-validated (#4083).
7
+ * When `REDIS_URL` is configured (in the environment or the dotenv file the CLI loads), these
8
+ * commands clear the cache categories and the metadata snapshot afterwards; every server reloads its
9
+ * engines and re-checks its metadata. `mj cache clear` does the same on demand.
10
+ *
11
+ * A failed clear never fails the command — the database change already succeeded — but it is
12
+ * reported loudly, with the command to run by hand.
13
+ */
14
+ import { ClearSharedCacheCategories, SHARED_CACHE_WRITE_CATEGORIES } from '@memberjunction/redis-provider';
15
+ /** Setting this to `1`/`true` disables the automatic clear (the explicit command still works). */
16
+ export const SKIP_CACHE_CLEAR_ENV = 'MJ_SKIP_SHARED_CACHE_CLEAR';
17
+ /** The categories a clear may target: everything a CLI write invalidates, plus the proxy-key store. */
18
+ const CLEARABLE_CATEGORIES = [...SHARED_CACHE_WRITE_CATEGORIES, 'default'];
19
+ /**
20
+ * Maps requested category names onto their canonical spelling.
21
+ *
22
+ * Names are accepted case-insensitively because nobody should have to remember that it is
23
+ * `RunViewCache` and not `runviewcache`. But Redis keys ARE case-sensitive, so accepting a
24
+ * spelling and then using it verbatim scanned `{prefix}:runviewcache:*`, matched nothing, and
25
+ * reported a successful clear of 0 keys — the operator is told the fleet will reload and it never
26
+ * does. Accept the spelling, then hand the store the canonical name.
27
+ */
28
+ export function ResolveCacheCategories(requested) {
29
+ if (!requested?.length) {
30
+ return { Categories: [...SHARED_CACHE_WRITE_CATEGORIES], Unknown: [] };
31
+ }
32
+ const resolved = [];
33
+ const unknown = [];
34
+ for (const raw of requested) {
35
+ const canonical = CLEARABLE_CATEGORIES.find(known => known.toLowerCase() === raw.trim().toLowerCase());
36
+ if (canonical) {
37
+ if (!resolved.includes(canonical)) {
38
+ resolved.push(canonical);
39
+ }
40
+ }
41
+ else {
42
+ unknown.push(raw);
43
+ }
44
+ }
45
+ return { Categories: resolved, Unknown: unknown };
46
+ }
47
+ /**
48
+ * Whether a migration run may have changed the database, and so whether the fleet's cache is stale.
49
+ *
50
+ * On success the count is authoritative: a run that found nothing pending must NOT make every server
51
+ * drop its cache and reload every engine for nothing.
52
+ *
53
+ * On a failure — including one that threw rather than returning — the count is not trustworthy and
54
+ * neither is the detail list, which can be empty precisely because the run died before assembling
55
+ * it. What IS known is whether a migration started executing. DDL is not transactional across
56
+ * batches on SQL Server, so a migration that began and failed can still have committed statements;
57
+ * a run that never started one cannot have. That makes "did anything start" the honest gate: a bad
58
+ * connection string or a config error leaves the fleet alone, and anything that touched the database
59
+ * clears.
60
+ */
61
+ export function MigrationChangedDatabase(outcome) {
62
+ if (outcome.Threw || !outcome.Succeeded) {
63
+ return outcome.StartedApplying;
64
+ }
65
+ return outcome.MigrationsApplied > 0;
66
+ }
67
+ /** The category names a clear can be asked for, for error messages and help text. */
68
+ export function KnownCacheCategories() {
69
+ return [...CLEARABLE_CATEGORIES];
70
+ }
71
+ /** Resolves the shared cache from `REDIS_URL` / `REDIS_KEY_PREFIX`, the variables MJAPI reads. */
72
+ export function ResolveSharedCacheTarget(env = process.env) {
73
+ const url = env.REDIS_URL?.trim();
74
+ if (!url) {
75
+ return null;
76
+ }
77
+ const keyPrefix = env.REDIS_KEY_PREFIX || 'mj';
78
+ return { Connection: { url, keyPrefix }, Description: `${DescribeRedisUrl(url)} (prefix "${keyPrefix}")` };
79
+ }
80
+ /** `host:port/db` of a Redis URL, without user or password. */
81
+ export function DescribeRedisUrl(url) {
82
+ try {
83
+ const parsed = new URL(url);
84
+ const db = parsed.pathname && parsed.pathname !== '/' ? parsed.pathname : '';
85
+ return `${parsed.protocol}//${parsed.hostname}${parsed.port ? `:${parsed.port}` : ''}${db}`;
86
+ }
87
+ catch {
88
+ return '(unparseable REDIS_URL)';
89
+ }
90
+ }
91
+ /** True when the automatic clear has been switched off by flag or environment. */
92
+ export function IsAutomaticClearDisabled(skipFlag, env = process.env) {
93
+ if (skipFlag) {
94
+ return true;
95
+ }
96
+ const value = env[SKIP_CACHE_CLEAR_ENV]?.trim().toLowerCase();
97
+ return value === '1' || value === 'true';
98
+ }
99
+ /**
100
+ * Clears the shared cache after `commandName` changed the database. Returns null when there is
101
+ * nothing to do (no `REDIS_URL`, or disabled).
102
+ */
103
+ export async function ClearSharedCacheAfterWrite(commandName, skipFlag) {
104
+ const target = ResolveSharedCacheTarget();
105
+ if (!target || IsAutomaticClearDisabled(skipFlag)) {
106
+ return null;
107
+ }
108
+ try {
109
+ const categories = await ClearSharedCacheCategories({
110
+ Connection: target.Connection, Categories: SHARED_CACHE_WRITE_CATEGORIES, IncludeMetadataSnapshot: true,
111
+ });
112
+ const total = categories.reduce((n, c) => n + c.KeyCount, 0);
113
+ // A category can fail on its own: ClearSharedCacheCategories reports per-category Ok/Error
114
+ // and returns normally on a partial failure. Reporting the whole clear as a success then
115
+ // told the operator "servers will reload" about categories that were never cleared, which
116
+ // is the same false-success the per-category outcomes were added to expose.
117
+ const failed = categories.filter(c => c.Ok === false);
118
+ if (failed.length > 0) {
119
+ const detail = failed.map(c => `${c.Category} (${c.Error ?? 'unknown error'})`).join('; ');
120
+ return {
121
+ Ok: false,
122
+ Message: `${commandName} changed the database and the shared cache on ${target.Description} was only partly cleared — ` +
123
+ `${failed.length} of ${categories.length} categories failed: ${detail}. ` +
124
+ `Servers may serve stale data for those categories until you run: mj cache clear`,
125
+ Categories: categories,
126
+ };
127
+ }
128
+ return {
129
+ Ok: true,
130
+ Message: `Cleared ${total} shared cache entr${total === 1 ? 'y' : 'ies'} on ${target.Description} after ${commandName}; running servers will reload.`,
131
+ Categories: categories,
132
+ };
133
+ }
134
+ catch (e) {
135
+ const reason = e instanceof Error ? e.message : String(e);
136
+ return {
137
+ Ok: false,
138
+ Message: `${commandName} changed the database but the shared cache on ${target.Description} could not be cleared (${reason}). ` +
139
+ `Running servers may serve stale data until you run: mj cache clear`,
140
+ Categories: [],
141
+ };
142
+ }
143
+ }
144
+ /**
145
+ * Logs a clear report and folds it into a plugin command's result: `data.sharedCacheClear`
146
+ * always, and a warning when the clear failed. Returns the result unchanged when there is no report.
147
+ */
148
+ export function AppendSharedCacheClear(result, report, sink) {
149
+ if (!report) {
150
+ return result;
151
+ }
152
+ sink.Log(report.Message, report.Ok ? 'info' : 'warn');
153
+ const warnings = report.Ok ? result.warnings : [...(result.warnings ?? []), report.Message];
154
+ return {
155
+ ...result,
156
+ data: { ...(result.data ?? {}), sharedCacheClear: { ok: report.Ok, categories: report.Categories } },
157
+ warnings,
158
+ };
159
+ }
160
+ //# sourceMappingURL=shared-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-cache.js","sourceRoot":"","sources":["../../src/lib/shared-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAG3G,kGAAkG;AAClG,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AAEjE,uGAAuG;AACvG,MAAM,oBAAoB,GAAsB,CAAC,GAAG,6BAA6B,EAAE,SAAS,CAAC,CAAC;AAU9F;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAwC;IAC3E,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,6BAA6B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC3E,CAAC;IACD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC1B,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACvG,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAChC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;IACL,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,QAAQ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