@atlasauth/cli 0.4.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlasauth/cli changelog
2
2
 
3
+ ## 0.6.0 — 2026-10-23
4
+
5
+ ### Added
6
+
7
+ - `atlas import --from <auth0|clerk|supabase|firebase|cognito|authjs|workos|better-auth> <file>`: maps each provider's export onto the bulk import, with `--dry-run`, resumable upsert batches (`--state-file`), `--hashes`, `--hash-config` and `--create-orgs`.
8
+ - `atlas mcp install --cursor | --claude-code | --codex | --vscode`: adds the Atlas MCP server (docs search) to the agent's config.
9
+
10
+ ## 0.5.0
11
+
12
+ ### Added
13
+
14
+ - `atlas referrals connect --provider referally` registers a Referally webhook (the `referral.*` topics) that sends referral changes back to Atlas and saves its secret on the instance; `--no-sync` skips it.
15
+ - It requires request-line (v2) signatures on the new connection from the first call.
16
+ - It refuses a test Referally key for a production instance, and a live key for a development one; `--allow-mode-mismatch` goes ahead with a warning.
17
+ - `atlas referrals status` shows two-way sync, the inbound URL and the last event. `connect --provider webhook` prints the inbound URL.
18
+
3
19
  ## 0.4.0
4
20
 
5
21
  ### Added
