@open-agent-toolkit/cli 0.0.18 → 0.0.19
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/assets/public-package-versions.json +4 -4
- package/dist/commands/providers/inspect/inspect.d.ts.map +1 -1
- package/dist/commands/providers/inspect/inspect.js +4 -1
- package/dist/commands/providers/list/list.d.ts.map +1 -1
- package/dist/commands/providers/list/list.js +14 -2
- package/dist/commands/providers/providers.types.d.ts +3 -3
- package/dist/commands/providers/providers.types.d.ts.map +1 -1
- package/dist/commands/status/index.d.ts +2 -2
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +8 -3
- package/dist/drift/detector.d.ts +4 -1
- package/dist/drift/detector.d.ts.map +1 -1
- package/dist/drift/detector.js +14 -3
- package/dist/drift/index.d.ts +1 -0
- package/dist/drift/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../../src/commands/providers/inspect/inspect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,4BAA4B,EAC7B,MAAM,qCAAqC,CAAC;AAmB7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../../src/commands/providers/inspect/inspect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,4BAA4B,EAC7B,MAAM,qCAAqC,CAAC;AAmB7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuLpC,wBAAgB,6BAA6B,CAC3C,SAAS,GAAE,OAAO,CAAC,4BAA4B,CAAM,GACpD,OAAO,CAiBT"}
|
|
@@ -71,6 +71,9 @@ async function collectInspectResult(providerName, context, dependencies) {
|
|
|
71
71
|
drifted: 0,
|
|
72
72
|
missing: 0,
|
|
73
73
|
};
|
|
74
|
+
const copyTransform = mapping.transformCanonical
|
|
75
|
+
? { transformCanonical: mapping.transformCanonical }
|
|
76
|
+
: undefined;
|
|
74
77
|
for (const entry of manifest.entries) {
|
|
75
78
|
if (entry.provider !== adapter.name) {
|
|
76
79
|
continue;
|
|
@@ -79,7 +82,7 @@ async function collectInspectResult(providerName, context, dependencies) {
|
|
|
79
82
|
continue;
|
|
80
83
|
}
|
|
81
84
|
state.managed += 1;
|
|
82
|
-
const report = await dependencies.detectDrift(entry, scopeRoot.root);
|
|
85
|
+
const report = await dependencies.detectDrift(entry, scopeRoot.root, copyTransform);
|
|
83
86
|
if (report.state.status === 'in_sync') {
|
|
84
87
|
state.inSync += 1;
|
|
85
88
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/providers/list/list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,yBAAyB,EAC1B,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/providers/list/list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,yBAAyB,EAC1B,MAAM,qCAAqC,CAAC;AAmB7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwMpC,wBAAgB,0BAA0B,CACxC,SAAS,GAAE,OAAO,CAAC,yBAAyB,CAAM,GACjD,OAAO,CAcT"}
|
|
@@ -2,7 +2,7 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { buildCommandContext } from '../../../app/command-context.js';
|
|
3
3
|
import { readGlobalOptions, resolveConcreteScopes, } from '../../shared/shared.utils.js';
|
|
4
4
|
import { detectDrift } from '../../../drift/index.js';
|
|
5
|
-
import { resolveProjectRoot, resolveScopeRoot } from '../../../fs/paths.js';
|
|
5
|
+
import { normalizeToPosixPath, resolveProjectRoot, resolveScopeRoot, } from '../../../fs/paths.js';
|
|
6
6
|
import { loadManifest } from '../../../manifest/index.js';
|
|
7
7
|
import { claudeAdapter } from '../../../providers/claude/index.js';
|
|
8
8
|
import { codexAdapter } from '../../../providers/codex/index.js';
|
|
@@ -95,9 +95,11 @@ async function collectProviderList(context, dependencies) {
|
|
|
95
95
|
for (const adapter of dependencies.getAdapters()) {
|
|
96
96
|
const summary = createEmptySummary();
|
|
97
97
|
const contentTypes = new Set();
|
|
98
|
+
const allMappings = [];
|
|
98
99
|
for (const scope of scopes) {
|
|
99
100
|
for (const mapping of dependencies.getSyncMappings(adapter, scope)) {
|
|
100
101
|
contentTypes.add(mapping.contentType);
|
|
102
|
+
allMappings.push(mapping);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
let detected = false;
|
|
@@ -114,7 +116,17 @@ async function collectProviderList(context, dependencies) {
|
|
|
114
116
|
continue;
|
|
115
117
|
}
|
|
116
118
|
summary.managed += 1;
|
|
117
|
-
const
|
|
119
|
+
const matchedMapping = allMappings.find((mapping) => {
|
|
120
|
+
const normalizedEntry = normalizeToPosixPath(entry.providerPath);
|
|
121
|
+
const normalizedDir = normalizeToPosixPath(mapping.providerDir);
|
|
122
|
+
return (mapping.contentType === entry.contentType &&
|
|
123
|
+
(normalizedEntry === normalizedDir ||
|
|
124
|
+
normalizedEntry.startsWith(`${normalizedDir}/`)));
|
|
125
|
+
});
|
|
126
|
+
const copyTransform = matchedMapping?.transformCanonical
|
|
127
|
+
? { transformCanonical: matchedMapping.transformCanonical }
|
|
128
|
+
: undefined;
|
|
129
|
+
const report = await dependencies.detectDrift(entry, scopeRoot.root, copyTransform);
|
|
118
130
|
if (report.state.status === 'in_sync') {
|
|
119
131
|
summary.inSync += 1;
|
|
120
132
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommandContext, GlobalOptions } from '../../app/command-context.js';
|
|
2
2
|
import type { SyncConfig } from '../../config/index.js';
|
|
3
|
-
import type { DriftReport } from '../../drift/index.js';
|
|
3
|
+
import type { CopyTransform, DriftReport } from '../../drift/index.js';
|
|
4
4
|
import type { Manifest } from '../../manifest/index.js';
|
|
5
5
|
import type { PathMapping, ProviderAdapter } from '../../providers/shared/index.js';
|
|
6
6
|
import type { ConcreteScope, ContentType, Scope, SyncStrategy } from '../../shared/types.js';
|
|
@@ -24,7 +24,7 @@ export interface ProvidersListDependencies {
|
|
|
24
24
|
getAdapters: () => ProviderAdapter[];
|
|
25
25
|
getSyncMappings: (adapter: ProviderAdapter, scope: Scope) => PathMapping[];
|
|
26
26
|
loadManifest: (manifestPath: string) => Promise<Manifest>;
|
|
27
|
-
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string) => Promise<DriftReport>;
|
|
27
|
+
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string, copyTransform?: CopyTransform) => Promise<DriftReport>;
|
|
28
28
|
}
|
|
29
29
|
export interface ProviderInspectMappingState {
|
|
30
30
|
scope: ConcreteScope;
|
|
@@ -51,7 +51,7 @@ export interface ProvidersInspectDependencies {
|
|
|
51
51
|
getAdapters: () => ProviderAdapter[];
|
|
52
52
|
getSyncMappings: (adapter: ProviderAdapter, scope: Scope) => PathMapping[];
|
|
53
53
|
loadManifest: (manifestPath: string) => Promise<Manifest>;
|
|
54
|
-
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string) => Promise<DriftReport>;
|
|
54
|
+
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string, copyTransform?: CopyTransform) => Promise<DriftReport>;
|
|
55
55
|
}
|
|
56
56
|
export interface ProvidersSetDependencies {
|
|
57
57
|
buildCommandContext: (options: GlobalOptions) => CommandContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.types.d.ts","sourceRoot":"","sources":["../../../src/commands/providers/providers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"providers.types.d.ts","sourceRoot":"","sources":["../../../src/commands/providers/providers.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,YAAY,CAAC;IAC9B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,OAAO,EAAE,mBAAmB,CAAC;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,gBAAgB,EAAE,CAChB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,cAAc,KACpB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,WAAW,EAAE,MAAM,eAAe,EAAE,CAAC;IACrC,eAAe,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAK,WAAW,EAAE,CAAC;IAC3E,YAAY,EAAE,CAAC,YAAY,EAAE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AS,CAAC,CAAC,MAAM,CAAC,EAClC,SAAS,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,aAAa,KAC1B,OAAO,CAAC,WAAW,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,gBAAgB,EAAE,CAChB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,cAAc,KACpB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,WAAW,EAAE,MAAM,eAAe,EAAE,CAAC;IACrC,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5D,cAAc,EAAE,CACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,UAAU,KACf,OAAO,CAAC,UAAU,CAAC,CAAC;CAC1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CommandContext, type GlobalOptions } from '../../app/command-context.js';
|
|
2
2
|
import { type CodexRoleStray } from '../shared/codex-strays.js';
|
|
3
3
|
import { type MultiSelectChoice, type PromptContext } from '../shared/shared.prompts.js';
|
|
4
|
-
import { type DriftReport } from '../../drift/index.js';
|
|
4
|
+
import { type CopyTransform, type DriftReport } from '../../drift/index.js';
|
|
5
5
|
import { type CanonicalEntry } from '../../engine/index.js';
|
|
6
6
|
import type { Manifest } from '../../manifest/index.js';
|
|
7
7
|
import { type CodexExtensionPlan } from '../../providers/codex/codec/sync-extension.js';
|
|
@@ -17,7 +17,7 @@ interface StatusDependencies {
|
|
|
17
17
|
getAdapters: () => ProviderAdapter[];
|
|
18
18
|
getActiveAdapters: (adapters: ProviderAdapter[], scopeRoot: string) => Promise<ProviderAdapter[]>;
|
|
19
19
|
getSyncMappings: (adapter: ProviderAdapter, scope: Scope) => PathMapping[];
|
|
20
|
-
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string) => Promise<DriftReport>;
|
|
20
|
+
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string, copyTransform?: CopyTransform) => Promise<DriftReport>;
|
|
21
21
|
detectStrays: (provider: string, providerDir: string, manifest: Manifest, canonicalEntries: CanonicalEntry[], mapping?: Pick<PathMapping, 'contentType' | 'providerExtension'>) => Promise<DriftReport[]>;
|
|
22
22
|
detectCodexRoleStrays: (scopeRoot: string, canonicalEntries: CanonicalEntry[]) => Promise<CodexRoleStray[]>;
|
|
23
23
|
computeCodexProjectExtensionPlan: (scopeRoot: string, canonicalEntries: CanonicalEntry[]) => Promise<CodexExtensionPlan>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/status/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAEnB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/status/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAEnB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,eAAe,CAAC;AAMnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,uCAAuC,CAAC;AAI/C,OA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,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAieD,wBAAgB,mBAAmB,CACjC,SAAS,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAC1C,OAAO,CAcT"}
|
|
@@ -4,7 +4,7 @@ import { adoptStrayToCanonical, isAdoptionConflictError, } from '../shared/adopt
|
|
|
4
4
|
import { detectCodexRoleStrays, regenerateCodexAfterAdoption, } from '../shared/codex-strays.js';
|
|
5
5
|
import { confirmAction, selectManyWithAbort, } from '../shared/shared.prompts.js';
|
|
6
6
|
import { readGlobalOptions, resolveConcreteScopes, } from '../shared/shared.utils.js';
|
|
7
|
-
import { detectDrift, detectStrays } from '../../drift/index.js';
|
|
7
|
+
import { detectDrift, detectStrays, } from '../../drift/index.js';
|
|
8
8
|
import { scanCanonical } from '../../engine/index.js';
|
|
9
9
|
import { normalizeToPosixPath, resolveProjectRoot, resolveScopeRoot, } from '../../fs/paths.js';
|
|
10
10
|
import { loadManifest, saveManifest } from '../../manifest/manager.js';
|
|
@@ -132,10 +132,15 @@ async function collectScopeReports(scope, context, dependencies) {
|
|
|
132
132
|
if (!contentTypeAllowed(entry.contentType, scope)) {
|
|
133
133
|
continue;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
const matchedMapping = mappings.find((mapping) => mapping.contentType === entry.contentType &&
|
|
136
|
+
entryInsideMapping(entry.providerPath, mapping.providerDir));
|
|
137
|
+
if (!matchedMapping) {
|
|
136
138
|
continue;
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
const copyTransform = matchedMapping.transformCanonical
|
|
141
|
+
? { transformCanonical: matchedMapping.transformCanonical }
|
|
142
|
+
: undefined;
|
|
143
|
+
reports.push(await dependencies.detectDrift(entry, scopeRoot, copyTransform));
|
|
139
144
|
}
|
|
140
145
|
for (const mapping of mappings) {
|
|
141
146
|
for (const canonicalEntry of canonicalEntries) {
|
package/dist/drift/detector.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ManifestEntry } from '../manifest/manifest.types.js';
|
|
2
2
|
import type { DriftReport } from './drift.types.js';
|
|
3
|
-
export
|
|
3
|
+
export interface CopyTransform {
|
|
4
|
+
transformCanonical: (content: string, canonicalPath: string) => string;
|
|
5
|
+
}
|
|
6
|
+
export declare function detectDrift(entry: ManifestEntry, scopeRoot: string, copyTransform?: CopyTransform): Promise<DriftReport>;
|
|
4
7
|
//# sourceMappingURL=detector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/drift/detector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/drift/detector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;CACxE;AAcD,wBAAsB,WAAW,CAC/B,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,WAAW,CAAC,CAkFtB"}
|
package/dist/drift/detector.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { lstat, readlink, stat } from 'node:fs/promises';
|
|
1
|
+
import { lstat, readFile, readlink, stat } from 'node:fs/promises';
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { computeContentHash } from '../manifest/hash.js';
|
|
3
|
+
import { computeContentHash, computeStringHash } from '../manifest/hash.js';
|
|
4
4
|
function createReport(entry, state) {
|
|
5
5
|
return {
|
|
6
6
|
canonical: entry.canonicalPath,
|
|
@@ -9,7 +9,7 @@ function createReport(entry, state) {
|
|
|
9
9
|
state,
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
export async function detectDrift(entry, scopeRoot) {
|
|
12
|
+
export async function detectDrift(entry, scopeRoot, copyTransform) {
|
|
13
13
|
const providerPath = resolve(scopeRoot, entry.providerPath);
|
|
14
14
|
const canonicalPath = resolve(scopeRoot, entry.canonicalPath);
|
|
15
15
|
// Missing check must run first, before strategy-specific branches.
|
|
@@ -62,6 +62,17 @@ export async function detectDrift(entry, scopeRoot) {
|
|
|
62
62
|
if (entry.contentHash === currentHash) {
|
|
63
63
|
return createReport(entry, { status: 'in_sync' });
|
|
64
64
|
}
|
|
65
|
+
// When the manifest hash is stale (e.g. frontmatter-only edits to the
|
|
66
|
+
// canonical source that don't change the rendered output), re-derive the
|
|
67
|
+
// expected provider content from the current canonical + transform and
|
|
68
|
+
// compare that instead.
|
|
69
|
+
if (copyTransform && entry.isFile) {
|
|
70
|
+
const canonicalContent = await readFile(canonicalPath, 'utf8');
|
|
71
|
+
const rendered = copyTransform.transformCanonical(canonicalContent, entry.canonicalPath);
|
|
72
|
+
if (computeStringHash(rendered) === currentHash) {
|
|
73
|
+
return createReport(entry, { status: 'in_sync' });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
65
76
|
return createReport(entry, {
|
|
66
77
|
status: 'drifted',
|
|
67
78
|
reason: 'modified',
|
package/dist/drift/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drift/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drift/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|