@atlasauth/cli 0.11.0 → 0.12.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 +9 -0
- package/dist/args.d.ts +106 -0
- package/dist/args.js +38 -0
- package/dist/args.js.map +1 -1
- package/dist/commands/init.js +13 -8
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts +6 -2
- package/dist/commands/migrate.js +13 -3
- package/dist/commands/migrate.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +38 -0
- package/dist/help.js.map +1 -1
- package/dist/migrate/auth0/plugin.d.ts +2 -0
- package/dist/migrate/auth0/plugin.js +126 -0
- package/dist/migrate/auth0/plugin.js.map +1 -0
- package/dist/migrate/clerk/plugin.d.ts +2 -0
- package/dist/migrate/clerk/plugin.js +76 -0
- package/dist/migrate/clerk/plugin.js.map +1 -0
- package/dist/migrate/descope/plugin.d.ts +2 -0
- package/dist/migrate/descope/plugin.js +83 -0
- package/dist/migrate/descope/plugin.js.map +1 -0
- package/dist/migrate/export/auth0-config.d.ts +29 -0
- package/dist/migrate/export/auth0-config.js +249 -0
- package/dist/migrate/export/auth0-config.js.map +1 -0
- package/dist/migrate/export/auth0.d.ts +62 -0
- package/dist/migrate/export/auth0.js +575 -0
- package/dist/migrate/export/auth0.js.map +1 -0
- package/dist/migrate/export/clerk-config.d.ts +26 -0
- package/dist/migrate/export/clerk-config.js +227 -0
- package/dist/migrate/export/clerk-config.js.map +1 -0
- package/dist/migrate/export/clerk.d.ts +46 -0
- package/dist/migrate/export/clerk.js +486 -0
- package/dist/migrate/export/clerk.js.map +1 -0
- package/dist/migrate/export/descope.d.ts +35 -0
- package/dist/migrate/export/descope.js +208 -0
- package/dist/migrate/export/descope.js.map +1 -0
- package/dist/migrate/export/fake-vendor.test-helper.d.ts +27 -0
- package/dist/migrate/export/fake-vendor.test-helper.js +41 -0
- package/dist/migrate/export/fake-vendor.test-helper.js.map +1 -0
- package/dist/migrate/export/frameworks/app-users.d.ts +42 -0
- package/dist/migrate/export/frameworks/app-users.js +161 -0
- package/dist/migrate/export/frameworks/app-users.js.map +1 -0
- package/dist/migrate/export/frameworks/authjs.d.ts +41 -0
- package/dist/migrate/export/frameworks/authjs.js +146 -0
- package/dist/migrate/export/frameworks/authjs.js.map +1 -0
- package/dist/migrate/export/frameworks/devise.d.ts +39 -0
- package/dist/migrate/export/frameworks/devise.js +218 -0
- package/dist/migrate/export/frameworks/devise.js.map +1 -0
- package/dist/migrate/export/frameworks/django.d.ts +45 -0
- package/dist/migrate/export/frameworks/django.js +315 -0
- package/dist/migrate/export/frameworks/django.js.map +1 -0
- package/dist/migrate/export/frameworks/lucia.d.ts +42 -0
- package/dist/migrate/export/frameworks/lucia.js +263 -0
- package/dist/migrate/export/frameworks/lucia.js.map +1 -0
- package/dist/migrate/export/frameworks/tables.d.ts +90 -0
- package/dist/migrate/export/frameworks/tables.js +325 -0
- package/dist/migrate/export/frameworks/tables.js.map +1 -0
- package/dist/migrate/export/frameworks/webauthn.d.ts +25 -0
- package/dist/migrate/export/frameworks/webauthn.js +130 -0
- package/dist/migrate/export/frameworks/webauthn.js.map +1 -0
- package/dist/migrate/export/kinde-descope-config.d.ts +38 -0
- package/dist/migrate/export/kinde-descope-config.js +172 -0
- package/dist/migrate/export/kinde-descope-config.js.map +1 -0
- package/dist/migrate/export/kinde.d.ts +57 -0
- package/dist/migrate/export/kinde.js +333 -0
- package/dist/migrate/export/kinde.js.map +1 -0
- package/dist/migrate/export/okta-config.d.ts +30 -0
- package/dist/migrate/export/okta-config.js +205 -0
- package/dist/migrate/export/okta-config.js.map +1 -0
- package/dist/migrate/export/okta.d.ts +43 -0
- package/dist/migrate/export/okta.js +337 -0
- package/dist/migrate/export/okta.js.map +1 -0
- package/dist/migrate/export/plugin-kit.d.ts +25 -0
- package/dist/migrate/export/plugin-kit.js +82 -0
- package/dist/migrate/export/plugin-kit.js.map +1 -0
- package/dist/migrate/export/record-set.d.ts +44 -0
- package/dist/migrate/export/record-set.js +98 -0
- package/dist/migrate/export/record-set.js.map +1 -0
- package/dist/migrate/export/translate-kit.d.ts +46 -0
- package/dist/migrate/export/translate-kit.js +148 -0
- package/dist/migrate/export/translate-kit.js.map +1 -0
- package/dist/migrate/export/vendor-http.d.ts +46 -0
- package/dist/migrate/export/vendor-http.js +138 -0
- package/dist/migrate/export/vendor-http.js.map +1 -0
- package/dist/migrate/export/zip.d.ts +8 -0
- package/dist/migrate/export/zip.js +66 -0
- package/dist/migrate/export/zip.js.map +1 -0
- package/dist/migrate/framework/builtins.d.ts +2 -0
- package/dist/migrate/framework/builtins.js +23 -0
- package/dist/migrate/framework/builtins.js.map +1 -0
- package/dist/migrate/framework/commands.d.ts +20 -0
- package/dist/migrate/framework/commands.js +58 -0
- package/dist/migrate/framework/commands.js.map +1 -0
- package/dist/migrate/framework/custom.d.ts +12 -0
- package/dist/migrate/framework/custom.js +96 -0
- package/dist/migrate/framework/custom.js.map +1 -0
- package/dist/migrate/framework/orchestrator.d.ts +113 -0
- package/dist/migrate/framework/orchestrator.js +531 -0
- package/dist/migrate/framework/orchestrator.js.map +1 -0
- package/dist/migrate/framework/plugin.d.ts +165 -0
- package/dist/migrate/framework/plugin.js +3 -0
- package/dist/migrate/framework/plugin.js.map +1 -0
- package/dist/migrate/framework/registry.d.ts +11 -0
- package/dist/migrate/framework/registry.js +44 -0
- package/dist/migrate/framework/registry.js.map +1 -0
- package/dist/migrate/framework/report.d.ts +17 -0
- package/dist/migrate/framework/report.js +103 -0
- package/dist/migrate/framework/report.js.map +1 -0
- package/dist/migrate/frameworks/plugins.d.ts +29 -0
- package/dist/migrate/frameworks/plugins.js +402 -0
- package/dist/migrate/frameworks/plugins.js.map +1 -0
- package/dist/migrate/frameworks/report.d.ts +92 -0
- package/dist/migrate/frameworks/report.js +207 -0
- package/dist/migrate/frameworks/report.js.map +1 -0
- package/dist/migrate/frameworks/translate-js.d.ts +5 -0
- package/dist/migrate/frameworks/translate-js.js +503 -0
- package/dist/migrate/frameworks/translate-js.js.map +1 -0
- package/dist/migrate/frameworks/translate-rails-django.d.ts +3 -0
- package/dist/migrate/frameworks/translate-rails-django.js +1391 -0
- package/dist/migrate/frameworks/translate-rails-django.js.map +1 -0
- package/dist/migrate/kinde/plugin.d.ts +2 -0
- package/dist/migrate/kinde/plugin.js +105 -0
- package/dist/migrate/kinde/plugin.js.map +1 -0
- package/dist/migrate/okta/plugin.d.ts +2 -0
- package/dist/migrate/okta/plugin.js +105 -0
- package/dist/migrate/okta/plugin.js.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customPlugin = void 0;
|
|
4
|
+
exports.parseCanonicalRecords = parseCanonicalRecords;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const migrate_1 = require("@atlasauth/migrate");
|
|
7
|
+
const args_1 = require("../../args");
|
|
8
|
+
const errors_1 = require("../../errors");
|
|
9
|
+
/**
|
|
10
|
+
* `atlas migrate custom export --file <records>` — your own user store through
|
|
11
|
+
* the same pipeline as every vendor. The file holds canonical records (the
|
|
12
|
+
* `@atlasauth/migrate` schema v1), as NDJSON (one `{ "model": …, "data": … }`
|
|
13
|
+
* per line) or a JSON array of them; `{ "type": "record", … }` entries from a
|
|
14
|
+
* decrypted bundle are accepted too. Records are written in canonical model
|
|
15
|
+
* order whatever order the file has them in; an invalid record is left out and
|
|
16
|
+
* reported, never fatal.
|
|
17
|
+
*
|
|
18
|
+
* The file is read on this machine; only the sealed bundle goes to Atlas.
|
|
19
|
+
*/
|
|
20
|
+
/** Records between two export checkpoints. */
|
|
21
|
+
const CHECKPOINT_EVERY = 1000;
|
|
22
|
+
/** Parse NDJSON or a JSON array of `{ model, data }`. Unknown models are returned in `unknown`. */
|
|
23
|
+
function parseCanonicalRecords(text) {
|
|
24
|
+
const trimmed = text.trim();
|
|
25
|
+
let raw;
|
|
26
|
+
if (!trimmed)
|
|
27
|
+
raw = [];
|
|
28
|
+
else if (trimmed.startsWith('[')) {
|
|
29
|
+
try {
|
|
30
|
+
raw = JSON.parse(trimmed);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
throw new errors_1.CliError('The records file is not valid JSON.');
|
|
34
|
+
}
|
|
35
|
+
if (!Array.isArray(raw))
|
|
36
|
+
throw new errors_1.CliError('The records file must be a JSON array or NDJSON.');
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
raw = trimmed.split('\n').filter((l) => l.trim()).map((line, i) => {
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(line);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
throw new errors_1.CliError(`Line ${i + 1} of the records file is not valid JSON.`);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const records = [];
|
|
49
|
+
const unknown = {};
|
|
50
|
+
for (const entry of raw) {
|
|
51
|
+
if (!entry || typeof entry !== 'object')
|
|
52
|
+
continue;
|
|
53
|
+
const e = entry;
|
|
54
|
+
if (e.type !== undefined && e.type !== 'record')
|
|
55
|
+
continue; // manifest / end lines of a decrypted bundle
|
|
56
|
+
const model = String(e.model ?? '');
|
|
57
|
+
if (!(0, migrate_1.isCanonicalModel)(model) || !e.data || typeof e.data !== 'object') {
|
|
58
|
+
unknown[model || '(none)'] = (unknown[model || '(none)'] ?? 0) + 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
records.push({ model, data: e.data });
|
|
62
|
+
}
|
|
63
|
+
const rank = (m) => migrate_1.CANONICAL_MODEL_ORDER.indexOf(m);
|
|
64
|
+
// Stable: records of one model keep the file's order.
|
|
65
|
+
records.sort((a, b) => rank(a.model) - rank(b.model));
|
|
66
|
+
return { records, unknown };
|
|
67
|
+
}
|
|
68
|
+
exports.customPlugin = {
|
|
69
|
+
vendor: 'custom',
|
|
70
|
+
source: 'custom',
|
|
71
|
+
label: 'Your own user database',
|
|
72
|
+
help: 'Import a homegrown user store: write its users, identities, organizations and so on as canonical migration records (NDJSON or a JSON array of { model, data }), then run atlas migrate custom export --file <records> and atlas migrate custom import.',
|
|
73
|
+
export: {
|
|
74
|
+
reads: 'a local file of canonical migration records (--file)',
|
|
75
|
+
credentials: [],
|
|
76
|
+
async run(p, writer, resume) {
|
|
77
|
+
const file = (0, args_1.str)(p.args.values, 'file') ?? p.credential({ flag: 'file', env: 'ATLAS_MIGRATE_FILE', label: 'the records file (--file)', required: true });
|
|
78
|
+
const { records, unknown } = parseCanonicalRecords(p.ctx.readFile((0, node_path_1.resolve)(file)));
|
|
79
|
+
for (const [model, n] of Object.entries(unknown))
|
|
80
|
+
writer.omit(model, 'not a canonical model (or no data)', n);
|
|
81
|
+
const start = typeof resume.cursor === 'number' ? resume.cursor : 0;
|
|
82
|
+
if (start)
|
|
83
|
+
p.say(` resuming at record ${start + 1} of ${records.length}`);
|
|
84
|
+
for (let i = start; i < records.length; i++) {
|
|
85
|
+
const r = records[i];
|
|
86
|
+
const issues = await writer.add(r.model, r.data);
|
|
87
|
+
if (issues.length)
|
|
88
|
+
p.say(` left out ${r.model} #${i + 1}: ${issues[0].message}`);
|
|
89
|
+
if ((i + 1) % CHECKPOINT_EVERY === 0)
|
|
90
|
+
resume.checkpoint(i + 1);
|
|
91
|
+
}
|
|
92
|
+
p.say(` read ${records.length} record(s) from ${file}`);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=custom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../../src/migrate/framework/custom.ts"],"names":[],"mappings":";;;AA2BA,sDAqCC;AAhED,yCAAoC;AACpC,gDAA4H;AAC5H,qCAAiC;AACjC,yCAAwC;AAGxC;;;;;;;;;;GAUG;AAEH,8CAA8C;AAC9C,MAAM,gBAAgB,GAAG,IAAI,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CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACjE,CAAC;YACD,CAAC,CAAC,GAAG,CAAC,UAAU,OAAO,CAAC,MAAM,mBAAmB,IAAI,EAAE,CAAC,CAAC;QAC3D,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type MigrationSource } from '@atlasauth/migrate';
|
|
2
|
+
import { type ParsedArgs } from '../../args';
|
|
3
|
+
import type { ConfigHttp } from '../../config-http';
|
|
4
|
+
import type { RunContext } from '../../context';
|
|
5
|
+
import type { Format, Json } from '../../serialize';
|
|
6
|
+
import type { MigrationPlugin, PluginContext, TranslationResult } from './plugin';
|
|
7
|
+
/**
|
|
8
|
+
* `atlas migrate <vendor> [path]` — the program for any vendor with a
|
|
9
|
+
* {@link MigrationPlugin}, as one resumable run:
|
|
10
|
+
*
|
|
11
|
+
* preflight → config → export → import → bridge → lazy → code → verify
|
|
12
|
+
*
|
|
13
|
+
* Each finished step is checkpointed in atlas-migrate/<vendor>/state.json, so
|
|
14
|
+
* `--resume` carries on where a run stopped (a confirmation declined, a vendor
|
|
15
|
+
* credential missing, an export interrupted). `--dry-run` walks every step
|
|
16
|
+
* without touching the instance, the vendor or the code; `--yes` answers every
|
|
17
|
+
* confirmation. A single step runs on its own with `atlas migrate <vendor> <step>`.
|
|
18
|
+
*
|
|
19
|
+
* EXPORT RESUME. A sealed bundle cannot be appended to, so an export is written
|
|
20
|
+
* as one or more SEGMENTS (bundle.1.atlas, bundle.2.atlas, …), each a complete
|
|
21
|
+
* bundle. The exporter calls `checkpoint(cursor)` as it goes; when it stops on
|
|
22
|
+
* an error the current segment is sealed with what it holds and the last
|
|
23
|
+
* checkpoint is kept, so the next run starts a new segment from there. Records
|
|
24
|
+
* written after the checkpoint appear in both segments, which is harmless:
|
|
25
|
+
* every import is an idempotent upsert. A hard crash leaves an unsealed
|
|
26
|
+
* segment that is simply rewritten. The import step imports the segments in
|
|
27
|
+
* order (each one's references resolve through the ones applied before it).
|
|
28
|
+
*/
|
|
29
|
+
export declare const VENDOR_STEPS: readonly ["preflight", "config", "export", "import", "bridge", "lazy", "code", "verify"];
|
|
30
|
+
export type VendorStepId = (typeof VENDOR_STEPS)[number];
|
|
31
|
+
type StepStatus = 'done' | 'skipped' | 'planned' | 'action_needed' | 'awaiting_confirmation' | 'blocked';
|
|
32
|
+
interface StepRecord {
|
|
33
|
+
status: StepStatus;
|
|
34
|
+
at?: number;
|
|
35
|
+
detail?: Record<string, unknown>;
|
|
36
|
+
message?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface VendorMigrationState {
|
|
39
|
+
version: 1;
|
|
40
|
+
vendor: string;
|
|
41
|
+
source: MigrationSource;
|
|
42
|
+
project: string;
|
|
43
|
+
instance_id: string | null;
|
|
44
|
+
environment: string | null;
|
|
45
|
+
started_at: number;
|
|
46
|
+
steps: Partial<Record<VendorStepId, StepRecord>>;
|
|
47
|
+
export: {
|
|
48
|
+
/** Sealed segment files, in order (relative to the state directory). */
|
|
49
|
+
segments: string[];
|
|
50
|
+
/** The exporter's last checkpoint, handed back on resume. */
|
|
51
|
+
cursor: Json | null;
|
|
52
|
+
/** The exporter ran to the end. */
|
|
53
|
+
complete: boolean;
|
|
54
|
+
counts: Record<string, number>;
|
|
55
|
+
};
|
|
56
|
+
import: {
|
|
57
|
+
/** Segments fully imported. */
|
|
58
|
+
done: string[];
|
|
59
|
+
/** The segment being imported and its import id. */
|
|
60
|
+
current: {
|
|
61
|
+
segment: string;
|
|
62
|
+
id: string;
|
|
63
|
+
} | null;
|
|
64
|
+
ids: string[];
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
interface StepResult {
|
|
68
|
+
status: StepStatus;
|
|
69
|
+
detail?: Record<string, unknown>;
|
|
70
|
+
message?: string;
|
|
71
|
+
stop?: boolean;
|
|
72
|
+
exitCode?: number;
|
|
73
|
+
}
|
|
74
|
+
export declare class VendorMigration {
|
|
75
|
+
readonly ctx: RunContext;
|
|
76
|
+
readonly args: ParsedArgs;
|
|
77
|
+
readonly plugin: MigrationPlugin;
|
|
78
|
+
readonly project: string;
|
|
79
|
+
readonly dir: string;
|
|
80
|
+
readonly statePath: string;
|
|
81
|
+
readonly configDir: string;
|
|
82
|
+
readonly format: Format;
|
|
83
|
+
readonly yes: boolean;
|
|
84
|
+
readonly dryRun: boolean;
|
|
85
|
+
readonly json: boolean;
|
|
86
|
+
readonly skip: Set<string>;
|
|
87
|
+
readonly sets: Record<string, string>;
|
|
88
|
+
state: VendorMigrationState;
|
|
89
|
+
private http?;
|
|
90
|
+
private translation?;
|
|
91
|
+
constructor(ctx: RunContext, args: ParsedArgs, plugin: MigrationPlugin, projectArg: string | undefined);
|
|
92
|
+
say(line: string): void;
|
|
93
|
+
api(): ConfigHttp;
|
|
94
|
+
confirm(question: string): Promise<boolean>;
|
|
95
|
+
sleep(ms: number): Promise<void>;
|
|
96
|
+
/** What a plugin step gets. */
|
|
97
|
+
pluginContext(): PluginContext;
|
|
98
|
+
/** The translation from this run, or the one a previous run wrote. */
|
|
99
|
+
getTranslation(): TranslationResult | undefined;
|
|
100
|
+
setTranslation(t: TranslationResult): void;
|
|
101
|
+
loadState(opts: {
|
|
102
|
+
single: boolean;
|
|
103
|
+
}): void;
|
|
104
|
+
saveState(): void;
|
|
105
|
+
record(step: VendorStepId, result: StepResult): void;
|
|
106
|
+
/** Run every step (or just `only`). Returns the exit code. */
|
|
107
|
+
run(only?: VendorStepId): Promise<number>;
|
|
108
|
+
}
|
|
109
|
+
/** `--set a=b --set c=d,e=f` → { a: 'b', c: 'd', e: 'f' }. A value may contain `=`. */
|
|
110
|
+
export declare function parseSets(raw: string[]): Record<string, string>;
|
|
111
|
+
export declare const VENDOR_HANDLERS: Record<VendorStepId, (m: VendorMigration) => Promise<StepResult>>;
|
|
112
|
+
export declare function migrateVendor(ctx: RunContext, args: ParsedArgs, plugin: MigrationPlugin, projectArg: string | undefined, only?: VendorStepId): Promise<number>;
|
|
113
|
+
export {};
|