@introspection-sdk/introspection-node 0.5.9 → 0.6.1
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/.turbo/turbo-build.log +1 -1
- package/dist/auth.d.ts +4 -4
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +5 -5
- package/dist/auth.js.map +1 -1
- package/dist/client.d.ts +5 -5
- package/dist/client.js +5 -5
- package/package.json +5 -5
- package/src/auth.ts +7 -7
- package/src/client.ts +5 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @introspection-sdk/introspection-node@0.
|
|
2
|
+
> @introspection-sdk/introspection-node@0.6.1 build /home/runner/work/introspection-js-sdk/introspection-js-sdk/packages/introspection-node
|
|
3
3
|
> tsc
|
|
4
4
|
|
package/dist/auth.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface ServiceAccountTokenParams {
|
|
|
29
29
|
* grant — the minted token is project-scoped and the project must belong to
|
|
30
30
|
* the Application's organization.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
project: string;
|
|
33
33
|
/**
|
|
34
34
|
* Optional space-separated scope. Capped server-side to the Application's
|
|
35
35
|
* `allowed_scopes`; omit to receive the Application's default scope.
|
|
@@ -57,7 +57,7 @@ export type ServiceAccountToken = OAuthToken;
|
|
|
57
57
|
* const { access_token, dp_url } = await serviceAccountToken({
|
|
58
58
|
* clientId: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_ID!,
|
|
59
59
|
* clientSecret: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_SECRET!,
|
|
60
|
-
*
|
|
60
|
+
* project: process.env.INTRO_PROJECT!,
|
|
61
61
|
* });
|
|
62
62
|
* const client = new IntrospectionClient({ token: access_token });
|
|
63
63
|
* ```
|
|
@@ -92,7 +92,7 @@ export interface TokenExchangeParams {
|
|
|
92
92
|
/** The federated Application's `client_id` (public client — no secret). */
|
|
93
93
|
clientId: string;
|
|
94
94
|
/** Project the minted DP token is scoped to. */
|
|
95
|
-
|
|
95
|
+
project: string;
|
|
96
96
|
/**
|
|
97
97
|
* The subject token's type URI. Defaults to
|
|
98
98
|
* `urn:ietf:params:oauth:token-type:id_token`.
|
|
@@ -119,7 +119,7 @@ export interface TokenExchangeParams {
|
|
|
119
119
|
* const { access_token, dp_url } = await tokenExchange({
|
|
120
120
|
* subjectToken: idTokenFromPartnerIdp,
|
|
121
121
|
* clientId: process.env.FEDERATED_CLIENT_ID!,
|
|
122
|
-
*
|
|
122
|
+
* project: process.env.INTRO_PROJECT!,
|
|
123
123
|
* });
|
|
124
124
|
* ```
|
|
125
125
|
*/
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAyDA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAyDA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,UAAU,EAAE,MA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AAC,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAcrB"}
|
package/dist/auth.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* straight into the existing client surface — pass it to
|
|
12
12
|
* {@link IntrospectionClient}, or use
|
|
13
13
|
* {@link IntrospectionClient.fromServiceAccount} to mint and construct in one
|
|
14
|
-
* call, and the usual `client.runtimes("
|
|
14
|
+
* call, and the usual `client.runtimes("runtime-slug").run()` flow works unchanged.
|
|
15
15
|
*/
|
|
16
16
|
import { stripTrailingSlash, toApiError } from "@introspection-sdk/http";
|
|
17
17
|
const DEFAULT_BASE_API_URL = "https://api.introspection.dev";
|
|
@@ -51,7 +51,7 @@ async function postTokenForm(baseApiUrl, form, fetchImpl) {
|
|
|
51
51
|
* const { access_token, dp_url } = await serviceAccountToken({
|
|
52
52
|
* clientId: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_ID!,
|
|
53
53
|
* clientSecret: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_SECRET!,
|
|
54
|
-
*
|
|
54
|
+
* project: process.env.INTRO_PROJECT!,
|
|
55
55
|
* });
|
|
56
56
|
* const client = new IntrospectionClient({ token: access_token });
|
|
57
57
|
* ```
|
|
@@ -61,7 +61,7 @@ export async function serviceAccountToken(params) {
|
|
|
61
61
|
grant_type: GRANT_TYPE_CLIENT_CREDENTIALS,
|
|
62
62
|
client_id: params.clientId,
|
|
63
63
|
client_secret: params.clientSecret,
|
|
64
|
-
|
|
64
|
+
project: params.project,
|
|
65
65
|
});
|
|
66
66
|
if (params.scope)
|
|
67
67
|
form.set("scope", params.scope);
|
|
@@ -93,7 +93,7 @@ export async function authorizationCodeToken(params) {
|
|
|
93
93
|
* const { access_token, dp_url } = await tokenExchange({
|
|
94
94
|
* subjectToken: idTokenFromPartnerIdp,
|
|
95
95
|
* clientId: process.env.FEDERATED_CLIENT_ID!,
|
|
96
|
-
*
|
|
96
|
+
* project: process.env.INTRO_PROJECT!,
|
|
97
97
|
* });
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
@@ -103,7 +103,7 @@ export async function tokenExchange(params) {
|
|
|
103
103
|
subject_token: params.subjectToken,
|
|
104
104
|
subject_token_type: params.subjectTokenType ?? SUBJECT_TOKEN_TYPE_ID_TOKEN,
|
|
105
105
|
client_id: params.clientId,
|
|
106
|
-
|
|
106
|
+
project: params.project,
|
|
107
107
|
});
|
|
108
108
|
if (params.scope)
|
|
109
109
|
form.set("scope", params.scope);
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAEzE,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAC7D,MAAM,6BAA6B,GAAG,oBAAoB,CAAC;AAC3D,MAAM,yBAAyB,GAC7B,iDAAiD,CAAC;AACpD,MAAM,6BAA6B,GAAG,oBAAoB,CAAC;AAC3D,MAAM,2BAA2B,GAAG,2CAA2C,CAAC;AAEhF,SAAS,iBAAiB,CAAC,UAAmB;IAC5C,OAAO,kBAAkB,CACvB,UAAU;QACR,OAAO,CAAC,GAAG,CAAC,0BAA0B;QACtC,oBAAoB,CACvB,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,MAAqB;IACzC,MAAM,SAAS,GAAG,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC;IAC7C,IAAI,CAAC,SAAS,E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AAK,CAAC,CAC3B,CAAC;AACJ,CAAC;AAoBD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAA+B;IAE/B,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC;QAC/B,UAAU,EAAE,6BAA6B;QACzC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,YAAY,EAAE,MAAM,CAAC,WAAW;QAChC,aAAa,EAAE,MAAM,CAAC,YAAY;KACnC,CAAC,CAAC;IACH,OAAO,aAAa,CAClB,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,EACpC,IAAI,EACJ,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAC3B,CAAC;AACJ,CAAC;AAyBD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA2B;IAE3B,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC;QAC/B,UAAU,EAAE,yBAAyB;QACrC,aAAa,EAAE,MAAM,CAAC,YAAY;QAClC,kBAAkB,EAAE,MAAM,CAAC,gBAAgB,IAAI,2BAA2B;QAC1E,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,KAAK;QAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAClD,OAAO,aAAa,CAClB,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,EACpC,IAAI,EACJ,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Introspection REST Client for Node.js
|
|
3
3
|
*
|
|
4
4
|
* Exposes the Control Plane REST surface for managing runtimes and
|
|
5
|
-
* experiments. Calling `client.runtimes(
|
|
5
|
+
* experiments. Calling `client.runtimes(slug).run()` or
|
|
6
6
|
* `client.experiments(id).run()` returns a {@link Runner} bound to a Data
|
|
7
7
|
* Plane sandbox.
|
|
8
8
|
*
|
|
@@ -44,9 +44,9 @@ export declare class IntrospectionClient {
|
|
|
44
44
|
/** @internal — passed through to Runner so it can build its own DP HTTP client. */
|
|
45
45
|
readonly advancedOptions: AdvancedOptions;
|
|
46
46
|
/**
|
|
47
|
-
* CRUD on `/v1/runtimes` and the `(
|
|
47
|
+
* CRUD on `/v1/runtimes` and the `(idOrSlug) => RuntimeHandle` factory.
|
|
48
48
|
* Call as `client.runtimes("customer-agent").run()`. The project is taken
|
|
49
|
-
* from the API key server-side; pass `
|
|
49
|
+
* from the API key server-side; pass `project` to a CRUD helper only to
|
|
50
50
|
* override it per call.
|
|
51
51
|
*/
|
|
52
52
|
readonly runtimes: RuntimesApi & RuntimeHandleFactory;
|
|
@@ -75,10 +75,10 @@ export declare class IntrospectionClient {
|
|
|
75
75
|
* const client = await IntrospectionClient.fromServiceAccount({
|
|
76
76
|
* clientId: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_ID!,
|
|
77
77
|
* clientSecret: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_SECRET!,
|
|
78
|
-
*
|
|
78
|
+
* project: process.env.INTRO_PROJECT!,
|
|
79
79
|
* });
|
|
80
80
|
*
|
|
81
|
-
* // Resolved fresh from the runtime
|
|
81
|
+
* // Resolved fresh from the runtime slug on every call.
|
|
82
82
|
* const runner = await client.runtimes("customer-agent").run({
|
|
83
83
|
* identity: { user_id: "u_demo" },
|
|
84
84
|
* });
|
package/dist/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Introspection REST Client for Node.js
|
|
3
3
|
*
|
|
4
4
|
* Exposes the Control Plane REST surface for managing runtimes and
|
|
5
|
-
* experiments. Calling `client.runtimes(
|
|
5
|
+
* experiments. Calling `client.runtimes(slug).run()` or
|
|
6
6
|
* `client.experiments(id).run()` returns a {@link Runner} bound to a Data
|
|
7
7
|
* Plane sandbox.
|
|
8
8
|
*
|
|
@@ -43,9 +43,9 @@ export class IntrospectionClient {
|
|
|
43
43
|
/** @internal — passed through to Runner so it can build its own DP HTTP client. */
|
|
44
44
|
advancedOptions;
|
|
45
45
|
/**
|
|
46
|
-
* CRUD on `/v1/runtimes` and the `(
|
|
46
|
+
* CRUD on `/v1/runtimes` and the `(idOrSlug) => RuntimeHandle` factory.
|
|
47
47
|
* Call as `client.runtimes("customer-agent").run()`. The project is taken
|
|
48
|
-
* from the API key server-side; pass `
|
|
48
|
+
* from the API key server-side; pass `project` to a CRUD helper only to
|
|
49
49
|
* override it per call.
|
|
50
50
|
*/
|
|
51
51
|
runtimes;
|
|
@@ -97,10 +97,10 @@ export class IntrospectionClient {
|
|
|
97
97
|
* const client = await IntrospectionClient.fromServiceAccount({
|
|
98
98
|
* clientId: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_ID!,
|
|
99
99
|
* clientSecret: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_SECRET!,
|
|
100
|
-
*
|
|
100
|
+
* project: process.env.INTRO_PROJECT!,
|
|
101
101
|
* });
|
|
102
102
|
*
|
|
103
|
-
* // Resolved fresh from the runtime
|
|
103
|
+
* // Resolved fresh from the runtime slug on every call.
|
|
104
104
|
* const runner = await client.runtimes("customer-agent").run({
|
|
105
105
|
* identity: { user_id: "u_demo" },
|
|
106
106
|
* });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@introspection-sdk/introspection-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Introspection observability SDK for Node.js",
|
|
6
6
|
"engines": {
|
|
@@ -139,10 +139,10 @@
|
|
|
139
139
|
"@opentelemetry/api": "^1.9.1",
|
|
140
140
|
"https-proxy-agent": "^7.0.6",
|
|
141
141
|
"proxy-from-env": "^2.1.0",
|
|
142
|
-
"@introspection-sdk/types": "0.
|
|
143
|
-
"@introspection-sdk/
|
|
144
|
-
"@introspection-sdk/introspection-proxy": "0.
|
|
145
|
-
"@introspection-sdk/
|
|
142
|
+
"@introspection-sdk/types": "0.6.1",
|
|
143
|
+
"@introspection-sdk/http": "0.6.1",
|
|
144
|
+
"@introspection-sdk/introspection-proxy": "0.6.1",
|
|
145
|
+
"@introspection-sdk/introspection-pi": "0.6.1"
|
|
146
146
|
},
|
|
147
147
|
"scripts": {
|
|
148
148
|
"lint": "eslint . --max-warnings 0",
|
package/src/auth.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* straight into the existing client surface — pass it to
|
|
12
12
|
* {@link IntrospectionClient}, or use
|
|
13
13
|
* {@link IntrospectionClient.fromServiceAccount} to mint and construct in one
|
|
14
|
-
* call, and the usual `client.runtimes("
|
|
14
|
+
* call, and the usual `client.runtimes("runtime-slug").run()` flow works unchanged.
|
|
15
15
|
*/
|
|
16
16
|
import { stripTrailingSlash, toApiError } from "@introspection-sdk/http";
|
|
17
17
|
|
|
@@ -87,7 +87,7 @@ export interface ServiceAccountTokenParams {
|
|
|
87
87
|
* grant — the minted token is project-scoped and the project must belong to
|
|
88
88
|
* the Application's organization.
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
project: string;
|
|
91
91
|
/**
|
|
92
92
|
* Optional space-separated scope. Capped server-side to the Application's
|
|
93
93
|
* `allowed_scopes`; omit to receive the Application's default scope.
|
|
@@ -117,7 +117,7 @@ export type ServiceAccountToken = OAuthToken;
|
|
|
117
117
|
* const { access_token, dp_url } = await serviceAccountToken({
|
|
118
118
|
* clientId: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_ID!,
|
|
119
119
|
* clientSecret: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_SECRET!,
|
|
120
|
-
*
|
|
120
|
+
* project: process.env.INTRO_PROJECT!,
|
|
121
121
|
* });
|
|
122
122
|
* const client = new IntrospectionClient({ token: access_token });
|
|
123
123
|
* ```
|
|
@@ -129,7 +129,7 @@ export async function serviceAccountToken(
|
|
|
129
129
|
grant_type: GRANT_TYPE_CLIENT_CREDENTIALS,
|
|
130
130
|
client_id: params.clientId,
|
|
131
131
|
client_secret: params.clientSecret,
|
|
132
|
-
|
|
132
|
+
project: params.project,
|
|
133
133
|
});
|
|
134
134
|
if (params.scope) form.set("scope", params.scope);
|
|
135
135
|
return postTokenForm(
|
|
@@ -185,7 +185,7 @@ export interface TokenExchangeParams {
|
|
|
185
185
|
/** The federated Application's `client_id` (public client — no secret). */
|
|
186
186
|
clientId: string;
|
|
187
187
|
/** Project the minted DP token is scoped to. */
|
|
188
|
-
|
|
188
|
+
project: string;
|
|
189
189
|
/**
|
|
190
190
|
* The subject token's type URI. Defaults to
|
|
191
191
|
* `urn:ietf:params:oauth:token-type:id_token`.
|
|
@@ -213,7 +213,7 @@ export interface TokenExchangeParams {
|
|
|
213
213
|
* const { access_token, dp_url } = await tokenExchange({
|
|
214
214
|
* subjectToken: idTokenFromPartnerIdp,
|
|
215
215
|
* clientId: process.env.FEDERATED_CLIENT_ID!,
|
|
216
|
-
*
|
|
216
|
+
* project: process.env.INTRO_PROJECT!,
|
|
217
217
|
* });
|
|
218
218
|
* ```
|
|
219
219
|
*/
|
|
@@ -225,7 +225,7 @@ export async function tokenExchange(
|
|
|
225
225
|
subject_token: params.subjectToken,
|
|
226
226
|
subject_token_type: params.subjectTokenType ?? SUBJECT_TOKEN_TYPE_ID_TOKEN,
|
|
227
227
|
client_id: params.clientId,
|
|
228
|
-
|
|
228
|
+
project: params.project,
|
|
229
229
|
});
|
|
230
230
|
if (params.scope) form.set("scope", params.scope);
|
|
231
231
|
return postTokenForm(
|
package/src/client.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Introspection REST Client for Node.js
|
|
3
3
|
*
|
|
4
4
|
* Exposes the Control Plane REST surface for managing runtimes and
|
|
5
|
-
* experiments. Calling `client.runtimes(
|
|
5
|
+
* experiments. Calling `client.runtimes(slug).run()` or
|
|
6
6
|
* `client.experiments(id).run()` returns a {@link Runner} bound to a Data
|
|
7
7
|
* Plane sandbox.
|
|
8
8
|
*
|
|
@@ -56,9 +56,9 @@ export class IntrospectionClient {
|
|
|
56
56
|
readonly advancedOptions: AdvancedOptions;
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* CRUD on `/v1/runtimes` and the `(
|
|
59
|
+
* CRUD on `/v1/runtimes` and the `(idOrSlug) => RuntimeHandle` factory.
|
|
60
60
|
* Call as `client.runtimes("customer-agent").run()`. The project is taken
|
|
61
|
-
* from the API key server-side; pass `
|
|
61
|
+
* from the API key server-side; pass `project` to a CRUD helper only to
|
|
62
62
|
* override it per call.
|
|
63
63
|
*/
|
|
64
64
|
readonly runtimes: RuntimesApi & RuntimeHandleFactory;
|
|
@@ -121,10 +121,10 @@ export class IntrospectionClient {
|
|
|
121
121
|
* const client = await IntrospectionClient.fromServiceAccount({
|
|
122
122
|
* clientId: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_ID!,
|
|
123
123
|
* clientSecret: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_SECRET!,
|
|
124
|
-
*
|
|
124
|
+
* project: process.env.INTRO_PROJECT!,
|
|
125
125
|
* });
|
|
126
126
|
*
|
|
127
|
-
* // Resolved fresh from the runtime
|
|
127
|
+
* // Resolved fresh from the runtime slug on every call.
|
|
128
128
|
* const runner = await client.runtimes("customer-agent").run({
|
|
129
129
|
* identity: { user_id: "u_demo" },
|
|
130
130
|
* });
|