@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
|
@@ -21,15 +21,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var src_exports = {};
|
|
23
23
|
__export(src_exports, {
|
|
24
|
+
ACCOUNT_SDK_CONTRACT: () => ACCOUNT_SDK_CONTRACT,
|
|
24
25
|
AccountClient: () => AccountClient,
|
|
25
26
|
AccountError: () => AccountError,
|
|
27
|
+
AccountIntegrationClient: () => AccountIntegrationClient,
|
|
28
|
+
AccountMutationError: () => AccountMutationError,
|
|
26
29
|
AuthzClient: () => AuthzClient,
|
|
27
30
|
BffSessionClient: () => BffSessionClient,
|
|
28
31
|
LedgerClient: () => LedgerClient,
|
|
29
32
|
MICRO_PER_CREDIT: () => MICRO_PER_CREDIT,
|
|
33
|
+
NotificationsClient: () => NotificationsClient,
|
|
30
34
|
Transport: () => Transport,
|
|
35
|
+
WorkforceClient: () => WorkforceClient,
|
|
36
|
+
WorkforceResourceMutationError: () => WorkforceResourceMutationError,
|
|
37
|
+
WorkspaceClient: () => WorkspaceClient,
|
|
38
|
+
WorkspaceKeyMutationError: () => WorkspaceKeyMutationError,
|
|
39
|
+
WorkspaceMembershipMutationError: () => WorkspaceMembershipMutationError,
|
|
31
40
|
XenoAccountClient: () => XenoAccountClient,
|
|
41
|
+
accountOperationIntentSchema: () => accountOperationIntentSchema,
|
|
32
42
|
accountSchema: () => accountSchema,
|
|
43
|
+
assertMembershipOperation: () => assertMembershipOperation,
|
|
33
44
|
authzCheckSchema: () => authzCheckSchema,
|
|
34
45
|
authzResultSchema: () => authzResultSchema,
|
|
35
46
|
balanceSchema: () => balanceSchema,
|
|
@@ -44,10 +55,23 @@ __export(src_exports, {
|
|
|
44
55
|
holdRequestSchema: () => holdRequestSchema,
|
|
45
56
|
holdSchema: () => holdSchema,
|
|
46
57
|
keychainStore: () => keychainStore,
|
|
58
|
+
membershipAbandonedSchema: () => membershipAbandonedSchema,
|
|
59
|
+
membershipCommittedSchema: () => membershipCommittedSchema,
|
|
60
|
+
membershipDeliverySchema: () => membershipDeliverySchema,
|
|
61
|
+
membershipMutationSchema: () => membershipMutationSchema,
|
|
62
|
+
membershipOperationSchema: () => membershipOperationSchema,
|
|
63
|
+
membershipRejectedSchema: () => membershipRejectedSchema,
|
|
47
64
|
memoryStore: () => memoryStore,
|
|
48
65
|
meterAggregationSchema: () => meterAggregationSchema,
|
|
49
66
|
normalize: () => normalize,
|
|
50
67
|
normalizeDpopHtu: () => normalizeDpopHtu,
|
|
68
|
+
notificationChannelSchema: () => notificationChannelSchema,
|
|
69
|
+
notificationDestinationActionSchema: () => notificationDestinationActionSchema,
|
|
70
|
+
notificationDestinationOperationSchema: () => notificationDestinationOperationSchema,
|
|
71
|
+
notificationEventSchema: () => notificationEventSchema,
|
|
72
|
+
notificationRuleSchema: () => notificationRuleSchema,
|
|
73
|
+
notificationScopeSchema: () => notificationScopeSchema,
|
|
74
|
+
notificationSettingsSchema: () => notificationSettingsSchema,
|
|
51
75
|
oauthTokenResponseSchema: () => oauthTokenResponseSchema,
|
|
52
76
|
pollDeviceToken: () => pollDeviceToken,
|
|
53
77
|
redact: () => redact,
|
|
@@ -60,7 +84,21 @@ __export(src_exports, {
|
|
|
60
84
|
usageResultSchema: () => usageResultSchema,
|
|
61
85
|
verifyAccessToken: () => verifyAccessToken,
|
|
62
86
|
verifyIdToken: () => verifyIdToken,
|
|
63
|
-
verifyLogoutToken: () => verifyLogoutToken
|
|
87
|
+
verifyLogoutToken: () => verifyLogoutToken,
|
|
88
|
+
workforceCreateResourceSchema: () => workforceCreateResourceSchema,
|
|
89
|
+
workforceDefinitionSchema: () => workforceDefinitionSchema,
|
|
90
|
+
workforceListOwnedResourcesSchema: () => workforceListOwnedResourcesSchema,
|
|
91
|
+
workforceOwnerSchema: () => workforceOwnerSchema,
|
|
92
|
+
workforceReadOperationSchema: () => workforceReadOperationSchema,
|
|
93
|
+
workspaceInviteRoleSchema: () => workspaceInviteRoleSchema,
|
|
94
|
+
workspaceInviteSchema: () => workspaceInviteSchema,
|
|
95
|
+
workspaceKeyOperationSchema: () => workspaceKeyOperationSchema,
|
|
96
|
+
workspaceKeyRejectionSchema: () => workspaceKeyRejectionSchema,
|
|
97
|
+
workspaceKeySchema: () => workspaceKeySchema,
|
|
98
|
+
workspaceKeyScopeSchema: () => workspaceKeyScopeSchema,
|
|
99
|
+
workspaceMemberSchema: () => workspaceMemberSchema,
|
|
100
|
+
workspaceRoleSchema: () => workspaceRoleSchema,
|
|
101
|
+
workspaceSchema: () => workspaceSchema
|
|
64
102
|
});
|
|
65
103
|
module.exports = __toCommonJS(src_exports);
|
|
66
104
|
|
|
@@ -90,8 +128,8 @@ var tokenSetSchema = import_zod.z.object({
|
|
|
90
128
|
/** Session id claim, the join key for back-channel logout. */
|
|
91
129
|
sid: import_zod.z.string().nullable().default(null),
|
|
92
130
|
/** Signature-verified claims; never populated by unverified decoding. */
|
|
93
|
-
accessClaims: import_zod.z.record(import_zod.z.unknown()).nullable().default(null),
|
|
94
|
-
idClaims: import_zod.z.record(import_zod.z.unknown()).nullable().default(null)
|
|
131
|
+
accessClaims: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).nullable().default(null),
|
|
132
|
+
idClaims: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).nullable().default(null)
|
|
95
133
|
});
|
|
96
134
|
var oauthTokenResponseSchema = import_zod.z.object({
|
|
97
135
|
access_token: import_zod.z.string(),
|
|
@@ -131,7 +169,7 @@ var usageEventSchema = import_zod.z.object({
|
|
|
131
169
|
inputTokens: import_zod.z.number().int().nonnegative().nullable().default(null),
|
|
132
170
|
outputTokens: import_zod.z.number().int().nonnegative().nullable().default(null),
|
|
133
171
|
/** Arbitrary attribution dimensions (project, workspace, …). */
|
|
134
|
-
dimensions: import_zod.z.record(import_zod.z.string()).default({}),
|
|
172
|
+
dimensions: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).default({}),
|
|
135
173
|
occurredAt: import_zod.z.coerce.date().optional()
|
|
136
174
|
});
|
|
137
175
|
var usageResultSchema = import_zod.z.object({
|
|
@@ -149,7 +187,7 @@ var holdRequestSchema = import_zod.z.object({
|
|
|
149
187
|
amountMicro: import_zod.z.number().int().positive(),
|
|
150
188
|
operation: import_zod.z.string().min(1),
|
|
151
189
|
expiresInSeconds: import_zod.z.number().int().positive().max(86400).default(900),
|
|
152
|
-
dimensions: import_zod.z.record(import_zod.z.string()).default({})
|
|
190
|
+
dimensions: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).default({})
|
|
153
191
|
});
|
|
154
192
|
var holdSchema = import_zod.z.object({
|
|
155
193
|
holdId: import_zod.z.string(),
|
|
@@ -169,7 +207,7 @@ var authzCheckSchema = import_zod.z.object({
|
|
|
169
207
|
relation: import_zod.z.string().min(1),
|
|
170
208
|
/** e.g. `workspace:acme` or `post:123`. */
|
|
171
209
|
object: import_zod.z.string().min(1),
|
|
172
|
-
context: import_zod.z.record(import_zod.z.unknown()).default({})
|
|
210
|
+
context: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).default({})
|
|
173
211
|
});
|
|
174
212
|
var authzResultSchema = import_zod.z.object({
|
|
175
213
|
allowed: import_zod.z.boolean(),
|
|
@@ -465,10 +503,10 @@ var Transport = class {
|
|
|
465
503
|
});
|
|
466
504
|
}
|
|
467
505
|
if (res.status === 204 || !res.body) return null;
|
|
468
|
-
const
|
|
469
|
-
if (!
|
|
506
|
+
const text2 = await readBoundedText(res, controller.signal, this.maxResponseBytes);
|
|
507
|
+
if (!text2) return null;
|
|
470
508
|
try {
|
|
471
|
-
return JSON.parse(
|
|
509
|
+
return JSON.parse(text2);
|
|
472
510
|
} catch {
|
|
473
511
|
throw new AccountError({
|
|
474
512
|
code: "INVALID_RESPONSE",
|
|
@@ -539,7 +577,7 @@ async function readBoundedText(response, signal, maxBytes) {
|
|
|
539
577
|
const decoder = new TextDecoder("utf-8", {
|
|
540
578
|
fatal: true
|
|
541
579
|
});
|
|
542
|
-
let
|
|
580
|
+
let text2 = "", size = 0;
|
|
543
581
|
while (true) {
|
|
544
582
|
const chunk = await beforeAbort(reader.read(), signal);
|
|
545
583
|
if (chunk.done) {
|
|
@@ -552,7 +590,7 @@ async function readBoundedText(response, signal, maxBytes) {
|
|
|
552
590
|
message: "Account response exceeds configured bound"
|
|
553
591
|
});
|
|
554
592
|
try {
|
|
555
|
-
|
|
593
|
+
text2 += decoder.decode(chunk.value, {
|
|
556
594
|
stream: true
|
|
557
595
|
});
|
|
558
596
|
} catch {
|
|
@@ -563,7 +601,7 @@ async function readBoundedText(response, signal, maxBytes) {
|
|
|
563
601
|
}
|
|
564
602
|
}
|
|
565
603
|
try {
|
|
566
|
-
return
|
|
604
|
+
return text2 + decoder.decode();
|
|
567
605
|
} catch {
|
|
568
606
|
throw new AccountError({
|
|
569
607
|
code: "INVALID_RESPONSE",
|
|
@@ -661,8 +699,8 @@ var AccountClient = class {
|
|
|
661
699
|
}
|
|
662
700
|
base;
|
|
663
701
|
transport;
|
|
664
|
-
constructor(
|
|
665
|
-
this.base =
|
|
702
|
+
constructor(base2, transport) {
|
|
703
|
+
this.base = base2;
|
|
666
704
|
this.transport = transport;
|
|
667
705
|
}
|
|
668
706
|
/** Resolve a token to its account, or throw an AccountError. */
|
|
@@ -701,20 +739,20 @@ function normalize(body) {
|
|
|
701
739
|
const root = body;
|
|
702
740
|
const user = root["user"] ?? root["data"] ?? root;
|
|
703
741
|
if (!user || typeof user !== "object") return null;
|
|
704
|
-
const
|
|
742
|
+
const id5 = str(user["id"]);
|
|
705
743
|
const email = str(user["email"]);
|
|
706
|
-
if (!
|
|
707
|
-
const
|
|
744
|
+
if (!id5 || !email) return null;
|
|
745
|
+
const linked2 = Array.isArray(user["linkedSurfaces"]) ? [
|
|
708
746
|
...new Set(user["linkedSurfaces"].map(normalizeSurface).filter(isSurface))
|
|
709
747
|
] : [];
|
|
710
748
|
const parsed = accountSchema.safeParse({
|
|
711
|
-
id,
|
|
749
|
+
id: id5,
|
|
712
750
|
email,
|
|
713
751
|
username: str(user["username"]) ?? null,
|
|
714
752
|
displayName: str(user["display_name"]) ?? str(user["displayName"]) ?? null,
|
|
715
753
|
avatarUrl: str(user["avatar_url"]) ?? str(user["avatarUrl"]) ?? null,
|
|
716
754
|
emailVerified: Boolean(user["email_verified"] ?? user["emailVerified"] ?? false),
|
|
717
|
-
linkedSurfaces:
|
|
755
|
+
linkedSurfaces: linked2
|
|
718
756
|
});
|
|
719
757
|
return parsed.success ? parsed.data : null;
|
|
720
758
|
}
|
|
@@ -853,6 +891,1653 @@ var AuthzClient = class {
|
|
|
853
891
|
}
|
|
854
892
|
};
|
|
855
893
|
|
|
894
|
+
// src/workspaces.ts
|
|
895
|
+
var import_zod3 = require("zod");
|
|
896
|
+
|
|
897
|
+
// src/workspaceMembership.ts
|
|
898
|
+
var import_zod2 = require("zod");
|
|
899
|
+
var id = import_zod2.z.string().uuid();
|
|
900
|
+
var timestamp = import_zod2.z.string().datetime({
|
|
901
|
+
offset: true
|
|
902
|
+
});
|
|
903
|
+
var role = import_zod2.z.enum([
|
|
904
|
+
"admin",
|
|
905
|
+
"member",
|
|
906
|
+
"viewer"
|
|
907
|
+
]);
|
|
908
|
+
var membershipMutationSchema = import_zod2.z.discriminatedUnion("action", [
|
|
909
|
+
import_zod2.z.object({
|
|
910
|
+
action: import_zod2.z.literal("invite.create"),
|
|
911
|
+
email: import_zod2.z.string().email().max(320).regex(/^[^\x00-\x20\x7f]+$/),
|
|
912
|
+
role
|
|
913
|
+
}).strict(),
|
|
914
|
+
import_zod2.z.object({
|
|
915
|
+
action: import_zod2.z.literal("invite.revoke"),
|
|
916
|
+
inviteId: id
|
|
917
|
+
}).strict(),
|
|
918
|
+
import_zod2.z.object({
|
|
919
|
+
action: import_zod2.z.literal("invite.resend"),
|
|
920
|
+
inviteId: id
|
|
921
|
+
}).strict(),
|
|
922
|
+
import_zod2.z.object({
|
|
923
|
+
action: import_zod2.z.literal("member.role"),
|
|
924
|
+
memberId: id,
|
|
925
|
+
role
|
|
926
|
+
}).strict(),
|
|
927
|
+
import_zod2.z.object({
|
|
928
|
+
action: import_zod2.z.literal("member.remove"),
|
|
929
|
+
memberId: id
|
|
930
|
+
}).strict(),
|
|
931
|
+
import_zod2.z.object({
|
|
932
|
+
action: import_zod2.z.literal("owner.transfer"),
|
|
933
|
+
newOwnerId: id
|
|
934
|
+
}).strict()
|
|
935
|
+
]);
|
|
936
|
+
var base = {
|
|
937
|
+
operation_id: id,
|
|
938
|
+
workspace_id: id,
|
|
939
|
+
actor_user_id: id,
|
|
940
|
+
client_id: import_zod2.z.string().regex(/^[a-zA-Z0-9._-]{1,128}$/),
|
|
941
|
+
committed_at: timestamp
|
|
942
|
+
};
|
|
943
|
+
var invite = import_zod2.z.object({
|
|
944
|
+
id,
|
|
945
|
+
workspace_id: id,
|
|
946
|
+
invited_email: import_zod2.z.string().email(),
|
|
947
|
+
role,
|
|
948
|
+
status: import_zod2.z.enum([
|
|
949
|
+
"pending",
|
|
950
|
+
"revoked"
|
|
951
|
+
]),
|
|
952
|
+
expires_at: timestamp
|
|
953
|
+
}).strict();
|
|
954
|
+
var delivery = import_zod2.z.object({
|
|
955
|
+
id,
|
|
956
|
+
state: import_zod2.z.literal("queued")
|
|
957
|
+
}).strict();
|
|
958
|
+
var membershipCommittedSchema = import_zod2.z.discriminatedUnion("action", [
|
|
959
|
+
import_zod2.z.object({
|
|
960
|
+
...base,
|
|
961
|
+
action: import_zod2.z.literal("invite.create"),
|
|
962
|
+
result: import_zod2.z.object({
|
|
963
|
+
invite,
|
|
964
|
+
delivery
|
|
965
|
+
}).strict()
|
|
966
|
+
}).strict(),
|
|
967
|
+
import_zod2.z.object({
|
|
968
|
+
...base,
|
|
969
|
+
action: import_zod2.z.literal("invite.resend"),
|
|
970
|
+
result: import_zod2.z.object({
|
|
971
|
+
invite,
|
|
972
|
+
delivery
|
|
973
|
+
}).strict()
|
|
974
|
+
}).strict(),
|
|
975
|
+
import_zod2.z.object({
|
|
976
|
+
...base,
|
|
977
|
+
action: import_zod2.z.literal("invite.revoke"),
|
|
978
|
+
result: import_zod2.z.object({
|
|
979
|
+
invite
|
|
980
|
+
}).strict()
|
|
981
|
+
}).strict(),
|
|
982
|
+
import_zod2.z.object({
|
|
983
|
+
...base,
|
|
984
|
+
action: import_zod2.z.literal("member.role"),
|
|
985
|
+
result: import_zod2.z.object({
|
|
986
|
+
memberId: id,
|
|
987
|
+
role
|
|
988
|
+
}).strict()
|
|
989
|
+
}).strict(),
|
|
990
|
+
import_zod2.z.object({
|
|
991
|
+
...base,
|
|
992
|
+
action: import_zod2.z.literal("member.remove"),
|
|
993
|
+
result: import_zod2.z.object({
|
|
994
|
+
memberId: id
|
|
995
|
+
}).strict()
|
|
996
|
+
}).strict(),
|
|
997
|
+
import_zod2.z.object({
|
|
998
|
+
...base,
|
|
999
|
+
action: import_zod2.z.literal("owner.transfer"),
|
|
1000
|
+
result: import_zod2.z.object({
|
|
1001
|
+
memberId: id,
|
|
1002
|
+
previousOwnerId: id
|
|
1003
|
+
}).strict()
|
|
1004
|
+
}).strict()
|
|
1005
|
+
]);
|
|
1006
|
+
var membershipRejectedSchema = import_zod2.z.object({
|
|
1007
|
+
...base,
|
|
1008
|
+
action: import_zod2.z.enum([
|
|
1009
|
+
"invite.create",
|
|
1010
|
+
"invite.resend",
|
|
1011
|
+
"invite.revoke",
|
|
1012
|
+
"member.role",
|
|
1013
|
+
"member.remove",
|
|
1014
|
+
"owner.transfer"
|
|
1015
|
+
]),
|
|
1016
|
+
rejection: import_zod2.z.enum([
|
|
1017
|
+
"invalid_membership_request",
|
|
1018
|
+
"member_not_found",
|
|
1019
|
+
"owner_transfer_required",
|
|
1020
|
+
"owner_target_not_member",
|
|
1021
|
+
"invite_not_found",
|
|
1022
|
+
"invite_already_pending",
|
|
1023
|
+
"already_member",
|
|
1024
|
+
"seat_limit"
|
|
1025
|
+
])
|
|
1026
|
+
}).strict();
|
|
1027
|
+
var membershipAbandonedSchema = membershipRejectedSchema.omit({
|
|
1028
|
+
rejection: true
|
|
1029
|
+
}).extend({
|
|
1030
|
+
abandoned: import_zod2.z.literal(true),
|
|
1031
|
+
request: membershipMutationSchema
|
|
1032
|
+
}).strict();
|
|
1033
|
+
var membershipOperationSchema = import_zod2.z.union([
|
|
1034
|
+
membershipCommittedSchema,
|
|
1035
|
+
membershipRejectedSchema,
|
|
1036
|
+
membershipAbandonedSchema
|
|
1037
|
+
]);
|
|
1038
|
+
var membershipDeliverySchema = import_zod2.z.object({
|
|
1039
|
+
id,
|
|
1040
|
+
state: import_zod2.z.enum([
|
|
1041
|
+
"queued",
|
|
1042
|
+
"accepted",
|
|
1043
|
+
"skipped",
|
|
1044
|
+
"unknown"
|
|
1045
|
+
])
|
|
1046
|
+
}).strict();
|
|
1047
|
+
var WorkspaceMembershipMutationError = class extends AccountError {
|
|
1048
|
+
static {
|
|
1049
|
+
__name(this, "WorkspaceMembershipMutationError");
|
|
1050
|
+
}
|
|
1051
|
+
operationId;
|
|
1052
|
+
outcome = "uncertain";
|
|
1053
|
+
constructor(operationId) {
|
|
1054
|
+
super({
|
|
1055
|
+
code: "PLATFORM_ERROR",
|
|
1056
|
+
message: "Workspace membership acknowledgement is uncertain. Read back the same operation.",
|
|
1057
|
+
retryable: false
|
|
1058
|
+
}), this.operationId = operationId;
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
function assertMembershipOperation(workspaceId, operationId, operation3, request) {
|
|
1062
|
+
if (operation3.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || operation3.operation_id.toLowerCase() !== operationId.toLowerCase() || request && operation3.action !== request.action) throw new Error("Foreign membership receipt");
|
|
1063
|
+
if ("rejection" in operation3) return;
|
|
1064
|
+
if ("abandoned" in operation3) {
|
|
1065
|
+
if (operation3.request.action !== operation3.action || request && JSON.stringify(membershipMutationSchema.parse(request)) !== JSON.stringify(operation3.request)) throw new Error("Wrong abandoned membership intent");
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
if (operation3.action.startsWith("invite.")) {
|
|
1069
|
+
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");
|
|
1070
|
+
if (request && "inviteId" in request && operation3.result.invite.id !== request.inviteId) throw new Error("Wrong invitation target");
|
|
1071
|
+
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");
|
|
1072
|
+
} else if ("memberId" in operation3.result) {
|
|
1073
|
+
if (request && "memberId" in request && operation3.result.memberId !== request.memberId) throw new Error("Wrong member target");
|
|
1074
|
+
if (request?.action === "member.role" && (!("role" in operation3.result) || operation3.result.role !== request.role)) throw new Error("Wrong member role");
|
|
1075
|
+
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");
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
__name(assertMembershipOperation, "assertMembershipOperation");
|
|
1079
|
+
|
|
1080
|
+
// src/workspaces.ts
|
|
1081
|
+
var workspaceRoleSchema = import_zod3.z.enum([
|
|
1082
|
+
"owner",
|
|
1083
|
+
"admin",
|
|
1084
|
+
"member",
|
|
1085
|
+
"viewer"
|
|
1086
|
+
]);
|
|
1087
|
+
var workspaceInviteRoleSchema = import_zod3.z.enum([
|
|
1088
|
+
"admin",
|
|
1089
|
+
"member",
|
|
1090
|
+
"viewer"
|
|
1091
|
+
]);
|
|
1092
|
+
var id2 = import_zod3.z.string().uuid();
|
|
1093
|
+
var timestamp2 = import_zod3.z.string().datetime({
|
|
1094
|
+
offset: true
|
|
1095
|
+
});
|
|
1096
|
+
var workspaceSchema = import_zod3.z.object({
|
|
1097
|
+
id: id2,
|
|
1098
|
+
owner_user_id: id2,
|
|
1099
|
+
workspace_type: import_zod3.z.enum([
|
|
1100
|
+
"personal",
|
|
1101
|
+
"team"
|
|
1102
|
+
]),
|
|
1103
|
+
name: import_zod3.z.string().min(1),
|
|
1104
|
+
slug: import_zod3.z.string().min(1),
|
|
1105
|
+
status: import_zod3.z.string().min(1),
|
|
1106
|
+
created_at: timestamp2,
|
|
1107
|
+
updated_at: timestamp2,
|
|
1108
|
+
metadata: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()),
|
|
1109
|
+
member_role: workspaceRoleSchema.optional(),
|
|
1110
|
+
member_count: import_zod3.z.number().int().nonnegative().optional()
|
|
1111
|
+
});
|
|
1112
|
+
var workspaceMemberSchema = import_zod3.z.object({
|
|
1113
|
+
id: id2,
|
|
1114
|
+
user_id: id2,
|
|
1115
|
+
member_role: workspaceRoleSchema,
|
|
1116
|
+
member_status: import_zod3.z.literal("active"),
|
|
1117
|
+
created_at: timestamp2,
|
|
1118
|
+
user: import_zod3.z.object({
|
|
1119
|
+
username: import_zod3.z.string().nullable(),
|
|
1120
|
+
email: import_zod3.z.string().email(),
|
|
1121
|
+
display_name: import_zod3.z.string().nullable(),
|
|
1122
|
+
avatar_url: import_zod3.z.string().url().nullable()
|
|
1123
|
+
}).optional()
|
|
1124
|
+
});
|
|
1125
|
+
var workspaceInviteSchema = import_zod3.z.object({
|
|
1126
|
+
id: id2,
|
|
1127
|
+
workspace_id: id2,
|
|
1128
|
+
invited_by_user_id: id2,
|
|
1129
|
+
invited_user_id: id2.nullable(),
|
|
1130
|
+
invited_email: import_zod3.z.string().email(),
|
|
1131
|
+
role: workspaceInviteRoleSchema,
|
|
1132
|
+
status: import_zod3.z.enum([
|
|
1133
|
+
"pending",
|
|
1134
|
+
"accepted",
|
|
1135
|
+
"declined",
|
|
1136
|
+
"revoked",
|
|
1137
|
+
"expired"
|
|
1138
|
+
]),
|
|
1139
|
+
created_at: timestamp2,
|
|
1140
|
+
expires_at: timestamp2.nullable(),
|
|
1141
|
+
workspace_name: import_zod3.z.string().optional(),
|
|
1142
|
+
invited_by_name: import_zod3.z.string().nullable().optional()
|
|
1143
|
+
});
|
|
1144
|
+
var accountOperationIntentSchema = import_zod3.z.discriminatedUnion("action", [
|
|
1145
|
+
import_zod3.z.object({
|
|
1146
|
+
action: import_zod3.z.literal("workspace.create"),
|
|
1147
|
+
name: import_zod3.z.string().trim().min(1).max(128),
|
|
1148
|
+
type: import_zod3.z.literal("team")
|
|
1149
|
+
}).strict(),
|
|
1150
|
+
import_zod3.z.object({
|
|
1151
|
+
action: import_zod3.z.literal("invite.accept"),
|
|
1152
|
+
inviteId: id2
|
|
1153
|
+
}).strict(),
|
|
1154
|
+
import_zod3.z.object({
|
|
1155
|
+
action: import_zod3.z.literal("invite.decline"),
|
|
1156
|
+
inviteId: id2
|
|
1157
|
+
}).strict()
|
|
1158
|
+
]);
|
|
1159
|
+
var accountOperationSchema = import_zod3.z.object({
|
|
1160
|
+
operation_id: id2,
|
|
1161
|
+
actor_user_id: id2,
|
|
1162
|
+
client_id: import_zod3.z.string().regex(/^[a-zA-Z0-9._-]{1,128}$/),
|
|
1163
|
+
action: import_zod3.z.enum([
|
|
1164
|
+
"workspace.create",
|
|
1165
|
+
"invite.accept",
|
|
1166
|
+
"invite.decline"
|
|
1167
|
+
]),
|
|
1168
|
+
committed_at: timestamp2,
|
|
1169
|
+
result: import_zod3.z.union([
|
|
1170
|
+
import_zod3.z.object({
|
|
1171
|
+
workspace: workspaceSchema
|
|
1172
|
+
}).strict(),
|
|
1173
|
+
import_zod3.z.object({
|
|
1174
|
+
invite: workspaceInviteSchema
|
|
1175
|
+
}).strict()
|
|
1176
|
+
])
|
|
1177
|
+
}).strict();
|
|
1178
|
+
var AccountMutationError = class extends AccountError {
|
|
1179
|
+
static {
|
|
1180
|
+
__name(this, "AccountMutationError");
|
|
1181
|
+
}
|
|
1182
|
+
operationId;
|
|
1183
|
+
outcome = "uncertain";
|
|
1184
|
+
constructor(operationId) {
|
|
1185
|
+
super({
|
|
1186
|
+
code: "PLATFORM_ERROR",
|
|
1187
|
+
message: "Account mutation acknowledgement is uncertain. Read back the same operation.",
|
|
1188
|
+
retryable: false
|
|
1189
|
+
}), this.operationId = operationId;
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
var workspaceKeyScopeSchema = import_zod3.z.enum([
|
|
1193
|
+
"workspace:read",
|
|
1194
|
+
"workspace:members:read"
|
|
1195
|
+
]);
|
|
1196
|
+
var keyScopes = import_zod3.z.array(workspaceKeyScopeSchema).min(1).max(2).refine((values) => new Set(values).size === values.length);
|
|
1197
|
+
var workspaceKeySchema = import_zod3.z.object({
|
|
1198
|
+
id: id2,
|
|
1199
|
+
workspace_id: id2,
|
|
1200
|
+
created_by_user_id: id2,
|
|
1201
|
+
name: import_zod3.z.string().min(1).max(100),
|
|
1202
|
+
prefix: import_zod3.z.string().regex(/^xeno-ws-v1_[0-9a-f]{13}$/),
|
|
1203
|
+
scopes: keyScopes,
|
|
1204
|
+
revision: import_zod3.z.number().int().positive(),
|
|
1205
|
+
created_at: timestamp2,
|
|
1206
|
+
expires_at: timestamp2,
|
|
1207
|
+
revoked_at: timestamp2.nullable(),
|
|
1208
|
+
replaced_by: id2.nullable()
|
|
1209
|
+
});
|
|
1210
|
+
var workspaceKeyInputSchema = import_zod3.z.object({
|
|
1211
|
+
name: import_zod3.z.string().trim().min(1).max(100).regex(/^[^\x00-\x1f]+$/),
|
|
1212
|
+
scopes: keyScopes,
|
|
1213
|
+
expires_at: timestamp2.refine((value) => Date.parse(value) > Date.now() && Date.parse(value) <= Date.now() + 90 * 864e5)
|
|
1214
|
+
}).strict();
|
|
1215
|
+
var keySecretSchema = import_zod3.z.string().regex(/^xeno-ws-v1_[0-9a-f]{64}$/);
|
|
1216
|
+
var committedKeyOperationSchema = import_zod3.z.object({
|
|
1217
|
+
operation_id: id2,
|
|
1218
|
+
workspace_id: id2,
|
|
1219
|
+
actor_user_id: id2,
|
|
1220
|
+
client_id: import_zod3.z.string().regex(/^[a-zA-Z0-9._-]{1,128}$/),
|
|
1221
|
+
action: import_zod3.z.enum([
|
|
1222
|
+
"create",
|
|
1223
|
+
"rotate",
|
|
1224
|
+
"revoke"
|
|
1225
|
+
]),
|
|
1226
|
+
key: workspaceKeySchema,
|
|
1227
|
+
previous_key_id: id2.nullable(),
|
|
1228
|
+
committed_at: timestamp2
|
|
1229
|
+
}).strict();
|
|
1230
|
+
var workspaceKeyRejectionSchema = import_zod3.z.enum([
|
|
1231
|
+
"invalid_workspace_key_request",
|
|
1232
|
+
"invalid_workspace_key_revision",
|
|
1233
|
+
"workspace_key_not_found",
|
|
1234
|
+
"workspace_key_conflict"
|
|
1235
|
+
]);
|
|
1236
|
+
var rejectedKeyOperationSchema = committedKeyOperationSchema.omit({
|
|
1237
|
+
key: true
|
|
1238
|
+
}).extend({
|
|
1239
|
+
rejection: workspaceKeyRejectionSchema
|
|
1240
|
+
}).strict();
|
|
1241
|
+
var abandonedKeyOperationSchema = committedKeyOperationSchema.omit({
|
|
1242
|
+
key: true
|
|
1243
|
+
}).extend({
|
|
1244
|
+
abandoned: import_zod3.z.literal(true)
|
|
1245
|
+
}).strict();
|
|
1246
|
+
var workspaceKeyOperationSchema = import_zod3.z.union([
|
|
1247
|
+
committedKeyOperationSchema,
|
|
1248
|
+
rejectedKeyOperationSchema,
|
|
1249
|
+
abandonedKeyOperationSchema
|
|
1250
|
+
]);
|
|
1251
|
+
var keyOperationInput = workspaceKeyInputSchema.extend({
|
|
1252
|
+
expires_at: timestamp2
|
|
1253
|
+
});
|
|
1254
|
+
var keyMutationSchema = import_zod3.z.discriminatedUnion("action", [
|
|
1255
|
+
import_zod3.z.object({
|
|
1256
|
+
action: import_zod3.z.literal("create"),
|
|
1257
|
+
input: keyOperationInput
|
|
1258
|
+
}).strict(),
|
|
1259
|
+
import_zod3.z.object({
|
|
1260
|
+
action: import_zod3.z.literal("rotate"),
|
|
1261
|
+
keyId: id2,
|
|
1262
|
+
expectedRevision: import_zod3.z.number().int().positive(),
|
|
1263
|
+
input: keyOperationInput.partial().optional()
|
|
1264
|
+
}).strict(),
|
|
1265
|
+
import_zod3.z.object({
|
|
1266
|
+
action: import_zod3.z.literal("revoke"),
|
|
1267
|
+
keyId: id2,
|
|
1268
|
+
expectedRevision: import_zod3.z.number().int().positive()
|
|
1269
|
+
}).strict()
|
|
1270
|
+
]);
|
|
1271
|
+
var WorkspaceKeyMutationError = class extends AccountError {
|
|
1272
|
+
static {
|
|
1273
|
+
__name(this, "WorkspaceKeyMutationError");
|
|
1274
|
+
}
|
|
1275
|
+
operationId;
|
|
1276
|
+
outcome = "uncertain";
|
|
1277
|
+
constructor(operationId) {
|
|
1278
|
+
super({
|
|
1279
|
+
code: "PLATFORM_ERROR",
|
|
1280
|
+
message: "Workspace key mutation acknowledgement is uncertain. Read back the same operation.",
|
|
1281
|
+
retryable: false
|
|
1282
|
+
}), this.operationId = operationId;
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
var workspaceKeyCursor = import_zod3.z.string().regex(/^[a-z0-9_-]{1,512}$/i);
|
|
1286
|
+
var success = import_zod3.z.object({
|
|
1287
|
+
success: import_zod3.z.literal(true)
|
|
1288
|
+
});
|
|
1289
|
+
var membersResponse = success.extend({
|
|
1290
|
+
workspace: workspaceSchema,
|
|
1291
|
+
members: import_zod3.z.array(workspaceMemberSchema)
|
|
1292
|
+
});
|
|
1293
|
+
var invitesResponse = success.extend({
|
|
1294
|
+
invites: import_zod3.z.array(workspaceInviteSchema)
|
|
1295
|
+
});
|
|
1296
|
+
var WorkspaceClient = class {
|
|
1297
|
+
static {
|
|
1298
|
+
__name(this, "WorkspaceClient");
|
|
1299
|
+
}
|
|
1300
|
+
transport;
|
|
1301
|
+
authorize;
|
|
1302
|
+
base;
|
|
1303
|
+
constructor(base2, transport, authorize) {
|
|
1304
|
+
this.transport = transport;
|
|
1305
|
+
this.authorize = authorize;
|
|
1306
|
+
const origin = new URL(base2);
|
|
1307
|
+
if (origin.protocol !== "https:" || origin.username || origin.password || origin.search || origin.hash || origin.pathname !== "/") {
|
|
1308
|
+
throw new AccountError({
|
|
1309
|
+
code: "BAD_REQUEST",
|
|
1310
|
+
message: "Workspace API requires an HTTPS origin."
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
this.base = origin.origin;
|
|
1314
|
+
}
|
|
1315
|
+
async call(method, path, scope, schema, body, idempotencyKey) {
|
|
1316
|
+
const url = `${this.base}/api${path}`;
|
|
1317
|
+
const raw = await this.transport.request({
|
|
1318
|
+
method,
|
|
1319
|
+
url,
|
|
1320
|
+
...body === void 0 ? {} : {
|
|
1321
|
+
body
|
|
1322
|
+
},
|
|
1323
|
+
...idempotencyKey ? {
|
|
1324
|
+
idempotencyKey
|
|
1325
|
+
} : {},
|
|
1326
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
1327
|
+
const auth = await this.authorize(method, url, {
|
|
1328
|
+
scopes: [
|
|
1329
|
+
scope
|
|
1330
|
+
],
|
|
1331
|
+
silent: true
|
|
1332
|
+
});
|
|
1333
|
+
if (!auth) throw new AccountError({
|
|
1334
|
+
code: "INVALID_TOKEN",
|
|
1335
|
+
message: "Sign in to manage workspaces."
|
|
1336
|
+
});
|
|
1337
|
+
return auth;
|
|
1338
|
+
}, "authorization")
|
|
1339
|
+
});
|
|
1340
|
+
const parsed = schema.safeParse(raw);
|
|
1341
|
+
if (!parsed.success) throw new AccountError({
|
|
1342
|
+
code: "INVALID_RESPONSE",
|
|
1343
|
+
message: "Invalid workspace response."
|
|
1344
|
+
});
|
|
1345
|
+
return parsed.data;
|
|
1346
|
+
}
|
|
1347
|
+
async list() {
|
|
1348
|
+
return (await this.call("GET", "/workspaces", "team:read", success.extend({
|
|
1349
|
+
workspaces: import_zod3.z.array(workspaceSchema)
|
|
1350
|
+
}))).workspaces;
|
|
1351
|
+
}
|
|
1352
|
+
async keys(workspaceId, options = {}) {
|
|
1353
|
+
const input = import_zod3.z.object({
|
|
1354
|
+
cursor: workspaceKeyCursor.optional(),
|
|
1355
|
+
limit: import_zod3.z.number().int().min(1).max(200).optional()
|
|
1356
|
+
}).strict().parse(options);
|
|
1357
|
+
const query = new URLSearchParams();
|
|
1358
|
+
if (input.cursor !== void 0) query.set("cursor", input.cursor);
|
|
1359
|
+
if (input.limit !== void 0) query.set("limit", String(input.limit));
|
|
1360
|
+
const result = await this.call("GET", `/workspaces/${id2.parse(workspaceId)}/api-keys${query.size ? `?${query}` : ""}`, "team:manage", success.extend({
|
|
1361
|
+
keys: import_zod3.z.array(workspaceKeySchema).max(200),
|
|
1362
|
+
next_cursor: workspaceKeyCursor.nullable()
|
|
1363
|
+
}));
|
|
1364
|
+
const { keys, next_cursor } = result;
|
|
1365
|
+
if (keys.some((key) => key.workspace_id.toLowerCase() !== workspaceId.toLowerCase())) throw new AccountError({
|
|
1366
|
+
code: "INVALID_RESPONSE",
|
|
1367
|
+
message: "Workspace key response belongs to another workspace."
|
|
1368
|
+
});
|
|
1369
|
+
return {
|
|
1370
|
+
keys,
|
|
1371
|
+
next_cursor
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
async createKey(workspaceId, input) {
|
|
1375
|
+
const body = workspaceKeyInputSchema.parse(input);
|
|
1376
|
+
const response = await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/api-keys`, "team:manage", success.extend({
|
|
1377
|
+
key: workspaceKeySchema,
|
|
1378
|
+
secret: keySecretSchema
|
|
1379
|
+
}), body);
|
|
1380
|
+
this.assertKeyReceipt(workspaceId, response.key);
|
|
1381
|
+
return {
|
|
1382
|
+
key: response.key,
|
|
1383
|
+
secret: response.secret
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
async keyOperation(workspaceId, operationId) {
|
|
1387
|
+
const workspace = id2.parse(workspaceId), operation3 = id2.parse(operationId);
|
|
1388
|
+
const response = await this.call("GET", `/workspaces/${workspace}/api-keys/operations/${operation3}`, "team:manage", import_zod3.z.discriminatedUnion("state", [
|
|
1389
|
+
import_zod3.z.object({
|
|
1390
|
+
success: import_zod3.z.literal(true),
|
|
1391
|
+
state: import_zod3.z.literal("not-observed"),
|
|
1392
|
+
operation: import_zod3.z.null()
|
|
1393
|
+
}).strict(),
|
|
1394
|
+
import_zod3.z.object({
|
|
1395
|
+
success: import_zod3.z.literal(true),
|
|
1396
|
+
state: import_zod3.z.literal("committed"),
|
|
1397
|
+
operation: committedKeyOperationSchema
|
|
1398
|
+
}).strict(),
|
|
1399
|
+
import_zod3.z.object({
|
|
1400
|
+
success: import_zod3.z.literal(true),
|
|
1401
|
+
state: import_zod3.z.literal("rejected"),
|
|
1402
|
+
operation: rejectedKeyOperationSchema
|
|
1403
|
+
}).strict(),
|
|
1404
|
+
import_zod3.z.object({
|
|
1405
|
+
success: import_zod3.z.literal(true),
|
|
1406
|
+
state: import_zod3.z.literal("abandoned"),
|
|
1407
|
+
operation: abandonedKeyOperationSchema
|
|
1408
|
+
}).strict()
|
|
1409
|
+
]));
|
|
1410
|
+
if (response.state === "not-observed") return {
|
|
1411
|
+
state: response.state,
|
|
1412
|
+
operation: null
|
|
1413
|
+
};
|
|
1414
|
+
this.assertOperation(workspace, operation3, response.operation);
|
|
1415
|
+
if (response.state === "abandoned") return {
|
|
1416
|
+
state: response.state,
|
|
1417
|
+
operation: response.operation
|
|
1418
|
+
};
|
|
1419
|
+
return response.state === "rejected" ? {
|
|
1420
|
+
state: response.state,
|
|
1421
|
+
operation: response.operation
|
|
1422
|
+
} : {
|
|
1423
|
+
state: response.state,
|
|
1424
|
+
operation: response.operation
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
async mutateKey(workspaceId, operationId, request) {
|
|
1428
|
+
const workspace = id2.parse(workspaceId), operation3 = id2.parse(operationId), input = keyMutationSchema.parse(request);
|
|
1429
|
+
const path = `/workspaces/${workspace}/api-keys${input.action === "create" ? "" : `/${input.keyId}${input.action === "rotate" ? "/rotate" : ""}`}`;
|
|
1430
|
+
const body = {
|
|
1431
|
+
...input.action === "revoke" ? {} : input.input,
|
|
1432
|
+
operation_id: operation3,
|
|
1433
|
+
...input.action === "create" ? {} : {
|
|
1434
|
+
expected_revision: input.expectedRevision
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
try {
|
|
1438
|
+
const response = await this.call(input.action === "revoke" ? "DELETE" : "POST", path, "team:manage", import_zod3.z.object({
|
|
1439
|
+
success: import_zod3.z.literal(true),
|
|
1440
|
+
key: workspaceKeySchema.optional(),
|
|
1441
|
+
operation: workspaceKeyOperationSchema,
|
|
1442
|
+
replayed: import_zod3.z.boolean(),
|
|
1443
|
+
secret: keySecretSchema.optional()
|
|
1444
|
+
}).strict(), body);
|
|
1445
|
+
this.assertOperation(workspace, operation3, response.operation);
|
|
1446
|
+
if ("rejection" in response.operation || "abandoned" in response.operation) {
|
|
1447
|
+
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");
|
|
1448
|
+
return {
|
|
1449
|
+
operation: response.operation,
|
|
1450
|
+
replayed: response.replayed
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
if (!response.key) throw new Error("Missing key");
|
|
1454
|
+
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");
|
|
1455
|
+
if (input.action === "revoke") {
|
|
1456
|
+
if (response.key.id.toLowerCase() !== input.keyId.toLowerCase() || !response.key.revoked_at || response.key.revision !== input.expectedRevision + 1) throw new Error("Invalid revocation");
|
|
1457
|
+
} else {
|
|
1458
|
+
this.assertKeyReceipt(workspace, response.key);
|
|
1459
|
+
if (input.action === "rotate" && response.key.id.toLowerCase() === input.keyId.toLowerCase()) throw new Error("Invalid rotation");
|
|
1460
|
+
}
|
|
1461
|
+
return {
|
|
1462
|
+
operation: response.operation,
|
|
1463
|
+
replayed: response.replayed,
|
|
1464
|
+
...response.secret === void 0 ? {} : {
|
|
1465
|
+
secret: response.secret
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
} catch {
|
|
1469
|
+
throw new WorkspaceKeyMutationError(operation3);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
assertOperation(workspaceId, operationId, operation3) {
|
|
1473
|
+
if (operation3.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || operation3.operation_id.toLowerCase() !== operationId.toLowerCase()) {
|
|
1474
|
+
throw new AccountError({
|
|
1475
|
+
code: "INVALID_RESPONSE",
|
|
1476
|
+
message: "Workspace operation response belongs to another authority."
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
if ("rejection" in operation3 || "abandoned" in operation3) return;
|
|
1480
|
+
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({
|
|
1481
|
+
code: "INVALID_RESPONSE",
|
|
1482
|
+
message: "Foreign key receipt."
|
|
1483
|
+
});
|
|
1484
|
+
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)) {
|
|
1485
|
+
throw new AccountError({
|
|
1486
|
+
code: "INVALID_RESPONSE",
|
|
1487
|
+
message: "Invalid committed workspace key operation."
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
async rotateKey(workspaceId, keyId, expectedRevision, input = {}) {
|
|
1492
|
+
const body = {
|
|
1493
|
+
...workspaceKeyInputSchema.partial().parse(input),
|
|
1494
|
+
expected_revision: import_zod3.z.number().int().positive().parse(expectedRevision)
|
|
1495
|
+
};
|
|
1496
|
+
const response = await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/api-keys/${id2.parse(keyId)}/rotate`, "team:manage", success.extend({
|
|
1497
|
+
key: workspaceKeySchema,
|
|
1498
|
+
secret: keySecretSchema
|
|
1499
|
+
}), body);
|
|
1500
|
+
this.assertKeyReceipt(workspaceId, response.key);
|
|
1501
|
+
if (response.key.id.toLowerCase() === keyId.toLowerCase()) throw new AccountError({
|
|
1502
|
+
code: "INVALID_RESPONSE",
|
|
1503
|
+
message: "Rotation did not acknowledge a new key identity."
|
|
1504
|
+
});
|
|
1505
|
+
return {
|
|
1506
|
+
key: response.key,
|
|
1507
|
+
secret: response.secret
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
async revokeKey(workspaceId, keyId, expectedRevision) {
|
|
1511
|
+
const key = (await this.call("DELETE", `/workspaces/${id2.parse(workspaceId)}/api-keys/${id2.parse(keyId)}`, "team:manage", success.extend({
|
|
1512
|
+
key: workspaceKeySchema
|
|
1513
|
+
}), {
|
|
1514
|
+
expected_revision: import_zod3.z.number().int().positive().parse(expectedRevision)
|
|
1515
|
+
})).key;
|
|
1516
|
+
if (key.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || key.id.toLowerCase() !== keyId.toLowerCase() || !key.revoked_at || key.revision !== expectedRevision + 1) throw new AccountError({
|
|
1517
|
+
code: "INVALID_RESPONSE",
|
|
1518
|
+
message: "Revocation was not acknowledged for the requested key revision."
|
|
1519
|
+
});
|
|
1520
|
+
return key;
|
|
1521
|
+
}
|
|
1522
|
+
assertKeyReceipt(workspaceId, key) {
|
|
1523
|
+
if (key.workspace_id.toLowerCase() !== workspaceId.toLowerCase() || key.revoked_at || key.replaced_by || key.revision !== 1) throw new AccountError({
|
|
1524
|
+
code: "INVALID_RESPONSE",
|
|
1525
|
+
message: "Invalid workspace key creation receipt."
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
async create(name, type = "team") {
|
|
1529
|
+
const body = import_zod3.z.object({
|
|
1530
|
+
name: import_zod3.z.string().trim().min(1).max(128),
|
|
1531
|
+
workspace_type: import_zod3.z.enum([
|
|
1532
|
+
"personal",
|
|
1533
|
+
"team"
|
|
1534
|
+
])
|
|
1535
|
+
}).parse({
|
|
1536
|
+
name,
|
|
1537
|
+
workspace_type: type
|
|
1538
|
+
});
|
|
1539
|
+
return (await this.call("POST", "/workspaces", "team:manage", success.extend({
|
|
1540
|
+
workspace: workspaceSchema
|
|
1541
|
+
}), body)).workspace;
|
|
1542
|
+
}
|
|
1543
|
+
async accountOperation(operationId) {
|
|
1544
|
+
const operation3 = id2.parse(operationId);
|
|
1545
|
+
const response = await this.call("GET", `/account-operations/${operation3}`, "team:manage", import_zod3.z.discriminatedUnion("state", [
|
|
1546
|
+
import_zod3.z.object({
|
|
1547
|
+
success: import_zod3.z.literal(true),
|
|
1548
|
+
state: import_zod3.z.literal("not-observed"),
|
|
1549
|
+
operation: import_zod3.z.null()
|
|
1550
|
+
}).strict(),
|
|
1551
|
+
import_zod3.z.object({
|
|
1552
|
+
success: import_zod3.z.literal(true),
|
|
1553
|
+
state: import_zod3.z.literal("committed"),
|
|
1554
|
+
operation: accountOperationSchema
|
|
1555
|
+
}).strict()
|
|
1556
|
+
]));
|
|
1557
|
+
if (response.state === "not-observed") return response;
|
|
1558
|
+
if (response.operation.operation_id.toLowerCase() !== operation3.toLowerCase()) throw new AccountError({
|
|
1559
|
+
code: "INVALID_RESPONSE",
|
|
1560
|
+
message: "Account operation response belongs to another operation."
|
|
1561
|
+
});
|
|
1562
|
+
return {
|
|
1563
|
+
state: "committed",
|
|
1564
|
+
operation: response.operation
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
async mutateAccount(operationId, request) {
|
|
1568
|
+
const operation3 = id2.parse(operationId), intent = accountOperationIntentSchema.parse(request);
|
|
1569
|
+
const path = intent.action === "workspace.create" ? "/workspaces" : `/workspace-invites/${intent.inviteId}/${intent.action === "invite.accept" ? "accept" : "decline"}`;
|
|
1570
|
+
const body = intent.action === "workspace.create" ? {
|
|
1571
|
+
operation_id: operation3,
|
|
1572
|
+
name: intent.name,
|
|
1573
|
+
workspace_type: intent.type
|
|
1574
|
+
} : {
|
|
1575
|
+
operation_id: operation3
|
|
1576
|
+
};
|
|
1577
|
+
try {
|
|
1578
|
+
const response = await this.call("POST", path, "team:manage", import_zod3.z.object({
|
|
1579
|
+
success: import_zod3.z.literal(true),
|
|
1580
|
+
operation: accountOperationSchema,
|
|
1581
|
+
replayed: import_zod3.z.boolean(),
|
|
1582
|
+
workspace: workspaceSchema.optional()
|
|
1583
|
+
}).strict(), body, operation3);
|
|
1584
|
+
if (response.operation.operation_id.toLowerCase() !== operation3.toLowerCase() || response.operation.action !== intent.action) throw new Error("foreign operation");
|
|
1585
|
+
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");
|
|
1586
|
+
if (intent.action !== "workspace.create" && (!("invite" in response.operation.result) || response.operation.result.invite.id.toLowerCase() !== intent.inviteId.toLowerCase())) throw new Error("foreign invite");
|
|
1587
|
+
return {
|
|
1588
|
+
operation: response.operation,
|
|
1589
|
+
replayed: response.replayed
|
|
1590
|
+
};
|
|
1591
|
+
} catch {
|
|
1592
|
+
throw new AccountMutationError(operation3);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
async select(workspaceId) {
|
|
1596
|
+
await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/select`, "team:read", success);
|
|
1597
|
+
}
|
|
1598
|
+
async members(workspaceId) {
|
|
1599
|
+
return this.call("GET", `/workspaces/${id2.parse(workspaceId)}/members`, "team:read", membersResponse);
|
|
1600
|
+
}
|
|
1601
|
+
async updateMember(workspaceId, memberId, role2) {
|
|
1602
|
+
await this.call("PATCH", `/workspaces/${id2.parse(workspaceId)}/members/${id2.parse(memberId)}`, "team:manage", success, {
|
|
1603
|
+
member_role: workspaceInviteRoleSchema.parse(role2)
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
async membershipOperation(workspaceId, operationId) {
|
|
1607
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId);
|
|
1608
|
+
const response = await this.call("GET", `/workspaces/${ws}/membership-operations/${op}`, "team:manage", import_zod3.z.discriminatedUnion("state", [
|
|
1609
|
+
import_zod3.z.object({
|
|
1610
|
+
success: import_zod3.z.literal(true),
|
|
1611
|
+
state: import_zod3.z.literal("not-observed"),
|
|
1612
|
+
operation: import_zod3.z.null()
|
|
1613
|
+
}).strict(),
|
|
1614
|
+
import_zod3.z.object({
|
|
1615
|
+
success: import_zod3.z.literal(true),
|
|
1616
|
+
state: import_zod3.z.literal("committed"),
|
|
1617
|
+
operation: membershipCommittedSchema,
|
|
1618
|
+
delivery: membershipDeliverySchema.optional()
|
|
1619
|
+
}).strict(),
|
|
1620
|
+
import_zod3.z.object({
|
|
1621
|
+
success: import_zod3.z.literal(true),
|
|
1622
|
+
state: import_zod3.z.literal("rejected"),
|
|
1623
|
+
operation: membershipRejectedSchema
|
|
1624
|
+
}).strict(),
|
|
1625
|
+
import_zod3.z.object({
|
|
1626
|
+
success: import_zod3.z.literal(true),
|
|
1627
|
+
state: import_zod3.z.literal("abandoned"),
|
|
1628
|
+
operation: membershipAbandonedSchema
|
|
1629
|
+
}).strict()
|
|
1630
|
+
]));
|
|
1631
|
+
if (response.state === "not-observed") return {
|
|
1632
|
+
state: response.state,
|
|
1633
|
+
operation: null
|
|
1634
|
+
};
|
|
1635
|
+
assertMembershipOperation(ws, op, response.operation);
|
|
1636
|
+
if (response.state === "abandoned") return {
|
|
1637
|
+
state: response.state,
|
|
1638
|
+
operation: response.operation
|
|
1639
|
+
};
|
|
1640
|
+
if (response.state === "committed" && response.delivery && (!("delivery" in response.operation.result) || response.operation.result.delivery.id !== response.delivery.id)) throw new AccountError({
|
|
1641
|
+
code: "INVALID_RESPONSE",
|
|
1642
|
+
message: "Foreign invitation delivery state."
|
|
1643
|
+
});
|
|
1644
|
+
return response.state === "committed" ? {
|
|
1645
|
+
state: response.state,
|
|
1646
|
+
operation: response.operation,
|
|
1647
|
+
...response.delivery ? {
|
|
1648
|
+
delivery: response.delivery
|
|
1649
|
+
} : {}
|
|
1650
|
+
} : {
|
|
1651
|
+
state: response.state,
|
|
1652
|
+
operation: response.operation
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
async mutateMembership(workspaceId, operationId, request) {
|
|
1656
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId), input = membershipMutationSchema.parse(request);
|
|
1657
|
+
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";
|
|
1658
|
+
const method = input.action === "member.role" ? "PATCH" : input.action === "invite.revoke" || input.action === "member.remove" ? "DELETE" : "POST";
|
|
1659
|
+
const body = {
|
|
1660
|
+
operation_id: op,
|
|
1661
|
+
...input.action === "invite.create" ? {
|
|
1662
|
+
email: input.email,
|
|
1663
|
+
role: input.role
|
|
1664
|
+
} : input.action === "member.role" ? {
|
|
1665
|
+
member_role: input.role
|
|
1666
|
+
} : input.action === "owner.transfer" ? {
|
|
1667
|
+
new_owner_user_id: input.newOwnerId
|
|
1668
|
+
} : {}
|
|
1669
|
+
};
|
|
1670
|
+
try {
|
|
1671
|
+
const response = await this.call(method, `/workspaces/${ws}${path}`, "team:manage", import_zod3.z.object({
|
|
1672
|
+
success: import_zod3.z.literal(true),
|
|
1673
|
+
operation: membershipOperationSchema,
|
|
1674
|
+
replayed: import_zod3.z.boolean()
|
|
1675
|
+
}).strict(), body);
|
|
1676
|
+
assertMembershipOperation(ws, op, response.operation, input);
|
|
1677
|
+
return {
|
|
1678
|
+
operation: response.operation,
|
|
1679
|
+
replayed: response.replayed
|
|
1680
|
+
};
|
|
1681
|
+
} catch {
|
|
1682
|
+
throw new WorkspaceMembershipMutationError(op);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
/** Explicit user-requested settlement only. A lost ACK remains uncertain; never
|
|
1686
|
+
* synthesize abandonment locally or automatically retry with a new ID. */
|
|
1687
|
+
async abandonMembershipOperation(workspaceId, operationId, request) {
|
|
1688
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId), input = membershipMutationSchema.parse(request);
|
|
1689
|
+
try {
|
|
1690
|
+
const response = await this.call("POST", `/workspaces/${ws}/membership-operations/${op}/abandon`, "team:manage", import_zod3.z.object({
|
|
1691
|
+
success: import_zod3.z.literal(true),
|
|
1692
|
+
operation: membershipOperationSchema,
|
|
1693
|
+
replayed: import_zod3.z.boolean()
|
|
1694
|
+
}).strict(), {
|
|
1695
|
+
request: input
|
|
1696
|
+
});
|
|
1697
|
+
assertMembershipOperation(ws, op, response.operation, input);
|
|
1698
|
+
return {
|
|
1699
|
+
operation: response.operation,
|
|
1700
|
+
replayed: response.replayed
|
|
1701
|
+
};
|
|
1702
|
+
} catch {
|
|
1703
|
+
throw new WorkspaceMembershipMutationError(op);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
async abandonKeyOperation(workspaceId, operationId, request) {
|
|
1707
|
+
const ws = id2.parse(workspaceId), op = id2.parse(operationId), input = keyMutationSchema.parse(request);
|
|
1708
|
+
const original = {
|
|
1709
|
+
action: input.action,
|
|
1710
|
+
...input.action === "revoke" ? {} : input.input,
|
|
1711
|
+
...input.action === "create" ? {} : {
|
|
1712
|
+
id: input.keyId,
|
|
1713
|
+
expected_revision: input.expectedRevision
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
try {
|
|
1717
|
+
const response = await this.call("POST", `/workspaces/${ws}/api-keys/operations/${op}/abandon`, "team:manage", import_zod3.z.object({
|
|
1718
|
+
success: import_zod3.z.literal(true),
|
|
1719
|
+
operation: workspaceKeyOperationSchema,
|
|
1720
|
+
replayed: import_zod3.z.boolean()
|
|
1721
|
+
}).strict(), {
|
|
1722
|
+
request: original
|
|
1723
|
+
});
|
|
1724
|
+
this.assertOperation(ws, op, response.operation);
|
|
1725
|
+
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");
|
|
1726
|
+
return {
|
|
1727
|
+
operation: response.operation,
|
|
1728
|
+
replayed: response.replayed
|
|
1729
|
+
};
|
|
1730
|
+
} catch {
|
|
1731
|
+
throw new WorkspaceKeyMutationError(op);
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
async removeMember(workspaceId, memberId) {
|
|
1735
|
+
await this.call("DELETE", `/workspaces/${id2.parse(workspaceId)}/members/${id2.parse(memberId)}`, "team:manage", success);
|
|
1736
|
+
}
|
|
1737
|
+
async transferOwnership(workspaceId, newOwnerUserId) {
|
|
1738
|
+
await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/owner-transfer`, "team:manage", success, {
|
|
1739
|
+
new_owner_user_id: id2.parse(newOwnerUserId)
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
async invites(workspaceId) {
|
|
1743
|
+
return (await this.call("GET", `/workspaces/${id2.parse(workspaceId)}/invites`, "team:read", invitesResponse)).invites;
|
|
1744
|
+
}
|
|
1745
|
+
async invite(workspaceId, email, role2 = "member") {
|
|
1746
|
+
const body = {
|
|
1747
|
+
email: import_zod3.z.string().trim().email().parse(email),
|
|
1748
|
+
role: workspaceInviteRoleSchema.parse(role2)
|
|
1749
|
+
};
|
|
1750
|
+
return (await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/invites`, "team:manage", success.extend({
|
|
1751
|
+
invite: workspaceInviteSchema
|
|
1752
|
+
}), body)).invite;
|
|
1753
|
+
}
|
|
1754
|
+
async revokeInvite(workspaceId, inviteId) {
|
|
1755
|
+
await this.call("DELETE", `/workspaces/${id2.parse(workspaceId)}/invites/${id2.parse(inviteId)}`, "team:manage", success);
|
|
1756
|
+
}
|
|
1757
|
+
async resendInvite(workspaceId, inviteId) {
|
|
1758
|
+
await this.call("POST", `/workspaces/${id2.parse(workspaceId)}/invites/${id2.parse(inviteId)}/resend`, "team:manage", success);
|
|
1759
|
+
}
|
|
1760
|
+
async pendingInvites() {
|
|
1761
|
+
return (await this.call("GET", "/workspace-invites", "team:read", invitesResponse)).invites;
|
|
1762
|
+
}
|
|
1763
|
+
async acceptInvite(inviteId) {
|
|
1764
|
+
await this.call("POST", `/workspace-invites/${id2.parse(inviteId)}/accept`, "team:manage", success);
|
|
1765
|
+
}
|
|
1766
|
+
async declineInvite(inviteId) {
|
|
1767
|
+
await this.call("POST", `/workspace-invites/${id2.parse(inviteId)}/decline`, "team:manage", success);
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1770
|
+
|
|
1771
|
+
// src/workforce.ts
|
|
1772
|
+
var import_zod4 = require("zod");
|
|
1773
|
+
var uuid = import_zod4.z.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());
|
|
1774
|
+
var timestamp3 = import_zod4.z.string().datetime({
|
|
1775
|
+
offset: true
|
|
1776
|
+
});
|
|
1777
|
+
var identifier = import_zod4.z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/@+-]{0,127}$/);
|
|
1778
|
+
var hash = import_zod4.z.string().regex(/^[a-f0-9]{64}$/);
|
|
1779
|
+
var revision = import_zod4.z.string().max(19).regex(/^[1-9][0-9]*$/).refine((value) => BigInt(value) <= 9223372036854775807n);
|
|
1780
|
+
var text = /* @__PURE__ */ __name((max, empty = false) => import_zod4.z.string().max(max).refine((value) => !value.includes("\0") && (empty || Boolean(value.trim())) && new TextEncoder().encode(value).length <= max), "text");
|
|
1781
|
+
var unique = /* @__PURE__ */ __name((items, key) => new Set(items.map(key)).size === items.length, "unique");
|
|
1782
|
+
var workforceOwnerSchema = import_zod4.z.object({
|
|
1783
|
+
type: import_zod4.z.enum([
|
|
1784
|
+
"user",
|
|
1785
|
+
"workspace"
|
|
1786
|
+
]),
|
|
1787
|
+
id: uuid
|
|
1788
|
+
}).strict();
|
|
1789
|
+
var skill = import_zod4.z.object({
|
|
1790
|
+
id: identifier,
|
|
1791
|
+
version: identifier,
|
|
1792
|
+
hash
|
|
1793
|
+
}).strict();
|
|
1794
|
+
var secretReference = import_zod4.z.object({
|
|
1795
|
+
name: import_zod4.z.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),
|
|
1796
|
+
ref: uuid
|
|
1797
|
+
}).strict();
|
|
1798
|
+
var contentShape = {
|
|
1799
|
+
instructions: text(32768, true),
|
|
1800
|
+
skills: import_zod4.z.array(skill).max(64).refine((items) => unique(items, (item) => item.id)),
|
|
1801
|
+
requestedCapabilities: import_zod4.z.array(identifier).max(64).refine((items) => unique(items, (item) => item)),
|
|
1802
|
+
secretReferences: import_zod4.z.array(secretReference).max(32).refine((items) => unique(items, (item) => item.name))
|
|
1803
|
+
};
|
|
1804
|
+
var provenance = import_zod4.z.object({
|
|
1805
|
+
source: import_zod4.z.enum([
|
|
1806
|
+
"authored",
|
|
1807
|
+
"imported"
|
|
1808
|
+
]),
|
|
1809
|
+
sourceVersion: identifier.optional()
|
|
1810
|
+
}).strict();
|
|
1811
|
+
var license = import_zod4.z.object({
|
|
1812
|
+
identifier
|
|
1813
|
+
}).strict();
|
|
1814
|
+
var workforceDefinitionSchema = import_zod4.z.object({
|
|
1815
|
+
schemaVersion: import_zod4.z.literal(1),
|
|
1816
|
+
...contentShape,
|
|
1817
|
+
secretReferences: contentShape.secretReferences.optional(),
|
|
1818
|
+
provenance: provenance.optional(),
|
|
1819
|
+
license: license.optional()
|
|
1820
|
+
}).strict();
|
|
1821
|
+
var createBase = {
|
|
1822
|
+
operationId: uuid,
|
|
1823
|
+
owner: workforceOwnerSchema,
|
|
1824
|
+
// Equality precondition only: the server authenticates the actor and refuses
|
|
1825
|
+
// a changed account. This field never selects or grants an acting identity.
|
|
1826
|
+
expectedActorAccountId: uuid.optional(),
|
|
1827
|
+
name: text(200).transform((value) => value.trim()),
|
|
1828
|
+
description: text(4096, true).optional()
|
|
1829
|
+
};
|
|
1830
|
+
var workforceCreateResourceSchema = import_zod4.z.discriminatedUnion("kind", [
|
|
1831
|
+
import_zod4.z.object({
|
|
1832
|
+
...createBase,
|
|
1833
|
+
kind: import_zod4.z.literal("agent"),
|
|
1834
|
+
definition: workforceDefinitionSchema
|
|
1835
|
+
}).strict(),
|
|
1836
|
+
import_zod4.z.object({
|
|
1837
|
+
...createBase,
|
|
1838
|
+
kind: import_zod4.z.literal("team")
|
|
1839
|
+
}).strict()
|
|
1840
|
+
]);
|
|
1841
|
+
var workforceReadOperationSchema = import_zod4.z.object({
|
|
1842
|
+
operationId: uuid,
|
|
1843
|
+
owner: workforceOwnerSchema,
|
|
1844
|
+
expectedActorAccountId: uuid.optional()
|
|
1845
|
+
}).strict();
|
|
1846
|
+
var catalogCursor = import_zod4.z.string().min(1).max(2048).regex(/^[A-Za-z0-9_-]+$/);
|
|
1847
|
+
var workforceListOwnedResourcesSchema = import_zod4.z.object({
|
|
1848
|
+
owner: workforceOwnerSchema,
|
|
1849
|
+
expectedActorAccountId: uuid,
|
|
1850
|
+
limit: import_zod4.z.number().int().min(1).max(100).optional(),
|
|
1851
|
+
kind: import_zod4.z.enum([
|
|
1852
|
+
"agent",
|
|
1853
|
+
"team"
|
|
1854
|
+
]).optional(),
|
|
1855
|
+
status: import_zod4.z.enum([
|
|
1856
|
+
"active",
|
|
1857
|
+
"archived"
|
|
1858
|
+
]).optional(),
|
|
1859
|
+
cursor: catalogCursor.optional()
|
|
1860
|
+
}).strict();
|
|
1861
|
+
var resource = import_zod4.z.object({
|
|
1862
|
+
id: uuid,
|
|
1863
|
+
kind: import_zod4.z.enum([
|
|
1864
|
+
"agent",
|
|
1865
|
+
"team"
|
|
1866
|
+
]),
|
|
1867
|
+
owner: workforceOwnerSchema,
|
|
1868
|
+
createdByUserId: uuid.nullable(),
|
|
1869
|
+
name: text(200),
|
|
1870
|
+
description: text(4096, true),
|
|
1871
|
+
status: import_zod4.z.enum([
|
|
1872
|
+
"active",
|
|
1873
|
+
"archived"
|
|
1874
|
+
]),
|
|
1875
|
+
revision,
|
|
1876
|
+
createdAt: timestamp3,
|
|
1877
|
+
updatedAt: timestamp3
|
|
1878
|
+
}).strict();
|
|
1879
|
+
var ownedCatalog = import_zod4.z.object({
|
|
1880
|
+
success: import_zod4.z.literal(true),
|
|
1881
|
+
schemaVersion: import_zod4.z.literal(1),
|
|
1882
|
+
scope: import_zod4.z.literal("owned"),
|
|
1883
|
+
owner: workforceOwnerSchema,
|
|
1884
|
+
items: import_zod4.z.array(resource).max(100),
|
|
1885
|
+
nextCursor: catalogCursor.nullable()
|
|
1886
|
+
}).strict();
|
|
1887
|
+
var version = import_zod4.z.object({
|
|
1888
|
+
resourceId: uuid,
|
|
1889
|
+
version: import_zod4.z.number().int().positive(),
|
|
1890
|
+
schemaVersion: import_zod4.z.literal(1),
|
|
1891
|
+
content: import_zod4.z.object(contentShape).strict(),
|
|
1892
|
+
contentHash: hash,
|
|
1893
|
+
provenance: import_zod4.z.union([
|
|
1894
|
+
provenance,
|
|
1895
|
+
import_zod4.z.object({}).strict()
|
|
1896
|
+
]),
|
|
1897
|
+
license: import_zod4.z.union([
|
|
1898
|
+
license,
|
|
1899
|
+
import_zod4.z.object({}).strict()
|
|
1900
|
+
]),
|
|
1901
|
+
createdByUserId: uuid.nullable(),
|
|
1902
|
+
createdAt: timestamp3
|
|
1903
|
+
}).strict();
|
|
1904
|
+
var operation = import_zod4.z.object({
|
|
1905
|
+
schemaVersion: import_zod4.z.literal(1),
|
|
1906
|
+
operationId: uuid,
|
|
1907
|
+
action: import_zod4.z.literal("agent.resource.create"),
|
|
1908
|
+
state: import_zod4.z.literal("committed"),
|
|
1909
|
+
owner: workforceOwnerSchema,
|
|
1910
|
+
resourceId: uuid,
|
|
1911
|
+
resourceRevision: revision,
|
|
1912
|
+
agentVersion: import_zod4.z.number().int().positive().nullable(),
|
|
1913
|
+
committedAt: timestamp3
|
|
1914
|
+
}).strict();
|
|
1915
|
+
var committed = import_zod4.z.object({
|
|
1916
|
+
success: import_zod4.z.literal(true),
|
|
1917
|
+
state: import_zod4.z.literal("committed"),
|
|
1918
|
+
operation,
|
|
1919
|
+
resource: resource.nullable(),
|
|
1920
|
+
version: version.nullable(),
|
|
1921
|
+
replayed: import_zod4.z.boolean(),
|
|
1922
|
+
resourceAccess: import_zod4.z.discriminatedUnion("allowed", [
|
|
1923
|
+
import_zod4.z.object({
|
|
1924
|
+
allowed: import_zod4.z.literal(true)
|
|
1925
|
+
}).strict(),
|
|
1926
|
+
import_zod4.z.object({
|
|
1927
|
+
allowed: import_zod4.z.literal(false),
|
|
1928
|
+
reason: import_zod4.z.literal("no_access")
|
|
1929
|
+
}).strict()
|
|
1930
|
+
])
|
|
1931
|
+
}).strict();
|
|
1932
|
+
var notObserved = import_zod4.z.object({
|
|
1933
|
+
success: import_zod4.z.literal(true),
|
|
1934
|
+
state: import_zod4.z.literal("not-observed"),
|
|
1935
|
+
operation: import_zod4.z.null(),
|
|
1936
|
+
resource: import_zod4.z.null(),
|
|
1937
|
+
version: import_zod4.z.null(),
|
|
1938
|
+
replayed: import_zod4.z.literal(false)
|
|
1939
|
+
}).strict();
|
|
1940
|
+
var WorkforceResourceMutationError = class extends AccountError {
|
|
1941
|
+
static {
|
|
1942
|
+
__name(this, "WorkforceResourceMutationError");
|
|
1943
|
+
}
|
|
1944
|
+
operationId;
|
|
1945
|
+
outcome = "uncertain";
|
|
1946
|
+
reason = "mutation_outcome_unverified";
|
|
1947
|
+
source = "client-observation";
|
|
1948
|
+
owner;
|
|
1949
|
+
constructor(operationId, owner, cause) {
|
|
1950
|
+
super({
|
|
1951
|
+
code: cause instanceof AccountError ? cause.code : "PLATFORM_ERROR",
|
|
1952
|
+
message: "Workforce creation acknowledgement is unverified. Read back the same operation before retrying.",
|
|
1953
|
+
httpStatus: cause instanceof AccountError ? cause.httpStatus : null,
|
|
1954
|
+
retryable: false
|
|
1955
|
+
}), this.operationId = operationId;
|
|
1956
|
+
this.name = "WorkforceResourceMutationError";
|
|
1957
|
+
this.owner = Object.freeze({
|
|
1958
|
+
...owner
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
var sameOwner = /* @__PURE__ */ __name((left, right) => left.type === right.type && left.id === right.id, "sameOwner");
|
|
1963
|
+
var invalidResponse = /* @__PURE__ */ __name(() => new AccountError({
|
|
1964
|
+
code: "INVALID_RESPONSE",
|
|
1965
|
+
message: "Invalid workforce operation response."
|
|
1966
|
+
}), "invalidResponse");
|
|
1967
|
+
var invalidInput = /* @__PURE__ */ __name(() => new AccountError({
|
|
1968
|
+
code: "BAD_REQUEST",
|
|
1969
|
+
message: "Invalid workforce operation request."
|
|
1970
|
+
}), "invalidInput");
|
|
1971
|
+
function assertData(value, depth = 0, budget = {
|
|
1972
|
+
remaining: 4096
|
|
1973
|
+
}) {
|
|
1974
|
+
if (--budget.remaining < 0 || depth > 8) throw invalidInput();
|
|
1975
|
+
if (value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number") return;
|
|
1976
|
+
if (!value || typeof value !== "object") throw invalidInput();
|
|
1977
|
+
const array = Array.isArray(value);
|
|
1978
|
+
if (array ? Object.getPrototypeOf(value) !== Array.prototype : ![
|
|
1979
|
+
Object.prototype,
|
|
1980
|
+
null
|
|
1981
|
+
].includes(Object.getPrototypeOf(value))) throw invalidInput();
|
|
1982
|
+
const keys = Reflect.ownKeys(value);
|
|
1983
|
+
if (keys.length > 4096 || array && keys.length !== value.length + 1) throw invalidInput();
|
|
1984
|
+
for (const key of keys) {
|
|
1985
|
+
if (array && key === "length") continue;
|
|
1986
|
+
if (typeof key !== "string" || array && !/^(0|[1-9][0-9]*)$/.test(key)) throw invalidInput();
|
|
1987
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
1988
|
+
if (!descriptor.enumerable || !Object.hasOwn(descriptor, "value")) throw invalidInput();
|
|
1989
|
+
assertData(descriptor.value, depth + 1, budget);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
__name(assertData, "assertData");
|
|
1993
|
+
function parseInput(schema, value) {
|
|
1994
|
+
assertData(value);
|
|
1995
|
+
const parsed = schema.safeParse(value);
|
|
1996
|
+
if (!parsed.success) throw invalidInput();
|
|
1997
|
+
if (new TextEncoder().encode(JSON.stringify(parsed.data)).length > 256 * 1024) throw invalidInput();
|
|
1998
|
+
return parsed.data;
|
|
1999
|
+
}
|
|
2000
|
+
__name(parseInput, "parseInput");
|
|
2001
|
+
var WorkforceClient = class {
|
|
2002
|
+
static {
|
|
2003
|
+
__name(this, "WorkforceClient");
|
|
2004
|
+
}
|
|
2005
|
+
transport;
|
|
2006
|
+
authorize;
|
|
2007
|
+
base;
|
|
2008
|
+
constructor(base2, transport, authorize) {
|
|
2009
|
+
this.transport = transport;
|
|
2010
|
+
this.authorize = authorize;
|
|
2011
|
+
const origin = new URL(base2);
|
|
2012
|
+
if (origin.protocol !== "https:" || origin.username || origin.password || origin.search || origin.hash || origin.pathname !== "/") {
|
|
2013
|
+
throw new AccountError({
|
|
2014
|
+
code: "BAD_REQUEST",
|
|
2015
|
+
message: "Workforce API requires an HTTPS origin."
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
this.base = origin.origin;
|
|
2019
|
+
}
|
|
2020
|
+
/** This catalog lists one explicitly owned scope only. It is not an aggregate
|
|
2021
|
+
* of assigned, shared or rented resources and contains no agent definitions. */
|
|
2022
|
+
async listOwnedResources(value) {
|
|
2023
|
+
const input = parseInput(workforceListOwnedResourcesSchema, value);
|
|
2024
|
+
const url = `${this.base}/api/workforce/resources/list`;
|
|
2025
|
+
const raw = await this.transport.request({
|
|
2026
|
+
method: "POST",
|
|
2027
|
+
url,
|
|
2028
|
+
body: input,
|
|
2029
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
2030
|
+
const auth = await this.authorize("POST", url, {
|
|
2031
|
+
scopes: [
|
|
2032
|
+
"workforce:read"
|
|
2033
|
+
],
|
|
2034
|
+
silent: true
|
|
2035
|
+
});
|
|
2036
|
+
if (!auth) throw new AccountError({
|
|
2037
|
+
code: "INVALID_TOKEN",
|
|
2038
|
+
message: "Sign in with workforce read access."
|
|
2039
|
+
});
|
|
2040
|
+
return auth;
|
|
2041
|
+
}, "authorization")
|
|
2042
|
+
});
|
|
2043
|
+
const parsed = ownedCatalog.safeParse(raw);
|
|
2044
|
+
if (!parsed.success) throw invalidResponse();
|
|
2045
|
+
const result = parsed.data;
|
|
2046
|
+
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();
|
|
2047
|
+
return result;
|
|
2048
|
+
}
|
|
2049
|
+
validate(raw, input, creating) {
|
|
2050
|
+
const parsed = (creating ? committed : import_zod4.z.union([
|
|
2051
|
+
committed,
|
|
2052
|
+
notObserved
|
|
2053
|
+
])).safeParse(raw);
|
|
2054
|
+
if (!parsed.success) throw invalidResponse();
|
|
2055
|
+
const result = parsed.data;
|
|
2056
|
+
if (result.state === "not-observed") return result;
|
|
2057
|
+
const op = result.operation;
|
|
2058
|
+
if (op.operationId !== input.operationId || !sameOwner(op.owner, input.owner)) throw invalidResponse();
|
|
2059
|
+
if (!result.resourceAccess.allowed) {
|
|
2060
|
+
if (result.resource !== null || result.version !== null) throw invalidResponse();
|
|
2061
|
+
return result;
|
|
2062
|
+
}
|
|
2063
|
+
const r = result.resource, v = result.version;
|
|
2064
|
+
if (!r || r.id !== op.resourceId || !sameOwner(r.owner, input.owner) || BigInt(r.revision) < BigInt(op.resourceRevision)) throw invalidResponse();
|
|
2065
|
+
if (r.kind === "team" ? op.agentVersion !== null || v !== null : op.agentVersion === null || !v || v.resourceId !== r.id || v.version !== op.agentVersion) throw invalidResponse();
|
|
2066
|
+
return result;
|
|
2067
|
+
}
|
|
2068
|
+
async createResource(value) {
|
|
2069
|
+
const input = parseInput(workforceCreateResourceSchema, value);
|
|
2070
|
+
let authorizationCompleted = false;
|
|
2071
|
+
try {
|
|
2072
|
+
const url = `${this.base}/api/workforce/resources`;
|
|
2073
|
+
const raw = await this.transport.request({
|
|
2074
|
+
method: "POST",
|
|
2075
|
+
url,
|
|
2076
|
+
body: input,
|
|
2077
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
2078
|
+
const auth = await this.authorize("POST", url, {
|
|
2079
|
+
scopes: [
|
|
2080
|
+
"workforce:manage"
|
|
2081
|
+
],
|
|
2082
|
+
silent: true
|
|
2083
|
+
});
|
|
2084
|
+
if (!auth) throw new AccountError({
|
|
2085
|
+
code: "INVALID_TOKEN",
|
|
2086
|
+
message: "Sign in with workforce management access."
|
|
2087
|
+
});
|
|
2088
|
+
authorizationCompleted = true;
|
|
2089
|
+
return auth;
|
|
2090
|
+
}, "authorization")
|
|
2091
|
+
});
|
|
2092
|
+
const result = this.validate(raw, input, true);
|
|
2093
|
+
if (result.resource && result.resource.kind !== input.kind) throw invalidResponse();
|
|
2094
|
+
if (input.kind === "agent" !== (result.operation.agentVersion !== null)) throw invalidResponse();
|
|
2095
|
+
return result;
|
|
2096
|
+
} catch (error) {
|
|
2097
|
+
if (!authorizationCompleted) throw error;
|
|
2098
|
+
throw new WorkforceResourceMutationError(input.operationId, input.owner, error);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
async readOperation(value) {
|
|
2102
|
+
const input = parseInput(workforceReadOperationSchema, value);
|
|
2103
|
+
const url = `${this.base}/api/workforce/resource-operations/read`;
|
|
2104
|
+
const raw = await this.transport.request({
|
|
2105
|
+
method: "POST",
|
|
2106
|
+
url,
|
|
2107
|
+
body: input,
|
|
2108
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
2109
|
+
const auth = await this.authorize("POST", url, {
|
|
2110
|
+
scopes: [
|
|
2111
|
+
"workforce:read"
|
|
2112
|
+
],
|
|
2113
|
+
silent: true
|
|
2114
|
+
});
|
|
2115
|
+
if (!auth) throw new AccountError({
|
|
2116
|
+
code: "INVALID_TOKEN",
|
|
2117
|
+
message: "Sign in with workforce read access."
|
|
2118
|
+
});
|
|
2119
|
+
return auth;
|
|
2120
|
+
}, "authorization")
|
|
2121
|
+
});
|
|
2122
|
+
return this.validate(raw, input, false);
|
|
2123
|
+
}
|
|
2124
|
+
};
|
|
2125
|
+
|
|
2126
|
+
// src/notifications.ts
|
|
2127
|
+
var import_zod5 = require("zod");
|
|
2128
|
+
var id3 = import_zod5.z.string().uuid();
|
|
2129
|
+
var localId = import_zod5.z.string().regex(/^[a-z0-9_:-]{1,240}$/i);
|
|
2130
|
+
var timestamp4 = import_zod5.z.string().datetime({
|
|
2131
|
+
offset: true
|
|
2132
|
+
});
|
|
2133
|
+
var revision2 = import_zod5.z.union([
|
|
2134
|
+
import_zod5.z.literal("0"),
|
|
2135
|
+
id3
|
|
2136
|
+
]);
|
|
2137
|
+
var httpsUrl = import_zod5.z.string().max(2048).url().refine((value) => {
|
|
2138
|
+
const parsed = new URL(value);
|
|
2139
|
+
return parsed.protocol === "https:" && !parsed.username && !parsed.password && !parsed.hash;
|
|
2140
|
+
}, "Notification destinations require credential-free HTTPS URLs");
|
|
2141
|
+
var notificationEventSchema = import_zod5.z.enum([
|
|
2142
|
+
"agent.finished",
|
|
2143
|
+
"agent.failed",
|
|
2144
|
+
"agent.cancelled"
|
|
2145
|
+
]);
|
|
2146
|
+
var notificationChannelSchema = import_zod5.z.enum([
|
|
2147
|
+
"webhook",
|
|
2148
|
+
"slack",
|
|
2149
|
+
"discord"
|
|
2150
|
+
]);
|
|
2151
|
+
var notificationScopeSchema = import_zod5.z.object({
|
|
2152
|
+
workspaceId: localId,
|
|
2153
|
+
workspaceCreatedAt: timestamp4.transform((value) => new Date(value).toISOString()),
|
|
2154
|
+
teamId: localId.optional(),
|
|
2155
|
+
agentId: localId.optional()
|
|
2156
|
+
}).strict().refine((scope) => !scope.agentId || !!scope.teamId, "Agent requires owning team");
|
|
2157
|
+
var notificationRuleSchema = import_zod5.z.object({
|
|
2158
|
+
id: import_zod5.z.string().regex(/^[a-f0-9]{64}$/).optional(),
|
|
2159
|
+
event: notificationEventSchema,
|
|
2160
|
+
channel: notificationChannelSchema,
|
|
2161
|
+
destinationId: id3,
|
|
2162
|
+
enabled: import_zod5.z.boolean()
|
|
2163
|
+
}).strict();
|
|
2164
|
+
var deliverySchema = import_zod5.z.object({
|
|
2165
|
+
id: id3,
|
|
2166
|
+
destination_id: id3,
|
|
2167
|
+
event: notificationEventSchema,
|
|
2168
|
+
state: import_zod5.z.enum([
|
|
2169
|
+
"queued",
|
|
2170
|
+
"leased",
|
|
2171
|
+
"delivered",
|
|
2172
|
+
"failed",
|
|
2173
|
+
"cancelled"
|
|
2174
|
+
]),
|
|
2175
|
+
attempt: import_zod5.z.number().int().nonnegative(),
|
|
2176
|
+
max_attempts: import_zod5.z.number().int().positive(),
|
|
2177
|
+
status_code: import_zod5.z.number().int().min(100).max(599).nullable().optional(),
|
|
2178
|
+
error_code: import_zod5.z.string().max(128).nullable().optional(),
|
|
2179
|
+
created_at: timestamp4,
|
|
2180
|
+
delivered_at: timestamp4.nullable().optional(),
|
|
2181
|
+
next_retry_at: timestamp4.nullable().optional(),
|
|
2182
|
+
cancelled_at: timestamp4.nullable().optional()
|
|
2183
|
+
});
|
|
2184
|
+
var notificationSettingsDestinationSchema = import_zod5.z.object({
|
|
2185
|
+
id: id3,
|
|
2186
|
+
label: import_zod5.z.string().min(1).max(253).refine((value) => value === "Unavailable webhook" || /^[a-z0-9.:[\]-]+$/i.test(value)),
|
|
2187
|
+
channel: notificationChannelSchema,
|
|
2188
|
+
ready: import_zod5.z.boolean(),
|
|
2189
|
+
enabled: import_zod5.z.boolean(),
|
|
2190
|
+
updated_at: timestamp4
|
|
2191
|
+
}).strict().transform(({ updated_at, ...value }) => ({
|
|
2192
|
+
...value,
|
|
2193
|
+
updatedAt: updated_at
|
|
2194
|
+
}));
|
|
2195
|
+
var notificationSettingsSchema = import_zod5.z.object({
|
|
2196
|
+
success: import_zod5.z.literal(true),
|
|
2197
|
+
channelVersion: import_zod5.z.literal(2),
|
|
2198
|
+
revision: revision2,
|
|
2199
|
+
rules: import_zod5.z.array(notificationRuleSchema).max(20),
|
|
2200
|
+
destinations: import_zod5.z.array(notificationSettingsDestinationSchema),
|
|
2201
|
+
deliveries: import_zod5.z.array(deliverySchema).max(50),
|
|
2202
|
+
channels: import_zod5.z.array(import_zod5.z.object({
|
|
2203
|
+
id: import_zod5.z.enum([
|
|
2204
|
+
"webhook",
|
|
2205
|
+
"email",
|
|
2206
|
+
"slack",
|
|
2207
|
+
"discord"
|
|
2208
|
+
]),
|
|
2209
|
+
available: import_zod5.z.boolean()
|
|
2210
|
+
})),
|
|
2211
|
+
digestFrequencies: import_zod5.z.tuple([
|
|
2212
|
+
import_zod5.z.literal("realtime")
|
|
2213
|
+
])
|
|
2214
|
+
});
|
|
2215
|
+
var eventInputSchema = import_zod5.z.object({
|
|
2216
|
+
eventId: import_zod5.z.string().regex(/^[a-f0-9]{64}$/),
|
|
2217
|
+
event: notificationEventSchema,
|
|
2218
|
+
occurredAt: timestamp4.transform((value) => new Date(value).toISOString()),
|
|
2219
|
+
scope: notificationScopeSchema,
|
|
2220
|
+
conversationId: localId,
|
|
2221
|
+
requestId: localId
|
|
2222
|
+
}).strict();
|
|
2223
|
+
var notificationDestinationActionSchema = import_zod5.z.discriminatedUnion("action", [
|
|
2224
|
+
import_zod5.z.object({
|
|
2225
|
+
action: import_zod5.z.literal("create"),
|
|
2226
|
+
url: httpsUrl
|
|
2227
|
+
}).strict(),
|
|
2228
|
+
import_zod5.z.object({
|
|
2229
|
+
action: import_zod5.z.literal("update"),
|
|
2230
|
+
destination_id: id3,
|
|
2231
|
+
expected_updated_at: timestamp4,
|
|
2232
|
+
url: httpsUrl.optional(),
|
|
2233
|
+
enabled: import_zod5.z.boolean().optional()
|
|
2234
|
+
}).strict().refine((value) => value.url !== void 0 || value.enabled !== void 0, "An update requires a changed field"),
|
|
2235
|
+
import_zod5.z.object({
|
|
2236
|
+
action: import_zod5.z.literal("delete"),
|
|
2237
|
+
destination_id: id3,
|
|
2238
|
+
expected_updated_at: timestamp4
|
|
2239
|
+
}).strict(),
|
|
2240
|
+
import_zod5.z.object({
|
|
2241
|
+
action: import_zod5.z.literal("delivery-control"),
|
|
2242
|
+
destination_id: id3,
|
|
2243
|
+
delivery_id: id3,
|
|
2244
|
+
operation: import_zod5.z.enum([
|
|
2245
|
+
"retry",
|
|
2246
|
+
"cancel"
|
|
2247
|
+
])
|
|
2248
|
+
}).strict()
|
|
2249
|
+
]);
|
|
2250
|
+
var notificationDestinationSchema = import_zod5.z.object({
|
|
2251
|
+
id: id3,
|
|
2252
|
+
label: import_zod5.z.string().min(1).max(253),
|
|
2253
|
+
channel: import_zod5.z.literal("webhook"),
|
|
2254
|
+
ready: import_zod5.z.boolean(),
|
|
2255
|
+
enabled: import_zod5.z.boolean(),
|
|
2256
|
+
updated_at: timestamp4
|
|
2257
|
+
}).strict();
|
|
2258
|
+
var notificationDeliveryOperationResultSchema = import_zod5.z.object({
|
|
2259
|
+
id: id3,
|
|
2260
|
+
state: import_zod5.z.string().min(1).max(64),
|
|
2261
|
+
attempt: import_zod5.z.number().int().nonnegative(),
|
|
2262
|
+
max_attempts: import_zod5.z.number().int().positive()
|
|
2263
|
+
}).strict();
|
|
2264
|
+
var notificationDestinationOperationSchema = import_zod5.z.object({
|
|
2265
|
+
operation_id: id3,
|
|
2266
|
+
workspace_id: id3,
|
|
2267
|
+
actor_user_id: id3,
|
|
2268
|
+
client_id: import_zod5.z.string().min(1).max(128),
|
|
2269
|
+
action: import_zod5.z.enum([
|
|
2270
|
+
"create",
|
|
2271
|
+
"update",
|
|
2272
|
+
"delete",
|
|
2273
|
+
"delivery-control"
|
|
2274
|
+
]),
|
|
2275
|
+
state: import_zod5.z.enum([
|
|
2276
|
+
"prepared",
|
|
2277
|
+
"committed",
|
|
2278
|
+
"rejected"
|
|
2279
|
+
]),
|
|
2280
|
+
prepared_at: timestamp4,
|
|
2281
|
+
committed_at: timestamp4.optional(),
|
|
2282
|
+
destination: notificationDestinationSchema.optional(),
|
|
2283
|
+
delivery: notificationDeliveryOperationResultSchema.optional(),
|
|
2284
|
+
rejection: import_zod5.z.enum([
|
|
2285
|
+
"notification_destination_not_found",
|
|
2286
|
+
"notification_destination_generation_conflict",
|
|
2287
|
+
"notification_delivery_transition_unavailable"
|
|
2288
|
+
]).optional()
|
|
2289
|
+
}).strict().superRefine((value, context) => {
|
|
2290
|
+
if (value.state === "rejected" && !value.rejection) context.addIssue({
|
|
2291
|
+
code: "custom",
|
|
2292
|
+
message: "Rejected operation requires a rejection."
|
|
2293
|
+
});
|
|
2294
|
+
if (value.state === "committed" && !value.committed_at) context.addIssue({
|
|
2295
|
+
code: "custom",
|
|
2296
|
+
message: "Committed operation requires a timestamp."
|
|
2297
|
+
});
|
|
2298
|
+
});
|
|
2299
|
+
var destinationOperationMutationResponseSchema = import_zod5.z.object({
|
|
2300
|
+
state: import_zod5.z.enum([
|
|
2301
|
+
"prepared",
|
|
2302
|
+
"committed",
|
|
2303
|
+
"rejected"
|
|
2304
|
+
]),
|
|
2305
|
+
operation: notificationDestinationOperationSchema,
|
|
2306
|
+
replayed: import_zod5.z.boolean()
|
|
2307
|
+
}).strict();
|
|
2308
|
+
var destinationOperationLookupResponseSchema = import_zod5.z.union([
|
|
2309
|
+
import_zod5.z.object({
|
|
2310
|
+
state: import_zod5.z.literal("not-observed"),
|
|
2311
|
+
operation: import_zod5.z.null()
|
|
2312
|
+
}).strict(),
|
|
2313
|
+
import_zod5.z.object({
|
|
2314
|
+
state: import_zod5.z.enum([
|
|
2315
|
+
"prepared",
|
|
2316
|
+
"committed",
|
|
2317
|
+
"rejected"
|
|
2318
|
+
]),
|
|
2319
|
+
operation: notificationDestinationOperationSchema
|
|
2320
|
+
}).strict()
|
|
2321
|
+
]);
|
|
2322
|
+
var destinationOperationExecuteResponseSchema = destinationOperationMutationResponseSchema.extend({
|
|
2323
|
+
secret: import_zod5.z.string().regex(/^[a-f0-9]{64}$/).optional()
|
|
2324
|
+
}).strict();
|
|
2325
|
+
var NotificationsClient = class {
|
|
2326
|
+
static {
|
|
2327
|
+
__name(this, "NotificationsClient");
|
|
2328
|
+
}
|
|
2329
|
+
transport;
|
|
2330
|
+
authorize;
|
|
2331
|
+
origin;
|
|
2332
|
+
constructor(origin, transport, authorize) {
|
|
2333
|
+
this.transport = transport;
|
|
2334
|
+
this.authorize = authorize;
|
|
2335
|
+
const url = new URL(origin);
|
|
2336
|
+
if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash || url.pathname !== "/") throw new AccountError({
|
|
2337
|
+
code: "BAD_REQUEST",
|
|
2338
|
+
message: "Notifications API requires an HTTPS origin."
|
|
2339
|
+
});
|
|
2340
|
+
this.origin = url.origin;
|
|
2341
|
+
}
|
|
2342
|
+
async call(workspaceId, method, suffix, schema, body) {
|
|
2343
|
+
const url = `${this.origin}/api/workspaces/${id3.parse(workspaceId)}/notifications${suffix}`;
|
|
2344
|
+
const response = await this.transport.request({
|
|
2345
|
+
method,
|
|
2346
|
+
url,
|
|
2347
|
+
...body === void 0 ? {} : {
|
|
2348
|
+
body
|
|
2349
|
+
},
|
|
2350
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
2351
|
+
const value = await this.authorize(method, url, {
|
|
2352
|
+
scopes: [
|
|
2353
|
+
method === "GET" ? "team:read" : "team:manage"
|
|
2354
|
+
],
|
|
2355
|
+
silent: true
|
|
2356
|
+
});
|
|
2357
|
+
if (!value) throw new AccountError({
|
|
2358
|
+
code: "INVALID_TOKEN",
|
|
2359
|
+
message: "Sign in to manage notifications."
|
|
2360
|
+
});
|
|
2361
|
+
return value;
|
|
2362
|
+
}, "authorization")
|
|
2363
|
+
});
|
|
2364
|
+
const parsed = schema.safeParse(response);
|
|
2365
|
+
if (!parsed.success) throw new AccountError({
|
|
2366
|
+
code: "INVALID_RESPONSE",
|
|
2367
|
+
message: "Invalid notification response."
|
|
2368
|
+
});
|
|
2369
|
+
return parsed.data;
|
|
2370
|
+
}
|
|
2371
|
+
read(workspaceId, scope) {
|
|
2372
|
+
return this.call(workspaceId, "GET", `/v2?scope=${encodeURIComponent(JSON.stringify(notificationScopeSchema.parse(scope)))}`, notificationSettingsSchema);
|
|
2373
|
+
}
|
|
2374
|
+
save(workspaceId, input) {
|
|
2375
|
+
const body = import_zod5.z.object({
|
|
2376
|
+
scope: notificationScopeSchema,
|
|
2377
|
+
expectedRevision: revision2,
|
|
2378
|
+
rules: import_zod5.z.array(notificationRuleSchema).max(20)
|
|
2379
|
+
}).strict().parse(input);
|
|
2380
|
+
return this.call(workspaceId, "POST", "/v2/settings", notificationSettingsSchema, body);
|
|
2381
|
+
}
|
|
2382
|
+
emit(workspaceId, input) {
|
|
2383
|
+
return this.call(workspaceId, "POST", "/events", import_zod5.z.object({
|
|
2384
|
+
success: import_zod5.z.literal(true),
|
|
2385
|
+
admitted: import_zod5.z.literal(true),
|
|
2386
|
+
duplicate: import_zod5.z.boolean()
|
|
2387
|
+
}), eventInputSchema.parse(input));
|
|
2388
|
+
}
|
|
2389
|
+
async prepareDestinationOperation(workspaceId, operationId, action) {
|
|
2390
|
+
const workspace = id3.parse(workspaceId), operation3 = id3.parse(operationId), request = notificationDestinationActionSchema.parse(action);
|
|
2391
|
+
const result = await this.call(workspace, "PUT", `/destination-operations/${operation3}`, destinationOperationMutationResponseSchema, request);
|
|
2392
|
+
if (result.operation.operation_id !== operation3 || result.operation.workspace_id !== workspace || result.operation.action !== request.action || result.operation.state !== result.state) throw new AccountError({
|
|
2393
|
+
code: "INVALID_RESPONSE",
|
|
2394
|
+
message: "Mismatched notification operation receipt."
|
|
2395
|
+
});
|
|
2396
|
+
return result;
|
|
2397
|
+
}
|
|
2398
|
+
async lookupDestinationOperation(workspaceId, operationId) {
|
|
2399
|
+
const workspace = id3.parse(workspaceId), operation3 = id3.parse(operationId);
|
|
2400
|
+
const result = await this.call(workspace, "GET", `/destination-operations/${operation3}`, destinationOperationLookupResponseSchema);
|
|
2401
|
+
if (result.operation && (result.operation.operation_id !== operation3 || result.operation.workspace_id !== workspace || result.operation.state !== result.state)) throw new AccountError({
|
|
2402
|
+
code: "INVALID_RESPONSE",
|
|
2403
|
+
message: "Mismatched notification operation receipt."
|
|
2404
|
+
});
|
|
2405
|
+
return result;
|
|
2406
|
+
}
|
|
2407
|
+
async executeDestinationOperation(workspaceId, operationId) {
|
|
2408
|
+
const workspace = id3.parse(workspaceId), operation3 = id3.parse(operationId);
|
|
2409
|
+
const result = await this.call(workspace, "POST", `/destination-operations/${operation3}`, destinationOperationExecuteResponseSchema);
|
|
2410
|
+
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({
|
|
2411
|
+
code: "INVALID_RESPONSE",
|
|
2412
|
+
message: "Mismatched notification operation receipt."
|
|
2413
|
+
});
|
|
2414
|
+
return result;
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2418
|
+
// src/integrations.ts
|
|
2419
|
+
var import_zod6 = require("zod");
|
|
2420
|
+
var id4 = import_zod6.z.string().uuid();
|
|
2421
|
+
var provider = import_zod6.z.enum([
|
|
2422
|
+
"google",
|
|
2423
|
+
"github",
|
|
2424
|
+
"twitter"
|
|
2425
|
+
]);
|
|
2426
|
+
var linked = import_zod6.z.object({
|
|
2427
|
+
provider,
|
|
2428
|
+
email: import_zod6.z.string().email().nullable(),
|
|
2429
|
+
username: import_zod6.z.string().nullable(),
|
|
2430
|
+
created_at: import_zod6.z.string().datetime({
|
|
2431
|
+
offset: true
|
|
2432
|
+
}).optional()
|
|
2433
|
+
}).passthrough();
|
|
2434
|
+
var integration = import_zod6.z.object({
|
|
2435
|
+
provider,
|
|
2436
|
+
available: import_zod6.z.boolean(),
|
|
2437
|
+
scopes: import_zod6.z.array(import_zod6.z.string().min(1)).max(16),
|
|
2438
|
+
linked: linked.nullable()
|
|
2439
|
+
}).strict();
|
|
2440
|
+
var operation2 = import_zod6.z.object({
|
|
2441
|
+
operationId: id4,
|
|
2442
|
+
actorAccountId: id4.optional(),
|
|
2443
|
+
clientId: import_zod6.z.string().optional(),
|
|
2444
|
+
provider: provider.optional(),
|
|
2445
|
+
scopes: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2446
|
+
state: import_zod6.z.enum([
|
|
2447
|
+
"not-observed",
|
|
2448
|
+
"waiting",
|
|
2449
|
+
"exchanging",
|
|
2450
|
+
"committed",
|
|
2451
|
+
"rejected",
|
|
2452
|
+
"cancelled"
|
|
2453
|
+
]),
|
|
2454
|
+
authorizationUrl: import_zod6.z.string().url().optional(),
|
|
2455
|
+
expiresAt: import_zod6.z.string().datetime({
|
|
2456
|
+
offset: true
|
|
2457
|
+
}).optional(),
|
|
2458
|
+
linked: linked.optional(),
|
|
2459
|
+
rejection: import_zod6.z.string().optional(),
|
|
2460
|
+
replayed: import_zod6.z.boolean().optional()
|
|
2461
|
+
}).strict();
|
|
2462
|
+
var AccountIntegrationClient = class {
|
|
2463
|
+
static {
|
|
2464
|
+
__name(this, "AccountIntegrationClient");
|
|
2465
|
+
}
|
|
2466
|
+
transport;
|
|
2467
|
+
authorize;
|
|
2468
|
+
base;
|
|
2469
|
+
constructor(base2, transport, authorize) {
|
|
2470
|
+
this.transport = transport;
|
|
2471
|
+
this.authorize = authorize;
|
|
2472
|
+
this.base = new URL(base2).origin;
|
|
2473
|
+
}
|
|
2474
|
+
async call(method, path, schema, body, idempotencyKey) {
|
|
2475
|
+
const url = `${this.base}/api/account-integrations${path}`, raw = await this.transport.request({
|
|
2476
|
+
method,
|
|
2477
|
+
url,
|
|
2478
|
+
...body === void 0 ? {} : {
|
|
2479
|
+
body
|
|
2480
|
+
},
|
|
2481
|
+
...idempotencyKey ? {
|
|
2482
|
+
idempotencyKey
|
|
2483
|
+
} : {},
|
|
2484
|
+
authorization: /* @__PURE__ */ __name(async () => {
|
|
2485
|
+
const value = await this.authorize(method, url, {
|
|
2486
|
+
scopes: [
|
|
2487
|
+
"openid"
|
|
2488
|
+
],
|
|
2489
|
+
silent: true
|
|
2490
|
+
});
|
|
2491
|
+
if (!value) throw new AccountError({
|
|
2492
|
+
code: "INVALID_TOKEN",
|
|
2493
|
+
message: "Sign in to manage account integrations."
|
|
2494
|
+
});
|
|
2495
|
+
return value;
|
|
2496
|
+
}, "authorization")
|
|
2497
|
+
});
|
|
2498
|
+
const parsed = schema.safeParse(raw);
|
|
2499
|
+
if (!parsed.success) throw new AccountError({
|
|
2500
|
+
code: "INVALID_RESPONSE",
|
|
2501
|
+
message: "Invalid account integration response."
|
|
2502
|
+
});
|
|
2503
|
+
return parsed.data;
|
|
2504
|
+
}
|
|
2505
|
+
async list() {
|
|
2506
|
+
return (await this.call("GET", "", import_zod6.z.object({
|
|
2507
|
+
success: import_zod6.z.literal(true),
|
|
2508
|
+
providers: import_zod6.z.array(integration)
|
|
2509
|
+
}).strict())).providers;
|
|
2510
|
+
}
|
|
2511
|
+
async operation(operationId) {
|
|
2512
|
+
return (await this.call("GET", `/operations/${id4.parse(operationId)}`, import_zod6.z.object({
|
|
2513
|
+
success: import_zod6.z.literal(true),
|
|
2514
|
+
operation: operation2
|
|
2515
|
+
}).strict())).operation;
|
|
2516
|
+
}
|
|
2517
|
+
async start(operationId, value) {
|
|
2518
|
+
const operationIdValue = id4.parse(operationId), result = (await this.call("POST", `/${provider.parse(value)}/operations/${operationIdValue}/start`, import_zod6.z.object({
|
|
2519
|
+
success: import_zod6.z.literal(true),
|
|
2520
|
+
operation: operation2
|
|
2521
|
+
}).strict(), {}, operationIdValue)).operation;
|
|
2522
|
+
if (result.operationId !== operationIdValue || result.provider !== value || result.state !== "waiting" || !result.authorizationUrl) throw new AccountError({
|
|
2523
|
+
code: "INVALID_RESPONSE",
|
|
2524
|
+
message: "Invalid provider authorization operation."
|
|
2525
|
+
});
|
|
2526
|
+
const url = new URL(result.authorizationUrl);
|
|
2527
|
+
if (url.protocol !== "https:" || url.username || url.password) throw new AccountError({
|
|
2528
|
+
code: "INVALID_RESPONSE",
|
|
2529
|
+
message: "Untrusted provider authorization URL."
|
|
2530
|
+
});
|
|
2531
|
+
return result;
|
|
2532
|
+
}
|
|
2533
|
+
async cancel(operationId) {
|
|
2534
|
+
return (await this.call("POST", `/operations/${id4.parse(operationId)}/cancel`, import_zod6.z.object({
|
|
2535
|
+
success: import_zod6.z.literal(true),
|
|
2536
|
+
operation: operation2
|
|
2537
|
+
}).strict(), {})).operation;
|
|
2538
|
+
}
|
|
2539
|
+
};
|
|
2540
|
+
|
|
856
2541
|
// src/verification.ts
|
|
857
2542
|
var jwksCache = /* @__PURE__ */ new Map();
|
|
858
2543
|
function bytes(value) {
|
|
@@ -1020,11 +2705,11 @@ function base64url(bytes2) {
|
|
|
1020
2705
|
}
|
|
1021
2706
|
__name(base64url, "base64url");
|
|
1022
2707
|
function endpoints(cfg) {
|
|
1023
|
-
const
|
|
2708
|
+
const base2 = cfg.issuer.replace(/\/+$/, "");
|
|
1024
2709
|
return {
|
|
1025
|
-
authorize: cfg.authorizeUrl ?? `${
|
|
1026
|
-
token: cfg.tokenUrl ?? `${
|
|
1027
|
-
device: cfg.deviceAuthorizationUrl ?? `${
|
|
2710
|
+
authorize: cfg.authorizeUrl ?? `${base2}/api/oauth2/authorize`,
|
|
2711
|
+
token: cfg.tokenUrl ?? `${base2}/api/oauth2/token`,
|
|
2712
|
+
device: cfg.deviceAuthorizationUrl ?? `${base2}/api/oauth2/device_authorization`
|
|
1028
2713
|
};
|
|
1029
2714
|
}
|
|
1030
2715
|
__name(endpoints, "endpoints");
|
|
@@ -1310,6 +2995,8 @@ var XenoAccountClient = class {
|
|
|
1310
2995
|
ledger;
|
|
1311
2996
|
authz;
|
|
1312
2997
|
oidcConfig;
|
|
2998
|
+
issuer;
|
|
2999
|
+
authorities = {};
|
|
1313
3000
|
transport;
|
|
1314
3001
|
store;
|
|
1315
3002
|
apiKey;
|
|
@@ -1335,10 +3022,30 @@ var XenoAccountClient = class {
|
|
|
1335
3022
|
this.account = new AccountClient(cfg.issuer, this.transport);
|
|
1336
3023
|
this.ledger = new LedgerClient(cfg.apiBase, this.transport);
|
|
1337
3024
|
this.authz = new AuthzClient(cfg.apiBase, this.transport);
|
|
3025
|
+
this.issuer = cfg.issuer;
|
|
1338
3026
|
this.store = cfg.store ?? memoryStore();
|
|
1339
3027
|
this.apiKey = cfg.apiKey ?? (typeof process !== "undefined" ? process.env?.XENO_API_KEY : void 0) ?? void 0;
|
|
1340
3028
|
this.broker = cfg.broker;
|
|
1341
3029
|
}
|
|
3030
|
+
// ─── Workspace, workforce, notification and integration authorities ───────
|
|
3031
|
+
//
|
|
3032
|
+
// They live on the issuer origin and authorise every request through `authorization()`, so each
|
|
3033
|
+
// attempt carries its own sender-constrained proof for its exact method and URL. Each is built on
|
|
3034
|
+
// first use: the workspace-line authorities refuse a non-HTTPS or path-bearing origin, and that
|
|
3035
|
+
// refusal belongs to the caller who uses them, not to every client constructed for local
|
|
3036
|
+
// development or for ledger-only use.
|
|
3037
|
+
get workspaces() {
|
|
3038
|
+
return this.authorities.workspaces ??= new WorkspaceClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
3039
|
+
}
|
|
3040
|
+
get workforce() {
|
|
3041
|
+
return this.authorities.workforce ??= new WorkforceClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
3042
|
+
}
|
|
3043
|
+
get notifications() {
|
|
3044
|
+
return this.authorities.notifications ??= new NotificationsClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
3045
|
+
}
|
|
3046
|
+
get integrations() {
|
|
3047
|
+
return this.authorities.integrations ??= new AccountIntegrationClient(this.issuer, this.transport, (method, url, opts) => this.authorization(method, url, opts));
|
|
3048
|
+
}
|
|
1342
3049
|
// ─── Session workhorse (priority chain, XENO AUTH §5) ───────────────────
|
|
1343
3050
|
/**
|
|
1344
3051
|
* Return a valid Bearer for the gate, walking the chain:
|
|
@@ -1384,7 +3091,7 @@ var XenoAccountClient = class {
|
|
|
1384
3091
|
if (!opts.silent && this.interactive) await this.resolveInteractive(opts.scopes, generation);
|
|
1385
3092
|
return;
|
|
1386
3093
|
}
|
|
1387
|
-
const pending = await this.storeRead(this.refreshPendingKey);
|
|
3094
|
+
const pending = await this.storeRead(this.refreshPendingKey) ?? await this.legacyRefreshMarker();
|
|
1388
3095
|
if (this.generation !== generation) return;
|
|
1389
3096
|
const interruptedRotation = abandonedRotation(pending);
|
|
1390
3097
|
if (pending && !interruptedRotation && !/^ready:v1:[A-Za-z0-9_-]{32}$/.test(pending)) {
|
|
@@ -1603,6 +3310,17 @@ var XenoAccountClient = class {
|
|
|
1603
3310
|
}
|
|
1604
3311
|
}
|
|
1605
3312
|
}
|
|
3313
|
+
/**
|
|
3314
|
+
* The 0.2.0 workforce builds (shipped vendored, never published) marked an in-flight refresh at
|
|
3315
|
+
* `<refresh key>-uncertain` and never named the rotation. An install upgrading with that marker
|
|
3316
|
+
* present may hold a token the origin already rotated, so sending it would be a replay — the
|
|
3317
|
+
* zero-grace reuse that revokes the whole family. It is therefore an unconfirmed transition like any
|
|
3318
|
+
* other v1 marker: refused silently, recoverable only by explicit sign-in (which writes this
|
|
3319
|
+
* version's own marker, after which the legacy one is never consulted again).
|
|
3320
|
+
*/
|
|
3321
|
+
async legacyRefreshMarker() {
|
|
3322
|
+
return await this.storeRead(`${this.refreshStoreKey}-uncertain`) ? "legacy-refresh-uncertain:v1" : null;
|
|
3323
|
+
}
|
|
1606
3324
|
async storeRead(key) {
|
|
1607
3325
|
try {
|
|
1608
3326
|
return await this.store.get(key);
|
|
@@ -1764,9 +3482,9 @@ var XenoAccountClient = class {
|
|
|
1764
3482
|
const transition = await this.reserveSignIn(generation);
|
|
1765
3483
|
if (args.signal?.aborted || this.generation !== generation) throw transitionConflict();
|
|
1766
3484
|
const ts = await exchangeCode(this.oidcConfig, this.transport, args);
|
|
1767
|
-
const
|
|
3485
|
+
const committed2 = await this.applyTokenSet(ts, generation, transition, false, args.signal);
|
|
1768
3486
|
if (this.generation !== generation || args.signal?.aborted) {
|
|
1769
|
-
if (
|
|
3487
|
+
if (committed2 && args.signal?.aborted) await this.cancelCommittedSignIn(committed2);
|
|
1770
3488
|
throw transitionConflict();
|
|
1771
3489
|
}
|
|
1772
3490
|
return ts;
|
|
@@ -1882,9 +3600,9 @@ var XenoAccountClient = class {
|
|
|
1882
3600
|
const transition = await this.reserveSignIn(generation);
|
|
1883
3601
|
if (opts?.signal?.aborted || this.generation !== generation) throw transitionConflict();
|
|
1884
3602
|
const ts = await pollDeviceToken(this.oidcConfig, this.transport, device, opts);
|
|
1885
|
-
const
|
|
3603
|
+
const committed2 = await this.applyTokenSet(ts, generation, transition, false, opts?.signal);
|
|
1886
3604
|
if (this.generation !== generation || opts?.signal?.aborted) {
|
|
1887
|
-
if (
|
|
3605
|
+
if (committed2 && opts?.signal?.aborted) await this.cancelCommittedSignIn(committed2);
|
|
1888
3606
|
throw transitionConflict();
|
|
1889
3607
|
}
|
|
1890
3608
|
return ts;
|
|
@@ -2136,7 +3854,7 @@ function frozenClaims(claims) {
|
|
|
2136
3854
|
__name(frozenClaims, "frozenClaims");
|
|
2137
3855
|
function createResourceRequestAuthorizer(options) {
|
|
2138
3856
|
const issuer = normalizeDpopHtu(options.issuer);
|
|
2139
|
-
if (issuer.replace(/\/$/, "") !== options.issuer || !options.clientIds.length || options.clientIds.length > 128 || options.clientIds.some((
|
|
3857
|
+
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");
|
|
2140
3858
|
const clients = new Set(options.clientIds);
|
|
2141
3859
|
return {
|
|
2142
3860
|
async authorize(request) {
|
|
@@ -2255,9 +3973,9 @@ function createResourceRequestAuthorizer(options) {
|
|
|
2255
3973
|
}
|
|
2256
3974
|
__name(createResourceRequestAuthorizer, "createResourceRequestAuthorizer");
|
|
2257
3975
|
function createOidcIntrospectionSessionAuthority(options) {
|
|
2258
|
-
const
|
|
3976
|
+
const base2 = new URL(options.issuer);
|
|
2259
3977
|
const timeoutMs = options.timeoutMs ?? 5e3;
|
|
2260
|
-
if (
|
|
3978
|
+
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");
|
|
2261
3979
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2262
3980
|
return async (claims, token) => {
|
|
2263
3981
|
if (token.length > MAX_JWT_BYTES || !token) throw unavailable();
|
|
@@ -2265,7 +3983,7 @@ function createOidcIntrospectionSessionAuthority(options) {
|
|
|
2265
3983
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
2266
3984
|
let response;
|
|
2267
3985
|
try {
|
|
2268
|
-
response = await fetchBeforeAbort(fetchImpl, `${
|
|
3986
|
+
response = await fetchBeforeAbort(fetchImpl, `${base2.origin}/api/oauth2/introspect`, {
|
|
2269
3987
|
method: "POST",
|
|
2270
3988
|
redirect: "error",
|
|
2271
3989
|
cache: "no-store",
|
|
@@ -2294,17 +4012,47 @@ function createOidcIntrospectionSessionAuthority(options) {
|
|
|
2294
4012
|
};
|
|
2295
4013
|
}
|
|
2296
4014
|
__name(createOidcIntrospectionSessionAuthority, "createOidcIntrospectionSessionAuthority");
|
|
4015
|
+
|
|
4016
|
+
// src/index.ts
|
|
4017
|
+
var ACCOUNT_SDK_CONTRACT = Object.freeze({
|
|
4018
|
+
version: 1,
|
|
4019
|
+
workspaceAuthority: 1,
|
|
4020
|
+
workforceResourceOperations: 1,
|
|
4021
|
+
workforceActorBinding: 2,
|
|
4022
|
+
workforceOwnedCatalog: 1,
|
|
4023
|
+
workspaceKeyAuthority: 1,
|
|
4024
|
+
workspaceKeyOperations: 1,
|
|
4025
|
+
workspaceMembershipOperations: 1,
|
|
4026
|
+
workspaceOperationAbandonment: 1,
|
|
4027
|
+
accountOperations: 1,
|
|
4028
|
+
accountIntegrations: 1,
|
|
4029
|
+
notificationAuthority: 1,
|
|
4030
|
+
notificationDestinationOperations: 1,
|
|
4031
|
+
requestBoundAuthorization: 1,
|
|
4032
|
+
serializedRefresh: 1
|
|
4033
|
+
});
|
|
2297
4034
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2298
4035
|
0 && (module.exports = {
|
|
4036
|
+
ACCOUNT_SDK_CONTRACT,
|
|
2299
4037
|
AccountClient,
|
|
2300
4038
|
AccountError,
|
|
4039
|
+
AccountIntegrationClient,
|
|
4040
|
+
AccountMutationError,
|
|
2301
4041
|
AuthzClient,
|
|
2302
4042
|
BffSessionClient,
|
|
2303
4043
|
LedgerClient,
|
|
2304
4044
|
MICRO_PER_CREDIT,
|
|
4045
|
+
NotificationsClient,
|
|
2305
4046
|
Transport,
|
|
4047
|
+
WorkforceClient,
|
|
4048
|
+
WorkforceResourceMutationError,
|
|
4049
|
+
WorkspaceClient,
|
|
4050
|
+
WorkspaceKeyMutationError,
|
|
4051
|
+
WorkspaceMembershipMutationError,
|
|
2306
4052
|
XenoAccountClient,
|
|
4053
|
+
accountOperationIntentSchema,
|
|
2307
4054
|
accountSchema,
|
|
4055
|
+
assertMembershipOperation,
|
|
2308
4056
|
authzCheckSchema,
|
|
2309
4057
|
authzResultSchema,
|
|
2310
4058
|
balanceSchema,
|
|
@@ -2319,10 +4067,23 @@ __name(createOidcIntrospectionSessionAuthority, "createOidcIntrospectionSessionA
|
|
|
2319
4067
|
holdRequestSchema,
|
|
2320
4068
|
holdSchema,
|
|
2321
4069
|
keychainStore,
|
|
4070
|
+
membershipAbandonedSchema,
|
|
4071
|
+
membershipCommittedSchema,
|
|
4072
|
+
membershipDeliverySchema,
|
|
4073
|
+
membershipMutationSchema,
|
|
4074
|
+
membershipOperationSchema,
|
|
4075
|
+
membershipRejectedSchema,
|
|
2322
4076
|
memoryStore,
|
|
2323
4077
|
meterAggregationSchema,
|
|
2324
4078
|
normalize,
|
|
2325
4079
|
normalizeDpopHtu,
|
|
4080
|
+
notificationChannelSchema,
|
|
4081
|
+
notificationDestinationActionSchema,
|
|
4082
|
+
notificationDestinationOperationSchema,
|
|
4083
|
+
notificationEventSchema,
|
|
4084
|
+
notificationRuleSchema,
|
|
4085
|
+
notificationScopeSchema,
|
|
4086
|
+
notificationSettingsSchema,
|
|
2326
4087
|
oauthTokenResponseSchema,
|
|
2327
4088
|
pollDeviceToken,
|
|
2328
4089
|
redact,
|
|
@@ -2335,6 +4096,20 @@ __name(createOidcIntrospectionSessionAuthority, "createOidcIntrospectionSessionA
|
|
|
2335
4096
|
usageResultSchema,
|
|
2336
4097
|
verifyAccessToken,
|
|
2337
4098
|
verifyIdToken,
|
|
2338
|
-
verifyLogoutToken
|
|
4099
|
+
verifyLogoutToken,
|
|
4100
|
+
workforceCreateResourceSchema,
|
|
4101
|
+
workforceDefinitionSchema,
|
|
4102
|
+
workforceListOwnedResourcesSchema,
|
|
4103
|
+
workforceOwnerSchema,
|
|
4104
|
+
workforceReadOperationSchema,
|
|
4105
|
+
workspaceInviteRoleSchema,
|
|
4106
|
+
workspaceInviteSchema,
|
|
4107
|
+
workspaceKeyOperationSchema,
|
|
4108
|
+
workspaceKeyRejectionSchema,
|
|
4109
|
+
workspaceKeySchema,
|
|
4110
|
+
workspaceKeyScopeSchema,
|
|
4111
|
+
workspaceMemberSchema,
|
|
4112
|
+
workspaceRoleSchema,
|
|
4113
|
+
workspaceSchema
|
|
2339
4114
|
});
|
|
2340
4115
|
//# sourceMappingURL=index.js.map
|