llama-stack-client 0.0.35 → 0.1.2
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/LICENSE +22 -201
- package/README.md +60 -26
- package/core.d.ts +7 -7
- package/core.d.ts.map +1 -1
- package/core.js +44 -19
- package/core.js.map +1 -1
- package/core.mjs +41 -17
- package/core.mjs.map +1 -1
- package/error.d.ts +18 -24
- package/error.d.ts.map +1 -1
- package/error.js +1 -31
- package/error.js.map +1 -1
- package/error.mjs +1 -31
- package/error.mjs.map +1 -1
- package/index.d.mts +106 -120
- package/index.d.ts +106 -120
- package/index.d.ts.map +1 -1
- package/index.js +100 -45
- package/index.js.map +1 -1
- package/index.mjs +84 -44
- package/index.mjs.map +1 -1
- package/internal/decoders/jsonl.d.ts +12 -0
- package/internal/decoders/jsonl.d.ts.map +1 -0
- package/internal/decoders/jsonl.js +35 -0
- package/internal/decoders/jsonl.js.map +1 -0
- package/internal/decoders/jsonl.mjs +31 -0
- package/internal/decoders/jsonl.mjs.map +1 -0
- package/internal/decoders/line.d.ts +20 -0
- package/internal/decoders/line.d.ts.map +1 -0
- package/internal/decoders/line.js +88 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +84 -0
- package/internal/decoders/line.mjs.map +1 -0
- package/internal/qs/formats.d.ts +6 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +11 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +8 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +280 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +276 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.ts +14 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +229 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/stream-utils.d.ts +8 -0
- package/internal/stream-utils.d.ts.map +1 -0
- package/internal/stream-utils.js +39 -0
- package/internal/stream-utils.js.map +1 -0
- package/internal/stream-utils.mjs +35 -0
- package/internal/stream-utils.mjs.map +1 -0
- package/package.json +8 -6
- package/resources/agents/agents.d.ts +31 -187
- package/resources/agents/agents.d.ts.map +1 -1
- package/resources/agents/agents.js +15 -32
- package/resources/agents/agents.js.map +1 -1
- package/resources/agents/agents.mjs +15 -32
- package/resources/agents/agents.mjs.map +1 -1
- package/resources/agents/index.d.ts +4 -4
- package/resources/agents/index.d.ts.map +1 -1
- package/resources/agents/index.js +7 -7
- package/resources/agents/index.js.map +1 -1
- package/resources/agents/index.mjs +3 -3
- package/resources/agents/index.mjs.map +1 -1
- package/resources/agents/session.d.ts +31 -0
- package/resources/agents/session.d.ts.map +1 -0
- package/resources/agents/session.js +25 -0
- package/resources/agents/session.js.map +1 -0
- package/resources/agents/session.mjs +21 -0
- package/resources/agents/session.mjs.map +1 -0
- package/resources/agents/steps.d.ts +3 -24
- package/resources/agents/steps.d.ts.map +1 -1
- package/resources/agents/steps.js +2 -14
- package/resources/agents/steps.js.map +1 -1
- package/resources/agents/steps.mjs +2 -14
- package/resources/agents/steps.mjs.map +1 -1
- package/resources/agents/turn.d.ts +199 -0
- package/resources/agents/turn.d.ts.map +1 -0
- package/resources/agents/turn.js +19 -0
- package/resources/agents/turn.js.map +1 -0
- package/resources/agents/turn.mjs +15 -0
- package/resources/agents/turn.mjs.map +1 -0
- package/resources/batch-inference.d.ts +23 -56
- package/resources/batch-inference.d.ts.map +1 -1
- package/resources/batch-inference.js +4 -26
- package/resources/batch-inference.js.map +1 -1
- package/resources/batch-inference.mjs +4 -26
- package/resources/batch-inference.mjs.map +1 -1
- package/resources/datasetio.d.ts +25 -0
- package/resources/datasetio.d.ts.map +1 -0
- package/resources/datasetio.js +19 -0
- package/resources/datasetio.js.map +1 -0
- package/resources/datasetio.mjs +15 -0
- package/resources/datasetio.mjs.map +1 -0
- package/resources/datasets.d.ts +34 -46
- package/resources/datasets.d.ts.map +1 -1
- package/resources/datasets.js +11 -35
- package/resources/datasets.js.map +1 -1
- package/resources/datasets.mjs +11 -35
- package/resources/datasets.mjs.map +1 -1
- package/resources/eval/eval.d.ts +62 -0
- package/resources/eval/eval.d.ts.map +1 -0
- package/resources/{inference/embeddings.js → eval/eval.js} +16 -20
- package/resources/eval/eval.js.map +1 -0
- package/resources/eval/eval.mjs +18 -0
- package/resources/eval/eval.mjs.map +1 -0
- package/resources/eval/index.d.ts +3 -0
- package/resources/eval/index.d.ts.map +1 -0
- package/resources/eval/index.js +9 -0
- package/resources/eval/index.js.map +1 -0
- package/resources/eval/index.mjs +4 -0
- package/resources/eval/index.mjs.map +1 -0
- package/resources/eval/jobs.d.ts +13 -0
- package/resources/eval/jobs.d.ts.map +1 -0
- package/resources/eval/jobs.js +21 -0
- package/resources/eval/jobs.js.map +1 -0
- package/resources/eval/jobs.mjs +17 -0
- package/resources/eval/jobs.mjs.map +1 -0
- package/resources/eval-tasks.d.ts +32 -0
- package/resources/eval-tasks.d.ts.map +1 -0
- package/resources/eval-tasks.js +22 -0
- package/resources/eval-tasks.js.map +1 -0
- package/resources/eval-tasks.mjs +18 -0
- package/resources/eval-tasks.mjs.map +1 -0
- package/resources/index.d.ts +23 -15
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +33 -17
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +19 -11
- package/resources/index.mjs.map +1 -1
- package/resources/inference.d.ts +286 -0
- package/resources/inference.d.ts.map +1 -0
- package/resources/inference.js +29 -0
- package/resources/inference.js.map +1 -0
- package/resources/inference.mjs +25 -0
- package/resources/inference.mjs.map +1 -0
- package/resources/inspect.d.ts +26 -0
- package/resources/inspect.d.ts.map +1 -0
- package/resources/inspect.js +15 -0
- package/resources/inspect.js.map +1 -0
- package/resources/inspect.mjs +11 -0
- package/resources/inspect.mjs.map +1 -0
- package/resources/models.d.ts +21 -36
- package/resources/models.d.ts.map +1 -1
- package/resources/models.js +11 -27
- package/resources/models.js.map +1 -1
- package/resources/models.mjs +11 -27
- package/resources/models.mjs.map +1 -1
- package/resources/post-training/index.d.ts +2 -2
- package/resources/post-training/index.d.ts.map +1 -1
- package/resources/post-training/index.js +3 -3
- package/resources/post-training/index.js.map +1 -1
- package/resources/post-training/index.mjs +1 -1
- package/resources/post-training/index.mjs.map +1 -1
- package/resources/post-training/job.d.ts +47 -0
- package/resources/post-training/job.d.ts.map +1 -0
- package/resources/post-training/job.js +25 -0
- package/resources/post-training/job.js.map +1 -0
- package/resources/post-training/job.mjs +21 -0
- package/resources/post-training/job.mjs.map +1 -0
- package/resources/post-training/post-training.d.ts +95 -142
- package/resources/post-training/post-training.d.ts.map +1 -1
- package/resources/post-training/post-training.js +8 -29
- package/resources/post-training/post-training.js.map +1 -1
- package/resources/post-training/post-training.mjs +8 -29
- package/resources/post-training/post-training.mjs.map +1 -1
- package/resources/providers.d.ts +14 -0
- package/resources/providers.d.ts.map +1 -0
- package/resources/providers.js +12 -0
- package/resources/providers.js.map +1 -0
- package/resources/providers.mjs +8 -0
- package/resources/providers.mjs.map +1 -0
- package/resources/routes.d.ts +14 -0
- package/resources/routes.d.ts.map +1 -0
- package/resources/routes.js +12 -0
- package/resources/routes.js.map +1 -0
- package/resources/routes.mjs +8 -0
- package/resources/routes.mjs.map +1 -0
- package/resources/safety.d.ts +6 -29
- package/resources/safety.d.ts.map +1 -1
- package/resources/safety.js +2 -14
- package/resources/safety.js.map +1 -1
- package/resources/safety.mjs +2 -14
- package/resources/safety.mjs.map +1 -1
- package/resources/scoring-functions.d.ts +53 -0
- package/resources/scoring-functions.d.ts.map +1 -0
- package/resources/scoring-functions.js +22 -0
- package/resources/scoring-functions.js.map +1 -0
- package/resources/scoring-functions.mjs +18 -0
- package/resources/scoring-functions.mjs.map +1 -0
- package/resources/scoring.d.ts +28 -0
- package/resources/scoring.d.ts.map +1 -0
- package/resources/scoring.js +15 -0
- package/resources/scoring.js.map +1 -0
- package/resources/scoring.mjs +11 -0
- package/resources/scoring.mjs.map +1 -0
- package/resources/shared.d.ts +406 -14
- package/resources/shared.d.ts.map +1 -1
- package/resources/shields.d.ts +21 -32
- package/resources/shields.d.ts.map +1 -1
- package/resources/shields.js +7 -29
- package/resources/shields.js.map +1 -1
- package/resources/shields.mjs +7 -29
- package/resources/shields.mjs.map +1 -1
- package/resources/synthetic-data-generation.d.ts +12 -22
- package/resources/synthetic-data-generation.d.ts.map +1 -1
- package/resources/synthetic-data-generation.js +5 -17
- package/resources/synthetic-data-generation.js.map +1 -1
- package/resources/synthetic-data-generation.mjs +3 -15
- package/resources/synthetic-data-generation.mjs.map +1 -1
- package/resources/telemetry.d.ts +84 -35
- package/resources/telemetry.d.ts.map +1 -1
- package/resources/telemetry.js +29 -22
- package/resources/telemetry.js.map +1 -1
- package/resources/telemetry.mjs +29 -22
- package/resources/telemetry.mjs.map +1 -1
- package/resources/tool-runtime/index.d.ts +3 -0
- package/resources/tool-runtime/index.d.ts.map +1 -0
- package/resources/tool-runtime/index.js +9 -0
- package/resources/tool-runtime/index.js.map +1 -0
- package/resources/tool-runtime/index.mjs +4 -0
- package/resources/tool-runtime/index.mjs.map +1 -0
- package/resources/tool-runtime/rag-tool.d.ts +30 -0
- package/resources/tool-runtime/rag-tool.d.ts.map +1 -0
- package/resources/tool-runtime/rag-tool.js +25 -0
- package/resources/tool-runtime/rag-tool.js.map +1 -0
- package/resources/tool-runtime/rag-tool.mjs +21 -0
- package/resources/tool-runtime/rag-tool.mjs.map +1 -0
- package/resources/tool-runtime/tool-runtime.d.ts +51 -0
- package/resources/tool-runtime/tool-runtime.d.ts.map +1 -0
- package/resources/{evaluate/evaluate.js → tool-runtime/tool-runtime.js} +29 -18
- package/resources/tool-runtime/tool-runtime.js.map +1 -0
- package/resources/tool-runtime/tool-runtime.mjs +33 -0
- package/resources/tool-runtime/tool-runtime.mjs.map +1 -0
- package/resources/toolgroups.d.ts +40 -0
- package/resources/toolgroups.d.ts.map +1 -0
- package/resources/toolgroups.js +37 -0
- package/resources/toolgroups.js.map +1 -0
- package/resources/toolgroups.mjs +33 -0
- package/resources/toolgroups.mjs.map +1 -0
- package/resources/tools.d.ts +41 -0
- package/resources/tools.d.ts.map +1 -0
- package/resources/tools.js +19 -0
- package/resources/tools.js.map +1 -0
- package/resources/tools.mjs +15 -0
- package/resources/tools.mjs.map +1 -0
- package/resources/vector-dbs.d.ts +49 -0
- package/resources/vector-dbs.d.ts.map +1 -0
- package/resources/vector-dbs.js +24 -0
- package/resources/vector-dbs.js.map +1 -0
- package/resources/vector-dbs.mjs +20 -0
- package/resources/vector-dbs.mjs.map +1 -0
- package/resources/vector-io.d.ts +46 -0
- package/resources/vector-io.d.ts.map +1 -0
- package/resources/vector-io.js +19 -0
- package/resources/vector-io.js.map +1 -0
- package/resources/vector-io.mjs +15 -0
- package/resources/vector-io.mjs.map +1 -0
- package/src/core.ts +57 -27
- package/src/error.ts +25 -41
- package/src/index.ts +457 -153
- package/src/internal/decoders/jsonl.ts +41 -0
- package/src/internal/decoders/line.ts +114 -0
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +9 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +388 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/stream-utils.ts +32 -0
- package/src/resources/agents/agents.ts +81 -299
- package/src/resources/agents/index.ts +24 -27
- package/src/resources/agents/session.ts +76 -0
- package/src/resources/agents/steps.ts +14 -40
- package/src/resources/agents/turn.ts +322 -0
- package/src/resources/batch-inference.ts +33 -84
- package/src/resources/datasetio.ts +53 -0
- package/src/resources/datasets.ts +70 -82
- package/src/resources/eval/eval.ts +107 -0
- package/src/resources/eval/index.ts +12 -0
- package/src/resources/eval/jobs.ts +36 -0
- package/src/resources/eval-tasks.ts +69 -0
- package/src/resources/index.ts +141 -65
- package/src/resources/inference.ts +395 -0
- package/src/resources/inspect.ts +47 -0
- package/src/resources/models.ts +46 -66
- package/src/resources/post-training/index.ts +14 -14
- package/src/resources/post-training/job.ts +96 -0
- package/src/resources/post-training/post-training.ts +151 -182
- package/src/resources/providers.ts +26 -0
- package/src/resources/routes.ts +23 -0
- package/src/resources/safety.ts +8 -47
- package/src/resources/scoring-functions.ts +108 -0
- package/src/resources/scoring.ts +52 -0
- package/src/resources/shared.ts +530 -14
- package/src/resources/shields.ts +40 -64
- package/src/resources/synthetic-data-generation.ts +17 -37
- package/src/resources/telemetry.ts +211 -65
- package/src/resources/tool-runtime/index.ts +10 -0
- package/src/resources/tool-runtime/rag-tool.ts +48 -0
- package/src/resources/tool-runtime/tool-runtime.ts +109 -0
- package/src/resources/toolgroups.ts +80 -0
- package/src/resources/tools.ts +81 -0
- package/src/resources/vector-dbs.ts +105 -0
- package/src/resources/vector-io.ts +74 -0
- package/src/streaming.ts +6 -148
- package/src/version.ts +1 -1
- package/streaming.d.ts +0 -7
- package/streaming.d.ts.map +1 -1
- package/streaming.js +8 -123
- package/streaming.js.map +1 -1
- package/streaming.mjs +4 -118
- package/streaming.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/agents/sessions.d.ts +0 -76
- package/resources/agents/sessions.d.ts.map +0 -1
- package/resources/agents/sessions.js +0 -52
- package/resources/agents/sessions.js.map +0 -1
- package/resources/agents/sessions.mjs +0 -48
- package/resources/agents/sessions.mjs.map +0 -1
- package/resources/agents/turns.d.ts +0 -133
- package/resources/agents/turns.d.ts.map +0 -1
- package/resources/agents/turns.js +0 -38
- package/resources/agents/turns.js.map +0 -1
- package/resources/agents/turns.mjs +0 -34
- package/resources/agents/turns.mjs.map +0 -1
- package/resources/evaluate/evaluate.d.ts +0 -29
- package/resources/evaluate/evaluate.d.ts.map +0 -1
- package/resources/evaluate/evaluate.js.map +0 -1
- package/resources/evaluate/evaluate.mjs +0 -22
- package/resources/evaluate/evaluate.mjs.map +0 -1
- package/resources/evaluate/index.d.ts +0 -6
- package/resources/evaluate/index.d.ts.map +0 -1
- package/resources/evaluate/index.js +0 -15
- package/resources/evaluate/index.js.map +0 -1
- package/resources/evaluate/index.mjs +0 -7
- package/resources/evaluate/index.mjs.map +0 -1
- package/resources/evaluate/jobs/artifacts.d.ts +0 -22
- package/resources/evaluate/jobs/artifacts.d.ts.map +0 -1
- package/resources/evaluate/jobs/artifacts.js +0 -24
- package/resources/evaluate/jobs/artifacts.js.map +0 -1
- package/resources/evaluate/jobs/artifacts.mjs +0 -20
- package/resources/evaluate/jobs/artifacts.mjs.map +0 -1
- package/resources/evaluate/jobs/index.d.ts +0 -5
- package/resources/evaluate/jobs/index.d.ts.map +0 -1
- package/resources/evaluate/jobs/index.js +0 -13
- package/resources/evaluate/jobs/index.js.map +0 -1
- package/resources/evaluate/jobs/index.mjs +0 -6
- package/resources/evaluate/jobs/index.mjs.map +0 -1
- package/resources/evaluate/jobs/jobs.d.ts +0 -56
- package/resources/evaluate/jobs/jobs.d.ts.map +0 -1
- package/resources/evaluate/jobs/jobs.js +0 -76
- package/resources/evaluate/jobs/jobs.js.map +0 -1
- package/resources/evaluate/jobs/jobs.mjs +0 -49
- package/resources/evaluate/jobs/jobs.mjs.map +0 -1
- package/resources/evaluate/jobs/logs.d.ts +0 -22
- package/resources/evaluate/jobs/logs.d.ts.map +0 -1
- package/resources/evaluate/jobs/logs.js +0 -24
- package/resources/evaluate/jobs/logs.js.map +0 -1
- package/resources/evaluate/jobs/logs.mjs +0 -20
- package/resources/evaluate/jobs/logs.mjs.map +0 -1
- package/resources/evaluate/jobs/status.d.ts +0 -22
- package/resources/evaluate/jobs/status.d.ts.map +0 -1
- package/resources/evaluate/jobs/status.js +0 -24
- package/resources/evaluate/jobs/status.js.map +0 -1
- package/resources/evaluate/jobs/status.mjs +0 -20
- package/resources/evaluate/jobs/status.mjs.map +0 -1
- package/resources/evaluate/question-answering.d.ts +0 -22
- package/resources/evaluate/question-answering.d.ts.map +0 -1
- package/resources/evaluate/question-answering.js +0 -24
- package/resources/evaluate/question-answering.js.map +0 -1
- package/resources/evaluate/question-answering.mjs +0 -20
- package/resources/evaluate/question-answering.mjs.map +0 -1
- package/resources/evaluate/summarization.d.ts +0 -4
- package/resources/evaluate/summarization.d.ts.map +0 -1
- package/resources/evaluate/summarization.js +0 -9
- package/resources/evaluate/summarization.js.map +0 -1
- package/resources/evaluate/summarization.mjs +0 -5
- package/resources/evaluate/summarization.mjs.map +0 -1
- package/resources/evaluate/text-generation.d.ts +0 -4
- package/resources/evaluate/text-generation.d.ts.map +0 -1
- package/resources/evaluate/text-generation.js +0 -9
- package/resources/evaluate/text-generation.js.map +0 -1
- package/resources/evaluate/text-generation.mjs +0 -5
- package/resources/evaluate/text-generation.mjs.map +0 -1
- package/resources/evaluations.d.ts +0 -35
- package/resources/evaluations.d.ts.map +0 -1
- package/resources/evaluations.js +0 -37
- package/resources/evaluations.js.map +0 -1
- package/resources/evaluations.mjs +0 -33
- package/resources/evaluations.mjs.map +0 -1
- package/resources/inference/embeddings.d.ts +0 -29
- package/resources/inference/embeddings.d.ts.map +0 -1
- package/resources/inference/embeddings.js.map +0 -1
- package/resources/inference/embeddings.mjs +0 -22
- package/resources/inference/embeddings.mjs.map +0 -1
- package/resources/inference/index.d.ts +0 -3
- package/resources/inference/index.d.ts.map +0 -1
- package/resources/inference/index.js +0 -9
- package/resources/inference/index.js.map +0 -1
- package/resources/inference/index.mjs +0 -4
- package/resources/inference/index.mjs.map +0 -1
- package/resources/inference/inference.d.ts +0 -172
- package/resources/inference/inference.d.ts.map +0 -1
- package/resources/inference/inference.js +0 -67
- package/resources/inference/inference.js.map +0 -1
- package/resources/inference/inference.mjs +0 -40
- package/resources/inference/inference.mjs.map +0 -1
- package/resources/memory/documents.d.ts +0 -49
- package/resources/memory/documents.d.ts.map +0 -1
- package/resources/memory/documents.js +0 -39
- package/resources/memory/documents.js.map +0 -1
- package/resources/memory/documents.mjs +0 -35
- package/resources/memory/documents.mjs.map +0 -1
- package/resources/memory/index.d.ts +0 -3
- package/resources/memory/index.d.ts.map +0 -1
- package/resources/memory/index.js +0 -9
- package/resources/memory/index.js.map +0 -1
- package/resources/memory/index.mjs +0 -4
- package/resources/memory/index.mjs.map +0 -1
- package/resources/memory/memory.d.ts +0 -158
- package/resources/memory/memory.d.ts.map +0 -1
- package/resources/memory/memory.js +0 -137
- package/resources/memory/memory.js.map +0 -1
- package/resources/memory/memory.mjs +0 -110
- package/resources/memory/memory.mjs.map +0 -1
- package/resources/memory-banks.d.ts +0 -42
- package/resources/memory-banks.d.ts.map +0 -1
- package/resources/memory-banks.js +0 -40
- package/resources/memory-banks.js.map +0 -1
- package/resources/memory-banks.mjs +0 -36
- package/resources/memory-banks.mjs.map +0 -1
- package/resources/post-training/jobs.d.ts +0 -91
- package/resources/post-training/jobs.d.ts.map +0 -1
- package/resources/post-training/jobs.js +0 -80
- package/resources/post-training/jobs.js.map +0 -1
- package/resources/post-training/jobs.mjs +0 -76
- package/resources/post-training/jobs.mjs.map +0 -1
- package/resources/reward-scoring.d.ts +0 -47
- package/resources/reward-scoring.d.ts.map +0 -1
- package/resources/reward-scoring.js +0 -24
- package/resources/reward-scoring.js.map +0 -1
- package/resources/reward-scoring.mjs +0 -20
- package/resources/reward-scoring.mjs.map +0 -1
- package/src/resources/agents/sessions.ts +0 -135
- package/src/resources/agents/turns.ts +0 -231
- package/src/resources/evaluate/evaluate.ts +0 -35
- package/src/resources/evaluate/index.ts +0 -14
- package/src/resources/evaluate/jobs/artifacts.ts +0 -42
- package/src/resources/evaluate/jobs/index.ts +0 -13
- package/src/resources/evaluate/jobs/jobs.ts +0 -99
- package/src/resources/evaluate/jobs/logs.ts +0 -42
- package/src/resources/evaluate/jobs/status.ts +0 -42
- package/src/resources/evaluate/question-answering.ts +0 -42
- package/src/resources/evaluate/summarization.ts +0 -5
- package/src/resources/evaluate/text-generation.ts +0 -5
- package/src/resources/evaluations.ts +0 -73
- package/src/resources/inference/embeddings.ts +0 -48
- package/src/resources/inference/index.ts +0 -15
- package/src/resources/inference/inference.ts +0 -268
- package/src/resources/memory/documents.ts +0 -92
- package/src/resources/memory/index.ts +0 -23
- package/src/resources/memory/memory.ts +0 -297
- package/src/resources/memory-banks.ts +0 -84
- package/src/resources/post-training/jobs.ts +0 -192
- package/src/resources/reward-scoring.ts +0 -82
package/index.mjs
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
var _a;
|
|
3
|
+
import * as qs from "./internal/qs/index.mjs";
|
|
4
|
+
import * as Core from "./core.mjs";
|
|
3
5
|
import * as Errors from "./error.mjs";
|
|
4
6
|
import * as Uploads from "./uploads.mjs";
|
|
5
|
-
import * as Core from "./core.mjs";
|
|
6
7
|
import * as API from "./resources/index.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
8
|
+
import { BatchInference, } from "./resources/batch-inference.mjs";
|
|
9
|
+
import { Datasetio, } from "./resources/datasetio.mjs";
|
|
10
|
+
import { Datasets, } from "./resources/datasets.mjs";
|
|
11
|
+
import { EvalTasks, } from "./resources/eval-tasks.mjs";
|
|
12
|
+
import { Inference, } from "./resources/inference.mjs";
|
|
13
|
+
import { Inspect } from "./resources/inspect.mjs";
|
|
14
|
+
import { Models, } from "./resources/models.mjs";
|
|
15
|
+
import { Providers } from "./resources/providers.mjs";
|
|
16
|
+
import { Routes } from "./resources/routes.mjs";
|
|
17
|
+
import { Safety } from "./resources/safety.mjs";
|
|
18
|
+
import { Scoring, } from "./resources/scoring.mjs";
|
|
19
|
+
import { ScoringFunctions, } from "./resources/scoring-functions.mjs";
|
|
20
|
+
import { Shields, } from "./resources/shields.mjs";
|
|
21
|
+
import { SyntheticDataGeneration, } from "./resources/synthetic-data-generation.mjs";
|
|
22
|
+
import { Telemetry, } from "./resources/telemetry.mjs";
|
|
23
|
+
import { Toolgroups, } from "./resources/toolgroups.mjs";
|
|
24
|
+
import { Tools } from "./resources/tools.mjs";
|
|
25
|
+
import { VectorDBs, } from "./resources/vector-dbs.mjs";
|
|
26
|
+
import { VectorIo, } from "./resources/vector-io.mjs";
|
|
27
|
+
import { Agents, } from "./resources/agents/agents.mjs";
|
|
28
|
+
import { Eval, } from "./resources/eval/eval.mjs";
|
|
29
|
+
import { PostTraining, } from "./resources/post-training/post-training.mjs";
|
|
30
|
+
import { ToolRuntime, } from "./resources/tool-runtime/tool-runtime.mjs";
|
|
11
31
|
/**
|
|
12
32
|
* API Client for interfacing with the Llama Stack Client API.
|
|
13
33
|
*/
|
|
@@ -15,8 +35,8 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
15
35
|
/**
|
|
16
36
|
* API Client for interfacing with the Llama Stack Client API.
|
|
17
37
|
*
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {string} [opts.baseURL=process.env['LLAMA_STACK_CLIENT_BASE_URL'] ?? http://any-hosted-llama-stack
|
|
38
|
+
* @param {string | null | undefined} [opts.apiKey=process.env['LLAMA_STACK_CLIENT_API_KEY'] ?? null]
|
|
39
|
+
* @param {string} [opts.baseURL=process.env['LLAMA_STACK_CLIENT_BASE_URL'] ?? http://any-hosted-llama-stack.com] - Override the default base URL for the API.
|
|
20
40
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
21
41
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
22
42
|
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -24,38 +44,44 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
24
44
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
25
45
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
26
46
|
*/
|
|
27
|
-
constructor({ baseURL = Core.readEnv('LLAMA_STACK_CLIENT_BASE_URL'), ...opts } = {}) {
|
|
47
|
+
constructor({ baseURL = Core.readEnv('LLAMA_STACK_CLIENT_BASE_URL'), apiKey = Core.readEnv('LLAMA_STACK_CLIENT_API_KEY') ?? null, ...opts } = {}) {
|
|
28
48
|
const options = {
|
|
49
|
+
apiKey,
|
|
29
50
|
...opts,
|
|
30
|
-
baseURL
|
|
31
|
-
environment: opts.environment ?? 'production',
|
|
51
|
+
baseURL: baseURL || `http://any-hosted-llama-stack.com`,
|
|
32
52
|
};
|
|
33
|
-
if (baseURL && opts.environment) {
|
|
34
|
-
throw new Errors.LlamaStackClientError('Ambiguous URL; The `baseURL` option (or LLAMA_STACK_CLIENT_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null');
|
|
35
|
-
}
|
|
36
53
|
super({
|
|
37
|
-
baseURL: options.baseURL
|
|
54
|
+
baseURL: options.baseURL,
|
|
38
55
|
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
39
56
|
httpAgent: options.httpAgent,
|
|
40
57
|
maxRetries: options.maxRetries,
|
|
41
58
|
fetch: options.fetch,
|
|
42
59
|
});
|
|
43
|
-
this.
|
|
60
|
+
this.toolgroups = new API.Toolgroups(this);
|
|
61
|
+
this.tools = new API.Tools(this);
|
|
62
|
+
this.toolRuntime = new API.ToolRuntime(this);
|
|
44
63
|
this.agents = new API.Agents(this);
|
|
64
|
+
this.batchInference = new API.BatchInference(this);
|
|
45
65
|
this.datasets = new API.Datasets(this);
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
66
|
+
this.eval = new API.Eval(this);
|
|
67
|
+
this.inspect = new API.Inspect(this);
|
|
48
68
|
this.inference = new API.Inference(this);
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
this.postTraining = new API.PostTraining(this);
|
|
52
|
-
this.rewardScoring = new API.RewardScoringResource(this);
|
|
53
|
-
this.syntheticDataGeneration = new API.SyntheticDataGenerationResource(this);
|
|
54
|
-
this.batchInference = new API.BatchInference(this);
|
|
69
|
+
this.vectorIo = new API.VectorIo(this);
|
|
70
|
+
this.vectorDBs = new API.VectorDBs(this);
|
|
55
71
|
this.models = new API.Models(this);
|
|
56
|
-
this.
|
|
72
|
+
this.postTraining = new API.PostTraining(this);
|
|
73
|
+
this.providers = new API.Providers(this);
|
|
74
|
+
this.routes = new API.Routes(this);
|
|
75
|
+
this.safety = new API.Safety(this);
|
|
57
76
|
this.shields = new API.Shields(this);
|
|
77
|
+
this.syntheticDataGeneration = new API.SyntheticDataGeneration(this);
|
|
78
|
+
this.telemetry = new API.Telemetry(this);
|
|
79
|
+
this.datasetio = new API.Datasetio(this);
|
|
80
|
+
this.scoring = new API.Scoring(this);
|
|
81
|
+
this.scoringFunctions = new API.ScoringFunctions(this);
|
|
82
|
+
this.evalTasks = new API.EvalTasks(this);
|
|
58
83
|
this._options = options;
|
|
84
|
+
this.apiKey = apiKey;
|
|
59
85
|
}
|
|
60
86
|
defaultQuery() {
|
|
61
87
|
return this._options.defaultQuery;
|
|
@@ -66,6 +92,15 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
66
92
|
...this._options.defaultHeaders,
|
|
67
93
|
};
|
|
68
94
|
}
|
|
95
|
+
authHeaders(opts) {
|
|
96
|
+
if (this.apiKey == null) {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
return { Authorization: `Bearer ${this.apiKey}` };
|
|
100
|
+
}
|
|
101
|
+
stringifyQuery(query) {
|
|
102
|
+
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
103
|
+
}
|
|
69
104
|
}
|
|
70
105
|
_a = LlamaStackClient;
|
|
71
106
|
LlamaStackClient.LlamaStackClient = _a;
|
|
@@ -85,25 +120,30 @@ LlamaStackClient.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
|
85
120
|
LlamaStackClient.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
86
121
|
LlamaStackClient.toFile = Uploads.toFile;
|
|
87
122
|
LlamaStackClient.fileFromPath = Uploads.fileFromPath;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
123
|
+
LlamaStackClient.Toolgroups = Toolgroups;
|
|
124
|
+
LlamaStackClient.Tools = Tools;
|
|
125
|
+
LlamaStackClient.ToolRuntime = ToolRuntime;
|
|
126
|
+
LlamaStackClient.Agents = Agents;
|
|
127
|
+
LlamaStackClient.BatchInference = BatchInference;
|
|
128
|
+
LlamaStackClient.Datasets = Datasets;
|
|
129
|
+
LlamaStackClient.Eval = Eval;
|
|
130
|
+
LlamaStackClient.Inspect = Inspect;
|
|
131
|
+
LlamaStackClient.Inference = Inference;
|
|
132
|
+
LlamaStackClient.VectorIo = VectorIo;
|
|
133
|
+
LlamaStackClient.VectorDBs = VectorDBs;
|
|
134
|
+
LlamaStackClient.Models = Models;
|
|
135
|
+
LlamaStackClient.PostTraining = PostTraining;
|
|
136
|
+
LlamaStackClient.Providers = Providers;
|
|
137
|
+
LlamaStackClient.Routes = Routes;
|
|
138
|
+
LlamaStackClient.Safety = Safety;
|
|
139
|
+
LlamaStackClient.Shields = Shields;
|
|
140
|
+
LlamaStackClient.SyntheticDataGeneration = SyntheticDataGeneration;
|
|
141
|
+
LlamaStackClient.Telemetry = Telemetry;
|
|
142
|
+
LlamaStackClient.Datasetio = Datasetio;
|
|
143
|
+
LlamaStackClient.Scoring = Scoring;
|
|
144
|
+
LlamaStackClient.ScoringFunctions = ScoringFunctions;
|
|
145
|
+
LlamaStackClient.EvalTasks = EvalTasks;
|
|
146
|
+
export { toFile, fileFromPath } from "./uploads.mjs";
|
|
147
|
+
export { LlamaStackClientError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.mjs";
|
|
108
148
|
export default LlamaStackClient;
|
|
109
149
|
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,KAAK,EAAE;OACP,KAAK,IAAI;OACT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EACL,cAAc,GAIf;OACM,EACL,SAAS,GAIV;OACM,EAIL,QAAQ,GAET;OACM,EAIL,SAAS,GAEV;OACM,EAIL,SAAS,GASV;OACM,EAAc,OAAO,EAAwC;OAC7D,EAKL,MAAM,GACP;OACM,EAA+C,SAAS,EAAE;OAC1D,EAAyC,MAAM,EAAE;OACjD,EAAqB,MAAM,EAAyB;OACpD,EACL,OAAO,GAKR;OACM,EAML,gBAAgB,GACjB;OACM,EAKL,OAAO,GACR;OACM,EACL,uBAAuB,GAGxB;OACM,EAKL,SAAS,GAWV;OACM,EAKL,UAAU,GACX;OACM,EAA6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AAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import { type Response } from "../../_shims/index.js";
|
|
3
|
+
import { type Bytes } from "./line.js";
|
|
4
|
+
export declare class JSONLDecoder<T> {
|
|
5
|
+
private iterator;
|
|
6
|
+
controller: AbortController;
|
|
7
|
+
constructor(iterator: AsyncIterableIterator<Bytes>, controller: AbortController);
|
|
8
|
+
private decoder;
|
|
9
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
10
|
+
static fromResponse<T>(response: Response, controller: AbortController): JSONLDecoder<T>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=jsonl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../src/internal/decoders/jsonl.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEjD,qBAAa,YAAY,CAAC,CAAC;IAIvB,OAAO,CAAC,QAAQ;IAHlB,UAAU,EAAE,eAAe,CAAC;gBAGlB,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,EAC9C,UAAU,EAAE,eAAe;YAKd,OAAO;IAatB,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;IAI1C,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,GAAG,YAAY,CAAC,CAAC,CAAC;CAQzF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSONLDecoder = void 0;
|
|
4
|
+
const error_1 = require("../../error.js");
|
|
5
|
+
const stream_utils_1 = require("../stream-utils.js");
|
|
6
|
+
const line_1 = require("./line.js");
|
|
7
|
+
class JSONLDecoder {
|
|
8
|
+
constructor(iterator, controller) {
|
|
9
|
+
this.iterator = iterator;
|
|
10
|
+
this.controller = controller;
|
|
11
|
+
}
|
|
12
|
+
async *decoder() {
|
|
13
|
+
const lineDecoder = new line_1.LineDecoder();
|
|
14
|
+
for await (const chunk of this.iterator) {
|
|
15
|
+
for (const line of lineDecoder.decode(chunk)) {
|
|
16
|
+
yield JSON.parse(line);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
for (const line of lineDecoder.flush()) {
|
|
20
|
+
yield JSON.parse(line);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
[Symbol.asyncIterator]() {
|
|
24
|
+
return this.decoder();
|
|
25
|
+
}
|
|
26
|
+
static fromResponse(response, controller) {
|
|
27
|
+
if (!response.body) {
|
|
28
|
+
controller.abort();
|
|
29
|
+
throw new error_1.LlamaStackClientError(`Attempted to iterate over a response with no body`);
|
|
30
|
+
}
|
|
31
|
+
return new JSONLDecoder((0, stream_utils_1.ReadableStreamToAsyncIterable)(response.body), controller);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.JSONLDecoder = JSONLDecoder;
|
|
35
|
+
//# sourceMappingURL=jsonl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../../src/internal/decoders/jsonl.ts"],"names":[],"mappings":";;;AAAA,0CAAoD;AACpD,qDAAgE;AAEhE,oCAAiD;AAEjD,MAAa,YAAY;IAGvB,YACU,QAAsC,EAC9C,UAA2B;QADnB,aAAQ,GAAR,QAAQ,CAA8B;QAG9C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,CAAC,OAAO;QACpB,MAAM,WAAW,GAAG,IAAI,kBAAW,EAAE,CAAC;QACtC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YACvC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;gBAC5C,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aACxB;SACF;QAED,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE;YACtC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACxB;IACH,CAAC;IAED,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,YAAY,CAAI,QAAkB,EAAE,UAA2B;QACpE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YAClB,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,6BAAqB,CAAC,mDAAmD,CAAC,CAAC;SACtF;QAED,OAAO,IAAI,YAAY,CAAC,IAAA,4CAA6B,EAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IAC3F,CAAC;CACF;AAnCD,oCAmCC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LlamaStackClientError } from "../../error.mjs";
|
|
2
|
+
import { ReadableStreamToAsyncIterable } from "../stream-utils.mjs";
|
|
3
|
+
import { LineDecoder } from "./line.mjs";
|
|
4
|
+
export class JSONLDecoder {
|
|
5
|
+
constructor(iterator, controller) {
|
|
6
|
+
this.iterator = iterator;
|
|
7
|
+
this.controller = controller;
|
|
8
|
+
}
|
|
9
|
+
async *decoder() {
|
|
10
|
+
const lineDecoder = new LineDecoder();
|
|
11
|
+
for await (const chunk of this.iterator) {
|
|
12
|
+
for (const line of lineDecoder.decode(chunk)) {
|
|
13
|
+
yield JSON.parse(line);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
for (const line of lineDecoder.flush()) {
|
|
17
|
+
yield JSON.parse(line);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
[Symbol.asyncIterator]() {
|
|
21
|
+
return this.decoder();
|
|
22
|
+
}
|
|
23
|
+
static fromResponse(response, controller) {
|
|
24
|
+
if (!response.body) {
|
|
25
|
+
controller.abort();
|
|
26
|
+
throw new LlamaStackClientError(`Attempted to iterate over a response with no body`);
|
|
27
|
+
}
|
|
28
|
+
return new JSONLDecoder(ReadableStreamToAsyncIterable(response.body), controller);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=jsonl.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl.mjs","sourceRoot":"","sources":["../../src/internal/decoders/jsonl.ts"],"names":[],"mappings":"OAAO,EAAE,qBAAqB,EAAE;OACzB,EAAE,6BAA6B,EAAE;OAEjC,EAAE,WAAW,EAAc;AAElC,MAAM,OAAO,YAAY;IAGvB,YACU,QAAsC,EAC9C,UAA2B;QADnB,aAAQ,GAAR,QAAQ,CAA8B;QAG9C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,CAAC,OAAO;QACpB,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QACtC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YACvC,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;gBAC5C,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aACxB;SACF;QAED,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE;YACtC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACxB;IACH,CAAC;IAED,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,YAAY,CAAI,QAAkB,EAAE,UAA2B;QACpE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YAClB,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,qBAAqB,CAAC,mDAAmD,CAAC,CAAC;SACtF;QAED,OAAO,IAAI,YAAY,CAAC,6BAA6B,CAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IAC3F,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
|
|
5
|
+
* reading lines from text.
|
|
6
|
+
*
|
|
7
|
+
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
|
|
8
|
+
*/
|
|
9
|
+
export declare class LineDecoder {
|
|
10
|
+
static NEWLINE_CHARS: Set<string>;
|
|
11
|
+
static NEWLINE_REGEXP: RegExp;
|
|
12
|
+
buffer: string[];
|
|
13
|
+
trailingCR: boolean;
|
|
14
|
+
textDecoder: any;
|
|
15
|
+
constructor();
|
|
16
|
+
decode(chunk: Bytes): string[];
|
|
17
|
+
decodeText(bytes: Bytes): string;
|
|
18
|
+
flush(): string[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";AAEA,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,WAAW;IAEtB,MAAM,CAAC,aAAa,cAAyB;IAC7C,MAAM,CAAC,cAAc,SAAkB;IAEvC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,GAAG,CAAC;;IAOjB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE;IA0C9B,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAqChC,KAAK,IAAI,MAAM,EAAE;CAUlB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LineDecoder = void 0;
|
|
4
|
+
const error_1 = require("../../error.js");
|
|
5
|
+
/**
|
|
6
|
+
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
|
|
7
|
+
* reading lines from text.
|
|
8
|
+
*
|
|
9
|
+
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
|
|
10
|
+
*/
|
|
11
|
+
class LineDecoder {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.buffer = [];
|
|
14
|
+
this.trailingCR = false;
|
|
15
|
+
}
|
|
16
|
+
decode(chunk) {
|
|
17
|
+
let text = this.decodeText(chunk);
|
|
18
|
+
if (this.trailingCR) {
|
|
19
|
+
text = '\r' + text;
|
|
20
|
+
this.trailingCR = false;
|
|
21
|
+
}
|
|
22
|
+
if (text.endsWith('\r')) {
|
|
23
|
+
this.trailingCR = true;
|
|
24
|
+
text = text.slice(0, -1);
|
|
25
|
+
}
|
|
26
|
+
if (!text) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || '');
|
|
30
|
+
let lines = text.split(LineDecoder.NEWLINE_REGEXP);
|
|
31
|
+
// if there is a trailing new line then the last entry will be an empty
|
|
32
|
+
// string which we don't care about
|
|
33
|
+
if (trailingNewline) {
|
|
34
|
+
lines.pop();
|
|
35
|
+
}
|
|
36
|
+
if (lines.length === 1 && !trailingNewline) {
|
|
37
|
+
this.buffer.push(lines[0]);
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
if (this.buffer.length > 0) {
|
|
41
|
+
lines = [this.buffer.join('') + lines[0], ...lines.slice(1)];
|
|
42
|
+
this.buffer = [];
|
|
43
|
+
}
|
|
44
|
+
if (!trailingNewline) {
|
|
45
|
+
this.buffer = [lines.pop() || ''];
|
|
46
|
+
}
|
|
47
|
+
return lines;
|
|
48
|
+
}
|
|
49
|
+
decodeText(bytes) {
|
|
50
|
+
if (bytes == null)
|
|
51
|
+
return '';
|
|
52
|
+
if (typeof bytes === 'string')
|
|
53
|
+
return bytes;
|
|
54
|
+
// Node:
|
|
55
|
+
if (typeof Buffer !== 'undefined') {
|
|
56
|
+
if (bytes instanceof Buffer) {
|
|
57
|
+
return bytes.toString();
|
|
58
|
+
}
|
|
59
|
+
if (bytes instanceof Uint8Array) {
|
|
60
|
+
return Buffer.from(bytes).toString();
|
|
61
|
+
}
|
|
62
|
+
throw new error_1.LlamaStackClientError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`);
|
|
63
|
+
}
|
|
64
|
+
// Browser
|
|
65
|
+
if (typeof TextDecoder !== 'undefined') {
|
|
66
|
+
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
|
|
67
|
+
this.textDecoder ?? (this.textDecoder = new TextDecoder('utf8'));
|
|
68
|
+
return this.textDecoder.decode(bytes);
|
|
69
|
+
}
|
|
70
|
+
throw new error_1.LlamaStackClientError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
|
|
71
|
+
}
|
|
72
|
+
throw new error_1.LlamaStackClientError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
|
|
73
|
+
}
|
|
74
|
+
flush() {
|
|
75
|
+
if (!this.buffer.length && !this.trailingCR) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
const lines = [this.buffer.join('')];
|
|
79
|
+
this.buffer = [];
|
|
80
|
+
this.trailingCR = false;
|
|
81
|
+
return lines;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.LineDecoder = LineDecoder;
|
|
85
|
+
// prettier-ignore
|
|
86
|
+
LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
|
|
87
|
+
LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
|
|
88
|
+
//# sourceMappingURL=line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":";;;AAAA,0CAAoD;AAIpD;;;;;GAKG;AACH,MAAa,WAAW;IAStB;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAElC,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;SACzB;QACD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC1B;QAED,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,EAAE,CAAC;SACX;QAED,MAAM,eAAe,GAAG,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACnF,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,C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K,WAAW,EAAE;YACtC,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,WAAW,EAAE;gBAC/D,IAAI,CAAC,WAAW,KAAhB,IAAI,CAAC,WAAW,GAAK,IAAI,WAAW,CAAC,MAAM,CAAC,EAAC;gBAC7C,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aACvC;YAED,MAAM,IAAI,6BAAqB,CAC7B,oDACG,KAAa,CAAC,WAAW,CAAC,IAC7B,gDAAgD,CACjD,CAAC;SACH;QAED,MAAM,IAAI,6BAAqB,CAC7B,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAC3C,OAAO,EAAE,CAAC;SACX;QAED,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;;AAtGH,kCAuGC;AAtGC,kBAAkB;AACX,yBAAa,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACtC,0BAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { LlamaStackClientError } from "../../error.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
|
|
4
|
+
* reading lines from text.
|
|
5
|
+
*
|
|
6
|
+
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
|
|
7
|
+
*/
|
|
8
|
+
export class LineDecoder {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.buffer = [];
|
|
11
|
+
this.trailingCR = false;
|
|
12
|
+
}
|
|
13
|
+
decode(chunk) {
|
|
14
|
+
let text = this.decodeText(chunk);
|
|
15
|
+
if (this.trailingCR) {
|
|
16
|
+
text = '\r' + text;
|
|
17
|
+
this.trailingCR = false;
|
|
18
|
+
}
|
|
19
|
+
if (text.endsWith('\r')) {
|
|
20
|
+
this.trailingCR = true;
|
|
21
|
+
text = text.slice(0, -1);
|
|
22
|
+
}
|
|
23
|
+
if (!text) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || '');
|
|
27
|
+
let lines = text.split(LineDecoder.NEWLINE_REGEXP);
|
|
28
|
+
// if there is a trailing new line then the last entry will be an empty
|
|
29
|
+
// string which we don't care about
|
|
30
|
+
if (trailingNewline) {
|
|
31
|
+
lines.pop();
|
|
32
|
+
}
|
|
33
|
+
if (lines.length === 1 && !trailingNewline) {
|
|
34
|
+
this.buffer.push(lines[0]);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
if (this.buffer.length > 0) {
|
|
38
|
+
lines = [this.buffer.join('') + lines[0], ...lines.slice(1)];
|
|
39
|
+
this.buffer = [];
|
|
40
|
+
}
|
|
41
|
+
if (!trailingNewline) {
|
|
42
|
+
this.buffer = [lines.pop() || ''];
|
|
43
|
+
}
|
|
44
|
+
return lines;
|
|
45
|
+
}
|
|
46
|
+
decodeText(bytes) {
|
|
47
|
+
if (bytes == null)
|
|
48
|
+
return '';
|
|
49
|
+
if (typeof bytes === 'string')
|
|
50
|
+
return bytes;
|
|
51
|
+
// Node:
|
|
52
|
+
if (typeof Buffer !== 'undefined') {
|
|
53
|
+
if (bytes instanceof Buffer) {
|
|
54
|
+
return bytes.toString();
|
|
55
|
+
}
|
|
56
|
+
if (bytes instanceof Uint8Array) {
|
|
57
|
+
return Buffer.from(bytes).toString();
|
|
58
|
+
}
|
|
59
|
+
throw new LlamaStackClientError(`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`);
|
|
60
|
+
}
|
|
61
|
+
// Browser
|
|
62
|
+
if (typeof TextDecoder !== 'undefined') {
|
|
63
|
+
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
|
|
64
|
+
this.textDecoder ?? (this.textDecoder = new TextDecoder('utf8'));
|
|
65
|
+
return this.textDecoder.decode(bytes);
|
|
66
|
+
}
|
|
67
|
+
throw new LlamaStackClientError(`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`);
|
|
68
|
+
}
|
|
69
|
+
throw new LlamaStackClientError(`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`);
|
|
70
|
+
}
|
|
71
|
+
flush() {
|
|
72
|
+
if (!this.buffer.length && !this.trailingCR) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
const lines = [this.buffer.join('')];
|
|
76
|
+
this.buffer = [];
|
|
77
|
+
this.trailingCR = false;
|
|
78
|
+
return lines;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// prettier-ignore
|
|
82
|
+
LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r']);
|
|
83
|
+
LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r]/g;
|
|
84
|
+
//# sourceMappingURL=line.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.mjs","sourceRoot":"","sources":["../../src/internal/decoders/line.ts"],"names":[],"mappings":"OAAO,EAAE,qBAAqB,EAAE;AAIhC;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IAStB;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,IAAI,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAElC,IAAI,IAAI,CAAC,U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KAAK,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;;AArGD,kBAAkB;AACX,yBAAa,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACtC,0BAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Format } from "./types.js";
|
|
2
|
+
export declare const default_format: Format;
|
|
3
|
+
export declare const formatters: Record<Format, (str: PropertyKey) => string>;
|
|
4
|
+
export declare const RFC1738 = "RFC1738";
|
|
5
|
+
export declare const RFC3986 = "RFC3986";
|
|
6
|
+
//# sourceMappingURL=formats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,cAAc,EAAE,MAAkB,CAAC;AAChD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,MAAM,CAGnE,CAAC;AACF,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,OAAO,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RFC3986 = exports.RFC1738 = exports.formatters = exports.default_format = void 0;
|
|
4
|
+
exports.default_format = 'RFC3986';
|
|
5
|
+
exports.formatters = {
|
|
6
|
+
RFC1738: (v) => String(v).replace(/%20/g, '+'),
|
|
7
|
+
RFC3986: (v) => String(v),
|
|
8
|
+
};
|
|
9
|
+
exports.RFC1738 = 'RFC1738';
|
|
10
|
+
exports.RFC3986 = 'RFC3986';
|
|
11
|
+
//# sourceMappingURL=formats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.js","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAW,SAAS,CAAC;AACnC,QAAA,UAAU,GAAiD;IACtE,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;CACvC,CAAC;AACW,QAAA,OAAO,GAAG,SAAS,CAAC;AACpB,QAAA,OAAO,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.mjs","sourceRoot":"","sources":["../../src/internal/qs/formats.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAW,SAAS,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAiD;IACtE,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAc,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;CACvC,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const formats: {
|
|
2
|
+
formatters: Record<import("./types").Format, (str: PropertyKey) => string>;
|
|
3
|
+
RFC1738: string;
|
|
4
|
+
RFC3986: string;
|
|
5
|
+
default: import("./types").Format;
|
|
6
|
+
};
|
|
7
|
+
export { stringify } from "./stringify.js";
|
|
8
|
+
export { formats };
|
|
9
|
+
export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from "./types.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO;;;;;CAKZ,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formats = exports.stringify = void 0;
|
|
4
|
+
const formats_1 = require("./formats.js");
|
|
5
|
+
const formats = {
|
|
6
|
+
formatters: formats_1.formatters,
|
|
7
|
+
RFC1738: formats_1.RFC1738,
|
|
8
|
+
RFC3986: formats_1.RFC3986,
|
|
9
|
+
default: formats_1.default_format,
|
|
10
|
+
};
|
|
11
|
+
exports.formats = formats;
|
|
12
|
+
var stringify_1 = require("./stringify.js");
|
|
13
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return stringify_1.stringify; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":";;;AAAA,0CAAyE;AAEzE,MAAM,OAAO,GAAG;IACd,UAAU,EAAV,oBAAU;IACV,OAAO,EAAP,iBAAO;IACP,OAAO,EAAP,iBAAO;IACP,OAAO,EAAE,wBAAc;CACxB,CAAC;AAGO,0BAAO;AADhB,4CAAwC;AAA/B,sGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default_format, formatters, RFC1738, RFC3986 } from "./formats.mjs";
|
|
2
|
+
const formats = {
|
|
3
|
+
formatters,
|
|
4
|
+
RFC1738,
|
|
5
|
+
RFC3986,
|
|
6
|
+
default: default_format,
|
|
7
|
+
};
|
|
8
|
+
export { stringify } from "./stringify.mjs";
|
|
9
|
+
export { formats };
|
|
10
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/internal/qs/index.ts"],"names":[],"mappings":"OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE;AAEvD,MAAM,OAAO,GAAG;IACd,UAAU;IACV,OAAO;IACP,OAAO;IACP,OAAO,EAAE,cAAc;CACxB,CAAC;OAEK,EAAE,SAAS,EAAE;AACpB,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../src/internal/qs/stringify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAkTvE,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,gBAAqB,UA+EjE"}
|