@unifyplane/logsdk 0.1.1 → 0.1.4
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/package.json +6 -1
- package/src/index.ts +4 -1
- package/src/sinks/index.ts +14 -0
- package/src.zip +0 -0
- package/unifyplane-logsdk-0.1.2.tgz +0 -0
- package/dist/core/clock.d.ts +0 -3
- package/dist/core/clock.d.ts.map +0 -1
- package/dist/core/clock.js +0 -21
- package/dist/core/clock.js.map +0 -1
- package/dist/core/context.d.ts +0 -10
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/context.js +0 -100
- package/dist/core/context.js.map +0 -1
- package/dist/core/fanout.d.ts +0 -4
- package/dist/core/fanout.d.ts.map +0 -1
- package/dist/core/fanout.js +0 -32
- package/dist/core/fanout.js.map +0 -1
- package/dist/core/ids.d.ts +0 -6
- package/dist/core/ids.d.ts.map +0 -1
- package/dist/core/ids.js +0 -27
- package/dist/core/ids.js.map +0 -1
- package/dist/core/message_constraints.d.ts +0 -4
- package/dist/core/message_constraints.d.ts.map +0 -1
- package/dist/core/message_constraints.js +0 -53
- package/dist/core/message_constraints.js.map +0 -1
- package/dist/core/outcomes.d.ts +0 -5
- package/dist/core/outcomes.d.ts.map +0 -1
- package/dist/core/outcomes.js +0 -4
- package/dist/core/outcomes.js.map +0 -1
- package/dist/core/record_builder.d.ts +0 -34
- package/dist/core/record_builder.d.ts.map +0 -1
- package/dist/core/record_builder.js +0 -188
- package/dist/core/record_builder.js.map +0 -1
- package/dist/core/spool.d.ts +0 -4
- package/dist/core/spool.d.ts.map +0 -1
- package/dist/core/spool.js +0 -31
- package/dist/core/spool.js.map +0 -1
- package/dist/core/types.d.ts +0 -33
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -4
- package/dist/core/types.js.map +0 -1
- package/dist/esm/core/clock.js +0 -21
- package/dist/esm/core/clock.js.map +0 -1
- package/dist/esm/core/context.js +0 -100
- package/dist/esm/core/context.js.map +0 -1
- package/dist/esm/core/fanout.js +0 -32
- package/dist/esm/core/fanout.js.map +0 -1
- package/dist/esm/core/ids.js +0 -27
- package/dist/esm/core/ids.js.map +0 -1
- package/dist/esm/core/message_constraints.js +0 -53
- package/dist/esm/core/message_constraints.js.map +0 -1
- package/dist/esm/core/outcomes.js +0 -4
- package/dist/esm/core/outcomes.js.map +0 -1
- package/dist/esm/core/record_builder.js +0 -188
- package/dist/esm/core/record_builder.js.map +0 -1
- package/dist/esm/core/spool.js +0 -31
- package/dist/esm/core/spool.js.map +0 -1
- package/dist/esm/core/types.js +0 -4
- package/dist/esm/core/types.js.map +0 -1
- package/dist/esm/index.js +0 -52
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/sinks/file_ndjson.js +0 -29
- package/dist/esm/sinks/file_ndjson.js.map +0 -1
- package/dist/esm/sinks/file_ndjson_sink.js +0 -36
- package/dist/esm/sinks/file_ndjson_sink.js.map +0 -1
- package/dist/esm/sinks/sink_types.js +0 -2
- package/dist/esm/sinks/sink_types.js.map +0 -1
- package/dist/esm/sinks/stdout_sink.js +0 -15
- package/dist/esm/sinks/stdout_sink.js.map +0 -1
- package/dist/esm/validate/api_surface_guard.js +0 -63
- package/dist/esm/validate/api_surface_guard.js.map +0 -1
- package/dist/esm/validate/noncompliance.js +0 -17
- package/dist/esm/validate/noncompliance.js.map +0 -1
- package/dist/esm/validate/schema_guard.js +0 -151
- package/dist/esm/validate/schema_guard.js.map +0 -1
- package/dist/index.d.ts +0 -26
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -52
- package/dist/index.js.map +0 -1
- package/dist/sinks/file_ndjson.d.ts +0 -18
- package/dist/sinks/file_ndjson.d.ts.map +0 -1
- package/dist/sinks/file_ndjson.js +0 -29
- package/dist/sinks/file_ndjson.js.map +0 -1
- package/dist/sinks/file_ndjson_sink.d.ts +0 -7
- package/dist/sinks/file_ndjson_sink.d.ts.map +0 -1
- package/dist/sinks/file_ndjson_sink.js +0 -36
- package/dist/sinks/file_ndjson_sink.js.map +0 -1
- package/dist/sinks/sink_types.d.ts +0 -12
- package/dist/sinks/sink_types.d.ts.map +0 -1
- package/dist/sinks/sink_types.js +0 -2
- package/dist/sinks/sink_types.js.map +0 -1
- package/dist/sinks/stdout_sink.d.ts +0 -6
- package/dist/sinks/stdout_sink.d.ts.map +0 -1
- package/dist/sinks/stdout_sink.js +0 -15
- package/dist/sinks/stdout_sink.js.map +0 -1
- package/dist/types/core/clock.d.ts +0 -3
- package/dist/types/core/clock.d.ts.map +0 -1
- package/dist/types/core/context.d.ts +0 -10
- package/dist/types/core/context.d.ts.map +0 -1
- package/dist/types/core/fanout.d.ts +0 -4
- package/dist/types/core/fanout.d.ts.map +0 -1
- package/dist/types/core/ids.d.ts +0 -6
- package/dist/types/core/ids.d.ts.map +0 -1
- package/dist/types/core/message_constraints.d.ts +0 -4
- package/dist/types/core/message_constraints.d.ts.map +0 -1
- package/dist/types/core/outcomes.d.ts +0 -5
- package/dist/types/core/outcomes.d.ts.map +0 -1
- package/dist/types/core/record_builder.d.ts +0 -34
- package/dist/types/core/record_builder.d.ts.map +0 -1
- package/dist/types/core/spool.d.ts +0 -4
- package/dist/types/core/spool.d.ts.map +0 -1
- package/dist/types/core/types.d.ts +0 -33
- package/dist/types/core/types.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -26
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/sinks/file_ndjson.d.ts +0 -18
- package/dist/types/sinks/file_ndjson.d.ts.map +0 -1
- package/dist/types/sinks/file_ndjson_sink.d.ts +0 -7
- package/dist/types/sinks/file_ndjson_sink.d.ts.map +0 -1
- package/dist/types/sinks/sink_types.d.ts +0 -12
- package/dist/types/sinks/sink_types.d.ts.map +0 -1
- package/dist/types/sinks/stdout_sink.d.ts +0 -6
- package/dist/types/sinks/stdout_sink.d.ts.map +0 -1
- package/dist/types/validate/api_surface_guard.d.ts +0 -2
- package/dist/types/validate/api_surface_guard.d.ts.map +0 -1
- package/dist/types/validate/noncompliance.d.ts +0 -15
- package/dist/types/validate/noncompliance.d.ts.map +0 -1
- package/dist/types/validate/schema_guard.d.ts +0 -5
- package/dist/types/validate/schema_guard.d.ts.map +0 -1
- package/dist/validate/api_surface_guard.d.ts +0 -2
- package/dist/validate/api_surface_guard.d.ts.map +0 -1
- package/dist/validate/api_surface_guard.js +0 -63
- package/dist/validate/api_surface_guard.js.map +0 -1
- package/dist/validate/noncompliance.d.ts +0 -15
- package/dist/validate/noncompliance.d.ts.map +0 -1
- package/dist/validate/noncompliance.js +0 -17
- package/dist/validate/noncompliance.js.map +0 -1
- package/dist/validate/schema_guard.d.ts +0 -5
- package/dist/validate/schema_guard.d.ts.map +0 -1
- package/dist/validate/schema_guard.js +0 -151
- package/dist/validate/schema_guard.js.map +0 -1
- package/unifyplane-logsdk-0.1.0.tgz +0 -0
- package/unifyplane-logsdk-0.1.1.tgz +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sink_types.d.ts","sourceRoot":"","sources":["../../src/sinks/sink_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,eAAe,CAAC;AAE1D,MAAM,WAAW,IAAI,CAAC,OAAO,GAAG,UAAU;IACxC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,KAAK,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,SAAS,CAAC,OAAO,GAAG,UAAU;IAC7C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;CACtB"}
|
package/dist/sinks/sink_types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sink_types.js","sourceRoot":"","sources":["../../src/sinks/sink_types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdout_sink.d.ts","sourceRoot":"","sources":["../../src/sinks/stdout_sink.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAW7C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference path="../process-shim.d.ts" />
|
|
2
|
-
export function createStdoutSink() {
|
|
3
|
-
return {
|
|
4
|
-
async emit(record) {
|
|
5
|
-
try {
|
|
6
|
-
const line = JSON.stringify(record);
|
|
7
|
-
process.stdout.write(`${line}\n`);
|
|
8
|
-
}
|
|
9
|
-
catch {
|
|
10
|
-
// Best-effort only: never throw.
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=stdout_sink.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdout_sink.js","sourceRoot":"","sources":["../../src/sinks/stdout_sink.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAQ7C,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,MAAkB;YAC3B,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBACpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;YACpC,CAAC;YAAC,MAAM,CAAC;gBACP,iCAAiC;YACnC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../src/core/clock.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAerC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
2
|
-
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
3
|
-
[key: string]: JsonValue;
|
|
4
|
-
};
|
|
5
|
-
export declare function initContext(context: unknown, version?: string): void;
|
|
6
|
-
export declare function getContextHash(): string;
|
|
7
|
-
export declare function getContextVersion(): string;
|
|
8
|
-
export declare function resetContextForTests(): void;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/core/context.ts"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAkBnF,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,MAAgC,GACxC,IAAI,CAiBN;AAED,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAK3C"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SinkEntry, StepRecord } from "../sinks/sink_types.js";
|
|
2
|
-
export type FanoutOutcome = "OK" | "DEGRADED" | "FAILED";
|
|
3
|
-
export declare function fanout(record: StepRecord, sinks: ReadonlyArray<SinkEntry>): Promise<FanoutOutcome>;
|
|
4
|
-
//# sourceMappingURL=fanout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fanout.d.ts","sourceRoot":"","sources":["../../../src/core/fanout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpE,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEzD,wBAAsB,MAAM,CAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAC9B,OAAO,CAAC,aAAa,CAAC,CA4BxB"}
|
package/dist/types/core/ids.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/core/ids.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,YAAY,IAAI,MAAM,CAAC;IACvB,YAAY,IAAI,MAAM,CAAC;CACxB;AASD,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,WAAW,CAoBnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message_constraints.d.ts","sourceRoot":"","sources":["../../../src/core/message_constraints.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,kBAAkB,MAAM,CAAC;AAyC/B,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAsB3D;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outcomes.d.ts","sourceRoot":"","sources":["../../../src/core/outcomes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE,EAAG,IAAa,CAAC;AAChC,eAAO,MAAM,QAAQ,EAAG,UAAmB,CAAC;AAC5C,eAAO,MAAM,MAAM,EAAG,QAAiB,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG,OAAO,EAAE,GAAG,OAAO,QAAQ,GAAG,OAAO,MAAM,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { assertValidMessage } from "./message_constraints.js";
|
|
2
|
-
import type { StepRecord } from "./types.js";
|
|
3
|
-
export declare const message_constraints: {
|
|
4
|
-
maxLength: number;
|
|
5
|
-
validate: typeof assertValidMessage;
|
|
6
|
-
};
|
|
7
|
-
export type EvidenceRef = string;
|
|
8
|
-
export type SystemOwnership = {
|
|
9
|
-
institution: string;
|
|
10
|
-
system_name: string;
|
|
11
|
-
system_type: string;
|
|
12
|
-
environment: string;
|
|
13
|
-
system_version: string;
|
|
14
|
-
instance_id?: string;
|
|
15
|
-
};
|
|
16
|
-
export type StepRecordOverrides = {
|
|
17
|
-
record_id?: string;
|
|
18
|
-
timestamp_utc?: string;
|
|
19
|
-
monotonic_time?: number;
|
|
20
|
-
message_code?: string;
|
|
21
|
-
evidence_refs?: EvidenceRef[];
|
|
22
|
-
trace_id?: string;
|
|
23
|
-
span_id?: string;
|
|
24
|
-
parent_step_id?: string;
|
|
25
|
-
surface_type?: string;
|
|
26
|
-
surface_name?: string;
|
|
27
|
-
surface_instance?: string;
|
|
28
|
-
source_file?: string;
|
|
29
|
-
source_module?: string;
|
|
30
|
-
source_function?: string;
|
|
31
|
-
source_line?: number;
|
|
32
|
-
};
|
|
33
|
-
export declare function buildStepRecord(message: string, sequence: number, system: SystemOwnership, overrides?: StepRecordOverrides): StepRecord;
|
|
34
|
-
//# sourceMappingURL=record_builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record_builder.d.ts","sourceRoot":"","sources":["../../../src/core/record_builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAsB,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAI7C,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,MAAM,MA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M,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB3E"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type SinkClass = "authoritative" | "observability";
|
|
2
|
-
export type FanoutOutcome = "OK" | "DEGRADED" | "FAILED";
|
|
3
|
-
export interface StepRecord {
|
|
4
|
-
record_version: "log.step.v1";
|
|
5
|
-
record_id: string;
|
|
6
|
-
sequence: number;
|
|
7
|
-
timestamp_utc: string;
|
|
8
|
-
monotonic_time: number;
|
|
9
|
-
institution: string;
|
|
10
|
-
system_name: string;
|
|
11
|
-
system_type: string;
|
|
12
|
-
environment: string;
|
|
13
|
-
system_version: string;
|
|
14
|
-
instance_id?: string;
|
|
15
|
-
trace_id?: string;
|
|
16
|
-
span_id?: string;
|
|
17
|
-
parent_step_id?: string;
|
|
18
|
-
surface_type?: string;
|
|
19
|
-
surface_name?: string;
|
|
20
|
-
surface_instance?: string;
|
|
21
|
-
source_file?: string;
|
|
22
|
-
source_module?: string;
|
|
23
|
-
source_function?: string;
|
|
24
|
-
source_line?: number;
|
|
25
|
-
message: string;
|
|
26
|
-
message_code?: string;
|
|
27
|
-
context_hash: string;
|
|
28
|
-
context_version: string;
|
|
29
|
-
evidence_refs?: string[];
|
|
30
|
-
record_hash: string;
|
|
31
|
-
hash_algorithm: string;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,eAAe,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEzD,MAAM,WAAW,UAAU;IAEzB,cAAc,EAAE,aAAa,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IAGjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IAGvB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IAGxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAGzB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SystemOwnership } from "./core/record_builder.js";
|
|
2
|
-
import type { StepRecord } from "./core/types.js";
|
|
3
|
-
type SinkClass = "authoritative" | "observability";
|
|
4
|
-
type Sink = {
|
|
5
|
-
emit(record: Readonly<StepRecord>): void | Promise<void>;
|
|
6
|
-
flush?(): void | Promise<void>;
|
|
7
|
-
};
|
|
8
|
-
type SinkEntry = {
|
|
9
|
-
sink: Sink;
|
|
10
|
-
sinkClass: SinkClass;
|
|
11
|
-
};
|
|
12
|
-
export type LogSDKConfig = {
|
|
13
|
-
context: unknown;
|
|
14
|
-
system: SystemOwnership;
|
|
15
|
-
sinks: ReadonlyArray<SinkEntry>;
|
|
16
|
-
};
|
|
17
|
-
export type LogApi = {
|
|
18
|
-
step(message: string): Promise<void>;
|
|
19
|
-
flush?: () => Promise<void>;
|
|
20
|
-
};
|
|
21
|
-
export type { SystemOwnership };
|
|
22
|
-
export declare function initLogSDK(config: LogSDKConfig): LogApi;
|
|
23
|
-
export declare function createLogger(config: LogSDKConfig): LogApi;
|
|
24
|
-
export { fileNdjsonSink } from "./sinks/file_ndjson.js";
|
|
25
|
-
export { authoritativeNdjsonSink } from "./sinks/file_ndjson.js";
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAW5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,SAAS,GAAG,eAAe,GAAG,eAAe,CAAC;AAEnD,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,KAAK,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAwDvD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAEzD;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { StepRecord } from "../core/types.js";
|
|
2
|
-
type SinkClass = "authoritative" | "observability";
|
|
3
|
-
type Sink = {
|
|
4
|
-
emit(record: Readonly<StepRecord>): void | Promise<void>;
|
|
5
|
-
flush?(): void | Promise<void>;
|
|
6
|
-
};
|
|
7
|
-
type SinkEntry = {
|
|
8
|
-
sink: Sink;
|
|
9
|
-
sinkClass: SinkClass;
|
|
10
|
-
};
|
|
11
|
-
export declare function fileNdjsonSink(pathOrOptions: string | {
|
|
12
|
-
path: string;
|
|
13
|
-
}): SinkEntry;
|
|
14
|
-
export declare function authoritativeNdjsonSink(pathOrOptions: string | {
|
|
15
|
-
path: string;
|
|
16
|
-
}): SinkEntry;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=file_ndjson.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file_ndjson.d.ts","sourceRoot":"","sources":["../../../src/sinks/file_ndjson.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,KAAK,SAAS,GAAG,eAAe,GAAG,eAAe,CAAC;AAEnD,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,KAAK,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAYlF;AACD,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAY3F"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { StepRecord } from "../core/types.js";
|
|
2
|
-
export interface FileNdjsonSink {
|
|
3
|
-
emit(record: StepRecord): Promise<void>;
|
|
4
|
-
close(): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare function createFileNdjsonSink(filePath: string): FileNdjsonSink;
|
|
7
|
-
//# sourceMappingURL=file_ndjson_sink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file_ndjson_sink.d.ts","sourceRoot":"","sources":["../../../src/sinks/file_ndjson_sink.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAkCrE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { StepRecord as CoreStepRecord } from "../core/types.js";
|
|
2
|
-
export type StepRecord = Readonly<CoreStepRecord>;
|
|
3
|
-
export type SinkClass = "authoritative" | "observability";
|
|
4
|
-
export interface Sink<TRecord = StepRecord> {
|
|
5
|
-
emit(record: Readonly<TRecord>): void | Promise<void>;
|
|
6
|
-
flush?(): void | Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export interface SinkEntry<TRecord = StepRecord> {
|
|
9
|
-
sink: Sink<TRecord>;
|
|
10
|
-
sinkClass: SinkClass;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=sink_types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sink_types.d.ts","sourceRoot":"","sources":["../../../src/sinks/sink_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,eAAe,CAAC;AAE1D,MAAM,WAAW,IAAI,CAAC,OAAO,GAAG,UAAU;IACxC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,KAAK,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,SAAS,CAAC,OAAO,GAAG,UAAU;IAC7C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;CACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdout_sink.d.ts","sourceRoot":"","sources":["../../../src/sinks/stdout_sink.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAW7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api_surface_guard.d.ts","sourceRoot":"","sources":["../../../src/validate/api_surface_guard.ts"],"names":[],"mappings":"AA2DA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8CvD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const API_SURFACE_VIOLATION: "API_SURFACE_VIOLATION";
|
|
2
|
-
export declare const CONTEXT_INJECTION_VIOLATION: "CONTEXT_INJECTION_VIOLATION";
|
|
3
|
-
export declare const PAYLOAD_EMBEDDING_VIOLATION: "PAYLOAD_EMBEDDING_VIOLATION";
|
|
4
|
-
export declare const CANONICAL_SCHEMA_VIOLATION: "CANONICAL_SCHEMA_VIOLATION";
|
|
5
|
-
export declare const SINK_MUTATION_VIOLATION: "SINK_MUTATION_VIOLATION";
|
|
6
|
-
export declare const NO_AUTHORITATIVE_SINK: "NO_AUTHORITATIVE_SINK";
|
|
7
|
-
export declare const FANOUT_NONDETERMINISM: "FANOUT_NONDETERMINISM";
|
|
8
|
-
export declare const AUTHORITATIVE_FAILURE_SWALLOWED: "AUTHORITATIVE_FAILURE_SWALLOWED";
|
|
9
|
-
export declare const UNBOUNDED_BUFFER_RISK: "UNBOUNDED_BUFFER_RISK";
|
|
10
|
-
export type NonComplianceCode = typeof API_SURFACE_VIOLATION | typeof CONTEXT_INJECTION_VIOLATION | typeof PAYLOAD_EMBEDDING_VIOLATION | typeof CANONICAL_SCHEMA_VIOLATION | typeof SINK_MUTATION_VIOLATION | typeof NO_AUTHORITATIVE_SINK | typeof FANOUT_NONDETERMINISM | typeof AUTHORITATIVE_FAILURE_SWALLOWED | typeof UNBOUNDED_BUFFER_RISK;
|
|
11
|
-
export declare class NonComplianceError extends Error {
|
|
12
|
-
readonly code: NonComplianceCode;
|
|
13
|
-
constructor(code: NonComplianceCode, message: string);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=noncompliance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noncompliance.d.ts","sourceRoot":"","sources":["../../../src/validate/noncompliance.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,2BAA2B,EACtC,6BAAsC,CAAC;AACzC,eAAO,MAAM,2BAA2B,EACtC,6BAAsC,CAAC;AACzC,eAAO,MAAM,0BAA0B,EACrC,4BAAqC,CAAC;AACxC,eAAO,MAAM,uBAAuB,EAAG,yBAAkC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,+BAA+B,EAC1C,iCAA0C,CAAC;AAC7C,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GACzB,OAAO,qBAAqB,GAC5B,OAAO,2BAA2B,GAClC,OAAO,2BAA2B,GAClC,OAAO,0BAA0B,GACjC,OAAO,uBAAuB,GAC9B,OAAO,qBAAqB,GAC5B,OAAO,qBAAqB,GAC5B,OAAO,+BAA+B,GACtC,OAAO,qBAAqB,CAAC;AAEjC,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;gBAErB,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM;CAIrD"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { StepRecord } from "../core/types.js";
|
|
2
|
-
import type { SinkEntry } from "../sinks/sink_types.js";
|
|
3
|
-
export declare function assertStepRecord(record: unknown): asserts record is StepRecord;
|
|
4
|
-
export declare function assertHasAuthoritativeSink(sinks: ReadonlyArray<SinkEntry>): void;
|
|
5
|
-
//# sourceMappingURL=schema_guard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema_guard.d.ts","sourceRoot":"","sources":["../../../src/validate/schema_guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AA0DxD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,UAAU,CA8G9E;AAID,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAC9B,IAAI,CAWN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api_surface_guard.d.ts","sourceRoot":"","sources":["../../src/validate/api_surface_guard.ts"],"names":[],"mappings":"AA2DA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8CvD"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { API_SURFACE_VIOLATION, NonComplianceError, } from "./noncompliance.js";
|
|
2
|
-
const ALLOWED_SCOPES = ["request", "job", "component"];
|
|
3
|
-
const FORBIDDEN_NAMES = new Set([
|
|
4
|
-
"withContext",
|
|
5
|
-
"ctx",
|
|
6
|
-
"meta",
|
|
7
|
-
"attributes",
|
|
8
|
-
"tags",
|
|
9
|
-
"labels",
|
|
10
|
-
"log",
|
|
11
|
-
"emit",
|
|
12
|
-
"metric",
|
|
13
|
-
"span",
|
|
14
|
-
]);
|
|
15
|
-
function assertFunction(value, name, arity) {
|
|
16
|
-
if (typeof value !== "function") {
|
|
17
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, `${name} must be a function.`);
|
|
18
|
-
}
|
|
19
|
-
if (value.length !== arity) {
|
|
20
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, `${name} must accept exactly ${arity} argument(s).`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function assertChildScopePolicy(child) {
|
|
24
|
-
const candidate = child;
|
|
25
|
-
const allowedScopes = candidate.allowedScopes;
|
|
26
|
-
if (!Array.isArray(allowedScopes) || allowedScopes.length === 0) {
|
|
27
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, "child() must declare allowedScopes to enforce scope union.");
|
|
28
|
-
}
|
|
29
|
-
for (const scope of allowedScopes) {
|
|
30
|
-
if (!ALLOWED_SCOPES.includes(scope)) {
|
|
31
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, `child() scope not allowed: ${String(scope)}.`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export function assertApiSurface(surface) {
|
|
36
|
-
if (!surface || typeof surface !== "object") {
|
|
37
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, "API surface must be an object.");
|
|
38
|
-
}
|
|
39
|
-
const api = surface;
|
|
40
|
-
const keys = Object.keys(api);
|
|
41
|
-
for (const key of keys) {
|
|
42
|
-
if (FORBIDDEN_NAMES.has(key)) {
|
|
43
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, `Forbidden API method detected: ${key}.`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!("step" in api)) {
|
|
47
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, "API surface must expose step(message).");
|
|
48
|
-
}
|
|
49
|
-
assertFunction(api.step, "step", 1);
|
|
50
|
-
if ("flush" in api) {
|
|
51
|
-
assertFunction(api.flush, "flush", 0);
|
|
52
|
-
}
|
|
53
|
-
if ("child" in api) {
|
|
54
|
-
assertFunction(api.child, "child", 1);
|
|
55
|
-
assertChildScopePolicy(api.child);
|
|
56
|
-
}
|
|
57
|
-
for (const key of keys) {
|
|
58
|
-
if (key !== "step" && key !== "child" && key !== "flush") {
|
|
59
|
-
throw new NonComplianceError(API_SURFACE_VIOLATION, `Unexpected API export: ${key}.`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=api_surface_guard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api_surface_guard.js","sourceRoot":"","sources":["../../src/valid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rB,0BAA0B,GAAG,GAAG,CACjC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const API_SURFACE_VIOLATION: "API_SURFACE_VIOLATION";
|
|
2
|
-
export declare const CONTEXT_INJECTION_VIOLATION: "CONTEXT_INJECTION_VIOLATION";
|
|
3
|
-
export declare const PAYLOAD_EMBEDDING_VIOLATION: "PAYLOAD_EMBEDDING_VIOLATION";
|
|
4
|
-
export declare const CANONICAL_SCHEMA_VIOLATION: "CANONICAL_SCHEMA_VIOLATION";
|
|
5
|
-
export declare const SINK_MUTATION_VIOLATION: "SINK_MUTATION_VIOLATION";
|
|
6
|
-
export declare const NO_AUTHORITATIVE_SINK: "NO_AUTHORITATIVE_SINK";
|
|
7
|
-
export declare const FANOUT_NONDETERMINISM: "FANOUT_NONDETERMINISM";
|
|
8
|
-
export declare const AUTHORITATIVE_FAILURE_SWALLOWED: "AUTHORITATIVE_FAILURE_SWALLOWED";
|
|
9
|
-
export declare const UNBOUNDED_BUFFER_RISK: "UNBOUNDED_BUFFER_RISK";
|
|
10
|
-
export type NonComplianceCode = typeof API_SURFACE_VIOLATION | typeof CONTEXT_INJECTION_VIOLATION | typeof PAYLOAD_EMBEDDING_VIOLATION | typeof CANONICAL_SCHEMA_VIOLATION | typeof SINK_MUTATION_VIOLATION | typeof NO_AUTHORITATIVE_SINK | typeof FANOUT_NONDETERMINISM | typeof AUTHORITATIVE_FAILURE_SWALLOWED | typeof UNBOUNDED_BUFFER_RISK;
|
|
11
|
-
export declare class NonComplianceError extends Error {
|
|
12
|
-
readonly code: NonComplianceCode;
|
|
13
|
-
constructor(code: NonComplianceCode, message: string);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=noncompliance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noncompliance.d.ts","sourceRoot":"","sources":["../../src/validate/noncompliance.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,2BAA2B,EACtC,6BAAsC,CAAC;AACzC,eAAO,MAAM,2BAA2B,EACtC,6BAAsC,CAAC;AACzC,eAAO,MAAM,0BAA0B,EACrC,4BAAqC,CAAC;AACxC,eAAO,MAAM,uBAAuB,EAAG,yBAAkC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AACtE,eAAO,MAAM,+BAA+B,EAC1C,iCAA0C,CAAC;AAC7C,eAAO,MAAM,qBAAqB,EAAG,uBAAgC,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GACzB,OAAO,qBAAqB,GAC5B,OAAO,2BAA2B,GAClC,OAAO,2BAA2B,GAClC,OAAO,0BAA0B,GACjC,OAAO,uBAAuB,GAC9B,OAAO,qBAAqB,GAC5B,OAAO,qBAAqB,GAC5B,OAAO,+BAA+B,GACtC,OAAO,qBAAqB,CAAC;AAEjC,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;gBAErB,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM;CAIrD"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const API_SURFACE_VIOLATION = "API_SURFACE_VIOLATION";
|
|
2
|
-
export const CONTEXT_INJECTION_VIOLATION = "CONTEXT_INJECTION_VIOLATION";
|
|
3
|
-
export const PAYLOAD_EMBEDDING_VIOLATION = "PAYLOAD_EMBEDDING_VIOLATION";
|
|
4
|
-
export const CANONICAL_SCHEMA_VIOLATION = "CANONICAL_SCHEMA_VIOLATION";
|
|
5
|
-
export const SINK_MUTATION_VIOLATION = "SINK_MUTATION_VIOLATION";
|
|
6
|
-
export const NO_AUTHORITATIVE_SINK = "NO_AUTHORITATIVE_SINK";
|
|
7
|
-
export const FANOUT_NONDETERMINISM = "FANOUT_NONDETERMINISM";
|
|
8
|
-
export const AUTHORITATIVE_FAILURE_SWALLOWED = "AUTHORITATIVE_FAILURE_SWALLOWED";
|
|
9
|
-
export const UNBOUNDED_BUFFER_RISK = "UNBOUNDED_BUFFER_RISK";
|
|
10
|
-
export class NonComplianceError extends Error {
|
|
11
|
-
code;
|
|
12
|
-
constructor(code, message) {
|
|
13
|
-
super(message);
|
|
14
|
-
this.code = code;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=noncompliance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noncompliance.js","sourceRoot":"","sources":["../../src/validate/noncompliance.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAgC,CAAC;AACtE,MAAM,CAAC,MAAM,2BAA2B,GACtC,6BAAsC,CAAC;AACzC,MAAM,CAAC,MAAM,2BAA2B,GACtC,6BAAsC,CAAC;AACzC,MAAM,CAAC,MAAM,0BAA0B,GACrC,4BAAqC,CAAC;AACxC,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAkC,CAAC;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAgC,CAAC;AACtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAgC,CAAC;AACtE,MAAM,CAAC,MAAM,+BAA+B,GAC1C,iCAA0C,CAAC;AAC7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAgC,CAAC;AAatE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAoB;IAEjC,YAAY,IAAuB,EAAE,OAAe;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { StepRecord } from "../core/types.js";
|
|
2
|
-
import type { SinkEntry } from "../sinks/sink_types.js";
|
|
3
|
-
export declare function assertStepRecord(record: unknown): asserts record is StepRecord;
|
|
4
|
-
export declare function assertHasAuthoritativeSink(sinks: ReadonlyArray<SinkEntry>): void;
|
|
5
|
-
//# sourceMappingURL=schema_guard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema_guard.d.ts","sourceRoot":"","sources":["../../src/validate/schema_guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AA0DxD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,UAAU,CA8G9E;AAID,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAC9B,IAAI,CAWN"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { assertValidMessage } from "../core/message_constraints.js";
|
|
2
|
-
import { CANONICAL_SCHEMA_VIOLATION, CONTEXT_INJECTION_VIOLATION, NO_AUTHORITATIVE_SINK, PAYLOAD_EMBEDDING_VIOLATION, NonComplianceError, } from "./noncompliance.js";
|
|
3
|
-
const REQUIRED_FIELDS = [
|
|
4
|
-
"record_version",
|
|
5
|
-
"record_id",
|
|
6
|
-
"sequence",
|
|
7
|
-
"timestamp_utc",
|
|
8
|
-
"monotonic_time",
|
|
9
|
-
"institution",
|
|
10
|
-
"system_name",
|
|
11
|
-
"system_type",
|
|
12
|
-
"environment",
|
|
13
|
-
"system_version",
|
|
14
|
-
"message",
|
|
15
|
-
"context_hash",
|
|
16
|
-
"context_version",
|
|
17
|
-
"record_hash",
|
|
18
|
-
"hash_algorithm",
|
|
19
|
-
];
|
|
20
|
-
const OPTIONAL_FIELDS = [
|
|
21
|
-
"instance_id",
|
|
22
|
-
"trace_id",
|
|
23
|
-
"span_id",
|
|
24
|
-
"parent_step_id",
|
|
25
|
-
"surface_type",
|
|
26
|
-
"surface_name",
|
|
27
|
-
"surface_instance",
|
|
28
|
-
"source_file",
|
|
29
|
-
"source_module",
|
|
30
|
-
"source_function",
|
|
31
|
-
"source_line",
|
|
32
|
-
"message_code",
|
|
33
|
-
"evidence_refs",
|
|
34
|
-
];
|
|
35
|
-
const ALLOWED_FIELDS = new Set([...REQUIRED_FIELDS, ...OPTIONAL_FIELDS]);
|
|
36
|
-
const CONTEXT_FIELDS = ["context", "context_blob", "context_data", "context_value"];
|
|
37
|
-
// Explicit type assertion for string keys from Object.keys(schema.properties)
|
|
38
|
-
function asRecord(value) {
|
|
39
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
40
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, "Step record must be a plain object.");
|
|
41
|
-
}
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
export function assertStepRecord(record) {
|
|
45
|
-
const candidate = asRecord(record);
|
|
46
|
-
if (!Object.isFrozen(candidate)) {
|
|
47
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, "Step record must be immutable at emission time.");
|
|
48
|
-
}
|
|
49
|
-
for (const forbidden of CONTEXT_FIELDS) {
|
|
50
|
-
if (forbidden in candidate) {
|
|
51
|
-
throw new NonComplianceError(CONTEXT_INJECTION_VIOLATION, "Context must not be embedded in the step record.");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (const key of Object.keys(candidate)) {
|
|
55
|
-
if (!ALLOWED_FIELDS.has(key)) {
|
|
56
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, `Unexpected field in step record: ${key}.`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
for (const field of REQUIRED_FIELDS) {
|
|
60
|
-
if (!(field in candidate)) {
|
|
61
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, `Missing required field: ${field}.`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
assertStringField(candidate, "record_version");
|
|
65
|
-
assertStringField(candidate, "record_id");
|
|
66
|
-
assertIntegerField(candidate, "sequence");
|
|
67
|
-
assertStringField(candidate, "timestamp_utc");
|
|
68
|
-
assertNumberField(candidate, "monotonic_time");
|
|
69
|
-
assertStringField(candidate, "institution");
|
|
70
|
-
assertStringField(candidate, "system_name");
|
|
71
|
-
assertStringField(candidate, "system_type");
|
|
72
|
-
assertStringField(candidate, "environment");
|
|
73
|
-
assertStringField(candidate, "system_version");
|
|
74
|
-
assertStringField(candidate, "context_hash");
|
|
75
|
-
assertStringField(candidate, "context_version");
|
|
76
|
-
assertStringField(candidate, "record_hash");
|
|
77
|
-
assertStringField(candidate, "hash_algorithm");
|
|
78
|
-
if (candidate.record_version !== "log.step.v1") {
|
|
79
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, "record_version must be log.step.v1.");
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
assertValidMessage(candidate.message);
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
throw new NonComplianceError(PAYLOAD_EMBEDDING_VIOLATION, error instanceof Error ? error.message : "Invalid message content.");
|
|
86
|
-
}
|
|
87
|
-
if (typeof candidate.timestamp_utc === "string") {
|
|
88
|
-
const parsed = Date.parse(candidate.timestamp_utc);
|
|
89
|
-
if (Number.isNaN(parsed)) {
|
|
90
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, "timestamp_utc must be a valid ISO-8601 string.");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
assertOptionalStringField(candidate, "instance_id");
|
|
94
|
-
assertOptionalStringField(candidate, "trace_id");
|
|
95
|
-
assertOptionalStringField(candidate, "span_id");
|
|
96
|
-
assertOptionalStringField(candidate, "parent_step_id");
|
|
97
|
-
assertOptionalStringField(candidate, "surface_type");
|
|
98
|
-
assertOptionalStringField(candidate, "surface_name");
|
|
99
|
-
assertOptionalStringField(candidate, "surface_instance");
|
|
100
|
-
assertOptionalStringField(candidate, "source_file");
|
|
101
|
-
assertOptionalStringField(candidate, "source_module");
|
|
102
|
-
assertOptionalStringField(candidate, "source_function");
|
|
103
|
-
assertOptionalStringField(candidate, "message_code");
|
|
104
|
-
if ("source_line" in candidate && candidate.source_line !== undefined) {
|
|
105
|
-
assertNumberField(candidate, "source_line");
|
|
106
|
-
}
|
|
107
|
-
if ("evidence_refs" in candidate && candidate.evidence_refs !== undefined) {
|
|
108
|
-
if (!Array.isArray(candidate.evidence_refs)) {
|
|
109
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, "evidence_refs must be an array of strings.");
|
|
110
|
-
}
|
|
111
|
-
for (const ref of candidate.evidence_refs) {
|
|
112
|
-
if (typeof ref !== "string" || ref.length === 0) {
|
|
113
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, "evidence_refs must contain non-empty strings.");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// Explicit type assertion for string keys from Object.keys(schema.properties)
|
|
119
|
-
export function assertHasAuthoritativeSink(sinks) {
|
|
120
|
-
const hasAuthoritative = sinks.some((entry) => entry.sinkClass === "authoritative");
|
|
121
|
-
if (!hasAuthoritative) {
|
|
122
|
-
throw new NonComplianceError(NO_AUTHORITATIVE_SINK, "At least one authoritative sink is required.");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function assertStringField(record, field) {
|
|
126
|
-
const value = record[field];
|
|
127
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
128
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, `${field} must be a non-empty string.`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function assertOptionalStringField(record, field) {
|
|
132
|
-
if (field in record && record[field] !== undefined) {
|
|
133
|
-
const value = record[field];
|
|
134
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
135
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, `${field} must be a non-empty string when provided.`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function assertNumberField(record, field) {
|
|
140
|
-
const value = record[field];
|
|
141
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
142
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, `${field} must be a finite number.`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function assertIntegerField(record, field) {
|
|
146
|
-
const value = record[field];
|
|
147
|
-
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) {
|
|
148
|
-
throw new NonComplianceError(CANONICAL_SCHEMA_VIOLATION, `${field} must be a non-negative integer.`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=schema_guard.js.map
|