@rex0220/ksql-flownet 1.0.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/LICENSE +21 -0
- package/README.ja.md +81 -0
- package/README.md +117 -0
- package/dist/bundle/bundle-builder.d.ts +49 -0
- package/dist/bundle/bundle-builder.js +208 -0
- package/dist/bundle/index.d.ts +4 -0
- package/dist/bundle/index.js +4 -0
- package/dist/bundle/upload.d.ts +28 -0
- package/dist/bundle/upload.js +72 -0
- package/dist/bundle/zip-store.d.ts +17 -0
- package/dist/bundle/zip-store.js +175 -0
- package/dist/cli/archive-run-command.d.ts +12 -0
- package/dist/cli/archive-run-command.js +131 -0
- package/dist/cli/cancel-run-command.d.ts +9 -0
- package/dist/cli/cancel-run-command.js +77 -0
- package/dist/cli/force-unlock-network-command.d.ts +8 -0
- package/dist/cli/force-unlock-network-command.js +129 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +132 -0
- package/dist/cli/plan-command.d.ts +2 -0
- package/dist/cli/plan-command.js +100 -0
- package/dist/cli/poll-requests-command.d.ts +3 -0
- package/dist/cli/poll-requests-command.js +74 -0
- package/dist/cli/record-job-unlock-command.d.ts +11 -0
- package/dist/cli/record-job-unlock-command.js +78 -0
- package/dist/cli/resolve-node-command.d.ts +13 -0
- package/dist/cli/resolve-node-command.js +174 -0
- package/dist/cli/run-network-command.d.ts +14 -0
- package/dist/cli/run-network-command.js +418 -0
- package/dist/cli/status-command.d.ts +5 -0
- package/dist/cli/status-command.js +137 -0
- package/dist/cli/validate-command.d.ts +6 -0
- package/dist/cli/validate-command.js +17 -0
- package/dist/dag/descendants.d.ts +9 -0
- package/dist/dag/descendants.js +67 -0
- package/dist/dag/topological-sort.d.ts +7 -0
- package/dist/dag/topological-sort.js +32 -0
- package/dist/domain/business-key.d.ts +15 -0
- package/dist/domain/business-key.js +249 -0
- package/dist/domain/canonical-lock-key.d.ts +17 -0
- package/dist/domain/canonical-lock-key.js +60 -0
- package/dist/domain/canonical-record-key.d.ts +18 -0
- package/dist/domain/canonical-record-key.js +70 -0
- package/dist/domain/load-network.d.ts +4 -0
- package/dist/domain/load-network.js +47 -0
- package/dist/domain/network-definition.d.ts +47 -0
- package/dist/domain/network-definition.js +7 -0
- package/dist/domain/persistence-model.d.ts +198 -0
- package/dist/domain/persistence-model.js +2 -0
- package/dist/domain/run-aggregate.d.ts +3 -0
- package/dist/domain/run-aggregate.js +15 -0
- package/dist/domain/validate-network-path.d.ts +11 -0
- package/dist/domain/validate-network-path.js +33 -0
- package/dist/domain/validate-network.d.ts +3 -0
- package/dist/domain/validate-network.js +180 -0
- package/dist/executor/attempt-executor.d.ts +43 -0
- package/dist/executor/attempt-executor.js +236 -0
- package/dist/executor/job-log-reader.d.ts +37 -0
- package/dist/executor/job-log-reader.js +91 -0
- package/dist/executor/ksql-flow-cli.d.ts +86 -0
- package/dist/executor/ksql-flow-cli.js +161 -0
- package/dist/executor/preflight.d.ts +41 -0
- package/dist/executor/preflight.js +150 -0
- package/dist/executor/result-classifier.d.ts +69 -0
- package/dist/executor/result-classifier.js +237 -0
- package/dist/executor/run-subprocess.d.ts +64 -0
- package/dist/executor/run-subprocess.js +175 -0
- package/dist/io/input-baseline.d.ts +19 -0
- package/dist/io/input-baseline.js +214 -0
- package/dist/io/io-config.d.ts +6 -0
- package/dist/io/io-config.js +33 -0
- package/dist/io/io-path.d.ts +37 -0
- package/dist/io/io-path.js +279 -0
- package/dist/orchestration/archive-run.d.ts +53 -0
- package/dist/orchestration/archive-run.js +323 -0
- package/dist/orchestration/cancel-request.d.ts +18 -0
- package/dist/orchestration/cancel-request.js +67 -0
- package/dist/orchestration/ensure-run.d.ts +83 -0
- package/dist/orchestration/ensure-run.js +632 -0
- package/dist/orchestration/job-lock-audit.d.ts +24 -0
- package/dist/orchestration/job-lock-audit.js +123 -0
- package/dist/orchestration/orphan-attempt-adjudication.d.ts +39 -0
- package/dist/orchestration/orphan-attempt-adjudication.js +167 -0
- package/dist/orchestration/reconciliation.d.ts +41 -0
- package/dist/orchestration/reconciliation.js +526 -0
- package/dist/orchestration/resolve-node.d.ts +29 -0
- package/dist/orchestration/resolve-node.js +105 -0
- package/dist/orchestration/run-activity.d.ts +13 -0
- package/dist/orchestration/run-activity.js +14 -0
- package/dist/orchestration/sequential-scheduler.d.ts +79 -0
- package/dist/orchestration/sequential-scheduler.js +706 -0
- package/dist/orchestration/status.d.ts +91 -0
- package/dist/orchestration/status.js +171 -0
- package/dist/persistence/in-memory-repository.d.ts +41 -0
- package/dist/persistence/in-memory-repository.js +333 -0
- package/dist/persistence/kintone/client.d.ts +36 -0
- package/dist/persistence/kintone/client.js +93 -0
- package/dist/persistence/kintone/design-notes.d.ts +38 -0
- package/dist/persistence/kintone/design-notes.js +38 -0
- package/dist/persistence/kintone/repository.d.ts +44 -0
- package/dist/persistence/kintone/repository.js +836 -0
- package/dist/persistence/kintone/schema.d.ts +116 -0
- package/dist/persistence/kintone/schema.js +115 -0
- package/dist/persistence/network-lock-reader.d.ts +24 -0
- package/dist/persistence/network-lock-reader.js +43 -0
- package/dist/persistence/network-lock-recovery.d.ts +66 -0
- package/dist/persistence/network-lock-recovery.js +392 -0
- package/dist/persistence/network-lock.d.ts +97 -0
- package/dist/persistence/network-lock.js +408 -0
- package/dist/persistence/repository.d.ts +101 -0
- package/dist/persistence/repository.js +11 -0
- package/dist/persistence/state-transition.d.ts +4 -0
- package/dist/persistence/state-transition.js +25 -0
- package/dist/requests/flownet-child-client.d.ts +78 -0
- package/dist/requests/flownet-child-client.js +243 -0
- package/dist/requests/kintone-request-store.d.ts +44 -0
- package/dist/requests/kintone-request-store.js +202 -0
- package/dist/requests/poll-requests-config.d.ts +26 -0
- package/dist/requests/poll-requests-config.js +105 -0
- package/dist/requests/request-model.d.ts +57 -0
- package/dist/requests/request-model.js +305 -0
- package/dist/requests/request-poller.d.ts +33 -0
- package/dist/requests/request-poller.js +353 -0
- package/dist/requests/request-result.d.ts +18 -0
- package/dist/requests/request-result.js +215 -0
- package/dist/requests/start-request.d.ts +26 -0
- package/dist/requests/start-request.js +83 -0
- package/package.json +63 -0
- package/schemas/.gitkeep +1 -0
- package/schemas/network-definition.schema.json +121 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export declare const KINTONE_FIELD_MAP: {
|
|
2
|
+
readonly NETWORK_RUN: {
|
|
3
|
+
readonly record_key: "record_key";
|
|
4
|
+
readonly record_type: "record_type";
|
|
5
|
+
readonly run_id: "run_id";
|
|
6
|
+
readonly network_id: "network_id";
|
|
7
|
+
readonly business_key: "business_key";
|
|
8
|
+
readonly max_active_runs: "max_active_runs";
|
|
9
|
+
readonly status: "status";
|
|
10
|
+
readonly lifecycle_status: "lifecycle_status";
|
|
11
|
+
readonly resume_allowed: "resume_allowed";
|
|
12
|
+
readonly as_of: "as_of";
|
|
13
|
+
readonly definition_schema_version: "definition_schema_version";
|
|
14
|
+
readonly definition_sha256: "definition_sha256";
|
|
15
|
+
readonly source_bundle_sha256: "source_bundle_sha256";
|
|
16
|
+
readonly source_bundle_attachment: "source_bundle_attachment";
|
|
17
|
+
readonly resolved_profile_snapshot: "resolved_profile_snapshot";
|
|
18
|
+
readonly resolved_profile_sha256: "resolved_profile_sha256";
|
|
19
|
+
readonly ksql_flow_version: "ksql_flow_version";
|
|
20
|
+
readonly engine_version: "engine_version";
|
|
21
|
+
readonly dialect: "dialect";
|
|
22
|
+
readonly created_at: "created_at";
|
|
23
|
+
readonly started_at: "started_at";
|
|
24
|
+
readonly finished_at: "finished_at";
|
|
25
|
+
readonly updated_at: "updated_at";
|
|
26
|
+
};
|
|
27
|
+
readonly NODE_STATE: {
|
|
28
|
+
readonly record_key: "record_key";
|
|
29
|
+
readonly record_type: "record_type";
|
|
30
|
+
readonly run_id: "run_id";
|
|
31
|
+
readonly revision: "revision";
|
|
32
|
+
readonly status: "status";
|
|
33
|
+
readonly started_at: "started_at";
|
|
34
|
+
readonly finished_at: "finished_at";
|
|
35
|
+
readonly updated_at: "updated_at";
|
|
36
|
+
readonly node_state_id: "node_state_id";
|
|
37
|
+
readonly node_state_key: "node_state_key";
|
|
38
|
+
readonly node_id: "node_id";
|
|
39
|
+
readonly job_id: "job_id";
|
|
40
|
+
readonly latest_attempt_no: "latest_attempt_no";
|
|
41
|
+
readonly active_attempt_id: "active_attempt_id";
|
|
42
|
+
readonly idempotent: "idempotent";
|
|
43
|
+
readonly trigger_rule: "trigger_rule";
|
|
44
|
+
readonly blocked_by: "blocked_by";
|
|
45
|
+
readonly status_reason: "status_reason";
|
|
46
|
+
};
|
|
47
|
+
readonly CANCEL_REQUEST: {
|
|
48
|
+
readonly record_key: "record_key";
|
|
49
|
+
readonly record_type: "record_type";
|
|
50
|
+
readonly run_id: "run_id";
|
|
51
|
+
readonly status_reason: "status_reason";
|
|
52
|
+
};
|
|
53
|
+
readonly RUN_INVOCATION: {
|
|
54
|
+
readonly record_key: "record_key";
|
|
55
|
+
readonly record_type: "record_type";
|
|
56
|
+
readonly run_id: "run_id";
|
|
57
|
+
readonly started_at: "started_at";
|
|
58
|
+
readonly finished_at: "finished_at";
|
|
59
|
+
readonly status: "status";
|
|
60
|
+
readonly result_code: "result_code";
|
|
61
|
+
readonly invocation_id: "invocation_id";
|
|
62
|
+
readonly mode: "mode";
|
|
63
|
+
readonly requested_by: "requested_by";
|
|
64
|
+
readonly host: "host";
|
|
65
|
+
readonly selected_node_ids: "selected_node_ids";
|
|
66
|
+
readonly preserved_node_ids: "preserved_node_ids";
|
|
67
|
+
readonly blocked_node_ids: "blocked_node_ids";
|
|
68
|
+
readonly reason: "reason";
|
|
69
|
+
};
|
|
70
|
+
readonly NODE_ATTEMPT: {
|
|
71
|
+
readonly record_key: "record_key";
|
|
72
|
+
readonly record_type: "record_type";
|
|
73
|
+
readonly run_id: "run_id";
|
|
74
|
+
readonly finished_at: "finished_at";
|
|
75
|
+
readonly status: "status";
|
|
76
|
+
readonly result_code: "result_code";
|
|
77
|
+
readonly node_attempt_id: "node_attempt_id";
|
|
78
|
+
readonly attempt_key: "attempt_key";
|
|
79
|
+
readonly node_id: "node_id";
|
|
80
|
+
readonly job_id: "job_id";
|
|
81
|
+
readonly invocation_id: "invocation_id";
|
|
82
|
+
readonly attempt_no: "attempt_no";
|
|
83
|
+
readonly execution_started_at: "execution_started_at";
|
|
84
|
+
readonly runner_execution_started_at: "runner_execution_started_at";
|
|
85
|
+
readonly execution_id: "execution_id";
|
|
86
|
+
readonly duration_sec: "duration_sec";
|
|
87
|
+
readonly error_message: "error_message";
|
|
88
|
+
readonly read_count: "read_count";
|
|
89
|
+
readonly written_count: "written_count";
|
|
90
|
+
readonly last_successful_chunk_no: "last_successful_chunk_no";
|
|
91
|
+
readonly last_written_key: "last_written_key";
|
|
92
|
+
readonly state_revision_before: "state_revision_before";
|
|
93
|
+
};
|
|
94
|
+
readonly ATTEMPT_RESOLUTION: {
|
|
95
|
+
readonly record_key: "record_key";
|
|
96
|
+
readonly record_type: "record_type";
|
|
97
|
+
readonly event_type: "event_type";
|
|
98
|
+
readonly attempt_id: "attempt_id";
|
|
99
|
+
readonly resolved_outcome: "resolved_outcome";
|
|
100
|
+
readonly evidence_ref: "evidence_ref";
|
|
101
|
+
readonly service_principal: "service_principal";
|
|
102
|
+
readonly requested_by: "requested_by";
|
|
103
|
+
readonly approved_by: "approved_by";
|
|
104
|
+
readonly resolved_at: "resolved_at";
|
|
105
|
+
};
|
|
106
|
+
readonly OPERATION_AUDIT: {
|
|
107
|
+
readonly record_key: "record_key";
|
|
108
|
+
readonly record_type: "record_type";
|
|
109
|
+
readonly run_id: "run_id";
|
|
110
|
+
readonly result_code: "result_code";
|
|
111
|
+
readonly reason: "reason";
|
|
112
|
+
readonly resolved_at: "resolved_at";
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type KintoneRecordType = keyof typeof KINTONE_FIELD_MAP;
|
|
116
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export const KINTONE_FIELD_MAP = {
|
|
2
|
+
NETWORK_RUN: {
|
|
3
|
+
record_key: "record_key",
|
|
4
|
+
record_type: "record_type",
|
|
5
|
+
run_id: "run_id",
|
|
6
|
+
network_id: "network_id",
|
|
7
|
+
business_key: "business_key",
|
|
8
|
+
max_active_runs: "max_active_runs",
|
|
9
|
+
status: "status",
|
|
10
|
+
lifecycle_status: "lifecycle_status",
|
|
11
|
+
resume_allowed: "resume_allowed",
|
|
12
|
+
as_of: "as_of",
|
|
13
|
+
definition_schema_version: "definition_schema_version",
|
|
14
|
+
definition_sha256: "definition_sha256",
|
|
15
|
+
source_bundle_sha256: "source_bundle_sha256",
|
|
16
|
+
source_bundle_attachment: "source_bundle_attachment",
|
|
17
|
+
resolved_profile_snapshot: "resolved_profile_snapshot",
|
|
18
|
+
resolved_profile_sha256: "resolved_profile_sha256",
|
|
19
|
+
ksql_flow_version: "ksql_flow_version",
|
|
20
|
+
engine_version: "engine_version",
|
|
21
|
+
dialect: "dialect",
|
|
22
|
+
created_at: "created_at",
|
|
23
|
+
started_at: "started_at",
|
|
24
|
+
finished_at: "finished_at",
|
|
25
|
+
updated_at: "updated_at",
|
|
26
|
+
},
|
|
27
|
+
NODE_STATE: {
|
|
28
|
+
record_key: "record_key",
|
|
29
|
+
record_type: "record_type",
|
|
30
|
+
run_id: "run_id",
|
|
31
|
+
revision: "revision",
|
|
32
|
+
status: "status",
|
|
33
|
+
started_at: "started_at",
|
|
34
|
+
finished_at: "finished_at",
|
|
35
|
+
updated_at: "updated_at",
|
|
36
|
+
node_state_id: "node_state_id",
|
|
37
|
+
node_state_key: "node_state_key",
|
|
38
|
+
node_id: "node_id",
|
|
39
|
+
job_id: "job_id",
|
|
40
|
+
latest_attempt_no: "latest_attempt_no",
|
|
41
|
+
active_attempt_id: "active_attempt_id",
|
|
42
|
+
idempotent: "idempotent",
|
|
43
|
+
trigger_rule: "trigger_rule",
|
|
44
|
+
blocked_by: "blocked_by",
|
|
45
|
+
status_reason: "status_reason",
|
|
46
|
+
},
|
|
47
|
+
CANCEL_REQUEST: {
|
|
48
|
+
record_key: "record_key",
|
|
49
|
+
record_type: "record_type",
|
|
50
|
+
run_id: "run_id",
|
|
51
|
+
status_reason: "status_reason",
|
|
52
|
+
},
|
|
53
|
+
RUN_INVOCATION: {
|
|
54
|
+
record_key: "record_key",
|
|
55
|
+
record_type: "record_type",
|
|
56
|
+
run_id: "run_id",
|
|
57
|
+
started_at: "started_at",
|
|
58
|
+
finished_at: "finished_at",
|
|
59
|
+
status: "status",
|
|
60
|
+
result_code: "result_code",
|
|
61
|
+
invocation_id: "invocation_id",
|
|
62
|
+
mode: "mode",
|
|
63
|
+
requested_by: "requested_by",
|
|
64
|
+
host: "host",
|
|
65
|
+
selected_node_ids: "selected_node_ids",
|
|
66
|
+
preserved_node_ids: "preserved_node_ids",
|
|
67
|
+
blocked_node_ids: "blocked_node_ids",
|
|
68
|
+
reason: "reason",
|
|
69
|
+
},
|
|
70
|
+
NODE_ATTEMPT: {
|
|
71
|
+
record_key: "record_key",
|
|
72
|
+
record_type: "record_type",
|
|
73
|
+
run_id: "run_id",
|
|
74
|
+
finished_at: "finished_at",
|
|
75
|
+
status: "status",
|
|
76
|
+
result_code: "result_code",
|
|
77
|
+
node_attempt_id: "node_attempt_id",
|
|
78
|
+
attempt_key: "attempt_key",
|
|
79
|
+
node_id: "node_id",
|
|
80
|
+
job_id: "job_id",
|
|
81
|
+
invocation_id: "invocation_id",
|
|
82
|
+
attempt_no: "attempt_no",
|
|
83
|
+
execution_started_at: "execution_started_at",
|
|
84
|
+
runner_execution_started_at: "runner_execution_started_at",
|
|
85
|
+
execution_id: "execution_id",
|
|
86
|
+
duration_sec: "duration_sec",
|
|
87
|
+
error_message: "error_message",
|
|
88
|
+
read_count: "read_count",
|
|
89
|
+
written_count: "written_count",
|
|
90
|
+
last_successful_chunk_no: "last_successful_chunk_no",
|
|
91
|
+
last_written_key: "last_written_key",
|
|
92
|
+
state_revision_before: "state_revision_before",
|
|
93
|
+
},
|
|
94
|
+
ATTEMPT_RESOLUTION: {
|
|
95
|
+
record_key: "record_key",
|
|
96
|
+
record_type: "record_type",
|
|
97
|
+
event_type: "event_type",
|
|
98
|
+
attempt_id: "attempt_id",
|
|
99
|
+
resolved_outcome: "resolved_outcome",
|
|
100
|
+
evidence_ref: "evidence_ref",
|
|
101
|
+
service_principal: "service_principal",
|
|
102
|
+
requested_by: "requested_by",
|
|
103
|
+
approved_by: "approved_by",
|
|
104
|
+
resolved_at: "resolved_at",
|
|
105
|
+
},
|
|
106
|
+
OPERATION_AUDIT: {
|
|
107
|
+
record_key: "record_key",
|
|
108
|
+
record_type: "record_type",
|
|
109
|
+
run_id: "run_id",
|
|
110
|
+
result_code: "result_code",
|
|
111
|
+
reason: "reason",
|
|
112
|
+
resolved_at: "resolved_at",
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface NetworkLockStatus {
|
|
2
|
+
readonly record_id: string;
|
|
3
|
+
readonly owner_invocation_id: string;
|
|
4
|
+
readonly owner_instance_id: string;
|
|
5
|
+
readonly heartbeat_at: string;
|
|
6
|
+
readonly lease_expires_at: string;
|
|
7
|
+
readonly revision: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NetworkLockStatusReader {
|
|
10
|
+
getNetworkLock(profile: string, networkId: string): Promise<NetworkLockStatus | null>;
|
|
11
|
+
}
|
|
12
|
+
export interface KintoneNetworkLockStatusReaderConfig {
|
|
13
|
+
readonly baseUrl: string;
|
|
14
|
+
readonly stateAppId: number;
|
|
15
|
+
readonly stateApiToken: string;
|
|
16
|
+
readonly fetch?: typeof fetch;
|
|
17
|
+
}
|
|
18
|
+
export declare function ownerInstanceIdFromStatusReason(statusReason: string): string;
|
|
19
|
+
export declare class KintoneNetworkLockStatusReader implements NetworkLockStatusReader {
|
|
20
|
+
private readonly client;
|
|
21
|
+
constructor(config: KintoneNetworkLockStatusReaderConfig);
|
|
22
|
+
getNetworkLock(profile: string, networkId: string): Promise<NetworkLockStatus | null>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=network-lock-reader.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { networkLockKey } from "../domain/canonical-lock-key.js";
|
|
2
|
+
import { KintoneClient } from "./kintone/client.js";
|
|
3
|
+
import { RepositoryError } from "./repository.js";
|
|
4
|
+
const text = (record, code) => String(record[code]?.value ?? "");
|
|
5
|
+
export function ownerInstanceIdFromStatusReason(statusReason) {
|
|
6
|
+
return statusReason.startsWith("owner_instance_id=")
|
|
7
|
+
? statusReason.slice("owner_instance_id=".length)
|
|
8
|
+
: "";
|
|
9
|
+
}
|
|
10
|
+
function quote(value) {
|
|
11
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
12
|
+
}
|
|
13
|
+
export class KintoneNetworkLockStatusReader {
|
|
14
|
+
client;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.client = new KintoneClient({
|
|
17
|
+
baseUrl: config.baseUrl,
|
|
18
|
+
appId: config.stateAppId,
|
|
19
|
+
apiToken: config.stateApiToken,
|
|
20
|
+
...(config.fetch === undefined ? {} : { fetch: config.fetch }),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async getNetworkLock(profile, networkId) {
|
|
24
|
+
const lockKey = networkLockKey(profile, networkId);
|
|
25
|
+
const records = await this.client.getRecords(`record_type in ("NETWORK_LOCK") and lock_key in (${quote(lockKey)}) and status in ("RUNNING")`);
|
|
26
|
+
if (records.length === 0)
|
|
27
|
+
return null;
|
|
28
|
+
if (records.length !== 1) {
|
|
29
|
+
throw new RepositoryError("MULTIPLE_RECORDS", "multiple active Network locks matched");
|
|
30
|
+
}
|
|
31
|
+
const record = records[0];
|
|
32
|
+
const ownerInstanceId = ownerInstanceIdFromStatusReason(text(record, "status_reason"));
|
|
33
|
+
return {
|
|
34
|
+
record_id: text(record, "$id"),
|
|
35
|
+
owner_invocation_id: text(record, "owner_invocation_id"),
|
|
36
|
+
owner_instance_id: ownerInstanceId,
|
|
37
|
+
heartbeat_at: text(record, "heartbeat_at"),
|
|
38
|
+
lease_expires_at: text(record, "lease_expires_at"),
|
|
39
|
+
revision: Number(record.revision?.value),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=network-lock-reader.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { NetworkLockForceReleaseOperationAudit } from "../domain/persistence-model.js";
|
|
2
|
+
import type { PersistenceRepository } from "./repository.js";
|
|
3
|
+
export interface StopConfirmationInput {
|
|
4
|
+
readonly profile: string;
|
|
5
|
+
readonly networkId: string;
|
|
6
|
+
readonly expectedOwnerInvocationId: string;
|
|
7
|
+
readonly ownerInstanceId: string;
|
|
8
|
+
readonly stopConfirmedBy: string;
|
|
9
|
+
readonly stopMethod: string;
|
|
10
|
+
readonly stopEvidenceRef: string;
|
|
11
|
+
}
|
|
12
|
+
export interface StopConfirmationResult {
|
|
13
|
+
readonly confirmed: boolean;
|
|
14
|
+
readonly method: string;
|
|
15
|
+
readonly detail: string;
|
|
16
|
+
}
|
|
17
|
+
export interface StopConfirmation {
|
|
18
|
+
confirm(input: StopConfirmationInput): Promise<StopConfirmationResult>;
|
|
19
|
+
}
|
|
20
|
+
export declare const manualStopConfirmation: StopConfirmation;
|
|
21
|
+
export interface StopConfirmationDependencies {
|
|
22
|
+
readonly host?: string;
|
|
23
|
+
readonly processKill?: (pid: number, signal: 0) => boolean;
|
|
24
|
+
readonly fetch?: typeof fetch;
|
|
25
|
+
readonly gcpAccessToken?: string;
|
|
26
|
+
readonly now?: () => Date;
|
|
27
|
+
}
|
|
28
|
+
export declare function createLocalPidStopConfirmation(dependencies?: StopConfirmationDependencies): StopConfirmation;
|
|
29
|
+
export declare function createCloudRunJobExecutionStopConfirmation(dependencies?: StopConfirmationDependencies): StopConfirmation;
|
|
30
|
+
export declare function defaultStopConfirmations(dependencies?: StopConfirmationDependencies): ReadonlyMap<string, StopConfirmation>;
|
|
31
|
+
export type NetworkLockRecoveryErrorCode = "INVALID_ARGUMENT" | "LOCK_NOT_FOUND" | "LOCK_READ_FAILED" | "OWNER_MISMATCH" | "LEASE_STILL_ACTIVE" | "STOP_NOT_CONFIRMED" | "HEARTBEAT_ADVANCED" | "REVISION_CONFLICT" | "RELEASE_UNCONFIRMED" | "AUDIT_FAILED";
|
|
32
|
+
export declare class NetworkLockRecoveryError extends Error {
|
|
33
|
+
readonly code: NetworkLockRecoveryErrorCode;
|
|
34
|
+
readonly causeDetail: unknown;
|
|
35
|
+
constructor(code: NetworkLockRecoveryErrorCode, message: string, causeDetail?: unknown);
|
|
36
|
+
}
|
|
37
|
+
export interface ForceUnlockNetworkInput {
|
|
38
|
+
readonly networkId: string;
|
|
39
|
+
readonly profile: string;
|
|
40
|
+
readonly expectedOwnerInvocationId: string;
|
|
41
|
+
readonly reason: string;
|
|
42
|
+
readonly evidenceRef: string;
|
|
43
|
+
readonly stopConfirmedBy: string;
|
|
44
|
+
readonly stopEvidenceRef: string;
|
|
45
|
+
readonly stopMethod: string;
|
|
46
|
+
readonly servicePrincipal: string;
|
|
47
|
+
readonly requestedBy: string;
|
|
48
|
+
}
|
|
49
|
+
export interface NetworkLockRecoveryDependencies {
|
|
50
|
+
readonly baseUrl: string;
|
|
51
|
+
readonly stateAppId: number;
|
|
52
|
+
readonly stateApiToken: string;
|
|
53
|
+
readonly repository: PersistenceRepository;
|
|
54
|
+
readonly fetch?: typeof fetch;
|
|
55
|
+
readonly stopConfirmations?: ReadonlyMap<string, StopConfirmation>;
|
|
56
|
+
readonly now?: () => Date;
|
|
57
|
+
readonly uuid?: () => string;
|
|
58
|
+
}
|
|
59
|
+
export interface ForceUnlockNetworkResult {
|
|
60
|
+
readonly lockKey: string;
|
|
61
|
+
readonly previousOwnerInvocationId: string;
|
|
62
|
+
readonly postReleaseRevision: number;
|
|
63
|
+
readonly audit: NetworkLockForceReleaseOperationAudit;
|
|
64
|
+
}
|
|
65
|
+
export declare function forceUnlockNetwork(input: ForceUnlockNetworkInput, dependencies: NetworkLockRecoveryDependencies): Promise<ForceUnlockNetworkResult>;
|
|
66
|
+
//# sourceMappingURL=network-lock-recovery.d.ts.map
|