terse-cli 0.9.20 → 0.9.22
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 +1 -1
- package/dist/cliUi.d.ts +3 -1
- package/dist/cliUi.d.ts.map +1 -1
- package/dist/cliUi.js +3 -2
- package/dist/cliUi.js.map +1 -1
- package/dist/commands/actor.d.ts.map +1 -1
- package/dist/commands/actor.js +32 -5
- package/dist/commands/actor.js.map +1 -1
- package/dist/commands/attach.d.ts +0 -7
- package/dist/commands/attach.d.ts.map +1 -1
- package/dist/commands/attach.js +220 -189
- package/dist/commands/attach.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +15 -3
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/generate.d.ts +0 -4
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +161 -127
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/history.d.ts +0 -15
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +139 -105
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +86 -28
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +6 -4
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/integrate.d.ts +0 -48
- package/dist/commands/integrate.d.ts.map +1 -1
- package/dist/commands/integrate.js +897 -699
- package/dist/commands/integrate.js.map +1 -1
- package/dist/commands/integrateUse.d.ts +0 -12
- package/dist/commands/integrateUse.d.ts.map +1 -1
- package/dist/commands/integrateUse.js +132 -98
- package/dist/commands/integrateUse.js.map +1 -1
- package/dist/commands/listen.d.ts +0 -7
- package/dist/commands/listen.d.ts.map +1 -1
- package/dist/commands/listen.js +98 -81
- package/dist/commands/listen.js.map +1 -1
- package/dist/commands/memory.d.ts +0 -21
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +147 -128
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/replay.d.ts +0 -2
- package/dist/commands/replay.d.ts.map +1 -1
- package/dist/commands/replay.js +37 -28
- package/dist/commands/replay.js.map +1 -1
- package/dist/commands/resume.d.ts +0 -4
- package/dist/commands/resume.d.ts.map +1 -1
- package/dist/commands/resume.js +34 -28
- package/dist/commands/resume.js.map +1 -1
- package/dist/commands/run.d.ts +0 -2
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +78 -70
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/state.d.ts +0 -18
- package/dist/commands/state.d.ts.map +1 -1
- package/dist/commands/state.js +129 -108
- package/dist/commands/state.js.map +1 -1
- package/dist/commands/test.d.ts +0 -28
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +509 -403
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/toolRun.d.ts +0 -6
- package/dist/commands/toolRun.d.ts.map +1 -1
- package/dist/commands/toolRun.js +149 -134
- package/dist/commands/toolRun.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/integrationApi.d.ts +0 -15
- package/dist/integrationApi.d.ts.map +1 -1
- package/dist/integrationApi.js +75 -49
- package/dist/integrationApi.js.map +1 -1
- package/dist/loadJob.d.ts +0 -11
- package/dist/loadJob.d.ts.map +1 -1
- package/dist/loadJob.js +54 -46
- package/dist/loadJob.js.map +1 -1
- package/dist/providers/LanguageProvider.d.ts +0 -29
- package/dist/providers/LanguageProvider.d.ts.map +1 -1
- package/dist/providers/LanguageProvider.js +3 -0
- package/dist/providers/LanguageProvider.js.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.d.ts +0 -24
- package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.js +115 -121
- package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
- package/dist/providers/typescript/runtimes/JobRuntime.d.ts +0 -26
- package/dist/providers/typescript/runtimes/JobRuntime.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/JobRuntime.js +51 -18
- package/dist/providers/typescript/runtimes/JobRuntime.js.map +1 -1
- package/dist/providers/typescript/runtimes/directJobRuntime.d.ts +0 -2
- package/dist/providers/typescript/runtimes/directJobRuntime.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/directJobRuntime.js +60 -49
- package/dist/providers/typescript/runtimes/directJobRuntime.js.map +1 -1
- package/dist/providers/typescript/runtimes/durableJobRuntime.d.ts +0 -2
- package/dist/providers/typescript/runtimes/durableJobRuntime.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/durableJobRuntime.js +168 -146
- package/dist/providers/typescript/runtimes/durableJobRuntime.js.map +1 -1
- package/dist/providers/typescript/runtimes/index.d.ts +0 -3
- package/dist/providers/typescript/runtimes/index.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/index.js +5 -2
- package/dist/providers/typescript/runtimes/index.js.map +1 -1
- package/dist/providers/typescript/runtimes/session.d.ts +0 -4
- package/dist/providers/typescript/runtimes/session.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/session.js +78 -64
- package/dist/providers/typescript/runtimes/session.js.map +1 -1
- package/dist/providers/typescript/terseWorkflow.d.ts +0 -7
- package/dist/providers/typescript/terseWorkflow.d.ts.map +1 -1
- package/dist/providers/typescript/terseWorkflow.js +12 -7
- package/dist/providers/typescript/terseWorkflow.js.map +1 -1
- package/dist/runLocalTestJob.d.ts +0 -19
- package/dist/runLocalTestJob.d.ts.map +1 -1
- package/dist/runLocalTestJob.js +55 -29
- package/dist/runLocalTestJob.js.map +1 -1
- package/dist/setup.js +1 -1
- package/dist/setup.js.map +1 -1
- package/dist/sourceArchive.d.ts +1 -1
- package/dist/sourceArchive.d.ts.map +1 -1
- package/dist/sourceArchive.js +1 -0
- package/dist/sourceArchive.js.map +1 -1
- package/dist/templates.d.ts +6 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +78 -0
- package/dist/templates.js.map +1 -0
- package/package.json +3 -4
- package/templates/typescript/init/package.json.hbs +1 -2
package/dist/commands/run.js
CHANGED
|
@@ -1,71 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// LEGACY-JOBS: Commented out while Terse is actors-only. Uncomment to restore; see the note in terse-sdk/src/index.ts.
|
|
3
|
+
// import chalk from "chalk"
|
|
4
|
+
// import fs from "fs"
|
|
5
|
+
// import type { SerializedEvent } from "terse-types"
|
|
6
|
+
//
|
|
7
|
+
// import { readApiKeyOrBail, readRunId, resolveEventFromRunId } from "../api.js"
|
|
8
|
+
// import { CliError } from "../cliError.js"
|
|
9
|
+
// import { parseEventFixtureJson } from "../eventFixture.js"
|
|
10
|
+
// import { loadJob } from "../loadJob.js"
|
|
11
|
+
// import { readProjectConfig, readProjectConfigOrBail } from "../projectConfig.js"
|
|
12
|
+
// import type { LanguageProvider } from "../providers/LanguageProvider.js"
|
|
13
|
+
// import { resolveProvider } from "../providers/resolveProvider.js"
|
|
14
|
+
// import type { SessionHandle } from "../providers/shared/sessionStream.js"
|
|
15
|
+
// import { startSession } from "../providers/typescript/runtimes/session.js"
|
|
16
|
+
// import { remoteDispatchNotice, runLocalTestJob } from "../runLocalTestJob.js"
|
|
17
|
+
// import { parseSerializedEventJson } from "../serializedEvent.js"
|
|
18
|
+
//
|
|
19
|
+
// export async function run(jobName?: string, eventJson?: string, eventFile?: string, provider: LanguageProvider = resolveProvider(), entryFile?: string, verbose?: boolean): Promise<void> {
|
|
20
|
+
// if (eventFile && !eventJson) {
|
|
21
|
+
// try {
|
|
22
|
+
// eventJson = fs.readFileSync(eventFile, "utf-8")
|
|
23
|
+
// } catch (err) {
|
|
24
|
+
// throw new CliError("event_file_unreadable", `Could not read event file: ${eventFile}`, {
|
|
25
|
+
// detail: err instanceof Error ? err.message : String(err)
|
|
26
|
+
// })
|
|
27
|
+
// }
|
|
28
|
+
// }
|
|
29
|
+
//
|
|
30
|
+
// const apiKey = readApiKeyOrBail()
|
|
31
|
+
// const runId = readRunId()
|
|
32
|
+
//
|
|
33
|
+
// // Opened up front so its round trip overlaps loading the job registry. The no-op catch keeps a
|
|
34
|
+
// // failed open from tripping node's unhandled-rejection exit before withSession awaits it.
|
|
35
|
+
// const session = runId ? startSession(apiKey, verbose ?? true, async fn => fn()) : undefined
|
|
36
|
+
// session?.catch(() => {})
|
|
37
|
+
// let sessionAdopted = false
|
|
38
|
+
//
|
|
39
|
+
// try {
|
|
40
|
+
// const { job } = await loadJob(provider, jobName, entryFile)
|
|
41
|
+
//
|
|
42
|
+
// let parsedEvent: SerializedEvent
|
|
43
|
+
// if (eventJson) {
|
|
44
|
+
// parsedEvent = parseEventFixtureJson(eventJson, "--event / --event-file")
|
|
45
|
+
// } else if (runId) {
|
|
46
|
+
// const resolvedEvent = await resolveEventFromRunId(runId, apiKey)
|
|
47
|
+
// if (!resolvedEvent) {
|
|
48
|
+
// throw new CliError("run_trigger_event_missing", "Could not resolve event from run ID.")
|
|
49
|
+
// }
|
|
50
|
+
// parsedEvent = resolvedEvent.event
|
|
51
|
+
// } else {
|
|
52
|
+
// throw new CliError("missing_event", "Provide --event <json> or --event-file <path>.", {
|
|
53
|
+
// detail: "Usage: terse run --event-file ./event.json\nTip: Use `terse test` to interactively pick a sample event."
|
|
54
|
+
// })
|
|
55
|
+
// }
|
|
56
|
+
//
|
|
57
|
+
// if (runId) {
|
|
58
|
+
// sessionAdopted = true
|
|
59
|
+
// await provider.executeJob(job, runId, parsedEvent, { entryFile, verbose, projectId: readProjectConfig()?.projectId, session })
|
|
60
|
+
// return
|
|
61
|
+
// }
|
|
62
|
+
//
|
|
63
|
+
// const projectId = readProjectConfigOrBail().projectId
|
|
64
|
+
// const { runId: dispatchedRunId, local } = await runLocalTestJob(provider, job, parsedEvent, { projectId, apiKey, verbose, entryFile })
|
|
65
|
+
// if (!local) console.log(chalk.cyan(` ${remoteDispatchNotice(dispatchedRunId)}`))
|
|
66
|
+
// } finally {
|
|
67
|
+
// if (session && !sessionAdopted) await closeUnusedSession(session)
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
//
|
|
71
|
+
// async function closeUnusedSession(session: Promise<SessionHandle>): Promise<void> {
|
|
72
|
+
// try {
|
|
73
|
+
// const handle = await session
|
|
74
|
+
// handle.close?.()
|
|
75
|
+
// } catch {
|
|
76
|
+
// // The open failed, so there is nothing to close.
|
|
77
|
+
// }
|
|
78
|
+
// }
|
|
71
79
|
//# sourceMappingURL=run.js.map
|
package/dist/commands/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";AAAA,uHAAuH;AACvH,4BAA4B;AAC5B,sBAAsB;AACtB,qDAAqD;AACrD,EAAE;AACF,iFAAiF;AACjF,4CAA4C;AAC5C,6DAA6D;AAC7D,0CAA0C;AAC1C,mFAAmF;AACnF,2EAA2E;AAC3E,oEAAoE;AACpE,4EAA4E;AAC5E,6EAA6E;AAC7E,gFAAgF;AAChF,mEAAmE;AACnE,EAAE;AACF,8LAA8L;AAC9L,qCAAqC;AACrC,gBAAgB;AAChB,8DAA8D;AAC9D,0BAA0B;AAC1B,uGAAuG;AACvG,2EAA2E;AAC3E,iBAAiB;AACjB,YAAY;AACZ,QAAQ;AACR,EAAE;AACF,wCAAwC;AACxC,gCAAgC;AAChC,EAAE;AACF,sGAAsG;AACtG,iGAAiG;AACjG,kGAAkG;AAClG,+BAA+B;AAC/B,iCAAiC;AACjC,EAAE;AACF,YAAY;AACZ,sEAAsE;AACtE,EAAE;AACF,2CAA2C;AAC3C,2BAA2B;AAC3B,uFAAuF;AACvF,8BAA8B;AAC9B,+EAA+E;AAC/E,oCAAoC;AACpC,0GAA0G;AAC1G,gBAAgB;AAChB,gDAAgD;AAChD,mBAAmB;AACnB,sGAAsG;AACtG,sIAAsI;AACtI,iBAAiB;AACjB,YAAY;AACZ,EAAE;AACF,uBAAuB;AACvB,oCAAoC;AACpC,6IAA6I;AAC7I,qBAAqB;AACrB,YAAY;AACZ,EAAE;AACF,gEAAgE;AAChE,iJAAiJ;AACjJ,4FAA4F;AAC5F,kBAAkB;AAClB,4EAA4E;AAC5E,QAAQ;AACR,IAAI;AACJ,EAAE;AACF,sFAAsF;AACtF,YAAY;AACZ,uCAAuC;AACvC,2BAA2B;AAC3B,gBAAgB;AAChB,4DAA4D;AAC5D,QAAQ;AACR,IAAI"}
|
package/dist/commands/state.d.ts
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import type { LanguageProvider } from "../providers/LanguageProvider.js";
|
|
2
|
-
export declare function stateList(opts?: BaseOpts & {
|
|
3
|
-
json?: boolean;
|
|
4
|
-
}): Promise<void>;
|
|
5
|
-
export declare function stateGet(key: string, opts?: BaseOpts): Promise<void>;
|
|
6
|
-
export declare function stateRemove(key: string, opts?: BaseOpts & {
|
|
7
|
-
yes?: boolean;
|
|
8
|
-
}): Promise<void>;
|
|
9
|
-
export declare function stateReset(opts?: BaseOpts & {
|
|
10
|
-
yes?: boolean;
|
|
11
|
-
}): Promise<void>;
|
|
12
|
-
type BaseOpts = {
|
|
13
|
-
job?: string;
|
|
14
|
-
test?: boolean;
|
|
15
|
-
entryFile?: string;
|
|
16
|
-
provider?: LanguageProvider;
|
|
17
|
-
};
|
|
18
|
-
export {};
|
|
19
1
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/commands/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/commands/state.ts"],"names":[],"mappings":""}
|
package/dist/commands/state.js
CHANGED
|
@@ -1,109 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// LEGACY-JOBS: Commented out while Terse is actors-only. Uncomment to restore; see the note in terse-sdk/src/index.ts.
|
|
3
|
+
// import { confirm } from "@inquirer/prompts"
|
|
4
|
+
// import chalk from "chalk"
|
|
5
|
+
// import { ApiRoutes } from "terse-types"
|
|
6
|
+
// import type { SdkStateListResponse, SdkStateReadResponse, SdkStateResetResponse } from "terse-types"
|
|
7
|
+
//
|
|
8
|
+
// import { ApiError, fetchWithAuth, readApiKeyOrBail } from "../api.js"
|
|
9
|
+
// import { CliError } from "../cliError.js"
|
|
10
|
+
// import { loadJob } from "../loadJob.js"
|
|
11
|
+
// import { readProjectConfigOrBail } from "../projectConfig.js"
|
|
12
|
+
// import type { LanguageProvider } from "../providers/LanguageProvider.js"
|
|
13
|
+
// import { resolveProvider } from "../providers/resolveProvider.js"
|
|
14
|
+
//
|
|
15
|
+
// import { humanSize } from "./memory.js"
|
|
16
|
+
//
|
|
17
|
+
// export async function stateList(opts: BaseOpts & { json?: boolean } = {}): Promise<void> {
|
|
18
|
+
// const apiKey = readApiKeyOrBail()
|
|
19
|
+
// const config = readProjectConfigOrBail()
|
|
20
|
+
// const jobName = await resolveJobName(opts)
|
|
21
|
+
//
|
|
22
|
+
// const response = await fetchWithAuth<SdkStateListResponse>(ApiRoutes.SDK.STATE_LIST, apiKey, { projectId: config.projectId, jobName, test: opts.test }, "POST")
|
|
23
|
+
//
|
|
24
|
+
// if (opts.json) {
|
|
25
|
+
// process.stdout.write(JSON.stringify(response, null, 2) + "\n")
|
|
26
|
+
// return
|
|
27
|
+
// }
|
|
28
|
+
//
|
|
29
|
+
// const lane = laneLabel(opts.test)
|
|
30
|
+
// if (response.keys.length === 0) {
|
|
31
|
+
// process.stdout.write(`No ${lane} state for job ${chalk.cyan(jobName)} yet.\n`)
|
|
32
|
+
// return
|
|
33
|
+
// }
|
|
34
|
+
//
|
|
35
|
+
// process.stdout.write(`${capitalize(lane)} state for job ${chalk.cyan(jobName)}:\n\n`)
|
|
36
|
+
// for (const entry of response.keys) {
|
|
37
|
+
// process.stdout.write(` ${humanSize(entry.sizeBytes).padStart(7, " ")} ${entry.key}\n`)
|
|
38
|
+
// }
|
|
39
|
+
// process.stdout.write(chalk.dim(`\nRead one with: terse state get <key> --job ${jobName}${opts.test ? " --test" : ""}\n`))
|
|
40
|
+
// }
|
|
41
|
+
//
|
|
42
|
+
// export async function stateGet(key: string, opts: BaseOpts = {}): Promise<void> {
|
|
43
|
+
// const apiKey = readApiKeyOrBail()
|
|
44
|
+
// const config = readProjectConfigOrBail()
|
|
45
|
+
// const jobName = await resolveJobName(opts)
|
|
46
|
+
//
|
|
47
|
+
// let response: SdkStateReadResponse
|
|
48
|
+
// try {
|
|
49
|
+
// response = await fetchWithAuth<SdkStateReadResponse>(ApiRoutes.SDK.STATE_READ, apiKey, { projectId: config.projectId, jobName, key, test: opts.test }, "POST")
|
|
50
|
+
// } catch (error) {
|
|
51
|
+
// if (error instanceof ApiError && error.status === 404) {
|
|
52
|
+
// throw new CliError("state_key_not_found", `No ${laneLabel(opts.test)} state value for key "${key}" on job ${jobName}.`)
|
|
53
|
+
// }
|
|
54
|
+
// throw error
|
|
55
|
+
// }
|
|
56
|
+
//
|
|
57
|
+
// process.stdout.write(response.content)
|
|
58
|
+
// if (!response.content.endsWith("\n")) process.stdout.write("\n")
|
|
59
|
+
// }
|
|
60
|
+
//
|
|
61
|
+
// export async function stateRemove(key: string, opts: BaseOpts & { yes?: boolean } = {}): Promise<void> {
|
|
62
|
+
// assertTestLane(opts)
|
|
63
|
+
// const apiKey = readApiKeyOrBail()
|
|
64
|
+
// const config = readProjectConfigOrBail()
|
|
65
|
+
// const jobName = await resolveJobName(opts)
|
|
66
|
+
//
|
|
67
|
+
// await confirmOrBail(opts.yes, `Delete state key "${key}" from ${jobName} test state?`)
|
|
68
|
+
//
|
|
69
|
+
// try {
|
|
70
|
+
// await fetchWithAuth(ApiRoutes.SDK.STATE_DELETE, apiKey, { projectId: config.projectId, jobName, key, test: true }, "POST")
|
|
71
|
+
// } catch (error) {
|
|
72
|
+
// if (error instanceof ApiError && error.status === 404) {
|
|
73
|
+
// throw new CliError("state_key_not_found", `No test state value for key "${key}" on job ${jobName}.`)
|
|
74
|
+
// }
|
|
75
|
+
// throw error
|
|
76
|
+
// }
|
|
77
|
+
// process.stdout.write(chalk.green(`Deleted state key "${key}" from ${jobName} test state.\n`))
|
|
78
|
+
// }
|
|
79
|
+
//
|
|
80
|
+
// export async function stateReset(opts: BaseOpts & { yes?: boolean } = {}): Promise<void> {
|
|
81
|
+
// assertTestLane(opts)
|
|
82
|
+
// const apiKey = readApiKeyOrBail()
|
|
83
|
+
// const config = readProjectConfigOrBail()
|
|
84
|
+
// const jobName = await resolveJobName(opts)
|
|
85
|
+
//
|
|
86
|
+
// await confirmOrBail(opts.yes, `Reset all test state for ${jobName}?`)
|
|
87
|
+
//
|
|
88
|
+
// const response = await fetchWithAuth<SdkStateResetResponse>(ApiRoutes.SDK.STATE_RESET, apiKey, { projectId: config.projectId, jobName, test: true }, "POST")
|
|
89
|
+
// const keys = response.deleted === 1 ? "1 key" : `${response.deleted} keys`
|
|
90
|
+
// process.stdout.write(chalk.green(`Reset test state for job ${jobName} (${keys} deleted).\n`))
|
|
91
|
+
// }
|
|
92
|
+
//
|
|
93
|
+
// async function resolveJobName(opts: BaseOpts): Promise<string> {
|
|
94
|
+
// if (opts.job?.trim()) return opts.job.trim()
|
|
95
|
+
// const provider = opts.provider ?? resolveProvider()
|
|
96
|
+
// const { job } = await loadJob(provider, undefined, opts.entryFile, { nonInteractive: true })
|
|
97
|
+
// return job.name
|
|
98
|
+
// }
|
|
99
|
+
//
|
|
100
|
+
// function assertTestLane(opts: BaseOpts): void {
|
|
101
|
+
// if (opts.test) return
|
|
102
|
+
// throw new CliError("deployed_state_read_only", "Deployed state is read-only from the CLI.", {
|
|
103
|
+
// detail: "Pass --test to target the test state used by `terse test` runs."
|
|
104
|
+
// })
|
|
105
|
+
// }
|
|
106
|
+
//
|
|
107
|
+
// async function confirmOrBail(yes: boolean | undefined, message: string): Promise<void> {
|
|
108
|
+
// if (yes) return
|
|
109
|
+
// if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
110
|
+
// throw new CliError("confirmation_required", "Refusing to modify state without confirmation.", {
|
|
111
|
+
// detail: "Pass --yes to confirm non-interactively."
|
|
112
|
+
// })
|
|
113
|
+
// }
|
|
114
|
+
// const approved = await confirm({ message, default: false })
|
|
115
|
+
// if (!approved) {
|
|
116
|
+
// process.stdout.write("Cancelled.\n")
|
|
117
|
+
// process.exit(0)
|
|
118
|
+
// }
|
|
119
|
+
// }
|
|
120
|
+
//
|
|
121
|
+
// function laneLabel(test?: boolean): string {
|
|
122
|
+
// return test ? "test" : "deployed"
|
|
123
|
+
// }
|
|
124
|
+
//
|
|
125
|
+
// function capitalize(value: string): string {
|
|
126
|
+
// return value.charAt(0).toUpperCase() + value.slice(1)
|
|
127
|
+
// }
|
|
128
|
+
//
|
|
129
|
+
// type BaseOpts = { job?: string; test?: boolean; entryFile?: string; provider?: LanguageProvider }
|
|
109
130
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/commands/state.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/commands/state.ts"],"names":[],"mappings":";AAAA,uHAAuH;AACvH,8CAA8C;AAC9C,4BAA4B;AAC5B,0CAA0C;AAC1C,uGAAuG;AACvG,EAAE;AACF,wEAAwE;AACxE,4CAA4C;AAC5C,0CAA0C;AAC1C,gEAAgE;AAChE,2EAA2E;AAC3E,oEAAoE;AACpE,EAAE;AACF,0CAA0C;AAC1C,EAAE;AACF,6FAA6F;AAC7F,wCAAwC;AACxC,+CAA+C;AAC/C,iDAAiD;AACjD,EAAE;AACF,sKAAsK;AACtK,EAAE;AACF,uBAAuB;AACvB,yEAAyE;AACzE,iBAAiB;AACjB,QAAQ;AACR,EAAE;AACF,wCAAwC;AACxC,wCAAwC;AACxC,yFAAyF;AACzF,iBAAiB;AACjB,QAAQ;AACR,EAAE;AACF,4FAA4F;AAC5F,2CAA2C;AAC3C,mGAAmG;AACnG,QAAQ;AACR,iIAAiI;AACjI,IAAI;AACJ,EAAE;AACF,oFAAoF;AACpF,wCAAwC;AACxC,+CAA+C;AAC/C,iDAAiD;AACjD,EAAE;AACF,yCAAyC;AACzC,YAAY;AACZ,yKAAyK;AACzK,wBAAwB;AACxB,mEAAmE;AACnE,sIAAsI;AACtI,YAAY;AACZ,sBAAsB;AACtB,QAAQ;AACR,EAAE;AACF,6CAA6C;AAC7C,uEAAuE;AACvE,IAAI;AACJ,EAAE;AACF,2GAA2G;AAC3G,2BAA2B;AAC3B,wCAAwC;AACxC,+CAA+C;AAC/C,iDAAiD;AACjD,EAAE;AACF,6FAA6F;AAC7F,EAAE;AACF,YAAY;AACZ,qIAAqI;AACrI,wBAAwB;AACxB,mEAAmE;AACnE,mHAAmH;AACnH,YAAY;AACZ,sBAAsB;AACtB,QAAQ;AACR,oGAAoG;AACpG,IAAI;AACJ,EAAE;AACF,6FAA6F;AAC7F,2BAA2B;AAC3B,wCAAwC;AACxC,+CAA+C;AAC/C,iDAAiD;AACjD,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,mKAAmK;AACnK,iFAAiF;AACjF,oGAAoG;AACpG,IAAI;AACJ,EAAE;AACF,mEAAmE;AACnE,mDAAmD;AACnD,0DAA0D;AAC1D,mGAAmG;AACnG,sBAAsB;AACtB,IAAI;AACJ,EAAE;AACF,kDAAkD;AAClD,4BAA4B;AAC5B,oGAAoG;AACpG,oFAAoF;AACpF,SAAS;AACT,IAAI;AACJ,EAAE;AACF,2FAA2F;AAC3F,sBAAsB;AACtB,2DAA2D;AAC3D,0GAA0G;AAC1G,iEAAiE;AACjE,aAAa;AACb,QAAQ;AACR,kEAAkE;AAClE,uBAAuB;AACvB,+CAA+C;AAC/C,0BAA0B;AAC1B,QAAQ;AACR,IAAI;AACJ,EAAE;AACF,+CAA+C;AAC/C,wCAAwC;AACxC,IAAI;AACJ,EAAE;AACF,+CAA+C;AAC/C,4DAA4D;AAC5D,IAAI;AACJ,EAAE;AACF,oGAAoG"}
|
package/dist/commands/test.d.ts
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
import type { LanguageProvider } from "../providers/LanguageProvider.js";
|
|
2
|
-
export declare function test(jobName?: string, verbose?: boolean, provider?: LanguageProvider, entryFile?: string, freshState?: boolean): Promise<void>;
|
|
3
|
-
export declare function testList(opts?: TestListOpts): Promise<void>;
|
|
4
|
-
export declare function testShow(opts: TestShowOpts): Promise<void>;
|
|
5
|
-
export declare function testRun(opts: TestRunOpts): Promise<void>;
|
|
6
|
-
export type TestListOpts = {
|
|
7
|
-
jobName?: string;
|
|
8
|
-
json?: boolean;
|
|
9
|
-
entryFile?: string;
|
|
10
|
-
provider?: LanguageProvider;
|
|
11
|
-
};
|
|
12
|
-
export type TestShowOpts = {
|
|
13
|
-
id: string;
|
|
14
|
-
jobName?: string;
|
|
15
|
-
json?: boolean;
|
|
16
|
-
entryFile?: string;
|
|
17
|
-
provider?: LanguageProvider;
|
|
18
|
-
};
|
|
19
|
-
export type TestRunOpts = {
|
|
20
|
-
jobName?: string;
|
|
21
|
-
id?: string;
|
|
22
|
-
eventJson?: string;
|
|
23
|
-
eventFile?: string;
|
|
24
|
-
verbose?: boolean;
|
|
25
|
-
entryFile?: string;
|
|
26
|
-
provider?: LanguageProvider;
|
|
27
|
-
freshState?: boolean;
|
|
28
|
-
};
|
|
29
1
|
//# sourceMappingURL=test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":""}
|