@xenosystem/agent-cli 0.5.134 → 0.5.136
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/cli.js +1 -1
- package/dist/index.js +1832 -1803
- package/dist/metafile-esm.json +1 -1
- package/dist/sdk-build-identity.json +28 -28
- package/node_modules/@xeno-corporation/account/README.md +24 -0
- package/node_modules/@xeno-corporation/account/dist/client-CVtf6u7F.d.mts +2346 -0
- package/node_modules/@xeno-corporation/account/dist/client-CVtf6u7F.d.ts +2346 -0
- package/node_modules/@xeno-corporation/account/dist/index.d.mts +36 -809
- package/node_modules/@xeno-corporation/account/dist/index.d.ts +36 -809
- package/node_modules/@xeno-corporation/account/dist/index.js +1808 -33
- package/node_modules/@xeno-corporation/account/dist/index.js.map +1 -1
- package/node_modules/@xeno-corporation/account/dist/index.mjs +1769 -32
- package/node_modules/@xeno-corporation/account/dist/index.mjs.map +1 -1
- package/node_modules/@xeno-corporation/account/dist/node.d.mts +25 -2
- package/node_modules/@xeno-corporation/account/dist/node.d.ts +25 -2
- package/node_modules/@xeno-corporation/account/dist/node.js +192 -33
- package/node_modules/@xeno-corporation/account/dist/node.js.map +1 -1
- package/node_modules/@xeno-corporation/account/dist/node.mjs +157 -1
- package/node_modules/@xeno-corporation/account/dist/node.mjs.map +1 -1
- package/node_modules/@xeno-corporation/account/package.json +2 -2
- package/node_modules/zod/LICENSE +1 -1
- package/node_modules/zod/README.md +110 -2920
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +52 -0
- package/node_modules/zod/index.d.cts +3 -0
- package/node_modules/zod/index.d.ts +3 -2
- package/node_modules/zod/index.js +7 -0
- package/node_modules/zod/{lib/external.js → locales/index.cjs} +20 -6
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +7 -0
- package/node_modules/zod/mini/index.cjs +51 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +127 -102
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +7 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +340 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +33 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +78 -0
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +97 -0
- package/node_modules/zod/src/v4/classic/external.ts +57 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +20 -0
- package/node_modules/zod/src/v4/classic/parse.ts +88 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +291 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +349 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1875 -0
- package/node_modules/zod/src/v4/core/checks.ts +1266 -0
- package/node_modules/zod/src/v4/core/compile.ts +2322 -0
- package/node_modules/zod/src/v4/core/core.ts +230 -0
- package/node_modules/zod/src/v4/core/doc.ts +52 -0
- package/node_modules/zod/src/v4/core/errors.ts +543 -0
- package/node_modules/zod/src/v4/core/index.ts +19 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +309 -0
- package/node_modules/zod/src/v4/core/regexes.ts +217 -0
- package/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/node_modules/zod/src/v4/core/schemas.ts +5226 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
- package/node_modules/zod/src/v4/core/util.ts +1293 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +120 -0
- package/node_modules/zod/src/v4/locales/az.ts +116 -0
- package/node_modules/zod/src/v4/locales/be.ts +188 -0
- package/node_modules/zod/src/v4/locales/bg.ts +133 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +121 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +123 -0
- package/node_modules/zod/src/v4/locales/da.ts +128 -0
- package/node_modules/zod/src/v4/locales/de.ts +121 -0
- package/node_modules/zod/src/v4/locales/el.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +136 -0
- package/node_modules/zod/src/v4/locales/eo.ts +123 -0
- package/node_modules/zod/src/v4/locales/es.ts +145 -0
- package/node_modules/zod/src/v4/locales/fa.ts +131 -0
- package/node_modules/zod/src/v4/locales/fi.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
- package/node_modules/zod/src/v4/locales/fr.ts +139 -0
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +253 -0
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +135 -0
- package/node_modules/zod/src/v4/locales/hu.ts +122 -0
- package/node_modules/zod/src/v4/locales/hy.ts +175 -0
- package/node_modules/zod/src/v4/locales/id.ts +120 -0
- package/node_modules/zod/src/v4/locales/index.ts +63 -0
- package/node_modules/zod/src/v4/locales/is.ts +124 -0
- package/node_modules/zod/src/v4/locales/it.ts +121 -0
- package/node_modules/zod/src/v4/locales/ja.ts +119 -0
- package/node_modules/zod/src/v4/locales/ka.ts +128 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +124 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +126 -0
- package/node_modules/zod/src/v4/locales/lt.ts +243 -0
- package/node_modules/zod/src/v4/locales/mk.ts +123 -0
- package/node_modules/zod/src/v4/locales/ms.ts +120 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +121 -0
- package/node_modules/zod/src/v4/locales/ota.ts +122 -0
- package/node_modules/zod/src/v4/locales/pl.ts +123 -0
- package/node_modules/zod/src/v4/locales/ps.ts +131 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +159 -0
- package/node_modules/zod/src/v4/locales/ro.ts +132 -0
- package/node_modules/zod/src/v4/locales/ru.ts +188 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +123 -0
- package/node_modules/zod/src/v4/locales/sv.ts +124 -0
- package/node_modules/zod/src/v4/locales/ta.ts +123 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +124 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +116 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +122 -0
- package/node_modules/zod/src/v4/locales/ur.ts +124 -0
- package/node_modules/zod/src/v4/locales/uz.ts +120 -0
- package/node_modules/zod/src/v4/locales/vi.ts +122 -0
- package/node_modules/zod/src/v4/locales/yo.ts +129 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
- package/node_modules/zod/src/v4/mini/checks.ts +33 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +52 -0
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/node_modules/zod/src/v4/mini/parse.ts +16 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
- package/node_modules/zod/src/v4-mini/index.ts +3 -0
- package/node_modules/zod/v3/ZodError.cjs +167 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/{lib → v3}/ZodError.d.ts +13 -13
- package/node_modules/zod/{lib → v3}/ZodError.js +31 -25
- package/node_modules/zod/v3/errors.cjs +36 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/{lib → v3}/errors.d.ts +2 -2
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +41 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/{lib → v3}/helpers/errorUtil.d.ts +1 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/{lib/helpers/parseUtil.js → v3/helpers/parseUtil.cjs} +26 -8
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/{lib → v3}/helpers/parseUtil.d.ts +4 -4
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/{lib → v3}/helpers/partialUtil.d.ts +1 -1
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/{lib/helpers/util.js → v3/helpers/util.cjs} +24 -10
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/{lib → v3}/helpers/util.d.ts +14 -11
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/{lib/index.js → v3/index.cjs} +21 -2
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/{lib/locales/en.js → v3/locales/en.cjs} +33 -50
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/{lib → v3}/locales/en.d.ts +1 -1
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +21 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/{lib/types.js → v3/types.cjs} +521 -546
- package/node_modules/zod/{lib/types.d.ts → v3/types.d.cts} +125 -153
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/{lib/index.mjs → v3/types.js} +183 -868
- package/node_modules/zod/v4/classic/checks.cjs +53 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +66 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +80 -0
- package/node_modules/zod/v4/classic/compat.d.cts +48 -0
- package/node_modules/zod/v4/classic/compat.d.ts +48 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +102 -0
- package/node_modules/zod/v4/classic/errors.d.cts +29 -0
- package/node_modules/zod/v4/classic/errors.d.ts +29 -0
- package/node_modules/zod/v4/classic/errors.js +57 -0
- package/node_modules/zod/v4/classic/external.cjs +97 -0
- package/node_modules/zod/v4/classic/external.d.cts +19 -0
- package/node_modules/zod/v4/classic/external.d.ts +19 -0
- package/node_modules/zod/v4/classic/external.js +17 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +52 -0
- package/node_modules/zod/v4/classic/index.d.cts +3 -0
- package/node_modules/zod/v4/classic/index.d.ts +3 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +68 -0
- package/node_modules/zod/v4/classic/iso.d.cts +7 -0
- package/node_modules/zod/v4/classic/iso.d.ts +7 -0
- package/node_modules/zod/v4/classic/iso.js +15 -0
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +63 -0
- package/node_modules/zod/v4/classic/parse.d.cts +44 -0
- package/node_modules/zod/v4/classic/parse.d.ts +44 -0
- package/node_modules/zod/v4/classic/parse.js +16 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
- package/node_modules/zod/v4/classic/schemas.js +1535 -0
- package/node_modules/zod/v4/core/api.cjs +1269 -0
- package/node_modules/zod/v4/core/api.d.cts +335 -0
- package/node_modules/zod/v4/core/api.d.ts +335 -0
- package/node_modules/zod/v4/core/api.js +1107 -0
- package/node_modules/zod/v4/core/checks.cjs +561 -0
- package/node_modules/zod/v4/core/checks.d.cts +294 -0
- package/node_modules/zod/v4/core/checks.d.ts +294 -0
- package/node_modules/zod/v4/core/checks.js +516 -0
- package/node_modules/zod/v4/core/compile.cjs +1916 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1866 -0
- package/node_modules/zod/v4/core/core.cjs +167 -0
- package/node_modules/zod/v4/core/core.d.cts +82 -0
- package/node_modules/zod/v4/core/core.d.ts +82 -0
- package/node_modules/zod/v4/core/core.js +141 -0
- package/node_modules/zod/v4/core/doc.cjs +61 -0
- package/node_modules/zod/v4/core/doc.d.cts +16 -0
- package/node_modules/zod/v4/core/doc.d.ts +16 -0
- package/node_modules/zod/v4/core/doc.js +38 -0
- package/node_modules/zod/v4/core/errors.cjs +317 -0
- package/node_modules/zod/v4/core/errors.d.cts +225 -0
- package/node_modules/zod/v4/core/errors.d.ts +225 -0
- package/node_modules/zod/v4/core/errors.js +267 -0
- package/node_modules/zod/v4/core/index.cjs +70 -0
- package/node_modules/zod/v4/core/index.d.cts +19 -0
- package/node_modules/zod/v4/core/index.d.ts +19 -0
- package/node_modules/zod/v4/core/index.js +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
- package/node_modules/zod/v4/core/json-schema.cjs +21 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +233 -0
- package/node_modules/zod/v4/core/parse.d.cts +52 -0
- package/node_modules/zod/v4/core/parse.d.ts +52 -0
- package/node_modules/zod/v4/core/parse.js +175 -0
- package/node_modules/zod/v4/core/regexes.cjs +209 -0
- package/node_modules/zod/v4/core/regexes.d.cts +90 -0
- package/node_modules/zod/v4/core/regexes.d.ts +90 -0
- package/node_modules/zod/v4/core/regexes.js +156 -0
- package/node_modules/zod/v4/core/registries.cjs +75 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +2699 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1275 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1275 -0
- package/node_modules/zod/v4/core/schemas.js +2636 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.js +651 -0
- package/node_modules/zod/v4/core/util.cjs +964 -0
- package/node_modules/zod/v4/core/util.d.cts +280 -0
- package/node_modules/zod/v4/core/util.d.ts +280 -0
- package/node_modules/zod/v4/core/util.js +873 -0
- package/node_modules/zod/v4/core/versions.cjs +27 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +51 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +4 -0
- package/node_modules/zod/v4/locales/ar.cjs +138 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +111 -0
- package/node_modules/zod/v4/locales/az.cjs +137 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +110 -0
- package/node_modules/zod/v4/locales/be.cjs +195 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +168 -0
- package/node_modules/zod/v4/locales/bg.cjs +152 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +125 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +139 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +112 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +143 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +116 -0
- package/node_modules/zod/v4/locales/da.cjs +147 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +120 -0
- package/node_modules/zod/v4/locales/de.cjs +140 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +113 -0
- package/node_modules/zod/v4/locales/el.cjs +139 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +112 -0
- package/node_modules/zod/v4/locales/en.cjs +152 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/node_modules/zod/v4/locales/en.js +125 -0
- package/node_modules/zod/v4/locales/eo.cjs +141 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/node_modules/zod/v4/locales/eo.js +114 -0
- package/node_modules/zod/v4/locales/es.cjs +163 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +136 -0
- package/node_modules/zod/v4/locales/fa.cjs +146 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +119 -0
- package/node_modules/zod/v4/locales/fi.cjs +144 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +117 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +112 -0
- package/node_modules/zod/v4/locales/fr.cjs +156 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +129 -0
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +248 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +221 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +153 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +126 -0
- package/node_modules/zod/v4/locales/hu.cjs +140 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +113 -0
- package/node_modules/zod/v4/locales/hy.cjs +185 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +158 -0
- package/node_modules/zod/v4/locales/id.cjs +138 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +111 -0
- package/node_modules/zod/v4/locales/index.cjs +152 -0
- package/node_modules/zod/v4/locales/index.d.cts +63 -0
- package/node_modules/zod/v4/locales/index.d.ts +63 -0
- package/node_modules/zod/v4/locales/index.js +63 -0
- package/node_modules/zod/v4/locales/is.cjs +141 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +114 -0
- package/node_modules/zod/v4/locales/it.cjs +140 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +113 -0
- package/node_modules/zod/v4/locales/ja.cjs +139 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +112 -0
- package/node_modules/zod/v4/locales/ka.cjs +144 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +117 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +142 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +115 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +143 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +116 -0
- package/node_modules/zod/v4/locales/lt.cjs +234 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +207 -0
- package/node_modules/zod/v4/locales/mk.cjs +141 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +114 -0
- package/node_modules/zod/v4/locales/ms.cjs +139 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +112 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +142 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +115 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +140 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +113 -0
- package/node_modules/zod/v4/locales/ota.cjs +141 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +114 -0
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +141 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +114 -0
- package/node_modules/zod/v4/locales/ps.cjs +146 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +119 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +169 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +142 -0
- package/node_modules/zod/v4/locales/ro.cjs +149 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +122 -0
- package/node_modules/zod/v4/locales/ru.cjs +195 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +168 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +141 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +114 -0
- package/node_modules/zod/v4/locales/sv.cjs +142 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +115 -0
- package/node_modules/zod/v4/locales/ta.cjs +142 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +115 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +142 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +115 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +137 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/node_modules/zod/v4/locales/tr.js +110 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +140 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +113 -0
- package/node_modules/zod/v4/locales/ur.cjs +142 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +115 -0
- package/node_modules/zod/v4/locales/uz.cjs +140 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +113 -0
- package/node_modules/zod/v4/locales/vi.cjs +140 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +113 -0
- package/node_modules/zod/v4/locales/yo.cjs +139 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +112 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +114 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +112 -0
- package/node_modules/zod/v4/mini/checks.cjs +54 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +71 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +22 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +95 -0
- package/node_modules/zod/v4/mini/external.d.cts +16 -0
- package/node_modules/zod/v4/mini/external.d.ts +16 -0
- package/node_modules/zod/v4/mini/external.js +16 -0
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +51 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +83 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +34 -0
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +37 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
- package/node_modules/zod/v4/mini/schemas.js +1002 -0
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +51 -0
- package/node_modules/zod/v4-mini/index.d.cts +3 -0
- package/node_modules/zod/v4-mini/index.d.ts +3 -0
- package/node_modules/zod/v4-mini/index.js +3 -0
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/package.json +4 -4
- package/node_modules/@xeno-corporation/account/dist/tokenStore-CnIo2ILq.d.mts +0 -47
- package/node_modules/@xeno-corporation/account/dist/tokenStore-CnIo2ILq.d.ts +0 -47
- package/node_modules/zod/lib/__tests__/Mocker.d.ts +0 -17
- package/node_modules/zod/lib/__tests__/Mocker.js +0 -57
- package/node_modules/zod/lib/benchmarks/datetime.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/datetime.js +0 -54
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.js +0 -79
- package/node_modules/zod/lib/benchmarks/index.js +0 -59
- package/node_modules/zod/lib/benchmarks/ipv4.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/ipv4.js +0 -54
- package/node_modules/zod/lib/benchmarks/object.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/object.js +0 -70
- package/node_modules/zod/lib/benchmarks/primitives.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/primitives.js +0 -170
- package/node_modules/zod/lib/benchmarks/realworld.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/realworld.js +0 -56
- package/node_modules/zod/lib/benchmarks/string.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/string.js +0 -55
- package/node_modules/zod/lib/benchmarks/union.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/union.js +0 -79
- package/node_modules/zod/lib/errors.js +0 -17
- package/node_modules/zod/lib/external.d.ts +0 -6
- package/node_modules/zod/lib/helpers/enumUtil.js +0 -2
- package/node_modules/zod/lib/helpers/errorUtil.js +0 -8
- package/node_modules/zod/lib/helpers/partialUtil.js +0 -2
- package/node_modules/zod/lib/helpers/typeAliases.js +0 -2
- package/node_modules/zod/lib/index.d.ts +0 -4
- package/node_modules/zod/lib/index.umd.js +0 -4497
- package/node_modules/zod/lib/standard-schema.js +0 -2
- /package/node_modules/zod/{lib/benchmarks/index.d.ts → compile.d.cts} +0 -0
- /package/node_modules/zod/{lib/helpers/typeAliases.d.ts → src/v3/helpers/typeAliases.ts} +0 -0
- /package/node_modules/zod/{lib/helpers/enumUtil.d.ts → v3/helpers/enumUtil.d.cts} +0 -0
- /package/node_modules/zod/{lib/standard-schema.d.ts → v3/standard-schema.d.cts} +0 -0
|
@@ -31,8 +31,8 @@ var tokenSetSchema = z.object({
|
|
|
31
31
|
/** Session id claim, the join key for back-channel logout. */
|
|
32
32
|
sid: z.string().nullable().default(null),
|
|
33
33
|
/** Signature-verified claims; never populated by unverified decoding. */
|
|
34
|
-
accessClaims: z.record(z.unknown()).nullable().default(null),
|
|
35
|
-
idClaims: z.record(z.unknown()).nullable().default(null)
|
|
34
|
+
accessClaims: z.record(z.string(), z.unknown()).nullable().default(null),
|
|
35
|
+
idClaims: z.record(z.string(), z.unknown()).nullable().default(null)
|
|
36
36
|
});
|
|
37
37
|
var oauthTokenResponseSchema = z.object({
|
|
38
38
|
access_token: z.string(),
|
|
@@ -72,7 +72,7 @@ var usageEventSchema = z.object({
|
|
|
72
72
|
inputTokens: z.number().int().nonnegative().nullable().default(null),
|
|
73
73
|
outputTokens: z.number().int().nonnegative().nullable().default(null),
|
|
74
74
|
/** Arbitrary attribution dimensions (project, workspace, …). */
|
|
75
|
-
dimensions: z.record(z.string()).default({}),
|
|
75
|
+
dimensions: z.record(z.string(), z.string()).default({}),
|
|
76
76
|
occurredAt: z.coerce.date().optional()
|
|
77
77
|
});
|
|
78
78
|
var usageResultSchema = z.object({
|
|
@@ -90,7 +90,7 @@ var holdRequestSchema = z.object({
|
|
|
90
90
|
amountMicro: z.number().int().positive(),
|
|
91
91
|
operation: z.string().min(1),
|
|
92
92
|
expiresInSeconds: z.number().int().positive().max(86400).default(900),
|
|
93
|
-
dimensions: z.record(z.string()).default({})
|
|
93
|
+
dimensions: z.record(z.string(), z.string()).default({})
|
|
94
94
|
});
|
|
95
95
|
var holdSchema = z.object({
|
|
96
96
|
holdId: z.string(),
|
|
@@ -110,7 +110,7 @@ var authzCheckSchema = z.object({
|
|
|
110
110
|
relation: z.string().min(1),
|
|
111
111
|
/** e.g. `workspace:acme` or `post:123`. */
|
|
112
112
|
object: z.string().min(1),
|
|
113
|
-
context: z.record(z.unknown()).default({})
|
|
113
|
+
context: z.record(z.string(), z.unknown()).default({})
|
|
114
114
|
});
|
|
115
115
|
var authzResultSchema = z.object({
|
|
116
116
|
allowed: z.boolean(),
|
|
@@ -370,10 +370,10 @@ var Transport = class {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
if (res.status === 204 || !res.body) return null;
|
|
373
|
-
const
|
|
374
|
-
if (!
|
|
373
|
+
const text2 = await readBoundedText(res, controller.signal, this.maxResponseBytes);
|
|
374
|
+
if (!text2) return null;
|
|
375
375
|
try {
|
|
376
|
-
return JSON.parse(
|
|
376
|
+
return JSON.parse(text2);
|
|
377
377
|
} catch {
|
|
378
378
|
throw new AccountError({
|
|
379
379
|
code: "INVALID_RESPONSE",
|
|
@@ -444,7 +444,7 @@ async function readBoundedText(response, signal, maxBytes) {
|
|
|
444
444
|
const decoder = new TextDecoder("utf-8", {
|
|
445
445
|
fatal: true
|
|
446
446
|
});
|
|
447
|
-
let
|
|
447
|
+
let text2 = "", size = 0;
|
|
448
448
|
while (true) {
|
|
449
449
|
const chunk = await beforeAbort(reader.read(), signal);
|
|
450
450
|
if (chunk.done) {
|
|
@@ -457,7 +457,7 @@ async function readBoundedText(response, signal, maxBytes) {
|
|
|
457
457
|
message: "Account response exceeds configured bound"
|
|
458
458
|
});
|
|
459
459
|
try {
|
|
460
|
-
|
|
460
|
+
text2 += decoder.decode(chunk.value, {
|
|
461
461
|
stream: true
|
|
462
462
|
});
|
|
463
463
|
} catch {
|
|
@@ -468,7 +468,7 @@ async function readBoundedText(response, signal, maxBytes) {
|
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
try {
|
|
471
|
-
return
|
|
471
|
+
return text2 + decoder.decode();
|
|
472
472
|
} catch {
|
|
473
473
|
throw new AccountError({
|
|
474
474
|
code: "INVALID_RESPONSE",
|
|
@@ -566,8 +566,8 @@ var AccountClient = class {
|
|
|
566
566
|
}
|
|
567
567
|
base;
|
|
568
568
|
transport;
|
|
569
|
-
constructor(
|
|
570
|
-
this.base =
|
|
569
|
+
constructor(base2, transport) {
|
|
570
|
+
this.base = base2;
|
|
571
571
|
this.transport = transport;
|
|
572
572
|
}
|
|
573
573
|
/** Resolve a token to its account, or throw an AccountError. */
|
|
@@ -606,20 +606,20 @@ function normalize(body) {
|
|
|
606
606
|
const root = body;
|
|
607
607
|
const user = root["user"] ?? root["data"] ?? root;
|
|
608
608
|
if (!user || typeof user !== "object") return null;
|
|
609
|
-
const
|
|
609
|
+
const id5 = str(user["id"]);
|
|
610
610
|
const email = str(user["email"]);
|
|
611
|
-
if (!
|
|
612
|
-
const
|
|
611
|
+
if (!id5 || !email) return null;
|
|
612
|
+
const linked2 = Array.isArray(user["linkedSurfaces"]) ? [
|
|
613
613
|
...new Set(user["linkedSurfaces"].map(normalizeSurface).filter(isSurface))
|
|
614
614
|
] : [];
|
|
615
615
|
const parsed = accountSchema.safeParse({
|
|
616
|
-
id,
|
|
616
|
+
id: id5,
|
|
617
617
|
email,
|
|
618
618
|
username: str(user["username"]) ?? null,
|
|
619
619
|
displayName: str(user["display_name"]) ?? str(user["displayName"]) ?? null,
|
|
620
620
|
avatarUrl: str(user["avatar_url"]) ?? str(user["avatarUrl"]) ?? null,
|
|
621
621
|
emailVerified: Boolean(user["email_verified"] ?? user["emailVerified"] ?? false),
|
|
622
|
-
linkedSurfaces:
|
|
622
|
+
linkedSurfaces: linked2
|
|
623
623
|
});
|
|
624
624
|
return parsed.success ? parsed.data : null;
|
|
625
625
|
}
|
|
@@ -758,6 +758,1653 @@ var AuthzClient = class {
|
|
|
758
758
|
}
|
|
759
759
|
};
|
|
760
760
|
|
|
761
|
+
// src/workspaces.ts
|
|
762
|
+
import { z as z3 } from "zod";
|
|
763
|
+
|
|
764
|
+
// src/workspaceMembership.ts
|
|
765
|
+
import { z as z2 } from "zod";
|
|
766
|
+
var id = z2.string().uuid();
|
|
767
|
+
var timestamp = z2.string().datetime({
|
|
768
|
+
offset: true
|
|
769
|
+
});
|
|
770
|
+
var role = z2.enum([
|
|
771
|
+
"admin",
|
|
772
|
+
"member",
|
|
773
|
+
"viewer"
|
|
774
|
+
]);
|
|
775
|
+
var membershipMutationSchema = z2.discriminatedUnion("action", [
|
|
776
|
+
z2.object({
|
|
777
|
+
action: z2.literal("invite.create"),
|
|
778
|
+
email: z2.string().email().max(320).regex(/^[^\x00-\x20\x7f]+$/),
|
|
779
|
+
role
|
|
780
|
+
}).strict(),
|
|
781
|
+
z2.object({
|
|
782
|
+
action: z2.literal("invite.revoke"),
|
|
783
|
+
inviteId: id
|
|
784
|
+
}).strict(),
|
|
785
|
+
z2.object({
|
|
786
|
+
action: z2.literal("invite.resend"),
|
|
787
|
+
inviteId: id
|
|
788
|
+
}).strict(),
|
|
789
|
+
z2.object({
|
|
790
|
+
action: z2.literal("member.role"),
|
|
791
|
+
memberId: id,
|
|
792
|
+
role
|
|
793
|
+
}).strict(),
|
|
794
|
+
z2.object({
|
|
795
|
+
action: z2.literal("member.remove"),
|
|
796
|
+
memberId: id
|
|
797
|
+
}).strict(),
|
|
798
|
+
z2.object({
|
|
799
|
+
action: z2.literal("owner.transfer"),
|
|
800
|
+
newOwnerId: id
|
|
801
|
+
}).strict()
|
|
802
|
+
]);
|
|
803
|
+
var base = {
|
|
804
|
+
operation_id: id,
|
|
805
|
+
workspace_id: id,
|
|
806
|
+
actor_user_id: id,
|
|
807
|
+
client_id: z2.string().regex(/^[a-zA-Z0-9._-]{1,128}$/),
|
|
808
|
+
committed_at: timestamp
|
|
809
|
+
};
|
|
810
|
+
var invite = z2.object({
|
|
811
|
+
id,
|
|
812
|
+
workspace_id: id,
|
|
813
|
+
invited_email: z2.string().email(),
|
|
814
|
+
role,
|
|
815
|
+
status: z2.enum([
|
|
816
|
+
"pending",
|
|
817
|
+
"revoked"
|
|
818
|
+
]),
|
|
819
|
+
expires_at: timestamp
|
|
820
|
+
}).strict();
|
|
821
|
+
var delivery = z2.object({
|
|
822
|
+
id,
|
|
823
|
+
state: z2.literal("queued")
|
|
824
|
+
}).strict();
|
|
825
|
+
var membershipCommittedSchema = z2.discriminatedUnion("action", [
|
|
826
|
+
z2.object({
|
|
827
|
+
...base,
|
|
828
|
+
action: z2.literal("invite.create"),
|
|
829
|
+
result: z2.object({
|
|
830
|
+
invite,
|
|
831
|
+
delivery
|
|
832
|
+
}).strict()
|
|
833
|
+
}).strict(),
|
|
834
|
+
z2.object({
|
|
835
|
+
...base,
|
|
836
|
+
action: z2.literal("invite.resend"),
|
|
837
|
+
result: z2.object({
|
|
838
|
+
invite,
|
|
839
|
+
delivery
|
|
840
|
+
}).strict()
|
|
841
|
+
}).strict(),
|
|
842
|
+
z2.object({
|
|
843
|
+
...base,
|
|
844
|
+
action: z2.literal("invite.revoke"),
|
|
845
|
+
result: z2.object({
|
|
846
|
+
invite
|
|
847
|
+
}).strict()
|
|
848
|
+
}).strict(),
|
|
849
|
+
z2.object({
|
|
850
|
+
...base,
|
|
851
|
+
action: z2.literal("member.role"),
|
|
852
|
+
result: z2.object({
|
|
853
|
+
memberId: id,
|
|
854
|
+
role
|
|
855
|
+
}).strict()
|
|
856
|
+
}).strict(),
|
|
857
|
+
z2.object({
|
|
858
|
+
...base,
|
|
859
|
+
action: z2.literal("member.remove"),
|
|
860
|
+
result: z2.object({
|
|
861
|
+
memberId: id
|
|
862
|
+
}).strict()
|
|
863
|
+
}).strict(),
|
|
864
|
+
z2.object({
|
|
865
|
+
...base,
|
|
866
|
+
action: z2.literal("owner.transfer"),
|
|
867
|
+
result: z2.object({
|
|
868
|
+
memberId: id,
|
|
869
|
+
previousOwnerId: id
|
|
870
|
+
}).strict()
|
|
871
|
+
}).strict()
|
|
872
|
+
]);
|
|
873
|
+
var membershipRejectedSchema = z2.object({
|
|
874
|
+
...base,
|
|
875
|
+
action: z2.enum([
|
|
876
|
+
"invite.create",
|
|
877
|
+
"invite.resend",
|
|
878
|
+
"invite.revoke",
|
|
879
|
+
"member.role",
|
|
880
|
+
"member.remove",
|
|
881
|
+
"owner.transfer"
|
|
882
|
+
]),
|
|
883
|
+
rejection: z2.enum([
|
|
884
|
+
"invalid_membership_request",
|
|
885
|
+
"member_not_found",
|
|
886
|
+
"owner_transfer_required",
|
|
887
|
+
"owner_target_not_member",
|
|
888
|
+
"invite_not_found",
|
|
889
|
+
"invite_already_pending",
|
|
890
|
+
"already_member",
|
|
891
|
+
"seat_limit"
|
|
892
|
+
])
|
|
893
|
+
}).strict();
|
|
894
|
+
var membershipAbandonedSchema = membershipRejectedSchema.omit({
|
|
895
|
+
rejection: true
|
|
896
|
+
}).extend({
|
|
897
|
+
abandoned: z2.literal(true),
|
|
898
|
+
request: membershipMutationSchema
|
|
899
|
+
}).strict();
|
|
900
|
+
var membershipOperationSchema = z2.union([
|
|
901
|
+
membershipCommittedSchema,
|
|
902
|
+
membershipRejectedSchema,
|
|
903
|
+
membershipAbandonedSchema
|
|
904
|
+
]);
|
|
905
|
+
var membershipDeliverySchema = z2.object({
|
|
906
|
+
id,
|
|
907
|
+
state: z2.enum([
|
|
908
|
+
"queued",
|
|
909
|
+
"accepted",
|
|
910
|
+
"skipped",
|
|
911
|
+
"unknown"
|
|
912
|
+
])
|
|
913
|
+
}).strict();
|
|
914
|
+
var WorkspaceMembershipMutationError = class extends AccountError {
|
|
915
|
+
static {
|
|
916
|
+
__name(this, "WorkspaceMembershipMutationError");
|
|
917
|
+
}
|
|
918
|
+
operationId;
|
|
919
|
+
outcome = "uncertain";
|
|
920
|
+
constructor(operationId) {
|
|
921
|
+
super({
|
|
922
|
+
code: "PLATFORM_ERROR",
|
|
923
|
+
message: "Workspace membership acknowledgement is uncertain. Read back the same operation.",
|
|
924
|
+
retryable: false
|
|
925
|
+
}), this.operationId = operationId;
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
function assertMembershipOperation(workspaceId, operationId, operation3, request) {
|
|
929
|
+
if (operation3.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || operation3.operation_id.toLowerCase() !== operationId.toLowerCase() || request && operation3.action !== request.action) throw new Error("Foreign membership receipt");
|
|
930
|
+
if ("rejection" in operation3) return;
|
|
931
|
+
if ("abandoned" in operation3) {
|
|
932
|
+
if (operation3.request.action !== operation3.action || request && JSON.stringify(membershipMutationSchema.parse(request)) !== JSON.stringify(operation3.request)) throw new Error("Wrong abandoned membership intent");
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
if (operation3.action.startsWith("invite.")) {
|
|
936
|
+
if (!("invite" in operation3.result) || operation3.result.invite.workspace_id !== operation3.workspace_id || operation3.result.invite.status !== (operation3.action === "invite.revoke" ? "revoked" : "pending")) throw new Error("Foreign invitation receipt");
|
|
937
|
+
if (request && "inviteId" in request && operation3.result.invite.id !== request.inviteId) throw new Error("Wrong invitation target");
|
|
938
|
+
if (request?.action === "invite.create" && (operation3.result.invite.invited_email !== request.email.toLowerCase() || operation3.result.invite.role !== request.role)) throw new Error("Wrong invitation intent");
|
|
939
|
+
} else if ("memberId" in operation3.result) {
|
|
940
|
+
if (request && "memberId" in request && operation3.result.memberId !== request.memberId) throw new Error("Wrong member target");
|
|
941
|
+
if (request?.action === "member.role" && (!("role" in operation3.result) || operation3.result.role !== request.role)) throw new Error("Wrong member role");
|
|
942
|
+
if (operation3.action === "owner.transfer" && (operation3.result.previousOwnerId !== operation3.actor_user_id || request?.action === "owner.transfer" && operation3.result.memberId !== request.newOwnerId)) throw new Error("Wrong owner target");
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
__name(assertMembershipOperation, "assertMembershipOperation");
|
|
946
|
+
|
|
947
|
+
// src/workspaces.ts
|
|
948
|
+
var workspaceRoleSchema = z3.enum([
|
|
949
|
+
"owner",
|
|
950
|
+
"admin",
|
|
951
|
+
"member",
|
|
952
|
+
"viewer"
|
|
953
|
+
]);
|
|
954
|
+
var workspaceInviteRoleSchema = z3.enum([
|
|
955
|
+
"admin",
|
|
956
|
+
"member",
|
|
957
|
+
"viewer"
|
|
958
|
+
]);
|
|
959
|
+
var id2 = z3.string().uuid();
|
|
960
|
+
var timestamp2 = z3.string().datetime({
|
|
961
|
+
offset: true
|
|
962
|
+
});
|
|
963
|
+
var workspaceSchema = z3.object({
|
|
964
|
+
id: id2,
|
|
965
|
+
owner_user_id: id2,
|
|
966
|
+
workspace_type: z3.enum([
|
|
967
|
+
"personal",
|
|
968
|
+
"team"
|
|
969
|
+
]),
|
|
970
|
+
name: z3.string().min(1),
|
|
971
|
+
slug: z3.string().min(1),
|
|
972
|
+
status: z3.string().min(1),
|
|
973
|
+
created_at: timestamp2,
|
|
974
|
+
updated_at: timestamp2,
|
|
975
|
+
metadata: z3.record(z3.string(), z3.unknown()),
|
|
976
|
+
member_role: workspaceRoleSchema.optional(),
|
|
977
|
+
member_count: z3.number().int().nonnegative().optional()
|
|
978
|
+
});
|
|
979
|
+
var workspaceMemberSchema = z3.object({
|
|
980
|
+
id: id2,
|
|
981
|
+
user_id: id2,
|
|
982
|
+
member_role: workspaceRoleSchema,
|
|
983
|
+
member_status: z3.literal("active"),
|
|
984
|
+
created_at: timestamp2,
|
|
985
|
+
user: z3.object({
|
|
986
|
+
username: z3.string().nullable(),
|
|
987
|
+
email: z3.string().email(),
|
|
988
|
+
display_name: z3.string().nullable(),
|
|
989
|
+
avatar_url: z3.string().url().nullable()
|
|
990
|
+
}).optional()
|
|
991
|
+
});
|
|
992
|
+
var workspaceInviteSchema = z3.object({
|
|
993
|
+
id: id2,
|
|
994
|
+
workspace_id: id2,
|
|
995
|
+
invited_by_user_id: id2,
|
|
996
|
+
invited_user_id: id2.nullable(),
|
|
997
|
+
invited_email: z3.string().email(),
|
|
998
|
+
role: workspaceInviteRoleSchema,
|
|
999
|
+
status: z3.enum([
|
|
1000
|
+
"pending",
|
|
1001
|
+
"accepted",
|
|
1002
|
+
"declined",
|
|
1003
|
+
"revoked",
|
|
1004
|
+
"expired"
|
|
1005
|
+
]),
|
|
1006
|
+
created_at: timestamp2,
|
|
1007
|
+
expires_at: timestamp2.nullable(),
|
|
1008
|
+
workspace_name: z3.string().optional(),
|
|
1009
|
+
invited_by_name: z3.string().nullable().optional()
|
|
1010
|
+
});
|
|
1011
|
+
var accountOperationIntentSchema = z3.discriminatedUnion("action", [
|
|
1012
|
+
z3.object({
|
|
1013
|
+
action: z3.literal("workspace.create"),
|
|
1014
|
+
name: z3.string().trim().min(1).max(128),
|
|
1015
|
+
type: z3.literal("team")
|
|
1016
|
+
}).strict(),
|
|
1017
|
+
z3.object({
|
|
1018
|
+
action: z3.literal("invite.accept"),
|
|
1019
|
+
inviteId: id2
|
|
1020
|
+
}).strict(),
|
|
1021
|
+
z3.object({
|
|
1022
|
+
action: z3.literal("invite.decline"),
|
|
1023
|
+
inviteId: id2
|
|
1024
|
+
}).strict()
|
|
1025
|
+
]);
|
|
1026
|
+
var accountOperationSchema = z3.object({
|
|
1027
|
+
operation_id: id2,
|
|
1028
|
+
actor_user_id: id2,
|
|
1029
|
+
client_id: z3.string().regex(/^[a-zA-Z0-9._-]{1,128}$/),
|
|
1030
|
+
action: z3.enum([
|
|
1031
|
+
"workspace.create",
|
|
1032
|
+
"invite.accept",
|
|
1033
|
+
"invite.decline"
|
|
1034
|
+
]),
|
|
1035
|
+
committed_at: timestamp2,
|
|
1036
|
+
result: z3.union([
|
|
1037
|
+
z3.object({
|
|
1038
|
+
workspace: workspaceSchema
|
|
1039
|
+
}).strict(),
|
|
1040
|
+
z3.object({
|
|
1041
|
+
invite: workspaceInviteSchema
|
|
1042
|
+
}).strict()
|
|
1043
|
+
])
|
|
1044
|
+
}).strict();
|
|
1045
|
+
var AccountMutationError = class extends AccountError {
|
|
1046
|
+
static {
|
|
1047
|
+
__name(this, "AccountMutationError");
|
|
1048
|
+
}
|
|
1049
|
+
operationId;
|
|
1050
|
+
outcome = "uncertain";
|
|
1051
|
+
constructor(operationId) {
|
|
1052
|
+
super({
|
|
1053
|
+
code: "PLATFORM_ERROR",
|
|
1054
|
+
message: "Account mutation acknowledgement is uncertain. Read back the same operation.",
|
|
1055
|
+
retryable: false
|
|
1056
|
+
}), this.operationId = operationId;
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
var workspaceKeyScopeSchema = z3.enum([
|
|
1060
|
+
"workspace:read",
|
|
1061
|
+
"workspace:members:read"
|
|
1062
|
+
]);
|
|
1063
|
+
var keyScopes = z3.array(workspaceKeyScopeSchema).min(1).max(2).refine((values) => new Set(values).size === values.length);
|
|
1064
|
+
var workspaceKeySchema = z3.object({
|
|
1065
|
+
id: id2,
|
|
1066
|
+
workspace_id: id2,
|
|
1067
|
+
created_by_user_id: id2,
|
|
1068
|
+
name: z3.string().min(1).max(100),
|
|
1069
|
+
prefix: z3.string().regex(/^xeno-ws-v1_[0-9a-f]{13}$/),
|
|
1070
|
+
scopes: keyScopes,
|
|
1071
|
+
revision: z3.number().int().positive(),
|
|
1072
|
+
created_at: timestamp2,
|
|
1073
|
+
expires_at: timestamp2,
|
|
1074
|
+
revoked_at: timestamp2.nullable(),
|
|
1075
|
+
replaced_by: id2.nullable()
|
|
1076
|
+
});
|
|
1077
|
+
var workspaceKeyInputSchema = z3.object({
|
|
1078
|
+
name: z3.string().trim().min(1).max(100).regex(/^[^\x00-\x1f]+$/),
|
|
1079
|
+
scopes: keyScopes,
|
|
1080
|
+
expires_at: timestamp2.refine((value) => Date.parse(value) > Date.now() && Date.parse(value) <= Date.now() + 90 * 864e5)
|
|
1081
|
+
}).strict();
|
|
1082
|
+
var keySecretSchema = z3.string().regex(/^xeno-ws-v1_[0-9a-f]{64}$/);
|
|
1083
|
+
var committedKeyOperationSchema = z3.object({
|
|
1084
|
+
operation_id: id2,
|
|
1085
|
+
workspace_id: id2,
|
|
1086
|
+
actor_user_id: id2,
|
|
1087
|
+
client_id: z3.string().regex(/^[a-zA-Z0-9._-]{1,128}$/),
|
|
1088
|
+
action: z3.enum([
|
|
1089
|
+
"create",
|
|
1090
|
+
"rotate",
|
|
1091
|
+
"revoke"
|
|
1092
|
+
]),
|
|
1093
|
+
key: workspaceKeySchema,
|
|
1094
|
+
previous_key_id: id2.nullable(),
|
|
1095
|
+
committed_at: timestamp2
|
|
1096
|
+
}).strict();
|
|
1097
|
+
var workspaceKeyRejectionSchema = z3.enum([
|
|
1098
|
+
"invalid_workspace_key_request",
|
|
1099
|
+
"invalid_workspace_key_revision",
|
|
1100
|
+
"workspace_key_not_found",
|
|
1101
|
+
"workspace_key_conflict"
|
|
1102
|
+
]);
|
|
1103
|
+
var rejectedKeyOperationSchema = committedKeyOperationSchema.omit({
|
|
1104
|
+
key: true
|
|
1105
|
+
}).extend({
|
|
1106
|
+
rejection: workspaceKeyRejectionSchema
|
|
1107
|
+
}).strict();
|
|
1108
|
+
var abandonedKeyOperationSchema = committedKeyOperationSchema.omit({
|
|
1109
|
+
key: true
|
|
1110
|
+
}).extend({
|
|
1111
|
+
abandoned: z3.literal(true)
|
|
1112
|
+
}).strict();
|
|
1113
|
+
var workspaceKeyOperationSchema = z3.union([
|
|
1114
|
+
committedKeyOperationSchema,
|
|
1115
|
+
rejectedKeyOperationSchema,
|
|
1116
|
+
abandonedKeyOperationSchema
|
|
1117
|
+
]);
|
|
1118
|
+
var keyOperationInput = workspaceKeyInputSchema.extend({
|
|
1119
|
+
expires_at: timestamp2
|
|
1120
|
+
});
|
|
1121
|
+
var keyMutationSchema = z3.discriminatedUnion("action", [
|
|
1122
|
+
z3.object({
|
|
1123
|
+
action: z3.literal("create"),
|
|
1124
|
+
input: keyOperationInput
|
|
1125
|
+
}).strict(),
|
|
1126
|
+
z3.object({
|
|
1127
|
+
action: z3.literal("rotate"),
|
|
1128
|
+
keyId: id2,
|
|
1129
|
+
expectedRevision: z3.number().int().positive(),
|
|
1130
|
+
input: keyOperationInput.partial().optional()
|
|
1131
|
+
}).strict(),
|
|
1132
|
+
z3.object({
|
|
1133
|
+
action: z3.literal("revoke"),
|
|
1134
|
+
keyId: id2,
|
|
1135
|
+
expectedRevision: z3.number().int().positive()
|
|
1136
|
+
}).strict()
|
|
1137
|
+
]);
|
|
1138
|
+
var WorkspaceKeyMutationError = class extends AccountError {
|
|
1139
|
+
static {
|
|
1140
|
+
__name(this, "WorkspaceKeyMutationError");
|
|
1141
|
+
}
|
|
1142
|
+
operationId;
|
|
1143
|
+
outcome = "uncertain";
|
|
1144
|
+
constructor(operationId) {
|
|
1145
|
+
super({
|
|
1146
|
+
code: "PLATFORM_ERROR",
|
|
1147
|
+
message: "Workspace key mutation acknowledgement is uncertain. Read back the same operation.",
|
|
1148
|
+
retryable: false
|
|
1149
|
+
}), this.operationId = operationId;
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
var workspaceKeyCursor = z3.string().regex(/^[a-z0-9_-]{1,512}$/i);
|
|
1153
|
+
var success = z3.object({
|
|
1154
|
+
success: z3.literal(true)
|
|
1155
|
+
});
|
|
1156
|
+
var membersResponse = success.extend({
|
|
1157
|
+
workspace: workspaceSchema,
|
|
1158
|
+
members: z3.array(workspaceMemberSchema)
|
|
1159
|
+
});
|
|
1160
|
+
var invitesResponse = success.extend({
|
|
1161
|
+
invites: z3.array(workspaceInviteSchema)
|
|
1162
|
+
});
|
|
1163
|
+
var WorkspaceClient = class {
|
|
1164
|
+
static {
|
|
1165
|
+
__name(this, "WorkspaceClient");
|
|
1166
|
+
}
|
|
1167
|
+
transport;
|
|
1168
|
+
authorize;
|
|
1169
|
+
base;
|
|
1170
|
+
constructor(base2, transport, authorize) {
|
|
1171
|
+
this.transport = transport;
|
|
1172
|
+
this.authorize = authorize;
|
|
1173
|
+
const origin = new URL(base2);
|
|
1174
|
+
if (origin.protocol !== "https:" || origin.username || origin.password || origin.search || origin.hash || origin.pathname !== "/") {
|
|
1175
|
+
throw new AccountError({
|
|
1176
|
+
code: "BAD_REQUEST",
|
|
1177
|
+
message: "Workspace API requires an HTTPS origin."
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
this.base = origin.origin;
|
|
1181
|
+
}
|
|
1182
|
+
async call(method, path, scope, schema, body, idempotencyKey) {
|
|
1183
|
+
const url = `${this.base}/api${path}`;
|
|
1184
|
+
const raw = await this.transport.request({
|
|
1185
|
+
method,
|
|
1186
|
+
url,
|
|
1187
|
+
...body === void 0 ? {} : {
|
|
1188
|
+
body
|
|
1189
|
+
},
|
|
1190
|
+
...idempotencyKey ? {
|
|
1191
|
+
idempotencyKey
|
|
1192
|
+
} : {},
|
|
1193
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
1194
|
+
const auth = await this.authorize(method, url, {
|
|
1195
|
+
scopes: [
|
|
1196
|
+
scope
|
|
1197
|
+
],
|
|
1198
|
+
silent: true
|
|
1199
|
+
});
|
|
1200
|
+
if (!auth) throw new AccountError({
|
|
1201
|
+
code: "INVALID_TOKEN",
|
|
1202
|
+
message: "Sign in to manage workspaces."
|
|
1203
|
+
});
|
|
1204
|
+
return auth;
|
|
1205
|
+
}, "authorization")
|
|
1206
|
+
});
|
|
1207
|
+
const parsed = schema.safeParse(raw);
|
|
1208
|
+
if (!parsed.success) throw new AccountError({
|
|
1209
|
+
code: "INVALID_RESPONSE",
|
|
1210
|
+
message: "Invalid workspace response."
|
|
1211
|
+
});
|
|
1212
|
+
return parsed.data;
|
|
1213
|
+
}
|
|
1214
|
+
async list() {
|
|
1215
|
+
return (await this.call("GET", "/workspaces", "team:read", success.extend({
|
|
1216
|
+
workspaces: z3.array(workspaceSchema)
|
|
1217
|
+
}))).workspaces;
|
|
1218
|
+
}
|
|
1219
|
+
async keys(workspaceId, options = {}) {
|
|
1220
|
+
const input = z3.object({
|
|
1221
|
+
cursor: workspaceKeyCursor.optional(),
|
|
1222
|
+
limit: z3.number().int().min(1).max(200).optional()
|
|
1223
|
+
}).strict().parse(options);
|
|
1224
|
+
const query = new URLSearchParams();
|
|
1225
|
+
if (input.cursor !== void 0) query.set("cursor", input.cursor);
|
|
1226
|
+
if (input.limit !== void 0) query.set("limit", String(input.limit));
|
|
1227
|
+
const result = await this.call("GET", `/workspaces/${id2.parse(workspaceId)}/api-keys${query.size ? `?${query}` : ""}`, "team:manage", success.extend({
|
|
1228
|
+
keys: z3.array(workspaceKeySchema).max(200),
|
|
1229
|
+
next_cursor: workspaceKeyCursor.nullable()
|
|
1230
|
+
}));
|
|
1231
|
+
const { keys, next_cursor } = result;
|
|
1232
|
+
if (keys.some((key) => key.workspace_id.toLowerCase() !== workspaceId.toLowerCase())) throw new AccountError({
|
|
1233
|
+
code: "INVALID_RESPONSE",
|
|
1234
|
+
message: "Workspace key response belongs to another workspace."
|
|
1235
|
+
});
|
|
1236
|
+
return {
|
|
1237
|
+
keys,
|
|
1238
|
+
next_cursor
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
async createKey(workspaceId, input) {
|
|
1242
|
+
const body = workspaceKeyInputSchema.parse(input);
|
|
1243
|
+
const response = await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/api-keys`, "team:manage", success.extend({
|
|
1244
|
+
key: workspaceKeySchema,
|
|
1245
|
+
secret: keySecretSchema
|
|
1246
|
+
}), body);
|
|
1247
|
+
this.assertKeyReceipt(workspaceId, response.key);
|
|
1248
|
+
return {
|
|
1249
|
+
key: response.key,
|
|
1250
|
+
secret: response.secret
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
async keyOperation(workspaceId, operationId) {
|
|
1254
|
+
const workspace = id2.parse(workspaceId), operation3 = id2.parse(operationId);
|
|
1255
|
+
const response = await this.call("GET", `/workspaces/${workspace}/api-keys/operations/${operation3}`, "team:manage", z3.discriminatedUnion("state", [
|
|
1256
|
+
z3.object({
|
|
1257
|
+
success: z3.literal(true),
|
|
1258
|
+
state: z3.literal("not-observed"),
|
|
1259
|
+
operation: z3.null()
|
|
1260
|
+
}).strict(),
|
|
1261
|
+
z3.object({
|
|
1262
|
+
success: z3.literal(true),
|
|
1263
|
+
state: z3.literal("committed"),
|
|
1264
|
+
operation: committedKeyOperationSchema
|
|
1265
|
+
}).strict(),
|
|
1266
|
+
z3.object({
|
|
1267
|
+
success: z3.literal(true),
|
|
1268
|
+
state: z3.literal("rejected"),
|
|
1269
|
+
operation: rejectedKeyOperationSchema
|
|
1270
|
+
}).strict(),
|
|
1271
|
+
z3.object({
|
|
1272
|
+
success: z3.literal(true),
|
|
1273
|
+
state: z3.literal("abandoned"),
|
|
1274
|
+
operation: abandonedKeyOperationSchema
|
|
1275
|
+
}).strict()
|
|
1276
|
+
]));
|
|
1277
|
+
if (response.state === "not-observed") return {
|
|
1278
|
+
state: response.state,
|
|
1279
|
+
operation: null
|
|
1280
|
+
};
|
|
1281
|
+
this.assertOperation(workspace, operation3, response.operation);
|
|
1282
|
+
if (response.state === "abandoned") return {
|
|
1283
|
+
state: response.state,
|
|
1284
|
+
operation: response.operation
|
|
1285
|
+
};
|
|
1286
|
+
return response.state === "rejected" ? {
|
|
1287
|
+
state: response.state,
|
|
1288
|
+
operation: response.operation
|
|
1289
|
+
} : {
|
|
1290
|
+
state: response.state,
|
|
1291
|
+
operation: response.operation
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
async mutateKey(workspaceId, operationId, request) {
|
|
1295
|
+
const workspace = id2.parse(workspaceId), operation3 = id2.parse(operationId), input = keyMutationSchema.parse(request);
|
|
1296
|
+
const path = `/workspaces/${workspace}/api-keys${input.action === "create" ? "" : `/${input.keyId}${input.action === "rotate" ? "/rotate" : ""}`}`;
|
|
1297
|
+
const body = {
|
|
1298
|
+
...input.action === "revoke" ? {} : input.input,
|
|
1299
|
+
operation_id: operation3,
|
|
1300
|
+
...input.action === "create" ? {} : {
|
|
1301
|
+
expected_revision: input.expectedRevision
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
try {
|
|
1305
|
+
const response = await this.call(input.action === "revoke" ? "DELETE" : "POST", path, "team:manage", z3.object({
|
|
1306
|
+
success: z3.literal(true),
|
|
1307
|
+
key: workspaceKeySchema.optional(),
|
|
1308
|
+
operation: workspaceKeyOperationSchema,
|
|
1309
|
+
replayed: z3.boolean(),
|
|
1310
|
+
secret: keySecretSchema.optional()
|
|
1311
|
+
}).strict(), body);
|
|
1312
|
+
this.assertOperation(workspace, operation3, response.operation);
|
|
1313
|
+
if ("rejection" in response.operation || "abandoned" in response.operation) {
|
|
1314
|
+
if (response.key !== void 0 || response.secret !== void 0 || response.operation.action !== input.action || response.operation.previous_key_id?.toLowerCase() !== (input.action === "create" ? void 0 : input.keyId.toLowerCase())) throw new Error("Invalid rejection receipt");
|
|
1315
|
+
return {
|
|
1316
|
+
operation: response.operation,
|
|
1317
|
+
replayed: response.replayed
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
if (!response.key) throw new Error("Missing key");
|
|
1321
|
+
if (response.operation.action !== input.action || JSON.stringify(response.key) !== JSON.stringify(response.operation.key) || response.operation.previous_key_id?.toLowerCase() !== (input.action === "create" ? void 0 : input.keyId.toLowerCase()) || (response.replayed || input.action === "revoke" ? response.secret !== void 0 : response.secret === void 0) || response.secret !== void 0 && !response.secret.startsWith(response.key.prefix)) throw new Error("Invalid receipt");
|
|
1322
|
+
if (input.action === "revoke") {
|
|
1323
|
+
if (response.key.id.toLowerCase() !== input.keyId.toLowerCase() || !response.key.revoked_at || response.key.revision !== input.expectedRevision + 1) throw new Error("Invalid revocation");
|
|
1324
|
+
} else {
|
|
1325
|
+
this.assertKeyReceipt(workspace, response.key);
|
|
1326
|
+
if (input.action === "rotate" && response.key.id.toLowerCase() === input.keyId.toLowerCase()) throw new Error("Invalid rotation");
|
|
1327
|
+
}
|
|
1328
|
+
return {
|
|
1329
|
+
operation: response.operation,
|
|
1330
|
+
replayed: response.replayed,
|
|
1331
|
+
...response.secret === void 0 ? {} : {
|
|
1332
|
+
secret: response.secret
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
} catch {
|
|
1336
|
+
throw new WorkspaceKeyMutationError(operation3);
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
assertOperation(workspaceId, operationId, operation3) {
|
|
1340
|
+
if (operation3.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || operation3.operation_id.toLowerCase() !== operationId.toLowerCase()) {
|
|
1341
|
+
throw new AccountError({
|
|
1342
|
+
code: "INVALID_RESPONSE",
|
|
1343
|
+
message: "Workspace operation response belongs to another authority."
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
if ("rejection" in operation3 || "abandoned" in operation3) return;
|
|
1347
|
+
if (operation3.key.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || operation3.key.created_by_user_id.toLowerCase() !== operation3.actor_user_id.toLowerCase() && operation3.action !== "revoke") throw new AccountError({
|
|
1348
|
+
code: "INVALID_RESPONSE",
|
|
1349
|
+
message: "Foreign key receipt."
|
|
1350
|
+
});
|
|
1351
|
+
if (operation3.action === "revoke" ? !operation3.key.revoked_at || operation3.key.revision < 2 || operation3.previous_key_id !== operation3.key.id : operation3.key.revoked_at !== null || operation3.key.replaced_by !== null || operation3.key.revision !== 1 || (operation3.action === "create" ? operation3.previous_key_id !== null : operation3.previous_key_id === null || operation3.previous_key_id === operation3.key.id)) {
|
|
1352
|
+
throw new AccountError({
|
|
1353
|
+
code: "INVALID_RESPONSE",
|
|
1354
|
+
message: "Invalid committed workspace key operation."
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
async rotateKey(workspaceId, keyId, expectedRevision, input = {}) {
|
|
1359
|
+
const body = {
|
|
1360
|
+
...workspaceKeyInputSchema.partial().parse(input),
|
|
1361
|
+
expected_revision: z3.number().int().positive().parse(expectedRevision)
|
|
1362
|
+
};
|
|
1363
|
+
const response = await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/api-keys/${id2.parse(keyId)}/rotate`, "team:manage", success.extend({
|
|
1364
|
+
key: workspaceKeySchema,
|
|
1365
|
+
secret: keySecretSchema
|
|
1366
|
+
}), body);
|
|
1367
|
+
this.assertKeyReceipt(workspaceId, response.key);
|
|
1368
|
+
if (response.key.id.toLowerCase() === keyId.toLowerCase()) throw new AccountError({
|
|
1369
|
+
code: "INVALID_RESPONSE",
|
|
1370
|
+
message: "Rotation did not acknowledge a new key identity."
|
|
1371
|
+
});
|
|
1372
|
+
return {
|
|
1373
|
+
key: response.key,
|
|
1374
|
+
secret: response.secret
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
async revokeKey(workspaceId, keyId, expectedRevision) {
|
|
1378
|
+
const key = (await this.call("DELETE", `/workspaces/${id2.parse(workspaceId)}/api-keys/${id2.parse(keyId)}`, "team:manage", success.extend({
|
|
1379
|
+
key: workspaceKeySchema
|
|
1380
|
+
}), {
|
|
1381
|
+
expected_revision: z3.number().int().positive().parse(expectedRevision)
|
|
1382
|
+
})).key;
|
|
1383
|
+
if (key.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || key.id.toLowerCase() !== keyId.toLowerCase() || !key.revoked_at || key.revision !== expectedRevision + 1) throw new AccountError({
|
|
1384
|
+
code: "INVALID_RESPONSE",
|
|
1385
|
+
message: "Revocation was not acknowledged for the requested key revision."
|
|
1386
|
+
});
|
|
1387
|
+
return key;
|
|
1388
|
+
}
|
|
1389
|
+
assertKeyReceipt(workspaceId, key) {
|
|
1390
|
+
if (key.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || key.revoked_at || key.replaced_by || key.revision !== 1) throw new AccountError({
|
|
1391
|
+
code: "INVALID_RESPONSE",
|
|
1392
|
+
message: "Invalid workspace key creation receipt."
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
async create(name, type = "team") {
|
|
1396
|
+
const body = z3.object({
|
|
1397
|
+
name: z3.string().trim().min(1).max(128),
|
|
1398
|
+
workspace_type: z3.enum([
|
|
1399
|
+
"personal",
|
|
1400
|
+
"team"
|
|
1401
|
+
])
|
|
1402
|
+
}).parse({
|
|
1403
|
+
name,
|
|
1404
|
+
workspace_type: type
|
|
1405
|
+
});
|
|
1406
|
+
return (await this.call("POST", "/workspaces", "team:manage", success.extend({
|
|
1407
|
+
workspace: workspaceSchema
|
|
1408
|
+
}), body)).workspace;
|
|
1409
|
+
}
|
|
1410
|
+
async accountOperation(operationId) {
|
|
1411
|
+
const operation3 = id2.parse(operationId);
|
|
1412
|
+
const response = await this.call("GET", `/account-operations/${operation3}`, "team:manage", z3.discriminatedUnion("state", [
|
|
1413
|
+
z3.object({
|
|
1414
|
+
success: z3.literal(true),
|
|
1415
|
+
state: z3.literal("not-observed"),
|
|
1416
|
+
operation: z3.null()
|
|
1417
|
+
}).strict(),
|
|
1418
|
+
z3.object({
|
|
1419
|
+
success: z3.literal(true),
|
|
1420
|
+
state: z3.literal("committed"),
|
|
1421
|
+
operation: accountOperationSchema
|
|
1422
|
+
}).strict()
|
|
1423
|
+
]));
|
|
1424
|
+
if (response.state === "not-observed") return response;
|
|
1425
|
+
if (response.operation.operation_id.toLowerCase() !== operation3.toLowerCase()) throw new AccountError({
|
|
1426
|
+
code: "INVALID_RESPONSE",
|
|
1427
|
+
message: "Account operation response belongs to another operation."
|
|
1428
|
+
});
|
|
1429
|
+
return {
|
|
1430
|
+
state: "committed",
|
|
1431
|
+
operation: response.operation
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
async mutateAccount(operationId, request) {
|
|
1435
|
+
const operation3 = id2.parse(operationId), intent = accountOperationIntentSchema.parse(request);
|
|
1436
|
+
const path = intent.action === "workspace.create" ? "/workspaces" : `/workspace-invites/${intent.inviteId}/${intent.action === "invite.accept" ? "accept" : "decline"}`;
|
|
1437
|
+
const body = intent.action === "workspace.create" ? {
|
|
1438
|
+
operation_id: operation3,
|
|
1439
|
+
name: intent.name,
|
|
1440
|
+
workspace_type: intent.type
|
|
1441
|
+
} : {
|
|
1442
|
+
operation_id: operation3
|
|
1443
|
+
};
|
|
1444
|
+
try {
|
|
1445
|
+
const response = await this.call("POST", path, "team:manage", z3.object({
|
|
1446
|
+
success: z3.literal(true),
|
|
1447
|
+
operation: accountOperationSchema,
|
|
1448
|
+
replayed: z3.boolean(),
|
|
1449
|
+
workspace: workspaceSchema.optional()
|
|
1450
|
+
}).strict(), body, operation3);
|
|
1451
|
+
if (response.operation.operation_id.toLowerCase() !== operation3.toLowerCase() || response.operation.action !== intent.action) throw new Error("foreign operation");
|
|
1452
|
+
if (intent.action === "workspace.create" && (!("workspace" in response.operation.result) || JSON.stringify(response.workspace) !== JSON.stringify(response.operation.result.workspace))) throw new Error("foreign workspace");
|
|
1453
|
+
if (intent.action !== "workspace.create" && (!("invite" in response.operation.result) || response.operation.result.invite.id.toLowerCase() !== intent.inviteId.toLowerCase())) throw new Error("foreign invite");
|
|
1454
|
+
return {
|
|
1455
|
+
operation: response.operation,
|
|
1456
|
+
replayed: response.replayed
|
|
1457
|
+
};
|
|
1458
|
+
} catch {
|
|
1459
|
+
throw new AccountMutationError(operation3);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
async select(workspaceId) {
|
|
1463
|
+
await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/select`, "team:read", success);
|
|
1464
|
+
}
|
|
1465
|
+
async members(workspaceId) {
|
|
1466
|
+
return this.call("GET", `/workspaces/${id2.parse(workspaceId)}/members`, "team:read", membersResponse);
|
|
1467
|
+
}
|
|
1468
|
+
async updateMember(workspaceId, memberId, role2) {
|
|
1469
|
+
await this.call("PATCH", `/workspaces/${id2.parse(workspaceId)}/members/${id2.parse(memberId)}`, "team:manage", success, {
|
|
1470
|
+
member_role: workspaceInviteRoleSchema.parse(role2)
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
async membershipOperation(workspaceId, operationId) {
|
|
1474
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId);
|
|
1475
|
+
const response = await this.call("GET", `/workspaces/${ws}/membership-operations/${op}`, "team:manage", z3.discriminatedUnion("state", [
|
|
1476
|
+
z3.object({
|
|
1477
|
+
success: z3.literal(true),
|
|
1478
|
+
state: z3.literal("not-observed"),
|
|
1479
|
+
operation: z3.null()
|
|
1480
|
+
}).strict(),
|
|
1481
|
+
z3.object({
|
|
1482
|
+
success: z3.literal(true),
|
|
1483
|
+
state: z3.literal("committed"),
|
|
1484
|
+
operation: membershipCommittedSchema,
|
|
1485
|
+
delivery: membershipDeliverySchema.optional()
|
|
1486
|
+
}).strict(),
|
|
1487
|
+
z3.object({
|
|
1488
|
+
success: z3.literal(true),
|
|
1489
|
+
state: z3.literal("rejected"),
|
|
1490
|
+
operation: membershipRejectedSchema
|
|
1491
|
+
}).strict(),
|
|
1492
|
+
z3.object({
|
|
1493
|
+
success: z3.literal(true),
|
|
1494
|
+
state: z3.literal("abandoned"),
|
|
1495
|
+
operation: membershipAbandonedSchema
|
|
1496
|
+
}).strict()
|
|
1497
|
+
]));
|
|
1498
|
+
if (response.state === "not-observed") return {
|
|
1499
|
+
state: response.state,
|
|
1500
|
+
operation: null
|
|
1501
|
+
};
|
|
1502
|
+
assertMembershipOperation(ws, op, response.operation);
|
|
1503
|
+
if (response.state === "abandoned") return {
|
|
1504
|
+
state: response.state,
|
|
1505
|
+
operation: response.operation
|
|
1506
|
+
};
|
|
1507
|
+
if (response.state === "committed" && response.delivery && (!("delivery" in response.operation.result) || response.operation.result.delivery.id !== response.delivery.id)) throw new AccountError({
|
|
1508
|
+
code: "INVALID_RESPONSE",
|
|
1509
|
+
message: "Foreign invitation delivery state."
|
|
1510
|
+
});
|
|
1511
|
+
return response.state === "committed" ? {
|
|
1512
|
+
state: response.state,
|
|
1513
|
+
operation: response.operation,
|
|
1514
|
+
...response.delivery ? {
|
|
1515
|
+
delivery: response.delivery
|
|
1516
|
+
} : {}
|
|
1517
|
+
} : {
|
|
1518
|
+
state: response.state,
|
|
1519
|
+
operation: response.operation
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
async mutateMembership(workspaceId, operationId, request) {
|
|
1523
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId), input = membershipMutationSchema.parse(request);
|
|
1524
|
+
const path = input.action === "invite.create" ? "/invites" : "inviteId" in input ? `/invites/${input.inviteId}${input.action === "invite.resend" ? "/resend" : ""}` : "memberId" in input ? `/members/${input.memberId}` : "/owner-transfer";
|
|
1525
|
+
const method = input.action === "member.role" ? "PATCH" : input.action === "invite.revoke" || input.action === "member.remove" ? "DELETE" : "POST";
|
|
1526
|
+
const body = {
|
|
1527
|
+
operation_id: op,
|
|
1528
|
+
...input.action === "invite.create" ? {
|
|
1529
|
+
email: input.email,
|
|
1530
|
+
role: input.role
|
|
1531
|
+
} : input.action === "member.role" ? {
|
|
1532
|
+
member_role: input.role
|
|
1533
|
+
} : input.action === "owner.transfer" ? {
|
|
1534
|
+
new_owner_user_id: input.newOwnerId
|
|
1535
|
+
} : {}
|
|
1536
|
+
};
|
|
1537
|
+
try {
|
|
1538
|
+
const response = await this.call(method, `/workspaces/${ws}${path}`, "team:manage", z3.object({
|
|
1539
|
+
success: z3.literal(true),
|
|
1540
|
+
operation: membershipOperationSchema,
|
|
1541
|
+
replayed: z3.boolean()
|
|
1542
|
+
}).strict(), body);
|
|
1543
|
+
assertMembershipOperation(ws, op, response.operation, input);
|
|
1544
|
+
return {
|
|
1545
|
+
operation: response.operation,
|
|
1546
|
+
replayed: response.replayed
|
|
1547
|
+
};
|
|
1548
|
+
} catch {
|
|
1549
|
+
throw new WorkspaceMembershipMutationError(op);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
/** Explicit user-requested settlement only. A lost ACK remains uncertain; never
|
|
1553
|
+
* synthesize abandonment locally or automatically retry with a new ID. */
|
|
1554
|
+
async abandonMembershipOperation(workspaceId, operationId, request) {
|
|
1555
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId), input = membershipMutationSchema.parse(request);
|
|
1556
|
+
try {
|
|
1557
|
+
const response = await this.call("POST", `/workspaces/${ws}/membership-operations/${op}/abandon`, "team:manage", z3.object({
|
|
1558
|
+
success: z3.literal(true),
|
|
1559
|
+
operation: membershipOperationSchema,
|
|
1560
|
+
replayed: z3.boolean()
|
|
1561
|
+
}).strict(), {
|
|
1562
|
+
request: input
|
|
1563
|
+
});
|
|
1564
|
+
assertMembershipOperation(ws, op, response.operation, input);
|
|
1565
|
+
return {
|
|
1566
|
+
operation: response.operation,
|
|
1567
|
+
replayed: response.replayed
|
|
1568
|
+
};
|
|
1569
|
+
} catch {
|
|
1570
|
+
throw new WorkspaceMembershipMutationError(op);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
async abandonKeyOperation(workspaceId, operationId, request) {
|
|
1574
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId), input = keyMutationSchema.parse(request);
|
|
1575
|
+
const original = {
|
|
1576
|
+
action: input.action,
|
|
1577
|
+
...input.action === "revoke" ? {} : input.input,
|
|
1578
|
+
...input.action === "create" ? {} : {
|
|
1579
|
+
id: input.keyId,
|
|
1580
|
+
expected_revision: input.expectedRevision
|
|
1581
|
+
}
|
|
1582
|
+
};
|
|
1583
|
+
try {
|
|
1584
|
+
const response = await this.call("POST", `/workspaces/${ws}/api-keys/operations/${op}/abandon`, "team:manage", z3.object({
|
|
1585
|
+
success: z3.literal(true),
|
|
1586
|
+
operation: workspaceKeyOperationSchema,
|
|
1587
|
+
replayed: z3.boolean()
|
|
1588
|
+
}).strict(), {
|
|
1589
|
+
request: original
|
|
1590
|
+
});
|
|
1591
|
+
this.assertOperation(ws, op, response.operation);
|
|
1592
|
+
if (response.operation.action !== input.action || response.operation.previous_key_id?.toLowerCase() !== (input.action === "create" ? void 0 : input.keyId.toLowerCase())) throw new Error("Wrong key operation intent");
|
|
1593
|
+
return {
|
|
1594
|
+
operation: response.operation,
|
|
1595
|
+
replayed: response.replayed
|
|
1596
|
+
};
|
|
1597
|
+
} catch {
|
|
1598
|
+
throw new WorkspaceKeyMutationError(op);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
async removeMember(workspaceId, memberId) {
|
|
1602
|
+
await this.call("DELETE", `/workspaces/${id2.parse(workspaceId)}/members/${id2.parse(memberId)}`, "team:manage", success);
|
|
1603
|
+
}
|
|
1604
|
+
async transferOwnership(workspaceId, newOwnerUserId) {
|
|
1605
|
+
await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/owner-transfer`, "team:manage", success, {
|
|
1606
|
+
new_owner_user_id: id2.parse(newOwnerUserId)
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
async invites(workspaceId) {
|
|
1610
|
+
return (await this.call("GET", `/workspaces/${id2.parse(workspaceId)}/invites`, "team:read", invitesResponse)).invites;
|
|
1611
|
+
}
|
|
1612
|
+
async invite(workspaceId, email, role2 = "member") {
|
|
1613
|
+
const body = {
|
|
1614
|
+
email: z3.string().trim().email().parse(email),
|
|
1615
|
+
role: workspaceInviteRoleSchema.parse(role2)
|
|
1616
|
+
};
|
|
1617
|
+
return (await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/invites`, "team:manage", success.extend({
|
|
1618
|
+
invite: workspaceInviteSchema
|
|
1619
|
+
}), body)).invite;
|
|
1620
|
+
}
|
|
1621
|
+
async revokeInvite(workspaceId, inviteId) {
|
|
1622
|
+
await this.call("DELETE", `/workspaces/${id2.parse(workspaceId)}/invites/${id2.parse(inviteId)}`, "team:manage", success);
|
|
1623
|
+
}
|
|
1624
|
+
async resendInvite(workspaceId, inviteId) {
|
|
1625
|
+
await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/invites/${id2.parse(inviteId)}/resend`, "team:manage", success);
|
|
1626
|
+
}
|
|
1627
|
+
async pendingInvites() {
|
|
1628
|
+
return (await this.call("GET", "/workspace-invites", "team:read", invitesResponse)).invites;
|
|
1629
|
+
}
|
|
1630
|
+
async acceptInvite(inviteId) {
|
|
1631
|
+
await this.call("POST", `/workspace-invites/${id2.parse(inviteId)}/accept`, "team:manage", success);
|
|
1632
|
+
}
|
|
1633
|
+
async declineInvite(inviteId) {
|
|
1634
|
+
await this.call("POST", `/workspace-invites/${id2.parse(inviteId)}/decline`, "team:manage", success);
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
// src/workforce.ts
|
|
1639
|
+
import { z as z4 } from "zod";
|
|
1640
|
+
var uuid = z4.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i).transform((value) => value.toLowerCase());
|
|
1641
|
+
var timestamp3 = z4.string().datetime({
|
|
1642
|
+
offset: true
|
|
1643
|
+
});
|
|
1644
|
+
var identifier = z4.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/);
|
|
1645
|
+
var hash = z4.string().regex(/^[a-f0-9]{64}$/);
|
|
1646
|
+
var revision = z4.string().max(19).regex(/^[1-9][0-9]*$/).refine((value) => BigInt(value) <= 9223372036854775807n);
|
|
1647
|
+
var text = /* @__PURE__ */ __name((max, empty = false) => z4.string().max(max).refine((value) => !value.includes("\0") && (empty || Boolean(value.trim())) && new TextEncoder().encode(value).length <= max), "text");
|
|
1648
|
+
var unique = /* @__PURE__ */ __name((items, key) => new Set(items.map(key)).size === items.length, "unique");
|
|
1649
|
+
var workforceOwnerSchema = z4.object({
|
|
1650
|
+
type: z4.enum([
|
|
1651
|
+
"user",
|
|
1652
|
+
"workspace"
|
|
1653
|
+
]),
|
|
1654
|
+
id: uuid
|
|
1655
|
+
}).strict();
|
|
1656
|
+
var skill = z4.object({
|
|
1657
|
+
id: identifier,
|
|
1658
|
+
version: identifier,
|
|
1659
|
+
hash
|
|
1660
|
+
}).strict();
|
|
1661
|
+
var secretReference = z4.object({
|
|
1662
|
+
name: z4.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),
|
|
1663
|
+
ref: uuid
|
|
1664
|
+
}).strict();
|
|
1665
|
+
var contentShape = {
|
|
1666
|
+
instructions: text(32768, true),
|
|
1667
|
+
skills: z4.array(skill).max(64).refine((items) => unique(items, (item) => item.id)),
|
|
1668
|
+
requestedCapabilities: z4.array(identifier).max(64).refine((items) => unique(items, (item) => item)),
|
|
1669
|
+
secretReferences: z4.array(secretReference).max(32).refine((items) => unique(items, (item) => item.name))
|
|
1670
|
+
};
|
|
1671
|
+
var provenance = z4.object({
|
|
1672
|
+
source: z4.enum([
|
|
1673
|
+
"authored",
|
|
1674
|
+
"imported"
|
|
1675
|
+
]),
|
|
1676
|
+
sourceVersion: identifier.optional()
|
|
1677
|
+
}).strict();
|
|
1678
|
+
var license = z4.object({
|
|
1679
|
+
identifier
|
|
1680
|
+
}).strict();
|
|
1681
|
+
var workforceDefinitionSchema = z4.object({
|
|
1682
|
+
schemaVersion: z4.literal(1),
|
|
1683
|
+
...contentShape,
|
|
1684
|
+
secretReferences: contentShape.secretReferences.optional(),
|
|
1685
|
+
provenance: provenance.optional(),
|
|
1686
|
+
license: license.optional()
|
|
1687
|
+
}).strict();
|
|
1688
|
+
var createBase = {
|
|
1689
|
+
operationId: uuid,
|
|
1690
|
+
owner: workforceOwnerSchema,
|
|
1691
|
+
// Equality precondition only: the server authenticates the actor and refuses
|
|
1692
|
+
// a changed account. This field never selects or grants an acting identity.
|
|
1693
|
+
expectedActorAccountId: uuid.optional(),
|
|
1694
|
+
name: text(200).transform((value) => value.trim()),
|
|
1695
|
+
description: text(4096, true).optional()
|
|
1696
|
+
};
|
|
1697
|
+
var workforceCreateResourceSchema = z4.discriminatedUnion("kind", [
|
|
1698
|
+
z4.object({
|
|
1699
|
+
...createBase,
|
|
1700
|
+
kind: z4.literal("agent"),
|
|
1701
|
+
definition: workforceDefinitionSchema
|
|
1702
|
+
}).strict(),
|
|
1703
|
+
z4.object({
|
|
1704
|
+
...createBase,
|
|
1705
|
+
kind: z4.literal("team")
|
|
1706
|
+
}).strict()
|
|
1707
|
+
]);
|
|
1708
|
+
var workforceReadOperationSchema = z4.object({
|
|
1709
|
+
operationId: uuid,
|
|
1710
|
+
owner: workforceOwnerSchema,
|
|
1711
|
+
expectedActorAccountId: uuid.optional()
|
|
1712
|
+
}).strict();
|
|
1713
|
+
var catalogCursor = z4.string().min(1).max(2048).regex(/^[A-Za-z0-9_-]+$/);
|
|
1714
|
+
var workforceListOwnedResourcesSchema = z4.object({
|
|
1715
|
+
owner: workforceOwnerSchema,
|
|
1716
|
+
expectedActorAccountId: uuid,
|
|
1717
|
+
limit: z4.number().int().min(1).max(100).optional(),
|
|
1718
|
+
kind: z4.enum([
|
|
1719
|
+
"agent",
|
|
1720
|
+
"team"
|
|
1721
|
+
]).optional(),
|
|
1722
|
+
status: z4.enum([
|
|
1723
|
+
"active",
|
|
1724
|
+
"archived"
|
|
1725
|
+
]).optional(),
|
|
1726
|
+
cursor: catalogCursor.optional()
|
|
1727
|
+
}).strict();
|
|
1728
|
+
var resource = z4.object({
|
|
1729
|
+
id: uuid,
|
|
1730
|
+
kind: z4.enum([
|
|
1731
|
+
"agent",
|
|
1732
|
+
"team"
|
|
1733
|
+
]),
|
|
1734
|
+
owner: workforceOwnerSchema,
|
|
1735
|
+
createdByUserId: uuid.nullable(),
|
|
1736
|
+
name: text(200),
|
|
1737
|
+
description: text(4096, true),
|
|
1738
|
+
status: z4.enum([
|
|
1739
|
+
"active",
|
|
1740
|
+
"archived"
|
|
1741
|
+
]),
|
|
1742
|
+
revision,
|
|
1743
|
+
createdAt: timestamp3,
|
|
1744
|
+
updatedAt: timestamp3
|
|
1745
|
+
}).strict();
|
|
1746
|
+
var ownedCatalog = z4.object({
|
|
1747
|
+
success: z4.literal(true),
|
|
1748
|
+
schemaVersion: z4.literal(1),
|
|
1749
|
+
scope: z4.literal("owned"),
|
|
1750
|
+
owner: workforceOwnerSchema,
|
|
1751
|
+
items: z4.array(resource).max(100),
|
|
1752
|
+
nextCursor: catalogCursor.nullable()
|
|
1753
|
+
}).strict();
|
|
1754
|
+
var version = z4.object({
|
|
1755
|
+
resourceId: uuid,
|
|
1756
|
+
version: z4.number().int().positive(),
|
|
1757
|
+
schemaVersion: z4.literal(1),
|
|
1758
|
+
content: z4.object(contentShape).strict(),
|
|
1759
|
+
contentHash: hash,
|
|
1760
|
+
provenance: z4.union([
|
|
1761
|
+
provenance,
|
|
1762
|
+
z4.object({}).strict()
|
|
1763
|
+
]),
|
|
1764
|
+
license: z4.union([
|
|
1765
|
+
license,
|
|
1766
|
+
z4.object({}).strict()
|
|
1767
|
+
]),
|
|
1768
|
+
createdByUserId: uuid.nullable(),
|
|
1769
|
+
createdAt: timestamp3
|
|
1770
|
+
}).strict();
|
|
1771
|
+
var operation = z4.object({
|
|
1772
|
+
schemaVersion: z4.literal(1),
|
|
1773
|
+
operationId: uuid,
|
|
1774
|
+
action: z4.literal("agent.resource.create"),
|
|
1775
|
+
state: z4.literal("committed"),
|
|
1776
|
+
owner: workforceOwnerSchema,
|
|
1777
|
+
resourceId: uuid,
|
|
1778
|
+
resourceRevision: revision,
|
|
1779
|
+
agentVersion: z4.number().int().positive().nullable(),
|
|
1780
|
+
committedAt: timestamp3
|
|
1781
|
+
}).strict();
|
|
1782
|
+
var committed = z4.object({
|
|
1783
|
+
success: z4.literal(true),
|
|
1784
|
+
state: z4.literal("committed"),
|
|
1785
|
+
operation,
|
|
1786
|
+
resource: resource.nullable(),
|
|
1787
|
+
version: version.nullable(),
|
|
1788
|
+
replayed: z4.boolean(),
|
|
1789
|
+
resourceAccess: z4.discriminatedUnion("allowed", [
|
|
1790
|
+
z4.object({
|
|
1791
|
+
allowed: z4.literal(true)
|
|
1792
|
+
}).strict(),
|
|
1793
|
+
z4.object({
|
|
1794
|
+
allowed: z4.literal(false),
|
|
1795
|
+
reason: z4.literal("no_access")
|
|
1796
|
+
}).strict()
|
|
1797
|
+
])
|
|
1798
|
+
}).strict();
|
|
1799
|
+
var notObserved = z4.object({
|
|
1800
|
+
success: z4.literal(true),
|
|
1801
|
+
state: z4.literal("not-observed"),
|
|
1802
|
+
operation: z4.null(),
|
|
1803
|
+
resource: z4.null(),
|
|
1804
|
+
version: z4.null(),
|
|
1805
|
+
replayed: z4.literal(false)
|
|
1806
|
+
}).strict();
|
|
1807
|
+
var WorkforceResourceMutationError = class extends AccountError {
|
|
1808
|
+
static {
|
|
1809
|
+
__name(this, "WorkforceResourceMutationError");
|
|
1810
|
+
}
|
|
1811
|
+
operationId;
|
|
1812
|
+
outcome = "uncertain";
|
|
1813
|
+
reason = "mutation_outcome_unverified";
|
|
1814
|
+
source = "client-observation";
|
|
1815
|
+
owner;
|
|
1816
|
+
constructor(operationId, owner, cause) {
|
|
1817
|
+
super({
|
|
1818
|
+
code: cause instanceof AccountError ? cause.code : "PLATFORM_ERROR",
|
|
1819
|
+
message: "Workforce creation acknowledgement is unverified. Read back the same operation before retrying.",
|
|
1820
|
+
httpStatus: cause instanceof AccountError ? cause.httpStatus : null,
|
|
1821
|
+
retryable: false
|
|
1822
|
+
}), this.operationId = operationId;
|
|
1823
|
+
this.name = "WorkforceResourceMutationError";
|
|
1824
|
+
this.owner = Object.freeze({
|
|
1825
|
+
...owner
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
var sameOwner = /* @__PURE__ */ __name((left, right) => left.type === right.type && left.id === right.id, "sameOwner");
|
|
1830
|
+
var invalidResponse = /* @__PURE__ */ __name(() => new AccountError({
|
|
1831
|
+
code: "INVALID_RESPONSE",
|
|
1832
|
+
message: "Invalid workforce operation response."
|
|
1833
|
+
}), "invalidResponse");
|
|
1834
|
+
var invalidInput = /* @__PURE__ */ __name(() => new AccountError({
|
|
1835
|
+
code: "BAD_REQUEST",
|
|
1836
|
+
message: "Invalid workforce operation request."
|
|
1837
|
+
}), "invalidInput");
|
|
1838
|
+
function assertData(value, depth = 0, budget = {
|
|
1839
|
+
remaining: 4096
|
|
1840
|
+
}) {
|
|
1841
|
+
if (--budget.remaining < 0 || depth > 8) throw invalidInput();
|
|
1842
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number") return;
|
|
1843
|
+
if (!value || typeof value !== "object") throw invalidInput();
|
|
1844
|
+
const array = Array.isArray(value);
|
|
1845
|
+
if (array ? Object.getPrototypeOf(value) !== Array.prototype : ![
|
|
1846
|
+
Object.prototype,
|
|
1847
|
+
null
|
|
1848
|
+
].includes(Object.getPrototypeOf(value))) throw invalidInput();
|
|
1849
|
+
const keys = Reflect.ownKeys(value);
|
|
1850
|
+
if (keys.length > 4096 || array && keys.length !== value.length + 1) throw invalidInput();
|
|
1851
|
+
for (const key of keys) {
|
|
1852
|
+
if (array && key === "length") continue;
|
|
1853
|
+
if (typeof key !== "string" || array && !/^(0|[1-9][0-9]*)$/.test(key)) throw invalidInput();
|
|
1854
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
1855
|
+
if (!descriptor.enumerable || !Object.hasOwn(descriptor, "value")) throw invalidInput();
|
|
1856
|
+
assertData(descriptor.value, depth + 1, budget);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
__name(assertData, "assertData");
|
|
1860
|
+
function parseInput(schema, value) {
|
|
1861
|
+
assertData(value);
|
|
1862
|
+
const parsed = schema.safeParse(value);
|
|
1863
|
+
if (!parsed.success) throw invalidInput();
|
|
1864
|
+
if (new TextEncoder().encode(JSON.stringify(parsed.data)).length > 256 * 1024) throw invalidInput();
|
|
1865
|
+
return parsed.data;
|
|
1866
|
+
}
|
|
1867
|
+
__name(parseInput, "parseInput");
|
|
1868
|
+
var WorkforceClient = class {
|
|
1869
|
+
static {
|
|
1870
|
+
__name(this, "WorkforceClient");
|
|
1871
|
+
}
|
|
1872
|
+
transport;
|
|
1873
|
+
authorize;
|
|
1874
|
+
base;
|
|
1875
|
+
constructor(base2, transport, authorize) {
|
|
1876
|
+
this.transport = transport;
|
|
1877
|
+
this.authorize = authorize;
|
|
1878
|
+
const origin = new URL(base2);
|
|
1879
|
+
if (origin.protocol !== "https:" || origin.username || origin.password || origin.search || origin.hash || origin.pathname !== "/") {
|
|
1880
|
+
throw new AccountError({
|
|
1881
|
+
code: "BAD_REQUEST",
|
|
1882
|
+
message: "Workforce API requires an HTTPS origin."
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
this.base = origin.origin;
|
|
1886
|
+
}
|
|
1887
|
+
/** This catalog lists one explicitly owned scope only. It is not an aggregate
|
|
1888
|
+
* of assigned, shared or rented resources and contains no agent definitions. */
|
|
1889
|
+
async listOwnedResources(value) {
|
|
1890
|
+
const input = parseInput(workforceListOwnedResourcesSchema, value);
|
|
1891
|
+
const url = `${this.base}/api/workforce/resources/list`;
|
|
1892
|
+
const raw = await this.transport.request({
|
|
1893
|
+
method: "POST",
|
|
1894
|
+
url,
|
|
1895
|
+
body: input,
|
|
1896
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
1897
|
+
const auth = await this.authorize("POST", url, {
|
|
1898
|
+
scopes: [
|
|
1899
|
+
"workforce:read"
|
|
1900
|
+
],
|
|
1901
|
+
silent: true
|
|
1902
|
+
});
|
|
1903
|
+
if (!auth) throw new AccountError({
|
|
1904
|
+
code: "INVALID_TOKEN",
|
|
1905
|
+
message: "Sign in with workforce read access."
|
|
1906
|
+
});
|
|
1907
|
+
return auth;
|
|
1908
|
+
}, "authorization")
|
|
1909
|
+
});
|
|
1910
|
+
const parsed = ownedCatalog.safeParse(raw);
|
|
1911
|
+
if (!parsed.success) throw invalidResponse();
|
|
1912
|
+
const result = parsed.data;
|
|
1913
|
+
if (!sameOwner(result.owner, input.owner) || result.items.length > (input.limit ?? 50) || !unique(result.items, (item) => item.id) || result.items.some((item) => !sameOwner(item.owner, input.owner) || input.kind !== void 0 && item.kind !== input.kind || item.status !== (input.status ?? "active")) || result.nextCursor !== null && (result.items.length === 0 || result.nextCursor === input.cursor)) throw invalidResponse();
|
|
1914
|
+
return result;
|
|
1915
|
+
}
|
|
1916
|
+
validate(raw, input, creating) {
|
|
1917
|
+
const parsed = (creating ? committed : z4.union([
|
|
1918
|
+
committed,
|
|
1919
|
+
notObserved
|
|
1920
|
+
])).safeParse(raw);
|
|
1921
|
+
if (!parsed.success) throw invalidResponse();
|
|
1922
|
+
const result = parsed.data;
|
|
1923
|
+
if (result.state === "not-observed") return result;
|
|
1924
|
+
const op = result.operation;
|
|
1925
|
+
if (op.operationId !== input.operationId || !sameOwner(op.owner, input.owner)) throw invalidResponse();
|
|
1926
|
+
if (!result.resourceAccess.allowed) {
|
|
1927
|
+
if (result.resource !== null || result.version !== null) throw invalidResponse();
|
|
1928
|
+
return result;
|
|
1929
|
+
}
|
|
1930
|
+
const r = result.resource, v = result.version;
|
|
1931
|
+
if (!r || r.id !== op.resourceId || !sameOwner(r.owner, input.owner) || BigInt(r.revision) < BigInt(op.resourceRevision)) throw invalidResponse();
|
|
1932
|
+
if (r.kind === "team" ? op.agentVersion !== null || v !== null : op.agentVersion === null || !v || v.resourceId !== r.id || v.version !== op.agentVersion) throw invalidResponse();
|
|
1933
|
+
return result;
|
|
1934
|
+
}
|
|
1935
|
+
async createResource(value) {
|
|
1936
|
+
const input = parseInput(workforceCreateResourceSchema, value);
|
|
1937
|
+
let authorizationCompleted = false;
|
|
1938
|
+
try {
|
|
1939
|
+
const url = `${this.base}/api/workforce/resources`;
|
|
1940
|
+
const raw = await this.transport.request({
|
|
1941
|
+
method: "POST",
|
|
1942
|
+
url,
|
|
1943
|
+
body: input,
|
|
1944
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
1945
|
+
const auth = await this.authorize("POST", url, {
|
|
1946
|
+
scopes: [
|
|
1947
|
+
"workforce:manage"
|
|
1948
|
+
],
|
|
1949
|
+
silent: true
|
|
1950
|
+
});
|
|
1951
|
+
if (!auth) throw new AccountError({
|
|
1952
|
+
code: "INVALID_TOKEN",
|
|
1953
|
+
message: "Sign in with workforce management access."
|
|
1954
|
+
});
|
|
1955
|
+
authorizationCompleted = true;
|
|
1956
|
+
return auth;
|
|
1957
|
+
}, "authorization")
|
|
1958
|
+
});
|
|
1959
|
+
const result = this.validate(raw, input, true);
|
|
1960
|
+
if (result.resource && result.resource.kind !== input.kind) throw invalidResponse();
|
|
1961
|
+
if (input.kind === "agent" !== (result.operation.agentVersion !== null)) throw invalidResponse();
|
|
1962
|
+
return result;
|
|
1963
|
+
} catch (error) {
|
|
1964
|
+
if (!authorizationCompleted) throw error;
|
|
1965
|
+
throw new WorkforceResourceMutationError(input.operationId, input.owner, error);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
async readOperation(value) {
|
|
1969
|
+
const input = parseInput(workforceReadOperationSchema, value);
|
|
1970
|
+
const url = `${this.base}/api/workforce/resource-operations/read`;
|
|
1971
|
+
const raw = await this.transport.request({
|
|
1972
|
+
method: "POST",
|
|
1973
|
+
url,
|
|
1974
|
+
body: input,
|
|
1975
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
1976
|
+
const auth = await this.authorize("POST", url, {
|
|
1977
|
+
scopes: [
|
|
1978
|
+
"workforce:read"
|
|
1979
|
+
],
|
|
1980
|
+
silent: true
|
|
1981
|
+
});
|
|
1982
|
+
if (!auth) throw new AccountError({
|
|
1983
|
+
code: "INVALID_TOKEN",
|
|
1984
|
+
message: "Sign in with workforce read access."
|
|
1985
|
+
});
|
|
1986
|
+
return auth;
|
|
1987
|
+
}, "authorization")
|
|
1988
|
+
});
|
|
1989
|
+
return this.validate(raw, input, false);
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
|
|
1993
|
+
// src/notifications.ts
|
|
1994
|
+
import { z as z5 } from "zod";
|
|
1995
|
+
var id3 = z5.string().uuid();
|
|
1996
|
+
var localId = z5.string().regex(/^[a-z0-9_:-]{1,240}$/i);
|
|
1997
|
+
var timestamp4 = z5.string().datetime({
|
|
1998
|
+
offset: true
|
|
1999
|
+
});
|
|
2000
|
+
var revision2 = z5.union([
|
|
2001
|
+
z5.literal("0"),
|
|
2002
|
+
id3
|
|
2003
|
+
]);
|
|
2004
|
+
var httpsUrl = z5.string().max(2048).url().refine((value) => {
|
|
2005
|
+
const parsed = new URL(value);
|
|
2006
|
+
return parsed.protocol === "https:" && !parsed.username && !parsed.password && !parsed.hash;
|
|
2007
|
+
}, "Notification destinations require credential-free HTTPS URLs");
|
|
2008
|
+
var notificationEventSchema = z5.enum([
|
|
2009
|
+
"agent.finished",
|
|
2010
|
+
"agent.failed",
|
|
2011
|
+
"agent.cancelled"
|
|
2012
|
+
]);
|
|
2013
|
+
var notificationChannelSchema = z5.enum([
|
|
2014
|
+
"webhook",
|
|
2015
|
+
"slack",
|
|
2016
|
+
"discord"
|
|
2017
|
+
]);
|
|
2018
|
+
var notificationScopeSchema = z5.object({
|
|
2019
|
+
workspaceId: localId,
|
|
2020
|
+
workspaceCreatedAt: timestamp4.transform((value) => new Date(value).toISOString()),
|
|
2021
|
+
teamId: localId.optional(),
|
|
2022
|
+
agentId: localId.optional()
|
|
2023
|
+
}).strict().refine((scope) => !scope.agentId || !!scope.teamId, "Agent requires owning team");
|
|
2024
|
+
var notificationRuleSchema = z5.object({
|
|
2025
|
+
id: z5.string().regex(/^[a-f0-9]{64}$/).optional(),
|
|
2026
|
+
event: notificationEventSchema,
|
|
2027
|
+
channel: notificationChannelSchema,
|
|
2028
|
+
destinationId: id3,
|
|
2029
|
+
enabled: z5.boolean()
|
|
2030
|
+
}).strict();
|
|
2031
|
+
var deliverySchema = z5.object({
|
|
2032
|
+
id: id3,
|
|
2033
|
+
destination_id: id3,
|
|
2034
|
+
event: notificationEventSchema,
|
|
2035
|
+
state: z5.enum([
|
|
2036
|
+
"queued",
|
|
2037
|
+
"leased",
|
|
2038
|
+
"delivered",
|
|
2039
|
+
"failed",
|
|
2040
|
+
"cancelled"
|
|
2041
|
+
]),
|
|
2042
|
+
attempt: z5.number().int().nonnegative(),
|
|
2043
|
+
max_attempts: z5.number().int().positive(),
|
|
2044
|
+
status_code: z5.number().int().min(100).max(599).nullable().optional(),
|
|
2045
|
+
error_code: z5.string().max(128).nullable().optional(),
|
|
2046
|
+
created_at: timestamp4,
|
|
2047
|
+
delivered_at: timestamp4.nullable().optional(),
|
|
2048
|
+
next_retry_at: timestamp4.nullable().optional(),
|
|
2049
|
+
cancelled_at: timestamp4.nullable().optional()
|
|
2050
|
+
});
|
|
2051
|
+
var notificationSettingsDestinationSchema = z5.object({
|
|
2052
|
+
id: id3,
|
|
2053
|
+
label: z5.string().min(1).max(253).refine((value) => value === "Unavailable webhook" || /^[a-z0-9.:[\]-]+$/i.test(value)),
|
|
2054
|
+
channel: notificationChannelSchema,
|
|
2055
|
+
ready: z5.boolean(),
|
|
2056
|
+
enabled: z5.boolean(),
|
|
2057
|
+
updated_at: timestamp4
|
|
2058
|
+
}).strict().transform(({ updated_at, ...value }) => ({
|
|
2059
|
+
...value,
|
|
2060
|
+
updatedAt: updated_at
|
|
2061
|
+
}));
|
|
2062
|
+
var notificationSettingsSchema = z5.object({
|
|
2063
|
+
success: z5.literal(true),
|
|
2064
|
+
channelVersion: z5.literal(2),
|
|
2065
|
+
revision: revision2,
|
|
2066
|
+
rules: z5.array(notificationRuleSchema).max(20),
|
|
2067
|
+
destinations: z5.array(notificationSettingsDestinationSchema),
|
|
2068
|
+
deliveries: z5.array(deliverySchema).max(50),
|
|
2069
|
+
channels: z5.array(z5.object({
|
|
2070
|
+
id: z5.enum([
|
|
2071
|
+
"webhook",
|
|
2072
|
+
"email",
|
|
2073
|
+
"slack",
|
|
2074
|
+
"discord"
|
|
2075
|
+
]),
|
|
2076
|
+
available: z5.boolean()
|
|
2077
|
+
})),
|
|
2078
|
+
digestFrequencies: z5.tuple([
|
|
2079
|
+
z5.literal("realtime")
|
|
2080
|
+
])
|
|
2081
|
+
});
|
|
2082
|
+
var eventInputSchema = z5.object({
|
|
2083
|
+
eventId: z5.string().regex(/^[a-f0-9]{64}$/),
|
|
2084
|
+
event: notificationEventSchema,
|
|
2085
|
+
occurredAt: timestamp4.transform((value) => new Date(value).toISOString()),
|
|
2086
|
+
scope: notificationScopeSchema,
|
|
2087
|
+
conversationId: localId,
|
|
2088
|
+
requestId: localId
|
|
2089
|
+
}).strict();
|
|
2090
|
+
var notificationDestinationActionSchema = z5.discriminatedUnion("action", [
|
|
2091
|
+
z5.object({
|
|
2092
|
+
action: z5.literal("create"),
|
|
2093
|
+
url: httpsUrl
|
|
2094
|
+
}).strict(),
|
|
2095
|
+
z5.object({
|
|
2096
|
+
action: z5.literal("update"),
|
|
2097
|
+
destination_id: id3,
|
|
2098
|
+
expected_updated_at: timestamp4,
|
|
2099
|
+
url: httpsUrl.optional(),
|
|
2100
|
+
enabled: z5.boolean().optional()
|
|
2101
|
+
}).strict().refine((value) => value.url !== void 0 || value.enabled !== void 0, "An update requires a changed field"),
|
|
2102
|
+
z5.object({
|
|
2103
|
+
action: z5.literal("delete"),
|
|
2104
|
+
destination_id: id3,
|
|
2105
|
+
expected_updated_at: timestamp4
|
|
2106
|
+
}).strict(),
|
|
2107
|
+
z5.object({
|
|
2108
|
+
action: z5.literal("delivery-control"),
|
|
2109
|
+
destination_id: id3,
|
|
2110
|
+
delivery_id: id3,
|
|
2111
|
+
operation: z5.enum([
|
|
2112
|
+
"retry",
|
|
2113
|
+
"cancel"
|
|
2114
|
+
])
|
|
2115
|
+
}).strict()
|
|
2116
|
+
]);
|
|
2117
|
+
var notificationDestinationSchema = z5.object({
|
|
2118
|
+
id: id3,
|
|
2119
|
+
label: z5.string().min(1).max(253),
|
|
2120
|
+
channel: z5.literal("webhook"),
|
|
2121
|
+
ready: z5.boolean(),
|
|
2122
|
+
enabled: z5.boolean(),
|
|
2123
|
+
updated_at: timestamp4
|
|
2124
|
+
}).strict();
|
|
2125
|
+
var notificationDeliveryOperationResultSchema = z5.object({
|
|
2126
|
+
id: id3,
|
|
2127
|
+
state: z5.string().min(1).max(64),
|
|
2128
|
+
attempt: z5.number().int().nonnegative(),
|
|
2129
|
+
max_attempts: z5.number().int().positive()
|
|
2130
|
+
}).strict();
|
|
2131
|
+
var notificationDestinationOperationSchema = z5.object({
|
|
2132
|
+
operation_id: id3,
|
|
2133
|
+
workspace_id: id3,
|
|
2134
|
+
actor_user_id: id3,
|
|
2135
|
+
client_id: z5.string().min(1).max(128),
|
|
2136
|
+
action: z5.enum([
|
|
2137
|
+
"create",
|
|
2138
|
+
"update",
|
|
2139
|
+
"delete",
|
|
2140
|
+
"delivery-control"
|
|
2141
|
+
]),
|
|
2142
|
+
state: z5.enum([
|
|
2143
|
+
"prepared",
|
|
2144
|
+
"committed",
|
|
2145
|
+
"rejected"
|
|
2146
|
+
]),
|
|
2147
|
+
prepared_at: timestamp4,
|
|
2148
|
+
committed_at: timestamp4.optional(),
|
|
2149
|
+
destination: notificationDestinationSchema.optional(),
|
|
2150
|
+
delivery: notificationDeliveryOperationResultSchema.optional(),
|
|
2151
|
+
rejection: z5.enum([
|
|
2152
|
+
"notification_destination_not_found",
|
|
2153
|
+
"notification_destination_generation_conflict",
|
|
2154
|
+
"notification_delivery_transition_unavailable"
|
|
2155
|
+
]).optional()
|
|
2156
|
+
}).strict().superRefine((value, context) => {
|
|
2157
|
+
if (value.state === "rejected" && !value.rejection) context.addIssue({
|
|
2158
|
+
code: "custom",
|
|
2159
|
+
message: "Rejected operation requires a rejection."
|
|
2160
|
+
});
|
|
2161
|
+
if (value.state === "committed" && !value.committed_at) context.addIssue({
|
|
2162
|
+
code: "custom",
|
|
2163
|
+
message: "Committed operation requires a timestamp."
|
|
2164
|
+
});
|
|
2165
|
+
});
|
|
2166
|
+
var destinationOperationMutationResponseSchema = z5.object({
|
|
2167
|
+
state: z5.enum([
|
|
2168
|
+
"prepared",
|
|
2169
|
+
"committed",
|
|
2170
|
+
"rejected"
|
|
2171
|
+
]),
|
|
2172
|
+
operation: notificationDestinationOperationSchema,
|
|
2173
|
+
replayed: z5.boolean()
|
|
2174
|
+
}).strict();
|
|
2175
|
+
var destinationOperationLookupResponseSchema = z5.union([
|
|
2176
|
+
z5.object({
|
|
2177
|
+
state: z5.literal("not-observed"),
|
|
2178
|
+
operation: z5.null()
|
|
2179
|
+
}).strict(),
|
|
2180
|
+
z5.object({
|
|
2181
|
+
state: z5.enum([
|
|
2182
|
+
"prepared",
|
|
2183
|
+
"committed",
|
|
2184
|
+
"rejected"
|
|
2185
|
+
]),
|
|
2186
|
+
operation: notificationDestinationOperationSchema
|
|
2187
|
+
}).strict()
|
|
2188
|
+
]);
|
|
2189
|
+
var destinationOperationExecuteResponseSchema = destinationOperationMutationResponseSchema.extend({
|
|
2190
|
+
secret: z5.string().regex(/^[a-f0-9]{64}$/).optional()
|
|
2191
|
+
}).strict();
|
|
2192
|
+
var NotificationsClient = class {
|
|
2193
|
+
static {
|
|
2194
|
+
__name(this, "NotificationsClient");
|
|
2195
|
+
}
|
|
2196
|
+
transport;
|
|
2197
|
+
authorize;
|
|
2198
|
+
origin;
|
|
2199
|
+
constructor(origin, transport, authorize) {
|
|
2200
|
+
this.transport = transport;
|
|
2201
|
+
this.authorize = authorize;
|
|
2202
|
+
const url = new URL(origin);
|
|
2203
|
+
if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash || url.pathname !== "/") throw new AccountError({
|
|
2204
|
+
code: "BAD_REQUEST",
|
|
2205
|
+
message: "Notifications API requires an HTTPS origin."
|
|
2206
|
+
});
|
|
2207
|
+
this.origin = url.origin;
|
|
2208
|
+
}
|
|
2209
|
+
async call(workspaceId, method, suffix, schema, body) {
|
|
2210
|
+
const url = `${this.origin}/api/workspaces/${id3.parse(workspaceId)}/notifications${suffix}`;
|
|
2211
|
+
const response = await this.transport.request({
|
|
2212
|
+
method,
|
|
2213
|
+
url,
|
|
2214
|
+
...body === void 0 ? {} : {
|
|
2215
|
+
body
|
|
2216
|
+
},
|
|
2217
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
2218
|
+
const value = await this.authorize(method, url, {
|
|
2219
|
+
scopes: [
|
|
2220
|
+
method === "GET" ? "team:read" : "team:manage"
|
|
2221
|
+
],
|
|
2222
|
+
silent: true
|
|
2223
|
+
});
|
|
2224
|
+
if (!value) throw new AccountError({
|
|
2225
|
+
code: "INVALID_TOKEN",
|
|
2226
|
+
message: "Sign in to manage notifications."
|
|
2227
|
+
});
|
|
2228
|
+
return value;
|
|
2229
|
+
}, "authorization")
|
|
2230
|
+
});
|
|
2231
|
+
const parsed = schema.safeParse(response);
|
|
2232
|
+
if (!parsed.success) throw new AccountError({
|
|
2233
|
+
code: "INVALID_RESPONSE",
|
|
2234
|
+
message: "Invalid notification response."
|
|
2235
|
+
});
|
|
2236
|
+
return parsed.data;
|
|
2237
|
+
}
|
|
2238
|
+
read(workspaceId, scope) {
|
|
2239
|
+
return this.call(workspaceId, "GET", `/v2?scope=${encodeURIComponent(JSON.stringify(notificationScopeSchema.parse(scope)))}`, notificationSettingsSchema);
|
|
2240
|
+
}
|
|
2241
|
+
save(workspaceId, input) {
|
|
2242
|
+
const body = z5.object({
|
|
2243
|
+
scope: notificationScopeSchema,
|
|
2244
|
+
expectedRevision: revision2,
|
|
2245
|
+
rules: z5.array(notificationRuleSchema).max(20)
|
|
2246
|
+
}).strict().parse(input);
|
|
2247
|
+
return this.call(workspaceId, "POST", "/v2/settings", notificationSettingsSchema, body);
|
|
2248
|
+
}
|
|
2249
|
+
emit(workspaceId, input) {
|
|
2250
|
+
return this.call(workspaceId, "POST", "/events", z5.object({
|
|
2251
|
+
success: z5.literal(true),
|
|
2252
|
+
admitted: z5.literal(true),
|
|
2253
|
+
duplicate: z5.boolean()
|
|
2254
|
+
}), eventInputSchema.parse(input));
|
|
2255
|
+
}
|
|
2256
|
+
async prepareDestinationOperation(workspaceId, operationId, action) {
|
|
2257
|
+
const workspace = id3.parse(workspaceId), operation3 = id3.parse(operationId), request = notificationDestinationActionSchema.parse(action);
|
|
2258
|
+
const result = await this.call(workspace, "PUT", `/destination-operations/${operation3}`, destinationOperationMutationResponseSchema, request);
|
|
2259
|
+
if (result.operation.operation_id !== operation3 || result.operation.workspace_id !== workspace || result.operation.action !== request.action || result.operation.state !== result.state) throw new AccountError({
|
|
2260
|
+
code: "INVALID_RESPONSE",
|
|
2261
|
+
message: "Mismatched notification operation receipt."
|
|
2262
|
+
});
|
|
2263
|
+
return result;
|
|
2264
|
+
}
|
|
2265
|
+
async lookupDestinationOperation(workspaceId, operationId) {
|
|
2266
|
+
const workspace = id3.parse(workspaceId), operation3 = id3.parse(operationId);
|
|
2267
|
+
const result = await this.call(workspace, "GET", `/destination-operations/${operation3}`, destinationOperationLookupResponseSchema);
|
|
2268
|
+
if (result.operation && (result.operation.operation_id !== operation3 || result.operation.workspace_id !== workspace || result.operation.state !== result.state)) throw new AccountError({
|
|
2269
|
+
code: "INVALID_RESPONSE",
|
|
2270
|
+
message: "Mismatched notification operation receipt."
|
|
2271
|
+
});
|
|
2272
|
+
return result;
|
|
2273
|
+
}
|
|
2274
|
+
async executeDestinationOperation(workspaceId, operationId) {
|
|
2275
|
+
const workspace = id3.parse(workspaceId), operation3 = id3.parse(operationId);
|
|
2276
|
+
const result = await this.call(workspace, "POST", `/destination-operations/${operation3}`, destinationOperationExecuteResponseSchema);
|
|
2277
|
+
if (result.operation.operation_id !== operation3 || result.operation.workspace_id !== workspace || result.operation.state !== result.state || result.secret !== void 0 && (result.operation.action !== "create" || result.state !== "committed" || result.replayed)) throw new AccountError({
|
|
2278
|
+
code: "INVALID_RESPONSE",
|
|
2279
|
+
message: "Mismatched notification operation receipt."
|
|
2280
|
+
});
|
|
2281
|
+
return result;
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
// src/integrations.ts
|
|
2286
|
+
import { z as z6 } from "zod";
|
|
2287
|
+
var id4 = z6.string().uuid();
|
|
2288
|
+
var provider = z6.enum([
|
|
2289
|
+
"google",
|
|
2290
|
+
"github",
|
|
2291
|
+
"twitter"
|
|
2292
|
+
]);
|
|
2293
|
+
var linked = z6.object({
|
|
2294
|
+
provider,
|
|
2295
|
+
email: z6.string().email().nullable(),
|
|
2296
|
+
username: z6.string().nullable(),
|
|
2297
|
+
created_at: z6.string().datetime({
|
|
2298
|
+
offset: true
|
|
2299
|
+
}).optional()
|
|
2300
|
+
}).passthrough();
|
|
2301
|
+
var integration = z6.object({
|
|
2302
|
+
provider,
|
|
2303
|
+
available: z6.boolean(),
|
|
2304
|
+
scopes: z6.array(z6.string().min(1)).max(16),
|
|
2305
|
+
linked: linked.nullable()
|
|
2306
|
+
}).strict();
|
|
2307
|
+
var operation2 = z6.object({
|
|
2308
|
+
operationId: id4,
|
|
2309
|
+
actorAccountId: id4.optional(),
|
|
2310
|
+
clientId: z6.string().optional(),
|
|
2311
|
+
provider: provider.optional(),
|
|
2312
|
+
scopes: z6.array(z6.string()).optional(),
|
|
2313
|
+
state: z6.enum([
|
|
2314
|
+
"not-observed",
|
|
2315
|
+
"waiting",
|
|
2316
|
+
"exchanging",
|
|
2317
|
+
"committed",
|
|
2318
|
+
"rejected",
|
|
2319
|
+
"cancelled"
|
|
2320
|
+
]),
|
|
2321
|
+
authorizationUrl: z6.string().url().optional(),
|
|
2322
|
+
expiresAt: z6.string().datetime({
|
|
2323
|
+
offset: true
|
|
2324
|
+
}).optional(),
|
|
2325
|
+
linked: linked.optional(),
|
|
2326
|
+
rejection: z6.string().optional(),
|
|
2327
|
+
replayed: z6.boolean().optional()
|
|
2328
|
+
}).strict();
|
|
2329
|
+
var AccountIntegrationClient = class {
|
|
2330
|
+
static {
|
|
2331
|
+
__name(this, "AccountIntegrationClient");
|
|
2332
|
+
}
|
|
2333
|
+
transport;
|
|
2334
|
+
authorize;
|
|
2335
|
+
base;
|
|
2336
|
+
constructor(base2, transport, authorize) {
|
|
2337
|
+
this.transport = transport;
|
|
2338
|
+
this.authorize = authorize;
|
|
2339
|
+
this.base = new URL(base2).origin;
|
|
2340
|
+
}
|
|
2341
|
+
async call(method, path, schema, body, idempotencyKey) {
|
|
2342
|
+
const url = `${this.base}/api/account-integrations${path}`, raw = await this.transport.request({
|
|
2343
|
+
method,
|
|
2344
|
+
url,
|
|
2345
|
+
...body === void 0 ? {} : {
|
|
2346
|
+
body
|
|
2347
|
+
},
|
|
2348
|
+
...idempotencyKey ? {
|
|
2349
|
+
idempotencyKey
|
|
2350
|
+
} : {},
|
|
2351
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
2352
|
+
const value = await this.authorize(method, url, {
|
|
2353
|
+
scopes: [
|
|
2354
|
+
"openid"
|
|
2355
|
+
],
|
|
2356
|
+
silent: true
|
|
2357
|
+
});
|
|
2358
|
+
if (!value) throw new AccountError({
|
|
2359
|
+
code: "INVALID_TOKEN",
|
|
2360
|
+
message: "Sign in to manage account integrations."
|
|
2361
|
+
});
|
|
2362
|
+
return value;
|
|
2363
|
+
}, "authorization")
|
|
2364
|
+
});
|
|
2365
|
+
const parsed = schema.safeParse(raw);
|
|
2366
|
+
if (!parsed.success) throw new AccountError({
|
|
2367
|
+
code: "INVALID_RESPONSE",
|
|
2368
|
+
message: "Invalid account integration response."
|
|
2369
|
+
});
|
|
2370
|
+
return parsed.data;
|
|
2371
|
+
}
|
|
2372
|
+
async list() {
|
|
2373
|
+
return (await this.call("GET", "", z6.object({
|
|
2374
|
+
success: z6.literal(true),
|
|
2375
|
+
providers: z6.array(integration)
|
|
2376
|
+
}).strict())).providers;
|
|
2377
|
+
}
|
|
2378
|
+
async operation(operationId) {
|
|
2379
|
+
return (await this.call("GET", `/operations/${id4.parse(operationId)}`, z6.object({
|
|
2380
|
+
success: z6.literal(true),
|
|
2381
|
+
operation: operation2
|
|
2382
|
+
}).strict())).operation;
|
|
2383
|
+
}
|
|
2384
|
+
async start(operationId, value) {
|
|
2385
|
+
const operationIdValue = id4.parse(operationId), result = (await this.call("POST", `/${provider.parse(value)}/operations/${operationIdValue}/start`, z6.object({
|
|
2386
|
+
success: z6.literal(true),
|
|
2387
|
+
operation: operation2
|
|
2388
|
+
}).strict(), {}, operationIdValue)).operation;
|
|
2389
|
+
if (result.operationId !== operationIdValue || result.provider !== value || result.state !== "waiting" || !result.authorizationUrl) throw new AccountError({
|
|
2390
|
+
code: "INVALID_RESPONSE",
|
|
2391
|
+
message: "Invalid provider authorization operation."
|
|
2392
|
+
});
|
|
2393
|
+
const url = new URL(result.authorizationUrl);
|
|
2394
|
+
if (url.protocol !== "https:" || url.username || url.password) throw new AccountError({
|
|
2395
|
+
code: "INVALID_RESPONSE",
|
|
2396
|
+
message: "Untrusted provider authorization URL."
|
|
2397
|
+
});
|
|
2398
|
+
return result;
|
|
2399
|
+
}
|
|
2400
|
+
async cancel(operationId) {
|
|
2401
|
+
return (await this.call("POST", `/operations/${id4.parse(operationId)}/cancel`, z6.object({
|
|
2402
|
+
success: z6.literal(true),
|
|
2403
|
+
operation: operation2
|
|
2404
|
+
}).strict(), {})).operation;
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
|
|
761
2408
|
// src/verification.ts
|
|
762
2409
|
var jwksCache = /* @__PURE__ */ new Map();
|
|
763
2410
|
function bytes(value) {
|
|
@@ -925,11 +2572,11 @@ function base64url(bytes2) {
|
|
|
925
2572
|
}
|
|
926
2573
|
__name(base64url, "base64url");
|
|
927
2574
|
function endpoints(cfg) {
|
|
928
|
-
const
|
|
2575
|
+
const base2 = cfg.issuer.replace(/\/+$/, "");
|
|
929
2576
|
return {
|
|
930
|
-
authorize: cfg.authorizeUrl ?? `${
|
|
931
|
-
token: cfg.tokenUrl ?? `${
|
|
932
|
-
device: cfg.deviceAuthorizationUrl ?? `${
|
|
2577
|
+
authorize: cfg.authorizeUrl ?? `${base2}/api/oauth2/authorize`,
|
|
2578
|
+
token: cfg.tokenUrl ?? `${base2}/api/oauth2/token`,
|
|
2579
|
+
device: cfg.deviceAuthorizationUrl ?? `${base2}/api/oauth2/device_authorization`
|
|
933
2580
|
};
|
|
934
2581
|
}
|
|
935
2582
|
__name(endpoints, "endpoints");
|
|
@@ -1215,6 +2862,8 @@ var XenoAccountClient = class {
|
|
|
1215
2862
|
ledger;
|
|
1216
2863
|
authz;
|
|
1217
2864
|
oidcConfig;
|
|
2865
|
+
issuer;
|
|
2866
|
+
authorities = {};
|
|
1218
2867
|
transport;
|
|
1219
2868
|
store;
|
|
1220
2869
|
apiKey;
|
|
@@ -1240,10 +2889,30 @@ var XenoAccountClient = class {
|
|
|
1240
2889
|
this.account = new AccountClient(cfg.issuer, this.transport);
|
|
1241
2890
|
this.ledger = new LedgerClient(cfg.apiBase, this.transport);
|
|
1242
2891
|
this.authz = new AuthzClient(cfg.apiBase, this.transport);
|
|
2892
|
+
this.issuer = cfg.issuer;
|
|
1243
2893
|
this.store = cfg.store ?? memoryStore();
|
|
1244
2894
|
this.apiKey = cfg.apiKey ?? (typeof process !== "undefined" ? process.env?.XENO_API_KEY : void 0) ?? void 0;
|
|
1245
2895
|
this.broker = cfg.broker;
|
|
1246
2896
|
}
|
|
2897
|
+
// ─── Workspace, workforce, notification and integration authorities ───────
|
|
2898
|
+
//
|
|
2899
|
+
// They live on the issuer origin and authorise every request through `authorization()`, so each
|
|
2900
|
+
// attempt carries its own sender-constrained proof for its exact method and URL. Each is built on
|
|
2901
|
+
// first use: the workspace-line authorities refuse a non-HTTPS or path-bearing origin, and that
|
|
2902
|
+
// refusal belongs to the caller who uses them, not to every client constructed for local
|
|
2903
|
+
// development or for ledger-only use.
|
|
2904
|
+
get workspaces() {
|
|
2905
|
+
return this.authorities.workspaces ??= new WorkspaceClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
2906
|
+
}
|
|
2907
|
+
get workforce() {
|
|
2908
|
+
return this.authorities.workforce ??= new WorkforceClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
2909
|
+
}
|
|
2910
|
+
get notifications() {
|
|
2911
|
+
return this.authorities.notifications ??= new NotificationsClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
2912
|
+
}
|
|
2913
|
+
get integrations() {
|
|
2914
|
+
return this.authorities.integrations ??= new AccountIntegrationClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
2915
|
+
}
|
|
1247
2916
|
// ─── Session workhorse (priority chain, XENO AUTH §5) ───────────────────
|
|
1248
2917
|
/**
|
|
1249
2918
|
* Return a valid Bearer for the gate, walking the chain:
|
|
@@ -1289,7 +2958,7 @@ var XenoAccountClient = class {
|
|
|
1289
2958
|
if (!opts.silent && this.interactive) await this.resolveInteractive(opts.scopes, generation);
|
|
1290
2959
|
return;
|
|
1291
2960
|
}
|
|
1292
|
-
const pending = await this.storeRead(this.refreshPendingKey);
|
|
2961
|
+
const pending = await this.storeRead(this.refreshPendingKey) ?? await this.legacyRefreshMarker();
|
|
1293
2962
|
if (this.generation !== generation) return;
|
|
1294
2963
|
const interruptedRotation = abandonedRotation(pending);
|
|
1295
2964
|
if (pending && !interruptedRotation && !/^ready:v1:[A-Za-z0-9_-]{32}$/.test(pending)) {
|
|
@@ -1508,6 +3177,17 @@ var XenoAccountClient = class {
|
|
|
1508
3177
|
}
|
|
1509
3178
|
}
|
|
1510
3179
|
}
|
|
3180
|
+
/**
|
|
3181
|
+
* The 0.2.0 workforce builds (shipped vendored, never published) marked an in-flight refresh at
|
|
3182
|
+
* `<refresh key>-uncertain` and never named the rotation. An install upgrading with that marker
|
|
3183
|
+
* present may hold a token the origin already rotated, so sending it would be a replay — the
|
|
3184
|
+
* zero-grace reuse that revokes the whole family. It is therefore an unconfirmed transition like any
|
|
3185
|
+
* other v1 marker: refused silently, recoverable only by explicit sign-in (which writes this
|
|
3186
|
+
* version's own marker, after which the legacy one is never consulted again).
|
|
3187
|
+
*/
|
|
3188
|
+
async legacyRefreshMarker() {
|
|
3189
|
+
return await this.storeRead(`${this.refreshStoreKey}-uncertain`) ? "legacy-refresh-uncertain:v1" : null;
|
|
3190
|
+
}
|
|
1511
3191
|
async storeRead(key) {
|
|
1512
3192
|
try {
|
|
1513
3193
|
return await this.store.get(key);
|
|
@@ -1669,9 +3349,9 @@ var XenoAccountClient = class {
|
|
|
1669
3349
|
const transition = await this.reserveSignIn(generation);
|
|
1670
3350
|
if (args.signal?.aborted || this.generation !== generation) throw transitionConflict();
|
|
1671
3351
|
const ts = await exchangeCode(this.oidcConfig, this.transport, args);
|
|
1672
|
-
const
|
|
3352
|
+
const committed2 = await this.applyTokenSet(ts, generation, transition, false, args.signal);
|
|
1673
3353
|
if (this.generation !== generation || args.signal?.aborted) {
|
|
1674
|
-
if (
|
|
3354
|
+
if (committed2 && args.signal?.aborted) await this.cancelCommittedSignIn(committed2);
|
|
1675
3355
|
throw transitionConflict();
|
|
1676
3356
|
}
|
|
1677
3357
|
return ts;
|
|
@@ -1787,9 +3467,9 @@ var XenoAccountClient = class {
|
|
|
1787
3467
|
const transition = await this.reserveSignIn(generation);
|
|
1788
3468
|
if (opts?.signal?.aborted || this.generation !== generation) throw transitionConflict();
|
|
1789
3469
|
const ts = await pollDeviceToken(this.oidcConfig, this.transport, device, opts);
|
|
1790
|
-
const
|
|
3470
|
+
const committed2 = await this.applyTokenSet(ts, generation, transition, false, opts?.signal);
|
|
1791
3471
|
if (this.generation !== generation || opts?.signal?.aborted) {
|
|
1792
|
-
if (
|
|
3472
|
+
if (committed2 && opts?.signal?.aborted) await this.cancelCommittedSignIn(committed2);
|
|
1793
3473
|
throw transitionConflict();
|
|
1794
3474
|
}
|
|
1795
3475
|
return ts;
|
|
@@ -2027,7 +3707,7 @@ function frozenClaims(claims) {
|
|
|
2027
3707
|
__name(frozenClaims, "frozenClaims");
|
|
2028
3708
|
function createResourceRequestAuthorizer(options) {
|
|
2029
3709
|
const issuer = normalizeDpopHtu(options.issuer);
|
|
2030
|
-
if (issuer.replace(/\/$/, "") !== options.issuer || !options.clientIds.length || options.clientIds.length > 128 || options.clientIds.some((
|
|
3710
|
+
if (issuer.replace(/\/$/, "") !== options.issuer || !options.clientIds.length || options.clientIds.length > 128 || options.clientIds.some((id5) => !/^[a-zA-Z0-9._-]{1,128}$/.test(id5)) || new Set(options.clientIds).size !== options.clientIds.length) throw new TypeError("Explicit canonical issuer and unique clients required");
|
|
2031
3711
|
const clients = new Set(options.clientIds);
|
|
2032
3712
|
return {
|
|
2033
3713
|
async authorize(request) {
|
|
@@ -2146,9 +3826,9 @@ function createResourceRequestAuthorizer(options) {
|
|
|
2146
3826
|
}
|
|
2147
3827
|
__name(createResourceRequestAuthorizer, "createResourceRequestAuthorizer");
|
|
2148
3828
|
function createOidcIntrospectionSessionAuthority(options) {
|
|
2149
|
-
const
|
|
3829
|
+
const base2 = new URL(options.issuer);
|
|
2150
3830
|
const timeoutMs = options.timeoutMs ?? 5e3;
|
|
2151
|
-
if (
|
|
3831
|
+
if (base2.origin !== options.issuer || base2.protocol !== "https:" || !Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 3e4) throw new TypeError("Canonical HTTPS issuer and bounded introspection timeout required");
|
|
2152
3832
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2153
3833
|
return async (claims, token) => {
|
|
2154
3834
|
if (token.length > MAX_JWT_BYTES || !token) throw unavailable();
|
|
@@ -2156,7 +3836,7 @@ function createOidcIntrospectionSessionAuthority(options) {
|
|
|
2156
3836
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
2157
3837
|
let response;
|
|
2158
3838
|
try {
|
|
2159
|
-
response = await fetchBeforeAbort(fetchImpl, `${
|
|
3839
|
+
response = await fetchBeforeAbort(fetchImpl, `${base2.origin}/api/oauth2/introspect`, {
|
|
2160
3840
|
method: "POST",
|
|
2161
3841
|
redirect: "error",
|
|
2162
3842
|
cache: "no-store",
|
|
@@ -2185,16 +3865,46 @@ function createOidcIntrospectionSessionAuthority(options) {
|
|
|
2185
3865
|
};
|
|
2186
3866
|
}
|
|
2187
3867
|
__name(createOidcIntrospectionSessionAuthority, "createOidcIntrospectionSessionAuthority");
|
|
3868
|
+
|
|
3869
|
+
// src/index.ts
|
|
3870
|
+
var ACCOUNT_SDK_CONTRACT = Object.freeze({
|
|
3871
|
+
version: 1,
|
|
3872
|
+
workspaceAuthority: 1,
|
|
3873
|
+
workforceResourceOperations: 1,
|
|
3874
|
+
workforceActorBinding: 2,
|
|
3875
|
+
workforceOwnedCatalog: 1,
|
|
3876
|
+
workspaceKeyAuthority: 1,
|
|
3877
|
+
workspaceKeyOperations: 1,
|
|
3878
|
+
workspaceMembershipOperations: 1,
|
|
3879
|
+
workspaceOperationAbandonment: 1,
|
|
3880
|
+
accountOperations: 1,
|
|
3881
|
+
accountIntegrations: 1,
|
|
3882
|
+
notificationAuthority: 1,
|
|
3883
|
+
notificationDestinationOperations: 1,
|
|
3884
|
+
requestBoundAuthorization: 1,
|
|
3885
|
+
serializedRefresh: 1
|
|
3886
|
+
});
|
|
2188
3887
|
export {
|
|
3888
|
+
ACCOUNT_SDK_CONTRACT,
|
|
2189
3889
|
AccountClient,
|
|
2190
3890
|
AccountError,
|
|
3891
|
+
AccountIntegrationClient,
|
|
3892
|
+
AccountMutationError,
|
|
2191
3893
|
AuthzClient,
|
|
2192
3894
|
BffSessionClient,
|
|
2193
3895
|
LedgerClient,
|
|
2194
3896
|
MICRO_PER_CREDIT,
|
|
3897
|
+
NotificationsClient,
|
|
2195
3898
|
Transport,
|
|
3899
|
+
WorkforceClient,
|
|
3900
|
+
WorkforceResourceMutationError,
|
|
3901
|
+
WorkspaceClient,
|
|
3902
|
+
WorkspaceKeyMutationError,
|
|
3903
|
+
WorkspaceMembershipMutationError,
|
|
2196
3904
|
XenoAccountClient,
|
|
3905
|
+
accountOperationIntentSchema,
|
|
2197
3906
|
accountSchema,
|
|
3907
|
+
assertMembershipOperation,
|
|
2198
3908
|
authzCheckSchema,
|
|
2199
3909
|
authzResultSchema,
|
|
2200
3910
|
balanceSchema,
|
|
@@ -2209,10 +3919,23 @@ export {
|
|
|
2209
3919
|
holdRequestSchema,
|
|
2210
3920
|
holdSchema,
|
|
2211
3921
|
keychainStore,
|
|
3922
|
+
membershipAbandonedSchema,
|
|
3923
|
+
membershipCommittedSchema,
|
|
3924
|
+
membershipDeliverySchema,
|
|
3925
|
+
membershipMutationSchema,
|
|
3926
|
+
membershipOperationSchema,
|
|
3927
|
+
membershipRejectedSchema,
|
|
2212
3928
|
memoryStore,
|
|
2213
3929
|
meterAggregationSchema,
|
|
2214
3930
|
normalize,
|
|
2215
3931
|
normalizeDpopHtu,
|
|
3932
|
+
notificationChannelSchema,
|
|
3933
|
+
notificationDestinationActionSchema,
|
|
3934
|
+
notificationDestinationOperationSchema,
|
|
3935
|
+
notificationEventSchema,
|
|
3936
|
+
notificationRuleSchema,
|
|
3937
|
+
notificationScopeSchema,
|
|
3938
|
+
notificationSettingsSchema,
|
|
2216
3939
|
oauthTokenResponseSchema,
|
|
2217
3940
|
pollDeviceToken,
|
|
2218
3941
|
redact,
|
|
@@ -2225,6 +3948,20 @@ export {
|
|
|
2225
3948
|
usageResultSchema,
|
|
2226
3949
|
verifyAccessToken,
|
|
2227
3950
|
verifyIdToken,
|
|
2228
|
-
verifyLogoutToken
|
|
3951
|
+
verifyLogoutToken,
|
|
3952
|
+
workforceCreateResourceSchema,
|
|
3953
|
+
workforceDefinitionSchema,
|
|
3954
|
+
workforceListOwnedResourcesSchema,
|
|
3955
|
+
workforceOwnerSchema,
|
|
3956
|
+
workforceReadOperationSchema,
|
|
3957
|
+
workspaceInviteRoleSchema,
|
|
3958
|
+
workspaceInviteSchema,
|
|
3959
|
+
workspaceKeyOperationSchema,
|
|
3960
|
+
workspaceKeyRejectionSchema,
|
|
3961
|
+
workspaceKeySchema,
|
|
3962
|
+
workspaceKeyScopeSchema,
|
|
3963
|
+
workspaceMemberSchema,
|
|
3964
|
+
workspaceRoleSchema,
|
|
3965
|
+
workspaceSchema
|
|
2229
3966
|
};
|
|
2230
3967
|
//# sourceMappingURL=index.mjs.map
|