@dossier-wiki/sync-cli 0.1.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/README.md +75 -0
- package/dist/api-client.d.ts +70 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +186 -0
- package/dist/api-client.js.map +1 -0
- package/dist/apply.d.ts +10 -0
- package/dist/apply.d.ts.map +1 -0
- package/dist/apply.js +444 -0
- package/dist/apply.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +394 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +411 -0
- package/dist/config.js.map +1 -0
- package/dist/diff.d.ts +9 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +415 -0
- package/dist/diff.js.map +1 -0
- package/dist/event-description.d.ts +15 -0
- package/dist/event-description.d.ts.map +1 -0
- package/dist/event-description.js +20 -0
- package/dist/event-description.js.map +1 -0
- package/dist/format.d.ts +10 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +249 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +165 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/dist/format.js
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatPlan = formatPlan;
|
|
4
|
+
exports.serializeConfig = serializeConfig;
|
|
5
|
+
const event_description_1 = require("./event-description");
|
|
6
|
+
// ── ANSI colors ──────────────────────────────────────────────
|
|
7
|
+
const GREEN = '\x1b[32m';
|
|
8
|
+
const YELLOW = '\x1b[33m';
|
|
9
|
+
const RED = '\x1b[31m';
|
|
10
|
+
const MAGENTA = '\x1b[35m';
|
|
11
|
+
const DIM = '\x1b[2m';
|
|
12
|
+
const BOLD = '\x1b[1m';
|
|
13
|
+
const RESET = '\x1b[0m';
|
|
14
|
+
// ── Format plan ──────────────────────────────────────────────
|
|
15
|
+
function formatPlan(plan, config) {
|
|
16
|
+
const lines = [];
|
|
17
|
+
const creates = countByType(plan, 'create');
|
|
18
|
+
const updates = countByType(plan, 'update');
|
|
19
|
+
const archives = countByType(plan, 'archive');
|
|
20
|
+
const tombstones = countByType(plan, 'tombstone') + countByType(plan, 'destroy');
|
|
21
|
+
const unchanged = countUnchanged(config, plan);
|
|
22
|
+
lines.push('');
|
|
23
|
+
lines.push(`${BOLD}Tenant:${RESET} ${config.tenant.displayName ?? config.tenant.organizationId} (${config.tenant.organizationId})`);
|
|
24
|
+
const parts = [`${creates} to create`, `${updates} to update`];
|
|
25
|
+
if (archives > 0)
|
|
26
|
+
parts.push(`${archives} to archive`);
|
|
27
|
+
if (tombstones > 0)
|
|
28
|
+
parts.push(`${tombstones} to tombstone`);
|
|
29
|
+
parts.push(`${unchanged} unchanged`);
|
|
30
|
+
lines.push(`${BOLD}Plan:${RESET} ${parts.join(', ')}.`);
|
|
31
|
+
lines.push('');
|
|
32
|
+
formatSection(lines, 'productDefinitions', plan.products);
|
|
33
|
+
formatSection(lines, 'currencies', plan.currencies);
|
|
34
|
+
formatSection(lines, 'constants', plan.constants);
|
|
35
|
+
formatSection(lines, 'eventDefinitions', plan.eventDefs);
|
|
36
|
+
formatSection(lines, 'webhooks', plan.webhooks);
|
|
37
|
+
formatSection(lines, 'rules', plan.rules);
|
|
38
|
+
// Immutable field violations
|
|
39
|
+
if (plan.immutableViolations.length > 0) {
|
|
40
|
+
lines.push(` ${BOLD}${RED}Immutable field violations:${RESET}`);
|
|
41
|
+
lines.push('');
|
|
42
|
+
for (const v of plan.immutableViolations) {
|
|
43
|
+
lines.push(` ${RED}✗${RESET} ${v.section}/${v.key}: field "${v.field}" is immutable (set at creation)`);
|
|
44
|
+
lines.push(` live: ${RED}${String(v.liveValue)}${RESET}`);
|
|
45
|
+
lines.push(` config: ${GREEN}${String(v.configValue)}${RESET}`);
|
|
46
|
+
}
|
|
47
|
+
lines.push('');
|
|
48
|
+
lines.push(` ${RED}${BOLD}${plan.immutableViolations.length} immutable field(s) differ.${RESET} To change these, destroy and recreate the resource.`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
}
|
|
51
|
+
// Cross-reference and field coverage status
|
|
52
|
+
lines.push(`${DIM}Cross-reference check: OK${RESET}`);
|
|
53
|
+
lines.push('');
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
56
|
+
function formatSection(lines, name, ops) {
|
|
57
|
+
lines.push(` ${BOLD}${name}:${RESET}`);
|
|
58
|
+
if (ops.length === 0) {
|
|
59
|
+
lines.push(` ${DIM}(no changes)${RESET}`);
|
|
60
|
+
lines.push('');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
for (const op of ops) {
|
|
64
|
+
switch (op.type) {
|
|
65
|
+
case 'create':
|
|
66
|
+
lines.push(` ${GREEN}+ create${RESET} ${op.key}${formatCreateSummary(op)}`);
|
|
67
|
+
break;
|
|
68
|
+
case 'update':
|
|
69
|
+
lines.push(` ${YELLOW}~ update${RESET} ${op.key} ${DIM}${(op.changes ?? []).join(', ')} changed${RESET}`);
|
|
70
|
+
formatFieldDiffs(lines, op);
|
|
71
|
+
break;
|
|
72
|
+
case 'archive':
|
|
73
|
+
lines.push(` ${MAGENTA}⊘ archive${RESET} ${op.key}${op.live?.name ? ` "${op.live.name}"` : ''}`);
|
|
74
|
+
break;
|
|
75
|
+
case 'tombstone':
|
|
76
|
+
lines.push(` ${RED}† tombstone${RESET} ${op.key}${op.live?.name ? ` "${op.live.name}"` : ''}`);
|
|
77
|
+
break;
|
|
78
|
+
case 'destroy':
|
|
79
|
+
// Legacy alias — render identically to tombstone.
|
|
80
|
+
lines.push(` ${RED}† tombstone${RESET} ${op.key}${op.live?.name ? ` "${op.live.name}"` : ''}`);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
lines.push('');
|
|
85
|
+
}
|
|
86
|
+
function formatCreateSummary(op) {
|
|
87
|
+
if (!op.config)
|
|
88
|
+
return '';
|
|
89
|
+
// Show a brief summary based on resource type
|
|
90
|
+
if (op.config.values)
|
|
91
|
+
return ` (${op.config.values.length} values)`;
|
|
92
|
+
if (op.config.name)
|
|
93
|
+
return ` "${op.config.name}"`;
|
|
94
|
+
return '';
|
|
95
|
+
}
|
|
96
|
+
function formatFieldDiffs(lines, op) {
|
|
97
|
+
if (!op.changes || !op.live || !op.config)
|
|
98
|
+
return;
|
|
99
|
+
for (const field of op.changes) {
|
|
100
|
+
const oldVal = getDisplayValue(op.live, field);
|
|
101
|
+
const newVal = getDisplayValue(op.config, field);
|
|
102
|
+
if (oldVal !== undefined || newVal !== undefined) {
|
|
103
|
+
const oldStr = typeof oldVal === 'object' ? JSON.stringify(oldVal) : String(oldVal);
|
|
104
|
+
const newStr = typeof newVal === 'object' ? JSON.stringify(newVal) : String(newVal);
|
|
105
|
+
lines.push(` ${RED}- ${truncate(oldStr, 80)}${RESET}`);
|
|
106
|
+
lines.push(` ${GREEN}+ ${truncate(newStr, 80)}${RESET}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function getDisplayValue(obj, field) {
|
|
111
|
+
// Map config field names to possible DB column names
|
|
112
|
+
if (field === 'name' && obj.displayName !== undefined)
|
|
113
|
+
return obj.displayName;
|
|
114
|
+
if (field === 'values' && obj.value?.values)
|
|
115
|
+
return JSON.stringify(obj.value.values);
|
|
116
|
+
if (field === 'values' && obj.values)
|
|
117
|
+
return JSON.stringify(obj.values);
|
|
118
|
+
return obj[field];
|
|
119
|
+
}
|
|
120
|
+
function truncate(s, max) {
|
|
121
|
+
return s.length > max ? s.substring(0, max - 3) + '...' : s;
|
|
122
|
+
}
|
|
123
|
+
function countByType(plan, type) {
|
|
124
|
+
return [plan.products, plan.currencies, plan.constants, plan.eventDefs, plan.webhooks, plan.rules]
|
|
125
|
+
.reduce((sum, ops) => sum + ops.filter((o) => o.type === type).length, 0);
|
|
126
|
+
}
|
|
127
|
+
function countUnchanged(config, plan) {
|
|
128
|
+
// Count product entries excluding string separators
|
|
129
|
+
const productCount = Object.values(config.productDefinitions ?? {}).filter((v) => typeof v !== 'string').length;
|
|
130
|
+
const configCounts = productCount +
|
|
131
|
+
Object.keys(config.currencies ?? {}).length +
|
|
132
|
+
Object.keys(config.constants ?? {}).length +
|
|
133
|
+
Object.keys(config.eventDefinitions ?? {}).length +
|
|
134
|
+
Object.keys(config.webhooks ?? {}).length +
|
|
135
|
+
Object.keys(config.rules ?? {}).length;
|
|
136
|
+
// "Unchanged" = config entries that produced no diff op. Excludes destructive
|
|
137
|
+
// ops (`destroy`/`tombstone`) since those are live rows not present in the
|
|
138
|
+
// config — counting them would double-subtract.
|
|
139
|
+
const changedKeys = [plan.products, plan.currencies, plan.constants, plan.eventDefs, plan.webhooks, plan.rules]
|
|
140
|
+
.reduce((sum, ops) => sum + ops.filter((o) => o.type !== 'destroy' && o.type !== 'tombstone').length, 0);
|
|
141
|
+
return configCounts - changedKeys;
|
|
142
|
+
}
|
|
143
|
+
// ── Serialize for import ─────────────────────────────────────
|
|
144
|
+
function serializeConfig(live, orgId, displayName) {
|
|
145
|
+
const config = {
|
|
146
|
+
$schema: 'https://dossiers.dev/schemas/tenant-sync-v1.json',
|
|
147
|
+
version: 1,
|
|
148
|
+
tenant: {
|
|
149
|
+
organizationId: orgId,
|
|
150
|
+
displayName: displayName ?? orgId,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
// Product definitions
|
|
154
|
+
if (live.products.size > 0) {
|
|
155
|
+
config.productDefinitions = {};
|
|
156
|
+
for (const [key, row] of live.products) {
|
|
157
|
+
config.productDefinitions[key] = {
|
|
158
|
+
name: row.name,
|
|
159
|
+
description: row.description ?? undefined,
|
|
160
|
+
category: row.category,
|
|
161
|
+
baseType: row.baseType,
|
|
162
|
+
defaultCurrency: row.defaultCurrency,
|
|
163
|
+
country: row.country ?? undefined,
|
|
164
|
+
supportedMethods: row.supportedMethods?.methodIds ?? [],
|
|
165
|
+
metadata: row.metadata ?? undefined,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Constants
|
|
170
|
+
if (live.constants.size > 0) {
|
|
171
|
+
config.constants = {};
|
|
172
|
+
for (const [key, row] of live.constants) {
|
|
173
|
+
const value = row.value;
|
|
174
|
+
const entry = {
|
|
175
|
+
type: row.type,
|
|
176
|
+
description: row.description ?? '',
|
|
177
|
+
};
|
|
178
|
+
if (row.type === 'set') {
|
|
179
|
+
entry.values = value?.values ?? value ?? [];
|
|
180
|
+
}
|
|
181
|
+
else if (row.type === 'monetary' || row.type === 'scalar') {
|
|
182
|
+
entry.value = typeof value === 'object' ? value?.value : value;
|
|
183
|
+
}
|
|
184
|
+
else if (row.type === 'range') {
|
|
185
|
+
entry.min = value?.min;
|
|
186
|
+
entry.max = value?.max;
|
|
187
|
+
}
|
|
188
|
+
config.constants[key] = entry;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Event definitions
|
|
192
|
+
if (live.eventDefs.size > 0) {
|
|
193
|
+
config.eventDefinitions = {};
|
|
194
|
+
for (const [key, row] of live.eventDefs) {
|
|
195
|
+
const parsed = (0, event_description_1.parseEventDescription)(row.description);
|
|
196
|
+
config.eventDefinitions[key] = {
|
|
197
|
+
name: row.displayName,
|
|
198
|
+
description: parsed.description,
|
|
199
|
+
subject: parsed.subject,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// Webhooks
|
|
204
|
+
if (live.webhooks.size > 0) {
|
|
205
|
+
config.webhooks = {};
|
|
206
|
+
for (const [key, row] of live.webhooks) {
|
|
207
|
+
config.webhooks[key] = {
|
|
208
|
+
description: row.description ?? '',
|
|
209
|
+
url: row.url,
|
|
210
|
+
events: row.events ?? [],
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// Currencies
|
|
215
|
+
if (live.currencies.size > 0) {
|
|
216
|
+
config.currencies = {};
|
|
217
|
+
for (const [key, row] of live.currencies) {
|
|
218
|
+
config.currencies[key] = {
|
|
219
|
+
name: row.name,
|
|
220
|
+
symbol: row.symbol ?? undefined,
|
|
221
|
+
precision: row.precision,
|
|
222
|
+
enabled: row.isEnabled !== false,
|
|
223
|
+
custom: row.isCustom === true,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Rules
|
|
228
|
+
if (live.rules.size > 0) {
|
|
229
|
+
config.rules = {};
|
|
230
|
+
for (const [key, row] of live.rules) {
|
|
231
|
+
const entry = {
|
|
232
|
+
name: row.name,
|
|
233
|
+
description: row.description,
|
|
234
|
+
subject: row.subject,
|
|
235
|
+
trigger: row.trigger,
|
|
236
|
+
severity: row.severity,
|
|
237
|
+
conditionTree: row.conditionTree,
|
|
238
|
+
actions: row.actions,
|
|
239
|
+
};
|
|
240
|
+
if (row.tags?.length > 0)
|
|
241
|
+
entry.tags = row.tags;
|
|
242
|
+
if (row.status !== 'DRAFT')
|
|
243
|
+
entry.status = row.status;
|
|
244
|
+
config.rules[key] = entry;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return config;
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":";;AAqBA,gCA4CC;AAkGD,0CA+GC;AA3QD,2DAA4D;AAE5D,gEAAgE;AAEhE,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,GAAG,GAAG,UAAU,CAAC;AACvB,MAAM,OAAO,GAA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MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Programmatic entry point. CLI consumers go through `bin: dossiers-sync`,
|
|
3
|
+
* which is `src/cli.ts`. Anything else (tests, the in-process backend
|
|
4
|
+
* `sync-export` service) can import named exports from here.
|
|
5
|
+
*/
|
|
6
|
+
export * from './types';
|
|
7
|
+
export * from './event-description';
|
|
8
|
+
export { SyncApiClient } from './api-client';
|
|
9
|
+
export type { SyncApiClientOptions } from './api-client';
|
|
10
|
+
export { loadConfig, validateConfig, parseConstantScope } from './config';
|
|
11
|
+
export { fetchLiveState, fetchAllState, computeDiff, deepEqual, setsEqual, } from './diff';
|
|
12
|
+
export { formatPlan, serializeConfig } from './format';
|
|
13
|
+
export { confirmPlan, applyPlan } from './apply';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,EACX,SAAS,EACT,SAAS,GACV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.applyPlan = exports.confirmPlan = exports.serializeConfig = exports.formatPlan = exports.setsEqual = exports.deepEqual = exports.computeDiff = exports.fetchAllState = exports.fetchLiveState = exports.parseConstantScope = exports.validateConfig = exports.loadConfig = exports.SyncApiClient = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* Programmatic entry point. CLI consumers go through `bin: dossiers-sync`,
|
|
20
|
+
* which is `src/cli.ts`. Anything else (tests, the in-process backend
|
|
21
|
+
* `sync-export` service) can import named exports from here.
|
|
22
|
+
*/
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./event-description"), exports);
|
|
25
|
+
var api_client_1 = require("./api-client");
|
|
26
|
+
Object.defineProperty(exports, "SyncApiClient", { enumerable: true, get: function () { return api_client_1.SyncApiClient; } });
|
|
27
|
+
var config_1 = require("./config");
|
|
28
|
+
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_1.loadConfig; } });
|
|
29
|
+
Object.defineProperty(exports, "validateConfig", { enumerable: true, get: function () { return config_1.validateConfig; } });
|
|
30
|
+
Object.defineProperty(exports, "parseConstantScope", { enumerable: true, get: function () { return config_1.parseConstantScope; } });
|
|
31
|
+
var diff_1 = require("./diff");
|
|
32
|
+
Object.defineProperty(exports, "fetchLiveState", { enumerable: true, get: function () { return diff_1.fetchLiveState; } });
|
|
33
|
+
Object.defineProperty(exports, "fetchAllState", { enumerable: true, get: function () { return diff_1.fetchAllState; } });
|
|
34
|
+
Object.defineProperty(exports, "computeDiff", { enumerable: true, get: function () { return diff_1.computeDiff; } });
|
|
35
|
+
Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return diff_1.deepEqual; } });
|
|
36
|
+
Object.defineProperty(exports, "setsEqual", { enumerable: true, get: function () { return diff_1.setsEqual; } });
|
|
37
|
+
var format_1 = require("./format");
|
|
38
|
+
Object.defineProperty(exports, "formatPlan", { enumerable: true, get: function () { return format_1.formatPlan; } });
|
|
39
|
+
Object.defineProperty(exports, "serializeConfig", { enumerable: true, get: function () { return format_1.serializeConfig; } });
|
|
40
|
+
var apply_1 = require("./apply");
|
|
41
|
+
Object.defineProperty(exports, "confirmPlan", { enumerable: true, get: function () { return apply_1.confirmPlan; } });
|
|
42
|
+
Object.defineProperty(exports, "applyPlan", { enumerable: true, get: function () { return apply_1.applyPlan; } });
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,0CAAwB;AACxB,sDAAoC;AACpC,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAEtB,mCAA0E;AAAjE,oGAAA,UAAU,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AACvD,+BAMgB;AALd,sGAAA,cAAc,OAAA;AACd,qGAAA,aAAa,OAAA;AACb,mGAAA,WAAW,OAAA;AACX,iGAAA,SAAS,OAAA;AACT,iGAAA,SAAS,OAAA;AAEX,mCAAuD;AAA9C,oGAAA,UAAU,OAAA;AAAE,yGAAA,eAAe,OAAA;AACpC,iCAAiD;AAAxC,oGAAA,WAAW,OAAA;AAAE,kGAAA,SAAS,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tenant Sync — Type definitions
|
|
3
|
+
*
|
|
4
|
+
* Types for the sync config file, live DB state, and diff operations.
|
|
5
|
+
*/
|
|
6
|
+
export interface SyncConfig {
|
|
7
|
+
$schema?: string;
|
|
8
|
+
version: number;
|
|
9
|
+
tenant: {
|
|
10
|
+
organizationId: string;
|
|
11
|
+
baseCurrency?: string;
|
|
12
|
+
displayName?: string;
|
|
13
|
+
};
|
|
14
|
+
productDefinitions?: Record<string, ProductDefinitionConfig | string>;
|
|
15
|
+
constants?: Record<string, ConstantConfig>;
|
|
16
|
+
eventDefinitions?: Record<string, EventDefConfig>;
|
|
17
|
+
webhooks?: Record<string, WebhookConfig>;
|
|
18
|
+
rules?: Record<string, RuleConfig>;
|
|
19
|
+
currencies?: Record<string, CurrencyConfig>;
|
|
20
|
+
customerFieldPolicy?: Record<string, CustomerFieldPolicyConfig>;
|
|
21
|
+
accountStatusPolicy?: AccountStatusPolicyConfig;
|
|
22
|
+
}
|
|
23
|
+
export interface CurrencyConfig {
|
|
24
|
+
/** Display name. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Currency symbol. */
|
|
27
|
+
symbol?: string;
|
|
28
|
+
/** Number of minor-unit decimal places (e.g. 2 for USD, 8 for BTC). */
|
|
29
|
+
precision: number;
|
|
30
|
+
/** Operational toggle — whether this currency is usable in this tenant. Default: true. */
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether this currency is tenant-defined (custom) or seeded from the
|
|
34
|
+
* platform defaults. Informational only on round-trip — the platform
|
|
35
|
+
* seeds the default set on tenant create and does not let sync flip
|
|
36
|
+
* `custom: false → true` after the fact.
|
|
37
|
+
*/
|
|
38
|
+
custom?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ConstantConfig {
|
|
41
|
+
type: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency';
|
|
42
|
+
description: string;
|
|
43
|
+
values?: string[];
|
|
44
|
+
value?: string | number | boolean | null;
|
|
45
|
+
min?: number;
|
|
46
|
+
max?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface ProductDefinitionConfig {
|
|
49
|
+
name: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
category: string;
|
|
52
|
+
baseType: string;
|
|
53
|
+
defaultCurrency: string;
|
|
54
|
+
country?: string;
|
|
55
|
+
supportedMethods: string[];
|
|
56
|
+
metadata?: Record<string, any>;
|
|
57
|
+
}
|
|
58
|
+
export interface EventDefConfig {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
subject: 'CUSTOMER' | 'ACCOUNT' | 'TRANSACTION';
|
|
62
|
+
}
|
|
63
|
+
export interface WebhookConfig {
|
|
64
|
+
description: string;
|
|
65
|
+
url: string;
|
|
66
|
+
headers?: Record<string, string>;
|
|
67
|
+
events: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface RuleConfig {
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
subject: string;
|
|
73
|
+
trigger: string;
|
|
74
|
+
severity: 'HIGH' | 'MEDIUM' | 'LOW';
|
|
75
|
+
tags?: string[];
|
|
76
|
+
conditionTree: ConditionNode;
|
|
77
|
+
actions?: ActionConfig[];
|
|
78
|
+
initialStatus?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
|
|
79
|
+
status?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
|
|
80
|
+
}
|
|
81
|
+
export interface ConditionNode {
|
|
82
|
+
logic?: 'AND' | 'OR';
|
|
83
|
+
conditions?: (ConditionNode | ConditionLeaf)[];
|
|
84
|
+
field?: string;
|
|
85
|
+
operator?: string;
|
|
86
|
+
value?: string | number | boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface ConditionLeaf {
|
|
89
|
+
field: string;
|
|
90
|
+
operator: string;
|
|
91
|
+
value?: string | number | boolean;
|
|
92
|
+
}
|
|
93
|
+
export interface ActionConfig {
|
|
94
|
+
type: string;
|
|
95
|
+
webhookId?: string;
|
|
96
|
+
entityType?: string;
|
|
97
|
+
flagType?: string;
|
|
98
|
+
queue?: string;
|
|
99
|
+
assignee?: string;
|
|
100
|
+
tag?: string;
|
|
101
|
+
severity?: string;
|
|
102
|
+
priority?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface CustomerFieldPolicyConfig {
|
|
105
|
+
source: string;
|
|
106
|
+
syncTrigger: string;
|
|
107
|
+
usedBy: string[];
|
|
108
|
+
}
|
|
109
|
+
export interface AccountStatusPolicyConfig {
|
|
110
|
+
statuses: string[];
|
|
111
|
+
dormancyThresholdDays?: number;
|
|
112
|
+
dormancyStrategy?: 'MANUAL' | 'AUTO';
|
|
113
|
+
usedBy?: Record<string, string[]>;
|
|
114
|
+
}
|
|
115
|
+
export interface LiveRow {
|
|
116
|
+
id: string;
|
|
117
|
+
syncKey: string;
|
|
118
|
+
[key: string]: any;
|
|
119
|
+
}
|
|
120
|
+
export interface LiveState {
|
|
121
|
+
products: Map<string, LiveRow>;
|
|
122
|
+
constants: Map<string, LiveRow>;
|
|
123
|
+
eventDefs: Map<string, LiveRow>;
|
|
124
|
+
webhooks: Map<string, LiveRow>;
|
|
125
|
+
rules: Map<string, LiveRow>;
|
|
126
|
+
currencies: Map<string, LiveRow>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* - `archive` — flip lifecycle to ARCHIVED (preserves the row, blocks new inbound references)
|
|
130
|
+
* - `tombstone` — flip lifecycle to TOMBSTONED (terminal; preserves the row for historical resolution)
|
|
131
|
+
* - `destroy` — legacy alias retained for the CLI surface; behaves identically to `tombstone`
|
|
132
|
+
*
|
|
133
|
+
* For a LIVE resource removed from the config, the planner emits both `archive`
|
|
134
|
+
* AND `tombstone` (per spec §3.4). For an already-archived resource, only
|
|
135
|
+
* `tombstone` is emitted. Constants skip `archive` entirely (per spec §7).
|
|
136
|
+
*/
|
|
137
|
+
export type DiffOpType = 'create' | 'update' | 'destroy' | 'archive' | 'tombstone';
|
|
138
|
+
export interface DiffOp {
|
|
139
|
+
type: DiffOpType;
|
|
140
|
+
key: string;
|
|
141
|
+
config?: any;
|
|
142
|
+
live?: LiveRow;
|
|
143
|
+
changes?: string[];
|
|
144
|
+
}
|
|
145
|
+
export interface ImmutableViolation {
|
|
146
|
+
section: string;
|
|
147
|
+
key: string;
|
|
148
|
+
field: string;
|
|
149
|
+
liveValue: any;
|
|
150
|
+
configValue: any;
|
|
151
|
+
}
|
|
152
|
+
export interface SyncPlan {
|
|
153
|
+
products: DiffOp[];
|
|
154
|
+
constants: DiffOp[];
|
|
155
|
+
eventDefs: DiffOp[];
|
|
156
|
+
webhooks: DiffOp[];
|
|
157
|
+
rules: DiffOp[];
|
|
158
|
+
currencies: DiffOp[];
|
|
159
|
+
immutableViolations: ImmutableViolation[];
|
|
160
|
+
}
|
|
161
|
+
export interface ValidationResult {
|
|
162
|
+
errors: string[];
|
|
163
|
+
warnings: string[];
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,kBAAkB,CAAC,EAAE,MAAM,CAA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";AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dossier-wiki/sync-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Terraform-style plan → confirm → apply CLI for Dossiers OS tenant configuration.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"dossiers-sync": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p tsconfig.build.json && bun run scripts/fix-shebang.ts",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"clean": "rm -rf dist",
|
|
19
|
+
"release": "bun run clean && bun run build && bun publish",
|
|
20
|
+
"sync": "bun run src/cli.ts"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"dossiers",
|
|
24
|
+
"sync",
|
|
25
|
+
"cli",
|
|
26
|
+
"tenant-config",
|
|
27
|
+
"terraform"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"fflate": "^0.8.3",
|
|
34
|
+
"yaml": "^2.8.3"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"typescript": "^5.5.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|