@centrali-io/centrali-sdk 8.2.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -29
- package/dist/index.d.ts +4 -72
- package/dist/index.js +3 -52
- package/index.ts +0 -1
- package/package.json +1 -1
- package/src/client.ts +0 -56
- package/src/internal/paths.ts +0 -7
- package/src/managers/records.ts +3 -4
- package/src/types/search.ts +0 -44
package/README.md
CHANGED
|
@@ -35,9 +35,9 @@ const product = await centrali.createRecord('Product', {
|
|
|
35
35
|
|
|
36
36
|
console.log('Created product:', product.data);
|
|
37
37
|
|
|
38
|
-
//
|
|
39
|
-
const results = await centrali.search('Awesome');
|
|
40
|
-
console.log('Found:', results.data.
|
|
38
|
+
// Full-text search within a collection
|
|
39
|
+
const results = await centrali.records.search('Product', 'Awesome');
|
|
40
|
+
console.log('Found:', results.data.length, 'results');
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## Authentication
|
|
@@ -100,7 +100,7 @@ const centrali = new CentraliSDK({
|
|
|
100
100
|
- ✅ **Query operations** - Powerful data querying with filters and sorting
|
|
101
101
|
- ✅ **Saved Queries** - Execute reusable, parameterized queries
|
|
102
102
|
- ✅ **Alerts** - Schedule a saved query and notify people when its result meets a condition
|
|
103
|
-
- ✅ **Full-text search** -
|
|
103
|
+
- ✅ **Full-text search** - `records.search()` / the `text` clause, served by Postgres full-text search
|
|
104
104
|
- ✅ **Realtime events** - Subscribe to record changes via SSE
|
|
105
105
|
- ✅ **Compute functions** - Execute serverless functions
|
|
106
106
|
- ✅ **File uploads** - Upload files to Centrali storage
|
|
@@ -600,36 +600,23 @@ That extra strictness exists because the failure it prevents is invisible. Execu
|
|
|
600
600
|
|
|
601
601
|
### Search
|
|
602
602
|
|
|
603
|
-
|
|
603
|
+
Full-text search is a clause of the records query, served by Postgres full-text search over each record's data. `records.search()` is sugar over `records.query({ text })`; both return the canonical `{ data, meta }` envelope.
|
|
604
604
|
|
|
605
605
|
```typescript
|
|
606
|
-
// Basic search
|
|
607
|
-
const results = await centrali.search('customer email');
|
|
608
|
-
console.log('Found:', results.data.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
structures: 'users'
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
// Search multiple structures with limit
|
|
619
|
-
const multiResults = await centrali.search('active', {
|
|
620
|
-
structures: ['users', 'orders'],
|
|
621
|
-
limit: 50
|
|
606
|
+
// Basic search within a collection
|
|
607
|
+
const results = await centrali.records.search('customers', 'customer email');
|
|
608
|
+
console.log('Found:', results.data.length, 'results', results.meta.hasMore ? '(more available)' : '');
|
|
609
|
+
|
|
610
|
+
// Narrow with a filter (text + where run as one query)
|
|
611
|
+
const openOrders = await centrali.records.query('orders', {
|
|
612
|
+
text: { query: 'urgent' },
|
|
613
|
+
where: { 'data.status': { eq: 'open' } },
|
|
614
|
+
page: { limit: 50, withTotal: true },
|
|
622
615
|
});
|
|
616
|
+
console.log(openOrders.meta.total);
|
|
623
617
|
```
|
|
624
618
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
| Field | Type | Description |
|
|
628
|
-
|-------|------|-------------|
|
|
629
|
-
| `hits` | `SearchHit[]` | Array of matching records |
|
|
630
|
-
| `totalHits` | `number` | Estimated total matches |
|
|
631
|
-
| `processingTimeMs` | `number` | Search time in milliseconds |
|
|
632
|
-
| `query` | `string` | The original search query |
|
|
619
|
+
Matching is prefix-based on the last word (`rac` matches `racks`), without stemming or typo tolerance; results are ranked by relevance unless you pass an explicit `sort`. The workspace-wide `client.search()` and its `{ hits, totalHits }` envelope were removed in 9.0.0 together with the standalone search service.
|
|
633
620
|
|
|
634
621
|
### Realtime Events
|
|
635
622
|
|
package/dist/index.d.ts
CHANGED
|
@@ -140,10 +140,6 @@ declare function getSavedQueryCanonicalTestPath(workspaceId: string): string;
|
|
|
140
140
|
*/
|
|
141
141
|
declare function getAlertDefinitionsApiPath(workspaceId: string): string;
|
|
142
142
|
declare function getAlertDefinitionByIdApiPath(workspaceId: string, alertId: string): string;
|
|
143
|
-
/**
|
|
144
|
-
* Generate Search API URL PATH.
|
|
145
|
-
*/
|
|
146
|
-
declare function getSearchApiPath(workspaceId: string): string;
|
|
147
143
|
/**
|
|
148
144
|
* Generate Anomaly Insights base API URL PATH.
|
|
149
145
|
*/
|
|
@@ -2463,44 +2459,6 @@ interface ComputeJobStatusResponse {
|
|
|
2463
2459
|
failedReason?: string | null;
|
|
2464
2460
|
}
|
|
2465
2461
|
|
|
2466
|
-
/**
|
|
2467
|
-
* Options for searching records.
|
|
2468
|
-
*/
|
|
2469
|
-
interface SearchOptions {
|
|
2470
|
-
/** Filter by structure slug(s). Can be a single slug or array of slugs */
|
|
2471
|
-
structures?: string | string[];
|
|
2472
|
-
/** Filter by collection slug(s). Can be a single slug or array of slugs */
|
|
2473
|
-
collections?: string | string[];
|
|
2474
|
-
/** Maximum number of results to return (default: 20, max: 100) */
|
|
2475
|
-
limit?: number;
|
|
2476
|
-
}
|
|
2477
|
-
/**
|
|
2478
|
-
* A single search result hit.
|
|
2479
|
-
*/
|
|
2480
|
-
interface SearchHit {
|
|
2481
|
-
/** The record ID */
|
|
2482
|
-
id: string;
|
|
2483
|
-
/** The record slug (structure type) */
|
|
2484
|
-
recordSlug: string;
|
|
2485
|
-
/** The structure slug */
|
|
2486
|
-
structureSlug: string;
|
|
2487
|
-
/** The indexed record data */
|
|
2488
|
-
[key: string]: unknown;
|
|
2489
|
-
}
|
|
2490
|
-
/**
|
|
2491
|
-
* Response from a search query.
|
|
2492
|
-
*/
|
|
2493
|
-
interface SearchResponse {
|
|
2494
|
-
/** Array of matching records */
|
|
2495
|
-
hits: SearchHit[];
|
|
2496
|
-
/** Estimated total number of matching records */
|
|
2497
|
-
totalHits: number;
|
|
2498
|
-
/** Time taken to process the search in milliseconds */
|
|
2499
|
-
processingTimeMs: number;
|
|
2500
|
-
/** The original search query */
|
|
2501
|
-
query: string;
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
2462
|
/**
|
|
2505
2463
|
* Anomaly insight types.
|
|
2506
2464
|
*/
|
|
@@ -3756,10 +3714,9 @@ declare class RecordsManager {
|
|
|
3756
3714
|
/**
|
|
3757
3715
|
* Full-text search sugar — equivalent to `query(resource, { text: ... })`.
|
|
3758
3716
|
*
|
|
3759
|
-
*
|
|
3760
|
-
*
|
|
3761
|
-
*
|
|
3762
|
-
* hybrid (`{ data, meta }`).
|
|
3717
|
+
* Runs as Postgres full-text search on the collection's records (one
|
|
3718
|
+
* statement, AND-ed with `where` when set). Result envelope is identical
|
|
3719
|
+
* across pure-filter, pure-text, and hybrid (`{ data, meta }`).
|
|
3763
3720
|
*/
|
|
3764
3721
|
search<T = any>(resource: string, text: string, opts?: {
|
|
3765
3722
|
fields?: string[];
|
|
@@ -6574,31 +6531,6 @@ declare class CentraliSDK {
|
|
|
6574
6531
|
* ```
|
|
6575
6532
|
*/
|
|
6576
6533
|
getFileDownloadUrl(renderId: string): string;
|
|
6577
|
-
/**
|
|
6578
|
-
* Search records across the workspace using full-text search.
|
|
6579
|
-
*
|
|
6580
|
-
* @param query - The search query string
|
|
6581
|
-
* @param options - Optional search parameters
|
|
6582
|
-
* @returns Search results with hits and metadata
|
|
6583
|
-
*
|
|
6584
|
-
* @example
|
|
6585
|
-
* ```ts
|
|
6586
|
-
* // Basic search
|
|
6587
|
-
* const results = await client.search('customer email');
|
|
6588
|
-
* console.log('Found:', results.data.totalHits, 'results');
|
|
6589
|
-
* results.data.hits.forEach(hit => console.log(hit.id, hit.structureSlug));
|
|
6590
|
-
*
|
|
6591
|
-
* // Search with structure filter
|
|
6592
|
-
* const userResults = await client.search('john', { structures: 'users' });
|
|
6593
|
-
*
|
|
6594
|
-
* // Search multiple structures with limit
|
|
6595
|
-
* const results = await client.search('active', {
|
|
6596
|
-
* structures: ['users', 'orders'],
|
|
6597
|
-
* limit: 50
|
|
6598
|
-
* });
|
|
6599
|
-
* ```
|
|
6600
|
-
*/
|
|
6601
|
-
search(query: string, options?: SearchOptions): Promise<ApiResponse<SearchResponse>>;
|
|
6602
6534
|
/**
|
|
6603
6535
|
* Check if an action is authorized for an external token.
|
|
6604
6536
|
*
|
|
@@ -6650,4 +6582,4 @@ declare class CentraliSDK {
|
|
|
6650
6582
|
checkAuthorization(options: CheckAuthorizationOptions): Promise<ApiResponse<AuthorizationResult>>;
|
|
6651
6583
|
}
|
|
6652
6584
|
|
|
6653
|
-
export { type AcceptSuggestionResult, type AddAllowedDomainOptions, type AlertComparisonOp, type AlertCondition, type AlertDefinition, AlertDefinitionsManager, type AlertRecipient, type AllowedDomain, type AllowedDomainsListResponse, AllowedDomainsManager, type AnomalyAnalysisResult, type AnomalyDetectionData, type AnomalyEventType, type AnomalyInsight, type AnomalyInsightData, AnomalyInsightsManager, type ApiResponse, type ArrayPropertyDefinition, AuditLogManager, type AuthorizationResult, type BasePropertyDefinition, type BatchScanResult, type BatchScanStatus, type BooleanPropertyDefinition, type BulkOperationResult, CANONICAL_OPERATORS, type CanonicalOperator, CentraliError, CentraliSDK, type CentraliSDKOptions, type CheckAuthorizationOptions, CollectionsManager, type ComputeEventType, type ComputeFunction, ComputeFunctionsManager, type ComputeJobStatus, type ComputeJobStatusResponse, type ConditionOperator, type CreateAlertDefinitionInput, type CreateComputeFunctionInput, type CreateOrchestrationInput, type CreateSmartQueryInput, type CreateStructureInput, type CreateTriggerInput, type CreateWebhookSubscriptionInput, type DateTimePropertyDefinition, type DateWindowOption, type DeleteRecordOptions, type EmbedCapability, EmbedManager, type EndpointResponse, EventLogEmbed, type EventLogSourceTable, type EventLogSubscribeOptions, type ExecuteSavedQueryValues, type ExecuteSmartQueryOptions, type ExpandOptions, type FieldCondition, type FieldConditionMap, type FileMetadata, FilesManager, type FilterOperators, type FilterValue, type FunctionMemoryUsage, type FunctionRun, type FunctionRunError, type FunctionRunExecutionSource, type FunctionRunStatus, FunctionRunsManager, type FunctionTrigger, type GetRecordOptions, type IncludeClause, type InsightSeverity, type InsightStatus, type InsightType, type InsightsSummary, type InvokeEndpointOptions, type InvokeTriggerOptions, type IssueEmbedTokenInput, type IssueEmbedTokenResult, JOINS_MAX_LENGTH, type JoinClause, type JoinType, type LegacyTranslateOptions, type LegacyTranslateResult, type LegacyTranslateWarning, type ListAlertDefinitionsOptions, type ListAllTriggersOptions, type ListCollectionsOptions, type ListComputeFunctionsOptions, type ListFunctionRunsOptions, type ListInsightsOptions, type ListOrchestrationRunsOptions, type ListOrchestrationsOptions, type ListSmartQueryOptions, type ListStructuresOptions, type ListValidationSuggestionsOptions, type ListWebhookDeliveriesOptions, type NumberPropertyDefinition, OPERATOR_METADATA, type ObjectPropertyDefinition, type OperatorMeta, type OperatorTypeApplicability, type OperatorValueShape, type Orchestration, type OrchestrationCaseEvaluation, type OrchestrationCondition, type OrchestrationConditionEvaluation, type OrchestrationDecisionCase, type OrchestrationDecisionResult, type OrchestrationDelayConfig, type OrchestrationEventType, type OrchestrationFailureReason, type OrchestrationOnFailure, type OrchestrationOnSuccess, type OrchestrationRetryConfig, type OrchestrationRun, type OrchestrationRunStatus, type OrchestrationRunStep, OrchestrationRunsManager, type OrchestrationScheduleType, type OrchestrationStatus, type OrchestrationStep, type OrchestrationStepError, type OrchestrationStepStatus, type OrchestrationStepType, type OrchestrationTrigger, type OrchestrationTriggerMetadata, type OrchestrationTriggerType, OrchestrationsManager, type PageClause, type PaginatedResponse, type ParsedUrlQuery, type PropertyDefinition, type PropertyType, type QueryDefinition, type QueryError, type QueryErrorCode, type QueryExecutionMode, type QueryHttpError, type QueryHttpErrorCode, QueryManager, type QueryRecordOptions, type QueryResult, type QueryResultMeta, type QueryValidateOptions, type QueryVariableDefinition, RECORDS_PAGE_DEFAULT_LIMIT, RECORDS_PAGE_MAX_LIMIT, type RealtimeAnomalyDetectionEvent, type RealtimeAnomalyInsightEvent, type RealtimeCloseEvent, type RealtimeError, type RealtimeEvent, type RealtimeEventLogEntry, type RealtimeEventType, type RealtimeFunctionRunEvent, RealtimeManager, type RealtimeOrchestrationRunEvent, type RealtimeRecordEvent, type RealtimeSubscribeOptions, type RealtimeSubscription, type RealtimeValidationBatchEvent, type RealtimeValidationSuggestionEvent, type RecordEventType, RecordEvents, type RecordTtlOptions, RecordsManager, type ReferencePropertyDefinition, type ResourceCategory, type RevokeEmbedSessionInput, type RevokeEmbedSessionResult, type SavedQueryDefinition, type SavedQueryScalarBinding, type ScalarValue, type SchemaDiscoveryMode, type
|
|
6585
|
+
export { type AcceptSuggestionResult, type AddAllowedDomainOptions, type AlertComparisonOp, type AlertCondition, type AlertDefinition, AlertDefinitionsManager, type AlertRecipient, type AllowedDomain, type AllowedDomainsListResponse, AllowedDomainsManager, type AnomalyAnalysisResult, type AnomalyDetectionData, type AnomalyEventType, type AnomalyInsight, type AnomalyInsightData, AnomalyInsightsManager, type ApiResponse, type ArrayPropertyDefinition, AuditLogManager, type AuthorizationResult, type BasePropertyDefinition, type BatchScanResult, type BatchScanStatus, type BooleanPropertyDefinition, type BulkOperationResult, CANONICAL_OPERATORS, type CanonicalOperator, CentraliError, CentraliSDK, type CentraliSDKOptions, type CheckAuthorizationOptions, CollectionsManager, type ComputeEventType, type ComputeFunction, ComputeFunctionsManager, type ComputeJobStatus, type ComputeJobStatusResponse, type ConditionOperator, type CreateAlertDefinitionInput, type CreateComputeFunctionInput, type CreateOrchestrationInput, type CreateSmartQueryInput, type CreateStructureInput, type CreateTriggerInput, type CreateWebhookSubscriptionInput, type DateTimePropertyDefinition, type DateWindowOption, type DeleteRecordOptions, type EmbedCapability, EmbedManager, type EndpointResponse, EventLogEmbed, type EventLogSourceTable, type EventLogSubscribeOptions, type ExecuteSavedQueryValues, type ExecuteSmartQueryOptions, type ExpandOptions, type FieldCondition, type FieldConditionMap, type FileMetadata, FilesManager, type FilterOperators, type FilterValue, type FunctionMemoryUsage, type FunctionRun, type FunctionRunError, type FunctionRunExecutionSource, type FunctionRunStatus, FunctionRunsManager, type FunctionTrigger, type GetRecordOptions, type IncludeClause, type InsightSeverity, type InsightStatus, type InsightType, type InsightsSummary, type InvokeEndpointOptions, type InvokeTriggerOptions, type IssueEmbedTokenInput, type IssueEmbedTokenResult, JOINS_MAX_LENGTH, type JoinClause, type JoinType, type LegacyTranslateOptions, type LegacyTranslateResult, type LegacyTranslateWarning, type ListAlertDefinitionsOptions, type ListAllTriggersOptions, type ListCollectionsOptions, type ListComputeFunctionsOptions, type ListFunctionRunsOptions, type ListInsightsOptions, type ListOrchestrationRunsOptions, type ListOrchestrationsOptions, type ListSmartQueryOptions, type ListStructuresOptions, type ListValidationSuggestionsOptions, type ListWebhookDeliveriesOptions, type NumberPropertyDefinition, OPERATOR_METADATA, type ObjectPropertyDefinition, type OperatorMeta, type OperatorTypeApplicability, type OperatorValueShape, type Orchestration, type OrchestrationCaseEvaluation, type OrchestrationCondition, type OrchestrationConditionEvaluation, type OrchestrationDecisionCase, type OrchestrationDecisionResult, type OrchestrationDelayConfig, type OrchestrationEventType, type OrchestrationFailureReason, type OrchestrationOnFailure, type OrchestrationOnSuccess, type OrchestrationRetryConfig, type OrchestrationRun, type OrchestrationRunStatus, type OrchestrationRunStep, OrchestrationRunsManager, type OrchestrationScheduleType, type OrchestrationStatus, type OrchestrationStep, type OrchestrationStepError, type OrchestrationStepStatus, type OrchestrationStepType, type OrchestrationTrigger, type OrchestrationTriggerMetadata, type OrchestrationTriggerType, OrchestrationsManager, type PageClause, type PaginatedResponse, type ParsedUrlQuery, type PropertyDefinition, type PropertyType, type QueryDefinition, type QueryError, type QueryErrorCode, type QueryExecutionMode, type QueryHttpError, type QueryHttpErrorCode, QueryManager, type QueryRecordOptions, type QueryResult, type QueryResultMeta, type QueryValidateOptions, type QueryVariableDefinition, RECORDS_PAGE_DEFAULT_LIMIT, RECORDS_PAGE_MAX_LIMIT, type RealtimeAnomalyDetectionEvent, type RealtimeAnomalyInsightEvent, type RealtimeCloseEvent, type RealtimeError, type RealtimeEvent, type RealtimeEventLogEntry, type RealtimeEventType, type RealtimeFunctionRunEvent, RealtimeManager, type RealtimeOrchestrationRunEvent, type RealtimeRecordEvent, type RealtimeSubscribeOptions, type RealtimeSubscription, type RealtimeValidationBatchEvent, type RealtimeValidationSuggestionEvent, type RecordEventType, RecordEvents, type RecordTtlOptions, RecordsManager, type ReferencePropertyDefinition, type ResourceCategory, type RevokeEmbedSessionInput, type RevokeEmbedSessionResult, type SavedQueryDefinition, type SavedQueryScalarBinding, type ScalarValue, type SchemaDiscoveryMode, type SelectClause, SmartQueriesManager, type SmartQuery, type SmartQueryDefinition, type SmartQueryExecuteResult, type SmartQueryFieldCondition, type SmartQueryJoin, type SmartQuerySort, type SmartQueryWhereClause, type SortClause, type StepEncryptedParam, type StringPropertyDefinition, type Structure, StructuresManager, type TestComputeFunctionInput, type TestComputeFunctionResult, type TestSmartQueryInput, type TextSearchClause, type TriggerExecutionType, type TriggerHealthMetrics, type TriggerHealthStatus, type TriggerInvokeResponse, type TriggerOrchestrationRunOptions, type TriggerScanOptions, type TriggerWithHealth, TriggersManager, type UpdateAlertDefinitionInput, type UpdateComputeFunctionInput, type UpdateOrchestrationInput, type UpdateSmartQueryInput, type UpdateStructureInput, type UpdateTriggerInput, type UpdateWebhookSubscriptionInput, type UrlParserOptions, type ValidateStructureInput, type ValidationBatchData, type ValidationEventType, type ValidationIssueType, ValidationManager, type ValidationResult, type ValidationSuggestion, type ValidationSuggestionData, type ValidationSuggestionStatus, type ValidationSummary, type VariableType, type WaitForScanOptions, type WebhookCancelResponse, type WebhookDeliveriesListMeta, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookDeliverySummary, type WebhookPayloadVersions, type WebhookReplayResponse, type WebhookSubscription, WebhookSubscriptionsManager, type WhereExpression, fetchClientToken, getAlertDefinitionByIdApiPath, getAlertDefinitionsApiPath, getAllowedDomainsApiPath, getAnomalyAnalysisTriggerApiPath, getAnomalyInsightAcknowledgeApiPath, getAnomalyInsightDismissApiPath, getAnomalyInsightsApiPath, getAnomalyInsightsBulkAcknowledgeApiPath, getAnomalyInsightsSummaryApiPath, getApiUrl, getAuthUrl, getCollectionBySlugApiPath, getCollectionInsightsApiPath, getCollectionValidateApiPath, getCollectionsApiPath, getComputeFunctionTestApiPath, getComputeFunctionsApiPath, getComputeJobStatusApiPath, getEndpointApiPath, getFileUploadApiPath, getFilesCanonicalApiPath, getFunctionRunsApiPath, getFunctionRunsByFunctionApiPath, getFunctionRunsByTriggerApiPath, getFunctionTriggerExecuteApiPath, getFunctionTriggerPauseApiPath, getFunctionTriggerResumeApiPath, getFunctionTriggersApiPath, getOrchestrationRunStepsApiPath, getOrchestrationRunsApiPath, getOrchestrationRunsCanonicalApiPath, getOrchestrationsApiPath, getRealtimeUrl, getRecordApiPath, getSavedQueryCanonicalByIdPath, getSavedQueryCanonicalCollectionPath, getSavedQueryCanonicalExecutePath, getSavedQueryCanonicalTestPath, getSmartQueriesApiPath, getSmartQueriesStructureApiPath, getSmartQueryByNameApiPath, getSmartQueryExecuteApiPath, getSmartQueryTestApiPath, getStructureBySlugApiPath, getStructureInsightsApiPath, getStructureValidateApiPath, getStructuresApiPath, getValidationBulkAcceptApiPath, getValidationBulkRejectApiPath, getValidationPendingCountApiPath, getValidationRecordSuggestionsApiPath, getValidationScanApiPath, getValidationSuggestionAcceptApiPath, getValidationSuggestionRejectApiPath, getValidationSuggestionsApiPath, getValidationSummaryApiPath, getWebhookDeliveryCancelApiPath, getWebhookDeliveryRetryApiPath, getWebhookPayloadVersionsApiPath, getWebhookSubscriptionDeliveriesApiPath, getWebhookSubscriptionRotateSecretApiPath, getWebhookSubscriptionsApiPath, isCentraliError, operatorsForFieldType };
|
package/dist/index.js
CHANGED
|
@@ -134,7 +134,6 @@ __export(index_exports, {
|
|
|
134
134
|
getSavedQueryCanonicalCollectionPath: () => getSavedQueryCanonicalCollectionPath,
|
|
135
135
|
getSavedQueryCanonicalExecutePath: () => getSavedQueryCanonicalExecutePath,
|
|
136
136
|
getSavedQueryCanonicalTestPath: () => getSavedQueryCanonicalTestPath,
|
|
137
|
-
getSearchApiPath: () => getSearchApiPath,
|
|
138
137
|
getSmartQueriesApiPath: () => getSmartQueriesApiPath,
|
|
139
138
|
getSmartQueriesStructureApiPath: () => getSmartQueriesStructureApiPath,
|
|
140
139
|
getSmartQueryByNameApiPath: () => getSmartQueryByNameApiPath,
|
|
@@ -274,9 +273,6 @@ function getAlertDefinitionsApiPath(workspaceId) {
|
|
|
274
273
|
function getAlertDefinitionByIdApiPath(workspaceId, alertId) {
|
|
275
274
|
return `data/workspace/${workspaceId}/api/v1/alert-definitions/${alertId}`;
|
|
276
275
|
}
|
|
277
|
-
function getSearchApiPath(workspaceId) {
|
|
278
|
-
return `search/workspace/${workspaceId}/api/v1/records/search`;
|
|
279
|
-
}
|
|
280
276
|
function getAnomalyInsightsApiPath(workspaceId, insightId) {
|
|
281
277
|
const basePath = `data/workspace/${workspaceId}/api/v1/ai/insights`;
|
|
282
278
|
return insightId ? `${basePath}/${insightId}` : basePath;
|
|
@@ -6451,10 +6447,9 @@ var RecordsManager = class {
|
|
|
6451
6447
|
/**
|
|
6452
6448
|
* Full-text search sugar — equivalent to `query(resource, { text: ... })`.
|
|
6453
6449
|
*
|
|
6454
|
-
*
|
|
6455
|
-
*
|
|
6456
|
-
*
|
|
6457
|
-
* hybrid (`{ data, meta }`).
|
|
6450
|
+
* Runs as Postgres full-text search on the collection's records (one
|
|
6451
|
+
* statement, AND-ed with `where` when set). Result envelope is identical
|
|
6452
|
+
* across pure-filter, pure-text, and hybrid (`{ data, meta }`).
|
|
6458
6453
|
*/
|
|
6459
6454
|
search(resource, text, opts) {
|
|
6460
6455
|
return __async(this, null, function* () {
|
|
@@ -9464,49 +9459,6 @@ var CentraliSDK = class {
|
|
|
9464
9459
|
const apiUrl = getApiUrl(this.options.baseUrl);
|
|
9465
9460
|
return `${apiUrl}/storage/ws/${this.options.workspaceId}/api/v1/download/${renderId}`;
|
|
9466
9461
|
}
|
|
9467
|
-
// ------------------ Search API Methods ------------------
|
|
9468
|
-
/**
|
|
9469
|
-
* Search records across the workspace using full-text search.
|
|
9470
|
-
*
|
|
9471
|
-
* @param query - The search query string
|
|
9472
|
-
* @param options - Optional search parameters
|
|
9473
|
-
* @returns Search results with hits and metadata
|
|
9474
|
-
*
|
|
9475
|
-
* @example
|
|
9476
|
-
* ```ts
|
|
9477
|
-
* // Basic search
|
|
9478
|
-
* const results = await client.search('customer email');
|
|
9479
|
-
* console.log('Found:', results.data.totalHits, 'results');
|
|
9480
|
-
* results.data.hits.forEach(hit => console.log(hit.id, hit.structureSlug));
|
|
9481
|
-
*
|
|
9482
|
-
* // Search with structure filter
|
|
9483
|
-
* const userResults = await client.search('john', { structures: 'users' });
|
|
9484
|
-
*
|
|
9485
|
-
* // Search multiple structures with limit
|
|
9486
|
-
* const results = await client.search('active', {
|
|
9487
|
-
* structures: ['users', 'orders'],
|
|
9488
|
-
* limit: 50
|
|
9489
|
-
* });
|
|
9490
|
-
* ```
|
|
9491
|
-
*/
|
|
9492
|
-
search(query, options) {
|
|
9493
|
-
return __async(this, null, function* () {
|
|
9494
|
-
const path = getSearchApiPath(this.options.workspaceId);
|
|
9495
|
-
const queryParams = { q: query };
|
|
9496
|
-
if (options == null ? void 0 : options.collections) {
|
|
9497
|
-
const collections = Array.isArray(options.collections) ? options.collections.join(",") : options.collections;
|
|
9498
|
-
queryParams.collections = collections;
|
|
9499
|
-
} else if (options == null ? void 0 : options.structures) {
|
|
9500
|
-
emitDeprecationWarning("The 'structures' search option is deprecated. Use 'collections' instead.");
|
|
9501
|
-
const structures = Array.isArray(options.structures) ? options.structures.join(",") : options.structures;
|
|
9502
|
-
queryParams.collections = structures;
|
|
9503
|
-
}
|
|
9504
|
-
if (options == null ? void 0 : options.limit) {
|
|
9505
|
-
queryParams.limit = String(options.limit);
|
|
9506
|
-
}
|
|
9507
|
-
return this.request("GET", path, null, queryParams);
|
|
9508
|
-
});
|
|
9509
|
-
}
|
|
9510
9462
|
// ------------------ Authorization API Methods (BYOT) ------------------
|
|
9511
9463
|
/**
|
|
9512
9464
|
* Check if an action is authorized for an external token.
|
|
@@ -9654,7 +9606,6 @@ var CentraliSDK = class {
|
|
|
9654
9606
|
getSavedQueryCanonicalCollectionPath,
|
|
9655
9607
|
getSavedQueryCanonicalExecutePath,
|
|
9656
9608
|
getSavedQueryCanonicalTestPath,
|
|
9657
|
-
getSearchApiPath,
|
|
9658
9609
|
getSmartQueriesApiPath,
|
|
9659
9610
|
getSmartQueriesStructureApiPath,
|
|
9660
9611
|
getSmartQueryByNameApiPath,
|
package/index.ts
CHANGED
|
@@ -27,7 +27,6 @@ export * from './src/types/orchestrations';
|
|
|
27
27
|
export * from './src/types/smartQueries';
|
|
28
28
|
export * from './src/types/structures';
|
|
29
29
|
export * from './src/types/compute';
|
|
30
|
-
export * from './src/types/search';
|
|
31
30
|
export * from './src/types/insights';
|
|
32
31
|
export * from './src/types/alertDefinitions';
|
|
33
32
|
export * from './src/types/validation';
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -10,13 +10,11 @@ import { isCanonicalQueryDefinition } from './internal/queryGuard';
|
|
|
10
10
|
import {
|
|
11
11
|
getRecordApiPath,
|
|
12
12
|
getFileUploadApiPath,
|
|
13
|
-
getSearchApiPath,
|
|
14
13
|
} from './internal/paths';
|
|
15
14
|
|
|
16
15
|
import type { CentraliSDKOptions, ApiResponse } from './types/common';
|
|
17
16
|
import type { CheckAuthorizationOptions, AuthorizationResult } from './types/auth';
|
|
18
17
|
import type { DeleteRecordOptions, RecordTtlOptions, GetRecordOptions, QueryRecordOptions } from './types/records';
|
|
19
|
-
import type { SearchOptions, SearchResponse } from './types/search';
|
|
20
18
|
import type { QueryDefinition, QueryResult } from '../query-types';
|
|
21
19
|
|
|
22
20
|
import { RealtimeManager } from './realtime/manager';
|
|
@@ -1420,60 +1418,6 @@ export class CentraliSDK {
|
|
|
1420
1418
|
return `${apiUrl}/storage/ws/${this.options.workspaceId}/api/v1/download/${renderId}`;
|
|
1421
1419
|
}
|
|
1422
1420
|
|
|
1423
|
-
// ------------------ Search API Methods ------------------
|
|
1424
|
-
|
|
1425
|
-
/**
|
|
1426
|
-
* Search records across the workspace using full-text search.
|
|
1427
|
-
*
|
|
1428
|
-
* @param query - The search query string
|
|
1429
|
-
* @param options - Optional search parameters
|
|
1430
|
-
* @returns Search results with hits and metadata
|
|
1431
|
-
*
|
|
1432
|
-
* @example
|
|
1433
|
-
* ```ts
|
|
1434
|
-
* // Basic search
|
|
1435
|
-
* const results = await client.search('customer email');
|
|
1436
|
-
* console.log('Found:', results.data.totalHits, 'results');
|
|
1437
|
-
* results.data.hits.forEach(hit => console.log(hit.id, hit.structureSlug));
|
|
1438
|
-
*
|
|
1439
|
-
* // Search with structure filter
|
|
1440
|
-
* const userResults = await client.search('john', { structures: 'users' });
|
|
1441
|
-
*
|
|
1442
|
-
* // Search multiple structures with limit
|
|
1443
|
-
* const results = await client.search('active', {
|
|
1444
|
-
* structures: ['users', 'orders'],
|
|
1445
|
-
* limit: 50
|
|
1446
|
-
* });
|
|
1447
|
-
* ```
|
|
1448
|
-
*/
|
|
1449
|
-
public async search(
|
|
1450
|
-
query: string,
|
|
1451
|
-
options?: SearchOptions
|
|
1452
|
-
): Promise<ApiResponse<SearchResponse>> {
|
|
1453
|
-
const path = getSearchApiPath(this.options.workspaceId);
|
|
1454
|
-
|
|
1455
|
-
const queryParams: Record<string, string> = { q: query };
|
|
1456
|
-
|
|
1457
|
-
if (options?.collections) {
|
|
1458
|
-
const collections = Array.isArray(options.collections)
|
|
1459
|
-
? options.collections.join(',')
|
|
1460
|
-
: options.collections;
|
|
1461
|
-
queryParams.collections = collections;
|
|
1462
|
-
} else if (options?.structures) {
|
|
1463
|
-
emitDeprecationWarning("The 'structures' search option is deprecated. Use 'collections' instead.");
|
|
1464
|
-
const structures = Array.isArray(options.structures)
|
|
1465
|
-
? options.structures.join(',')
|
|
1466
|
-
: options.structures;
|
|
1467
|
-
queryParams.collections = structures;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
if (options?.limit) {
|
|
1471
|
-
queryParams.limit = String(options.limit);
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
return this.request<SearchResponse>('GET', path, null, queryParams);
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
1421
|
// ------------------ Authorization API Methods (BYOT) ------------------
|
|
1478
1422
|
|
|
1479
1423
|
/**
|
package/src/internal/paths.ts
CHANGED
|
@@ -125,13 +125,6 @@ export function getAlertDefinitionByIdApiPath(workspaceId: string, alertId: stri
|
|
|
125
125
|
return `data/workspace/${workspaceId}/api/v1/alert-definitions/${alertId}`;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
/**
|
|
129
|
-
* Generate Search API URL PATH.
|
|
130
|
-
*/
|
|
131
|
-
export function getSearchApiPath(workspaceId: string): string {
|
|
132
|
-
return `search/workspace/${workspaceId}/api/v1/records/search`;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
128
|
/**
|
|
136
129
|
* Generate Anomaly Insights base API URL PATH.
|
|
137
130
|
*/
|
package/src/managers/records.ts
CHANGED
|
@@ -157,10 +157,9 @@ export class RecordsManager {
|
|
|
157
157
|
/**
|
|
158
158
|
* Full-text search sugar — equivalent to `query(resource, { text: ... })`.
|
|
159
159
|
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* hybrid (`{ data, meta }`).
|
|
160
|
+
* Runs as Postgres full-text search on the collection's records (one
|
|
161
|
+
* statement, AND-ed with `where` when set). Result envelope is identical
|
|
162
|
+
* across pure-filter, pure-text, and hybrid (`{ data, meta }`).
|
|
164
163
|
*/
|
|
165
164
|
public async search<T = any>(
|
|
166
165
|
resource: string,
|
package/src/types/search.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// =====================================================
|
|
2
|
-
// Search Types
|
|
3
|
-
// =====================================================
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Options for searching records.
|
|
7
|
-
*/
|
|
8
|
-
export interface SearchOptions {
|
|
9
|
-
/** Filter by structure slug(s). Can be a single slug or array of slugs */
|
|
10
|
-
structures?: string | string[];
|
|
11
|
-
/** Filter by collection slug(s). Can be a single slug or array of slugs */
|
|
12
|
-
collections?: string | string[];
|
|
13
|
-
/** Maximum number of results to return (default: 20, max: 100) */
|
|
14
|
-
limit?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A single search result hit.
|
|
19
|
-
*/
|
|
20
|
-
export interface SearchHit {
|
|
21
|
-
/** The record ID */
|
|
22
|
-
id: string;
|
|
23
|
-
/** The record slug (structure type) */
|
|
24
|
-
recordSlug: string;
|
|
25
|
-
/** The structure slug */
|
|
26
|
-
structureSlug: string;
|
|
27
|
-
/** The indexed record data */
|
|
28
|
-
[key: string]: unknown;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Response from a search query.
|
|
33
|
-
*/
|
|
34
|
-
export interface SearchResponse {
|
|
35
|
-
/** Array of matching records */
|
|
36
|
-
hits: SearchHit[];
|
|
37
|
-
/** Estimated total number of matching records */
|
|
38
|
-
totalHits: number;
|
|
39
|
-
/** Time taken to process the search in milliseconds */
|
|
40
|
-
processingTimeMs: number;
|
|
41
|
-
/** The original search query */
|
|
42
|
-
query: string;
|
|
43
|
-
}
|
|
44
|
-
|