@kamilio/wire 0.1.55 → 0.1.57
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 +44 -1
- package/dist/adapters/codesignal.d.ts +10 -0
- package/dist/adapters/codesignal.d.ts.map +1 -0
- package/dist/adapters/codesignal.js +165 -0
- package/dist/adapters/codesignal.js.map +1 -0
- package/dist/adapters/document-shell.d.ts +7 -0
- package/dist/adapters/document-shell.d.ts.map +1 -0
- package/dist/adapters/document-shell.js +51 -0
- package/dist/adapters/document-shell.js.map +1 -0
- package/dist/adapters/root.d.ts.map +1 -1
- package/dist/adapters/root.js +74 -8
- package/dist/adapters/root.js.map +1 -1
- package/dist/auth.d.ts +2 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +4 -2
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +10 -4
- package/dist/cli.js.map +1 -1
- package/dist/document-shell-engine.mjs +1880 -0
- package/dist/executable.d.ts.map +1 -1
- package/dist/executable.js +3 -2
- package/dist/executable.js.map +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +19 -19
- package/dist/hooks.js.map +1 -1
- package/node_modules/provider-asana/dist/asana-project.d.ts +7 -1
- package/node_modules/provider-asana/dist/asana-project.d.ts.map +1 -1
- package/node_modules/provider-asana/dist/asana-task.d.ts +7 -1
- package/node_modules/provider-asana/dist/asana-task.d.ts.map +1 -1
- package/node_modules/provider-asana/dist/index.d.ts +14 -2
- package/node_modules/provider-asana/dist/index.d.ts.map +1 -1
- package/node_modules/provider-chatgpt/dist/chatgpt.d.ts +7 -1
- package/node_modules/provider-chatgpt/dist/chatgpt.d.ts.map +1 -1
- package/node_modules/provider-chatgpt/dist/index.d.ts +7 -1
- package/node_modules/provider-chatgpt/dist/index.d.ts.map +1 -1
- package/node_modules/provider-gmail/dist/gmail.d.ts +7 -1
- package/node_modules/provider-gmail/dist/gmail.d.ts.map +1 -1
- package/node_modules/provider-gmail/dist/index.d.ts +7 -1
- package/node_modules/provider-gmail/dist/index.d.ts.map +1 -1
- package/node_modules/provider-google-docs/dist/doc-blocks.d.ts.map +1 -1
- package/node_modules/provider-google-docs/dist/doc-blocks.js +6 -2
- package/node_modules/provider-google-docs/dist/doc-blocks.js.map +1 -1
- package/node_modules/provider-google-docs/dist/google-docs.d.ts +7 -1
- package/node_modules/provider-google-docs/dist/google-docs.d.ts.map +1 -1
- package/node_modules/provider-google-docs/dist/google-docs.js +31 -10
- package/node_modules/provider-google-docs/dist/google-docs.js.map +1 -1
- package/node_modules/provider-google-docs/dist/google-forms.d.ts +7 -1
- package/node_modules/provider-google-docs/dist/google-forms.d.ts.map +1 -1
- package/node_modules/provider-google-docs/dist/index.d.ts +14 -2
- package/node_modules/provider-google-docs/dist/index.d.ts.map +1 -1
- package/node_modules/provider-google-docs/src/doc-blocks.ts +8 -2
- package/node_modules/provider-google-docs/src/google-docs.ts +26 -10
- package/node_modules/provider-lattice/dist/index.d.ts +14 -2
- package/node_modules/provider-lattice/dist/index.d.ts.map +1 -1
- package/node_modules/provider-notion/dist/index.d.ts +7 -1
- package/node_modules/provider-notion/dist/index.d.ts.map +1 -1
- package/node_modules/provider-notion/dist/notion-sync.d.ts +2 -2
- package/node_modules/provider-notion/dist/notion-sync.d.ts.map +1 -1
- package/node_modules/provider-notion/dist/notion-sync.js +24 -15
- package/node_modules/provider-notion/dist/notion-sync.js.map +1 -1
- package/node_modules/provider-notion/dist/notion.d.ts +7 -1
- package/node_modules/provider-notion/dist/notion.d.ts.map +1 -1
- package/node_modules/provider-notion/dist/notion.js +1 -1
- package/node_modules/provider-notion/dist/notion.js.map +1 -1
- package/node_modules/provider-notion/src/notion-sync.ts +23 -15
- package/node_modules/provider-notion/src/notion.ts +1 -1
- package/node_modules/provider-slack/dist/index.d.ts +7 -1
- package/node_modules/provider-slack/dist/index.d.ts.map +1 -1
- package/node_modules/provider-slack/dist/slack.d.ts +7 -1
- package/node_modules/provider-slack/dist/slack.d.ts.map +1 -1
- package/node_modules/provider-zoom/dist/index.d.ts +7 -1
- package/node_modules/provider-zoom/dist/index.d.ts.map +1 -1
- package/node_modules/provider-zoom/dist/zoom-hub.d.ts +7 -1
- package/node_modules/provider-zoom/dist/zoom-hub.d.ts.map +1 -1
- package/node_modules/wire-core/dist/core/editor-receipts.d.ts +5 -0
- package/node_modules/wire-core/dist/core/editor-receipts.d.ts.map +1 -0
- package/node_modules/wire-core/dist/core/editor-receipts.js +9 -0
- package/node_modules/wire-core/dist/core/editor-receipts.js.map +1 -0
- package/node_modules/wire-core/dist/core/model.d.ts +4 -1
- package/node_modules/wire-core/dist/core/model.d.ts.map +1 -1
- package/node_modules/wire-core/dist/core/owner.d.ts +3 -0
- package/node_modules/wire-core/dist/core/owner.d.ts.map +1 -0
- package/node_modules/wire-core/dist/core/owner.js +16 -0
- package/node_modules/wire-core/dist/core/owner.js.map +1 -0
- package/node_modules/wire-core/dist/core/source.d.ts +4 -1
- package/node_modules/wire-core/dist/core/source.d.ts.map +1 -1
- package/node_modules/wire-core/dist/core/source.js +12 -2
- package/node_modules/wire-core/dist/core/source.js.map +1 -1
- package/node_modules/wire-core/dist/index.d.ts +1 -1
- package/node_modules/wire-core/dist/index.d.ts.map +1 -1
- package/node_modules/wire-core/dist/index.js +1 -1
- package/node_modules/wire-core/dist/index.js.map +1 -1
- package/node_modules/wire-core/dist/operations.d.ts +11 -2
- package/node_modules/wire-core/dist/operations.d.ts.map +1 -1
- package/node_modules/wire-core/dist/operations.js +399 -31
- package/node_modules/wire-core/dist/operations.js.map +1 -1
- package/node_modules/wire-core/dist/runtime/cookies.js +1 -1
- package/node_modules/wire-core/dist/runtime/cookies.js.map +1 -1
- package/node_modules/wire-core/dist/storage/editor-receipts.d.ts +17 -0
- package/node_modules/wire-core/dist/storage/editor-receipts.d.ts.map +1 -0
- package/node_modules/wire-core/dist/storage/editor-receipts.js +27 -0
- package/node_modules/wire-core/dist/storage/editor-receipts.js.map +1 -0
- package/node_modules/wire-core/dist/storage/history-integrity.d.ts +4 -0
- package/node_modules/wire-core/dist/storage/history-integrity.d.ts.map +1 -0
- package/node_modules/wire-core/dist/storage/history-integrity.js +32 -0
- package/node_modules/wire-core/dist/storage/history-integrity.js.map +1 -0
- package/node_modules/wire-core/dist/storage/history.d.ts +93 -0
- package/node_modules/wire-core/dist/storage/history.d.ts.map +1 -0
- package/node_modules/wire-core/dist/storage/history.js +450 -0
- package/node_modules/wire-core/dist/storage/history.js.map +1 -0
- package/node_modules/wire-core/dist/storage/registry.d.ts +2 -2
- package/node_modules/wire-core/dist/storage/registry.d.ts.map +1 -1
- package/node_modules/wire-core/dist/storage/registry.js +34 -14
- package/node_modules/wire-core/dist/storage/registry.js.map +1 -1
- package/node_modules/wire-core/dist/storage/workspace.d.ts.map +1 -1
- package/node_modules/wire-core/dist/storage/workspace.js +183 -40
- package/node_modules/wire-core/dist/storage/workspace.js.map +1 -1
- package/node_modules/wire-core/src/core/editor-receipts.ts +8 -0
- package/node_modules/wire-core/src/core/model.ts +4 -1
- package/node_modules/wire-core/src/core/owner.ts +16 -0
- package/node_modules/wire-core/src/core/source.ts +13 -1
- package/node_modules/wire-core/src/index.ts +1 -1
- package/node_modules/wire-core/src/operations.ts +339 -33
- package/node_modules/wire-core/src/runtime/cookies.ts +1 -1
- package/node_modules/wire-core/src/storage/editor-receipts.ts +27 -0
- package/node_modules/wire-core/src/storage/history-integrity.ts +25 -0
- package/node_modules/wire-core/src/storage/history.ts +331 -0
- package/node_modules/wire-core/src/storage/registry.ts +22 -15
- package/node_modules/wire-core/src/storage/workspace.ts +129 -34
- package/package.json +6 -2
- package/src/adapters/codesignal.ts +244 -0
- package/src/adapters/document-shell.ts +43 -0
- package/src/adapters/root.ts +76 -8
- package/src/auth.ts +6 -3
- package/src/cli.ts +10 -4
- package/src/executable.ts +3 -2
- package/src/hooks.ts +19 -18
package/src/hooks.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { promisify } from "node:util";
|
|
|
7
7
|
import type { Resource, Wire, WireResult } from "wire-core";
|
|
8
8
|
import { configuredWireRoot, loadWireConfig, openWireRegistry, wireRelativePath } from "wire-core";
|
|
9
9
|
import type { WireWatchSyncHook } from "wire-core/internal/operations";
|
|
10
|
-
import { wireWatchHooks } from "wire-core/internal/operations";
|
|
10
|
+
import { sourceLock, wireWatchHooks, withHistoryLock } from "wire-core/internal/operations";
|
|
11
11
|
|
|
12
12
|
const execFileAsync = promisify(execFile);
|
|
13
13
|
|
|
@@ -106,21 +106,22 @@ function outputEnvironment(stdout: string): Record<string, string> {
|
|
|
106
106
|
return values;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
async function updateMovedResult(options: WireHookOptions, wireRoot: string, result: WireResult, movedPath: string): Promise<WireResult> {
|
|
109
|
+
async function updateMovedResult(options: WireHookOptions, wireRoot: string, result: WireResult, movedPath: string, tracked: boolean): Promise<WireResult> {
|
|
110
110
|
const workspace = dirname(wireRoot);
|
|
111
111
|
const outputPath = isAbsolute(movedPath) ? movedPath : resolve(workspace, movedPath);
|
|
112
112
|
const relativePath = wireRelativePath(outputPath, wireRoot);
|
|
113
113
|
const primary = primaryFilesystemLink(result.resource);
|
|
114
|
-
const
|
|
115
|
-
...
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
const moveLink = (r: Resource): Resource => ({ ...r, filesystem_links: r.filesystem_links.map(link =>
|
|
115
|
+
link.role === "primary" && link.path === primary.path ? { ...link, path: relativePath } : link) });
|
|
116
|
+
let resource = moveLink(result.resource);
|
|
117
|
+
if (result.summary.action !== "detached" && tracked) {
|
|
118
|
+
const source = result.resource.identifiers.find(i => i.service + ":" + i.identifier === result.resource.id)!;
|
|
119
|
+
resource = await withHistoryLock(wireRoot, sourceLock({ ...source, type: result.resource.type }), async () => {
|
|
120
|
+
const registry = await openWireRegistry(wireRoot, options.home);
|
|
121
|
+
const latest = await registry.get(result.resource.id);
|
|
122
|
+
if (primaryFilesystemLink(latest).path !== primary.path) throw new Error("The registered path changed while the hook was running. Wire kept the newer path.");
|
|
123
|
+
return registry.put(moveLink(latest));
|
|
124
|
+
});
|
|
124
125
|
}
|
|
125
126
|
return { ...result, resource, path: outputPath, summary: { ...result.summary, local: outputPath } };
|
|
126
127
|
}
|
|
@@ -139,7 +140,7 @@ async function runHookCommands(wireRoot: string, event: WireHookEvent, environme
|
|
|
139
140
|
return current;
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
async function runResourceHooks(options: WireHookOptions, command: string, result: WireResult): Promise<HookState> {
|
|
143
|
+
async function runResourceHooks(options: WireHookOptions, command: string, result: WireResult, tracked = true): Promise<HookState> {
|
|
143
144
|
const wireRoot = await configuredWireRoot(result.path, options.home);
|
|
144
145
|
if (wireRoot === null) return { result, environment: {} };
|
|
145
146
|
let currentResult = result;
|
|
@@ -153,7 +154,7 @@ async function runResourceHooks(options: WireHookOptions, command: string, resul
|
|
|
153
154
|
environment = { ...environment, ...output };
|
|
154
155
|
const outputPath = output["WIRE_PATH"];
|
|
155
156
|
if (outputPath !== undefined && resolve(dirname(wireRoot), outputPath) !== currentResult.path) {
|
|
156
|
-
currentResult = await updateMovedResult(options, wireRoot, currentResult, outputPath);
|
|
157
|
+
currentResult = await updateMovedResult(options, wireRoot, currentResult, outputPath, tracked);
|
|
157
158
|
environment = { ...environment, ...resourceEnvironment(command, options.currentDirectory, wireRoot, currentResult) };
|
|
158
159
|
}
|
|
159
160
|
}
|
|
@@ -170,8 +171,8 @@ async function runSummaryHooks(options: WireHookOptions, event: WireHookEvent, c
|
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
async function runSingleResultHooks(options: WireHookOptions, command: string, result: WireResult): Promise<WireResult> {
|
|
174
|
-
const state = result.summary.action === "failed" ? { result, environment: {} } : await runResourceHooks(options, command, result);
|
|
174
|
+
async function runSingleResultHooks(options: WireHookOptions, command: string, result: WireResult, tracked = true): Promise<WireResult> {
|
|
175
|
+
const state = result.summary.action === "failed" ? { result, environment: {} } : await runResourceHooks(options, command, result, tracked);
|
|
175
176
|
await runSummaryHooks(options, "post-command", command, state.result.path, [state.result], state.environment);
|
|
176
177
|
return state.result;
|
|
177
178
|
}
|
|
@@ -198,10 +199,10 @@ export function withWireHooks(wire: Wire, options: WireHookOptions): Wire {
|
|
|
198
199
|
const watchSyncHook: WireWatchSyncHook = (command, result) => runSingleResultHooks(options, command, result);
|
|
199
200
|
return Object.freeze({
|
|
200
201
|
...wire,
|
|
201
|
-
attach: async (url, path) => runSingleResultHooks(options, "attach", await wire.attach(url, path)),
|
|
202
|
+
attach: async (url, path, editorReceipts) => runSingleResultHooks(options, "attach", await wire.attach(url, path, editorReceipts)),
|
|
202
203
|
create: async (url, path) => runSingleResultHooks(options, "attach", await wire.create(url, path)),
|
|
203
204
|
sync: async (value, path) => runSingleResultHooks(options, "sync", await wire.sync(value, path)),
|
|
204
|
-
downloadSource: async (url, path) => runSingleResultHooks(options, "download", await wire.downloadSource(url, path)),
|
|
205
|
+
downloadSource: async (url, path) => runSingleResultHooks(options, "download", await wire.downloadSource(url, path), false),
|
|
205
206
|
download: async (value, path) => runSingleResultHooks(options, "download", await wire.download(value, path)),
|
|
206
207
|
detach: async (value, path) => runSingleResultHooks(options, "detach", await wire.detach(value, path)),
|
|
207
208
|
unlink: async (value, path) => runSingleResultHooks(options, "detach", await wire.unlink(value, path)),
|