@ai-matrx/records 0.99.26 → 0.99.28
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 +45 -2
- package/dist/core/index.cjs +45 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +45 -0
- package/dist/core/index.js.map +1 -1
- package/dist/first-page/index.cjs +1 -0
- package/dist/first-page/index.cjs.map +1 -1
- package/dist/first-page/index.js +1 -0
- package/dist/first-page/index.js.map +1 -1
- package/dist/index.cjs +45 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +45 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +40 -1
- package/dist/react/index.d.ts +40 -1
- package/dist/react/index.js +45 -0
- package/dist/react/index.js.map +1 -1
- package/dist/views/index.cjs +1 -0
- package/dist/views/index.cjs.map +1 -1
- package/dist/views/index.js +1 -0
- package/dist/views/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -136,6 +136,38 @@ interface BasePort {
|
|
|
136
136
|
relinked_columns: number;
|
|
137
137
|
relinked_cells: number;
|
|
138
138
|
}>>;
|
|
139
|
+
/** Automations and pages (dashboards) of a table, so a base copy carries them: `RecordsClient.automations` / `dashboards`. */
|
|
140
|
+
automations?(tableId: Uuid): Promise<RecordsResult<{
|
|
141
|
+
automations: Array<{
|
|
142
|
+
id: Uuid;
|
|
143
|
+
name: string;
|
|
144
|
+
spec: unknown;
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
}>;
|
|
147
|
+
}>>;
|
|
148
|
+
automationDeclare?(args: {
|
|
149
|
+
table_id: Uuid;
|
|
150
|
+
spec: unknown;
|
|
151
|
+
}): Promise<RecordsResult<{
|
|
152
|
+
ok: boolean;
|
|
153
|
+
automation_id?: Uuid;
|
|
154
|
+
}>>;
|
|
155
|
+
automationSetEnabled?(args: {
|
|
156
|
+
automation_id: Uuid;
|
|
157
|
+
enabled: boolean;
|
|
158
|
+
}): Promise<RecordsResult<unknown>>;
|
|
159
|
+
dashboards?(tableId: Uuid): Promise<RecordsResult<Array<{
|
|
160
|
+
dashboard_id: Uuid;
|
|
161
|
+
name: string;
|
|
162
|
+
blocks: unknown[];
|
|
163
|
+
presentation: Record<string, unknown>;
|
|
164
|
+
}>>>;
|
|
165
|
+
dashboardDeclare?(args: {
|
|
166
|
+
table_id: Uuid;
|
|
167
|
+
name: string;
|
|
168
|
+
blocks: unknown[];
|
|
169
|
+
presentation: Record<string, unknown> | null;
|
|
170
|
+
}): Promise<RecordsResult<Uuid>>;
|
|
139
171
|
/** `RecordsClient.tableArchive` / its restore: put a copy away, or bring it back to be copied from. */
|
|
140
172
|
archive?(tableId: Uuid): Promise<RecordsResult<unknown>>;
|
|
141
173
|
unarchive?(tableId: Uuid): Promise<RecordsResult<unknown>>;
|
|
@@ -157,6 +189,11 @@ interface BaseCopied {
|
|
|
157
189
|
}>;
|
|
158
190
|
relinkedColumns: number;
|
|
159
191
|
relinkedCells: number;
|
|
192
|
+
/** Automations copied (every one OFF) and pages copied, with every table id inside them pointing at the copies. */
|
|
193
|
+
automations: number;
|
|
194
|
+
pages: number;
|
|
195
|
+
/** One sentence per automation or page that could not be copied. */
|
|
196
|
+
extrasRefused: string[];
|
|
160
197
|
/** What a copy never carries, from the per-table door's own words, once per table. */
|
|
161
198
|
notCopied: string[];
|
|
162
199
|
}
|
|
@@ -182,6 +219,8 @@ declare function duplicateBase(port: BasePort, args: {
|
|
|
182
219
|
nameFor?: (table: BaseTable) => string;
|
|
183
220
|
onProgress?: (p: BaseCopyProgress) => void;
|
|
184
221
|
}): Promise<BaseCopyResult>;
|
|
222
|
+
/** Every table id (and any id of a copied table) inside a document becomes its copy's id. Column keys are kept by a copy, so they stay. */
|
|
223
|
+
declare function pointAtCopies<T>(doc: T, pairs: Record<Uuid, Uuid>): T;
|
|
185
224
|
interface BaseSnapshotRecord {
|
|
186
225
|
label: string;
|
|
187
226
|
origin: "manual" | "schedule";
|
|
@@ -524,4 +563,4 @@ declare function alternatePatch(document: RecordDocument, field_key: string, alt
|
|
|
524
563
|
};
|
|
525
564
|
declare function chooseAlternate(client: Pick<RecordsClient, "recordRead" | "recordAsOf" | "recordUpdate">, { record_id, field_key, alternate_index, rank }: ChooseAlternateArgs): Promise<RecordsResult<number>>;
|
|
526
565
|
|
|
527
|
-
export { type BaseCopied, type BaseCopyProgress, type BaseCopyResult, type BasePort, type BaseSnapshotRecord, type BaseTable, CaptureFileRef, CaptureOutcome, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSyncReport, type ChooseAlternateArgs, CoercibleField, Delivery, Freshness, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, OverridePolicy, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, REFUSALS_WORTH_REPEATING, RecordDocument, RecordsResult, type ResolutionTriple, TableDuplicateProgress, TableDuplicated, Timestamp, type TypedDate, type TypedMatchScore, type TypedNumber, type TypedTime, Uuid, alternatePatch, autonumberJoin, autonumberPrefixOf, autonumberSearchOf, autonumberWords, baseCopyName, chooseAlternate, duplicateBase, filterWithAutonumber, indexedDbStore, isAutonumberField, isDecided, localeDateOrder, memoryStore, mintClientKey, openCaptureQueue, rankTypedMatches, readTypedDate, readTypedNumber, readTypedTime, restoreSnapshot, snapshotBase, twoDigitYear, typedDateText, typedMatchScore, typedTimeText };
|
|
566
|
+
export { type BaseCopied, type BaseCopyProgress, type BaseCopyResult, type BasePort, type BaseSnapshotRecord, type BaseTable, CaptureFileRef, CaptureOutcome, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSyncReport, type ChooseAlternateArgs, CoercibleField, Delivery, Freshness, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, OverridePolicy, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, REFUSALS_WORTH_REPEATING, RecordDocument, RecordsResult, type ResolutionTriple, TableDuplicateProgress, TableDuplicated, Timestamp, type TypedDate, type TypedMatchScore, type TypedNumber, type TypedTime, Uuid, alternatePatch, autonumberJoin, autonumberPrefixOf, autonumberSearchOf, autonumberWords, baseCopyName, chooseAlternate, duplicateBase, filterWithAutonumber, indexedDbStore, isAutonumberField, isDecided, localeDateOrder, memoryStore, mintClientKey, openCaptureQueue, pointAtCopies, rankTypedMatches, readTypedDate, readTypedNumber, readTypedTime, restoreSnapshot, snapshotBase, twoDigitYear, typedDateText, typedMatchScore, typedTimeText };
|
package/dist/index.d.ts
CHANGED
|
@@ -136,6 +136,38 @@ interface BasePort {
|
|
|
136
136
|
relinked_columns: number;
|
|
137
137
|
relinked_cells: number;
|
|
138
138
|
}>>;
|
|
139
|
+
/** Automations and pages (dashboards) of a table, so a base copy carries them: `RecordsClient.automations` / `dashboards`. */
|
|
140
|
+
automations?(tableId: Uuid): Promise<RecordsResult<{
|
|
141
|
+
automations: Array<{
|
|
142
|
+
id: Uuid;
|
|
143
|
+
name: string;
|
|
144
|
+
spec: unknown;
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
}>;
|
|
147
|
+
}>>;
|
|
148
|
+
automationDeclare?(args: {
|
|
149
|
+
table_id: Uuid;
|
|
150
|
+
spec: unknown;
|
|
151
|
+
}): Promise<RecordsResult<{
|
|
152
|
+
ok: boolean;
|
|
153
|
+
automation_id?: Uuid;
|
|
154
|
+
}>>;
|
|
155
|
+
automationSetEnabled?(args: {
|
|
156
|
+
automation_id: Uuid;
|
|
157
|
+
enabled: boolean;
|
|
158
|
+
}): Promise<RecordsResult<unknown>>;
|
|
159
|
+
dashboards?(tableId: Uuid): Promise<RecordsResult<Array<{
|
|
160
|
+
dashboard_id: Uuid;
|
|
161
|
+
name: string;
|
|
162
|
+
blocks: unknown[];
|
|
163
|
+
presentation: Record<string, unknown>;
|
|
164
|
+
}>>>;
|
|
165
|
+
dashboardDeclare?(args: {
|
|
166
|
+
table_id: Uuid;
|
|
167
|
+
name: string;
|
|
168
|
+
blocks: unknown[];
|
|
169
|
+
presentation: Record<string, unknown> | null;
|
|
170
|
+
}): Promise<RecordsResult<Uuid>>;
|
|
139
171
|
/** `RecordsClient.tableArchive` / its restore: put a copy away, or bring it back to be copied from. */
|
|
140
172
|
archive?(tableId: Uuid): Promise<RecordsResult<unknown>>;
|
|
141
173
|
unarchive?(tableId: Uuid): Promise<RecordsResult<unknown>>;
|
|
@@ -157,6 +189,11 @@ interface BaseCopied {
|
|
|
157
189
|
}>;
|
|
158
190
|
relinkedColumns: number;
|
|
159
191
|
relinkedCells: number;
|
|
192
|
+
/** Automations copied (every one OFF) and pages copied, with every table id inside them pointing at the copies. */
|
|
193
|
+
automations: number;
|
|
194
|
+
pages: number;
|
|
195
|
+
/** One sentence per automation or page that could not be copied. */
|
|
196
|
+
extrasRefused: string[];
|
|
160
197
|
/** What a copy never carries, from the per-table door's own words, once per table. */
|
|
161
198
|
notCopied: string[];
|
|
162
199
|
}
|
|
@@ -182,6 +219,8 @@ declare function duplicateBase(port: BasePort, args: {
|
|
|
182
219
|
nameFor?: (table: BaseTable) => string;
|
|
183
220
|
onProgress?: (p: BaseCopyProgress) => void;
|
|
184
221
|
}): Promise<BaseCopyResult>;
|
|
222
|
+
/** Every table id (and any id of a copied table) inside a document becomes its copy's id. Column keys are kept by a copy, so they stay. */
|
|
223
|
+
declare function pointAtCopies<T>(doc: T, pairs: Record<Uuid, Uuid>): T;
|
|
185
224
|
interface BaseSnapshotRecord {
|
|
186
225
|
label: string;
|
|
187
226
|
origin: "manual" | "schedule";
|
|
@@ -524,4 +563,4 @@ declare function alternatePatch(document: RecordDocument, field_key: string, alt
|
|
|
524
563
|
};
|
|
525
564
|
declare function chooseAlternate(client: Pick<RecordsClient, "recordRead" | "recordAsOf" | "recordUpdate">, { record_id, field_key, alternate_index, rank }: ChooseAlternateArgs): Promise<RecordsResult<number>>;
|
|
526
565
|
|
|
527
|
-
export { type BaseCopied, type BaseCopyProgress, type BaseCopyResult, type BasePort, type BaseSnapshotRecord, type BaseTable, CaptureFileRef, CaptureOutcome, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSyncReport, type ChooseAlternateArgs, CoercibleField, Delivery, Freshness, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, OverridePolicy, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, REFUSALS_WORTH_REPEATING, RecordDocument, RecordsResult, type ResolutionTriple, TableDuplicateProgress, TableDuplicated, Timestamp, type TypedDate, type TypedMatchScore, type TypedNumber, type TypedTime, Uuid, alternatePatch, autonumberJoin, autonumberPrefixOf, autonumberSearchOf, autonumberWords, baseCopyName, chooseAlternate, duplicateBase, filterWithAutonumber, indexedDbStore, isAutonumberField, isDecided, localeDateOrder, memoryStore, mintClientKey, openCaptureQueue, rankTypedMatches, readTypedDate, readTypedNumber, readTypedTime, restoreSnapshot, snapshotBase, twoDigitYear, typedDateText, typedMatchScore, typedTimeText };
|
|
566
|
+
export { type BaseCopied, type BaseCopyProgress, type BaseCopyResult, type BasePort, type BaseSnapshotRecord, type BaseTable, CaptureFileRef, CaptureOutcome, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSyncReport, type ChooseAlternateArgs, CoercibleField, Delivery, Freshness, type MergeField, MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, MergeFieldSemanticType, MergeFieldSource, type MergeFieldTransform, type MissingBehavior, OverridePolicy, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, REFUSALS_WORTH_REPEATING, RecordDocument, RecordsResult, type ResolutionTriple, TableDuplicateProgress, TableDuplicated, Timestamp, type TypedDate, type TypedMatchScore, type TypedNumber, type TypedTime, Uuid, alternatePatch, autonumberJoin, autonumberPrefixOf, autonumberSearchOf, autonumberWords, baseCopyName, chooseAlternate, duplicateBase, filterWithAutonumber, indexedDbStore, isAutonumberField, isDecided, localeDateOrder, memoryStore, mintClientKey, openCaptureQueue, pointAtCopies, rankTypedMatches, readTypedDate, readTypedNumber, readTypedTime, restoreSnapshot, snapshotBase, twoDigitYear, typedDateText, typedMatchScore, typedTimeText };
|
package/dist/index.js
CHANGED
|
@@ -1719,6 +1719,7 @@ async function duplicateBase(port, args) {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
const fin = args.tables.length > 1 ? await port.finish({ organizationId: args.organizationId, pairs }) : null;
|
|
1721
1721
|
if (fin && !fin.ok) return { ok: false, error: fin.error, stoppedAt: args.tables[args.tables.length - 1], made };
|
|
1722
|
+
const extras = await copyExtras(port, args.tables, pairs);
|
|
1722
1723
|
return {
|
|
1723
1724
|
ok: true,
|
|
1724
1725
|
data: {
|
|
@@ -1726,10 +1727,53 @@ async function duplicateBase(port, args) {
|
|
|
1726
1727
|
tables: made,
|
|
1727
1728
|
relinkedColumns: fin?.ok ? fin.data.relinked_columns : 0,
|
|
1728
1729
|
relinkedCells: fin?.ok ? fin.data.relinked_cells : 0,
|
|
1730
|
+
...extras,
|
|
1729
1731
|
notCopied: [...notCopied]
|
|
1730
1732
|
}
|
|
1731
1733
|
};
|
|
1732
1734
|
}
|
|
1735
|
+
function pointAtCopies(doc, pairs) {
|
|
1736
|
+
let text = JSON.stringify(doc);
|
|
1737
|
+
for (const [from, to] of Object.entries(pairs)) text = text.split(from).join(to);
|
|
1738
|
+
return JSON.parse(text);
|
|
1739
|
+
}
|
|
1740
|
+
async function copyExtras(port, tables, pairs) {
|
|
1741
|
+
let automations = 0;
|
|
1742
|
+
let pages = 0;
|
|
1743
|
+
const extrasRefused = [];
|
|
1744
|
+
for (const t of tables) {
|
|
1745
|
+
const copy = pairs[t.id];
|
|
1746
|
+
if (!copy) continue;
|
|
1747
|
+
if (port.automations && port.automationDeclare) {
|
|
1748
|
+
const list = await port.automations(t.id);
|
|
1749
|
+
if (list.ok) {
|
|
1750
|
+
for (const a of list.data.automations) {
|
|
1751
|
+
const made = await port.automationDeclare({ table_id: copy, spec: pointAtCopies(a.spec, pairs) });
|
|
1752
|
+
if (made.ok && made.data.ok && made.data.automation_id) {
|
|
1753
|
+
await port.automationSetEnabled?.({ automation_id: made.data.automation_id, enabled: false });
|
|
1754
|
+
automations += 1;
|
|
1755
|
+
} else extrasRefused.push(`Automation "${a.name}" on ${t.name} was not copied.`);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
if (port.dashboards && port.dashboardDeclare) {
|
|
1760
|
+
const list = await port.dashboards(t.id);
|
|
1761
|
+
if (list.ok) {
|
|
1762
|
+
for (const d of list.data) {
|
|
1763
|
+
const made = await port.dashboardDeclare({
|
|
1764
|
+
table_id: copy,
|
|
1765
|
+
name: d.name,
|
|
1766
|
+
blocks: pointAtCopies(d.blocks, pairs),
|
|
1767
|
+
presentation: pointAtCopies(d.presentation, pairs)
|
|
1768
|
+
});
|
|
1769
|
+
if (made.ok) pages += 1;
|
|
1770
|
+
else extrasRefused.push(`Page "${d.name}" on ${t.name} was not copied.`);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
return { automations, pages, extrasRefused };
|
|
1776
|
+
}
|
|
1733
1777
|
async function snapshotBase(port, args) {
|
|
1734
1778
|
const copied = await duplicateBase(port, {
|
|
1735
1779
|
organizationId: args.organizationId,
|
|
@@ -5707,6 +5751,7 @@ export {
|
|
|
5707
5751
|
parseTableHome,
|
|
5708
5752
|
parseTableMoved,
|
|
5709
5753
|
personStampText,
|
|
5754
|
+
pointAtCopies,
|
|
5710
5755
|
portalArchiveConsequence,
|
|
5711
5756
|
portalConfirmLine,
|
|
5712
5757
|
portalPath,
|