@propertysimple/client 0.1.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.
Files changed (54) hide show
  1. package/API.md +79 -0
  2. package/README.md +348 -0
  3. package/client/src/directory-sync.d.ts +123 -0
  4. package/client/src/directory-sync.js +404 -0
  5. package/client/src/index.d.ts +5123 -0
  6. package/client/src/index.js +285 -0
  7. package/client/src/managed-sync.d.ts +129 -0
  8. package/client/src/managed-sync.js +410 -0
  9. package/contracts/src/catalog-derived.d.ts +7 -0
  10. package/contracts/src/catalog-derived.js +78 -0
  11. package/contracts/src/catalog-fields.d.ts +231 -0
  12. package/contracts/src/catalog-fields.js +194 -0
  13. package/contracts/src/catalog-inventory.d.ts +14 -0
  14. package/contracts/src/catalog-inventory.js +10 -0
  15. package/contracts/src/directory-execution.d.ts +320 -0
  16. package/contracts/src/directory-execution.js +122 -0
  17. package/contracts/src/directory-identity.d.ts +1255 -0
  18. package/contracts/src/directory-identity.js +129 -0
  19. package/contracts/src/directory-sales.d.ts +333 -0
  20. package/contracts/src/directory-sales.js +102 -0
  21. package/contracts/src/directory.d.ts +1088 -0
  22. package/contracts/src/directory.js +179 -0
  23. package/contracts/src/index.d.ts +18 -0
  24. package/contracts/src/index.js +18 -0
  25. package/contracts/src/intelligence.d.ts +366 -0
  26. package/contracts/src/intelligence.js +157 -0
  27. package/contracts/src/location-serving.d.ts +13 -0
  28. package/contracts/src/location-serving.js +89 -0
  29. package/contracts/src/location.d.ts +73 -0
  30. package/contracts/src/location.js +75 -0
  31. package/contracts/src/openapi.d.ts +22 -0
  32. package/contracts/src/openapi.js +109 -0
  33. package/contracts/src/operations.d.ts +8316 -0
  34. package/contracts/src/operations.js +56 -0
  35. package/contracts/src/opportunity-events.d.ts +38 -0
  36. package/contracts/src/opportunity-events.js +69 -0
  37. package/contracts/src/platform-api.d.ts +12 -0
  38. package/contracts/src/platform-api.js +1 -0
  39. package/contracts/src/professional-intelligence.d.ts +256 -0
  40. package/contracts/src/professional-intelligence.js +90 -0
  41. package/contracts/src/property-features.d.ts +94 -0
  42. package/contracts/src/property-features.js +398 -0
  43. package/contracts/src/publication.d.ts +44 -0
  44. package/contracts/src/publication.js +42 -0
  45. package/contracts/src/routes.d.ts +437 -0
  46. package/contracts/src/routes.js +496 -0
  47. package/contracts/src/schemas.d.ts +3198 -0
  48. package/contracts/src/schemas.js +674 -0
  49. package/contracts/src/search.d.ts +2630 -0
  50. package/contracts/src/search.js +223 -0
  51. package/contracts/src/smart-feed.d.ts +3731 -0
  52. package/contracts/src/smart-feed.js +109 -0
  53. package/openapi.json +43542 -0
  54. package/package.json +60 -0
