@sixb/core 0.1.2 → 0.1.3
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/dist/actions/index.js +16 -13
- package/dist/actions/index.js.map +1 -1
- package/dist/agents/adapters.d.ts +11 -1
- package/dist/agents/adapters.d.ts.map +1 -1
- package/dist/agents/context.js +1 -1
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +3 -0
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/index.d.ts +6 -3
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +33 -22
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/prompt.d.ts +8 -2
- package/dist/agents/prompt.d.ts.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams.js +2 -2
- package/dist/agents/thread-context-projection.d.ts +19 -0
- package/dist/agents/thread-context-projection.d.ts.map +1 -0
- package/dist/agents/tool-definition.d.ts.map +1 -1
- package/dist/agents/tool-result.d.ts +6 -0
- package/dist/agents/tool-result.d.ts.map +1 -0
- package/dist/agents/types.d.ts +37 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/index.js +7 -5
- package/dist/auth/index.js.map +1 -1
- package/dist/authorization/index.js +1 -1
- package/dist/bootstrap/index.js +27 -24
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/{chunk-0mbx247x.js → chunk-177ed2mp.js} +241 -45
- package/dist/chunk-177ed2mp.js.map +46 -0
- package/dist/{chunk-sa4340y1.js → chunk-1ywq4hzk.js} +7 -7
- package/dist/{chunk-zg9yryhz.js → chunk-261ag4t4.js} +3 -3
- package/dist/{chunk-k9pts48t.js → chunk-3rsf30p4.js} +5 -5
- package/dist/{chunk-8ryen3p3.js → chunk-4aw0jwk0.js} +1 -1
- package/dist/{chunk-bh6k3nc6.js → chunk-4p9rh7jj.js} +1 -1
- package/dist/{chunk-34bqh420.js → chunk-4z3n1dzt.js} +59 -21
- package/dist/{chunk-34bqh420.js.map → chunk-4z3n1dzt.js.map} +4 -4
- package/dist/chunk-96swp2wd.js +47 -0
- package/dist/chunk-96swp2wd.js.map +10 -0
- package/dist/{chunk-n8herkry.js → chunk-bv41fmjn.js} +11 -11
- package/dist/{chunk-7pc8b818.js → chunk-c6cfqydk.js} +1 -1
- package/dist/{chunk-0k4avqr2.js → chunk-c8bw2b6c.js} +2 -2
- package/dist/{chunk-jaj13078.js → chunk-d2adj15j.js} +3 -33
- package/dist/{chunk-jaj13078.js.map → chunk-d2adj15j.js.map} +3 -4
- package/dist/{chunk-c6qd89g5.js → chunk-d6y2wsfg.js} +3 -3
- package/dist/chunk-dysw7nsm.js.map +1 -1
- package/dist/{chunk-st4xgxey.js → chunk-ettb0cy4.js} +150 -23
- package/dist/chunk-ettb0cy4.js.map +45 -0
- package/dist/{chunk-nnyp53zt.js → chunk-f1cyvnrk.js} +1 -1
- package/dist/chunk-fmx1sz2h.js.map +2 -2
- package/dist/{chunk-bct7hmfc.js → chunk-km4rkj4t.js} +3 -3
- package/dist/chunk-kqxgf6kv.js +898 -0
- package/dist/chunk-kqxgf6kv.js.map +15 -0
- package/dist/{chunk-qvybnnpe.js → chunk-n5x5y80a.js} +2 -2
- package/dist/{chunk-4x43bkbp.js → chunk-pxtrxm3p.js} +1 -1
- package/dist/chunk-qer6am8w.js +133 -0
- package/dist/chunk-qer6am8w.js.map +11 -0
- package/dist/{chunk-85j5ybfj.js → chunk-rdeagz6b.js} +2 -2
- package/dist/{chunk-85j5ybfj.js.map → chunk-rdeagz6b.js.map} +3 -3
- package/dist/chunk-rhrbz7d4.js +36 -0
- package/dist/chunk-rhrbz7d4.js.map +10 -0
- package/dist/{chunk-663csy96.js → chunk-t0jjkep3.js} +2 -1
- package/dist/chunk-t0jjkep3.js.map +10 -0
- package/dist/{chunk-5egfka8j.js → chunk-ttba8x6z.js} +2 -2
- package/dist/{chunk-nten49ta.js → chunk-wb4051cx.js} +3 -3
- package/dist/{chunk-nten49ta.js.map → chunk-wb4051cx.js.map} +1 -1
- package/dist/{chunk-57r1cpxx.js → chunk-xc7hq65b.js} +3 -2
- package/dist/{chunk-57r1cpxx.js.map → chunk-xc7hq65b.js.map} +3 -3
- package/dist/{chunk-ys1nse2v.js → chunk-xmggaxg4.js} +256 -231
- package/dist/{chunk-ys1nse2v.js.map → chunk-xmggaxg4.js.map} +8 -10
- package/dist/{chunk-g9t3kdtx.js → chunk-z8j83gzd.js} +1 -1
- package/dist/{chunk-57zpb99z.js → chunk-zpw39qhj.js} +1 -1
- package/dist/execution/agent.js +23 -20
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/primitive.js +23 -20
- package/dist/execution/primitive.js.map +2 -2
- package/dist/execution/request.js +24 -21
- package/dist/execution/request.js.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -29
- package/dist/index.js.map +1 -1
- package/dist/materialization/model.d.ts +4 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/edits/apply.d.ts +6 -1
- package/dist/materializer/edits/apply.d.ts.map +1 -1
- package/dist/materializer/edits/working-state.d.ts +2 -0
- package/dist/materializer/edits/working-state.d.ts.map +1 -1
- package/dist/materializer/effective/resolve.d.ts +3 -1
- package/dist/materializer/effective/resolve.d.ts.map +1 -1
- package/dist/materializer/execution/work-records.d.ts.map +1 -1
- package/dist/materializer/index.js +14 -11
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/objects/index.js +17 -14
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/index.js +2 -2
- package/dist/pipelines/index.js +14 -12
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/builders.d.ts +19 -6
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +2 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.d.ts +4 -1
- package/dist/projections/internal.d.ts.map +1 -1
- package/dist/projections/internal.js +17 -11
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/timestamp.d.ts +3 -0
- package/dist/projections/timestamp.d.ts.map +1 -0
- package/dist/projections/types.d.ts +9 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/types.d.ts +7 -0
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/ai-cost.d.ts +8 -0
- package/dist/runtime/ai-cost.d.ts.map +1 -0
- package/dist/storage/agents/in-memory.d.ts +18 -4
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +31 -0
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +18 -7
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +70 -4
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +61 -0
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -0
- package/dist/storage/ai-cost/codec.d.ts +14 -0
- package/dist/storage/ai-cost/codec.d.ts.map +1 -0
- package/dist/storage/ai-cost/errors.d.ts +7 -0
- package/dist/storage/ai-cost/errors.d.ts.map +1 -0
- package/dist/storage/ai-cost/in-memory.d.ts +32 -0
- package/dist/storage/ai-cost/in-memory.d.ts.map +1 -0
- package/dist/storage/ai-cost/index.d.ts +6 -0
- package/dist/storage/ai-cost/index.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.d.ts +7 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -0
- package/dist/storage/ai-cost/provider.js +132 -0
- package/dist/storage/ai-cost/provider.js.map +10 -0
- package/dist/storage/ai-cost/types.d.ts +154 -0
- package/dist/storage/ai-cost/types.d.ts.map +1 -0
- package/dist/storage/ai-cost/validation.d.ts +7 -0
- package/dist/storage/ai-cost/validation.d.ts.map +1 -0
- package/dist/storage/in-memory/index.d.ts +5 -0
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +3 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +22 -15
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/materializations.d.ts +3 -0
- package/dist/storage/ontology/materializations.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/types.d.ts +2 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +6 -5
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/syncs/index.js +14 -12
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts +3 -2
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts +12 -0
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2098 -1468
- package/dist/testing/index.js.map +6 -5
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +12 -10
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +12 -2
- package/dist/workers/index.js.map +3 -3
- package/dist/workers/queue-worker.d.ts +2 -0
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workflows/execution.d.ts +3 -0
- package/dist/workflows/execution.d.ts.map +1 -1
- package/dist/workflows/index.js +24 -21
- package/dist/workflows/index.js.map +1 -1
- package/package.json +7 -1
- package/src/agents/adapters.ts +64 -23
- package/src/agents/errors.ts +2 -2
- package/src/agents/execution.ts +14 -2
- package/src/agents/index.ts +18 -1
- package/src/agents/prompt.ts +33 -5
- package/src/agents/request.ts +5 -0
- package/src/agents/thread-context-projection.ts +93 -0
- package/src/agents/tool-definition.ts +17 -2
- package/src/agents/tool-result.ts +61 -0
- package/src/agents/types.ts +47 -1
- package/src/agents/validation.ts +1 -1
- package/src/index.ts +13 -0
- package/src/materialization/model.ts +4 -0
- package/src/materializer/edits/apply.ts +55 -2
- package/src/materializer/edits/operations.ts +8 -1
- package/src/materializer/edits/working-state.ts +7 -0
- package/src/materializer/effective/resolve.ts +78 -9
- package/src/materializer/execution/work-records.ts +3 -1
- package/src/materializer/projections/entry-validator.ts +23 -1
- package/src/materializer/projections/replacement-plan.ts +2 -0
- package/src/materializer/shared/normalize.ts +16 -0
- package/src/projections/builders.ts +100 -35
- package/src/projections/index.ts +6 -0
- package/src/projections/internal.ts +4 -1
- package/src/projections/registry.ts +7 -0
- package/src/projections/revision.ts +4 -0
- package/src/projections/timestamp.ts +66 -0
- package/src/projections/types.ts +7 -0
- package/src/projections/validation.ts +24 -0
- package/src/queues/index.ts +1 -0
- package/src/queues/types.ts +8 -0
- package/src/runtime/ai-cost.ts +15 -0
- package/src/storage/agents/in-memory.ts +171 -4
- package/src/storage/agents/index.ts +5 -0
- package/src/storage/agents/provider.ts +225 -0
- package/src/storage/agents/types.ts +77 -3
- package/src/storage/ai-cost/analytics.ts +602 -0
- package/src/storage/ai-cost/codec.ts +136 -0
- package/src/storage/ai-cost/errors.ts +12 -0
- package/src/storage/ai-cost/in-memory.ts +164 -0
- package/src/storage/ai-cost/index.ts +35 -0
- package/src/storage/ai-cost/provider.ts +20 -0
- package/src/storage/ai-cost/types.ts +193 -0
- package/src/storage/ai-cost/validation.ts +337 -0
- package/src/storage/in-memory/index.ts +50 -0
- package/src/storage/index.ts +37 -0
- package/src/storage/ontology/in-memory/materializations.ts +1 -0
- package/src/storage/ontology/materializations.ts +3 -0
- package/src/storage/operation-scope.ts +1 -0
- package/src/storage/types.ts +2 -0
- package/src/testing/agent-storage-contract.ts +341 -2
- package/src/testing/ai-cost-storage-contract.ts +320 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/materializer-storage-contract.ts +120 -2
- package/src/workers/queue-worker.ts +14 -1
- package/src/workflows/execution.ts +31 -10
- package/dist/chunk-0mbx247x.js.map +0 -43
- package/dist/chunk-663csy96.js.map +0 -10
- package/dist/chunk-st4xgxey.js.map +0 -45
- package/dist/chunk-vp1vc6ee.js +0 -35
- package/dist/chunk-vp1vc6ee.js.map +0 -11
- /package/dist/{chunk-sa4340y1.js.map → chunk-1ywq4hzk.js.map} +0 -0
- /package/dist/{chunk-zg9yryhz.js.map → chunk-261ag4t4.js.map} +0 -0
- /package/dist/{chunk-k9pts48t.js.map → chunk-3rsf30p4.js.map} +0 -0
- /package/dist/{chunk-8ryen3p3.js.map → chunk-4aw0jwk0.js.map} +0 -0
- /package/dist/{chunk-bh6k3nc6.js.map → chunk-4p9rh7jj.js.map} +0 -0
- /package/dist/{chunk-n8herkry.js.map → chunk-bv41fmjn.js.map} +0 -0
- /package/dist/{chunk-7pc8b818.js.map → chunk-c6cfqydk.js.map} +0 -0
- /package/dist/{chunk-0k4avqr2.js.map → chunk-c8bw2b6c.js.map} +0 -0
- /package/dist/{chunk-c6qd89g5.js.map → chunk-d6y2wsfg.js.map} +0 -0
- /package/dist/{chunk-nnyp53zt.js.map → chunk-f1cyvnrk.js.map} +0 -0
- /package/dist/{chunk-bct7hmfc.js.map → chunk-km4rkj4t.js.map} +0 -0
- /package/dist/{chunk-qvybnnpe.js.map → chunk-n5x5y80a.js.map} +0 -0
- /package/dist/{chunk-4x43bkbp.js.map → chunk-pxtrxm3p.js.map} +0 -0
- /package/dist/{chunk-5egfka8j.js.map → chunk-ttba8x6z.js.map} +0 -0
- /package/dist/{chunk-g9t3kdtx.js.map → chunk-z8j83gzd.js.map} +0 -0
- /package/dist/{chunk-57zpb99z.js.map → chunk-zpw39qhj.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
isSyncDefinition
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-c6cfqydk.js";
|
|
5
5
|
import {
|
|
6
6
|
isPipelineDefinition
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-4p9rh7jj.js";
|
|
8
8
|
import {
|
|
9
9
|
allPredicates,
|
|
10
10
|
anyPredicates,
|
|
@@ -20,24 +20,24 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
isAgentDefinition,
|
|
22
22
|
isWorkflowDefinition
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-177ed2mp.js";
|
|
24
24
|
import {
|
|
25
25
|
RuntimeError
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-3rsf30p4.js";
|
|
27
27
|
import {
|
|
28
28
|
isConnectorDefinition
|
|
29
29
|
} from "./chunk-8m5ejdpn.js";
|
|
30
30
|
import {
|
|
31
31
|
isActionDefinition
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-d6y2wsfg.js";
|
|
33
33
|
import {
|
|
34
34
|
isGroupDefinition,
|
|
35
35
|
isMembershipPolicyDefinition,
|
|
36
36
|
isRoleDefinition
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-d2adj15j.js";
|
|
38
38
|
import {
|
|
39
39
|
isProjectionDefinition
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-4z3n1dzt.js";
|
|
41
41
|
|
|
42
42
|
// src/bootstrap/discovery.ts
|
|
43
43
|
import { readdir } from "fs/promises";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
createPrimitiveExecutionRecord,
|
|
4
4
|
ensureExecutionRecord,
|
|
5
5
|
executionRecordInputFromRuntime
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4aw0jwk0.js";
|
|
7
7
|
import {
|
|
8
8
|
PIPELINE_RUN_FAILURE_CODES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-xmggaxg4.js";
|
|
10
10
|
import {
|
|
11
11
|
PipelineRunError
|
|
12
12
|
} from "./chunk-cy0n5dms.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-dsrkgtnh.js";
|
|
16
16
|
import {
|
|
17
17
|
assertAuthorized
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4z3n1dzt.js";
|
|
19
19
|
import {
|
|
20
20
|
createSixbError,
|
|
21
21
|
toSixbFailure
|
|
@@ -13,20 +13,20 @@ import {
|
|
|
13
13
|
explainObjectQuery,
|
|
14
14
|
facetObjects,
|
|
15
15
|
validateObjectQuery
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-f1cyvnrk.js";
|
|
17
17
|
import {
|
|
18
18
|
ObjectQueryPlanningError
|
|
19
19
|
} from "./chunk-88ppkr54.js";
|
|
20
20
|
import {
|
|
21
21
|
requestAction,
|
|
22
22
|
requestActionAndWait
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-d6y2wsfg.js";
|
|
24
24
|
import {
|
|
25
25
|
normalizeJsonProperties
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ettb0cy4.js";
|
|
27
27
|
import {
|
|
28
28
|
ObjectNotFoundError
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-xmggaxg4.js";
|
|
30
30
|
import {
|
|
31
31
|
linkRefKey,
|
|
32
32
|
telemetryPointKey
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
assertCanAppendTelemetry,
|
|
58
58
|
assertCanEdit,
|
|
59
59
|
assertPrivileged
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-4z3n1dzt.js";
|
|
61
61
|
import {
|
|
62
62
|
stableJsonStringify
|
|
63
63
|
} from "./chunk-t8t39h7v.js";
|
|
@@ -775,6 +775,19 @@ function validateProjectionsAtStartup(projections, ontology, datasetsById) {
|
|
|
775
775
|
throw new ProjectionValidationError(`${prefix}: unknown object type "${projection.objectTypeId}"`);
|
|
776
776
|
}
|
|
777
777
|
const datasetColumnNames = new Set(dataset.schema.columns.map((column) => column.name));
|
|
778
|
+
const conflictResolution = projection.conflictResolution ?? { strategy: "editsWin" };
|
|
779
|
+
if (conflictResolution.strategy === "mostRecent") {
|
|
780
|
+
const sourceTimestamp = dataset.schema.columns.find((column) => column.name === conflictResolution.sourceTimestamp);
|
|
781
|
+
if (!sourceTimestamp) {
|
|
782
|
+
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" references unknown ` + `dataset column on dataset "${projection.datasetId}"`);
|
|
783
|
+
}
|
|
784
|
+
if (sourceTimestamp.type !== "timestamp") {
|
|
785
|
+
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `timestamp dataset column`);
|
|
786
|
+
}
|
|
787
|
+
if (sourceTimestamp.nullable === true) {
|
|
788
|
+
throw new ProjectionValidationError(`${prefix}: source timestamp "${conflictResolution.sourceTimestamp}" must reference a ` + `non-null timestamp dataset column`);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
778
791
|
const propertyIds = new Set(objectType.properties.map((p) => p.id));
|
|
779
792
|
for (const [propId, columnName] of Object.entries(projection.properties)) {
|
|
780
793
|
if (!propertyIds.has(propId)) {
|
|
@@ -964,33 +977,49 @@ function buildObjectProjection(id, objectType) {
|
|
|
964
977
|
properties(mapping) {
|
|
965
978
|
const propertyMapping = mapping;
|
|
966
979
|
validatePropertyMapping(objectType, propertyMapping);
|
|
967
|
-
|
|
968
|
-
_tag: "ObjectProjectionDefinition",
|
|
980
|
+
return objectProjectionBuilder({
|
|
969
981
|
id,
|
|
970
|
-
|
|
982
|
+
objectType,
|
|
971
983
|
datasetId,
|
|
972
|
-
|
|
973
|
-
links: {}
|
|
974
|
-
|
|
975
|
-
return Object.assign(definition, {
|
|
976
|
-
withLinks(linkMapping) {
|
|
977
|
-
const loweredLinkMapping = lowerForeignKeyMapping(linkMapping);
|
|
978
|
-
const validatedLinks = validateAndLowerLinkMapping(objectType, loweredLinkMapping, propertyMapping);
|
|
979
|
-
return {
|
|
980
|
-
_tag: "ObjectProjectionDefinition",
|
|
981
|
-
id,
|
|
982
|
-
objectTypeId: objectType.id,
|
|
983
|
-
datasetId,
|
|
984
|
-
properties: { ...propertyMapping },
|
|
985
|
-
links: validatedLinks
|
|
986
|
-
};
|
|
987
|
-
}
|
|
984
|
+
propertyMapping,
|
|
985
|
+
links: {},
|
|
986
|
+
conflictResolution: { strategy: "editsWin" }
|
|
988
987
|
});
|
|
989
988
|
}
|
|
990
989
|
};
|
|
991
990
|
}
|
|
992
991
|
};
|
|
993
992
|
}
|
|
993
|
+
function objectProjectionBuilder(input) {
|
|
994
|
+
const definition = {
|
|
995
|
+
_tag: "ObjectProjectionDefinition",
|
|
996
|
+
id: input.id,
|
|
997
|
+
objectTypeId: input.objectType.id,
|
|
998
|
+
datasetId: input.datasetId,
|
|
999
|
+
properties: { ...input.propertyMapping },
|
|
1000
|
+
links: { ...input.links },
|
|
1001
|
+
conflictResolution: { ...input.conflictResolution }
|
|
1002
|
+
};
|
|
1003
|
+
return Object.assign(definition, {
|
|
1004
|
+
withLinks(linkMapping) {
|
|
1005
|
+
const loweredLinkMapping = lowerForeignKeyMapping(linkMapping);
|
|
1006
|
+
const validatedLinks = validateAndLowerLinkMapping(input.objectType, loweredLinkMapping, input.propertyMapping);
|
|
1007
|
+
return objectProjectionBuilder({ ...input, links: validatedLinks });
|
|
1008
|
+
},
|
|
1009
|
+
resolveConflicts(resolution) {
|
|
1010
|
+
validateConflictResolution(resolution);
|
|
1011
|
+
return objectProjectionBuilder({
|
|
1012
|
+
...input,
|
|
1013
|
+
conflictResolution: resolution
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
function validateConflictResolution(resolution) {
|
|
1019
|
+
if (resolution.strategy === "editsWin")
|
|
1020
|
+
return;
|
|
1021
|
+
assertNonEmpty2(resolution.sourceTimestamp, "source timestamp field");
|
|
1022
|
+
}
|
|
994
1023
|
function buildTelemetryProjection(id, propertyToken) {
|
|
995
1024
|
assertNonEmpty2(id, "id");
|
|
996
1025
|
validateTelemetryProjectionProperty(propertyToken);
|
|
@@ -1103,7 +1132,16 @@ function buildLinkProjection(id, linkToken) {
|
|
|
1103
1132
|
function isObjectProjectionDefinition(value) {
|
|
1104
1133
|
if (!isRecord(value))
|
|
1105
1134
|
return false;
|
|
1106
|
-
return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord(value.properties) && isRecord(value.links);
|
|
1135
|
+
return value._tag === "ObjectProjectionDefinition" && typeof value.id === "string" && typeof value.objectTypeId === "string" && typeof value.datasetId === "string" && isRecord(value.properties) && isRecord(value.links) && isSourceEditConflictResolution(value.conflictResolution);
|
|
1136
|
+
}
|
|
1137
|
+
function isSourceEditConflictResolution(value) {
|
|
1138
|
+
if (value === undefined)
|
|
1139
|
+
return true;
|
|
1140
|
+
if (!isRecord(value) || typeof value.strategy !== "string")
|
|
1141
|
+
return false;
|
|
1142
|
+
if (value.strategy === "editsWin")
|
|
1143
|
+
return value.sourceTimestamp === undefined;
|
|
1144
|
+
return value.strategy === "mostRecent" && typeof value.sourceTimestamp === "string";
|
|
1107
1145
|
}
|
|
1108
1146
|
function isLinkProjectionDefinition(value) {
|
|
1109
1147
|
if (!isRecord(value))
|
|
@@ -1165,4 +1203,4 @@ function emptyGrantIndex() {
|
|
|
1165
1203
|
}
|
|
1166
1204
|
export { ProjectionValidationError, computeProjectionOwnership, validateProjectionOwnership, validateTelemetryProjectionFieldMapping, validateProjectionsAtStartup, defineProjection, fromForeignKey, isObjectProjectionDefinition, isLinkProjectionDefinition, isTelemetryProjectionDefinition, isProjectionDefinition, projectionTargetOf, GRANT_KINDS, grantKindOf, createPrincipalRuntimeAuthorization, createAgentRuntimeAuthorization, createDisabledRuntimeAuthorization, createTrustedPrimitiveRuntimeAuthorization, getAuthorizationRef, resolveExecutionScopeAuthorization, AuthorizationError, evaluate, isAllowed, assertAuthorized, assertCanEdit, assertCanAppendTelemetry, assertCanManageConnector, assertPrivileged, assertProviderAccess, isApplicationAccessControlled, canAccessApplication, canViewEvent, resolveRoleGrants, resolveAuthorizationContext, canViewActionRun, canViewWorkflowRun, canViewWorkflowIntervention, canViewPipelineRun, canViewProjectionRun, canViewProjection, emptyGrantIndex };
|
|
1167
1205
|
|
|
1168
|
-
//# debugId=
|
|
1206
|
+
//# debugId=07A883C0450D0C9064756E2164756E21
|