@adcp/client 4.20.0 → 4.22.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/AGENTS.md +278 -0
- package/README.md +96 -61
- package/bin/adcp.js +342 -4
- package/dist/lib/agents/index.generated.d.ts +9 -1
- package/dist/lib/agents/index.generated.d.ts.map +1 -1
- package/dist/lib/agents/index.generated.js +12 -0
- package/dist/lib/agents/index.generated.js.map +1 -1
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts +2 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +10 -1
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/discovery/property-crawler.d.ts +4 -0
- package/dist/lib/discovery/property-crawler.d.ts.map +1 -1
- package/dist/lib/discovery/property-crawler.js +10 -2
- package/dist/lib/discovery/property-crawler.js.map +1 -1
- package/dist/lib/index.d.ts +9 -9
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +13 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +8 -6
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +24 -11
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/registry/cursor-store.d.ts +19 -0
- package/dist/lib/registry/cursor-store.d.ts.map +1 -0
- package/dist/lib/registry/cursor-store.js +44 -0
- package/dist/lib/registry/cursor-store.js.map +1 -0
- package/dist/lib/registry/index.d.ts +21 -3
- package/dist/lib/registry/index.d.ts.map +1 -1
- package/dist/lib/registry/index.js +94 -1
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/property-registry.d.ts +57 -0
- package/dist/lib/registry/property-registry.d.ts.map +1 -0
- package/dist/lib/registry/property-registry.js +92 -0
- package/dist/lib/registry/property-registry.js.map +1 -0
- package/dist/lib/registry/sync.d.ts +4 -0
- package/dist/lib/registry/sync.d.ts.map +1 -1
- package/dist/lib/registry/sync.js +14 -0
- package/dist/lib/registry/sync.js.map +1 -1
- package/dist/lib/registry/types.d.ts +35 -2
- package/dist/lib/registry/types.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.d.ts +349 -321
- package/dist/lib/registry/types.generated.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.js +1 -1
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +3 -1
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/serve.d.ts +45 -0
- package/dist/lib/server/serve.d.ts.map +1 -0
- package/dist/lib/server/serve.js +86 -0
- package/dist/lib/server/serve.js.map +1 -0
- package/dist/lib/testing/agent-tester.d.ts +1 -1
- package/dist/lib/testing/agent-tester.d.ts.map +1 -1
- package/dist/lib/testing/agent-tester.js +10 -1
- package/dist/lib/testing/agent-tester.js.map +1 -1
- package/dist/lib/testing/client.d.ts.map +1 -1
- package/dist/lib/testing/client.js +3 -0
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +158 -203
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/storyboard-tracks.d.ts +24 -0
- package/dist/lib/testing/compliance/storyboard-tracks.d.ts.map +1 -0
- package/dist/lib/testing/compliance/storyboard-tracks.js +157 -0
- package/dist/lib/testing/compliance/storyboard-tracks.js.map +1 -0
- package/dist/lib/testing/compliance/types.d.ts +1 -1
- package/dist/lib/testing/compliance/types.d.ts.map +1 -1
- package/dist/lib/testing/index.d.ts +2 -1
- package/dist/lib/testing/index.d.ts.map +1 -1
- package/dist/lib/testing/index.js +26 -1
- package/dist/lib/testing/index.js.map +1 -1
- package/dist/lib/testing/orchestrator.d.ts +8 -0
- package/dist/lib/testing/orchestrator.d.ts.map +1 -1
- package/dist/lib/testing/orchestrator.js +11 -0
- package/dist/lib/testing/orchestrator.js.map +1 -1
- package/dist/lib/testing/scenarios/brand-rights.d.ts +23 -0
- package/dist/lib/testing/scenarios/brand-rights.d.ts.map +1 -0
- package/dist/lib/testing/scenarios/brand-rights.js +144 -0
- package/dist/lib/testing/scenarios/brand-rights.js.map +1 -0
- package/dist/lib/testing/scenarios/capabilities.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/capabilities.js +11 -2
- package/dist/lib/testing/scenarios/capabilities.js.map +1 -1
- package/dist/lib/testing/scenarios/governance.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/governance.js +5 -0
- package/dist/lib/testing/scenarios/governance.js.map +1 -1
- package/dist/lib/testing/scenarios/index.d.ts +2 -0
- package/dist/lib/testing/scenarios/index.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/index.js +10 -2
- package/dist/lib/testing/scenarios/index.js.map +1 -1
- package/dist/lib/testing/scenarios/media-buy.d.ts.map +1 -1
- package/dist/lib/testing/scenarios/media-buy.js +22 -3
- package/dist/lib/testing/scenarios/media-buy.js.map +1 -1
- package/dist/lib/testing/scenarios/trusted-match.d.ts +22 -0
- package/dist/lib/testing/scenarios/trusted-match.d.ts.map +1 -0
- package/dist/lib/testing/scenarios/trusted-match.js +128 -0
- package/dist/lib/testing/scenarios/trusted-match.js.map +1 -0
- package/dist/lib/testing/storyboard/context.d.ts +34 -0
- package/dist/lib/testing/storyboard/context.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/context.js +257 -0
- package/dist/lib/testing/storyboard/context.js.map +1 -0
- package/dist/lib/testing/storyboard/index.d.ts +15 -0
- package/dist/lib/testing/storyboard/index.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/index.js +48 -0
- package/dist/lib/testing/storyboard/index.js.map +1 -0
- package/dist/lib/testing/storyboard/loader.d.ts +53 -0
- package/dist/lib/testing/storyboard/loader.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/loader.js +114 -0
- package/dist/lib/testing/storyboard/loader.js.map +1 -0
- package/dist/lib/testing/storyboard/path.d.ts +29 -0
- package/dist/lib/testing/storyboard/path.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/path.js +121 -0
- package/dist/lib/testing/storyboard/path.js.map +1 -0
- package/dist/lib/testing/storyboard/request-builder.d.ts +28 -0
- package/dist/lib/testing/storyboard/request-builder.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/request-builder.js +410 -0
- package/dist/lib/testing/storyboard/request-builder.js.map +1 -0
- package/dist/lib/testing/storyboard/runner.d.ts +24 -0
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/runner.js +280 -0
- package/dist/lib/testing/storyboard/runner.js.map +1 -0
- package/dist/lib/testing/storyboard/task-map.d.ts +21 -0
- package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/task-map.js +84 -0
- package/dist/lib/testing/storyboard/task-map.js.map +1 -0
- package/dist/lib/testing/storyboard/types.d.ts +156 -0
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/types.js +10 -0
- package/dist/lib/testing/storyboard/types.js.map +1 -0
- package/dist/lib/testing/storyboard/validations.d.ts +17 -0
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/validations.js +166 -0
- package/dist/lib/testing/storyboard/validations.js.map +1 -0
- package/dist/lib/testing/types.d.ts +4 -1
- package/dist/lib/testing/types.d.ts.map +1 -1
- package/dist/lib/types/core.generated.d.ts +36 -23
- package/dist/lib/types/core.generated.d.ts.map +1 -1
- package/dist/lib/types/core.generated.js +1 -1
- package/dist/lib/types/schemas.generated.d.ts +1098 -770
- package/dist/lib/types/schemas.generated.d.ts.map +1 -1
- package/dist/lib/types/schemas.generated.js +163 -76
- package/dist/lib/types/schemas.generated.js.map +1 -1
- package/dist/lib/types/tools.generated.d.ts +314 -24
- package/dist/lib/types/tools.generated.d.ts.map +1 -1
- package/dist/lib/utils/capabilities.d.ts +4 -1
- package/dist/lib/utils/capabilities.d.ts.map +1 -1
- package/dist/lib/utils/capabilities.js +25 -1
- package/dist/lib/utils/capabilities.js.map +1 -1
- package/dist/lib/utils/response-schemas.d.ts.map +1 -1
- package/dist/lib/utils/response-schemas.js +34 -3
- package/dist/lib/utils/response-schemas.js.map +1 -1
- package/dist/lib/utils/validate-user-agent.d.ts +8 -0
- package/dist/lib/utils/validate-user-agent.d.ts.map +1 -0
- package/dist/lib/utils/validate-user-agent.js +15 -0
- package/dist/lib/utils/validate-user-agent.js.map +1 -0
- package/dist/lib/version.d.ts +9 -3
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +10 -4
- package/dist/lib/version.js.map +1 -1
- package/docs/README.md +42 -0
- package/docs/guides/BUILD-AN-AGENT.md +292 -0
- package/docs/llms.txt +634 -0
- package/examples/README.md +106 -0
- package/examples/adcp.config.json +30 -0
- package/examples/basic-a2a.ts +76 -0
- package/examples/basic-mcp.ts +50 -0
- package/examples/batch-preview-test.ts +266 -0
- package/examples/conversation-client.ts +291 -0
- package/examples/debug-preview-response.ts +73 -0
- package/examples/debug-preview-with-logging.ts +50 -0
- package/examples/easy-config-demo.ts +242 -0
- package/examples/env-config.ts +51 -0
- package/examples/error-compliant-server.ts +237 -0
- package/examples/generative-creative-demo.ts +205 -0
- package/examples/inspect-card-formats.ts +161 -0
- package/examples/logger-usage.ts +165 -0
- package/examples/oauth-cli-example.ts +154 -0
- package/examples/pr78-async-patterns-demo.ts +247 -0
- package/examples/signals-agent.ts +162 -0
- package/examples/simple-getting-started.ts +225 -0
- package/examples/simple-protocol-demo.ts +75 -0
- package/examples/test-helpers-demo.ts +239 -0
- package/examples/zod-validation-example.ts +126 -0
- package/package.json +12 -2
- package/skills/adcp/SKILL.md +13 -2
- package/storyboards/audience_sync.yaml +199 -0
- package/storyboards/behavioral_analysis.yaml +244 -0
- package/storyboards/brand_rights.yaml +131 -0
- package/storyboards/creative_ad_server.yaml +171 -0
- package/storyboards/creative_sales_agent.yaml +169 -0
- package/storyboards/creative_template.yaml +306 -0
- package/storyboards/deterministic_testing.yaml +925 -0
- package/storyboards/error_compliance.yaml +231 -0
- package/storyboards/governance_content_standards.yaml +213 -0
- package/storyboards/governance_property_lists.yaml +372 -0
- package/storyboards/media_buy_catalog_creative.yaml +457 -0
- package/storyboards/media_buy_governance_escalation.yaml +467 -0
- package/storyboards/media_buy_guaranteed_approval.yaml +396 -0
- package/storyboards/media_buy_non_guaranteed.yaml +288 -0
- package/storyboards/media_buy_proposal_mode.yaml +369 -0
- package/storyboards/media_buy_seller.yaml +560 -0
- package/storyboards/media_buy_state_machine.yaml +254 -0
- package/storyboards/schema.yaml +65 -0
- package/storyboards/schema_validation.yaml +166 -0
- package/storyboards/si_session.yaml +384 -0
- package/storyboards/signal_marketplace.yaml +283 -0
- package/storyboards/signal_owned.yaml +211 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Context propagation for storyboard steps.
|
|
4
|
+
*
|
|
5
|
+
* After each successful step, known IDs and references are extracted
|
|
6
|
+
* from the response and accumulated in a StoryboardContext. Before
|
|
7
|
+
* executing a step, context values are injected into the request via
|
|
8
|
+
* "$context.<key>" placeholders.
|
|
9
|
+
*
|
|
10
|
+
* This convention-based approach avoids requiring YAML enrichment
|
|
11
|
+
* (context_outputs/context_inputs) while still enabling stateful flows.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.setPath = void 0;
|
|
15
|
+
exports.extractContext = extractContext;
|
|
16
|
+
exports.injectContext = injectContext;
|
|
17
|
+
exports.applyContextOutputs = applyContextOutputs;
|
|
18
|
+
exports.applyContextInputs = applyContextInputs;
|
|
19
|
+
const path_1 = require("./path");
|
|
20
|
+
const CONTEXT_EXTRACTORS = {
|
|
21
|
+
sync_accounts(data) {
|
|
22
|
+
const d = data;
|
|
23
|
+
const accounts = d?.accounts;
|
|
24
|
+
if (!accounts?.[0])
|
|
25
|
+
return {};
|
|
26
|
+
const first = accounts[0];
|
|
27
|
+
const extracted = {};
|
|
28
|
+
if (first.account_id)
|
|
29
|
+
extracted.account_id = first.account_id;
|
|
30
|
+
if (first.status)
|
|
31
|
+
extracted.account_status = first.status;
|
|
32
|
+
// Build an account reference for downstream steps
|
|
33
|
+
extracted.account = {
|
|
34
|
+
brand: first.brand,
|
|
35
|
+
operator: first.operator,
|
|
36
|
+
};
|
|
37
|
+
return extracted;
|
|
38
|
+
},
|
|
39
|
+
list_accounts(data) {
|
|
40
|
+
const d = data;
|
|
41
|
+
const accounts = d?.accounts;
|
|
42
|
+
if (!accounts?.[0])
|
|
43
|
+
return {};
|
|
44
|
+
return { account_id: accounts[0].account_id };
|
|
45
|
+
},
|
|
46
|
+
get_products(data) {
|
|
47
|
+
const d = data;
|
|
48
|
+
const products = d?.products;
|
|
49
|
+
if (!products?.[0])
|
|
50
|
+
return {};
|
|
51
|
+
const extracted = { products };
|
|
52
|
+
if (products[0].product_id)
|
|
53
|
+
extracted.product_id = products[0].product_id;
|
|
54
|
+
// Extract proposal_id if proposals are returned
|
|
55
|
+
const proposals = d?.proposals;
|
|
56
|
+
if (proposals?.[0]?.proposal_id)
|
|
57
|
+
extracted.proposal_id = proposals[0].proposal_id;
|
|
58
|
+
return extracted;
|
|
59
|
+
},
|
|
60
|
+
create_media_buy(data) {
|
|
61
|
+
const d = data;
|
|
62
|
+
const extracted = {};
|
|
63
|
+
if (d?.media_buy_id)
|
|
64
|
+
extracted.media_buy_id = d.media_buy_id;
|
|
65
|
+
if (d?.status)
|
|
66
|
+
extracted.media_buy_status = d.status;
|
|
67
|
+
return extracted;
|
|
68
|
+
},
|
|
69
|
+
update_media_buy(data) {
|
|
70
|
+
const d = data;
|
|
71
|
+
const extracted = {};
|
|
72
|
+
if (d?.media_buy_id)
|
|
73
|
+
extracted.media_buy_id = d.media_buy_id;
|
|
74
|
+
if (d?.status)
|
|
75
|
+
extracted.media_buy_status = d.status;
|
|
76
|
+
return extracted;
|
|
77
|
+
},
|
|
78
|
+
get_media_buys(data) {
|
|
79
|
+
const d = data;
|
|
80
|
+
const buys = d?.media_buys;
|
|
81
|
+
if (!buys?.[0])
|
|
82
|
+
return {};
|
|
83
|
+
return {
|
|
84
|
+
media_buy_id: buys[0].media_buy_id,
|
|
85
|
+
media_buy_status: buys[0].status,
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
list_creative_formats(data) {
|
|
89
|
+
const d = data;
|
|
90
|
+
const formats = d?.formats;
|
|
91
|
+
if (!formats?.[0])
|
|
92
|
+
return {};
|
|
93
|
+
return {
|
|
94
|
+
formats,
|
|
95
|
+
format_id: formats[0].format_id,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
build_creative(data) {
|
|
99
|
+
const d = data;
|
|
100
|
+
const extracted = {};
|
|
101
|
+
if (d?.creative_id)
|
|
102
|
+
extracted.creative_id = d.creative_id;
|
|
103
|
+
const creatives = d?.creatives;
|
|
104
|
+
if (creatives?.[0]?.creative_id)
|
|
105
|
+
extracted.creative_id = creatives[0].creative_id;
|
|
106
|
+
return extracted;
|
|
107
|
+
},
|
|
108
|
+
sync_creatives(data) {
|
|
109
|
+
const d = data;
|
|
110
|
+
const results = d?.results;
|
|
111
|
+
if (!results?.length)
|
|
112
|
+
return {};
|
|
113
|
+
return { creative_results: results };
|
|
114
|
+
},
|
|
115
|
+
preview_creative(data) {
|
|
116
|
+
const d = data;
|
|
117
|
+
const previews = d?.previews;
|
|
118
|
+
if (!previews?.length)
|
|
119
|
+
return {};
|
|
120
|
+
return { previews };
|
|
121
|
+
},
|
|
122
|
+
get_signals(data) {
|
|
123
|
+
const d = data;
|
|
124
|
+
const signals = d?.signals;
|
|
125
|
+
if (!signals?.[0])
|
|
126
|
+
return {};
|
|
127
|
+
return {
|
|
128
|
+
signals,
|
|
129
|
+
signal_id: signals[0].signal_id,
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
activate_signal(data) {
|
|
133
|
+
const d = data;
|
|
134
|
+
const extracted = {};
|
|
135
|
+
if (d?.activation_id)
|
|
136
|
+
extracted.activation_id = d.activation_id;
|
|
137
|
+
return extracted;
|
|
138
|
+
},
|
|
139
|
+
si_initiate_session(data) {
|
|
140
|
+
const d = data;
|
|
141
|
+
const extracted = {};
|
|
142
|
+
if (d?.session_id)
|
|
143
|
+
extracted.session_id = d.session_id;
|
|
144
|
+
return extracted;
|
|
145
|
+
},
|
|
146
|
+
si_get_offering(data) {
|
|
147
|
+
const d = data;
|
|
148
|
+
const extracted = {};
|
|
149
|
+
if (d?.offering_id)
|
|
150
|
+
extracted.offering_id = d.offering_id;
|
|
151
|
+
const offerings = d?.offerings;
|
|
152
|
+
if (offerings?.[0]?.offering_id)
|
|
153
|
+
extracted.offering_id = offerings[0].offering_id;
|
|
154
|
+
return extracted;
|
|
155
|
+
},
|
|
156
|
+
sync_plans(data) {
|
|
157
|
+
const d = data;
|
|
158
|
+
const plans = d?.plans;
|
|
159
|
+
if (!plans?.[0])
|
|
160
|
+
return {};
|
|
161
|
+
return { plan_id: plans[0].plan_id };
|
|
162
|
+
},
|
|
163
|
+
create_property_list(data) {
|
|
164
|
+
const d = data;
|
|
165
|
+
const extracted = {};
|
|
166
|
+
if (d?.property_list_id)
|
|
167
|
+
extracted.property_list_id = d.property_list_id;
|
|
168
|
+
return extracted;
|
|
169
|
+
},
|
|
170
|
+
sync_governance(data) {
|
|
171
|
+
// Governance registration — no IDs to extract, just confirmation
|
|
172
|
+
return { governance_synced: true, governance_response: data };
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Extract context values from a task response.
|
|
177
|
+
*/
|
|
178
|
+
function extractContext(taskName, data) {
|
|
179
|
+
const extractor = CONTEXT_EXTRACTORS[taskName];
|
|
180
|
+
if (!extractor)
|
|
181
|
+
return {};
|
|
182
|
+
try {
|
|
183
|
+
return extractor(data);
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return {};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// ────────────────────────────────────────────────────────────
|
|
190
|
+
// Context injection: substitute $context.<key> in requests
|
|
191
|
+
// ────────────────────────────────────────────────────────────
|
|
192
|
+
/**
|
|
193
|
+
* Deep-walk an object and replace "$context.<key>" string values
|
|
194
|
+
* with the corresponding value from context.
|
|
195
|
+
*
|
|
196
|
+
* Returns a new object (does not mutate the input).
|
|
197
|
+
*/
|
|
198
|
+
function injectContext(obj, context) {
|
|
199
|
+
return deepReplace(obj, context);
|
|
200
|
+
}
|
|
201
|
+
function deepReplace(value, context) {
|
|
202
|
+
if (typeof value === 'string') {
|
|
203
|
+
const match = value.match(/^\$context\.(\w+)$/);
|
|
204
|
+
if (match?.[1]) {
|
|
205
|
+
const key = match[1];
|
|
206
|
+
return key in context ? context[key] : value;
|
|
207
|
+
}
|
|
208
|
+
return value;
|
|
209
|
+
}
|
|
210
|
+
if (Array.isArray(value)) {
|
|
211
|
+
return value.map(item => deepReplace(item, context));
|
|
212
|
+
}
|
|
213
|
+
if (value !== null && typeof value === 'object') {
|
|
214
|
+
const result = {};
|
|
215
|
+
for (const [k, v] of Object.entries(value)) {
|
|
216
|
+
result[k] = deepReplace(v, context);
|
|
217
|
+
}
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
return value;
|
|
221
|
+
}
|
|
222
|
+
// ────────────────────────────────────────────────────────────
|
|
223
|
+
// Explicit context_outputs: extract values by path
|
|
224
|
+
// ────────────────────────────────────────────────────────────
|
|
225
|
+
/**
|
|
226
|
+
* Apply explicit context_outputs rules to extract values from response data.
|
|
227
|
+
*/
|
|
228
|
+
function applyContextOutputs(data, outputs) {
|
|
229
|
+
const result = {};
|
|
230
|
+
for (const output of outputs) {
|
|
231
|
+
const value = (0, path_1.resolvePath)(data, output.path);
|
|
232
|
+
if (value !== undefined && value !== null) {
|
|
233
|
+
result[output.key] = value;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
238
|
+
// ────────────────────────────────────────────────────────────
|
|
239
|
+
// Explicit context_inputs: inject values into request by path
|
|
240
|
+
// ────────────────────────────────────────────────────────────
|
|
241
|
+
/**
|
|
242
|
+
* Apply explicit context_inputs rules to inject context values into a request.
|
|
243
|
+
* Returns a new object (does not mutate the input).
|
|
244
|
+
*/
|
|
245
|
+
function applyContextInputs(request, inputs, context) {
|
|
246
|
+
const result = structuredClone(request);
|
|
247
|
+
for (const input of inputs) {
|
|
248
|
+
if (input.key in context) {
|
|
249
|
+
(0, path_1.setPath)(result, input.inject_at, context[input.key]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
// setPath is re-exported from ./path for backwards compat
|
|
255
|
+
var path_2 = require("./path");
|
|
256
|
+
Object.defineProperty(exports, "setPath", { enumerable: true, get: function () { return path_2.setPath; } });
|
|
257
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAkKH,wCAQC;AAYD,sCAEC;AAkCD,kDASC;AAUD,gDAYC;AAtPD,iCAA8C;AAQ9C,MAAM,kBAAkB,GAAqC;IAC3D,aAAa,CAAC,IAAI;QAChB,MAAM,CAAC,GAAG,IAA2C,CAAC;QACtD,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAsD,CAAC;QAC3E,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAAE,OAAO,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,SAAS,GAA4B,EAAE,CAAC;QAC9C,IAAI,KAAK,CAAC,UAAU;YAAE,SAAS,CAAC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FAAA,OAAO,OAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storyboard-driven testing for AdCP agents.
|
|
3
|
+
*
|
|
4
|
+
* Storyboards are YAML-defined workflows that map directly to
|
|
5
|
+
* SingleAgentClient methods, enabling step-by-step agent testing.
|
|
6
|
+
*/
|
|
7
|
+
export type { Storyboard, StoryboardPhase, StoryboardStep, StoryboardValidation, ContextOutput, ContextInput, StoryboardContext, StoryboardRunOptions, ValidationResult, StoryboardStepPreview, StoryboardStepResult, StoryboardPhaseResult, StoryboardResult, } from './types';
|
|
8
|
+
export { runStoryboard, runStoryboardStep, getFirstStepPreview } from './runner';
|
|
9
|
+
export { parseStoryboard, loadStoryboardFile, loadBundledStoryboards, getStoryboardById, getStoryboardsForPlatformType, getComplianceStoryboards, getComplianceStoryboardsForTrack, getApplicableComplianceStoryboards, listStoryboards, } from './loader';
|
|
10
|
+
export { TASK_TO_METHOD, executeStoryboardTask } from './task-map';
|
|
11
|
+
export { parsePath, resolvePath, setPath } from './path';
|
|
12
|
+
export { extractContext, injectContext, applyContextOutputs, applyContextInputs } from './context';
|
|
13
|
+
export { buildRequest, hasRequestBuilder } from './request-builder';
|
|
14
|
+
export { runValidations } from './validations';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGjF,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,6BAA6B,EAC7B,wBAAwB,EACxB,gCAAgC,EAChC,kCAAkC,EAClC,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGnG,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Storyboard-driven testing for AdCP agents.
|
|
4
|
+
*
|
|
5
|
+
* Storyboards are YAML-defined workflows that map directly to
|
|
6
|
+
* SingleAgentClient methods, enabling step-by-step agent testing.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.runValidations = exports.hasRequestBuilder = exports.buildRequest = exports.applyContextInputs = exports.applyContextOutputs = exports.injectContext = exports.extractContext = exports.setPath = exports.resolvePath = exports.parsePath = exports.executeStoryboardTask = exports.TASK_TO_METHOD = exports.listStoryboards = exports.getApplicableComplianceStoryboards = exports.getComplianceStoryboardsForTrack = exports.getComplianceStoryboards = exports.getStoryboardsForPlatformType = exports.getStoryboardById = exports.loadBundledStoryboards = exports.loadStoryboardFile = exports.parseStoryboard = exports.getFirstStepPreview = exports.runStoryboardStep = exports.runStoryboard = void 0;
|
|
10
|
+
// Runner
|
|
11
|
+
var runner_1 = require("./runner");
|
|
12
|
+
Object.defineProperty(exports, "runStoryboard", { enumerable: true, get: function () { return runner_1.runStoryboard; } });
|
|
13
|
+
Object.defineProperty(exports, "runStoryboardStep", { enumerable: true, get: function () { return runner_1.runStoryboardStep; } });
|
|
14
|
+
Object.defineProperty(exports, "getFirstStepPreview", { enumerable: true, get: function () { return runner_1.getFirstStepPreview; } });
|
|
15
|
+
// Loader
|
|
16
|
+
var loader_1 = require("./loader");
|
|
17
|
+
Object.defineProperty(exports, "parseStoryboard", { enumerable: true, get: function () { return loader_1.parseStoryboard; } });
|
|
18
|
+
Object.defineProperty(exports, "loadStoryboardFile", { enumerable: true, get: function () { return loader_1.loadStoryboardFile; } });
|
|
19
|
+
Object.defineProperty(exports, "loadBundledStoryboards", { enumerable: true, get: function () { return loader_1.loadBundledStoryboards; } });
|
|
20
|
+
Object.defineProperty(exports, "getStoryboardById", { enumerable: true, get: function () { return loader_1.getStoryboardById; } });
|
|
21
|
+
Object.defineProperty(exports, "getStoryboardsForPlatformType", { enumerable: true, get: function () { return loader_1.getStoryboardsForPlatformType; } });
|
|
22
|
+
Object.defineProperty(exports, "getComplianceStoryboards", { enumerable: true, get: function () { return loader_1.getComplianceStoryboards; } });
|
|
23
|
+
Object.defineProperty(exports, "getComplianceStoryboardsForTrack", { enumerable: true, get: function () { return loader_1.getComplianceStoryboardsForTrack; } });
|
|
24
|
+
Object.defineProperty(exports, "getApplicableComplianceStoryboards", { enumerable: true, get: function () { return loader_1.getApplicableComplianceStoryboards; } });
|
|
25
|
+
Object.defineProperty(exports, "listStoryboards", { enumerable: true, get: function () { return loader_1.listStoryboards; } });
|
|
26
|
+
// Task mapping
|
|
27
|
+
var task_map_1 = require("./task-map");
|
|
28
|
+
Object.defineProperty(exports, "TASK_TO_METHOD", { enumerable: true, get: function () { return task_map_1.TASK_TO_METHOD; } });
|
|
29
|
+
Object.defineProperty(exports, "executeStoryboardTask", { enumerable: true, get: function () { return task_map_1.executeStoryboardTask; } });
|
|
30
|
+
// Path utilities
|
|
31
|
+
var path_1 = require("./path");
|
|
32
|
+
Object.defineProperty(exports, "parsePath", { enumerable: true, get: function () { return path_1.parsePath; } });
|
|
33
|
+
Object.defineProperty(exports, "resolvePath", { enumerable: true, get: function () { return path_1.resolvePath; } });
|
|
34
|
+
Object.defineProperty(exports, "setPath", { enumerable: true, get: function () { return path_1.setPath; } });
|
|
35
|
+
// Context
|
|
36
|
+
var context_1 = require("./context");
|
|
37
|
+
Object.defineProperty(exports, "extractContext", { enumerable: true, get: function () { return context_1.extractContext; } });
|
|
38
|
+
Object.defineProperty(exports, "injectContext", { enumerable: true, get: function () { return context_1.injectContext; } });
|
|
39
|
+
Object.defineProperty(exports, "applyContextOutputs", { enumerable: true, get: function () { return context_1.applyContextOutputs; } });
|
|
40
|
+
Object.defineProperty(exports, "applyContextInputs", { enumerable: true, get: function () { return context_1.applyContextInputs; } });
|
|
41
|
+
// Request builder
|
|
42
|
+
var request_builder_1 = require("./request-builder");
|
|
43
|
+
Object.defineProperty(exports, "buildRequest", { enumerable: true, get: function () { return request_builder_1.buildRequest; } });
|
|
44
|
+
Object.defineProperty(exports, "hasRequestBuilder", { enumerable: true, get: function () { return request_builder_1.hasRequestBuilder; } });
|
|
45
|
+
// Validations
|
|
46
|
+
var validations_1 = require("./validations");
|
|
47
|
+
Object.defineProperty(exports, "runValidations", { enumerable: true, get: function () { return validations_1.runValidations; } });
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAmBH,SAAS;AACT,mCAAiF;AAAxE,uGAAA,aAAa,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAE9D,SAAS;AACT,mCAUkB;AAThB,yGAAA,eAAe,OAAA;AACf,4GAAA,kBAAkB,OAAA;AAClB,gHAAA,sBAAsB,OAAA;AACtB,2GAAA,iBAAiB,OAAA;AACjB,uHAAA,6BAA6B,OAAA;AAC7B,kHAAA,wBAAwB,OAAA;AACxB,0HAAA,gCAAgC,OAAA;AAChC,4HAAA,kCAAkC,OAAA;AAClC,yGAAA,eAAe,OAAA;AAGjB,eAAe;AACf,uCAAmE;AAA1D,0GAAA,cAAc,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AAE9C,iBAAiB;AACjB,+BAAyD;AAAhD,iGAAA,SAAS,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,+FAAA,OAAO,OAAA;AAExC,UAAU;AACV,qCAAmG;AAA1F,yGAAA,cAAc,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAE/E,kBAAkB;AAClB,qDAAoE;AAA3D,+GAAA,YAAY,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAExC,cAAc;AACd,6CAA+C;AAAtC,6GAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storyboard YAML loader.
|
|
3
|
+
*
|
|
4
|
+
* Parses storyboard YAML files into typed Storyboard objects.
|
|
5
|
+
* Bundled storyboards ship with the package in the storyboards/ directory.
|
|
6
|
+
*/
|
|
7
|
+
import type { Storyboard } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Parse a YAML string into a Storyboard.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseStoryboard(yamlContent: string): Storyboard;
|
|
12
|
+
/**
|
|
13
|
+
* Load a storyboard from a file path.
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadStoryboardFile(filePath: string): Storyboard;
|
|
16
|
+
/**
|
|
17
|
+
* Load all bundled storyboards from the storyboards/ directory.
|
|
18
|
+
* Results are cached after the first call.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadBundledStoryboards(): Storyboard[];
|
|
21
|
+
/**
|
|
22
|
+
* Get a bundled storyboard by ID.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getStoryboardById(id: string): Storyboard | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Get bundled storyboards that match a platform type tag.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getStoryboardsForPlatformType(platformType: string): Storyboard[];
|
|
29
|
+
/**
|
|
30
|
+
* Get compliance storyboards (those with a `track` field set).
|
|
31
|
+
*/
|
|
32
|
+
export declare function getComplianceStoryboards(): Storyboard[];
|
|
33
|
+
/**
|
|
34
|
+
* Get compliance storyboards for a specific track.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getComplianceStoryboardsForTrack(track: string): Storyboard[];
|
|
37
|
+
/**
|
|
38
|
+
* Get compliance storyboards applicable to an agent based on its tools.
|
|
39
|
+
* A storyboard is applicable if the agent has at least one of its required_tools.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getApplicableComplianceStoryboards(track: string, agentTools: string[]): Storyboard[];
|
|
42
|
+
/**
|
|
43
|
+
* Get all bundled storyboard IDs with titles and categories.
|
|
44
|
+
*/
|
|
45
|
+
export declare function listStoryboards(): Array<{
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
category: string;
|
|
49
|
+
summary: string;
|
|
50
|
+
platform_types?: string[];
|
|
51
|
+
step_count: number;
|
|
52
|
+
}>;
|
|
53
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAM/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAG/D;AAcD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,UAAU,EAAE,CAarD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAEpE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,EAAE,CAEhF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,UAAU,EAAE,CAEvD;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAE5E;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CAKpG;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,KAAK,CAAC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CASD"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Storyboard YAML loader.
|
|
4
|
+
*
|
|
5
|
+
* Parses storyboard YAML files into typed Storyboard objects.
|
|
6
|
+
* Bundled storyboards ship with the package in the storyboards/ directory.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.parseStoryboard = parseStoryboard;
|
|
10
|
+
exports.loadStoryboardFile = loadStoryboardFile;
|
|
11
|
+
exports.loadBundledStoryboards = loadBundledStoryboards;
|
|
12
|
+
exports.getStoryboardById = getStoryboardById;
|
|
13
|
+
exports.getStoryboardsForPlatformType = getStoryboardsForPlatformType;
|
|
14
|
+
exports.getComplianceStoryboards = getComplianceStoryboards;
|
|
15
|
+
exports.getComplianceStoryboardsForTrack = getComplianceStoryboardsForTrack;
|
|
16
|
+
exports.getApplicableComplianceStoryboards = getApplicableComplianceStoryboards;
|
|
17
|
+
exports.listStoryboards = listStoryboards;
|
|
18
|
+
const fs_1 = require("fs");
|
|
19
|
+
const path_1 = require("path");
|
|
20
|
+
const yaml_1 = require("yaml");
|
|
21
|
+
/**
|
|
22
|
+
* Parse a YAML string into a Storyboard.
|
|
23
|
+
*/
|
|
24
|
+
function parseStoryboard(yamlContent) {
|
|
25
|
+
const parsed = (0, yaml_1.parse)(yamlContent);
|
|
26
|
+
if (!parsed?.id || !parsed?.phases) {
|
|
27
|
+
throw new Error('Invalid storyboard YAML: missing required fields (id, phases)');
|
|
28
|
+
}
|
|
29
|
+
return parsed;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Load a storyboard from a file path.
|
|
33
|
+
*/
|
|
34
|
+
function loadStoryboardFile(filePath) {
|
|
35
|
+
const content = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
36
|
+
return parseStoryboard(content);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the bundled storyboards directory.
|
|
40
|
+
* Works from both source (src/lib/testing/storyboard/) and dist (dist/lib/testing/storyboard/).
|
|
41
|
+
*/
|
|
42
|
+
function getStoryboardsDir() {
|
|
43
|
+
// Walk up from this file to the package root, then into storyboards/
|
|
44
|
+
// From src/lib/testing/storyboard/ or dist/lib/testing/storyboard/ → 4 levels up
|
|
45
|
+
return (0, path_1.resolve)(__dirname, '..', '..', '..', '..', 'storyboards');
|
|
46
|
+
}
|
|
47
|
+
let _bundledCache = null;
|
|
48
|
+
/**
|
|
49
|
+
* Load all bundled storyboards from the storyboards/ directory.
|
|
50
|
+
* Results are cached after the first call.
|
|
51
|
+
*/
|
|
52
|
+
function loadBundledStoryboards() {
|
|
53
|
+
if (_bundledCache)
|
|
54
|
+
return _bundledCache;
|
|
55
|
+
const dir = getStoryboardsDir();
|
|
56
|
+
let files;
|
|
57
|
+
try {
|
|
58
|
+
files = (0, fs_1.readdirSync)(dir).filter(f => (f.endsWith('.yaml') || f.endsWith('.yml')) && f !== 'schema.yaml');
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
_bundledCache = files.map(f => loadStoryboardFile((0, path_1.join)(dir, f)));
|
|
64
|
+
return _bundledCache;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get a bundled storyboard by ID.
|
|
68
|
+
*/
|
|
69
|
+
function getStoryboardById(id) {
|
|
70
|
+
return loadBundledStoryboards().find(s => s.id === id);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get bundled storyboards that match a platform type tag.
|
|
74
|
+
*/
|
|
75
|
+
function getStoryboardsForPlatformType(platformType) {
|
|
76
|
+
return loadBundledStoryboards().filter(s => s.platform_types?.includes(platformType));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get compliance storyboards (those with a `track` field set).
|
|
80
|
+
*/
|
|
81
|
+
function getComplianceStoryboards() {
|
|
82
|
+
return loadBundledStoryboards().filter(s => s.track);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get compliance storyboards for a specific track.
|
|
86
|
+
*/
|
|
87
|
+
function getComplianceStoryboardsForTrack(track) {
|
|
88
|
+
return getComplianceStoryboards().filter(s => s.track === track);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get compliance storyboards applicable to an agent based on its tools.
|
|
92
|
+
* A storyboard is applicable if the agent has at least one of its required_tools.
|
|
93
|
+
*/
|
|
94
|
+
function getApplicableComplianceStoryboards(track, agentTools) {
|
|
95
|
+
return getComplianceStoryboardsForTrack(track).filter(s => {
|
|
96
|
+
if (!s.required_tools?.length)
|
|
97
|
+
return true;
|
|
98
|
+
return s.required_tools.some(tool => agentTools.includes(tool));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get all bundled storyboard IDs with titles and categories.
|
|
103
|
+
*/
|
|
104
|
+
function listStoryboards() {
|
|
105
|
+
return loadBundledStoryboards().map(s => ({
|
|
106
|
+
id: s.id,
|
|
107
|
+
title: s.title,
|
|
108
|
+
category: s.category,
|
|
109
|
+
summary: s.summary,
|
|
110
|
+
platform_types: s.platform_types,
|
|
111
|
+
step_count: s.phases.reduce((sum, p) => sum + p.steps.length, 0),
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/loader.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAUH,0CAMC;AAKD,gDAGC;AAkBD,wDAaC;AAKD,8CAEC;AAKD,sEAEC;AAKD,4DAEC;AAKD,4EAEC;AAMD,gFAKC;AAKD,0CAgBC;AAjHD,2BAA+C;AAC/C,+BAAqC;AACrC,+BAA6B;AAG7B;;GAEG;AACH,SAAgB,eAAe,CAAC,WAAmB;IACjD,MAAM,MAAM,GAAG,IAAA,YAAK,EAAC,WAAW,CAAe,CAAC;IAChD,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,MAAM,OAAO,GAAG,IAAA,iBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,SAAS,iBAAiB;IACxB,qEAAqE;IACrE,iFAAiF;IACjF,OAAO,IAAA,cAAO,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;AACnE,CAAC;AAED,IAAI,aAAa,GAAwB,IAAI,CAAC;AAE9C;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CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,SAAgB,kCAAkC,CAAC,KAAa,EAAE,UAAoB;IACpF,OAAO,gCAAgC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QACxD,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE,MAAM;YAAE,OAAO,IAAI,CAAC;QAC3C,OAAO,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe;IAQ7B,OAAO,sBAAsB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxC,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,cAAc,EAAE,CAAC,CAAC,cAAc;QAChC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;KACjE,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared JSON path utilities for storyboard context and validations.
|
|
3
|
+
*
|
|
4
|
+
* Parses dot-notation paths with array indexing (e.g., "accounts[0].account_id")
|
|
5
|
+
* into segment arrays, and resolves/sets values at those paths.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parse a path string into segments.
|
|
9
|
+
* "accounts[0].account_id" → ["accounts", 0, "account_id"]
|
|
10
|
+
*/
|
|
11
|
+
export declare function parsePath(path: string): Array<string | number>;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a dot-path with array indexing against an object.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* "accounts[0].account_id" → obj.accounts[0].account_id
|
|
17
|
+
* "formats[0].format_id.id" → obj.formats[0].format_id.id
|
|
18
|
+
* "status" → obj.status
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolvePath(obj: unknown, path: string): unknown;
|
|
21
|
+
/**
|
|
22
|
+
* Set a value at a dot-path with array indexing.
|
|
23
|
+
* Creates intermediate objects/arrays as needed.
|
|
24
|
+
* Guards against prototype pollution.
|
|
25
|
+
*
|
|
26
|
+
* "media_buy_ids[0]" → obj.media_buy_ids[0] = value
|
|
27
|
+
*/
|
|
28
|
+
export declare function setPath(obj: Record<string, unknown>, path: string, value: unknown): void;
|
|
29
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/path.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAc9D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAmB/D;AAQD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CA8CxF"}
|