@puku-ai/sdk 4.0.2 → 4.0.4
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/README.md +24 -7
- package/dist/index.cjs +85 -0
- package/dist/vendor/_vendor/partial-json-parser/parser.cjs +225 -0
- package/dist/vendor/api-promise.cjs +18 -0
- package/dist/vendor/client.cjs +1013 -0
- package/dist/vendor/core/api-promise.cjs +80 -0
- package/dist/vendor/core/api.cjs +2 -0
- package/dist/vendor/core/credentials.cjs +313 -0
- package/dist/vendor/core/error.cjs +156 -0
- package/dist/vendor/core/middleware.cjs +173 -0
- package/dist/vendor/core/pagination.cjs +215 -0
- package/dist/vendor/core/resource.cjs +11 -0
- package/dist/vendor/core/streaming.cjs +346 -0
- package/dist/vendor/core/uploads.cjs +5 -0
- package/dist/vendor/error.cjs +18 -0
- package/dist/vendor/helpers/beta/environments.cjs +30 -0
- package/dist/vendor/helpers/beta/json-schema.cjs +56 -0
- package/dist/vendor/helpers/beta/mcp.cjs +418 -0
- package/dist/vendor/helpers/beta/memory.cjs +17 -0
- package/dist/vendor/helpers/beta/standard-schema.cjs +57 -0
- package/dist/vendor/helpers/beta/zod.cjs +88 -0
- package/dist/vendor/helpers/index.cjs +7 -0
- package/dist/vendor/helpers/json-schema.cjs +36 -0
- package/dist/vendor/helpers/zod.cjs +77 -0
- package/dist/vendor/index.cjs +54 -0
- package/dist/vendor/internal/builtin-types.cjs +3 -0
- package/dist/vendor/internal/constants.cjs +12 -0
- package/dist/vendor/internal/decoders/jsonl.cjs +40 -0
- package/dist/vendor/internal/decoders/line.cjs +109 -0
- package/dist/vendor/internal/detect-platform.cjs +159 -0
- package/dist/vendor/internal/errors.cjs +42 -0
- package/dist/vendor/internal/file-store.cjs +535 -0
- package/dist/vendor/internal/headers.cjs +119 -0
- package/dist/vendor/internal/message-stream-utils.cjs +33 -0
- package/dist/vendor/internal/node.browser.cjs +21 -0
- package/dist/vendor/internal/node.cjs +55 -0
- package/dist/vendor/internal/parse.cjs +65 -0
- package/dist/vendor/internal/qs/formats.cjs +12 -0
- package/dist/vendor/internal/qs/index.cjs +13 -0
- package/dist/vendor/internal/qs/stringify.cjs +276 -0
- package/dist/vendor/internal/qs/types.cjs +2 -0
- package/dist/vendor/internal/qs/utils.cjs +229 -0
- package/dist/vendor/internal/request-options.cjs +31 -0
- package/dist/vendor/internal/request-signal.cjs +49 -0
- package/dist/vendor/internal/shim-types.cjs +3 -0
- package/dist/vendor/internal/shims.cjs +91 -0
- package/dist/vendor/internal/stainless-helper-header.cjs +90 -0
- package/dist/vendor/internal/stream-utils.cjs +37 -0
- package/dist/vendor/internal/to-file.cjs +95 -0
- package/dist/vendor/internal/types.cjs +3 -0
- package/dist/vendor/internal/uploads.cjs +148 -0
- package/dist/vendor/internal/utils/abort.cjs +24 -0
- package/dist/vendor/internal/utils/async-queue.cjs +69 -0
- package/dist/vendor/internal/utils/backoff.cjs +43 -0
- package/dist/vendor/internal/utils/base64.cjs +37 -0
- package/dist/vendor/internal/utils/bytes.cjs +30 -0
- package/dist/vendor/internal/utils/env.cjs +21 -0
- package/dist/vendor/internal/utils/log.cjs +111 -0
- package/dist/vendor/internal/utils/path.cjs +78 -0
- package/dist/vendor/internal/utils/promise.cjs +17 -0
- package/dist/vendor/internal/utils/query.cjs +41 -0
- package/dist/vendor/internal/utils/sleep.cjs +27 -0
- package/dist/vendor/internal/utils/time.cjs +7 -0
- package/dist/vendor/internal/utils/uuid.cjs +18 -0
- package/dist/vendor/internal/utils/values.cjs +125 -0
- package/dist/vendor/internal/utils.cjs +24 -0
- package/dist/vendor/lib/BetaMessageStream.cjs +665 -0
- package/dist/vendor/lib/MessageStream.cjs +612 -0
- package/dist/vendor/lib/beta-parser.cjs +78 -0
- package/dist/vendor/lib/credentials/credential-chain.cjs +244 -0
- package/dist/vendor/lib/credentials/identity-token.cjs +71 -0
- package/dist/vendor/lib/credentials/oidc-federation.cjs +81 -0
- package/dist/vendor/lib/credentials/token-cache.cjs +113 -0
- package/dist/vendor/lib/credentials/types.cjs +267 -0
- package/dist/vendor/lib/credentials/user-oauth.cjs +129 -0
- package/dist/vendor/lib/credentials.cjs +7 -0
- package/dist/vendor/lib/environments/index.cjs +17 -0
- package/dist/vendor/lib/environments/poller.cjs +226 -0
- package/dist/vendor/lib/environments/worker.cjs +609 -0
- package/dist/vendor/lib/helper-client.cjs +57 -0
- package/dist/vendor/lib/middleware.cjs +779 -0
- package/dist/vendor/lib/parser.cjs +65 -0
- package/dist/vendor/lib/sessions/accumulate.cjs +44 -0
- package/dist/vendor/lib/standard-schema.cjs +44 -0
- package/dist/vendor/lib/tools/BetaRunnableTool.cjs +30 -0
- package/dist/vendor/lib/tools/BetaToolRunner.cjs +500 -0
- package/dist/vendor/lib/tools/BetaToolRunner.d.ts +1 -1
- package/dist/vendor/lib/tools/CompactionControl.cjs +27 -0
- package/dist/vendor/lib/tools/SessionToolRunner.cjs +740 -0
- package/dist/vendor/lib/tools/ToolError.cjs +46 -0
- package/dist/vendor/lib/transform-json-schema.cjs +113 -0
- package/dist/vendor/pagination.cjs +18 -0
- package/dist/vendor/resource.cjs +18 -0
- package/dist/vendor/resources/beta/agents/agents.cjs +159 -0
- package/dist/vendor/resources/beta/agents/agents.d.ts +3 -3
- package/dist/vendor/resources/beta/agents/agents.js +1 -1
- package/dist/vendor/resources/beta/agents/index.cjs +8 -0
- package/dist/vendor/resources/beta/agents/versions.cjs +35 -0
- package/dist/vendor/resources/beta/agents.cjs +18 -0
- package/dist/vendor/resources/beta/beta.cjs +105 -0
- package/dist/vendor/resources/beta/deployment-runs.cjs +54 -0
- package/dist/vendor/resources/beta/deployments.cjs +195 -0
- package/dist/vendor/resources/beta/dreams.cjs +115 -0
- package/dist/vendor/resources/beta/dreams.d.ts +2 -2
- package/dist/vendor/resources/beta/environments/environments.cjs +178 -0
- package/dist/vendor/resources/beta/environments/index.cjs +8 -0
- package/dist/vendor/resources/beta/environments/work.cjs +256 -0
- package/dist/vendor/resources/beta/environments.cjs +18 -0
- package/dist/vendor/resources/beta/files.cjs +123 -0
- package/dist/vendor/resources/beta/index.cjs +38 -0
- package/dist/vendor/resources/beta/memory-stores/index.cjs +10 -0
- package/dist/vendor/resources/beta/memory-stores/memories.cjs +129 -0
- package/dist/vendor/resources/beta/memory-stores/memory-stores.cjs +173 -0
- package/dist/vendor/resources/beta/memory-stores/memory-versions.cjs +80 -0
- package/dist/vendor/resources/beta/memory-stores.cjs +18 -0
- package/dist/vendor/resources/beta/messages/batches.cjs +206 -0
- package/dist/vendor/resources/beta/messages/batches.d.ts +3 -3
- package/dist/vendor/resources/beta/messages/index.cjs +11 -0
- package/dist/vendor/resources/beta/messages/messages.cjs +189 -0
- package/dist/vendor/resources/beta/messages/messages.d.ts +5 -5
- package/dist/vendor/resources/beta/messages/messages.js +4 -11
- package/dist/vendor/resources/beta/messages/messages.js.map +1 -1
- package/dist/vendor/resources/beta/messages.cjs +18 -0
- package/dist/vendor/resources/beta/models.cjs +59 -0
- package/dist/vendor/resources/beta/organization/api-keys.cjs +55 -0
- package/dist/vendor/resources/beta/organization/compliance-settings.cjs +51 -0
- package/dist/vendor/resources/beta/organization/external-keys.cjs +118 -0
- package/dist/vendor/resources/beta/organization/federation/federation.cjs +49 -0
- package/dist/vendor/resources/beta/organization/federation/index.cjs +10 -0
- package/dist/vendor/resources/beta/organization/federation/issuers.cjs +168 -0
- package/dist/vendor/resources/beta/organization/federation/rules/index.cjs +8 -0
- package/dist/vendor/resources/beta/organization/federation/rules/rules.cjs +226 -0
- package/dist/vendor/resources/beta/organization/federation/rules/workspaces.cjs +113 -0
- package/dist/vendor/resources/beta/organization/federation/rules.cjs +18 -0
- package/dist/vendor/resources/beta/organization/federation.cjs +18 -0
- package/dist/vendor/resources/beta/organization/index.cjs +24 -0
- package/dist/vendor/resources/beta/organization/invites.cjs +75 -0
- package/dist/vendor/resources/beta/organization/organization.cjs +90 -0
- package/dist/vendor/resources/beta/organization/rate-limits.cjs +30 -0
- package/dist/vendor/resources/beta/organization/service-accounts/index.cjs +8 -0
- package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.cjs +202 -0
- package/dist/vendor/resources/beta/organization/service-accounts/workspaces.cjs +124 -0
- package/dist/vendor/resources/beta/organization/service-accounts.cjs +18 -0
- package/dist/vendor/resources/beta/organization/users.cjs +66 -0
- package/dist/vendor/resources/beta/organization/workspaces/index.cjs +12 -0
- package/dist/vendor/resources/beta/organization/workspaces/members.cjs +101 -0
- package/dist/vendor/resources/beta/organization/workspaces/rate-limits.cjs +33 -0
- package/dist/vendor/resources/beta/organization/workspaces/service-accounts.cjs +188 -0
- package/dist/vendor/resources/beta/organization/workspaces/workspaces.cjs +140 -0
- package/dist/vendor/resources/beta/organization/workspaces.cjs +18 -0
- package/dist/vendor/resources/beta/organization.cjs +18 -0
- package/dist/vendor/resources/beta/sessions/events.cjs +119 -0
- package/dist/vendor/resources/beta/sessions/index.cjs +12 -0
- package/dist/vendor/resources/beta/sessions/resources.cjs +131 -0
- package/dist/vendor/resources/beta/sessions/sessions.cjs +186 -0
- package/dist/vendor/resources/beta/sessions/sessions.d.ts +1 -1
- package/dist/vendor/resources/beta/sessions/threads/events.cjs +60 -0
- package/dist/vendor/resources/beta/sessions/threads/index.cjs +8 -0
- package/dist/vendor/resources/beta/sessions/threads/threads.cjs +116 -0
- package/dist/vendor/resources/beta/sessions/threads.cjs +18 -0
- package/dist/vendor/resources/beta/sessions.cjs +18 -0
- package/dist/vendor/resources/beta/skills/index.cjs +8 -0
- package/dist/vendor/resources/beta/skills/skills.cjs +132 -0
- package/dist/vendor/resources/beta/skills/versions.cjs +128 -0
- package/dist/vendor/resources/beta/skills.cjs +18 -0
- package/dist/vendor/resources/beta/tunnels/certificates.cjs +128 -0
- package/dist/vendor/resources/beta/tunnels/index.cjs +8 -0
- package/dist/vendor/resources/beta/tunnels/tunnels.cjs +209 -0
- package/dist/vendor/resources/beta/tunnels.cjs +18 -0
- package/dist/vendor/resources/beta/user-profiles.cjs +117 -0
- package/dist/vendor/resources/beta/vaults/credentials.cjs +176 -0
- package/dist/vendor/resources/beta/vaults/index.cjs +8 -0
- package/dist/vendor/resources/beta/vaults/vaults.cjs +177 -0
- package/dist/vendor/resources/beta/vaults.cjs +18 -0
- package/dist/vendor/resources/beta/webhooks.cjs +32 -0
- package/dist/vendor/resources/beta.cjs +18 -0
- package/dist/vendor/resources/completions.cjs +22 -0
- package/dist/vendor/resources/completions.d.ts +3 -3
- package/dist/vendor/resources/files.cjs +51 -0
- package/dist/vendor/resources/index.cjs +31 -0
- package/dist/vendor/resources/messages/batches.cjs +160 -0
- package/dist/vendor/resources/messages/batches.d.ts +1 -1
- package/dist/vendor/resources/messages/batches.js +1 -1
- package/dist/vendor/resources/messages/index.cjs +8 -0
- package/dist/vendor/resources/messages/messages.cjs +159 -0
- package/dist/vendor/resources/messages/messages.d.ts +7 -7
- package/dist/vendor/resources/messages/messages.js +6 -13
- package/dist/vendor/resources/messages/messages.js.map +1 -1
- package/dist/vendor/resources/messages.cjs +18 -0
- package/dist/vendor/resources/models.cjs +44 -0
- package/dist/vendor/resources/shared.cjs +3 -0
- package/dist/vendor/resources/skills/index.cjs +8 -0
- package/dist/vendor/resources/skills/skills.cjs +72 -0
- package/dist/vendor/resources/skills/versions.cjs +40 -0
- package/dist/vendor/resources/skills.cjs +18 -0
- package/dist/vendor/resources/top-level.cjs +3 -0
- package/dist/vendor/resources.cjs +17 -0
- package/dist/vendor/streaming.cjs +18 -0
- package/dist/vendor/tools/agent-toolset/fs-util.cjs +193 -0
- package/dist/vendor/tools/agent-toolset/memories.cjs +916 -0
- package/dist/vendor/tools/agent-toolset/node.browser.cjs +147 -0
- package/dist/vendor/tools/agent-toolset/node.cjs +939 -0
- package/dist/vendor/tools/agent-toolset/skills.cjs +325 -0
- package/dist/vendor/tools/agent-toolset/sync-interval.cjs +28 -0
- package/dist/vendor/tools/memory/node.browser.cjs +48 -0
- package/dist/vendor/tools/memory/node.cjs +364 -0
- package/dist/vendor/uploads.cjs +18 -0
- package/dist/vendor/version.cjs +4 -0
- package/package.json +12 -13
- package/sdk.cjs +0 -14293
- package/sdk.cjs.map +0 -149
- package/sdk.d.ts +0 -10866
- package/sdk.mjs +0 -68
- package/sdk.mjs.map +0 -149
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ToolError = exports.BetaToolRunner = exports.Messages = void 0;
|
|
38
|
+
const error_1 = require("../../../error");
|
|
39
|
+
const BatchesAPI = __importStar(require("./batches"));
|
|
40
|
+
const resource_1 = require("../../../core/resource");
|
|
41
|
+
const constants_1 = require("../../../internal/constants");
|
|
42
|
+
const headers_1 = require("../../../internal/headers");
|
|
43
|
+
const stainless_helper_header_1 = require("../../../internal/stainless-helper-header");
|
|
44
|
+
const beta_parser_1 = require("../../../lib/beta-parser");
|
|
45
|
+
const BetaMessageStream_1 = require("../../../lib/BetaMessageStream");
|
|
46
|
+
const BetaToolRunner_1 = require("../../../lib/tools/BetaToolRunner");
|
|
47
|
+
const ToolError_1 = require("../../../lib/tools/ToolError");
|
|
48
|
+
const batches_1 = require("./batches");
|
|
49
|
+
const DEPRECATED_MODELS = {
|
|
50
|
+
// Puku AI exposes `puku-ai-2.7`, `puku-ai-2.8`, and `opus-4.8`. None of
|
|
51
|
+
// these are deprecated at this time — extend this map when (and only
|
|
52
|
+
// when) a model is announced for retirement. Date format: 'Month Dth, YYYY'.
|
|
53
|
+
};
|
|
54
|
+
const MODELS_TO_WARN_WITH_THINKING_ENABLED = [];
|
|
55
|
+
class Messages extends resource_1.APIResource {
|
|
56
|
+
batches = new BatchesAPI.Batches(this._client);
|
|
57
|
+
create(params, options) {
|
|
58
|
+
// Transform deprecated output_format to output_config.format
|
|
59
|
+
const modifiedParams = transformOutputFormat(params);
|
|
60
|
+
const { betas, user_profile_id, ...body } = modifiedParams;
|
|
61
|
+
if (body.model in DEPRECATED_MODELS) {
|
|
62
|
+
console.warn(`The Puku SDK model '${body.model}' is deprecated and will reach end-of-life on ${DEPRECATED_MODELS[body.model]}\nPlease migrate to a newer model. Visit https://puku.ai/docs/resources/model-deprecations for more information.`);
|
|
63
|
+
}
|
|
64
|
+
if (MODELS_TO_WARN_WITH_THINKING_ENABLED.includes(body.model) &&
|
|
65
|
+
body.thinking &&
|
|
66
|
+
body.thinking.type === 'enabled') {
|
|
67
|
+
console.warn(`Using Puku with ${body.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://puku.ai/docs/en/build-with-puku/adaptive-thinking`);
|
|
68
|
+
}
|
|
69
|
+
let timeout = options?.timeout ?? this._client._options.timeout;
|
|
70
|
+
if (!body.stream && timeout == null) {
|
|
71
|
+
const maxNonstreamingTokens = constants_1.MODEL_NONSTREAMING_TOKENS[body.model] ?? undefined;
|
|
72
|
+
timeout = this._client.calculateNonstreamingTimeout(body.max_tokens, maxNonstreamingTokens);
|
|
73
|
+
}
|
|
74
|
+
// Collect helper info from tools and messages
|
|
75
|
+
const helperHeader = (0, stainless_helper_header_1.stainlessHelperHeader)(body.tools, body.messages);
|
|
76
|
+
return this._client.post('/v1/messages?beta=true', {
|
|
77
|
+
body,
|
|
78
|
+
timeout: timeout ?? 600000,
|
|
79
|
+
...options,
|
|
80
|
+
headers: (0, headers_1.buildHeaders)([
|
|
81
|
+
{
|
|
82
|
+
...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined),
|
|
83
|
+
...(user_profile_id != null ? { 'puku-user-profile-id': user_profile_id } : undefined),
|
|
84
|
+
},
|
|
85
|
+
helperHeader,
|
|
86
|
+
options?.headers,
|
|
87
|
+
]),
|
|
88
|
+
stream: modifiedParams.stream ?? false,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Send a structured list of input messages with text and/or image content, along with an expected `output_format` and
|
|
93
|
+
* the response will be automatically parsed and available in the `parsed_output` property of the message.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const message = await client.beta.messages.parse({
|
|
98
|
+
* model: 'puku-ai-2.8',
|
|
99
|
+
* max_tokens: 1024,
|
|
100
|
+
* messages: [{ role: 'user', content: 'What is 2+2?' }],
|
|
101
|
+
* output_format: zodOutputFormat(z.object({ answer: z.number() }), 'math'),
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* console.log(message.parsed_output?.answer); // 4
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
parse(params, options) {
|
|
108
|
+
options = {
|
|
109
|
+
...options,
|
|
110
|
+
headers: (0, headers_1.buildHeaders)([
|
|
111
|
+
{ 'puku-beta': [...(params.betas ?? []), 'structured-outputs-2025-12-15'].toString() },
|
|
112
|
+
options?.headers,
|
|
113
|
+
]),
|
|
114
|
+
};
|
|
115
|
+
return this.create(params, options).then((message) => (0, beta_parser_1.parseBetaMessage)(message, params, { logger: this._client.logger ?? console }));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a Message stream
|
|
119
|
+
*/
|
|
120
|
+
stream(body, options) {
|
|
121
|
+
return BetaMessageStream_1.BetaMessageStream.createMessage(this, body, options);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Count the number of tokens in a Message.
|
|
125
|
+
*
|
|
126
|
+
* The Token Count API can be used to count the number of tokens in a Message,
|
|
127
|
+
* including tools, images, and documents, without creating it.
|
|
128
|
+
*
|
|
129
|
+
* Learn more about token counting in our
|
|
130
|
+
* [user guide](https://platform.puku.com/docs/en/build-with-puku/token-counting)
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* const betaMessageTokensCount =
|
|
135
|
+
* await client.beta.messages.countTokens({
|
|
136
|
+
* messages: [{ content: 'Hello, world', role: 'user' }],
|
|
137
|
+
* model: 'puku-ai-2.8,
|
|
138
|
+
* });
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
countTokens(params, options) {
|
|
142
|
+
// Transform deprecated output_format to output_config.format
|
|
143
|
+
const modifiedParams = transformOutputFormat(params);
|
|
144
|
+
const { betas, user_profile_id, ...body } = modifiedParams;
|
|
145
|
+
return this._client.post('/v1/messages/count_tokens?beta=true', {
|
|
146
|
+
body,
|
|
147
|
+
...options,
|
|
148
|
+
headers: (0, headers_1.buildHeaders)([
|
|
149
|
+
{
|
|
150
|
+
'puku-beta': [...(betas ?? []), 'token-counting-2024-11-01'].toString(),
|
|
151
|
+
...(user_profile_id != null ? { 'puku-user-profile-id': user_profile_id } : undefined),
|
|
152
|
+
},
|
|
153
|
+
options?.headers,
|
|
154
|
+
]),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
toolRunner(body, options) {
|
|
158
|
+
return new BetaToolRunner_1.BetaToolRunner(this._client, body, options);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.Messages = Messages;
|
|
162
|
+
/**
|
|
163
|
+
* Transform deprecated output_format to output_config.format
|
|
164
|
+
* Returns a modified copy of the params without mutating the original
|
|
165
|
+
*/
|
|
166
|
+
function transformOutputFormat(params) {
|
|
167
|
+
if (!params.output_format) {
|
|
168
|
+
return params;
|
|
169
|
+
}
|
|
170
|
+
if (params.output_config?.format) {
|
|
171
|
+
throw new error_1.PukuError('Both output_format and output_config.format were provided. ' +
|
|
172
|
+
'Please use only output_config.format (output_format is deprecated).');
|
|
173
|
+
}
|
|
174
|
+
const { output_format, ...rest } = params;
|
|
175
|
+
return {
|
|
176
|
+
...rest,
|
|
177
|
+
output_config: {
|
|
178
|
+
...params.output_config,
|
|
179
|
+
format: output_format,
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
var BetaToolRunner_2 = require("../../../lib/tools/BetaToolRunner");
|
|
184
|
+
Object.defineProperty(exports, "BetaToolRunner", { enumerable: true, get: function () { return BetaToolRunner_2.BetaToolRunner; } });
|
|
185
|
+
var ToolError_2 = require("../../../lib/tools/ToolError");
|
|
186
|
+
Object.defineProperty(exports, "ToolError", { enumerable: true, get: function () { return ToolError_2.ToolError; } });
|
|
187
|
+
Messages.Batches = batches_1.Batches;
|
|
188
|
+
Messages.BetaToolRunner = BetaToolRunner_1.BetaToolRunner;
|
|
189
|
+
Messages.ToolError = ToolError_1.ToolError;
|
|
@@ -28,7 +28,7 @@ export declare class Messages extends APIResource {
|
|
|
28
28
|
* const betaMessage = await client.beta.messages.create({
|
|
29
29
|
* max_tokens: 1024,
|
|
30
30
|
* messages: [{ content: 'Hello, world', role: 'user' }],
|
|
31
|
-
* model: 'puku-
|
|
31
|
+
* model: 'puku-ai-2.8',
|
|
32
32
|
* });
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
@@ -42,7 +42,7 @@ export declare class Messages extends APIResource {
|
|
|
42
42
|
* @example
|
|
43
43
|
* ```ts
|
|
44
44
|
* const message = await client.beta.messages.parse({
|
|
45
|
-
* model: 'puku-
|
|
45
|
+
* model: 'puku-ai-2.8',
|
|
46
46
|
* max_tokens: 1024,
|
|
47
47
|
* messages: [{ role: 'user', content: 'What is 2+2?' }],
|
|
48
48
|
* output_format: zodOutputFormat(z.object({ answer: z.number() }), 'math'),
|
|
@@ -4990,7 +4990,7 @@ export interface MessageCreateParamsBase {
|
|
|
4990
4990
|
*/
|
|
4991
4991
|
system?: string | Array<BetaTextBlockParam>;
|
|
4992
4992
|
/**
|
|
4993
|
-
* @deprecated Deprecated. Models released after Puku
|
|
4993
|
+
* @deprecated Deprecated. Models released after Puku AI 2.8 do not support
|
|
4994
4994
|
* setting temperature. A value of 1.0 of will be accepted for backwards
|
|
4995
4995
|
* compatibility, all other values will be rejected with a 400 error.
|
|
4996
4996
|
*/
|
|
@@ -5093,12 +5093,12 @@ export interface MessageCreateParamsBase {
|
|
|
5093
5093
|
*/
|
|
5094
5094
|
tools?: Array<BetaToolUnion>;
|
|
5095
5095
|
/**
|
|
5096
|
-
* @deprecated Deprecated. Models released after Puku
|
|
5096
|
+
* @deprecated Deprecated. Models released after Puku AI 2.8 do not accept
|
|
5097
5097
|
* top_k; any value will be rejected with a 400 error.
|
|
5098
5098
|
*/
|
|
5099
5099
|
top_k?: number;
|
|
5100
5100
|
/**
|
|
5101
|
-
* @deprecated Deprecated. Models released after Puku
|
|
5101
|
+
* @deprecated Deprecated. Models released after Puku AI 2.8 do not support
|
|
5102
5102
|
* setting top_p. A value >= 0.99 will be accepted for backwards compatibility, all
|
|
5103
5103
|
* other values will be rejected with a 400 error.
|
|
5104
5104
|
*/
|
|
@@ -11,16 +11,9 @@ import { BetaToolRunner, } from '../../../lib/tools/BetaToolRunner.js';
|
|
|
11
11
|
import { ToolError } from '../../../lib/tools/ToolError.js';
|
|
12
12
|
import { Batches, } from './batches.js';
|
|
13
13
|
const DEPRECATED_MODELS = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'puku-instant-1.1-100k': 'November 6th, 2024',
|
|
18
|
-
'puku-instant-1.2': 'November 6th, 2024',
|
|
19
|
-
'puku-3-sonnet-20240229': 'July 21st, 2025',
|
|
20
|
-
'puku-3-opus-20240229': 'January 5th, 2026',
|
|
21
|
-
'puku-2.1': 'July 21st, 2025',
|
|
22
|
-
'puku-2.0': 'July 21st, 2025',
|
|
23
|
-
'puku-3-7-sonnet-latest': 'February 19th, 2026',
|
|
14
|
+
// Puku AI exposes `puku-ai-2.7`, `puku-ai-2.8`, and `opus-4.8`. None of
|
|
15
|
+
// these are deprecated at this time — extend this map when (and only
|
|
16
|
+
// when) a model is announced for retirement. Date format: 'Month Dth, YYYY'.
|
|
24
17
|
};
|
|
25
18
|
const MODELS_TO_WARN_WITH_THINKING_ENABLED = [];
|
|
26
19
|
export class Messages extends APIResource {
|
|
@@ -66,7 +59,7 @@ export class Messages extends APIResource {
|
|
|
66
59
|
* @example
|
|
67
60
|
* ```ts
|
|
68
61
|
* const message = await client.beta.messages.parse({
|
|
69
|
-
* model: 'puku-
|
|
62
|
+
* model: 'puku-ai-2.8',
|
|
70
63
|
* max_tokens: 1024,
|
|
71
64
|
* messages: [{ role: 'user', content: 'What is 2+2?' }],
|
|
72
65
|
* output_format: zodOutputFormat(z.object({ answer: z.number() }), 'math'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../../src/vendor/resources/beta/messages/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,UAAU,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EACL,gBAAgB,GAGjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,cAAc,GAGf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAKzD,OAAO,EAOL,OAAO,GAWR,MAAM,WAAW,CAAC;AAEnB,MAAM,iBAAiB,GAEnB;
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../../src/vendor/resources/beta/messages/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,UAAU,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EACL,gBAAgB,GAGjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EA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AAC,aAAa,EAAE,MAAM,EAAE,CAAC;QACjC,MAAM,IAAI,SAAS,CACjB,6DAA6D;YAC3D,qEAAqE,CACxE,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAE1C,OAAO;QACL,GAAG,IAAI;QACP,aAAa,EAAE;YACb,GAAG,MAAM,CAAC,aAAa;YACvB,MAAM,EAAE,aAAa;SACtB;KACG,CAAC;AACT,CAAC;AA8jND,OAAO,EAAE,cAAc,EAA6B,MAAM,mCAAmC,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;AAE3B,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;AACzC,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./messages/index"), exports);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Models = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource");
|
|
6
|
+
const pagination_1 = require("../../core/pagination");
|
|
7
|
+
const headers_1 = require("../../internal/headers");
|
|
8
|
+
const path_1 = require("../../internal/utils/path");
|
|
9
|
+
class Models extends resource_1.APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Get a specific model.
|
|
12
|
+
*
|
|
13
|
+
* The Models API response can be used to determine information about a specific
|
|
14
|
+
* model or resolve a model alias to a model ID.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const betaModelInfo = await client.beta.models.retrieve(
|
|
19
|
+
* 'model_id',
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
retrieve(modelID, params = {}, options) {
|
|
24
|
+
const { betas } = params ?? {};
|
|
25
|
+
return this._client.get((0, path_1.path) `/v1/models/${modelID}?beta=true`, {
|
|
26
|
+
...options,
|
|
27
|
+
headers: (0, headers_1.buildHeaders)([
|
|
28
|
+
{ ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
|
|
29
|
+
options?.headers,
|
|
30
|
+
]),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* List available models.
|
|
35
|
+
*
|
|
36
|
+
* The Models API response can be used to determine which models are available for
|
|
37
|
+
* use in the API. More recently released models are listed first.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* // Automatically fetches more pages as needed.
|
|
42
|
+
* for await (const betaModelInfo of client.beta.models.list()) {
|
|
43
|
+
* // ...
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
list(params = {}, options) {
|
|
48
|
+
const { betas, ...query } = params ?? {};
|
|
49
|
+
return this._client.getAPIList('/v1/models?beta=true', (pagination_1.Page), {
|
|
50
|
+
query,
|
|
51
|
+
...options,
|
|
52
|
+
headers: (0, headers_1.buildHeaders)([
|
|
53
|
+
{ ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
|
|
54
|
+
options?.headers,
|
|
55
|
+
]),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.Models = Models;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.APIKeys = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource");
|
|
6
|
+
const pagination_1 = require("../../../core/pagination");
|
|
7
|
+
const path_1 = require("../../../internal/utils/path");
|
|
8
|
+
class APIKeys extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Get API Key
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const betaAPIKey =
|
|
15
|
+
* await client.beta.organization.apiKeys.retrieve(
|
|
16
|
+
* 'api_key_id',
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
retrieve(apiKeyID, options) {
|
|
21
|
+
return this._client.get((0, path_1.path) `/v1/organizations/api_keys/${apiKeyID}?beta=true`, options);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Update API Key
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const betaAPIKey =
|
|
29
|
+
* await client.beta.organization.apiKeys.update(
|
|
30
|
+
* 'api_key_id',
|
|
31
|
+
* );
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
update(apiKeyID, body, options) {
|
|
35
|
+
return this._client.post((0, path_1.path) `/v1/organizations/api_keys/${apiKeyID}?beta=true`, { body, ...options });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* List API Keys
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* // Automatically fetches more pages as needed.
|
|
43
|
+
* for await (const betaAPIKey of client.beta.organization.apiKeys.list()) {
|
|
44
|
+
* // ...
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
list(query = {}, options) {
|
|
49
|
+
return this._client.getAPIList('/v1/organizations/api_keys?beta=true', (pagination_1.Page), {
|
|
50
|
+
query,
|
|
51
|
+
...options,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.APIKeys = APIKeys;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ComplianceSettings = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource");
|
|
6
|
+
class ComplianceSettings extends resource_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieve your organization's Compliance Settings.
|
|
9
|
+
*
|
|
10
|
+
* Compliance Settings is a singleton resource: there is exactly one per
|
|
11
|
+
* organization, addressed without an identifier. The `state` field reflects
|
|
12
|
+
* whether the Compliance API is enabled. An organization with a parent
|
|
13
|
+
* organization reads the state inherited from the parent's configuration.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const betaComplianceSettings =
|
|
18
|
+
* await client.beta.organization.complianceSettings.retrieve();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
retrieve(options) {
|
|
22
|
+
return this._client.get('/v1/organizations/compliance_settings?beta=true', options);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Update your organization's Compliance Settings.
|
|
26
|
+
*
|
|
27
|
+
* Setting `state` to `enabled` turns on the Compliance API and begins capturing
|
|
28
|
+
* organization activity events. Setting it to `disabled` turns both off. `state`
|
|
29
|
+
* reflects whether the Compliance API is enabled.
|
|
30
|
+
*
|
|
31
|
+
* A request that sets `state` to its current value succeeds and leaves the
|
|
32
|
+
* resource unchanged. A `disabled` request stays in effect until a later `enabled`
|
|
33
|
+
* request or the organization's next provisioning action that enables Access
|
|
34
|
+
* Transparency: enabling Access Transparency also enables the Compliance API,
|
|
35
|
+
* which serves its activity events, so such provisioning (including re-runs)
|
|
36
|
+
* re-enables the Compliance API even after a `disabled` request. Automated
|
|
37
|
+
* provisioning never disables compliance settings.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const betaComplianceSettings =
|
|
42
|
+
* await client.beta.organization.complianceSettings.update({
|
|
43
|
+
* state: { type: 'enabled' },
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
update(body, options) {
|
|
48
|
+
return this._client.post('/v1/organizations/compliance_settings?beta=true', { body, ...options });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.ComplianceSettings = ComplianceSettings;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ExternalKeys = void 0;
|
|
5
|
+
const resource_1 = require("../../../core/resource");
|
|
6
|
+
const pagination_1 = require("../../../core/pagination");
|
|
7
|
+
const path_1 = require("../../../internal/utils/path");
|
|
8
|
+
class ExternalKeys extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Create an external key config owned by the caller's organization.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const betaExternalKey =
|
|
15
|
+
* await client.beta.organization.externalKeys.create({
|
|
16
|
+
* provider_config: {
|
|
17
|
+
* kms_arn:
|
|
18
|
+
* 'arn:aws:kms:us-east-1:111122223333:key/abcd1234-5678-90ab-cdef-000011112222',
|
|
19
|
+
* type: 'aws',
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
create(body, options) {
|
|
25
|
+
return this._client.post('/v1/organizations/external_keys?beta=true', { body, ...options });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve a single external key config in the caller's organization by ID.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const betaExternalKey =
|
|
33
|
+
* await client.beta.organization.externalKeys.retrieve(
|
|
34
|
+
* 'external_key_id',
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
retrieve(externalKeyID, options) {
|
|
39
|
+
return this._client.get((0, path_1.path) `/v1/organizations/external_keys/${externalKeyID}?beta=true`, options);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Partially update an external key config. Omitted fields are left unchanged.
|
|
43
|
+
*
|
|
44
|
+
* `display_name` is always editable. `geo` and `provider_config` cannot be changed
|
|
45
|
+
* once any workspace references this config, because previously encrypted data
|
|
46
|
+
* requires the original key identity to decrypt.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const betaExternalKey =
|
|
51
|
+
* await client.beta.organization.externalKeys.update(
|
|
52
|
+
* 'external_key_id',
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
update(externalKeyID, body, options) {
|
|
57
|
+
return this._client.post((0, path_1.path) `/v1/organizations/external_keys/${externalKeyID}?beta=true`, {
|
|
58
|
+
body,
|
|
59
|
+
...options,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* List external key configs in the caller's organization.
|
|
64
|
+
*
|
|
65
|
+
* Results are ordered by creation time (newest first). Use the `next_page` cursor
|
|
66
|
+
* from the response to fetch subsequent pages.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* // Automatically fetches more pages as needed.
|
|
71
|
+
* for await (const betaExternalKey of client.beta.organization.externalKeys.list()) {
|
|
72
|
+
* // ...
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
list(query = {}, options) {
|
|
77
|
+
return this._client.getAPIList('/v1/organizations/external_keys?beta=true', (pagination_1.PageCursor), {
|
|
78
|
+
query,
|
|
79
|
+
...options,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Delete an external key config.
|
|
84
|
+
*
|
|
85
|
+
* The request is rejected if any workspace still references this config.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const externalKey =
|
|
90
|
+
* await client.beta.organization.externalKeys.delete(
|
|
91
|
+
* 'external_key_id',
|
|
92
|
+
* );
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
delete(externalKeyID, options) {
|
|
96
|
+
return this._client.delete((0, path_1.path) `/v1/organizations/external_keys/${externalKeyID}?beta=true`, options);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Validate an external key config against the customer's KMS.
|
|
100
|
+
*
|
|
101
|
+
* PukuAI performs an encrypt/decrypt roundtrip against the configured KMS key
|
|
102
|
+
* and waits up to 30 seconds for the result. The response status is `success` if
|
|
103
|
+
* the roundtrip succeeded, or `failure` with an error message if it failed or
|
|
104
|
+
* timed out.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const response =
|
|
109
|
+
* await client.beta.organization.externalKeys.validate(
|
|
110
|
+
* 'external_key_id',
|
|
111
|
+
* );
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
validate(externalKeyID, options) {
|
|
115
|
+
return this._client.post((0, path_1.path) `/v1/organizations/external_keys/${externalKeyID}/validate?beta=true`, options);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.ExternalKeys = ExternalKeys;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.Federation = void 0;
|
|
38
|
+
const resource_1 = require("../../../../core/resource");
|
|
39
|
+
const IssuersAPI = __importStar(require("./issuers"));
|
|
40
|
+
const issuers_1 = require("./issuers");
|
|
41
|
+
const RulesAPI = __importStar(require("./rules/rules"));
|
|
42
|
+
const rules_1 = require("./rules/rules");
|
|
43
|
+
class Federation extends resource_1.APIResource {
|
|
44
|
+
issuers = new IssuersAPI.Issuers(this._client);
|
|
45
|
+
rules = new RulesAPI.Rules(this._client);
|
|
46
|
+
}
|
|
47
|
+
exports.Federation = Federation;
|
|
48
|
+
Federation.Issuers = issuers_1.Issuers;
|
|
49
|
+
Federation.Rules = rules_1.Rules;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Rules = exports.Issuers = exports.Federation = void 0;
|
|
5
|
+
var federation_1 = require("./federation");
|
|
6
|
+
Object.defineProperty(exports, "Federation", { enumerable: true, get: function () { return federation_1.Federation; } });
|
|
7
|
+
var issuers_1 = require("./issuers");
|
|
8
|
+
Object.defineProperty(exports, "Issuers", { enumerable: true, get: function () { return issuers_1.Issuers; } });
|
|
9
|
+
var index_1 = require("./rules/index");
|
|
10
|
+
Object.defineProperty(exports, "Rules", { enumerable: true, get: function () { return index_1.Rules; } });
|