@sixb/core 0.1.11 → 0.1.13
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/builders/params.d.ts +1 -22
- package/dist/actions/builders/params.d.ts.map +1 -1
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +33 -30
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/read-facade.d.ts +14 -16
- package/dist/actions/read-facade.d.ts.map +1 -1
- package/dist/actions/request.d.ts.map +1 -1
- package/dist/actions/run-dispatch.d.ts +2 -0
- package/dist/actions/run-dispatch.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +18 -31
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/types/params.d.ts +11 -44
- package/dist/actions/types/params.d.ts.map +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/actions/worker.js +3 -2
- package/dist/actions/worker.js.map +2 -2
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +15 -9
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +2 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +52 -44
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/sandbox.d.ts +5 -0
- package/dist/agents/sandbox.d.ts.map +1 -0
- package/dist/agents/streams/index.js +4 -3
- package/dist/agents/streams/index.js.map +1 -1
- package/dist/agents/streams/internal.js +4 -3
- package/dist/agents/streams/internal.js.map +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/assert-never.d.ts +6 -0
- package/dist/assert-never.d.ts.map +1 -0
- package/dist/auth/client-address.d.ts +3 -0
- package/dist/auth/client-address.d.ts.map +1 -0
- package/dist/auth/csrf.d.ts +5 -1
- package/dist/auth/csrf.d.ts.map +1 -1
- package/dist/auth/index.d.ts +3 -2
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +15 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +58 -41
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/session-cache.d.ts +10 -3
- package/dist/auth/session-cache.d.ts.map +1 -1
- package/dist/auth/sessions.d.ts +12 -0
- package/dist/auth/sessions.d.ts.map +1 -1
- package/dist/auth/strategy.js +1 -1
- package/dist/auth/types.d.ts +8 -15
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/authorization/index.js +5 -4
- package/dist/authorization/index.js.map +1 -1
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +54 -48
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/bootstrap/ontology-type-manifest.d.ts +8 -0
- package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
- package/dist/{chunk-q5gz3g2j.js → chunk-0321g649.js} +2 -16
- package/dist/{chunk-q5gz3g2j.js.map → chunk-0321g649.js.map} +2 -2
- package/dist/{chunk-d63nnr5b.js → chunk-04h4t2b5.js} +39 -53
- package/dist/{chunk-d63nnr5b.js.map → chunk-04h4t2b5.js.map} +5 -6
- package/dist/chunk-2fv8sajb.js +84 -0
- package/dist/chunk-2fv8sajb.js.map +10 -0
- package/dist/{chunk-1yefycb1.js → chunk-2hbhn1ff.js} +2 -2
- package/dist/{chunk-ap0g1g74.js → chunk-3nx8vj5a.js} +43 -6
- package/dist/chunk-3nx8vj5a.js.map +12 -0
- package/dist/{chunk-wjasrj67.js → chunk-3qpcrcj8.js} +1 -1
- package/dist/{chunk-0y39rgsb.js → chunk-4tnrzqqh.js} +1 -1
- package/dist/chunk-58geavnf.js +29 -0
- package/dist/chunk-58geavnf.js.map +10 -0
- package/dist/{chunk-01kj2pbh.js → chunk-63fp9x3q.js} +97 -67
- package/dist/chunk-63fp9x3q.js.map +20 -0
- package/dist/{chunk-7bs40fe1.js → chunk-69266efg.js} +83 -2
- package/dist/chunk-69266efg.js.map +12 -0
- package/dist/{chunk-sepyxgpc.js → chunk-693f3zn8.js} +70 -28
- package/dist/chunk-693f3zn8.js.map +15 -0
- package/dist/{chunk-7zgecwy1.js → chunk-6x0pqh32.js} +12 -1
- package/dist/{chunk-7zgecwy1.js.map → chunk-6x0pqh32.js.map} +3 -3
- package/dist/{chunk-c5rkjrgp.js → chunk-7ytf06d3.js} +1 -1
- package/dist/{chunk-a0e6x5hd.js → chunk-898y24dd.js} +165 -90
- package/dist/chunk-898y24dd.js.map +15 -0
- package/dist/{chunk-mrp7k0pw.js → chunk-91kcnbf0.js} +9 -14
- package/dist/chunk-91kcnbf0.js.map +10 -0
- package/dist/{chunk-z0s4axeh.js → chunk-91wthfwe.js} +97 -21
- package/dist/{chunk-z0s4axeh.js.map → chunk-91wthfwe.js.map} +8 -7
- package/dist/{chunk-yv79ncbv.js → chunk-96yw3pwd.js} +3 -3
- package/dist/chunk-96yw3pwd.js.map +10 -0
- package/dist/chunk-98cw09sw.js.map +2 -2
- package/dist/{chunk-g00bfdq6.js → chunk-9pfw47qx.js} +318 -257
- package/dist/chunk-9pfw47qx.js.map +44 -0
- package/dist/{chunk-5hz0fnca.js → chunk-a0073121.js} +64 -60
- package/dist/chunk-a0073121.js.map +12 -0
- package/dist/{chunk-cfvakeax.js → chunk-a69fkrtr.js} +5 -5
- package/dist/{chunk-72w2pxk7.js → chunk-bdhfn0ww.js} +11 -3
- package/dist/{chunk-72w2pxk7.js.map → chunk-bdhfn0ww.js.map} +3 -3
- package/dist/chunk-bep5rrdq.js +81 -0
- package/dist/chunk-bep5rrdq.js.map +10 -0
- package/dist/chunk-bxx3ms5t.js +29 -0
- package/dist/chunk-bxx3ms5t.js.map +10 -0
- package/dist/{chunk-v2vcg0w6.js → chunk-cbn96bve.js} +2 -2
- package/dist/{chunk-860dwwy0.js → chunk-cd234ba4.js} +22 -12
- package/dist/chunk-cd234ba4.js.map +14 -0
- package/dist/{chunk-gq8vhakp.js → chunk-cvrbhvtr.js} +292 -104
- package/dist/chunk-cvrbhvtr.js.map +46 -0
- package/dist/{chunk-ms2tmn1k.js → chunk-d8yes9yx.js} +355 -100
- package/dist/chunk-d8yes9yx.js.map +20 -0
- package/dist/{chunk-pr2h4bv4.js → chunk-darm7eeg.js} +9 -9
- package/dist/{chunk-pr2h4bv4.js.map → chunk-darm7eeg.js.map} +3 -3
- package/dist/chunk-dmn70ztd.js.map +2 -2
- package/dist/chunk-drz59ve0.js +57 -0
- package/dist/chunk-drz59ve0.js.map +10 -0
- package/dist/{chunk-skz0hst3.js → chunk-dsfw1bdr.js} +6 -86
- package/dist/{chunk-skz0hst3.js.map → chunk-dsfw1bdr.js.map} +3 -3
- package/dist/{chunk-g6cke204.js → chunk-f85hpqnm.js} +1 -1
- package/dist/{chunk-vsj3mdfj.js → chunk-fc5zfxy1.js} +1 -1
- package/dist/chunk-ffwvdgk1.js +85 -0
- package/dist/chunk-ffwvdgk1.js.map +10 -0
- package/dist/chunk-gbcrz0gr.js +552 -0
- package/dist/chunk-gbcrz0gr.js.map +17 -0
- package/dist/{chunk-gqm76kse.js → chunk-gc226ten.js} +434 -177
- package/dist/chunk-gc226ten.js.map +62 -0
- package/dist/{chunk-awbhdqyc.js → chunk-gmt22nxx.js} +10 -16
- package/dist/chunk-gmt22nxx.js.map +10 -0
- package/dist/chunk-h89wz928.js +42 -0
- package/dist/chunk-h89wz928.js.map +10 -0
- package/dist/{chunk-aa6z4a19.js → chunk-hgqpcmyr.js} +2 -1
- package/dist/chunk-hgqpcmyr.js.map +12 -0
- package/dist/{chunk-gqh45d2n.js → chunk-ht4a7mjg.js} +76 -6
- package/dist/chunk-ht4a7mjg.js.map +15 -0
- package/dist/{chunk-x9m9x2eq.js → chunk-jhyc777j.js} +3 -3
- package/dist/{chunk-fh8kgex1.js → chunk-jmwy25mf.js} +76 -58
- package/dist/{chunk-fh8kgex1.js.map → chunk-jmwy25mf.js.map} +3 -3
- package/dist/{chunk-rb1xx120.js → chunk-k4kkp58d.js} +25 -8
- package/dist/chunk-k4kkp58d.js.map +11 -0
- package/dist/{chunk-jsy70480.js → chunk-ky7zpbtt.js} +366 -98
- package/dist/chunk-ky7zpbtt.js.map +19 -0
- package/dist/chunk-m4ehq95f.js +9 -0
- package/dist/chunk-m4ehq95f.js.map +10 -0
- package/dist/{chunk-17kfctj6.js → chunk-m8zkvep1.js} +2 -2
- package/dist/{chunk-z0271qkp.js → chunk-mdnw7nj8.js} +8 -6
- package/dist/chunk-mdnw7nj8.js.map +15 -0
- package/dist/{chunk-4zhmdsx6.js → chunk-mf6hwpzh.js} +121 -28
- package/dist/{chunk-4zhmdsx6.js.map → chunk-mf6hwpzh.js.map} +6 -6
- package/dist/{chunk-z30bv4ga.js → chunk-mr60an99.js} +5 -3
- package/dist/{chunk-z30bv4ga.js.map → chunk-mr60an99.js.map} +3 -3
- package/dist/chunk-n33e8dz8.js +191 -0
- package/dist/chunk-n33e8dz8.js.map +11 -0
- package/dist/chunk-p1683c0v.js +104 -0
- package/dist/chunk-p1683c0v.js.map +11 -0
- package/dist/{chunk-9qsh3p5y.js → chunk-rb143ggb.js} +1 -1
- package/dist/{chunk-653vwrzr.js → chunk-rdghfsss.js} +1 -1
- package/dist/chunk-rdghfsss.js.map +10 -0
- package/dist/{chunk-ftv470j8.js → chunk-rqtdtm43.js} +365 -67
- package/dist/chunk-rqtdtm43.js.map +50 -0
- package/dist/{chunk-dz5h08xv.js → chunk-rzcjp5m2.js} +28 -9
- package/dist/chunk-rzcjp5m2.js.map +25 -0
- package/dist/{chunk-f4w3yp4f.js → chunk-rzkr70gr.js} +108 -21
- package/dist/chunk-rzkr70gr.js.map +13 -0
- package/dist/{chunk-3ckk0xfj.js → chunk-s24qbp32.js} +18 -13
- package/dist/{chunk-3ckk0xfj.js.map → chunk-s24qbp32.js.map} +3 -3
- package/dist/{chunk-f0rwz2vh.js → chunk-t6f3tdnr.js} +2 -54
- package/dist/chunk-t6f3tdnr.js.map +10 -0
- package/dist/{chunk-93csa55g.js → chunk-tw03bsmb.js} +11 -5
- package/dist/chunk-tw03bsmb.js.map +11 -0
- package/dist/chunk-vef6qa14.js +363 -0
- package/dist/chunk-vef6qa14.js.map +14 -0
- package/dist/{chunk-92vk7gta.js → chunk-vn3yh259.js} +1 -1
- package/dist/{chunk-g91qxjj0.js → chunk-w9bp61e7.js} +5 -5
- package/dist/{chunk-b19g04jk.js → chunk-xgptywp0.js} +4 -3
- package/dist/chunk-xgptywp0.js.map +11 -0
- package/dist/{chunk-g53f0e4j.js → chunk-xnx96gfy.js} +45 -17
- package/dist/{chunk-g53f0e4j.js.map → chunk-xnx96gfy.js.map} +3 -3
- package/dist/{chunk-1824gssz.js → chunk-y487ywrv.js} +4 -4
- package/dist/{chunk-7apz6hg4.js → chunk-y6vnvayj.js} +8 -4
- package/dist/chunk-y6vnvayj.js.map +10 -0
- package/dist/{chunk-wf88w4kp.js → chunk-ypj2wqtj.js} +3 -6
- package/dist/{chunk-wf88w4kp.js.map → chunk-ypj2wqtj.js.map} +4 -4
- package/dist/chunk-z3y5kg1x.js +14 -0
- package/dist/chunk-z3y5kg1x.js.map +10 -0
- package/dist/{chunk-38zv5rkr.js → chunk-z9h698s8.js} +1 -1
- package/dist/{chunk-38zv5rkr.js.map → chunk-z9h698s8.js.map} +2 -2
- package/dist/{chunk-8vj0rjgs.js → chunk-zdkcdshk.js} +3 -36
- package/dist/{chunk-8vj0rjgs.js.map → chunk-zdkcdshk.js.map} +3 -4
- package/dist/{chunk-358caqf5.js → chunk-znw0zvy4.js} +2 -2
- package/dist/datasets/validation.d.ts +4 -0
- package/dist/datasets/validation.d.ts.map +1 -1
- package/dist/datasets/write.d.ts.map +1 -1
- package/dist/datasets/write.js +5 -4
- package/dist/datasets/write.js.map +1 -1
- package/dist/edits/types.d.ts +19 -19
- package/dist/edits/types.d.ts.map +1 -1
- package/dist/error-reporting/capability.d.ts +3 -2
- package/dist/error-reporting/capability.d.ts.map +1 -1
- package/dist/error-reporting/internal.js +5 -4
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/error-reporting/reports.d.ts +10 -0
- package/dist/error-reporting/reports.d.ts.map +1 -1
- package/dist/error-reporting/types.d.ts +10 -2
- package/dist/error-reporting/types.d.ts.map +1 -1
- package/dist/errors/catalog.d.ts +16 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/failure-message.d.ts +8 -0
- package/dist/errors/failure-message.d.ts.map +1 -0
- package/dist/errors/internal.d.ts.map +1 -1
- package/dist/errors/internal.js +3 -2
- package/dist/errors/internal.js.map +1 -1
- package/dist/events/envelope.d.ts +0 -12
- package/dist/events/envelope.d.ts.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +5 -4
- package/dist/events/index.js.map +1 -1
- package/dist/events/service.d.ts +1 -2
- package/dist/events/service.d.ts.map +1 -1
- package/dist/events/toStoredEvent.d.ts +1 -2
- package/dist/events/toStoredEvent.d.ts.map +1 -1
- package/dist/events/types/index.d.ts +2 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/execution/agent.d.ts +1 -2
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +48 -43
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +3 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/kernel-operation.d.ts +4 -0
- package/dist/execution/kernel-operation.d.ts.map +1 -0
- package/dist/execution/primitive.d.ts +1 -2
- package/dist/execution/primitive.d.ts.map +1 -1
- package/dist/execution/primitive.js +47 -42
- package/dist/execution/primitive.js.map +3 -3
- package/dist/execution/request.d.ts +1 -2
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +48 -43
- package/dist/execution/request.js.map +3 -3
- package/dist/execution/types.d.ts +6 -0
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/index.d.ts +20 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +77 -62
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/in-memory.d.ts.map +1 -1
- package/dist/lake-storage/index.js +5 -4
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/maintenance/ontology-maintenance.d.ts +11 -1
- package/dist/maintenance/ontology-maintenance.d.ts.map +1 -1
- package/dist/materialization/errors.d.ts +4 -2
- package/dist/materialization/errors.d.ts.map +1 -1
- package/dist/materialization/events.d.ts +27 -2
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.d.ts +1 -0
- package/dist/materialization/index.d.ts.map +1 -1
- package/dist/materialization/index.js +3 -3
- package/dist/materialization/model.d.ts +2 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materialization/vectors.d.ts +19 -0
- package/dist/materialization/vectors.d.ts.map +1 -0
- package/dist/materializer/context.d.ts.map +1 -1
- package/dist/materializer/edits/commit.d.ts.map +1 -1
- package/dist/materializer/edits/operations.d.ts +2 -1
- package/dist/materializer/edits/operations.d.ts.map +1 -1
- package/dist/materializer/edits/plan.d.ts +2 -2
- package/dist/materializer/edits/plan.d.ts.map +1 -1
- package/dist/materializer/edits/user-refs.d.ts +30 -0
- package/dist/materializer/edits/user-refs.d.ts.map +1 -0
- package/dist/materializer/edits/vector-authority.d.ts +6 -0
- package/dist/materializer/edits/vector-authority.d.ts.map +1 -0
- package/dist/materializer/edits/vectors.d.ts +6 -0
- package/dist/materializer/edits/vectors.d.ts.map +1 -0
- package/dist/materializer/effective/build-events.d.ts +2 -2
- package/dist/materializer/effective/build-events.d.ts.map +1 -1
- package/dist/materializer/effective/validate.d.ts.map +1 -1
- package/dist/materializer/effective/vector-indexing.d.ts +7 -0
- package/dist/materializer/effective/vector-indexing.d.ts.map +1 -0
- package/dist/materializer/effective/vectors.d.ts +6 -0
- package/dist/materializer/effective/vectors.d.ts.map +1 -0
- package/dist/materializer/execution/scope.d.ts +11 -3
- package/dist/materializer/execution/scope.d.ts.map +1 -1
- package/dist/materializer/execution/work-executor.d.ts +2 -1
- package/dist/materializer/execution/work-executor.d.ts.map +1 -1
- package/dist/materializer/index.js +30 -27
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +2 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/materializer/telemetry/plan.d.ts +2 -2
- package/dist/materializer/telemetry/plan.d.ts.map +1 -1
- package/dist/models/catalog-index.d.ts +15 -0
- package/dist/models/catalog-index.d.ts.map +1 -0
- package/dist/models/catalog.d.ts +27 -6
- package/dist/models/catalog.d.ts.map +1 -1
- package/dist/models/decision/catalog.d.ts +12 -0
- package/dist/models/decision/catalog.d.ts.map +1 -0
- package/dist/models/decision/errors.d.ts +7 -0
- package/dist/models/decision/errors.d.ts.map +1 -0
- package/dist/models/decision/output.d.ts +50 -0
- package/dist/models/decision/output.d.ts.map +1 -0
- package/dist/models/decision/questions.d.ts +14 -0
- package/dist/models/decision/questions.d.ts.map +1 -0
- package/dist/models/decision/runtime.d.ts +7 -0
- package/dist/models/decision/runtime.d.ts.map +1 -0
- package/dist/models/decision/types.d.ts +92 -0
- package/dist/models/decision/types.d.ts.map +1 -0
- package/dist/models/decision/validation.d.ts +7 -0
- package/dist/models/decision/validation.d.ts.map +1 -0
- package/dist/models/definitions.d.ts +1 -1
- package/dist/models/definitions.d.ts.map +1 -1
- package/dist/models/embedding-model.d.ts +60 -0
- package/dist/models/embedding-model.d.ts.map +1 -0
- package/dist/models/execution/binding.d.ts +2 -0
- package/dist/models/execution/binding.d.ts.map +1 -1
- package/dist/models/execution/embedding.d.ts +5 -0
- package/dist/models/execution/embedding.d.ts.map +1 -0
- package/dist/models/execution/index.js +32 -27
- package/dist/models/execution/index.js.map +1 -1
- package/dist/models/execution/model-call-recorder.d.ts +5 -1
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -1
- package/dist/models/execution/session.d.ts +21 -0
- package/dist/models/execution/session.d.ts.map +1 -0
- package/dist/models/execution.d.ts.map +1 -1
- package/dist/models/generation-types.d.ts +2 -0
- package/dist/models/generation-types.d.ts.map +1 -1
- package/dist/models/index.d.ts +9 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +17 -7
- package/dist/models/index.js.map +1 -1
- package/dist/models/pricing.d.ts +3 -2
- package/dist/models/pricing.d.ts.map +1 -1
- package/dist/objects/authorized-ontology-view.d.ts.map +1 -1
- package/dist/objects/execution.d.ts +21 -26
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +33 -30
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/executor.d.ts +3 -0
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +2 -0
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +42 -30
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/ir.d.ts +14 -3
- package/dist/objects/query/ir.d.ts.map +1 -1
- package/dist/objects/query/normalize.d.ts.map +1 -1
- package/dist/objects/query/scalar-values.d.ts.map +1 -1
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/object-handle.d.ts +6 -2
- package/dist/objects/sdk/object-handle.d.ts.map +1 -1
- package/dist/objects/sdk/object-set.d.ts +2 -3
- package/dist/objects/sdk/object-set.d.ts.map +1 -1
- package/dist/objects/sdk/query-builder.d.ts +8 -10
- package/dist/objects/sdk/query-builder.d.ts.map +1 -1
- package/dist/objects/sdk/query-executor.d.ts +2 -0
- package/dist/objects/sdk/query-executor.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/objects/sdk/telemetry-channel.d.ts +1 -2
- package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
- package/dist/objects/sdk/where.d.ts +2 -3
- package/dist/objects/sdk/where.d.ts.map +1 -1
- package/dist/objects/vectors/handle.d.ts +4 -0
- package/dist/objects/vectors/handle.d.ts.map +1 -0
- package/dist/objects/vectors/indexing-batch.d.ts +6 -0
- package/dist/objects/vectors/indexing-batch.d.ts.map +1 -0
- package/dist/objects/vectors/indexing-generate.d.ts +11 -0
- package/dist/objects/vectors/indexing-generate.d.ts.map +1 -0
- package/dist/objects/vectors/indexing-runtime.d.ts +7 -0
- package/dist/objects/vectors/indexing-runtime.d.ts.map +1 -0
- package/dist/objects/vectors/indexing-shared.d.ts +17 -0
- package/dist/objects/vectors/indexing-shared.d.ts.map +1 -0
- package/dist/objects/vectors/indexing-single.d.ts +4 -0
- package/dist/objects/vectors/indexing-single.d.ts.map +1 -0
- package/dist/objects/vectors/indexing-store-batch.d.ts +6 -0
- package/dist/objects/vectors/indexing-store-batch.d.ts.map +1 -0
- package/dist/objects/vectors/indexing.d.ts +7 -0
- package/dist/objects/vectors/indexing.d.ts.map +1 -0
- package/dist/objects/vectors/profile.d.ts +13 -0
- package/dist/objects/vectors/profile.d.ts.map +1 -0
- package/dist/objects/vectors/query.d.ts +5 -0
- package/dist/objects/vectors/query.d.ts.map +1 -0
- package/dist/objects/vectors/resolve-query.d.ts +6 -0
- package/dist/objects/vectors/resolve-query.d.ts.map +1 -0
- package/dist/objects/vectors/types.d.ts +11 -0
- package/dist/objects/vectors/types.d.ts.map +1 -0
- package/dist/ontology/builders.d.ts +11 -10
- package/dist/ontology/builders.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +5 -2
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +7 -5
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/inference/index.d.ts +34 -22
- package/dist/ontology/inference/index.d.ts.map +1 -1
- package/dist/ontology/internal.d.ts +1 -0
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +10 -7
- package/dist/ontology/internal.js.map +1 -1
- package/dist/ontology/primitives.d.ts +38 -0
- package/dist/ontology/primitives.d.ts.map +1 -0
- package/dist/ontology/query-capabilities.d.ts +38 -0
- package/dist/ontology/query-capabilities.d.ts.map +1 -0
- package/dist/ontology/refs.d.ts +23 -2
- package/dist/ontology/refs.d.ts.map +1 -1
- package/dist/ontology/registered.d.ts +16 -0
- package/dist/ontology/registered.d.ts.map +1 -0
- package/dist/ontology/registry.d.ts.map +1 -1
- package/dist/ontology/tokens.d.ts +35 -1
- package/dist/ontology/tokens.d.ts.map +1 -1
- package/dist/ontology/types.d.ts +26 -13
- package/dist/ontology/types.d.ts.map +1 -1
- package/dist/ontology/user-ref.d.ts +35 -0
- package/dist/ontology/user-ref.d.ts.map +1 -0
- package/dist/ontology/validation/definition.d.ts +3 -0
- package/dist/ontology/validation/definition.d.ts.map +1 -0
- package/dist/ontology/validation/index.d.ts +1 -1
- package/dist/ontology/validation/index.d.ts.map +1 -1
- package/dist/ontology/validation/normalize.d.ts.map +1 -1
- package/dist/ontology/validation/properties.d.ts +6 -1
- package/dist/ontology/validation/properties.d.ts.map +1 -1
- package/dist/ontology/validation/query.d.ts.map +1 -1
- package/dist/ontology/validation/schema.d.ts +1 -1
- package/dist/ontology/validation/schema.d.ts.map +1 -1
- package/dist/ontology/vector-profiles.d.ts +4 -0
- package/dist/ontology/vector-profiles.d.ts.map +1 -0
- package/dist/pipelines/index.js +32 -29
- package/dist/pipelines/index.js.map +1 -1
- package/dist/predicates/types.d.ts +53 -3
- package/dist/predicates/types.d.ts.map +1 -1
- package/dist/projections/builders.d.ts +19 -1
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/internal.js +28 -25
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/queues/in-memory.d.ts +3 -2
- package/dist/queues/in-memory.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/index.js +1 -1
- package/dist/queues/types.d.ts +5 -0
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/create.d.ts +4 -3
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +10 -7
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +3 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +49 -1
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts +11 -6
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/runtime/types.d.ts +182 -187
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/sandboxes/auth.d.ts +16 -0
- package/dist/sandboxes/auth.d.ts.map +1 -0
- package/dist/sandboxes/config.d.ts +5 -0
- package/dist/sandboxes/config.d.ts.map +1 -0
- package/dist/sandboxes/configuration.d.ts +41 -0
- package/dist/sandboxes/configuration.d.ts.map +1 -0
- package/dist/sandboxes/environment.d.ts +13 -0
- package/dist/sandboxes/environment.d.ts.map +1 -0
- package/dist/sandboxes/errors.d.ts +1 -1
- package/dist/sandboxes/errors.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +6 -1
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +16 -3
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +39 -4
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/shared/params/builders.d.ts +25 -0
- package/dist/shared/params/builders.d.ts.map +1 -0
- package/dist/shared/params/types.d.ts +48 -0
- package/dist/shared/params/types.d.ts.map +1 -0
- package/dist/shared/params/user-refs.d.ts +19 -0
- package/dist/shared/params/user-refs.d.ts.map +1 -0
- package/dist/shared/params/validation.d.ts +15 -0
- package/dist/shared/params/validation.d.ts.map +1 -0
- package/dist/shares/compiler.d.ts.map +1 -1
- package/dist/shares/internal.js +29 -26
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/action-runs/failure.js +4 -3
- package/dist/storage/action-runs/failure.js.map +1 -1
- package/dist/storage/action-runs/provider.js +1 -1
- package/dist/storage/action-runs/types.d.ts +1 -1
- package/dist/storage/action-runs/types.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +2 -1
- 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 +5 -1
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +8 -4
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +49 -0
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +1 -0
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/index.d.ts +1 -1
- package/dist/storage/ai-cost/index.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +2 -2
- package/dist/storage/ai-cost/types.d.ts +14 -2
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +4 -3
- package/dist/storage/ai-limits/enforcement.js.map +1 -1
- package/dist/storage/auth/in-memory/access-tokens.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/device-authorizations.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/sessions.d.ts +8 -1
- package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/index.d.ts +1 -1
- package/dist/storage/auth/index.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +62 -13
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +3 -2
- package/dist/storage/connector-connections/provider.js.map +2 -2
- package/dist/storage/executions/provider.d.ts +3 -3
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +13 -11
- package/dist/storage/executions/provider.js.map +3 -3
- package/dist/storage/executions/types.d.ts +3 -0
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/in-memory.d.ts +9 -18
- package/dist/storage/file-upload-sessions/in-memory.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/index.d.ts +1 -1
- package/dist/storage/file-upload-sessions/index.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.d.ts +52 -0
- package/dist/storage/file-upload-sessions/provider.d.ts.map +1 -0
- package/dist/storage/file-upload-sessions/provider.js +24 -0
- package/dist/storage/file-upload-sessions/provider.js.map +9 -0
- package/dist/storage/file-upload-sessions/types.d.ts +19 -1
- package/dist/storage/file-upload-sessions/types.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/utils.d.ts +8 -2
- package/dist/storage/file-upload-sessions/utils.d.ts.map +1 -1
- package/dist/storage/index.d.ts +8 -6
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +37 -30
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.js +11 -9
- package/dist/storage/internal.js.map +1 -1
- package/dist/storage/objects/in-memory/query.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/read-source.d.ts +5 -0
- package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -1
- package/dist/storage/objects/in-memory/storage.d.ts +7 -0
- package/dist/storage/objects/in-memory/storage.d.ts.map +1 -1
- package/dist/storage/objects/types.d.ts +2 -0
- package/dist/storage/objects/types.d.ts.map +1 -1
- package/dist/storage/ontology/commits.d.ts +7 -2
- package/dist/storage/ontology/commits.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/index.d.ts +4 -0
- package/dist/storage/ontology/in-memory/index.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/materializations.d.ts +2 -0
- package/dist/storage/ontology/in-memory/materializations.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/shared-state.d.ts +7 -0
- package/dist/storage/ontology/in-memory/shared-state.d.ts.map +1 -1
- package/dist/storage/ontology/in-memory/vector-indexing.d.ts +44 -0
- package/dist/storage/ontology/in-memory/vector-indexing.d.ts.map +1 -0
- package/dist/storage/ontology/in-memory/vectors.d.ts +31 -0
- package/dist/storage/ontology/in-memory/vectors.d.ts.map +1 -0
- package/dist/storage/ontology/index.d.ts +6 -0
- package/dist/storage/ontology/index.d.ts.map +1 -1
- package/dist/storage/ontology/provider-work.d.ts.map +1 -1
- package/dist/storage/ontology/provider.d.ts +14 -1
- package/dist/storage/ontology/provider.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +9 -3
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/ontology/vector-indexing.d.ts +94 -0
- package/dist/storage/ontology/vector-indexing.d.ts.map +1 -0
- package/dist/storage/ontology/vectors.d.ts +56 -0
- package/dist/storage/ontology/vectors.d.ts.map +1 -0
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/projection-runs/provider.js +4 -3
- package/dist/storage/projection-runs/provider.js.map +1 -1
- package/dist/storage/types.d.ts +2 -2
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/workflow-interventions/index.d.ts +1 -1
- package/dist/storage/workflow-interventions/index.d.ts.map +1 -1
- package/dist/storage/workflow-interventions/types.d.ts +5 -8
- package/dist/storage/workflow-interventions/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +10 -8
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/syncs/index.js +33 -30
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/action-execution.d.ts +4 -0
- package/dist/testing/action-execution.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution.d.ts +1 -2
- package/dist/testing/execution.d.ts.map +1 -1
- package/dist/testing/file-upload-session-storage-contract.d.ts +12 -0
- package/dist/testing/file-upload-session-storage-contract.d.ts.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2351 -1263
- package/dist/testing/index.js.map +19 -17
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/object-query-contract.d.ts.map +1 -1
- package/dist/testing/object-read-scope-contract.d.ts.map +1 -1
- package/dist/testing/ontology-contract-fixture.d.ts +8 -0
- package/dist/testing/ontology-contract-fixture.d.ts.map +1 -1
- package/dist/testing/ontology-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/sandboxes-contract.d.ts.map +1 -1
- package/dist/testing/workflow-intervention-storage-contract.d.ts +8 -0
- package/dist/testing/workflow-intervention-storage-contract.d.ts.map +1 -0
- package/dist/webhooks/internal.js +29 -26
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/webhooks/types.d.ts +2 -2
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/index.js +3 -2
- package/dist/workers/index.js.map +2 -2
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.js +51 -45
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +2 -2
- package/dist/workflows/types.d.ts.map +1 -1
- package/package.json +7 -1
- package/src/actions/builders/params.ts +1 -48
- package/src/actions/index.ts +0 -3
- package/src/actions/read-facade.ts +102 -62
- package/src/actions/request.ts +13 -0
- package/src/actions/run-dispatch.ts +3 -0
- package/src/actions/types/context.ts +17 -65
- package/src/actions/types/params.ts +16 -75
- package/src/actions/validation.ts +7 -84
- package/src/agents/authority.ts +1 -1
- package/src/agents/errors.ts +3 -0
- package/src/agents/execution.ts +67 -15
- package/src/agents/ids.ts +8 -0
- package/src/agents/index.ts +1 -0
- package/src/agents/request.ts +11 -0
- package/src/agents/sandbox.ts +44 -0
- package/src/agents/validation.ts +2 -108
- package/src/assert-never.ts +7 -0
- package/src/auth/client-address.ts +12 -0
- package/src/auth/csrf.ts +14 -5
- package/src/auth/index.ts +3 -2
- package/src/auth/runtime.ts +299 -277
- package/src/auth/session-cache.ts +18 -6
- package/src/auth/sessions.ts +30 -0
- package/src/auth/types.ts +7 -17
- package/src/bootstrap/index.ts +1 -0
- package/src/bootstrap/ontology-type-manifest.ts +112 -60
- package/src/datasets/validation.ts +40 -11
- package/src/datasets/write.ts +8 -11
- package/src/edits/types.ts +47 -63
- package/src/error-reporting/capability.ts +11 -0
- package/src/error-reporting/reports.ts +23 -0
- package/src/error-reporting/types.ts +12 -1
- package/src/errors/catalog.ts +16 -0
- package/src/errors/failure-message.ts +15 -0
- package/src/errors/internal.ts +57 -25
- package/src/events/envelope.ts +0 -13
- package/src/events/index.ts +1 -1
- package/src/events/service.ts +1 -11
- package/src/events/toStoredEvent.ts +1 -3
- package/src/events/types/index.ts +1 -1
- package/src/execution/agent.ts +1 -2
- package/src/execution/authorization.ts +12 -5
- package/src/execution/authorized-object-reader.ts +42 -9
- package/src/execution/kernel-operation.ts +27 -0
- package/src/execution/primitive.ts +1 -2
- package/src/execution/request.ts +1 -2
- package/src/execution/scopes.ts +2 -0
- package/src/execution/types.ts +4 -4
- package/src/index.ts +68 -8
- package/src/lake-storage/in-memory.ts +5 -3
- package/src/maintenance/ontology-maintenance.ts +77 -1
- package/src/materialization/errors.ts +4 -2
- package/src/materialization/events.ts +27 -2
- package/src/materialization/index.ts +1 -0
- package/src/materialization/model.ts +2 -0
- package/src/materialization/vectors.ts +18 -0
- package/src/materializer/README.md +16 -0
- package/src/materializer/context.ts +10 -0
- package/src/materializer/edits/commit.ts +29 -13
- package/src/materializer/edits/operations.ts +32 -4
- package/src/materializer/edits/plan.ts +4 -5
- package/src/materializer/edits/user-refs.ts +115 -0
- package/src/materializer/edits/vector-authority.ts +108 -0
- package/src/materializer/edits/vectors.ts +100 -0
- package/src/materializer/effective/build-events.ts +4 -5
- package/src/materializer/effective/validate.ts +10 -3
- package/src/materializer/effective/vector-indexing.ts +84 -0
- package/src/materializer/effective/vectors.ts +47 -0
- package/src/materializer/execution/scope.ts +40 -7
- package/src/materializer/execution/work-executor.ts +11 -3
- package/src/materializer/projections/replace.ts +3 -1
- package/src/materializer/projections/replacement-plan.ts +4 -0
- package/src/materializer/shared/normalize.ts +11 -0
- package/src/materializer/telemetry/append.ts +5 -13
- package/src/materializer/telemetry/plan.ts +4 -5
- package/src/models/catalog-index.ts +38 -0
- package/src/models/catalog.ts +66 -38
- package/src/models/decision/catalog.ts +32 -0
- package/src/models/decision/errors.ts +18 -0
- package/src/models/decision/output.ts +101 -0
- package/src/models/decision/questions.ts +29 -0
- package/src/models/decision/runtime.ts +188 -0
- package/src/models/decision/types.ts +109 -0
- package/src/models/decision/validation.ts +335 -0
- package/src/models/definitions.ts +1 -1
- package/src/models/embedding-model.ts +129 -0
- package/src/models/execution/README.md +63 -0
- package/src/models/execution/binding.ts +2 -0
- package/src/models/execution/embedding.ts +133 -0
- package/src/models/execution/model-call-recorder.ts +42 -30
- package/src/models/execution/session.ts +81 -0
- package/src/models/execution.ts +10 -52
- package/src/models/generation-types.ts +2 -0
- package/src/models/index.ts +37 -0
- package/src/models/pricing.ts +1 -2
- package/src/objects/authorized-ontology-view.ts +12 -8
- package/src/objects/execution.ts +34 -61
- package/src/objects/query/executor.ts +25 -7
- package/src/objects/query/explain.ts +7 -2
- package/src/objects/query/index.ts +2 -0
- package/src/objects/query/ir.ts +13 -2
- package/src/objects/query/normalize.ts +5 -1
- package/src/objects/query/planner.ts +1 -0
- package/src/objects/query/scalar-values.ts +19 -0
- package/src/objects/query/validate.ts +129 -117
- package/src/objects/sdk/object-handle.ts +11 -8
- package/src/objects/sdk/object-set.ts +9 -15
- package/src/objects/sdk/query-builder.ts +66 -72
- package/src/objects/sdk/query-executor.ts +2 -1
- package/src/objects/sdk/runtime-query-executor.ts +6 -2
- package/src/objects/sdk/telemetry-channel.ts +6 -7
- package/src/objects/sdk/where.ts +6 -13
- package/src/objects/vectors/README.md +59 -0
- package/src/objects/vectors/handle.ts +91 -0
- package/src/objects/vectors/indexing-batch.ts +163 -0
- package/src/objects/vectors/indexing-generate.ts +184 -0
- package/src/objects/vectors/indexing-runtime.ts +17 -0
- package/src/objects/vectors/indexing-shared.ts +188 -0
- package/src/objects/vectors/indexing-single.ts +51 -0
- package/src/objects/vectors/indexing-store-batch.ts +62 -0
- package/src/objects/vectors/indexing.ts +23 -0
- package/src/objects/vectors/profile.ts +64 -0
- package/src/objects/vectors/query.ts +16 -0
- package/src/objects/vectors/resolve-query.ts +89 -0
- package/src/objects/vectors/types.ts +10 -0
- package/src/ontology/builders.ts +15 -11
- package/src/ontology/index.ts +6 -0
- package/src/ontology/inference/index.ts +56 -36
- package/src/ontology/internal.ts +1 -0
- package/src/ontology/json-schema.ts +12 -0
- package/src/ontology/primitives.ts +91 -0
- package/src/ontology/query-capabilities.ts +136 -0
- package/src/ontology/refs.ts +33 -6
- package/src/ontology/registered.ts +22 -0
- package/src/ontology/registry.ts +14 -3
- package/src/ontology/tokens.ts +41 -2
- package/src/ontology/types.ts +28 -12
- package/src/ontology/user-ref.ts +120 -0
- package/src/ontology/validation/definition.ts +93 -0
- package/src/ontology/validation/index.ts +1 -0
- package/src/ontology/validation/normalize.ts +39 -3
- package/src/ontology/validation/properties.ts +109 -23
- package/src/ontology/validation/query.ts +44 -92
- package/src/ontology/validation/schema.ts +101 -23
- package/src/ontology/vector-profiles.ts +35 -0
- package/src/predicates/types.ts +43 -33
- package/src/projections/builders.ts +24 -3
- package/src/projections/validation.ts +15 -1
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +1 -0
- package/src/queues/types.ts +10 -0
- package/src/runtime/create.ts +7 -6
- package/src/runtime/host.ts +44 -10
- package/src/runtime/index.ts +3 -2
- package/src/runtime/internal.ts +3 -0
- package/src/runtime/resolve-definitions.ts +19 -1
- package/src/runtime/sixb.ts +25 -17
- package/src/runtime/types.ts +288 -478
- package/src/sandboxes/README.md +41 -0
- package/src/sandboxes/auth.ts +17 -0
- package/src/sandboxes/config.ts +37 -0
- package/src/sandboxes/configuration.ts +268 -0
- package/src/sandboxes/environment.ts +107 -0
- package/src/sandboxes/errors.ts +1 -1
- package/src/sandboxes/index.ts +15 -0
- package/src/sandboxes/sandbox.ts +42 -4
- package/src/shared/params/builders.ts +50 -0
- package/src/shared/params/types.ts +85 -0
- package/src/shared/params/user-refs.ts +48 -0
- package/src/shared/params/validation.ts +114 -0
- package/src/shares/compiler.ts +6 -16
- package/src/storage/action-runs/types.ts +1 -0
- package/src/storage/agents/in-memory.ts +25 -1
- package/src/storage/agents/index.ts +3 -0
- package/src/storage/agents/provider.ts +105 -0
- package/src/storage/agents/types.ts +54 -0
- package/src/storage/ai-cost/analytics.ts +59 -21
- package/src/storage/ai-cost/index.ts +1 -0
- package/src/storage/ai-cost/types.ts +19 -2
- package/src/storage/auth/in-memory/access-tokens.ts +5 -2
- package/src/storage/auth/in-memory/auth-storage.ts +5 -8
- package/src/storage/auth/in-memory/device-authorizations.ts +0 -2
- package/src/storage/auth/in-memory/sessions.ts +69 -1
- package/src/storage/auth/in-memory/shared.ts +13 -7
- package/src/storage/auth/index.ts +2 -1
- package/src/storage/auth/types.ts +57 -13
- package/src/storage/executions/provider.ts +24 -12
- package/src/storage/executions/types.ts +1 -0
- package/src/storage/executions/validation.ts +8 -4
- package/src/storage/file-upload-sessions/in-memory.ts +64 -113
- package/src/storage/file-upload-sessions/index.ts +1 -0
- package/src/storage/file-upload-sessions/provider.ts +258 -0
- package/src/storage/file-upload-sessions/types.ts +20 -1
- package/src/storage/file-upload-sessions/utils.ts +25 -9
- package/src/storage/index.ts +18 -3
- package/src/storage/objects/in-memory/query.ts +38 -14
- package/src/storage/objects/in-memory/read-scope.ts +9 -2
- package/src/storage/objects/in-memory/read-source.ts +5 -0
- package/src/storage/objects/in-memory/selected-reader.ts +5 -1
- package/src/storage/objects/in-memory/storage.ts +19 -1
- package/src/storage/objects/types.ts +2 -0
- package/src/storage/ontology/commits.ts +7 -2
- package/src/storage/ontology/in-memory/index.ts +20 -0
- package/src/storage/ontology/in-memory/materializations.ts +19 -34
- package/src/storage/ontology/in-memory/shared-state.ts +9 -0
- package/src/storage/ontology/in-memory/vector-indexing.ts +179 -0
- package/src/storage/ontology/in-memory/vectors.ts +73 -0
- package/src/storage/ontology/index.ts +14 -0
- package/src/storage/ontology/provider-header-validation.ts +57 -0
- package/src/storage/ontology/provider-work.ts +15 -3
- package/src/storage/ontology/provider.ts +59 -1
- package/src/storage/ontology/vector-indexing.ts +98 -0
- package/src/storage/ontology/vectors.ts +48 -0
- package/src/storage/operation-scope.ts +2 -0
- package/src/storage/types.ts +3 -1
- package/src/storage/workflow-interventions/index.ts +0 -1
- package/src/storage/workflow-interventions/types.ts +5 -9
- package/src/testing/action-execution.ts +13 -3
- package/src/testing/agent-storage-contract.ts +246 -0
- package/src/testing/ai-cost-storage-contract.ts +134 -0
- package/src/testing/auth-storage-contract.ts +149 -62
- package/src/testing/execution-storage-contract.ts +1 -2
- package/src/testing/execution.ts +4 -7
- package/src/testing/file-upload-session-storage-contract.ts +335 -0
- package/src/testing/index.ts +8 -0
- package/src/testing/materializer-storage-contract.ts +86 -4
- package/src/testing/object-query-contract.ts +162 -27
- package/src/testing/object-read-scope-contract.ts +1 -5
- package/src/testing/ontology-contract-fixture.ts +23 -3
- package/src/testing/ontology-storage-contract.ts +58 -0
- package/src/testing/queues-contract.ts +31 -0
- package/src/testing/sandboxes-contract.ts +27 -0
- package/src/testing/workflow-intervention-storage-contract.ts +203 -0
- package/src/webhooks/types.ts +2 -2
- package/src/workflows/failure.ts +10 -4
- package/src/workflows/run-dispatch.ts +12 -1
- package/src/workflows/snapshot.ts +16 -7
- package/src/workflows/types.ts +2 -2
- package/src/workflows/validation.ts +2 -2
- package/dist/chunk-01kj2pbh.js.map +0 -19
- package/dist/chunk-5hz0fnca.js.map +0 -12
- package/dist/chunk-653vwrzr.js.map +0 -10
- package/dist/chunk-7apz6hg4.js.map +0 -10
- package/dist/chunk-7bs40fe1.js.map +0 -12
- package/dist/chunk-860dwwy0.js.map +0 -14
- package/dist/chunk-93csa55g.js.map +0 -11
- package/dist/chunk-a0e6x5hd.js.map +0 -14
- package/dist/chunk-aa6z4a19.js.map +0 -12
- package/dist/chunk-ap0g1g74.js.map +0 -11
- package/dist/chunk-awbhdqyc.js.map +0 -10
- package/dist/chunk-b19g04jk.js.map +0 -11
- package/dist/chunk-dz5h08xv.js.map +0 -25
- package/dist/chunk-f0rwz2vh.js.map +0 -11
- package/dist/chunk-f4w3yp4f.js.map +0 -12
- package/dist/chunk-ftv470j8.js.map +0 -45
- package/dist/chunk-g00bfdq6.js.map +0 -43
- package/dist/chunk-gq8vhakp.js.map +0 -44
- package/dist/chunk-gqh45d2n.js.map +0 -15
- package/dist/chunk-gqm76kse.js.map +0 -58
- package/dist/chunk-jsy70480.js.map +0 -15
- package/dist/chunk-mrp7k0pw.js.map +0 -10
- package/dist/chunk-ms2tmn1k.js.map +0 -17
- package/dist/chunk-rb1xx120.js.map +0 -11
- package/dist/chunk-sepyxgpc.js.map +0 -15
- package/dist/chunk-yv79ncbv.js.map +0 -10
- package/dist/chunk-z0271qkp.js.map +0 -15
- package/dist/chunk-z3y411fq.js +0 -99
- package/dist/chunk-z3y411fq.js.map +0 -11
- /package/dist/{chunk-1yefycb1.js.map → chunk-2hbhn1ff.js.map} +0 -0
- /package/dist/{chunk-wjasrj67.js.map → chunk-3qpcrcj8.js.map} +0 -0
- /package/dist/{chunk-0y39rgsb.js.map → chunk-4tnrzqqh.js.map} +0 -0
- /package/dist/{chunk-c5rkjrgp.js.map → chunk-7ytf06d3.js.map} +0 -0
- /package/dist/{chunk-cfvakeax.js.map → chunk-a69fkrtr.js.map} +0 -0
- /package/dist/{chunk-v2vcg0w6.js.map → chunk-cbn96bve.js.map} +0 -0
- /package/dist/{chunk-g6cke204.js.map → chunk-f85hpqnm.js.map} +0 -0
- /package/dist/{chunk-vsj3mdfj.js.map → chunk-fc5zfxy1.js.map} +0 -0
- /package/dist/{chunk-x9m9x2eq.js.map → chunk-jhyc777j.js.map} +0 -0
- /package/dist/{chunk-17kfctj6.js.map → chunk-m8zkvep1.js.map} +0 -0
- /package/dist/{chunk-9qsh3p5y.js.map → chunk-rb143ggb.js.map} +0 -0
- /package/dist/{chunk-92vk7gta.js.map → chunk-vn3yh259.js.map} +0 -0
- /package/dist/{chunk-g91qxjj0.js.map → chunk-w9bp61e7.js.map} +0 -0
- /package/dist/{chunk-1824gssz.js.map → chunk-y487ywrv.js.map} +0 -0
- /package/dist/{chunk-358caqf5.js.map → chunk-znw0zvy4.js.map} +0 -0
|
@@ -5,27 +5,26 @@ import {
|
|
|
5
5
|
canAccessApplication2,
|
|
6
6
|
resolveRoleGrants2,
|
|
7
7
|
resolveAuthorizationContext2
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
normalizeSchemaValue2,
|
|
11
|
-
coerceSchemaValueToTyped2
|
|
12
|
-
} from "./chunk-ms2tmn1k.js";
|
|
8
|
+
} from "./chunk-rzcjp5m2.js";
|
|
13
9
|
import {
|
|
14
10
|
AuthRuntimeError2,
|
|
11
|
+
DEFAULT_AUTH_SESSION_AUDIENCE2,
|
|
15
12
|
resolveAuthSessionAudience2,
|
|
16
13
|
resolveAuthCookieOptionsForAudience,
|
|
17
14
|
getCookie2,
|
|
18
15
|
resolveAuthConfig2,
|
|
19
16
|
resolveInvitationExpiresAt,
|
|
20
|
-
sanitizeReturnTo,
|
|
21
17
|
assertNonEmpty3,
|
|
22
18
|
normalizePagination,
|
|
23
19
|
isInvitationDeliveryAuthStrategy2
|
|
24
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-0321g649.js";
|
|
21
|
+
import {
|
|
22
|
+
normalizeParams,
|
|
23
|
+
coerceParamsToTyped
|
|
24
|
+
} from "./chunk-2fv8sajb.js";
|
|
25
25
|
import {
|
|
26
|
-
validateSchemaOrRefValue2,
|
|
27
26
|
snapshotLinkPathSelection
|
|
28
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-t6f3tdnr.js";
|
|
29
28
|
import {
|
|
30
29
|
OntologyValidationError2
|
|
31
30
|
} from "./chunk-cqr3acm1.js";
|
|
@@ -110,6 +109,14 @@ function accessTokenKindFromLabel(label) {
|
|
|
110
109
|
}
|
|
111
110
|
return null;
|
|
112
111
|
}
|
|
112
|
+
// src/auth/client-address.ts
|
|
113
|
+
var clientAddresses = new WeakMap;
|
|
114
|
+
function setRequestClientAddress2(request, address) {
|
|
115
|
+
clientAddresses.set(request, address);
|
|
116
|
+
}
|
|
117
|
+
function getRequestClientAddress2(request) {
|
|
118
|
+
return clientAddresses.get(request);
|
|
119
|
+
}
|
|
113
120
|
// src/auth/csrf.ts
|
|
114
121
|
import { randomBytes as randomBytes2, timingSafeEqual } from "crypto";
|
|
115
122
|
var CSRF_HEADER_NAME2 = "x-sixb-csrf";
|
|
@@ -124,12 +131,17 @@ function verifyDoubleSubmitCsrf2(request, options) {
|
|
|
124
131
|
if (isCsrfExemptMethod2(request.method)) {
|
|
125
132
|
return true;
|
|
126
133
|
}
|
|
134
|
+
return verifyCsrfToken2(request, {
|
|
135
|
+
cookieName: options.cookieName,
|
|
136
|
+
token: request.headers.get(CSRF_HEADER_NAME2)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function verifyCsrfToken2(request, options) {
|
|
127
140
|
const cookieValue = getCookie2(request, options.cookieName);
|
|
128
|
-
|
|
129
|
-
if (!cookieValue || !headerValue) {
|
|
141
|
+
if (!cookieValue || !options.token) {
|
|
130
142
|
return false;
|
|
131
143
|
}
|
|
132
|
-
return safeEqual(cookieValue,
|
|
144
|
+
return safeEqual(cookieValue, options.token);
|
|
133
145
|
}
|
|
134
146
|
function safeEqual(left, right) {
|
|
135
147
|
const leftBytes = Buffer.from(left);
|
|
@@ -626,46 +638,13 @@ function isObjectActionDefinition2(value) {
|
|
|
626
638
|
return value.binding.kind === "object";
|
|
627
639
|
}
|
|
628
640
|
function normalizeActionParams(runtime, paramsConfig, params, pathPrefix) {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
throw new OntologyValidationError2(`Unknown param '${paramId}' for action '${pathPrefix}'`);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
|
|
637
|
-
const value = params[paramId];
|
|
638
|
-
if (value === undefined) {
|
|
639
|
-
if (paramDef.required) {
|
|
640
|
-
throw new OntologyValidationError2(`Missing required param '${paramId}' for action '${pathPrefix}'`);
|
|
641
|
-
}
|
|
642
|
-
continue;
|
|
643
|
-
}
|
|
644
|
-
if (value === null) {
|
|
645
|
-
if (!paramDef.nullable) {
|
|
646
|
-
throw new OntologyValidationError2(`[Sixb] Action param ${pathPrefix}.${paramId} cannot be null`);
|
|
647
|
-
}
|
|
648
|
-
normalized[paramId] = null;
|
|
649
|
-
continue;
|
|
650
|
-
}
|
|
651
|
-
validateSchemaOrRefValue2(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
|
|
652
|
-
normalized[paramId] = normalizeSchemaOrRefValue(paramDef.schema, value, `${pathPrefix}.${paramId}`, runtime.ontology.getValueTypesById());
|
|
653
|
-
}
|
|
654
|
-
return normalized;
|
|
641
|
+
return normalizeParams(runtime.ontology.getValueTypesById(), paramsConfig, params, {
|
|
642
|
+
kind: "action",
|
|
643
|
+
id: pathPrefix
|
|
644
|
+
});
|
|
655
645
|
}
|
|
656
646
|
function coerceActionParamsToTyped2(paramsConfig, params, valueTypesById) {
|
|
657
|
-
|
|
658
|
-
for (const [paramId, paramDef] of Object.entries(paramsConfig)) {
|
|
659
|
-
const value = params[paramId];
|
|
660
|
-
if (value === undefined)
|
|
661
|
-
continue;
|
|
662
|
-
const schema = paramDef.schema;
|
|
663
|
-
if (typeof schema === "object" && schema !== null && schema.type === "objectRef") {
|
|
664
|
-
continue;
|
|
665
|
-
}
|
|
666
|
-
coerced[paramId] = coerceSchemaValueToTyped2(schema, value, valueTypesById);
|
|
667
|
-
}
|
|
668
|
-
return coerced;
|
|
647
|
+
return coerceParamsToTyped(paramsConfig, params, valueTypesById);
|
|
669
648
|
}
|
|
670
649
|
function validateActionSubject(action, subject) {
|
|
671
650
|
if (isGlobalActionDefinition2(action) && subject.kind !== "none") {
|
|
@@ -686,16 +665,6 @@ function resolveObjectActionSubject(params) {
|
|
|
686
665
|
function actionAppliesToObjectType(runtime, action, objectType) {
|
|
687
666
|
return runtime.actionRegistry.listForType(objectType).some((candidate) => candidate.id === action.id);
|
|
688
667
|
}
|
|
689
|
-
function normalizeSchemaOrRefValue(schema, value, path, valueTypesById) {
|
|
690
|
-
if (typeof schema === "object" && schema !== null && schema.type === "objectRef") {
|
|
691
|
-
const refValue = value;
|
|
692
|
-
return {
|
|
693
|
-
objectTypeId: refValue.objectTypeId,
|
|
694
|
-
primaryId: refValue.primaryId
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
return normalizeSchemaValue2(schema, value, path, valueTypesById);
|
|
698
|
-
}
|
|
699
668
|
|
|
700
669
|
// src/shares/errors.ts
|
|
701
670
|
class ShareDefinitionError2 extends Error {
|
|
@@ -1410,7 +1379,12 @@ function createSessionRecord(state, input) {
|
|
|
1410
1379
|
expiresAt: cloneDate(input.expiresAt),
|
|
1411
1380
|
absoluteExpiresAt: input.absoluteExpiresAt ? cloneDate(input.absoluteExpiresAt) : undefined,
|
|
1412
1381
|
userAgent: input.userAgent,
|
|
1413
|
-
ipAddress: input.ipAddress
|
|
1382
|
+
ipAddress: input.ipAddress,
|
|
1383
|
+
bearer: input.bearer ? {
|
|
1384
|
+
clientName: assertNonEmpty4(input.bearer.clientName, "Session client name"),
|
|
1385
|
+
accessExpiresAt: cloneDate(input.bearer.accessExpiresAt),
|
|
1386
|
+
refreshTokenHash: assertNonEmpty4(input.bearer.refreshTokenHash, "Refresh token hash")
|
|
1387
|
+
} : undefined
|
|
1414
1388
|
};
|
|
1415
1389
|
state.sessions.set(sessionKey(projectId, id), cloneRecord(session));
|
|
1416
1390
|
return session;
|
|
@@ -1464,10 +1438,10 @@ function createAccessTokenRecord(state, input) {
|
|
|
1464
1438
|
const id = assertNonEmpty4(input.id, "Access token id");
|
|
1465
1439
|
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
1466
1440
|
const name = assertNonEmpty4(input.name, "Access token name");
|
|
1467
|
-
const subjectId = assertNonEmpty4(input.
|
|
1441
|
+
const subjectId = assertNonEmpty4(input.subject.id, "Access token subject id");
|
|
1468
1442
|
const tokenHash = assertNonEmpty4(input.tokenHash, "Access token hash");
|
|
1469
|
-
assertAccessTokenSubject(input.kind, input.
|
|
1470
|
-
assertAccessTokenSubjectExists(state, projectId, input.
|
|
1443
|
+
assertAccessTokenSubject(input.kind, input.subject.type);
|
|
1444
|
+
assertAccessTokenSubjectExists(state, projectId, input.subject.type, subjectId);
|
|
1471
1445
|
const key = accessTokenKey(projectId, id);
|
|
1472
1446
|
if (state.accessTokens.has(key)) {
|
|
1473
1447
|
throw new AuthStorageError2("duplicate_access_token", `[Sixb] Access token '${id}' already exists for project '${projectId}'.`);
|
|
@@ -1477,8 +1451,7 @@ function createAccessTokenRecord(state, input) {
|
|
|
1477
1451
|
projectId,
|
|
1478
1452
|
name,
|
|
1479
1453
|
kind: input.kind,
|
|
1480
|
-
|
|
1481
|
-
subjectId,
|
|
1454
|
+
subject: { type: input.subject.type, id: subjectId },
|
|
1482
1455
|
tokenHash,
|
|
1483
1456
|
groupIds: normalizeOptionalGroupIds(input.groupIds),
|
|
1484
1457
|
createdByPrincipal: input.createdByPrincipal,
|
|
@@ -1600,7 +1573,7 @@ class InMemoryAuthAccessTokenStore {
|
|
|
1600
1573
|
async list(input) {
|
|
1601
1574
|
const order = input.order ?? "asc";
|
|
1602
1575
|
const offset = input.offset ?? 0;
|
|
1603
|
-
const rows = [...this.state.accessTokens.values()].filter((token) => token.projectId === input.projectId).filter((token) => input.kind === undefined || token.kind === input.kind).filter((token) => input.
|
|
1576
|
+
const rows = [...this.state.accessTokens.values()].filter((token) => token.projectId === input.projectId).filter((token) => input.kind === undefined || token.kind === input.kind).filter((token) => input.subject === undefined || token.subject.type === input.subject.type && token.subject.id === input.subject.id).filter((token) => input.includeRevoked || !token.revokedAt).sort((a, b) => compareByCreatedAt(a, b, order));
|
|
1604
1577
|
const page = rows.slice(offset, input.limit === undefined ? undefined : offset + input.limit);
|
|
1605
1578
|
return {
|
|
1606
1579
|
accessTokens: page.map(cloneRecord),
|
|
@@ -1676,8 +1649,6 @@ class InMemoryAuthDeviceAuthorizationStore {
|
|
|
1676
1649
|
deviceCodeHash: assertNonEmpty4(input.deviceCodeHash, "Device code hash"),
|
|
1677
1650
|
userCode: assertNonEmpty4(input.userCode, "User code"),
|
|
1678
1651
|
clientName: assertNonEmpty4(input.clientName, "Client name"),
|
|
1679
|
-
tokenName: assertNonEmpty4(input.tokenName, "Token name"),
|
|
1680
|
-
tokenExpiresAt: new Date(input.tokenExpiresAt),
|
|
1681
1652
|
status: "pending",
|
|
1682
1653
|
createdAt: new Date(input.createdAt),
|
|
1683
1654
|
expiresAt: new Date(input.expiresAt)
|
|
@@ -2124,15 +2095,54 @@ class InMemoryAuthSessionStore {
|
|
|
2124
2095
|
}
|
|
2125
2096
|
async findValidByTokenHash(params) {
|
|
2126
2097
|
const session = this.state.sessions.get(sessionKey(params.projectId, params.id));
|
|
2127
|
-
if (!session || session.audience !== params.audience || session.tokenHash !== params.tokenHash || !isActiveSession(session, params.now)) {
|
|
2098
|
+
if (!session || session.bearer || session.audience !== params.audience || session.tokenHash !== params.tokenHash || !isActiveSession(session, params.now)) {
|
|
2099
|
+
return null;
|
|
2100
|
+
}
|
|
2101
|
+
return cloneRecord(session);
|
|
2102
|
+
}
|
|
2103
|
+
async findValidByAccessTokenHash(params) {
|
|
2104
|
+
const session = this.state.sessions.get(sessionKey(params.projectId, params.id));
|
|
2105
|
+
if (!session?.bearer || session.tokenHash !== params.tokenHash || session.bearer.accessExpiresAt <= params.now || !isActiveSession(session, params.now)) {
|
|
2128
2106
|
return null;
|
|
2129
2107
|
}
|
|
2130
2108
|
return cloneRecord(session);
|
|
2131
2109
|
}
|
|
2110
|
+
async rotateRefreshToken(params) {
|
|
2111
|
+
const key = sessionKey(params.projectId, params.id);
|
|
2112
|
+
const session = this.state.sessions.get(key);
|
|
2113
|
+
if (!session?.bearer || !isActiveSession(session, params.now)) {
|
|
2114
|
+
return { status: "invalid" };
|
|
2115
|
+
}
|
|
2116
|
+
const { bearer } = session;
|
|
2117
|
+
const replacedRecently = bearer.previousRefreshTokenHash === params.refreshTokenHash && bearer.refreshedAt !== undefined && params.now.getTime() - bearer.refreshedAt.getTime() <= params.reuseGraceMs;
|
|
2118
|
+
if (bearer.refreshTokenHash !== params.refreshTokenHash && !replacedRecently) {
|
|
2119
|
+
if (bearer.previousRefreshTokenHash !== params.refreshTokenHash) {
|
|
2120
|
+
return { status: "invalid" };
|
|
2121
|
+
}
|
|
2122
|
+
this.state.sessions.set(key, cloneRecord({ ...session, revokedAt: cloneDate(params.now) }));
|
|
2123
|
+
return { status: "reused" };
|
|
2124
|
+
}
|
|
2125
|
+
const requestedExpiresAt = session.absoluteExpiresAt ? new Date(Math.min(params.next.expiresAt.getTime(), session.absoluteExpiresAt.getTime())) : params.next.expiresAt;
|
|
2126
|
+
const next = {
|
|
2127
|
+
...session,
|
|
2128
|
+
tokenHash: params.next.tokenHash,
|
|
2129
|
+
expiresAt: new Date(Math.max(session.expiresAt.getTime(), requestedExpiresAt.getTime())),
|
|
2130
|
+
lastSeenAt: cloneDate(params.now),
|
|
2131
|
+
bearer: {
|
|
2132
|
+
clientName: bearer.clientName,
|
|
2133
|
+
accessExpiresAt: cloneDate(params.next.accessExpiresAt),
|
|
2134
|
+
refreshTokenHash: params.next.refreshTokenHash,
|
|
2135
|
+
previousRefreshTokenHash: bearer.refreshTokenHash,
|
|
2136
|
+
refreshedAt: cloneDate(params.now)
|
|
2137
|
+
}
|
|
2138
|
+
};
|
|
2139
|
+
this.state.sessions.set(key, cloneRecord(next));
|
|
2140
|
+
return { status: "rotated", session: cloneRecord(next) };
|
|
2141
|
+
}
|
|
2132
2142
|
async renewIfValid(params) {
|
|
2133
2143
|
const key = sessionKey(params.projectId, params.id);
|
|
2134
2144
|
const session = this.state.sessions.get(key);
|
|
2135
|
-
if (!session || session.audience !== params.audience || session.tokenHash !== params.tokenHash || !isActiveSession(session, params.now)) {
|
|
2145
|
+
if (!session || session.bearer || session.audience !== params.audience || session.tokenHash !== params.tokenHash || !isActiveSession(session, params.now)) {
|
|
2136
2146
|
return null;
|
|
2137
2147
|
}
|
|
2138
2148
|
const requestedExpiresAt = session.absoluteExpiresAt ? new Date(Math.min(params.expiresAt.getTime(), session.absoluteExpiresAt.getTime())) : params.expiresAt;
|
|
@@ -2318,17 +2328,17 @@ class InMemoryAuthStorage2 {
|
|
|
2318
2328
|
if (authorization.status !== "approved" || !authorization.approvedUserId || !authorization.approvedSessionId || authorization.expiresAt <= input.completedAt) {
|
|
2319
2329
|
throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Device authorization is invalid.");
|
|
2320
2330
|
}
|
|
2321
|
-
if (input.
|
|
2322
|
-
throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Device
|
|
2331
|
+
if (input.session.projectId !== input.projectId || input.session.userId !== authorization.approvedUserId) {
|
|
2332
|
+
throw new AuthStorageError2("invalid_device_authorization", "[Sixb] Device session is invalid.");
|
|
2323
2333
|
}
|
|
2324
|
-
const
|
|
2334
|
+
const session = createSessionRecord(this.state, input.session);
|
|
2325
2335
|
const consumed = {
|
|
2326
2336
|
...authorization,
|
|
2327
2337
|
status: "consumed",
|
|
2328
2338
|
consumedAt: new Date(input.completedAt)
|
|
2329
2339
|
};
|
|
2330
2340
|
this.state.deviceAuthorizations.set(key, cloneRecord(consumed));
|
|
2331
|
-
return { authorization: cloneRecord(consumed),
|
|
2341
|
+
return { authorization: cloneRecord(consumed), session: cloneRecord(session) };
|
|
2332
2342
|
}
|
|
2333
2343
|
async completeMagicLinkSignIn(input) {
|
|
2334
2344
|
const projectId = assertNonEmpty4(input.projectId, "Project id");
|
|
@@ -2640,20 +2650,22 @@ class SessionCache {
|
|
|
2640
2650
|
if (!entry) {
|
|
2641
2651
|
return;
|
|
2642
2652
|
}
|
|
2643
|
-
if (entry.expiresAtMs <= input.nowMs || entry.tokenHash !== input.tokenHash || entry.audience !== input.audience) {
|
|
2653
|
+
if (entry.expiresAtMs <= input.nowMs || entry.tokenHash !== input.tokenHash || entry.transport !== input.transport || input.audience !== undefined && entry.audience !== input.audience) {
|
|
2644
2654
|
this.entries.delete(input.sessionId);
|
|
2645
2655
|
return;
|
|
2646
2656
|
}
|
|
2647
2657
|
return entry.session;
|
|
2648
2658
|
}
|
|
2649
2659
|
set(input) {
|
|
2650
|
-
const
|
|
2660
|
+
const bearer = input.session.session.bearer;
|
|
2661
|
+
const expiresAtMs = Math.min(input.nowMs + this.ttlMs, input.sessionExpiresAtMs, input.sessionAbsoluteExpiresAtMs ?? Number.POSITIVE_INFINITY, bearer?.accessExpiresAt.getTime() ?? Number.POSITIVE_INFINITY);
|
|
2651
2662
|
if (expiresAtMs <= input.nowMs) {
|
|
2652
2663
|
return;
|
|
2653
2664
|
}
|
|
2654
2665
|
this.entries.delete(input.sessionId);
|
|
2655
2666
|
this.entries.set(input.sessionId, {
|
|
2656
2667
|
tokenHash: input.tokenHash,
|
|
2668
|
+
transport: bearer ? "bearer" : "cookie",
|
|
2657
2669
|
audience: input.audience,
|
|
2658
2670
|
session: input.session,
|
|
2659
2671
|
expiresAtMs
|
|
@@ -2716,10 +2728,27 @@ function createSessionCredential2(sessionId = `ses_${randomUUID2()}`) {
|
|
|
2716
2728
|
cookieValue: formatSessionCookieValue2(sessionId, sessionSecret)
|
|
2717
2729
|
};
|
|
2718
2730
|
}
|
|
2731
|
+
var SESSION_ACCESS_TOKEN_PREFIX = "sixb_at_";
|
|
2732
|
+
var SESSION_REFRESH_TOKEN_PREFIX = "sixb_rt_";
|
|
2733
|
+
function createBearerSessionTokens(sessionId) {
|
|
2734
|
+
const accessSecret = generateSessionSecret2();
|
|
2735
|
+
const refreshSecret = generateSessionSecret2();
|
|
2736
|
+
return {
|
|
2737
|
+
accessToken: `${SESSION_ACCESS_TOKEN_PREFIX}${formatSessionCookieValue2(sessionId, accessSecret)}`,
|
|
2738
|
+
refreshToken: `${SESSION_REFRESH_TOKEN_PREFIX}${formatSessionCookieValue2(sessionId, refreshSecret)}`,
|
|
2739
|
+
tokenHash: hashSessionSecret2(accessSecret),
|
|
2740
|
+
refreshTokenHash: hashSessionSecret2(refreshSecret)
|
|
2741
|
+
};
|
|
2742
|
+
}
|
|
2743
|
+
function parseBearerSessionToken(prefix, value) {
|
|
2744
|
+
return value.startsWith(prefix) ? parseSessionCookieValue2(value.slice(prefix.length)) : null;
|
|
2745
|
+
}
|
|
2719
2746
|
|
|
2720
2747
|
// src/auth/runtime.ts
|
|
2721
2748
|
var SESSION_TOUCH_INTERVAL_MS = 60000;
|
|
2722
2749
|
var ACCESS_TOKEN_TOUCH_INTERVAL_MS = 60000;
|
|
2750
|
+
var BEARER_ACCESS_TOKEN_TTL_MS = 15 * 60000;
|
|
2751
|
+
var REFRESH_REUSE_GRACE_MS = 60000;
|
|
2723
2752
|
|
|
2724
2753
|
class AuthRuntime2 {
|
|
2725
2754
|
projectId;
|
|
@@ -2774,19 +2803,17 @@ class AuthRuntime2 {
|
|
|
2774
2803
|
return { authenticated: false, reason: "auth_disabled" };
|
|
2775
2804
|
}
|
|
2776
2805
|
const audience = resolveAuthSessionAudience2(options.audience);
|
|
2777
|
-
|
|
2778
|
-
if (credentialSource !== "session") {
|
|
2779
|
-
const authorizationHeader = request.headers.get("authorization");
|
|
2806
|
+
if (options.credentialSource === "any") {
|
|
2780
2807
|
const tokenValue = getBearerAccessTokenValue2(request);
|
|
2808
|
+
if (tokenValue?.startsWith(SESSION_ACCESS_TOKEN_PREFIX)) {
|
|
2809
|
+
return this.resolveBearerSession(tokenValue);
|
|
2810
|
+
}
|
|
2781
2811
|
if (tokenValue) {
|
|
2782
2812
|
return this.resolveAccessTokenSession(request, tokenValue);
|
|
2783
2813
|
}
|
|
2784
|
-
if (
|
|
2814
|
+
if (request.headers.get("authorization")) {
|
|
2785
2815
|
return { authenticated: false, reason: "invalid_access_token" };
|
|
2786
2816
|
}
|
|
2787
|
-
if (credentialSource === "accessToken") {
|
|
2788
|
-
return { authenticated: false, reason: "missing_access_token" };
|
|
2789
|
-
}
|
|
2790
2817
|
}
|
|
2791
2818
|
return this.resolveCookieSession(request, audience, options.sessionActivity);
|
|
2792
2819
|
}
|
|
@@ -2805,6 +2832,7 @@ class AuthRuntime2 {
|
|
|
2805
2832
|
const cached = this.sessionCache?.get({
|
|
2806
2833
|
sessionId: parts.sessionId,
|
|
2807
2834
|
tokenHash,
|
|
2835
|
+
transport: "cookie",
|
|
2808
2836
|
audience,
|
|
2809
2837
|
nowMs
|
|
2810
2838
|
});
|
|
@@ -2843,41 +2871,109 @@ class AuthRuntime2 {
|
|
|
2843
2871
|
session = renewed;
|
|
2844
2872
|
sessionRenewed = true;
|
|
2845
2873
|
}
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
id: session.userId
|
|
2849
|
-
});
|
|
2850
|
-
if (!user) {
|
|
2851
|
-
return { authenticated: false, reason: "missing_user" };
|
|
2874
|
+
if (!sessionRenewed) {
|
|
2875
|
+
await this.touchSessionLastSeen(storage, session, now);
|
|
2852
2876
|
}
|
|
2853
|
-
|
|
2854
|
-
|
|
2877
|
+
const result = await this.authenticateSession(storage, session, tokenHash, now);
|
|
2878
|
+
return result.authenticated && sessionRenewed ? { ...result, sessionRenewed: true } : result;
|
|
2879
|
+
}
|
|
2880
|
+
async resolveBearerSession(tokenValue) {
|
|
2881
|
+
const parts = parseBearerSessionToken(SESSION_ACCESS_TOKEN_PREFIX, tokenValue);
|
|
2882
|
+
if (!parts) {
|
|
2883
|
+
return { authenticated: false, reason: "invalid_access_token" };
|
|
2855
2884
|
}
|
|
2856
|
-
const
|
|
2885
|
+
const tokenHash = hashSessionSecret2(parts.sessionSecret);
|
|
2886
|
+
const now = new Date;
|
|
2887
|
+
const cached = this.sessionCache?.get({
|
|
2888
|
+
sessionId: parts.sessionId,
|
|
2889
|
+
tokenHash,
|
|
2890
|
+
transport: "bearer",
|
|
2891
|
+
nowMs: now.getTime()
|
|
2892
|
+
});
|
|
2893
|
+
if (cached) {
|
|
2894
|
+
return cached;
|
|
2895
|
+
}
|
|
2896
|
+
const storage = this.requireAuthStorage();
|
|
2897
|
+
const session = await storage.sessions.findValidByAccessTokenHash({
|
|
2857
2898
|
projectId: this.projectId,
|
|
2858
|
-
|
|
2899
|
+
id: parts.sessionId,
|
|
2900
|
+
tokenHash,
|
|
2901
|
+
now
|
|
2859
2902
|
});
|
|
2860
|
-
if (!
|
|
2861
|
-
|
|
2903
|
+
if (!session) {
|
|
2904
|
+
return { authenticated: false, reason: "invalid_access_token" };
|
|
2905
|
+
}
|
|
2906
|
+
await this.touchSessionLastSeen(storage, session, now);
|
|
2907
|
+
return this.authenticateSession(storage, session, tokenHash, now);
|
|
2908
|
+
}
|
|
2909
|
+
async authenticateSession(storage, session, tokenHash, now) {
|
|
2910
|
+
const member = await this.loadActiveUser(storage, session.userId);
|
|
2911
|
+
if (!member.authenticated) {
|
|
2912
|
+
return member;
|
|
2862
2913
|
}
|
|
2863
2914
|
const result = {
|
|
2864
2915
|
authenticated: true,
|
|
2865
2916
|
credentialSource: "session",
|
|
2866
|
-
principal: { type: "user", id: user.id },
|
|
2867
|
-
user,
|
|
2917
|
+
principal: { type: "user", id: member.user.id },
|
|
2918
|
+
user: member.user,
|
|
2868
2919
|
session,
|
|
2869
|
-
groupIds:
|
|
2920
|
+
groupIds: member.groupIds
|
|
2870
2921
|
};
|
|
2871
2922
|
this.sessionCache?.set({
|
|
2872
|
-
sessionId:
|
|
2923
|
+
sessionId: session.id,
|
|
2873
2924
|
tokenHash,
|
|
2874
|
-
audience,
|
|
2925
|
+
audience: session.audience,
|
|
2875
2926
|
session: result,
|
|
2876
|
-
nowMs,
|
|
2927
|
+
nowMs: now.getTime(),
|
|
2877
2928
|
sessionExpiresAtMs: session.expiresAt.getTime(),
|
|
2878
2929
|
sessionAbsoluteExpiresAtMs: session.absoluteExpiresAt?.getTime()
|
|
2879
2930
|
});
|
|
2880
|
-
return
|
|
2931
|
+
return result;
|
|
2932
|
+
}
|
|
2933
|
+
prepareBearerSession(input) {
|
|
2934
|
+
const sessionId = `ses_${randomUUID3()}`;
|
|
2935
|
+
const tokens = createBearerSessionTokens(sessionId);
|
|
2936
|
+
return {
|
|
2937
|
+
tokens,
|
|
2938
|
+
session: {
|
|
2939
|
+
id: sessionId,
|
|
2940
|
+
projectId: this.projectId,
|
|
2941
|
+
userId: input.userId,
|
|
2942
|
+
strategyId: "device",
|
|
2943
|
+
audience: DEFAULT_AUTH_SESSION_AUDIENCE2,
|
|
2944
|
+
tokenHash: tokens.tokenHash,
|
|
2945
|
+
createdAt: input.now,
|
|
2946
|
+
...this.createSessionDeadlines(input.now),
|
|
2947
|
+
bearer: {
|
|
2948
|
+
clientName: input.clientName,
|
|
2949
|
+
accessExpiresAt: new Date(input.now.getTime() + BEARER_ACCESS_TOKEN_TTL_MS),
|
|
2950
|
+
refreshTokenHash: tokens.refreshTokenHash
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
async refreshSession(refreshToken) {
|
|
2956
|
+
const parts = parseBearerSessionToken(SESSION_REFRESH_TOKEN_PREFIX, refreshToken);
|
|
2957
|
+
if (!parts || !this.isEnabled()) {
|
|
2958
|
+
return null;
|
|
2959
|
+
}
|
|
2960
|
+
const now = new Date;
|
|
2961
|
+
const tokens = createBearerSessionTokens(parts.sessionId);
|
|
2962
|
+
const result = await this.requireAuthStorage().sessions.rotateRefreshToken({
|
|
2963
|
+
projectId: this.projectId,
|
|
2964
|
+
id: parts.sessionId,
|
|
2965
|
+
refreshTokenHash: hashSessionSecret2(parts.sessionSecret),
|
|
2966
|
+
now,
|
|
2967
|
+
reuseGraceMs: REFRESH_REUSE_GRACE_MS,
|
|
2968
|
+
next: {
|
|
2969
|
+
tokenHash: tokens.tokenHash,
|
|
2970
|
+
accessExpiresAt: new Date(now.getTime() + BEARER_ACCESS_TOKEN_TTL_MS),
|
|
2971
|
+
refreshTokenHash: tokens.refreshTokenHash,
|
|
2972
|
+
expiresAt: new Date(now.getTime() + this.config.session.idleTimeoutMs)
|
|
2973
|
+
}
|
|
2974
|
+
});
|
|
2975
|
+
this.sessionCache?.invalidate(parts.sessionId);
|
|
2976
|
+
return result.status === "rotated" ? { tokens, session: result.session } : null;
|
|
2881
2977
|
}
|
|
2882
2978
|
canRenewSession(session, nowMs) {
|
|
2883
2979
|
if (session.expiresAt.getTime() - nowMs > this.config.session.renewalWindowMs) {
|
|
@@ -2907,33 +3003,23 @@ class AuthRuntime2 {
|
|
|
2907
3003
|
return { authenticated: false, reason: "invalid_access_token" };
|
|
2908
3004
|
}
|
|
2909
3005
|
await this.touchAccessTokenLastUsed(storage, accessToken, request, now);
|
|
2910
|
-
if (accessToken.
|
|
2911
|
-
const
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
});
|
|
2915
|
-
if (!user) {
|
|
2916
|
-
return { authenticated: false, reason: "missing_user" };
|
|
3006
|
+
if (accessToken.subject.type === "user") {
|
|
3007
|
+
const member = await this.loadActiveUser(storage, accessToken.subject.id);
|
|
3008
|
+
if (!member.authenticated) {
|
|
3009
|
+
return member;
|
|
2917
3010
|
}
|
|
2918
|
-
if (user.status === "suspended") {
|
|
2919
|
-
return { authenticated: false, reason: "suspended_user" };
|
|
2920
|
-
}
|
|
2921
|
-
const memberships = await storage.groupMemberships.listForUser({
|
|
2922
|
-
projectId: this.projectId,
|
|
2923
|
-
userId: user.id
|
|
2924
|
-
});
|
|
2925
3011
|
return {
|
|
2926
3012
|
authenticated: true,
|
|
2927
3013
|
credentialSource: "accessToken",
|
|
2928
|
-
principal: { type: "user", id: user.id },
|
|
2929
|
-
user,
|
|
3014
|
+
principal: { type: "user", id: member.user.id },
|
|
3015
|
+
user: member.user,
|
|
2930
3016
|
accessToken,
|
|
2931
|
-
groupIds: constrainTokenGroupIds(
|
|
3017
|
+
groupIds: constrainTokenGroupIds(member.groupIds, accessToken)
|
|
2932
3018
|
};
|
|
2933
3019
|
}
|
|
2934
3020
|
const serviceAccount = await storage.serviceAccounts.getById({
|
|
2935
3021
|
projectId: this.projectId,
|
|
2936
|
-
id: accessToken.
|
|
3022
|
+
id: accessToken.subject.id
|
|
2937
3023
|
});
|
|
2938
3024
|
if (!serviceAccount) {
|
|
2939
3025
|
return { authenticated: false, reason: "missing_service_account" };
|
|
@@ -2954,8 +3040,23 @@ class AuthRuntime2 {
|
|
|
2954
3040
|
groupIds: constrainTokenGroupIds(memberships.map((membership) => membership.groupId), accessToken)
|
|
2955
3041
|
};
|
|
2956
3042
|
}
|
|
2957
|
-
|
|
2958
|
-
this.
|
|
3043
|
+
async loadActiveUser(storage, userId) {
|
|
3044
|
+
const user = await storage.users.getById({ projectId: this.projectId, id: userId });
|
|
3045
|
+
if (!user) {
|
|
3046
|
+
return { authenticated: false, reason: "missing_user" };
|
|
3047
|
+
}
|
|
3048
|
+
if (user.status === "suspended") {
|
|
3049
|
+
return { authenticated: false, reason: "suspended_user" };
|
|
3050
|
+
}
|
|
3051
|
+
const memberships = await storage.groupMemberships.listForUser({
|
|
3052
|
+
projectId: this.projectId,
|
|
3053
|
+
userId
|
|
3054
|
+
});
|
|
3055
|
+
return {
|
|
3056
|
+
authenticated: true,
|
|
3057
|
+
user,
|
|
3058
|
+
groupIds: memberships.map((membership) => membership.groupId)
|
|
3059
|
+
};
|
|
2959
3060
|
}
|
|
2960
3061
|
async touchSessionLastSeen(storage, session, now) {
|
|
2961
3062
|
const lastSeen = session.lastSeenAt?.getTime() ?? 0;
|
|
@@ -2977,76 +3078,33 @@ class AuthRuntime2 {
|
|
|
2977
3078
|
id: accessToken.id,
|
|
2978
3079
|
lastUsedAt: now,
|
|
2979
3080
|
userAgent: request.headers.get("user-agent")?.trim() || undefined,
|
|
2980
|
-
ipAddress:
|
|
3081
|
+
ipAddress: getRequestClientAddress2(request)
|
|
2981
3082
|
});
|
|
2982
3083
|
} catch {}
|
|
2983
3084
|
}
|
|
2984
|
-
async requirePrincipal(request, options = {}) {
|
|
2985
|
-
const session = await this.getSession(request, options);
|
|
2986
|
-
if (!session.authenticated) {
|
|
2987
|
-
throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
|
|
2988
|
-
}
|
|
2989
|
-
return session.principal;
|
|
2990
|
-
}
|
|
2991
|
-
async requireUser(request, options = {}) {
|
|
2992
|
-
const session = await this.getSession(request, { ...options, credentialSource: "session" });
|
|
2993
|
-
if (!session.authenticated) {
|
|
2994
|
-
throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
|
|
2995
|
-
}
|
|
2996
|
-
return session;
|
|
2997
|
-
}
|
|
2998
|
-
async requireUserRequest(request, options = {}) {
|
|
2999
|
-
const session = await this.getSession(request, { ...options, credentialSource: "any" });
|
|
3000
|
-
if (!session.authenticated) {
|
|
3001
|
-
throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
|
|
3002
|
-
}
|
|
3003
|
-
if (!isAuthenticatedUserRequestSession(session)) {
|
|
3004
|
-
throw new AuthRuntimeError2("authorization_denied", "[Sixb] User authentication is required.");
|
|
3005
|
-
}
|
|
3006
|
-
return session;
|
|
3007
|
-
}
|
|
3008
|
-
async createSecurityContext(request, options = {}) {
|
|
3009
|
-
const session = await this.requireUser(request, options);
|
|
3010
|
-
return {
|
|
3011
|
-
principal: session.principal,
|
|
3012
|
-
sessionId: session.session.id,
|
|
3013
|
-
projectId: this.projectId,
|
|
3014
|
-
correlationId: resolveCorrelationId(request)
|
|
3015
|
-
};
|
|
3016
|
-
}
|
|
3017
|
-
async createAuthorizationContext(request, options = {}) {
|
|
3018
|
-
const session = await this.getSession(request, options);
|
|
3019
|
-
if (!session.authenticated) {
|
|
3020
|
-
throw new AuthRuntimeError2("authentication_required", "[Sixb] Authentication is required.");
|
|
3021
|
-
}
|
|
3022
|
-
return this.contextFromSession(session);
|
|
3023
|
-
}
|
|
3024
3085
|
contextFromSession(session) {
|
|
3025
3086
|
return resolveAuthorizationContext2({
|
|
3026
3087
|
principal: session.principal,
|
|
3027
|
-
sessionId: session
|
|
3088
|
+
sessionId: callerSessionId(session),
|
|
3028
3089
|
groupIds: session.groupIds,
|
|
3029
3090
|
roles: this.security.listResolvedRoles()
|
|
3030
3091
|
});
|
|
3031
3092
|
}
|
|
3032
|
-
async listPersonalAccessTokens(
|
|
3033
|
-
const session = await this.requireUserRequest(request, options);
|
|
3093
|
+
async listPersonalAccessTokens(caller) {
|
|
3034
3094
|
const storage = this.requireAuthStorage();
|
|
3035
3095
|
const result = await storage.accessTokens.list({
|
|
3036
3096
|
projectId: this.projectId,
|
|
3037
3097
|
kind: "personal",
|
|
3038
|
-
|
|
3039
|
-
subjectId: session.user.id,
|
|
3098
|
+
subject: { type: "user", id: caller.user.id },
|
|
3040
3099
|
includeRevoked: true,
|
|
3041
3100
|
order: "desc",
|
|
3042
3101
|
limit: 100
|
|
3043
3102
|
});
|
|
3044
3103
|
return { accessTokens: result.accessTokens };
|
|
3045
3104
|
}
|
|
3046
|
-
async createPersonalAccessToken(
|
|
3047
|
-
const session = await this.requireUserRequest(request, options);
|
|
3105
|
+
async createPersonalAccessToken(caller, input) {
|
|
3048
3106
|
const storage = this.requireAuthStorage();
|
|
3049
|
-
const groupIds = constrainRequestedGroupIds(input.groupIds,
|
|
3107
|
+
const groupIds = constrainRequestedGroupIds(input.groupIds, caller.groupIds, {
|
|
3050
3108
|
subject: "personal access token"
|
|
3051
3109
|
});
|
|
3052
3110
|
const credential = createAccessTokenCredential2("personal");
|
|
@@ -3055,25 +3113,23 @@ class AuthRuntime2 {
|
|
|
3055
3113
|
projectId: this.projectId,
|
|
3056
3114
|
name: input.name,
|
|
3057
3115
|
kind: "personal",
|
|
3058
|
-
|
|
3059
|
-
subjectId: session.user.id,
|
|
3116
|
+
subject: { type: "user", id: caller.user.id },
|
|
3060
3117
|
tokenHash: credential.tokenHash,
|
|
3061
3118
|
groupIds,
|
|
3062
|
-
createdByPrincipal:
|
|
3063
|
-
createdBySessionId:
|
|
3119
|
+
createdByPrincipal: caller.principal,
|
|
3120
|
+
createdBySessionId: callerSessionId(caller),
|
|
3064
3121
|
createdAt: new Date,
|
|
3065
3122
|
expiresAt: input.expiresAt
|
|
3066
3123
|
});
|
|
3067
3124
|
return { accessToken, tokenValue: credential.tokenValue };
|
|
3068
3125
|
}
|
|
3069
|
-
async revokePersonalAccessToken(
|
|
3070
|
-
const session = await this.requireUserRequest(request, options);
|
|
3126
|
+
async revokePersonalAccessToken(caller, input) {
|
|
3071
3127
|
const storage = this.requireAuthStorage();
|
|
3072
3128
|
const token = await storage.accessTokens.getById({
|
|
3073
3129
|
projectId: this.projectId,
|
|
3074
3130
|
id: input.tokenId
|
|
3075
3131
|
});
|
|
3076
|
-
if (!token || token.kind !== "personal" || token.
|
|
3132
|
+
if (!token || token.kind !== "personal" || token.subject.type !== "user" || token.subject.id !== caller.user.id) {
|
|
3077
3133
|
throw missingAccessTokenError(input.tokenId, this.projectId);
|
|
3078
3134
|
}
|
|
3079
3135
|
const accessToken = await storage.accessTokens.revoke({
|
|
@@ -3083,8 +3139,7 @@ class AuthRuntime2 {
|
|
|
3083
3139
|
});
|
|
3084
3140
|
return { accessToken };
|
|
3085
3141
|
}
|
|
3086
|
-
async listServiceAccounts(
|
|
3087
|
-
const session = await this.requireUserRequest(request, options);
|
|
3142
|
+
async listServiceAccounts(caller) {
|
|
3088
3143
|
const storage = this.requireAuthStorage();
|
|
3089
3144
|
const result = await storage.serviceAccounts.list({
|
|
3090
3145
|
projectId: this.projectId,
|
|
@@ -3096,13 +3151,12 @@ class AuthRuntime2 {
|
|
|
3096
3151
|
groupIds: await this.listServiceAccountGroupIds(storage, serviceAccount.id)
|
|
3097
3152
|
})));
|
|
3098
3153
|
return {
|
|
3099
|
-
serviceAccounts: withGroups.filter(({ groupIds }) => callerCanManageServiceAccount(
|
|
3154
|
+
serviceAccounts: withGroups.filter(({ groupIds }) => callerCanManageServiceAccount(caller.groupIds, groupIds))
|
|
3100
3155
|
};
|
|
3101
3156
|
}
|
|
3102
|
-
async createServiceAccount(
|
|
3103
|
-
const session = await this.requireUserRequest(request, options);
|
|
3157
|
+
async createServiceAccount(caller, input) {
|
|
3104
3158
|
const storage = this.requireAuthStorage();
|
|
3105
|
-
const groupIds = constrainRequestedGroupIds(input.groupIds,
|
|
3159
|
+
const groupIds = constrainRequestedGroupIds(input.groupIds, caller.groupIds, {
|
|
3106
3160
|
subject: "service account"
|
|
3107
3161
|
}) ?? [];
|
|
3108
3162
|
const now = new Date;
|
|
@@ -3111,8 +3165,8 @@ class AuthRuntime2 {
|
|
|
3111
3165
|
projectId: this.projectId,
|
|
3112
3166
|
name: input.name,
|
|
3113
3167
|
description: input.description,
|
|
3114
|
-
createdByPrincipal:
|
|
3115
|
-
createdBySessionId:
|
|
3168
|
+
createdByPrincipal: caller.principal,
|
|
3169
|
+
createdBySessionId: callerSessionId(caller),
|
|
3116
3170
|
createdAt: now,
|
|
3117
3171
|
updatedAt: now
|
|
3118
3172
|
});
|
|
@@ -3128,10 +3182,9 @@ class AuthRuntime2 {
|
|
|
3128
3182
|
}
|
|
3129
3183
|
return { serviceAccount, groupMemberships };
|
|
3130
3184
|
}
|
|
3131
|
-
async disableServiceAccount(
|
|
3132
|
-
const session = await this.requireUserRequest(request, options);
|
|
3185
|
+
async disableServiceAccount(caller, input) {
|
|
3133
3186
|
const storage = this.requireAuthStorage();
|
|
3134
|
-
const { serviceAccount, groupIds } = await this.requireManageableServiceAccount(storage,
|
|
3187
|
+
const { serviceAccount, groupIds } = await this.requireManageableServiceAccount(storage, caller.groupIds, input.serviceAccountId);
|
|
3135
3188
|
const updated = await storage.serviceAccounts.update({
|
|
3136
3189
|
projectId: this.projectId,
|
|
3137
3190
|
id: serviceAccount.id,
|
|
@@ -3140,25 +3193,22 @@ class AuthRuntime2 {
|
|
|
3140
3193
|
});
|
|
3141
3194
|
return { serviceAccount: updated, groupIds };
|
|
3142
3195
|
}
|
|
3143
|
-
async listServiceAccountAccessTokens(
|
|
3144
|
-
const session = await this.requireUserRequest(request, options);
|
|
3196
|
+
async listServiceAccountAccessTokens(caller, input) {
|
|
3145
3197
|
const storage = this.requireAuthStorage();
|
|
3146
|
-
const { serviceAccount } = await this.requireManageableServiceAccount(storage,
|
|
3198
|
+
const { serviceAccount } = await this.requireManageableServiceAccount(storage, caller.groupIds, input.serviceAccountId);
|
|
3147
3199
|
const result = await storage.accessTokens.list({
|
|
3148
3200
|
projectId: this.projectId,
|
|
3149
3201
|
kind: "serviceAccount",
|
|
3150
|
-
|
|
3151
|
-
subjectId: serviceAccount.id,
|
|
3202
|
+
subject: { type: "serviceAccount", id: serviceAccount.id },
|
|
3152
3203
|
includeRevoked: true,
|
|
3153
3204
|
order: "desc",
|
|
3154
3205
|
limit: 100
|
|
3155
3206
|
});
|
|
3156
3207
|
return { serviceAccount, accessTokens: result.accessTokens };
|
|
3157
3208
|
}
|
|
3158
|
-
async createServiceAccountAccessToken(
|
|
3159
|
-
const session = await this.requireUserRequest(request, options);
|
|
3209
|
+
async createServiceAccountAccessToken(caller, input) {
|
|
3160
3210
|
const storage = this.requireAuthStorage();
|
|
3161
|
-
const { serviceAccount, groupIds: serviceAccountGroupIds } = await this.requireManageableServiceAccount(storage,
|
|
3211
|
+
const { serviceAccount, groupIds: serviceAccountGroupIds } = await this.requireManageableServiceAccount(storage, caller.groupIds, input.serviceAccountId);
|
|
3162
3212
|
if (serviceAccount.status === "suspended") {
|
|
3163
3213
|
throw new AuthStorageError2("suspended_service_account", `[Sixb] Service account '${input.serviceAccountId}' is suspended for project '${this.projectId}'.`);
|
|
3164
3214
|
}
|
|
@@ -3171,26 +3221,24 @@ class AuthRuntime2 {
|
|
|
3171
3221
|
projectId: this.projectId,
|
|
3172
3222
|
name: input.name,
|
|
3173
3223
|
kind: "serviceAccount",
|
|
3174
|
-
|
|
3175
|
-
subjectId: serviceAccount.id,
|
|
3224
|
+
subject: { type: "serviceAccount", id: serviceAccount.id },
|
|
3176
3225
|
tokenHash: credential.tokenHash,
|
|
3177
3226
|
groupIds,
|
|
3178
|
-
createdByPrincipal:
|
|
3179
|
-
createdBySessionId:
|
|
3227
|
+
createdByPrincipal: caller.principal,
|
|
3228
|
+
createdBySessionId: callerSessionId(caller),
|
|
3180
3229
|
createdAt: new Date,
|
|
3181
3230
|
expiresAt: input.expiresAt
|
|
3182
3231
|
});
|
|
3183
3232
|
return { accessToken, tokenValue: credential.tokenValue, serviceAccount };
|
|
3184
3233
|
}
|
|
3185
|
-
async revokeServiceAccountAccessToken(
|
|
3186
|
-
const session = await this.requireUserRequest(request, options);
|
|
3234
|
+
async revokeServiceAccountAccessToken(caller, input) {
|
|
3187
3235
|
const storage = this.requireAuthStorage();
|
|
3188
|
-
const { serviceAccount } = await this.requireManageableServiceAccount(storage,
|
|
3236
|
+
const { serviceAccount } = await this.requireManageableServiceAccount(storage, caller.groupIds, input.serviceAccountId);
|
|
3189
3237
|
const token = await storage.accessTokens.getById({
|
|
3190
3238
|
projectId: this.projectId,
|
|
3191
3239
|
id: input.tokenId
|
|
3192
3240
|
});
|
|
3193
|
-
if (!token || token.kind !== "serviceAccount" || token.
|
|
3241
|
+
if (!token || token.kind !== "serviceAccount" || token.subject.type !== "serviceAccount" || token.subject.id !== serviceAccount.id) {
|
|
3194
3242
|
throw missingAccessTokenError(input.tokenId, this.projectId);
|
|
3195
3243
|
}
|
|
3196
3244
|
const accessToken = await storage.accessTokens.revoke({
|
|
@@ -3218,9 +3266,8 @@ class AuthRuntime2 {
|
|
|
3218
3266
|
});
|
|
3219
3267
|
return memberships.map((membership) => membership.groupId);
|
|
3220
3268
|
}
|
|
3221
|
-
async getInvitationOptions(
|
|
3222
|
-
const
|
|
3223
|
-
const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
|
|
3269
|
+
async getInvitationOptions(caller) {
|
|
3270
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3224
3271
|
const inviteScope = scope.operations.invite;
|
|
3225
3272
|
const groups = this.scopedGroupOptions(inviteScope.groupIds);
|
|
3226
3273
|
const hasInviteMembershipPolicy = inviteScope.policyIds.length > 0;
|
|
@@ -3237,18 +3284,16 @@ class AuthRuntime2 {
|
|
|
3237
3284
|
getMembershipCapabilities(input) {
|
|
3238
3285
|
return membershipCapabilities(this.resolveMembershipPolicyScopeForUser(groupIdsOf(input.callerGroups)));
|
|
3239
3286
|
}
|
|
3240
|
-
async getMembershipOptions(
|
|
3241
|
-
const
|
|
3242
|
-
const scope = this.resolveMembershipPolicyScopeForUser(session.groupIds);
|
|
3287
|
+
async getMembershipOptions(caller) {
|
|
3288
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3243
3289
|
return {
|
|
3244
3290
|
groups: this.scopedGroupOptions(scope.operations.assignGroups.groupIds),
|
|
3245
3291
|
capabilities: membershipCapabilities(scope).holds
|
|
3246
3292
|
};
|
|
3247
3293
|
}
|
|
3248
|
-
async listMembers(
|
|
3249
|
-
const session = await this.requireUser(request, options);
|
|
3294
|
+
async listMembers(caller, input = {}) {
|
|
3250
3295
|
const storage = this.requireAuthStorage();
|
|
3251
|
-
const scope = this.resolveMembershipPolicyScopeForUser(
|
|
3296
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3252
3297
|
const { limit, offset } = normalizePagination(input);
|
|
3253
3298
|
const result = await storage.users.list({ projectId: this.projectId, order: input.order });
|
|
3254
3299
|
const members = [];
|
|
@@ -3259,7 +3304,7 @@ class AuthRuntime2 {
|
|
|
3259
3304
|
if (!canAssignGroups && !canSuspendScope) {
|
|
3260
3305
|
continue;
|
|
3261
3306
|
}
|
|
3262
|
-
const isSelf = user.id ===
|
|
3307
|
+
const isSelf = user.id === caller.user.id;
|
|
3263
3308
|
members.push({
|
|
3264
3309
|
user,
|
|
3265
3310
|
groupIds,
|
|
@@ -3273,10 +3318,9 @@ class AuthRuntime2 {
|
|
|
3273
3318
|
const page = paginate(members, { limit, offset });
|
|
3274
3319
|
return { members: page.page, hasMore: page.hasMore, total: page.total };
|
|
3275
3320
|
}
|
|
3276
|
-
async updateMemberGroups(
|
|
3277
|
-
const session = await this.requireUser(request, options);
|
|
3321
|
+
async updateMemberGroups(caller, input) {
|
|
3278
3322
|
const storage = this.requireAuthStorage();
|
|
3279
|
-
const scope = this.resolveMembershipPolicyScopeForUser(
|
|
3323
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3280
3324
|
const userId = assertNonEmpty3(input.userId, "User id");
|
|
3281
3325
|
const { user, groupIds: currentGroupIds } = await this.requireManageableMember(storage, scope, "assignGroups", userId);
|
|
3282
3326
|
const requestedGroupIds = this.resolveMemberGroupIds(input.groupIds);
|
|
@@ -3288,7 +3332,7 @@ class AuthRuntime2 {
|
|
|
3288
3332
|
const requested = new Set(requestedGroupIds);
|
|
3289
3333
|
const additions = requestedGroupIds.filter((groupId) => !current.has(groupId));
|
|
3290
3334
|
const removals = currentGroupIds.filter((groupId) => !requested.has(groupId));
|
|
3291
|
-
if (user.id ===
|
|
3335
|
+
if (user.id === caller.user.id && removals.length > 0) {
|
|
3292
3336
|
throw new AuthRuntimeError2("authorization_denied", "[Sixb] The current user cannot remove their own groups.");
|
|
3293
3337
|
}
|
|
3294
3338
|
const now = new Date;
|
|
@@ -3308,17 +3352,16 @@ class AuthRuntime2 {
|
|
|
3308
3352
|
groupId
|
|
3309
3353
|
});
|
|
3310
3354
|
}
|
|
3311
|
-
this.
|
|
3355
|
+
this.sessionCache?.invalidateUser(user.id);
|
|
3312
3356
|
const groupIds = (await storage.groupMemberships.listForUser({ projectId: this.projectId, userId: user.id })).map((membership) => membership.groupId);
|
|
3313
3357
|
return { user, groupIds };
|
|
3314
3358
|
}
|
|
3315
|
-
async suspendMember(
|
|
3316
|
-
const session = await this.requireUser(request, options);
|
|
3359
|
+
async suspendMember(caller, input) {
|
|
3317
3360
|
const storage = this.requireAuthStorage();
|
|
3318
|
-
const scope = this.resolveMembershipPolicyScopeForUser(
|
|
3361
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3319
3362
|
const userId = assertNonEmpty3(input.userId, "User id");
|
|
3320
3363
|
const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
|
|
3321
|
-
if (user.id ===
|
|
3364
|
+
if (user.id === caller.user.id) {
|
|
3322
3365
|
throw new AuthRuntimeError2("authorization_denied", "[Sixb] The current user cannot suspend themselves.");
|
|
3323
3366
|
}
|
|
3324
3367
|
const suspended = await storage.suspendUserAndRevokeSessions({
|
|
@@ -3326,13 +3369,12 @@ class AuthRuntime2 {
|
|
|
3326
3369
|
userId: user.id,
|
|
3327
3370
|
suspendedAt: new Date
|
|
3328
3371
|
});
|
|
3329
|
-
this.
|
|
3372
|
+
this.sessionCache?.invalidateUser(user.id);
|
|
3330
3373
|
return { user: suspended, groupIds };
|
|
3331
3374
|
}
|
|
3332
|
-
async reactivateMember(
|
|
3333
|
-
const session = await this.requireUser(request, options);
|
|
3375
|
+
async reactivateMember(caller, input) {
|
|
3334
3376
|
const storage = this.requireAuthStorage();
|
|
3335
|
-
const scope = this.resolveMembershipPolicyScopeForUser(
|
|
3377
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3336
3378
|
const userId = assertNonEmpty3(input.userId, "User id");
|
|
3337
3379
|
const { user, groupIds } = await this.requireManageableMember(storage, scope, "suspend", userId);
|
|
3338
3380
|
const reactivated = await storage.users.updateStatus({
|
|
@@ -3343,8 +3385,37 @@ class AuthRuntime2 {
|
|
|
3343
3385
|
});
|
|
3344
3386
|
return { user: reactivated, groupIds };
|
|
3345
3387
|
}
|
|
3346
|
-
|
|
3347
|
-
this.
|
|
3388
|
+
async listSessions(caller) {
|
|
3389
|
+
return this.requireAuthStorage().sessions.listActiveByUserId({
|
|
3390
|
+
projectId: this.projectId,
|
|
3391
|
+
userId: caller.user.id,
|
|
3392
|
+
now: new Date
|
|
3393
|
+
});
|
|
3394
|
+
}
|
|
3395
|
+
async revokeSession(caller, sessionId) {
|
|
3396
|
+
const storage = this.requireAuthStorage();
|
|
3397
|
+
const session = await storage.sessions.getById({ projectId: this.projectId, id: sessionId });
|
|
3398
|
+
if (!session || session.userId !== caller.user.id) {
|
|
3399
|
+
return false;
|
|
3400
|
+
}
|
|
3401
|
+
await storage.sessions.revoke({
|
|
3402
|
+
projectId: this.projectId,
|
|
3403
|
+
id: sessionId,
|
|
3404
|
+
revokedAt: new Date
|
|
3405
|
+
});
|
|
3406
|
+
this.sessionCache?.invalidate(sessionId);
|
|
3407
|
+
return true;
|
|
3408
|
+
}
|
|
3409
|
+
async revokeAllSessions(caller) {
|
|
3410
|
+
const revoked = await this.requireAuthStorage().sessions.revokeActiveForUser({
|
|
3411
|
+
projectId: this.projectId,
|
|
3412
|
+
userId: caller.user.id,
|
|
3413
|
+
revokedAt: new Date
|
|
3414
|
+
});
|
|
3415
|
+
for (const session of revoked) {
|
|
3416
|
+
this.sessionCache?.invalidate(session.id);
|
|
3417
|
+
}
|
|
3418
|
+
return revoked.length;
|
|
3348
3419
|
}
|
|
3349
3420
|
scopedGroupOptions(groupIds) {
|
|
3350
3421
|
return this.security.listGroups().filter((group) => groupIds.has(group.id)).map((group) => ({
|
|
@@ -3370,26 +3441,24 @@ class AuthRuntime2 {
|
|
|
3370
3441
|
}
|
|
3371
3442
|
return groupIds;
|
|
3372
3443
|
}
|
|
3373
|
-
async invite(
|
|
3374
|
-
const session = await this.requireUser(request, options);
|
|
3444
|
+
async invite(caller, input, destination) {
|
|
3375
3445
|
const authStorage = this.requireAuthStorage();
|
|
3376
3446
|
const now = new Date;
|
|
3377
3447
|
const groupIds = this.resolveInviteGroupIds(input);
|
|
3378
|
-
this.assertCanManageInvitationGroups(
|
|
3448
|
+
this.assertCanManageInvitationGroups(caller.groupIds, groupIds);
|
|
3379
3449
|
const strategy = this.getStrategy();
|
|
3380
3450
|
if (!isInvitationDeliveryAuthStrategy2(strategy)) {
|
|
3381
3451
|
throw new AuthRuntimeError2("invalid_auth_config", "[Sixb] The active auth strategy does not support invitations.");
|
|
3382
3452
|
}
|
|
3383
3453
|
await this.assertCanInviteRecipient(strategy, authStorage, input.email, now);
|
|
3384
|
-
|
|
3385
|
-
this.assertInvitationApplicationAccess(groupIds, deliveryAudience);
|
|
3454
|
+
this.assertInvitationApplicationAccess(groupIds, destination.audience);
|
|
3386
3455
|
const invitation = await authStorage.invitations.createOrUpdateActive({
|
|
3387
3456
|
id: `inv_${randomUUID3()}`,
|
|
3388
3457
|
projectId: this.projectId,
|
|
3389
3458
|
email: input.email,
|
|
3390
3459
|
groupIds,
|
|
3391
|
-
createdByPrincipal:
|
|
3392
|
-
createdBySessionId:
|
|
3460
|
+
createdByPrincipal: caller.principal,
|
|
3461
|
+
createdBySessionId: callerSessionId(caller),
|
|
3393
3462
|
createdAt: now,
|
|
3394
3463
|
updatedAt: now,
|
|
3395
3464
|
expiresAt: resolveInvitationExpiresAt(input.expiresAt, now)
|
|
@@ -3400,9 +3469,9 @@ class AuthRuntime2 {
|
|
|
3400
3469
|
projectId: this.projectId,
|
|
3401
3470
|
authStorage,
|
|
3402
3471
|
invitation,
|
|
3403
|
-
audience:
|
|
3404
|
-
returnTo:
|
|
3405
|
-
requestOrigin:
|
|
3472
|
+
audience: destination.audience,
|
|
3473
|
+
returnTo: destination.returnTo,
|
|
3474
|
+
requestOrigin: destination.requestOrigin,
|
|
3406
3475
|
revealLink: input.revealLink,
|
|
3407
3476
|
now
|
|
3408
3477
|
});
|
|
@@ -3423,8 +3492,7 @@ class AuthRuntime2 {
|
|
|
3423
3492
|
}
|
|
3424
3493
|
return { invitation, delivery };
|
|
3425
3494
|
}
|
|
3426
|
-
async listInvitations(
|
|
3427
|
-
const session = await this.requireUser(request, options);
|
|
3495
|
+
async listInvitations(caller, input = {}) {
|
|
3428
3496
|
const authStorage = this.requireAuthStorage();
|
|
3429
3497
|
const { limit, offset } = normalizePagination(input);
|
|
3430
3498
|
const result = await authStorage.invitations.list({
|
|
@@ -3433,7 +3501,7 @@ class AuthRuntime2 {
|
|
|
3433
3501
|
statuses: input.statuses,
|
|
3434
3502
|
order: input.order
|
|
3435
3503
|
});
|
|
3436
|
-
const scope = this.resolveMembershipPolicyScopeForUser(
|
|
3504
|
+
const scope = this.resolveMembershipPolicyScopeForUser(caller.groupIds);
|
|
3437
3505
|
const manageable = result.invitations.filter((invitation) => canPerformMembershipOperation(scope, "invite", invitation.groupIds));
|
|
3438
3506
|
const page = paginate(manageable, { limit, offset });
|
|
3439
3507
|
return {
|
|
@@ -3442,8 +3510,7 @@ class AuthRuntime2 {
|
|
|
3442
3510
|
total: page.total
|
|
3443
3511
|
};
|
|
3444
3512
|
}
|
|
3445
|
-
async revokeInvitation(
|
|
3446
|
-
const session = await this.requireUser(request, options);
|
|
3513
|
+
async revokeInvitation(caller, input) {
|
|
3447
3514
|
const authStorage = this.requireAuthStorage();
|
|
3448
3515
|
const invitationId = assertNonEmpty3(input.invitationId, "Invitation id");
|
|
3449
3516
|
const invitation = await authStorage.invitations.getById({
|
|
@@ -3453,7 +3520,7 @@ class AuthRuntime2 {
|
|
|
3453
3520
|
if (!invitation) {
|
|
3454
3521
|
throw new AuthStorageError2("missing_invitation", `[Sixb] Invitation '${invitationId}' not found for project '${this.projectId}'.`);
|
|
3455
3522
|
}
|
|
3456
|
-
this.assertCanManageInvitationGroups(
|
|
3523
|
+
this.assertCanManageInvitationGroups(caller.groupIds, invitation.groupIds);
|
|
3457
3524
|
if (invitation.status !== "pending") {
|
|
3458
3525
|
throw new AuthRuntimeError2("invalid_auth_input", `[Sixb] Invitation '${invitationId}' is already ${invitation.status} and cannot be revoked.`);
|
|
3459
3526
|
}
|
|
@@ -3550,14 +3617,8 @@ class AuthRuntime2 {
|
|
|
3550
3617
|
throw new AuthRuntimeError2("authorization_denied", `[Sixb] The current user is not allowed to create or manage invitations for group(s): ${missing.join(", ")}.`);
|
|
3551
3618
|
}
|
|
3552
3619
|
}
|
|
3553
|
-
function
|
|
3554
|
-
return
|
|
3555
|
-
}
|
|
3556
|
-
function isAuthenticatedUserRequestSession(session) {
|
|
3557
|
-
return session.principal.type === "user";
|
|
3558
|
-
}
|
|
3559
|
-
function resolveRequestIpAddress(request) {
|
|
3560
|
-
return request.headers.get("x-forwarded-for")?.split(",")[0]?.trim() || request.headers.get("x-real-ip")?.trim() || undefined;
|
|
3620
|
+
function callerSessionId(caller) {
|
|
3621
|
+
return caller.credentialSource === "session" ? caller.session.id : undefined;
|
|
3561
3622
|
}
|
|
3562
3623
|
function constrainTokenGroupIds(principalGroupIds, accessToken) {
|
|
3563
3624
|
if (accessToken.groupIds === undefined) {
|
|
@@ -3633,6 +3694,6 @@ var SYSTEM_PRINCIPAL2 = { type: "system", id: "system" };
|
|
|
3633
3694
|
function principalsEqual2(left, right) {
|
|
3634
3695
|
return left.type === right.type && left.id === right.id;
|
|
3635
3696
|
}
|
|
3636
|
-
export { ActionDefinitionError2, ActionEditCommitError2, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2, isActionDefinition2, isGlobalActionDefinition2, isObjectActionDefinition2, normalizeActionParams, coerceActionParamsToTyped2, validateActionSubject, resolveObjectActionSubject, PERSONAL_ACCESS_TOKEN_PREFIX2, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2, generateAccessTokenSecret2, hashAccessTokenSecret2, formatAccessTokenValue2, parseAccessTokenValue2, getBearerAccessTokenValue2, createAccessTokenCredential2, CSRF_HEADER_NAME2, generateCsrfToken2, isCsrfExemptMethod2, verifyDoubleSubmitCsrf2, applications2, SecurityValidationError2, isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition, defineGroup2, defineRole2, defineMembershipPolicy2, every2, ShareDefinitionError2, defineShare2, isShareDefinition, snapshotShareDefinition, can2, SecurityRegistry, AuthStorageError2, MAX_PENDING_DEVICE_AUTHORIZATIONS2, paginate, InMemoryAuthStorage2, generateSessionSecret2, hashSessionSecret2, formatSessionCookieValue2, parseSessionCookieValue2, createSessionCredential2, AuthRuntime2, SYSTEM_PRINCIPAL2, principalsEqual2 };
|
|
3697
|
+
export { ActionDefinitionError2, ActionEditCommitError2, missingActionMutationMessage, effectsWithoutEditsMessage, assertNonEmpty2, isActionDefinition2, isGlobalActionDefinition2, isObjectActionDefinition2, normalizeActionParams, coerceActionParamsToTyped2, validateActionSubject, resolveObjectActionSubject, PERSONAL_ACCESS_TOKEN_PREFIX2, SERVICE_ACCOUNT_ACCESS_TOKEN_PREFIX2, generateAccessTokenSecret2, hashAccessTokenSecret2, formatAccessTokenValue2, parseAccessTokenValue2, getBearerAccessTokenValue2, createAccessTokenCredential2, setRequestClientAddress2, getRequestClientAddress2, CSRF_HEADER_NAME2, generateCsrfToken2, isCsrfExemptMethod2, verifyDoubleSubmitCsrf2, verifyCsrfToken2, applications2, SecurityValidationError2, isGroupDefinition, isMembershipPolicyDefinition, isRoleDefinition, defineGroup2, defineRole2, defineMembershipPolicy2, every2, ShareDefinitionError2, defineShare2, isShareDefinition, snapshotShareDefinition, can2, SecurityRegistry, AuthStorageError2, MAX_PENDING_DEVICE_AUTHORIZATIONS2, paginate, InMemoryAuthStorage2, generateSessionSecret2, hashSessionSecret2, formatSessionCookieValue2, parseSessionCookieValue2, createSessionCredential2, AuthRuntime2, SYSTEM_PRINCIPAL2, principalsEqual2 };
|
|
3637
3698
|
|
|
3638
|
-
//# debugId=
|
|
3699
|
+
//# debugId=934CBDB22AF498A264756E2164756E21
|