package/dist/args.d.ts CHANGED
@@ -150,6 +150,12 @@ declare const OPTIONS: {
150
150
  readonly 'tracking-token': {
151
151
  readonly type: "string";
152
152
  };
153
+ readonly 'no-sync': {
154
+ readonly type: "boolean";
155
+ };
156
+ readonly 'allow-mode-mismatch': {
157
+ readonly type: "boolean";
158
+ };
153
159
  readonly endpoint: {
154
160
  readonly type: "string";
155
161
  };
@@ -171,6 +177,39 @@ declare const OPTIONS: {
171
177
  readonly wait: {
172
178
  readonly type: "boolean";
173
179
  };
180
+ readonly from: {
181
+ readonly type: "string";
182
+ };
183
+ readonly 'batch-size': {
184
+ readonly type: "string";
185
+ };
186
+ readonly 'state-file': {
187
+ readonly type: "string";
188
+ };
189
+ readonly 'hash-config': {
190
+ readonly type: "string";
191
+ };
192
+ readonly hashes: {
193
+ readonly type: "string";
194
+ };
195
+ readonly 'create-orgs': {
196
+ readonly type: "boolean";
197
+ };
198
+ readonly cursor: {
199
+ readonly type: "boolean";
200
+ };
201
+ readonly 'claude-code': {
202
+ readonly type: "boolean";
203
+ };
204
+ readonly codex: {
205
+ readonly type: "boolean";
206
+ };
207
+ readonly vscode: {
208
+ readonly type: "boolean";
209
+ };
210
+ readonly global: {
211
+ readonly type: "boolean";
212
+ };
174
213
  };
175
214
  type OptionValue<O> = O extends {
176
215
  type: 'boolean';
package/dist/args.js CHANGED
@@ -71,6 +71,8 @@ const OPTIONS = {
71
71
  'auto-enroll': { type: 'boolean' },
72
72
  destination: { type: 'string' },
73
73
  'tracking-token': { type: 'string' },
74
+ 'no-sync': { type: 'boolean' },
75
+ 'allow-mode-mismatch': { type: 'boolean' },
74
76
  endpoint: { type: 'string' },
75
77
  'secret-file': { type: 'string' },
76
78
  enable: { type: 'boolean' },
@@ -78,6 +80,19 @@ const OPTIONS = {
78
80
  map: { type: 'string' },
79
81
  'metadata-path': { type: 'string' },
80
82
  wait: { type: 'boolean' },
83
+ // import --from <vendor>.
84
+ from: { type: 'string' },
85
+ 'batch-size': { type: 'string' },
86
+ 'state-file': { type: 'string' },
87
+ 'hash-config': { type: 'string' },
88
+ hashes: { type: 'string' },
89
+ 'create-orgs': { type: 'boolean' },
90
+ // mcp install.
91
+ cursor: { type: 'boolean' },
92
+ 'claude-code': { type: 'boolean' },
93
+ codex: { type: 'boolean' },
94
+ vscode: { type: 'boolean' },
95
+ global: { type: 'boolean' },
81
96
  };
82
97
  /** Parse argv, turning parseArgs' own errors (unknown/invalid flag) into clean CliErrors. */
83
98
  function parse(argv) {
package/dist/args.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":";;AA6FA,sBAeC;AAGD,kBAGC;AAGD,oBAOC;AAGD,sBAQC;AAvID,yCA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C,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED,yFAAyF;AACzF,SAAgB,KAAK,CAAC,MAAc;IAClC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,iBAAQ,CAAC,4CAA4C,GAAG,IAAI,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ParsedArgs } from '../args';
2
+ import type { RunContext } from '../context';
3
+ export declare function importUsers(ctx: RunContext, args: ParsedArgs): Promise<number>;
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.importUsers = importUsers;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const node_fs_1 = require("node:fs");
6
+ const args_1 = require("../args");
7
+ const errors_1 = require("../errors");
8
+ const output_1 = require("../output");
9
+ const project_1 = require("../project");
10
+ const vendors_1 = require("../import/vendors");
11
+ const shared_1 = require("./shared");
12
+ async function importUsers(ctx, args) {
13
+ const vendor = (0, args_1.str)(args.values, 'from');
14
+ if (!vendor || !vendors_1.VENDORS.includes(vendor)) {
15
+ throw new errors_1.CliError(`import needs --from <${vendors_1.VENDORS.join('|')}>.`);
16
+ }
17
+ const file = args.positionals[1];
18
+ if (!file)
19
+ throw new errors_1.CliError(`import needs the export file: atlas import --from ${vendor} <file>`);
20
+ const text = ctx.readFile(file);
21
+ let doc;
22
+ let hashes;
23
+ try {
24
+ doc = (0, vendors_1.parseExport)(text, file);
25
+ const hashesFile = (0, args_1.str)(args.values, 'hashes');
26
+ if (hashesFile)
27
+ hashes = (0, vendors_1.parseExport)(ctx.readFile(hashesFile), hashesFile);
28
+ }
29
+ catch (err) {
30
+ throw new errors_1.CliError(err instanceof Error ? err.message : String(err));
31
+ }
32
+ const { rows, warnings } = (0, vendors_1.mapExport)(vendor, doc, hashes);
33
+ const json = (0, shared_1.wantsJson)(args.values);
34
+ const summary = (0, vendors_1.summarize)(rows);
35
+ let hashConfig;
36
+ const hashConfigFile = (0, args_1.str)(args.values, 'hash-config');
37
+ if (hashConfigFile) {
38
+ try {
39
+ hashConfig = JSON.parse(ctx.readFile(hashConfigFile));
40
+ }
41
+ catch {
42
+ throw new errors_1.CliError(`--hash-config ${hashConfigFile} is not valid JSON.`);
43
+ }
44
+ }
45
+ if (vendor === 'firebase' && (summary.with_password_hash ?? 0) > 0 && !hashConfig && !args.values['dry-run']) {
46
+ throw new errors_1.CliError('Firebase password hashes need the project hash parameters. Copy them from the Firebase console (Authentication > Users > Password hash parameters) into a JSON file and pass --hash-config <file>.');
47
+ }
48
+ if (args.values['dry-run']) {
49
+ if (json)
50
+ (0, output_1.printJson)(ctx.io, { vendor, summary, warnings, sample: rows.slice(0, 3).map(redact) });
51
+ else {
52
+ ctx.io.out(`Dry run: ${rows.length} user(s) mapped from ${vendor}. Nothing was sent.`);
53
+ for (const [k, v] of Object.entries(summary))
54
+ ctx.io.out(` ${k.replace(/_/g, ' ')}: ${v}`);
55
+ for (const w of warnings)
56
+ ctx.io.out(` note: ${w}`);
57
+ }
58
+ return 0;
59
+ }
60
+ if (rows.length === 0)
61
+ throw new errors_1.CliError('The export contains no users with an email address.');
62
+ const batchSize = Math.min(Math.max(Number((0, args_1.str)(args.values, 'batch-size') ?? 100) || 100, 1), 100);
63
+ const statePath = (0, args_1.str)(args.values, 'state-file') ?? `${file}.atlas-import.json`;
64
+ const sha = (0, node_crypto_1.createHash)('sha256').update(text).digest('hex');
65
+ let state = { vendor, input_sha256: sha, next_index: 0, total: rows.length, succeeded: 0, failed: 0, jobs: [] };
66
+ if ((0, node_fs_1.existsSync)(statePath)) {
67
+ const saved = JSON.parse((0, node_fs_1.readFileSync)(statePath, 'utf8'));
68
+ if (saved.input_sha256 !== sha || saved.vendor !== vendor) {
69
+ throw new errors_1.CliError(`${statePath} belongs to a different export. Delete it or pass --state-file to start over.`);
70
+ }
71
+ state = saved;
72
+ if (state.next_index >= rows.length) {
73
+ ctx.io.out(`Already imported: ${state.succeeded} succeeded, ${state.failed} failed. Delete ${statePath} to run again.`);
74
+ return 0;
75
+ }
76
+ ctx.io.err(`Resuming at user ${state.next_index + 1} of ${rows.length}.`);
77
+ }
78
+ const auth = (0, shared_1.resolveAuth)(ctx, args.values);
79
+ const http = (0, project_1.httpFor)(ctx, { secretKey: auth.secretKey, apiUrl: auth.apiUrl });
80
+ for (const w of warnings)
81
+ ctx.io.err(`note: ${w}`);
82
+ while (state.next_index < rows.length) {
83
+ const batch = rows.slice(state.next_index, state.next_index + batchSize);
84
+ const body = { users: batch, upsert: true };
85
+ if (args.values['create-orgs'])
86
+ body.create_organizations = true;
87
+ if (hashConfig)
88
+ body.password_hash_config = { firebase: hashConfig };
89
+ let job = await http.post('/v1/user_imports', body);
90
+ // A batch over the inline limit is queued; poll it to completion.
91
+ while (job.status === 'pending' || job.status === 'processing') {
92
+ await (ctx.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))))(2000);
93
+ job = await http.get(`/v1/jobs/${job.id}`);
94
+ }
95
+ state.next_index += batch.length;
96
+ state.succeeded += job.succeeded;
97
+ state.failed += job.failed;
98
+ state.jobs.push(job.id);
99
+ (0, node_fs_1.writeFileSync)(statePath, JSON.stringify(state, null, 2));
100
+ if (!json)
101
+ ctx.io.err(` ${state.next_index}/${rows.length} sent (job ${job.id}: ${job.succeeded} ok, ${job.failed} issues)`);
102
+ }
103
+ if (json)
104
+ (0, output_1.printJson)(ctx.io, { ...state, summary, warnings });
105
+ else {
106
+ ctx.io.out(`Imported ${rows.length} user(s) from ${vendor}: ${state.succeeded} created or updated, ${state.failed} row issue(s).`);
107
+ if (state.failed)
108
+ ctx.io.out(`Per-row issues: GET /v1/jobs/<job-id>/errors for jobs ${state.jobs.join(', ')}`);
109
+ }
110
+ return state.failed > 0 ? 2 : 0;
111
+ }
112
+ /** A dry-run sample never prints a password hash. */
113
+ function redact(row) {
114
+ return row.password_hash ? { ...row, password_hash: '[redacted]', ...(row.password_salt ? { password_salt: '[redacted]' } : {}) } : row;
115
+ }
116
+ //# sourceMappingURL=import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":";;AA6CA,kCA+FC;AA5ID,6CAAyC;AACzC,qCAAkE;AAClE,kCAA+C;AAE/C,sCAAqC;AACrC,sCAAsC;AACtC,wCAAqC;AACrC,+CAA4G;AAC5G,qCAAkD;AAqC3C,KAAK,UAAU,WAAW,CAAC,GAAe,EAAE,IAAgB;IACjE,MAAM,MAAM,GAAG,IAAA,UAAG,EAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAuB,CAAC;IAC9D,IAAI,CAAC,MAAM,IAAI,CAAE,iBAA6B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,iBAAQ,CAAC,wBAAwB,iBAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,iBAAQ,CAAC,qDAAqD,MAAM,SAAS,CAAC,CAAC;IAEpG,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,GAAY,CAAC;IACjB,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,GAAG,GAAG,IAAA,qBAAW,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,MAA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GAAG,CAAC;AAC1I,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { type ParsedArgs } from '../args';
2
+ import type { RunContext } from '../context';
3
+ /**
4
+ * `atlas mcp install --cursor | --claude-code | --codex | --vscode` — add the
5
+ * Atlas MCP server to an AI coding agent's config, so the agent can search and
6
+ * read the Atlas docs while it works.
7
+ *
8
+ * The server runs as `npx -y @atlasauth/mcp`. No key is written: without
9
+ * `ATLAS_SECRET_KEY` it serves only the read-only docs tools, which is what a
10
+ * coding agent needs. Existing servers in the file are kept; an existing
11
+ * `atlas` entry is replaced (or, in Codex's TOML, left alone and reported).
12
+ */
13
+ export declare const MCP_SERVER_NAME = "atlas";
14
+ export declare const MCP_CLIENTS: readonly ["cursor", "claude-code", "codex", "vscode"];
15
+ export type McpClient = (typeof MCP_CLIENTS)[number];
16
+ interface InstallResult {
17
+ client: McpClient;
18
+ path: string;
19
+ status: 'added' | 'updated' | 'unchanged';
20
+ }
21
+ /** Where each client keeps its MCP config. Project files go under `dir`. */
22
+ export declare function mcpConfigPath(client: McpClient, opts: {
23
+ dir: string;
24
+ global: boolean;
25
+ env: NodeJS.ProcessEnv;
26
+ }): string;
27
+ /** Merge the Atlas server into a JSON MCP config. Pure, for tests. */
28
+ export declare function mergeJsonConfig(existing: string | null, client: McpClient): {
29
+ text: string;
30
+ status: InstallResult['status'];
31
+ };
32
+ /** Append the Atlas server to Codex's TOML config, unless one is already there. Pure, for tests. */
33
+ export declare function mergeCodexToml(existing: string | null): {
34
+ text: string;
35
+ status: InstallResult['status'];
36
+ };
37
+ export declare function mcp(ctx: RunContext, args: ParsedArgs): Promise<number>;
38
+ export {};
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MCP_CLIENTS = exports.MCP_SERVER_NAME = void 0;
4
+ exports.mcpConfigPath = mcpConfigPath;
5
+ exports.mergeJsonConfig = mergeJsonConfig;
6
+ exports.mergeCodexToml = mergeCodexToml;
7
+ exports.mcp = mcp;
8
+ const node_fs_1 = require("node:fs");
9
+ const node_os_1 = require("node:os");
10
+ const node_path_1 = require("node:path");
11
+ const args_1 = require("../args");
12
+ const errors_1 = require("../errors");
13
+ const output_1 = require("../output");
14
+ const shared_1 = require("./shared");
15
+ /**
16
+ * `atlas mcp install --cursor | --claude-code | --codex | --vscode` — add the
17
+ * Atlas MCP server to an AI coding agent's config, so the agent can search and
18
+ * read the Atlas docs while it works.
19
+ *
20
+ * The server runs as `npx -y @atlasauth/mcp`. No key is written: without
21
+ * `ATLAS_SECRET_KEY` it serves only the read-only docs tools, which is what a
22
+ * coding agent needs. Existing servers in the file are kept; an existing
23
+ * `atlas` entry is replaced (or, in Codex's TOML, left alone and reported).
24
+ */
25
+ exports.MCP_SERVER_NAME = 'atlas';
26
+ const COMMAND = 'npx';
27
+ const ARGS = ['-y', '@atlasauth/mcp'];
28
+ exports.MCP_CLIENTS = ['cursor', 'claude-code', 'codex', 'vscode'];
29
+ /** Where each client keeps its MCP config. Project files go under `dir`. */
30
+ function mcpConfigPath(client, opts) {
31
+ const home = opts.env.HOME || (0, node_os_1.homedir)();
32
+ switch (client) {
33
+ case 'cursor':
34
+ return opts.global ? (0, node_path_1.join)(home, '.cursor', 'mcp.json') : (0, node_path_1.join)(opts.dir, '.cursor', 'mcp.json');
35
+ case 'claude-code':
36
+ // Project scope: a checked-in `.mcp.json` that Claude Code offers to the whole team.
37
+ return (0, node_path_1.join)(opts.dir, '.mcp.json');
38
+ case 'vscode':
39
+ return (0, node_path_1.join)(opts.dir, '.vscode', 'mcp.json');
40
+ case 'codex':
41
+ return (0, node_path_1.join)(opts.env.CODEX_HOME || (0, node_path_1.join)(home, '.codex'), 'config.toml');
42
+ }
43
+ }
44
+ /** Merge the Atlas server into a JSON MCP config. Pure, for tests. */
45
+ function mergeJsonConfig(existing, client) {
46
+ let doc = {};
47
+ if (existing && existing.trim()) {
48
+ try {
49
+ const parsed = JSON.parse(existing);
50
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
51
+ throw new Error('not an object');
52
+ doc = parsed;
53
+ }
54
+ catch {
55
+ throw new errors_1.CliError('The existing MCP config is not valid JSON. Fix or move it, then run this again; it was not changed.');
56
+ }
57
+ }
58
+ // VS Code calls the map `servers` and wants an explicit transport type.
59
+ const key = client === 'vscode' ? 'servers' : 'mcpServers';
60
+ const entry = client === 'vscode' ? { type: 'stdio', command: COMMAND, args: ARGS } : { command: COMMAND, args: ARGS };
61
+ const servers = (typeof doc[key] === 'object' && doc[key] !== null ? doc[key] : {});
62
+ const before = servers[exports.MCP_SERVER_NAME];
63
+ const status = before === undefined ? 'added' : JSON.stringify(before) === JSON.stringify(entry) ? 'unchanged' : 'updated';
64
+ doc[key] = { ...servers, [exports.MCP_SERVER_NAME]: entry };
65
+ return { text: `${JSON.stringify(doc, null, 2)}\n`, status };
66
+ }
67
+ /** Append the Atlas server to Codex's TOML config, unless one is already there. Pure, for tests. */
68
+ function mergeCodexToml(existing) {
69
+ const current = existing ?? '';
70
+ if (/^\s*\[mcp_servers\.(atlas|"atlas")\]\s*$/m.test(current))
71
+ return { text: current, status: 'unchanged' };
72
+ const block = `[mcp_servers.${exports.MCP_SERVER_NAME}]\ncommand = "${COMMAND}"\nargs = [${ARGS.map((a) => JSON.stringify(a)).join(', ')}]\n`;
73
+ const sep = current === '' ? '' : current.endsWith('\n\n') ? '' : current.endsWith('\n') ? '\n' : '\n\n';
74
+ return { text: `${current}${sep}${block}`, status: 'added' };
75
+ }
76
+ async function mcp(ctx, args) {
77
+ const sub = args.positionals[1];
78
+ if (sub !== 'install')
79
+ throw new errors_1.CliError("Usage: atlas mcp install --cursor | --claude-code | --codex | --vscode");
80
+ const chosen = exports.MCP_CLIENTS.filter((c) => args.values[c] === true);
81
+ if (chosen.length === 0) {
82
+ throw new errors_1.CliError('Choose at least one client: --cursor, --claude-code, --codex or --vscode.');
83
+ }
84
+ const dir = (0, node_path_1.resolve)((0, args_1.str)(args.values, 'dir') ?? process.cwd());
85
+ const global = args.values.global === true;
86
+ const results = [];
87
+ for (const client of chosen) {
88
+ const path = mcpConfigPath(client, { dir, global, env: ctx.env });
89
+ const existing = (0, node_fs_1.existsSync)(path) ? (0, node_fs_1.readFileSync)(path, 'utf8') : null;
90
+ const merged = client === 'codex' ? mergeCodexToml(existing) : mergeJsonConfig(existing, client);
91
+ if (merged.status !== 'unchanged') {
92
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
93
+ (0, node_fs_1.writeFileSync)(path, merged.text);
94
+ }
95
+ results.push({ client, path, status: merged.status });
96
+ }
97
+ if ((0, shared_1.wantsJson)(args.values))
98
+ (0, output_1.printJson)(ctx.io, { server: exports.MCP_SERVER_NAME, command: [COMMAND, ...ARGS].join(' '), results });
99
+ else {
100
+ for (const r of results) {
101
+ const verb = r.status === 'unchanged' ? 'already set up in' : r.status === 'updated' ? 'updated in' : 'added to';
102
+ ctx.io.out(`${r.client}: Atlas MCP server ${verb} ${r.path}`);
103
+ }
104
+ ctx.io.out('Restart the client (or reload its MCP servers). It can now search and read the Atlas docs.');
105
+ }
106
+ return 0;
107
+ }
108
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":";;;AAkCA,sCAaC;AAGD,0CAoBC;AAGD,wCAMC;AAED,kBAgCC;AAjHD,qCAA6E;AAC7E,qCAAkC;AAClC,yCAAmD;AACnD,kCAA+C;AAE/C,sCAAqC;AACrC,sCAAsC;AACtC,qCAAqC;AAErC;;;;;;;;;GASG;AAEU,QAAA,eAAe,GAAG,OAAO,CAAC;AACvC,MAAM,OAAO,GAAG,KAAK,CAAC;AACtB,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAEzB,QAAA,WAAW,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AASjF,4EAA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AAC;QACJ,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;YACjH,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,sBAAsB,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,4FAA4F,CAAC,CAAC;IAC3G,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -4,12 +4,12 @@ import type { RunContext } from '../context';
4
4
  * `atlas referrals connect | backfill | status`: referral attribution from the
