@specstream/sdk 1.1.1 → 1.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @specstream/sdk
2
2
 
3
- TypeScript client for [SpecStream](https://specstream.ai), the live web data engine for teams and agents. Describe the list you need in plain words; SpecStream reads the web where those things live, hands back only the matches, each with the page it came from, and you pay only for the matches.
3
+ TypeScript client for [SpecStream](https://specstream.ai), the live web data engine for teams and agents. Describe the list you need in plain words; SpecStream reads the web where those things live, hands back only the matches, each with the page it came from, and you pay for each result delivered.
4
4
 
5
5
  The client has no runtime dependencies and needs Node 22 or newer. It uses the same account, permissions, projects and balance as the workspace.
6
6
 
@@ -64,7 +64,7 @@ New accounts start with $10 of work for 30 days, no card. A delivered result cos
64
64
  ## Links
65
65
 
66
66
  - [SDK docs](https://specstream.ai/docs/sdk) and [API docs](https://specstream.ai/docs/api)
67
- - [Source and issues](https://github.com/Specstreamai/specstream-tools)
67
+ - [Source and issues](https://github.com/specstream/specstream-tools)
68
68
  - [Python client](https://pypi.org/project/specstream-client/)
69
69
  - Support: support@specstream.ai
70
70
 
package/dist/index.d.ts CHANGED
@@ -2,7 +2,10 @@
2
2
  import type { Schemas } from "./work-types.js";
3
3
  export type { Schemas } from "./work-types.js";
4
4
  export declare const FAMILIES: readonly ["local_business", "creator", "organization", "storefront_product", "app_listing", "job_posting", "scholarly_work", "tender", "grant", "software_repository", "software_package", "dataset", "clinical_trial", "regulatory_document", "vulnerability", "book", "podcast", "web_page", "knowledge_entity", "person"];
5
- export type EntityType = (typeof FAMILIES)[number];
5
+ /** A record kind the service names today. FAMILIES lists them; they are examples, not a limit. */
6
+ export type KnownEntityType = (typeof FAMILIES)[number];
7
+ /** A record kind is an open string: any kind name a reading gives is valid. */
8
+ export type EntityType = KnownEntityType | (string & {});
6
9
  export declare const DEFAULT_BASE_URL = "https://api.specstream.ai";
7
10
  export declare class SpecstreamError extends Error {
8
11
  readonly status: number | null;
@@ -28,7 +31,7 @@ export declare class Client {
28
31
  private readonly exportOrigin?;
29
32
  private readonly timeoutMs;
30
33
  constructor(options: ClientOptions);
31
- families(): readonly EntityType[];
34
+ families(): readonly KnownEntityType[];
32
35
  compile(q: string, locale?: string): Promise<JsonMap>;
33
36
  editSpec(ast: JsonMap, operations?: JsonMap[]): Promise<JsonMap>;
34
37
  specOptions(target: string): Promise<JsonMap>;
@@ -139,11 +142,19 @@ export declare class Client {
139
142
  quoteCapacityWork(request: Schemas["CapacityQuoteRequest"]): Promise<Schemas["CapacityQuoteData"]>;
140
143
  getCapacityQuote(quoteId: string): Promise<Schemas["CapacityQuoteData"]>;
141
144
  authorizeCapacityWork(request: Schemas["CapacityAuthorizeRequest"]): Promise<Schemas["CapacityExecutionData"]>;
145
+ startCapacityRequest(request: Schemas["CapacityStartRequest"]): Promise<Schemas["CapacityStartData"]>;
142
146
  getCapacityRequest(requestKey: string, query?: {
143
147
  "project_id"?: string;
144
148
  }): Promise<{
145
149
  [key: string]: unknown;
146
150
  }>;
151
+ getCapacityRequestRows(requestKey: string, query?: {
152
+ "project_id"?: string;
153
+ "cursor"?: string;
154
+ "limit"?: number;
155
+ }): Promise<{
156
+ [key: string]: unknown;
157
+ }>;
147
158
  getCapacityExecution(findId: string): Promise<Schemas["CommerceData"]>;
148
159
  createCapacityFunding(request: Schemas["CapacityFundingRequest"]): Promise<Schemas["CapacityFundingData"]>;
149
160
  getCapacityFunding(fundingId: string): Promise<Schemas["CapacityFundingData"]>;
package/dist/index.js CHANGED
@@ -51,8 +51,8 @@ export class SpecstreamError extends Error {
51
51
  }
52
52
  }
53
53
  export function assertFamily(entityType) {
54
- if (!FAMILIES.includes(entityType)) {
55
- throw new Error(`unsupported entity_type ${entityType}`);
54
+ if (typeof entityType !== "string" || !entityType.trim()) {
55
+ throw new Error("entity_type must be a non-empty string");
56
56
  }
57
57
  return entityType;
58
58
  }
@@ -459,6 +459,10 @@ export class Client {
459
459
  requireWorkAuthorization(request);
460
460
  return this.request("POST", path, request);
461
461
  }
462
+ startCapacityRequest(request) {
463
+ let path = `/v1/capacity/requests`;
464
+ return this.request("POST", path, request);
465
+ }
462
466
  getCapacityRequest(requestKey, query = {}) {
463
467
  let path = `/v1/capacity/requests/${encodeURIComponent(requestKey)}`;
464
468
  const queryString = new URLSearchParams();
@@ -469,6 +473,16 @@ export class Client {
469
473
  path += "?" + queryString.toString();
470
474
  return this.request("GET", path);
471
475
  }
476
+ getCapacityRequestRows(requestKey, query = {}) {
477
+ let path = `/v1/capacity/requests/${encodeURIComponent(requestKey)}/rows`;
478
+ const queryString = new URLSearchParams();
479
+ for (const [key, value] of Object.entries(query))
480
+ if (value !== undefined && value !== null)
481
+ queryString.set(key, String(value));
482
+ if (queryString.size)
483
+ path += "?" + queryString.toString();
484
+ return this.request("GET", path);
485
+ }
472
486
  getCapacityExecution(findId) {
473
487
  let path = `/v1/capacity/executions/${encodeURIComponent(findId)}`;
474
488
  return this.request("GET", path);
@@ -966,7 +980,7 @@ export class Client {
966
980
  Authorization: token,
967
981
  Accept: "application/json",
968
982
  "Content-Type": "application/json",
969
- "User-Agent": "specstream-typescript/1.1.1",
983
+ "User-Agent": "specstream-typescript/1.2.0",
970
984
  };
971
985
  }
972
986
  async request(method, path, body) {
@@ -174,8 +174,6 @@ export interface Schemas {
174
174
  "members_used": number;
175
175
  "current_lists_limit": (number | null);
176
176
  "current_lists_used": number;
177
- "finds_at_once": number;
178
- "finds_per_hour": number;
179
177
  "capabilities": Schemas["CapacityPlanCapabilities"];
180
178
  "unlock": {
181
179
  [key: string]: "starter" | "pro" | "team" | "enterprise";
@@ -245,7 +243,8 @@ export interface Schemas {
245
243
  "CapacityMembershipData": {
246
244
  "plan_id": string;
247
245
  "pending_plan_id"?: (string | null);
248
- "billed_by"?: "card" | "app_store" | "google_play";
246
+ "billed_by"?: "card" | "app_store" | "google_play" | "vercel" | "digitalocean";
247
+ "manage_url"?: (string | null);
249
248
  "next_plan"?: (string | null);
250
249
  "upgrade_pending"?: boolean;
251
250
  "payment_action_url"?: (string | null);
@@ -264,6 +263,15 @@ export interface Schemas {
264
263
  "CapacityMembershipStatusData": {
265
264
  "membership"?: (Schemas["CapacityMembershipData"] | null);
266
265
  };
266
+ "CapacityPartnerData": {
267
+ "share_percent": number;
268
+ "months": number;
269
+ "clearing_days": number;
270
+ "pending_cents": number;
271
+ "payable_cents": number;
272
+ "paid_cents": number;
273
+ "paying_accounts": number;
274
+ };
267
275
  "CapacityPlanCapabilities": {
268
276
  "schedules": boolean;
269
277
  "deliveries": boolean;
@@ -293,6 +301,7 @@ export interface Schemas {
293
301
  "check_unit_cents"?: number;
294
302
  "required_check_unit_cents"?: number;
295
303
  "required_check_allowance"?: number;
304
+ "unchanged_unit_cents"?: number;
296
305
  "related_block_cents"?: number;
297
306
  "undelivered_unit_cents"?: number;
298
307
  "retail_rate"?: {
@@ -329,6 +338,7 @@ export interface Schemas {
329
338
  "signed_up": number;
330
339
  "rewarded": number;
331
340
  "earned_cents": number;
341
+ "partner"?: (Schemas["CapacityPartnerData"] | null);
332
342
  };
333
343
  "CapacityReferralVisitData": {
334
344
  "attributed": boolean;
@@ -368,6 +378,31 @@ export interface Schemas {
368
378
  "calendar_schedule"?: (Schemas["CalendarSchedule"] | null);
369
379
  "valid_until": string;
370
380
  };
381
+ "CapacityStartData": {
382
+ "idempotency_key": string;
383
+ "state": "reading" | "started" | "needs_edit" | "above_maximum" | "failed";
384
+ "message"?: (string | null);
385
+ "read_back"?: (string | null);
386
+ "maximum_cents"?: (number | null);
387
+ "find_id"?: (string | null);
388
+ "retry_after_seconds"?: (number | null);
389
+ "queue_position"?: (number | null);
390
+ };
391
+ "CapacityStartRequest": {
392
+ "q"?: (string | null);
393
+ "rows"?: (Array<{
394
+ [key: string]: (string | number | boolean | null);
395
+ }> | null);
396
+ "fields"?: (Array<string> | null);
397
+ "requested_units"?: number;
398
+ "confirm_max_cents": number;
399
+ "maximum_price_usd"?: (number | null);
400
+ "idempotency_key": string;
401
+ "locale"?: string;
402
+ "callback_url"?: (string | null);
403
+ "callback_on"?: "start" | "done";
404
+ "one_row_per"?: (string | null);
405
+ };
371
406
  "CapacityTrialEndingData": {
372
407
  "event"?: "trial_ending";
373
408
  "expires_at": string;
@@ -451,7 +486,7 @@ export interface Schemas {
451
486
  "billed_units"?: Array<Schemas["BilledUnit"]>;
452
487
  "shortfall"?: (Schemas["Shortfall"] | null);
453
488
  };
454
- "CompilerStatus": "runnable" | "needs_edit" | "rejected" | "capability_pending" | "compiler_unavailable" | "unquoted_plan";
489
+ "CompilerStatus": "runnable" | "needs_edit" | "rejected" | "capability_pending" | "compiler_unavailable" | "unquoted_plan" | "pending";
455
490
  "ConditionGrade": {
456
491
  "part_id": string;
457
492
  "field_id": (string | null);
@@ -588,13 +623,14 @@ export interface Schemas {
588
623
  "platforms"?: Array<string>;
589
624
  "searches"?: Array<string>;
590
625
  "role_phrases"?: Array<string>;
626
+ "record_words"?: Array<string>;
591
627
  "seed_identifiers"?: {
592
628
  [key: string]: string;
593
629
  };
594
630
  };
595
631
  "DisplayAbsence": "Not published" | "Couldn't check";
596
- "EntityKind": "place" | "creator" | "organization" | "storefront_product" | "app_listing" | "job_posting" | "scholarly_work" | "tender" | "grant" | "software_repository" | "software_package" | "dataset" | "clinical_trial" | "regulatory_document" | "vulnerability" | "book" | "podcast" | "web_page" | "knowledge_entity" | "person";
597
- "EntityType": "local_business" | "creator" | "organization" | "storefront_product" | "app_listing" | "job_posting" | "scholarly_work" | "tender" | "grant" | "software_repository" | "software_package" | "dataset" | "clinical_trial" | "regulatory_document" | "vulnerability" | "book" | "podcast" | "web_page" | "knowledge_entity" | "person";
632
+ "EntityKind": string;
633
+ "EntityType": string;
598
634
  "EquivalenceRecord": {
599
635
  "assessment_id": string;
600
636
  "provider": string;
@@ -613,7 +649,7 @@ export interface Schemas {
613
649
  [key: string]: unknown;
614
650
  };
615
651
  };
616
- "ErrorCode": "unsupported_query" | "unsupported_predicate" | "unsupported_entity_family" | "ambiguous_geo" | "capability_pending" | "source_blocked" | "challenge_page" | "unquoted_plan" | "compiler_unavailable" | "parse_failed" | "payments_not_live" | "capacity" | "kill_switch" | "internal_failure" | "plan_required";
652
+ "ErrorCode": "unsupported_query" | "unsupported_predicate" | "unsupported_entity_family" | "ambiguous_geo" | "capability_pending" | "source_blocked" | "challenge_page" | "unquoted_plan" | "compiler_unavailable" | "parse_failed" | "payments_not_live" | "capacity" | "kill_switch" | "internal_failure" | "plan_required" | "invalid_token";
617
653
  "ErrorEnvelope": {
618
654
  "error": Schemas["ErrorBody"];
619
655
  };
@@ -674,6 +710,10 @@ export interface Schemas {
674
710
  "source_pointer"?: (string | null);
675
711
  "source_response_sha256"?: (string | null);
676
712
  "source_time"?: (Schemas["EvidenceTime"] | null);
713
+ "source_raw"?: ({
714
+ [key: string]: unknown;
715
+ } | null);
716
+ "capability_id"?: (string | null);
677
717
  };
678
718
  "FileImportCommand": {
679
719
  "import_id": string;
@@ -748,6 +788,9 @@ export interface Schemas {
748
788
  "accepted_count": number;
749
789
  "rows": Array<Schemas["AcceptedRow"]>;
750
790
  "possible"?: Array<Schemas["PossibleRow"]>;
791
+ "flat_rows"?: Array<{
792
+ [key: string]: unknown;
793
+ }>;
751
794
  "entitlement": string;
752
795
  "commerce"?: (Schemas["CommerceData"] | null);
753
796
  "next_cursor"?: (string | null);
@@ -1152,6 +1195,8 @@ export interface Schemas {
1152
1195
  "compiler_version": string;
1153
1196
  "ast_hash": (string | null);
1154
1197
  "canonical_sentence": (string | null);
1198
+ "notice"?: (string | null);
1199
+ "read_back"?: (string | null);
1155
1200
  };
1156
1201
  "PasskeyComplete": {
1157
1202
  "challenge_id": string;
@@ -1353,6 +1398,9 @@ export interface Schemas {
1353
1398
  "output_fields"?: Array<Schemas["OutputField"]>;
1354
1399
  "worded_conditions"?: Array<Schemas["WordedCondition"]>;
1355
1400
  "worded_outputs"?: Array<Schemas["WordedOutput"]>;
1401
+ "contact_off"?: Array<"email" | "phone">;
1402
+ "record_fields"?: Array<string>;
1403
+ "each_location"?: boolean;
1356
1404
  "sort": Array<Schemas["SortKey"]>;
1357
1405
  "locale": string;
1358
1406
  "inferred": Array<Schemas["InferredClause"]>;
@@ -1941,6 +1989,7 @@ export interface Schemas {
1941
1989
  "source_find_id"?: (string | null);
1942
1990
  "project_id"?: (string | null);
1943
1991
  "context"?: string;
1992
+ "q"?: (string | null);
1944
1993
  } & ({
1945
1994
  "ast": NonNullable<unknown>;
1946
1995
  "source_find_id"?: null;
@@ -1993,10 +2042,12 @@ export interface Schemas {
1993
2042
  "ast": Schemas["QueryAst"];
1994
2043
  "name"?: (string | null);
1995
2044
  "context"?: (string | null);
2045
+ "q"?: (string | null);
1996
2046
  };
1997
2047
  "SseComplete": {
1998
2048
  "row_count": number;
1999
2049
  "stop_reason": Schemas["StopReason"];
2050
+ "message"?: (string | null);
2000
2051
  };
2001
2052
  "SseError": {
2002
2053
  "code": Schemas["ErrorCode"];
@@ -2055,7 +2106,7 @@ export interface Schemas {
2055
2106
  "SseZero": {
2056
2107
  "cause": string;
2057
2108
  };
2058
- "StopReason": "complete_target" | "saturated_discovery" | "budget_reserved_exhausted" | "wall_clock" | "fetch_count" | "source_blocked" | "unsupported_predicate" | "zero_after_filters" | "user_cancel" | "capacity";
2109
+ "StopReason": "complete_target" | "saturated_discovery" | "budget_reserved_exhausted" | "wall_clock" | "fetch_count" | "source_blocked" | "unsupported_predicate" | "zero_after_filters" | "user_cancel" | "capacity" | "model_unavailable";
2059
2110
  "StoreCardTransferRequest": {
2060
2111
  "plan_id": string;
2061
2112
  "idempotency_key": string;
@@ -2243,7 +2294,7 @@ export interface Schemas {
2243
2294
  "detail_id": string;
2244
2295
  "words": string;
2245
2296
  "description": string;
2246
- "value_type"?: "text" | "number" | "date" | "url" | "email" | "phone" | "yes_no";
2297
+ "value_type"?: "text" | "number" | "date" | "url" | "email" | "phone" | "yes_no" | "place";
2247
2298
  "required"?: boolean;
2248
2299
  };
2249
2300
  "WorkspaceAuditEvent": {
@@ -2470,6 +2521,7 @@ export interface Schemas {
2470
2521
  "snippet": string;
2471
2522
  "project_id"?: (string | null);
2472
2523
  "collection_id"?: (string | null);
2524
+ "find_id"?: (string | null);
2473
2525
  "record_id"?: (string | null);
2474
2526
  "note_id"?: (string | null);
2475
2527
  "imported"?: (boolean | null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specstream/sdk",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "TypeScript client for building lead lists and company lists from the live web. Every match comes with its source, priced before it runs.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,11 +49,11 @@
49
49
  "homepage": "https://specstream.ai/docs/sdk",
50
50
  "repository": {
51
51
  "type": "git",
52
- "url": "git+https://github.com/Specstreamai/specstream-tools.git",
52
+ "url": "git+https://github.com/specstream/specstream-tools.git",
53
53
  "directory": "packages/sdk-ts"
54
54
  },
55
55
  "bugs": {
56
- "url": "https://github.com/Specstreamai/specstream-tools/issues"
56
+ "url": "https://github.com/specstream/specstream-tools/issues"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"