@@ -0,0 +1,56 @@
1
+ import { directoryOperations } from './directory.js';
2
+ import { smartFeedOperations } from './smart-feed.js';
3
+ import { professionalIntelligenceOperations } from './professional-intelligence.js';
4
+ import { directorySalesOperations } from './directory-sales.js';
5
+ import { directoryIdentityOperations } from './directory-identity.js';
6
+ import { directoryExecutionOperations } from './directory-execution.js';
7
+ import { searchOperations } from './search.js';
8
+ import { PublicationReportRequest, PublicationReceipt, DestinationQuery, DestinationResponse, } from './publication.js';
9
+ import { JudgmentRequest, JudgmentSchema, IntelligenceCapabilitiesSchema } from './intelligence.js';
10
+ import { Id, Empty, ResourceQuery, ResourcePageQuery, DatasetPageQuery, ListingDetailQuery, ListingSchema, ListingContactsSchema, AgentSchema, ListingQuery, IdentityQuery, IdentitySchema, AgentIdentitySchema, page, CatalogHealthQuery, CatalogHealthSchema, ListingPage, ListingMapQuery, ListingMapSchema, SimilarListingQuery, SimilarListingsSchema, SnapshotRequest, SnapshotSchema, CatalogChangeSchema, DomainEventSchema, ClassificationDefinitionSchema, ActionProfileSchema, OpportunityQuery, OpportunitySchema, PlanRequest, PlanSchema, PlanItemSchema, DispatchRequest, DispatchBatchSchema, AttemptRequest, AttemptSchema, OutcomesRequest, ContextEventsRequest, BatchResultSchema, WebhookRequest, WebhookSchema, CapabilitiesSchema, ReadinessSchema, } from './schemas.js';
11
+ /** One registry drives the interface, HTTP validation and SDK response validation. */
12
+ export const operations = {
13
+ ...searchOperations,
14
+ ...directoryOperations,
15
+ ...smartFeedOperations,
16
+ ...professionalIntelligenceOperations,
17
+ ...directorySalesOperations,
18
+ ...directoryIdentityOperations,
19
+ ...directoryExecutionOperations,
20
+ evaluateJudgment: { input: JudgmentRequest, output: JudgmentSchema },
21
+ getJudgment: { input: ResourceQuery, output: JudgmentSchema },
22
+ intelligenceCapabilities: { input: Empty, output: IntelligenceCapabilitiesSchema },
23
+ capabilities: { input: Empty, output: CapabilitiesSchema },
24
+ reportPublication: { input: PublicationReportRequest, output: PublicationReceipt },
25
+ resolveDestination: { input: DestinationQuery, output: DestinationResponse },
26
+ listListings: { input: ListingQuery, output: ListingPage },
27
+ getCatalogHealth: { input: CatalogHealthQuery, output: CatalogHealthSchema },
28
+ getListing: { input: ListingDetailQuery, output: ListingSchema },
29
+ getListingContacts: {
30
+ input: ResourceQuery.extend({ dataset_id: Id.optional() }),
31
+ output: ListingContactsSchema,
32
+ },
33
+ listListingMap: { input: ListingMapQuery, output: ListingMapSchema },
34
+ listSimilarListings: { input: SimilarListingQuery, output: SimilarListingsSchema },
35
+ resolveListingIdentity: { input: IdentityQuery, output: IdentitySchema },
36
+ resolveAgentIdentity: { input: IdentityQuery, output: AgentIdentitySchema },
37
+ getAgent: { input: ResourceQuery, output: AgentSchema },
38
+ listAgentListings: { input: ListingQuery.safeExtend({ id: Id }), output: ListingPage },
39
+ classificationSchema: { input: Empty, output: ClassificationDefinitionSchema },
40
+ createSnapshot: { input: SnapshotRequest, output: SnapshotSchema },
41
+ getSnapshot: { input: ResourceQuery, output: SnapshotSchema },
42
+ listSnapshotItems: { input: ResourcePageQuery, output: ListingPage },
43
+ listCatalogChanges: { input: DatasetPageQuery, output: page(CatalogChangeSchema) },
44
+ listEvents: { input: DatasetPageQuery, output: page(DomainEventSchema) },
45
+ listActionProfiles: { input: Empty, output: page(ActionProfileSchema) },
46
+ listOpportunities: { input: OpportunityQuery, output: page(OpportunitySchema) },
47
+ createPlan: { input: PlanRequest, output: PlanSchema },
48
+ getPlan: { input: ResourceQuery, output: PlanSchema },
49
+ listPlanItems: { input: ResourcePageQuery, output: page(PlanItemSchema) },
50
+ claimDispatchBatch: { input: DispatchRequest, output: DispatchBatchSchema },
51
+ startAttempt: { input: AttemptRequest, output: AttemptSchema },
52
+ recordActionOutcomes: { input: OutcomesRequest, output: BatchResultSchema },
53
+ recordProductContextEvents: { input: ContextEventsRequest, output: BatchResultSchema },
54
+ createWebhookSubscription: { input: WebhookRequest, output: WebhookSchema },
55
+ readiness: { input: Empty, output: ReadinessSchema },
56
+ };
@@ -0,0 +1,38 @@
1
+ import { z } from 'zod';
2
+ import { DomainEventSchema } from './schemas.js';
3
+ export declare const MarketAgeEvidenceSchema: z.ZodObject<{
4
+ threshold_days: z.ZodNumber;
5
+ listed_at: z.ZodISODateTime;
6
+ listed_precision: z.ZodEnum<{
7
+ date: "date";
8
+ instant: "instant";
9
+ }>;
10
+ source_observed_at: z.ZodISODateTime;
11
+ }, z.core.$strict>;
12
+ /** An observed occasion, never a recommendation, consent, send or order permit.
13
+ * received_at is the platform observation clock used for activity charts;
14
+ * occurred_at preserves the source/calculated boundary for enrollment/history. */
15
+ export declare const OpportunityObservationSchema: z.ZodObject<{
16
+ schema_version: z.ZodLiteral<"opportunity-observation-v1">;
17
+ id: z.ZodString;
18
+ sequence: z.ZodString;
19
+ listing_id: z.ZodString;
20
+ episode_id: z.ZodString;
21
+ type: z.ZodEnum<{
22
+ new_to_market: "new_to_market";
23
+ price_drop: "price_drop";
24
+ open_house_changed: "open_house_changed";
25
+ market_age_milestone: "market_age_milestone";
26
+ source_removed: "source_removed";
27
+ }>;
28
+ received_at: z.ZodISODateTime;
29
+ occurred_at: z.ZodISODateTime;
30
+ evidence: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
31
+ requires_current_eligibility: z.ZodLiteral<true>;
32
+ authorizes_order: z.ZodLiteral<false>;
33
+ }, z.core.$strict>;
34
+ export type OpportunityObservation = z.infer<typeof OpportunityObservationSchema>;
35
+ /** Map durable /v1/events replay to a product-neutral observation. Baseline,
36
+ * parser corrections and arbitrary catalog updates are deliberately not events
37
+ * a consumer can mistake for a newly received marketing opportunity. */
38
+ export declare function opportunityObservation(input: z.infer<typeof DomainEventSchema>): OpportunityObservation | null;
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ import { DomainEventSchema } from './schemas.js';
3
+ export const MarketAgeEvidenceSchema = z.strictObject({
4
+ threshold_days: z.number().int().min(30).multipleOf(30),
5
+ listed_at: z.iso.datetime({ offset: true }),
6
+ listed_precision: z.enum(['date', 'instant']),
7
+ source_observed_at: z.iso.datetime({ offset: true }),
8
+ });
9
+ /** An observed occasion, never a recommendation, consent, send or order permit.
10
+ * received_at is the platform observation clock used for activity charts;
11
+ * occurred_at preserves the source/calculated boundary for enrollment/history. */
12
+ export const OpportunityObservationSchema = z
13
+ .strictObject({
14
+ schema_version: z.literal('opportunity-observation-v1'),
15
+ id: z.string().min(1),
16
+ sequence: z.string().regex(/^\d+$/),
17
+ listing_id: z.string().min(1),
18
+ episode_id: z.string().min(1),
19
+ type: z.enum([
20
+ 'new_to_market',
21
+ 'price_drop',
22
+ 'open_house_changed',
23
+ 'market_age_milestone',
24
+ 'source_removed',
25
+ ]),
26
+ received_at: z.iso.datetime({ offset: true }),
27
+ occurred_at: z.iso.datetime({ offset: true }),
28
+ evidence: DomainEventSchema.shape.evidence,
29
+ requires_current_eligibility: z.literal(true),
30
+ authorizes_order: z.literal(false),
31
+ })
32
+ .superRefine((event, context) => {
33
+ if (event.type === 'market_age_milestone' &&
34
+ !MarketAgeEvidenceSchema.safeParse(event.evidence).success) {
35
+ context.addIssue({
36
+ code: 'custom',
37
+ path: ['evidence'],
38
+ message: 'Invalid market-age milestone evidence.',
39
+ });
40
+ }
41
+ });
42
+ /** Map durable /v1/events replay to a product-neutral observation. Baseline,
43
+ * parser corrections and arbitrary catalog updates are deliberately not events
44
+ * a consumer can mistake for a newly received marketing opportunity. */
45
+ export function opportunityObservation(input) {
46
+ const event = DomainEventSchema.parse(input);
47
+ const type = event.type === 'listing_removed' ? 'source_removed' : event.type;
48
+ if (![
49
+ 'new_to_market',
50
+ 'price_drop',
51
+ 'open_house_changed',
52
+ 'market_age_milestone',
53
+ 'source_removed',
54
+ ].includes(type))
55
+ return null;
56
+ return OpportunityObservationSchema.parse({
57
+ schema_version: 'opportunity-observation-v1',
58
+ id: event.id,
59
+ sequence: event.sequence,
60
+ listing_id: event.listing_id,
61
+ episode_id: event.episode_id,
62
+ type,
63
+ received_at: event.observed_at,
64
+ occurred_at: event.occurred_at,
65
+ evidence: event.evidence,
66
+ requires_current_eligibility: true,
67
+ authorizes_order: false,
68
+ });
69
+ }
@@ -0,0 +1,12 @@
1
+ import type { Input, Operation, Output, Principal } from './schemas.js';
2
+ export interface RequestContext {
3
+ request_id: string;
4
+ /** Required by the router on mutations. Services must scope it to tenant, operation and body hash. */
5
+ idempotency_key?: string;
6
+ }
7
+ export type MutationContext = RequestContext;
8
+ /** Services must authorize resource ownership as well as the router's coarse scopes. */
9
+ export type PlatformApi = {
10
+ [K in Operation]: (principal: Principal, input: Input<K>, context: RequestContext) => Promise<Output<K>>;
11
+ };
12
+ export type Authenticate = (request: Request) => Promise<Principal | null>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,256 @@
1
+ import { z } from 'zod';
2
+ export declare const DirectoryAssessmentTask: z.ZodEnum<{
3
+ entity_match: "entity_match";
4
+ office_variant: "office_variant";
5
+ relationship_support: "relationship_support";
6
+ professional_category: "professional_category";
7
+ }>;
8
+ export declare const DirectoryAssessmentRequest: z.ZodObject<{
9
+ dataset_id: z.ZodString;
10
+ entity_id: z.ZodString;
11
+ comparison_id: z.ZodOptional<z.ZodString>;
12
+ task: z.ZodEnum<{
13
+ entity_match: "entity_match";
14
+ office_variant: "office_variant";
15
+ relationship_support: "relationship_support";
16
+ professional_category: "professional_category";
17
+ }>;
18
+ relationship: z.ZodOptional<z.ZodEnum<{
19
+ observed_at_office: "observed_at_office";
20
+ observed_brokerage: "observed_brokerage";
21
+ affiliated_with: "affiliated_with";
22
+ operates: "operates";
23
+ member_of: "member_of";
24
+ }>>;
25
+ }, z.core.$strict>;
26
+ export declare const DirectoryAssessmentSchema: z.ZodObject<{
27
+ id: z.ZodString;
28
+ entity_id: z.ZodString;
29
+ comparison_id: z.ZodNullable<z.ZodString>;
30
+ task: z.ZodEnum<{
31
+ entity_match: "entity_match";
32
+ office_variant: "office_variant";
33
+ relationship_support: "relationship_support";
34
+ professional_category: "professional_category";
35
+ }>;
36
+ definition_version: z.ZodString;
37
+ evidence_hash: z.ZodString;
38
+ state: z.ZodEnum<{
39
+ stale: "stale";
40
+ failed: "failed";
41
+ running: "running";
42
+ succeeded: "succeeded";
43
+ queued: "queued";
44
+ }>;
45
+ provider: z.ZodString;
46
+ model: z.ZodString;
47
+ result: z.ZodNullable<z.ZodObject<{
48
+ decision: z.ZodEnum<{
49
+ unknown: "unknown";
50
+ supported: "supported";
51
+ conflicting: "conflicting";
52
+ not_established: "not_established";
53
+ consistent: "consistent";
54
+ distinct: "distinct";
55
+ residential: "residential";
56
+ commercial: "commercial";
57
+ rental: "rental";
58
+ mixed: "mixed";
59
+ }>;
60
+ evidence_refs: z.ZodArray<z.ZodString>;
61
+ confidence: z.ZodNumber;
62
+ authority: z.ZodLiteral<"semantic_assessment">;
63
+ changes_account_access: z.ZodLiteral<false>;
64
+ }, z.core.$strict>>;
65
+ error_code: z.ZodNullable<z.ZodString>;
66
+ created_at: z.ZodISODateTime;
67
+ completed_at: z.ZodNullable<z.ZodISODateTime>;
68
+ }, z.core.$strict>;
69
+ export declare const professionalIntelligenceOperations: {
70
+ readonly latestDirectoryAssessment: {
71
+ readonly input: z.ZodObject<{
72
+ dataset_id: z.ZodString;
73
+ entity_id: z.ZodString;
74
+ comparison_id: z.ZodOptional<z.ZodString>;
75
+ task: z.ZodEnum<{
76
+ entity_match: "entity_match";
77
+ office_variant: "office_variant";
78
+ relationship_support: "relationship_support";
79
+ professional_category: "professional_category";
80
+ }>;
81
+ relationship: z.ZodOptional<z.ZodEnum<{
82
+ observed_at_office: "observed_at_office";
83
+ observed_brokerage: "observed_brokerage";
84
+ affiliated_with: "affiliated_with";
85
+ operates: "operates";
86
+ member_of: "member_of";
87
+ }>>;
88
+ }, z.core.$strict>;
89
+ readonly output: z.ZodObject<{
90
+ state: z.ZodEnum<{
91
+ stale: "stale";
92
+ failed: "failed";
93
+ running: "running";
94
+ succeeded: "succeeded";
95
+ queued: "queued";
96
+ not_assessed: "not_assessed";
97
+ }>;
98
+ assessment: z.ZodNullable<z.ZodObject<{
99
+ id: z.ZodString;
100
+ entity_id: z.ZodString;
101
+ comparison_id: z.ZodNullable<z.ZodString>;
102
+ task: z.ZodEnum<{
103
+ entity_match: "entity_match";
104
+ office_variant: "office_variant";
105
+ relationship_support: "relationship_support";
106
+ professional_category: "professional_category";
107
+ }>;
108
+ definition_version: z.ZodString;
109
+ evidence_hash: z.ZodString;
110
+ state: z.ZodEnum<{
111
+ stale: "stale";
112
+ failed: "failed";
113
+ running: "running";
114
+ succeeded: "succeeded";
115
+ queued: "queued";
116
+ }>;
117
+ provider: z.ZodString;
118
+ model: z.ZodString;
119
+ result: z.ZodNullable<z.ZodObject<{
120
+ decision: z.ZodEnum<{
121
+ unknown: "unknown";
122
+ supported: "supported";
123
+ conflicting: "conflicting";
124
+ not_established: "not_established";
125
+ consistent: "consistent";
126
+ distinct: "distinct";
127
+ residential: "residential";
128
+ commercial: "commercial";
129
+ rental: "rental";
130
+ mixed: "mixed";
131
+ }>;
132
+ evidence_refs: z.ZodArray<z.ZodString>;
133
+ confidence: z.ZodNumber;
134
+ authority: z.ZodLiteral<"semantic_assessment">;
135
+ changes_account_access: z.ZodLiteral<false>;
136
+ }, z.core.$strict>>;
137
+ error_code: z.ZodNullable<z.ZodString>;
138
+ created_at: z.ZodISODateTime;
139
+ completed_at: z.ZodNullable<z.ZodISODateTime>;
140
+ }, z.core.$strict>>;
141
+ }, z.core.$strict>;
142
+ };
143
+ readonly requestDirectoryAssessment: {
144
+ readonly input: z.ZodObject<{
145
+ dataset_id: z.ZodString;
146
+ entity_id: z.ZodString;
147
+ comparison_id: z.ZodOptional<z.ZodString>;
148
+ task: z.ZodEnum<{
149
+ entity_match: "entity_match";
150
+ office_variant: "office_variant";
151
+ relationship_support: "relationship_support";
152
+ professional_category: "professional_category";
153
+ }>;
154
+ relationship: z.ZodOptional<z.ZodEnum<{
155
+ observed_at_office: "observed_at_office";
156
+ observed_brokerage: "observed_brokerage";
157
+ affiliated_with: "affiliated_with";
158
+ operates: "operates";
159
+ member_of: "member_of";
160
+ }>>;
161
+ }, z.core.$strict>;
162
+ readonly output: z.ZodObject<{
163
+ id: z.ZodString;
164
+ entity_id: z.ZodString;
165
+ comparison_id: z.ZodNullable<z.ZodString>;
166
+ task: z.ZodEnum<{
167
+ entity_match: "entity_match";
168
+ office_variant: "office_variant";
169
+ relationship_support: "relationship_support";
170
+ professional_category: "professional_category";
171
+ }>;
172
+ definition_version: z.ZodString;
173
+ evidence_hash: z.ZodString;
174
+ state: z.ZodEnum<{
175
+ stale: "stale";
176
+ failed: "failed";
177
+ running: "running";
178
+ succeeded: "succeeded";
179
+ queued: "queued";
180
+ }>;
181
+ provider: z.ZodString;
182
+ model: z.ZodString;
183
+ result: z.ZodNullable<z.ZodObject<{
184
+ decision: z.ZodEnum<{
185
+ unknown: "unknown";
186
+ supported: "supported";
187
+ conflicting: "conflicting";
188
+ not_established: "not_established";
189
+ consistent: "consistent";
190
+ distinct: "distinct";
191
+ residential: "residential";
192
+ commercial: "commercial";
193
+ rental: "rental";
194
+ mixed: "mixed";
195
+ }>;
196
+ evidence_refs: z.ZodArray<z.ZodString>;
197
+ confidence: z.ZodNumber;
198
+ authority: z.ZodLiteral<"semantic_assessment">;
199
+ changes_account_access: z.ZodLiteral<false>;
200
+ }, z.core.$strict>>;
201
+ error_code: z.ZodNullable<z.ZodString>;
202
+ created_at: z.ZodISODateTime;
203
+ completed_at: z.ZodNullable<z.ZodISODateTime>;
204
+ }, z.core.$strict>;
205
+ };
206
+ readonly getDirectoryAssessment: {
207
+ readonly input: z.ZodObject<{
208
+ id: z.ZodString;
209
+ }, z.core.$strict>;
210
+ readonly output: z.ZodObject<{
211
+ id: z.ZodString;
212
+ entity_id: z.ZodString;
213
+ comparison_id: z.ZodNullable<z.ZodString>;
214
+ task: z.ZodEnum<{
215
+ entity_match: "entity_match";
216
+ office_variant: "office_variant";
217
+ relationship_support: "relationship_support";
218
+ professional_category: "professional_category";
219
+ }>;
220
+ definition_version: z.ZodString;
221
+ evidence_hash: z.ZodString;
222
+ state: z.ZodEnum<{
223
+ stale: "stale";
224
+ failed: "failed";
225
+ running: "running";
226
+ succeeded: "succeeded";
227
+ queued: "queued";
228
+ }>;
229
+ provider: z.ZodString;
230
+ model: z.ZodString;
231
+ result: z.ZodNullable<z.ZodObject<{
232
+ decision: z.ZodEnum<{
233
+ unknown: "unknown";
234
+ supported: "supported";
235
+ conflicting: "conflicting";
236
+ not_established: "not_established";
237
+ consistent: "consistent";
238
+ distinct: "distinct";
239
+ residential: "residential";
240
+ commercial: "commercial";
241
+ rental: "rental";
242
+ mixed: "mixed";
243
+ }>;
244
+ evidence_refs: z.ZodArray<z.ZodString>;
245
+ confidence: z.ZodNumber;
246
+ authority: z.ZodLiteral<"semantic_assessment">;
247
+ changes_account_access: z.ZodLiteral<false>;
248
+ }, z.core.$strict>>;
249
+ error_code: z.ZodNullable<z.ZodString>;
250
+ created_at: z.ZodISODateTime;
251
+ completed_at: z.ZodNullable<z.ZodISODateTime>;
252
+ }, z.core.$strict>;
253
+ };
254
+ };
255
+ export type DirectoryAssessmentInput = z.infer<typeof DirectoryAssessmentRequest>;
256
+ export type DirectoryAssessment = z.infer<typeof DirectoryAssessmentSchema>;
@@ -0,0 +1,90 @@
1
+ import { z } from 'zod';
2
+ const Id = z.string().min(1).max(256);
3
+ export const DirectoryAssessmentTask = z.enum([
4
+ 'entity_match',
5
+ 'office_variant',
6
+ 'relationship_support',
7
+ 'professional_category',
8
+ ]);
9
+ export const DirectoryAssessmentRequest = z
10
+ .strictObject({
11
+ dataset_id: Id,
12
+ entity_id: Id,
13
+ comparison_id: Id.optional(),
14
+ task: DirectoryAssessmentTask,
15
+ relationship: z
16
+ .enum([
17
+ 'affiliated_with',
18
+ 'operates',
19
+ 'member_of',
20
+ 'observed_at_office',
21
+ 'observed_brokerage',
22
+ ])
23
+ .optional(),
24
+ })
25
+ .superRefine((input, ctx) => {
26
+ if (input.task !== 'professional_category' && !input.comparison_id)
27
+ ctx.addIssue({ code: 'custom', message: 'Pair tasks require comparison_id.' });
28
+ if (input.comparison_id === input.entity_id)
29
+ ctx.addIssue({ code: 'custom', message: 'Compare distinct records.' });
30
+ if (input.task === 'professional_category' && input.comparison_id)
31
+ ctx.addIssue({ code: 'custom', message: 'Category tasks have one subject.' });
32
+ if (input.task === 'relationship_support' && !input.relationship)
33
+ ctx.addIssue({
34
+ code: 'custom',
35
+ message: 'Relationship support requires an explicit relationship predicate.',
36
+ });
37
+ if (input.task !== 'relationship_support' && input.relationship)
38
+ ctx.addIssue({
39
+ code: 'custom',
40
+ message: 'Only relationship-support tasks accept a relationship predicate.',
41
+ });
42
+ });
43
+ export const DirectoryAssessmentSchema = z.strictObject({
44
+ id: Id,
45
+ entity_id: Id,
46
+ comparison_id: Id.nullable(),
47
+ task: DirectoryAssessmentTask,
48
+ definition_version: z.string(),
49
+ evidence_hash: z.string(),
50
+ state: z.enum(['queued', 'running', 'succeeded', 'failed', 'stale']),
51
+ provider: z.string(),
52
+ model: z.string(),
53
+ result: z
54
+ .strictObject({
55
+ decision: z.enum([
56
+ 'consistent',
57
+ 'distinct',
58
+ 'supported',
59
+ 'not_established',
60
+ 'conflicting',
61
+ 'residential',
62
+ 'commercial',
63
+ 'rental',
64
+ 'mixed',
65
+ 'unknown',
66
+ ]),
67
+ evidence_refs: z.array(z.string()),
68
+ confidence: z.number().min(0).max(1),
69
+ authority: z.literal('semantic_assessment'),
70
+ changes_account_access: z.literal(false),
71
+ })
72
+ .nullable(),
73
+ error_code: z.string().nullable(),
74
+ created_at: z.iso.datetime({ offset: true }),
75
+ completed_at: z.iso.datetime({ offset: true }).nullable(),
76
+ });
77
+ export const professionalIntelligenceOperations = {
78
+ latestDirectoryAssessment: {
79
+ input: DirectoryAssessmentRequest,
80
+ output: z.strictObject({
81
+ state: z.enum(['not_assessed', 'queued', 'running', 'succeeded', 'failed', 'stale']),
82
+ assessment: DirectoryAssessmentSchema.nullable(),
83
+ }),
84
+ },
85
+ requestDirectoryAssessment: {
86
+ input: DirectoryAssessmentRequest,
87
+ output: DirectoryAssessmentSchema,
88
+ },
89
+ getDirectoryAssessment: { input: z.strictObject({ id: Id }), output: DirectoryAssessmentSchema },
90
+ };
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ /** Stable product vocabulary. Availability describes an implemented inference path,
3
+ * not measured model accuracy or whether a particular feed supplies the field. */
4
+ export declare const PROPERTY_DISCOVERY_REGISTRY_VERSION = "property-discovery-v1";
5
+ export declare const PropertyFeatureDefinitionSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ family: z.ZodNumber;
8
+ label: z.ZodString;
9
+ definition: z.ZodString;
10
+ type: z.ZodEnum<{
11
+ string: "string";
12
+ number: "number";
13
+ boolean: "boolean";
14
+ }>;
15
+ values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
16
+ synonyms: z.ZodArray<z.ZodString>;
17
+ applicability: z.ZodEnum<{
18
+ any: "any";
19
+ rental: "rental";
20
+ dwelling: "dwelling";
21
+ sale: "sale";
22
+ }>;
23
+ source_paths: z.ZodArray<z.ZodString>;
24
+ operators: z.ZodArray<z.ZodEnum<{
25
+ in: "in";
26
+ eq: "eq";
27
+ neq: "neq";
28
+ not_in: "not_in";
29
+ gt: "gt";
30
+ gte: "gte";
31
+ lt: "lt";
32
+ lte: "lte";
33
+ }>>;
34
+ availability: z.ZodEnum<{
35
+ source_and_interpretation: "source_and_interpretation";
36
+ source_only: "source_only";
37
+ }>;
38
+ consequence: z.ZodEnum<{
39
+ ordinary: "ordinary";
40
+ consequential: "consequential";
41
+ }>;
42
+ status: z.ZodLiteral<"experimental">;
43
+ }, z.core.$strict>;
44
+ export type PropertyFeatureDefinition = z.infer<typeof PropertyFeatureDefinitionSchema>;
45
+ export declare const PropertyFeatureRegistrySchema: z.ZodObject<{
46
+ version: z.ZodLiteral<"property-discovery-v1">;
47
+ features: z.ZodArray<z.ZodObject<{
48
+ id: z.ZodString;
49
+ family: z.ZodNumber;
50
+ label: z.ZodString;
51
+ definition: z.ZodString;
52
+ type: z.ZodEnum<{
53
+ string: "string";
54
+ number: "number";
55
+ boolean: "boolean";
56
+ }>;
57
+ values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
58
+ synonyms: z.ZodArray<z.ZodString>;
59
+ applicability: z.ZodEnum<{
60
+ any: "any";
61
+ rental: "rental";
62
+ dwelling: "dwelling";
63
+ sale: "sale";
64
+ }>;
65
+ source_paths: z.ZodArray<z.ZodString>;
66
+ operators: z.ZodArray<z.ZodEnum<{
67
+ in: "in";
68
+ eq: "eq";
69
+ neq: "neq";
70
+ not_in: "not_in";
71
+ gt: "gt";
72
+ gte: "gte";
73
+ lt: "lt";
74
+ lte: "lte";
75
+ }>>;
76
+ availability: z.ZodEnum<{
77
+ source_and_interpretation: "source_and_interpretation";
78
+ source_only: "source_only";
79
+ }>;
80
+ consequence: z.ZodEnum<{
81
+ ordinary: "ordinary";
82
+ consequential: "consequential";
83
+ }>;
84
+ status: z.ZodLiteral<"experimental">;
85
+ }, z.core.$strict>>;
86
+ }, z.core.$strict>;
87
+ export declare const PROPERTY_FEATURE_FAMILIES: {
88
+ id: number;
89
+ label: string;
90
+ }[];
91
+ /** Never reuse an existing ID for a narrower claim: the legacy coarse pantry,
92
+ * laundry and style definitions remain alongside precise discovery attributes. */
93
+ export declare const PROPERTY_FEATURE_REGISTRY: readonly PropertyFeatureDefinition[];
94
+ export declare function propertyFeature(id: string): PropertyFeatureDefinition | undefined;