5
5
  * terminal.
6
6
  *
7
- * `connect --provider referally` is bring-your-own-key: the Referally merchant
8
- * key is used for one call (it creates the Atlas connection on Referally) and
9
- * is never stored or printed. The connection id and secret Referally returns
7
+ * `connect --provider referally` is bring-your-own-key: the Referalli merchant
8
+ * key is used for one call (it creates the Atlas connection on Referalli) and
9
+ * is never stored or printed. The connection id and secret Referalli returns
10
10
  * go straight onto the instance; the secret is never printed either.
11
11
  */
12
- /** The Referally API version pinned on every call. */
12
+ /** The Referalli API version pinned on every call. */
13
13
  export declare const REFERALLY_VERSION = "2026-10-21";
14
14
  interface PingRead {
15
15
  ok?: boolean;
@@ -36,5 +36,19 @@ export declare function pingSkewMs(ping: PingRead, receivedAt: number, latencyMs
36
36
  export declare function describeTestLines(test: TestRead, receivedAt: number): string[];
37
37
  /** A `customerRef,code` CSV → map; throws on a bad line. A header row is skipped. */
38
38
  export declare function parseCodeCsv(text: string): Record<string, string>;
39
+ /** The Referalli topics two-way sync subscribes to (changes to a referral after sign-up). */
40
+ export declare const REFERALLY_SYNC_TOPICS: readonly ["referral.created", "referral.held", "referral.paused", "referral.resumed", "referral.approved", "referral.voided", "referral.reassigned"];
41
+ /**
42
+ * Whether the merchant key reaches live or test data: the org's `livemode`,
43
+ * else the key prefix (rk_test_ = test; rk_live_ and older rk_ keys = live).
44
+ * `known` is false when Referalli reports no mode (no test mode there).
45
+ */
46
+ export declare function referallyKeyMode(ctx: RunContext, input: {
47
+ baseUrl: string;
48
+ key: string;
49
+ }): Promise<{
50
+ live: boolean;
51
+ known: boolean;
52
+ }>;
39
53
  export declare function referrals(ctx: RunContext, args: ParsedArgs): Promise<number>;
40
54
  export {};