@adcp/sdk 15.5.0 → 15.7.0
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 +15 -0
- package/dist/lib/auth/oauth/index.d.mts +1 -0
- package/dist/lib/auth/oauth/index.d.ts +1 -0
- package/dist/lib/auth/oauth/index.js +5 -0
- package/dist/lib/auth/oauth/index.mjs +3 -0
- package/dist/lib/auth/oauth/pending-web-flow.d.mts +16 -0
- package/dist/lib/auth/oauth/pending-web-flow.d.ts +16 -0
- package/dist/lib/auth/oauth/pending-web-flow.js +66 -0
- package/dist/lib/auth/oauth/pending-web-flow.mjs +41 -0
- package/dist/lib/auth/oauth/web-flow.js +3 -3
- package/dist/lib/auth/oauth/web-flow.mjs +3 -3
- package/dist/lib/registry/types.generated.d.mts +63 -1
- package/dist/lib/registry/types.generated.d.ts +63 -1
- package/dist/lib/reporting/azure/index.d.mts +26 -0
- package/dist/lib/reporting/azure/index.d.ts +26 -0
- package/dist/lib/reporting/azure/index.js +247 -0
- package/dist/lib/reporting/azure/index.mjs +230 -0
- package/dist/lib/reporting/bigquery/index.d.mts +127 -0
- package/dist/lib/reporting/bigquery/index.d.ts +127 -0
- package/dist/lib/reporting/bigquery/index.js +379 -0
- package/dist/lib/reporting/bigquery/index.mjs +341 -0
- package/dist/lib/reporting/ledger/handler.js +20 -8
- package/dist/lib/reporting/ledger/handler.mjs +20 -8
- package/dist/lib/reporting/ledger/postgres.d.mts +21 -0
- package/dist/lib/reporting/ledger/postgres.d.ts +21 -0
- package/dist/lib/reporting/ledger/postgres.js +35 -2
- package/dist/lib/reporting/ledger/postgres.mjs +35 -2
- package/dist/lib/reporting/ledger/row-storage-object.js +31 -8
- package/dist/lib/reporting/ledger/row-storage-object.mjs +32 -9
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -7
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -7
- package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -10
- package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -8
- package/dist/lib/reporting/s3/index.d.mts +29 -0
- package/dist/lib/reporting/s3/index.d.ts +29 -0
- package/dist/lib/reporting/s3/index.js +324 -0
- package/dist/lib/reporting/s3/index.mjs +317 -0
- package/dist/lib/reporting/service/index.d.mts +39 -22
- package/dist/lib/reporting/service/index.d.ts +39 -22
- package/dist/lib/reporting/service/index.js +75 -64
- package/dist/lib/reporting/service/index.mjs +79 -63
- package/dist/lib/reporting/service/maintenance.d.mts +91 -0
- package/dist/lib/reporting/service/maintenance.d.ts +91 -0
- package/dist/lib/reporting/service/maintenance.js +140 -0
- package/dist/lib/reporting/service/maintenance.mjs +114 -0
- package/dist/lib/schemas/browser.d.mts +14 -0
- package/dist/lib/schemas/browser.d.ts +14 -0
- package/dist/lib/schemas/browser.js +48 -0
- package/dist/lib/schemas/browser.mjs +20 -0
- package/dist/lib/schemas/index.d.mts +2 -120
- package/dist/lib/schemas/index.d.ts +2 -120
- package/dist/lib/schemas/index.js +3 -11
- package/dist/lib/schemas/index.mjs +1 -9
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/index.d.mts +1 -0
- package/dist/lib/testing/index.d.ts +1 -0
- package/dist/lib/testing/index.js +3 -0
- package/dist/lib/testing/index.mjs +2 -0
- package/dist/lib/testing/pending-web-flow-store.d.mts +20 -0
- package/dist/lib/testing/pending-web-flow-store.d.ts +20 -0
- package/dist/lib/testing/pending-web-flow-store.js +132 -0
- package/dist/lib/testing/pending-web-flow-store.mjs +98 -0
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/validation/get-products-request.d.mts +122 -0
- package/dist/lib/validation/get-products-request.d.ts +122 -0
- package/dist/lib/validation/get-products-request.js +39 -0
- package/dist/lib/validation/get-products-request.mjs +14 -0
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +1 -1
- package/docs/ZOD-SCHEMAS.md +13 -1
- package/docs/guides/OAUTH-ISSUER-BINDING.md +6 -0
- package/docs/guides/REPORTING-LEDGER.md +254 -0
- package/docs/guides/REPORTING-OPERATIONS.md +82 -1
- package/docs/guides/WEB-OAUTH.md +48 -1
- package/docs/llms.txt +1 -1
- package/docs/migration-14.x-rc-worksheet.md +6 -4
- package/package.json +64 -1
package/README.md
CHANGED
|
@@ -57,8 +57,23 @@ Large workspaces should keep the generated schema surface out of the default typ
|
|
|
57
57
|
| Client, server, signing, and response helpers | `@adcp/sdk`, `@adcp/sdk/client`, `@adcp/sdk/server`, or another focused runtime subpath |
|
|
58
58
|
| One tool's request/response types | `@adcp/sdk/types/<tool>` such as `@adcp/sdk/types/sync-accounts` |
|
|
59
59
|
| Runtime Zod schemas and tool schema maps | `@adcp/sdk/schemas` |
|
|
60
|
+
| Runtime Zod schemas in browser UIs | `@adcp/sdk/schemas/browser` |
|
|
60
61
|
| Broad generated protocol type barrel | `@adcp/sdk/types` |
|
|
61
62
|
|
|
63
|
+
Browser widgets and dashboards can validate AdCP objects with the generated Zod schemas:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import {
|
|
67
|
+
EventSourceHealthSchema,
|
|
68
|
+
SyncAudiencesResponseSchema,
|
|
69
|
+
SyncEventSourcesResponseSchema,
|
|
70
|
+
} from '@adcp/sdk/schemas/browser';
|
|
71
|
+
|
|
72
|
+
const health = EventSourceHealthSchema.parse(rawHealth);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The browser entry also exports `GetProductsRequestSchema` and `LegacyGetProductsRequestSchema`, `BiddingPolicySchema`, `CanonicalBudgetAllocationSchema`, and the strict `SyncCreatives*` validators, with the same validation behavior as the Node entry. It has no Node built-ins in its import graph. JSON Schema loading and tool registration helpers remain available from `@adcp/sdk/schemas`. The generated schemas still initialize together, so importing one schema can retain the full generated module in a browser bundle; per-schema tree-shaking is tracked in [#3178](https://github.com/adcontextprotocol/adcp-client/issues/3178).
|
|
76
|
+
|
|
62
77
|
### Focused client runtime (`@adcp/sdk/client/core`)
|
|
63
78
|
|
|
64
79
|
Applications that only call AdCP agents can avoid evaluating the SDK's server,
|
|
@@ -37,6 +37,7 @@ export { DEFAULT_CLIENT_METADATA, OAuthError, OAuthCancelledError, OAuthTimeoutE
|
|
|
37
37
|
export { CLIFlowHandler, type CLIFlowHandlerConfig } from './CLIFlowHandler.mjs';
|
|
38
38
|
export { NonInteractiveFlowHandler, type NonInteractiveFlowHandlerConfig } from './NonInteractiveFlowHandler.mjs';
|
|
39
39
|
export { startWebOAuthFlow, completeWebOAuthFlow, safeReturnTo, InMemoryPendingFlowStore, InvalidOrExpiredFlowError, StateMismatchError, BrowserBindingRequiredError, TokenExchangeError, ProtectedResourceMetadataError, AgentVanishedDuringFlowError, AgentChangedDuringFlowError, ConfidentialClientNotAllowedError, DEFAULT_WEB_FLOW_TTL_MS, type PendingWebFlow, type PendingWebFlowStore, type PendingFlowStore, type StartWebFlowOptions, type StartWebFlowResult, type CompleteWebFlowOptions, type CompleteWebFlowResult, } from './web-flow.mjs';
|
|
40
|
+
export { serializePendingWebFlow, parsePendingWebFlow } from './pending-web-flow.mjs';
|
|
40
41
|
export { MCPOAuthProvider } from './MCPOAuthProvider.mjs';
|
|
41
42
|
import { MCPOAuthProvider } from './MCPOAuthProvider.mjs';
|
|
42
43
|
import type { OAuthClientMetadata, OAuthConfigStorage, AgentConfig } from './types.mjs';
|
|
@@ -37,6 +37,7 @@ export { DEFAULT_CLIENT_METADATA, OAuthError, OAuthCancelledError, OAuthTimeoutE
|
|
|
37
37
|
export { CLIFlowHandler, type CLIFlowHandlerConfig } from './CLIFlowHandler';
|
|
38
38
|
export { NonInteractiveFlowHandler, type NonInteractiveFlowHandlerConfig } from './NonInteractiveFlowHandler';
|
|
39
39
|
export { startWebOAuthFlow, completeWebOAuthFlow, safeReturnTo, InMemoryPendingFlowStore, InvalidOrExpiredFlowError, StateMismatchError, BrowserBindingRequiredError, TokenExchangeError, ProtectedResourceMetadataError, AgentVanishedDuringFlowError, AgentChangedDuringFlowError, ConfidentialClientNotAllowedError, DEFAULT_WEB_FLOW_TTL_MS, type PendingWebFlow, type PendingWebFlowStore, type PendingFlowStore, type StartWebFlowOptions, type StartWebFlowResult, type CompleteWebFlowOptions, type CompleteWebFlowResult, } from './web-flow';
|
|
40
|
+
export { serializePendingWebFlow, parsePendingWebFlow } from './pending-web-flow';
|
|
40
41
|
export { MCPOAuthProvider } from './MCPOAuthProvider';
|
|
41
42
|
import { MCPOAuthProvider } from './MCPOAuthProvider';
|
|
42
43
|
import type { OAuthClientMetadata, OAuthConfigStorage, AgentConfig } from './types';
|
|
@@ -62,11 +62,13 @@ __export(oauth_exports, {
|
|
|
62
62
|
hasValidatedMcpAuthorizationRequirements: () => import_authorization_required.hasValidatedMcpAuthorizationRequirements,
|
|
63
63
|
isEnvSecretReference: () => import_secret_resolver.isEnvSecretReference,
|
|
64
64
|
isOAuthRequired: () => isOAuthRequired,
|
|
65
|
+
parsePendingWebFlow: () => import_pending_web_flow.parsePendingWebFlow,
|
|
65
66
|
parseWWWAuthenticate: () => import_diagnostics.parseWWWAuthenticate,
|
|
66
67
|
probeAuthChallenge: () => import_authorization_required.probeAuthChallenge,
|
|
67
68
|
resolveSecret: () => import_secret_resolver.resolveSecret,
|
|
68
69
|
runAuthDiagnosis: () => import_diagnose.runAuthDiagnosis,
|
|
69
70
|
safeReturnTo: () => import_web_flow.safeReturnTo,
|
|
71
|
+
serializePendingWebFlow: () => import_pending_web_flow.serializePendingWebFlow,
|
|
70
72
|
startWebOAuthFlow: () => import_web_flow.startWebOAuthFlow,
|
|
71
73
|
supportsDynamicRegistration: () => import_discovery.supportsDynamicRegistration,
|
|
72
74
|
supportsOAuth: () => import_discovery.supportsOAuth,
|
|
@@ -81,6 +83,7 @@ var import_types = require('./types.js');
|
|
|
81
83
|
var import_CLIFlowHandler = require('./CLIFlowHandler.js');
|
|
82
84
|
var import_NonInteractiveFlowHandler = require('./NonInteractiveFlowHandler.js');
|
|
83
85
|
var import_web_flow = require('./web-flow.js');
|
|
86
|
+
var import_pending_web_flow = require('./pending-web-flow.js');
|
|
84
87
|
var import_MCPOAuthProvider = require('./MCPOAuthProvider.js');
|
|
85
88
|
var import_MCPOAuthProvider2 = require('./MCPOAuthProvider.js');
|
|
86
89
|
var import_CLIFlowHandler2 = require('./CLIFlowHandler.js');
|
|
@@ -214,11 +217,13 @@ function getEffectiveAuthToken(agent) {
|
|
|
214
217
|
hasValidatedMcpAuthorizationRequirements,
|
|
215
218
|
isEnvSecretReference,
|
|
216
219
|
isOAuthRequired,
|
|
220
|
+
parsePendingWebFlow,
|
|
217
221
|
parseWWWAuthenticate,
|
|
218
222
|
probeAuthChallenge,
|
|
219
223
|
resolveSecret,
|
|
220
224
|
runAuthDiagnosis,
|
|
221
225
|
safeReturnTo,
|
|
226
|
+
serializePendingWebFlow,
|
|
222
227
|
startWebOAuthFlow,
|
|
223
228
|
supportsDynamicRegistration,
|
|
224
229
|
supportsOAuth,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
ConfidentialClientNotAllowedError,
|
|
26
26
|
DEFAULT_WEB_FLOW_TTL_MS
|
|
27
27
|
} from "./web-flow.mjs";
|
|
28
|
+
import { serializePendingWebFlow, parsePendingWebFlow } from "./pending-web-flow.mjs";
|
|
28
29
|
import { MCPOAuthProvider } from "./MCPOAuthProvider.mjs";
|
|
29
30
|
import { MCPOAuthProvider as MCPOAuthProvider2 } from "./MCPOAuthProvider.mjs";
|
|
30
31
|
import { CLIFlowHandler as CLIFlowHandler2 } from "./CLIFlowHandler.mjs";
|
|
@@ -183,11 +184,13 @@ export {
|
|
|
183
184
|
hasValidatedMcpAuthorizationRequirements,
|
|
184
185
|
isEnvSecretReference,
|
|
185
186
|
isOAuthRequired,
|
|
187
|
+
parsePendingWebFlow,
|
|
186
188
|
parseWWWAuthenticate,
|
|
187
189
|
probeAuthChallenge,
|
|
188
190
|
resolveSecret,
|
|
189
191
|
runAuthDiagnosis,
|
|
190
192
|
safeReturnTo,
|
|
193
|
+
serializePendingWebFlow,
|
|
191
194
|
startWebOAuthFlow,
|
|
192
195
|
supportsDynamicRegistration,
|
|
193
196
|
supportsOAuth,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PendingWebFlow } from './web-flow.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Serialize a pending flow for a durable store, preserving unknown fields.
|
|
4
|
+
* Throws for malformed SDK fields or JSON.stringify failures. The payload
|
|
5
|
+
* contains PKCE/client secrets; the store owns encryption, TTL and atomic consume.
|
|
6
|
+
*/
|
|
7
|
+
export declare function serializePendingWebFlow(flow: PendingWebFlow): string;
|
|
8
|
+
/**
|
|
9
|
+
* Validate a JSON string or decoded JSON value (e.g. PostgreSQL jsonb), and revive
|
|
10
|
+
* createdAt/expiresAt as Dates. Unknown fields (including client metadata)
|
|
11
|
+
* pass through unchanged. Malformed input
|
|
12
|
+
* returns null. Expiry and issuer trust are enforced by the store/callback,
|
|
13
|
+
* not by this parser; legacy rows without a frozen issuer remain parseable.
|
|
14
|
+
* The store must also bind the parsed state to the key it consumed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parsePendingWebFlow(json: unknown): PendingWebFlow | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PendingWebFlow } from './web-flow';
|
|
2
|
+
/**
|
|
3
|
+
* Serialize a pending flow for a durable store, preserving unknown fields.
|
|
4
|
+
* Throws for malformed SDK fields or JSON.stringify failures. The payload
|
|
5
|
+
* contains PKCE/client secrets; the store owns encryption, TTL and atomic consume.
|
|
6
|
+
*/
|
|
7
|
+
export declare function serializePendingWebFlow(flow: PendingWebFlow): string;
|
|
8
|
+
/**
|
|
9
|
+
* Validate a JSON string or decoded JSON value (e.g. PostgreSQL jsonb), and revive
|
|
10
|
+
* createdAt/expiresAt as Dates. Unknown fields (including client metadata)
|
|
11
|
+
* pass through unchanged. Malformed input
|
|
12
|
+
* returns null. Expiry and issuer trust are enforced by the store/callback,
|
|
13
|
+
* not by this parser; legacy rows without a frozen issuer remain parseable.
|
|
14
|
+
* The store must also bind the parsed state to the key it consumed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parsePendingWebFlow(json: unknown): PendingWebFlow | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var pending_web_flow_exports = {};
|
|
20
|
+
__export(pending_web_flow_exports, {
|
|
21
|
+
parsePendingWebFlow: () => parsePendingWebFlow,
|
|
22
|
+
serializePendingWebFlow: () => serializePendingWebFlow
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(pending_web_flow_exports);
|
|
25
|
+
var import_auth = require("@modelcontextprotocol/sdk/shared/auth.js");
|
|
26
|
+
var import_zod = require("zod");
|
|
27
|
+
const persistedDate = import_zod.z.iso.datetime({ offset: true }).transform((value) => new Date(value)).pipe(import_zod.z.date());
|
|
28
|
+
const pendingWebFlowShape = {
|
|
29
|
+
state: import_zod.z.string(),
|
|
30
|
+
agentId: import_zod.z.string(),
|
|
31
|
+
agentUrl: import_zod.z.string(),
|
|
32
|
+
codeVerifier: import_zod.z.string(),
|
|
33
|
+
redirectUri: import_zod.z.string(),
|
|
34
|
+
resource: import_zod.z.string().optional(),
|
|
35
|
+
resourceOverride: import_zod.z.string().optional(),
|
|
36
|
+
resourceOverrideAction: import_zod.z.enum(["set", "clear"]).optional(),
|
|
37
|
+
resourceOverrideSnapshot: import_zod.z.string().nullable().optional(),
|
|
38
|
+
scope: import_zod.z.string().optional(),
|
|
39
|
+
authorizationServerUrl: import_zod.z.string(),
|
|
40
|
+
authorizationServerIssuer: import_zod.z.string().optional(),
|
|
41
|
+
// The MCP schema strips extensions and catches invalid issuer values. Stored
|
|
42
|
+
// credentials must retain extensions and reject a malformed issuer instead.
|
|
43
|
+
clientInformation: import_auth.OAuthClientInformationSchema.extend({ issuer: import_zod.z.string().optional() }).loose(),
|
|
44
|
+
createdAt: persistedDate,
|
|
45
|
+
expiresAt: persistedDate,
|
|
46
|
+
carry: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
|
|
47
|
+
};
|
|
48
|
+
const persistedPendingWebFlowSchema = import_zod.z.looseObject(pendingWebFlowShape);
|
|
49
|
+
function serializePendingWebFlow(flow) {
|
|
50
|
+
const json = JSON.stringify(flow);
|
|
51
|
+
if (!parsePendingWebFlow(json)) throw new TypeError("Invalid PendingWebFlow payload");
|
|
52
|
+
return json;
|
|
53
|
+
}
|
|
54
|
+
function parsePendingWebFlow(json) {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = persistedPendingWebFlowSchema.safeParse(typeof json === "string" ? JSON.parse(json) : json);
|
|
57
|
+
return parsed.success ? parsed.data : null;
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
parsePendingWebFlow,
|
|
65
|
+
serializePendingWebFlow
|
|
66
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { OAuthClientInformationSchema } from "@modelcontextprotocol/sdk/shared/auth.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const persistedDate = z.iso.datetime({ offset: true }).transform((value) => new Date(value)).pipe(z.date());
|
|
4
|
+
const pendingWebFlowShape = {
|
|
5
|
+
state: z.string(),
|
|
6
|
+
agentId: z.string(),
|
|
7
|
+
agentUrl: z.string(),
|
|
8
|
+
codeVerifier: z.string(),
|
|
9
|
+
redirectUri: z.string(),
|
|
10
|
+
resource: z.string().optional(),
|
|
11
|
+
resourceOverride: z.string().optional(),
|
|
12
|
+
resourceOverrideAction: z.enum(["set", "clear"]).optional(),
|
|
13
|
+
resourceOverrideSnapshot: z.string().nullable().optional(),
|
|
14
|
+
scope: z.string().optional(),
|
|
15
|
+
authorizationServerUrl: z.string(),
|
|
16
|
+
authorizationServerIssuer: z.string().optional(),
|
|
17
|
+
// The MCP schema strips extensions and catches invalid issuer values. Stored
|
|
18
|
+
// credentials must retain extensions and reject a malformed issuer instead.
|
|
19
|
+
clientInformation: OAuthClientInformationSchema.extend({ issuer: z.string().optional() }).loose(),
|
|
20
|
+
createdAt: persistedDate,
|
|
21
|
+
expiresAt: persistedDate,
|
|
22
|
+
carry: z.record(z.string(), z.unknown()).optional()
|
|
23
|
+
};
|
|
24
|
+
const persistedPendingWebFlowSchema = z.looseObject(pendingWebFlowShape);
|
|
25
|
+
function serializePendingWebFlow(flow) {
|
|
26
|
+
const json = JSON.stringify(flow);
|
|
27
|
+
if (!parsePendingWebFlow(json)) throw new TypeError("Invalid PendingWebFlow payload");
|
|
28
|
+
return json;
|
|
29
|
+
}
|
|
30
|
+
function parsePendingWebFlow(json) {
|
|
31
|
+
try {
|
|
32
|
+
const parsed = persistedPendingWebFlowSchema.safeParse(typeof json === "string" ? JSON.parse(json) : json);
|
|
33
|
+
return parsed.success ? parsed.data : null;
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
parsePendingWebFlow,
|
|
40
|
+
serializePendingWebFlow
|
|
41
|
+
};
|
|
@@ -223,7 +223,7 @@ async function completeWebOAuthFlow(opts) {
|
|
|
223
223
|
throw new StateMismatchError();
|
|
224
224
|
}
|
|
225
225
|
const flow = await pendingFlowStore.consume(state);
|
|
226
|
-
if (!flow || flow.expiresAt.getTime()
|
|
226
|
+
if (!flow || flow.expiresAt.getTime() <= Date.now()) {
|
|
227
227
|
throw new InvalidOrExpiredFlowError(state);
|
|
228
228
|
}
|
|
229
229
|
const guardedFetch = createSsrfSafeOAuthFetch(fetchFn, allowHttp);
|
|
@@ -345,14 +345,14 @@ class InMemoryPendingFlowStore {
|
|
|
345
345
|
const flow = this.flows.get(state);
|
|
346
346
|
if (!flow) return null;
|
|
347
347
|
this.flows.delete(state);
|
|
348
|
-
if (flow.expiresAt.getTime()
|
|
348
|
+
if (flow.expiresAt.getTime() <= Date.now()) return null;
|
|
349
349
|
return flow;
|
|
350
350
|
}
|
|
351
351
|
async cleanupExpired() {
|
|
352
352
|
const now = Date.now();
|
|
353
353
|
let removed = 0;
|
|
354
354
|
for (const [state, flow] of this.flows) {
|
|
355
|
-
if (flow.expiresAt.getTime()
|
|
355
|
+
if (flow.expiresAt.getTime() <= now) {
|
|
356
356
|
this.flows.delete(state);
|
|
357
357
|
removed++;
|
|
358
358
|
}
|
|
@@ -202,7 +202,7 @@ async function completeWebOAuthFlow(opts) {
|
|
|
202
202
|
throw new StateMismatchError();
|
|
203
203
|
}
|
|
204
204
|
const flow = await pendingFlowStore.consume(state);
|
|
205
|
-
if (!flow || flow.expiresAt.getTime()
|
|
205
|
+
if (!flow || flow.expiresAt.getTime() <= Date.now()) {
|
|
206
206
|
throw new InvalidOrExpiredFlowError(state);
|
|
207
207
|
}
|
|
208
208
|
const guardedFetch = createSsrfSafeOAuthFetch(fetchFn, allowHttp);
|
|
@@ -324,14 +324,14 @@ class InMemoryPendingFlowStore {
|
|
|
324
324
|
const flow = this.flows.get(state);
|
|
325
325
|
if (!flow) return null;
|
|
326
326
|
this.flows.delete(state);
|
|
327
|
-
if (flow.expiresAt.getTime()
|
|
327
|
+
if (flow.expiresAt.getTime() <= Date.now()) return null;
|
|
328
328
|
return flow;
|
|
329
329
|
}
|
|
330
330
|
async cleanupExpired() {
|
|
331
331
|
const now = Date.now();
|
|
332
332
|
let removed = 0;
|
|
333
333
|
for (const [state, flow] of this.flows) {
|
|
334
|
-
if (flow.expiresAt.getTime()
|
|
334
|
+
if (flow.expiresAt.getTime() <= now) {
|
|
335
335
|
this.flows.delete(state);
|
|
336
336
|
removed++;
|
|
337
337
|
}
|
|
@@ -1825,7 +1825,11 @@ export interface paths {
|
|
|
1825
1825
|
*/
|
|
1826
1826
|
put: operations["connectAgent"];
|
|
1827
1827
|
post?: never;
|
|
1828
|
-
|
|
1828
|
+
/**
|
|
1829
|
+
* Clear saved bearer or basic credentials
|
|
1830
|
+
* @description Clear the selected organization's static credential while retaining OAuth configuration and compliance history. Requires authentication and ownership.
|
|
1831
|
+
*/
|
|
1832
|
+
delete: operations["removeAgentAuthToken"];
|
|
1829
1833
|
options?: never;
|
|
1830
1834
|
head?: never;
|
|
1831
1835
|
patch?: never;
|
|
@@ -10662,6 +10666,64 @@ export interface operations {
|
|
|
10662
10666
|
};
|
|
10663
10667
|
};
|
|
10664
10668
|
};
|
|
10669
|
+
removeAgentAuthToken: {
|
|
10670
|
+
parameters: {
|
|
10671
|
+
query?: {
|
|
10672
|
+
org?: string;
|
|
10673
|
+
};
|
|
10674
|
+
header?: never;
|
|
10675
|
+
path: {
|
|
10676
|
+
encodedUrl: string;
|
|
10677
|
+
};
|
|
10678
|
+
cookie?: never;
|
|
10679
|
+
};
|
|
10680
|
+
requestBody?: never;
|
|
10681
|
+
responses: {
|
|
10682
|
+
/** @description Static credential cleared */
|
|
10683
|
+
204: {
|
|
10684
|
+
headers: {
|
|
10685
|
+
[name: string]: unknown;
|
|
10686
|
+
};
|
|
10687
|
+
content?: never;
|
|
10688
|
+
};
|
|
10689
|
+
/** @description Invalid parameters */
|
|
10690
|
+
400: {
|
|
10691
|
+
headers: {
|
|
10692
|
+
[name: string]: unknown;
|
|
10693
|
+
};
|
|
10694
|
+
content: {
|
|
10695
|
+
"application/json": components["schemas"]["Error"];
|
|
10696
|
+
};
|
|
10697
|
+
};
|
|
10698
|
+
/** @description Authentication required */
|
|
10699
|
+
401: {
|
|
10700
|
+
headers: {
|
|
10701
|
+
[name: string]: unknown;
|
|
10702
|
+
};
|
|
10703
|
+
content: {
|
|
10704
|
+
"application/json": components["schemas"]["Error"];
|
|
10705
|
+
};
|
|
10706
|
+
};
|
|
10707
|
+
/** @description Not authorized */
|
|
10708
|
+
403: {
|
|
10709
|
+
headers: {
|
|
10710
|
+
[name: string]: unknown;
|
|
10711
|
+
};
|
|
10712
|
+
content: {
|
|
10713
|
+
"application/json": components["schemas"]["Error"];
|
|
10714
|
+
};
|
|
10715
|
+
};
|
|
10716
|
+
/** @description Server error */
|
|
10717
|
+
500: {
|
|
10718
|
+
headers: {
|
|
10719
|
+
[name: string]: unknown;
|
|
10720
|
+
};
|
|
10721
|
+
content: {
|
|
10722
|
+
"application/json": components["schemas"]["Error"];
|
|
10723
|
+
};
|
|
10724
|
+
};
|
|
10725
|
+
};
|
|
10726
|
+
};
|
|
10665
10727
|
saveAgentOAuthClientCredentials: {
|
|
10666
10728
|
parameters: {
|
|
10667
10729
|
query?: never;
|
|
@@ -1825,7 +1825,11 @@ export interface paths {
|
|
|
1825
1825
|
*/
|
|
1826
1826
|
put: operations["connectAgent"];
|
|
1827
1827
|
post?: never;
|
|
1828
|
-
|
|
1828
|
+
/**
|
|
1829
|
+
* Clear saved bearer or basic credentials
|
|
1830
|
+
* @description Clear the selected organization's static credential while retaining OAuth configuration and compliance history. Requires authentication and ownership.
|
|
1831
|
+
*/
|
|
1832
|
+
delete: operations["removeAgentAuthToken"];
|
|
1829
1833
|
options?: never;
|
|
1830
1834
|
head?: never;
|
|
1831
1835
|
patch?: never;
|
|
@@ -10662,6 +10666,64 @@ export interface operations {
|
|
|
10662
10666
|
};
|
|
10663
10667
|
};
|
|
10664
10668
|
};
|
|
10669
|
+
removeAgentAuthToken: {
|
|
10670
|
+
parameters: {
|
|
10671
|
+
query?: {
|
|
10672
|
+
org?: string;
|
|
10673
|
+
};
|
|
10674
|
+
header?: never;
|
|
10675
|
+
path: {
|
|
10676
|
+
encodedUrl: string;
|
|
10677
|
+
};
|
|
10678
|
+
cookie?: never;
|
|
10679
|
+
};
|
|
10680
|
+
requestBody?: never;
|
|
10681
|
+
responses: {
|
|
10682
|
+
/** @description Static credential cleared */
|
|
10683
|
+
204: {
|
|
10684
|
+
headers: {
|
|
10685
|
+
[name: string]: unknown;
|
|
10686
|
+
};
|
|
10687
|
+
content?: never;
|
|
10688
|
+
};
|
|
10689
|
+
/** @description Invalid parameters */
|
|
10690
|
+
400: {
|
|
10691
|
+
headers: {
|
|
10692
|
+
[name: string]: unknown;
|
|
10693
|
+
};
|
|
10694
|
+
content: {
|
|
10695
|
+
"application/json": components["schemas"]["Error"];
|
|
10696
|
+
};
|
|
10697
|
+
};
|
|
10698
|
+
/** @description Authentication required */
|
|
10699
|
+
401: {
|
|
10700
|
+
headers: {
|
|
10701
|
+
[name: string]: unknown;
|
|
10702
|
+
};
|
|
10703
|
+
content: {
|
|
10704
|
+
"application/json": components["schemas"]["Error"];
|
|
10705
|
+
};
|
|
10706
|
+
};
|
|
10707
|
+
/** @description Not authorized */
|
|
10708
|
+
403: {
|
|
10709
|
+
headers: {
|
|
10710
|
+
[name: string]: unknown;
|
|
10711
|
+
};
|
|
10712
|
+
content: {
|
|
10713
|
+
"application/json": components["schemas"]["Error"];
|
|
10714
|
+
};
|
|
10715
|
+
};
|
|
10716
|
+
/** @description Server error */
|
|
10717
|
+
500: {
|
|
10718
|
+
headers: {
|
|
10719
|
+
[name: string]: unknown;
|
|
10720
|
+
};
|
|
10721
|
+
content: {
|
|
10722
|
+
"application/json": components["schemas"]["Error"];
|
|
10723
|
+
};
|
|
10724
|
+
};
|
|
10725
|
+
};
|
|
10726
|
+
};
|
|
10665
10727
|
saveAgentOAuthClientCredentials: {
|
|
10666
10728
|
parameters: {
|
|
10667
10729
|
query?: never;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BlobServiceClient } from '@azure/storage-blob';
|
|
2
|
+
import type { ReportingRowObjectProviderV1 } from '../ledger/row-storage-object.mjs';
|
|
3
|
+
export interface CreateAzureBlobReportingRowObjectProviderOptionsV1 {
|
|
4
|
+
/** Official client used by bindings without a `credentialRef`. */
|
|
5
|
+
client?: BlobServiceClient;
|
|
6
|
+
/**
|
|
7
|
+
* Official clients keyed by `credentialRef`. This map is the closed set of
|
|
8
|
+
* references a binding may name; an unknown reference fails `UNSAFE_BINDING`.
|
|
9
|
+
* Endpoint and credentials come only from these clients.
|
|
10
|
+
*/
|
|
11
|
+
clients?: Readonly<Record<string, BlobServiceClient>>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Azure Blob Storage row-object provider (`@adcp/sdk/reporting/azure`).
|
|
15
|
+
*
|
|
16
|
+
* Inject official `BlobServiceClient`s with host-owned credentials (managed
|
|
17
|
+
* identity, workload identity). Bindings use `location: { account, container }`;
|
|
18
|
+
* the selected client must belong to `account`. Writes are block-blob uploads
|
|
19
|
+
* with `If-None-Match: *`. Blob versioning must be enabled on the storage account:
|
|
20
|
+
* the recorded native version is the write-unique `versionId` and pins every read
|
|
21
|
+
* and delete, so a delayed delete can never remove a later write that re-created
|
|
22
|
+
* identical bytes at the same key (ETags are content-derived and cannot fence that).
|
|
23
|
+
* The probe refuses accounts without versioning and proves create-only behaviour
|
|
24
|
+
* empirically.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createAzureBlobReportingRowObjectProviderV1(options: CreateAzureBlobReportingRowObjectProviderOptionsV1): ReportingRowObjectProviderV1;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BlobServiceClient } from '@azure/storage-blob';
|
|
2
|
+
import type { ReportingRowObjectProviderV1 } from '../ledger/row-storage-object';
|
|
3
|
+
export interface CreateAzureBlobReportingRowObjectProviderOptionsV1 {
|
|
4
|
+
/** Official client used by bindings without a `credentialRef`. */
|
|
5
|
+
client?: BlobServiceClient;
|
|
6
|
+
/**
|
|
7
|
+
* Official clients keyed by `credentialRef`. This map is the closed set of
|
|
8
|
+
* references a binding may name; an unknown reference fails `UNSAFE_BINDING`.
|
|
9
|
+
* Endpoint and credentials come only from these clients.
|
|
10
|
+
*/
|
|
11
|
+
clients?: Readonly<Record<string, BlobServiceClient>>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Azure Blob Storage row-object provider (`@adcp/sdk/reporting/azure`).
|
|
15
|
+
*
|
|
16
|
+
* Inject official `BlobServiceClient`s with host-owned credentials (managed
|
|
17
|
+
* identity, workload identity). Bindings use `location: { account, container }`;
|
|
18
|
+
* the selected client must belong to `account`. Writes are block-blob uploads
|
|
19
|
+
* with `If-None-Match: *`. Blob versioning must be enabled on the storage account:
|
|
20
|
+
* the recorded native version is the write-unique `versionId` and pins every read
|
|
21
|
+
* and delete, so a delayed delete can never remove a later write that re-created
|
|
22
|
+
* identical bytes at the same key (ETags are content-derived and cannot fence that).
|
|
23
|
+
* The probe refuses accounts without versioning and proves create-only behaviour
|
|
24
|
+
* empirically.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createAzureBlobReportingRowObjectProviderV1(options: CreateAzureBlobReportingRowObjectProviderOptionsV1): ReportingRowObjectProviderV1;
|