@centrali-io/centrali-sdk 5.5.1 → 6.0.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 +164 -14
- package/dist/index.d.ts +1807 -878
- package/dist/index.js +9153 -4076
- package/index.ts +61 -7152
- package/package.json +10 -3
- package/query-types.ts +83 -2
- package/scripts/smoke-types.ts +145 -5
- package/src/client.ts +1507 -0
- package/src/internal/auth.ts +35 -0
- package/src/internal/deprecation.ts +11 -0
- package/src/internal/error.ts +90 -0
- package/src/internal/paths.ts +456 -0
- package/src/internal/queryGuard.ts +21 -0
- package/src/managers/allowedDomains.ts +90 -0
- package/src/managers/anomalyInsights.ts +215 -0
- package/src/managers/auditLog.ts +105 -0
- package/src/managers/collections.ts +197 -0
- package/src/managers/files.ts +182 -0
- package/src/managers/functionRuns.ts +229 -0
- package/src/managers/functions.ts +171 -0
- package/src/managers/orchestrationRuns.ts +122 -0
- package/src/managers/orchestrations.ts +297 -0
- package/src/managers/query.ts +199 -0
- package/src/managers/records.ts +186 -0
- package/src/managers/smartQueries.ts +374 -0
- package/src/managers/structures.ts +205 -0
- package/src/managers/triggers.ts +349 -0
- package/src/managers/validation.ts +303 -0
- package/src/managers/webhookSubscriptions.ts +206 -0
- package/src/realtime/manager.ts +292 -0
- package/src/types/allowedDomains.ts +29 -0
- package/src/types/auth.ts +83 -0
- package/src/types/common.ts +57 -0
- package/src/types/compute.ts +145 -0
- package/src/types/insights.ts +113 -0
- package/src/types/orchestrations.ts +460 -0
- package/src/types/realtime.ts +403 -0
- package/src/types/records.ts +261 -0
- package/src/types/search.ts +44 -0
- package/src/types/smartQueries.ts +303 -0
- package/src/types/structures.ts +203 -0
- package/src/types/triggers.ts +122 -0
- package/src/types/validation.ts +167 -0
- package/src/types/webhooks.ts +114 -0
- package/src/urls.ts +33 -0
- package/dist/query-types.d.ts +0 -187
- package/dist/query-types.js +0 -137
- package/dist/scripts/smoke-types.d.ts +0 -12
- package/dist/scripts/smoke-types.js +0 -102
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Type-only smoke for the canonical query surface added in 5.5.0 (CEN-1194).
|
|
4
|
-
*
|
|
5
|
-
* Runs as part of `npm run build` because it lives in the same project as
|
|
6
|
-
* `index.ts`. Compiling means the canonical types and new methods type-check
|
|
7
|
-
* end-to-end. There is no runtime assertion — when the SDK has a real test
|
|
8
|
-
* harness (separate ticket), these calls will turn into integration tests.
|
|
9
|
-
*
|
|
10
|
-
* To run manually:
|
|
11
|
-
* npx tsc --noEmit scripts/smoke-types.ts
|
|
12
|
-
*/
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
const index_1 = require("../index");
|
|
24
|
-
// ---- Canonical type ergonomics ----
|
|
25
|
-
const _operators = index_1.CANONICAL_OPERATORS;
|
|
26
|
-
const _defaultLimit = index_1.RECORDS_PAGE_DEFAULT_LIMIT;
|
|
27
|
-
const _maxLimit = index_1.RECORDS_PAGE_MAX_LIMIT;
|
|
28
|
-
const _eqOnly = { eq: 'paid' };
|
|
29
|
-
// Uncommenting the next line MUST fail to compile (exactly-one-operator rule):
|
|
30
|
-
// const _twoOps: FieldCondition = { eq: 'paid', ne: 'cancelled' };
|
|
31
|
-
const _where = {
|
|
32
|
-
and: [
|
|
33
|
-
{ 'data.status': { eq: 'open' } },
|
|
34
|
-
{ or: [
|
|
35
|
-
{ 'data.amount': { gte: 100 } },
|
|
36
|
-
{ 'data.priority': { eq: 'high' } }
|
|
37
|
-
] },
|
|
38
|
-
{ not: { 'data.archived': { eq: true } } }
|
|
39
|
-
]
|
|
40
|
-
};
|
|
41
|
-
const _sort = [
|
|
42
|
-
{ field: 'createdAt', direction: 'desc' },
|
|
43
|
-
{ field: 'data.amount', direction: 'asc' }
|
|
44
|
-
];
|
|
45
|
-
const _pageOffset = { limit: 50, offset: 100 };
|
|
46
|
-
const _pageCursor = { limit: 50, cursor: 'abc' };
|
|
47
|
-
// Uncommenting must fail (offset and cursor are mutually exclusive):
|
|
48
|
-
// const _pageBoth: PageClause = { limit: 50, offset: 0, cursor: 'abc' };
|
|
49
|
-
const _select = { fields: ['id', 'data.status', 'data.customer'] };
|
|
50
|
-
const _def = {
|
|
51
|
-
resource: 'orders',
|
|
52
|
-
where: _where,
|
|
53
|
-
sort: _sort,
|
|
54
|
-
page: _pageOffset,
|
|
55
|
-
select: _select,
|
|
56
|
-
};
|
|
57
|
-
function exerciseSdk() {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
const client = new index_1.CentraliSDK({
|
|
60
|
-
baseUrl: 'http://localhost',
|
|
61
|
-
workspaceId: 'demo',
|
|
62
|
-
token: 'test',
|
|
63
|
-
});
|
|
64
|
-
// RecordsManager.query → QueryResult<T>
|
|
65
|
-
const r1 = yield client.records.query('orders', _def);
|
|
66
|
-
console.log(r1.data.length, r1.meta.limit);
|
|
67
|
-
// Resource backfill — caller can omit `resource` and we fill it from arg1
|
|
68
|
-
yield client.records.query('orders', { where: _where });
|
|
69
|
-
// RecordsManager.test → QueryResult<T>
|
|
70
|
-
yield client.records.test('orders', { resource: 'orders' });
|
|
71
|
-
// RecordsManager.list → ApiResponse<T[]> (legacy GET adapter envelope kept)
|
|
72
|
-
const r2 = yield client.records.list('orders', {
|
|
73
|
-
'data.status': 'paid',
|
|
74
|
-
sort: '-createdAt',
|
|
75
|
-
});
|
|
76
|
-
console.log(r2.data.length);
|
|
77
|
-
// RecordsManager.search — text sugar, returns QueryResult<T>
|
|
78
|
-
const r3 = yield client.records.search('orders', 'urgent shipping', {
|
|
79
|
-
page: { limit: 25 },
|
|
80
|
-
});
|
|
81
|
-
console.log(r3.data, r3.meta.mode);
|
|
82
|
-
// (Saved-query SDK surface — `client.savedQueries` — is deliberately not
|
|
83
|
-
// shipped in 5.5.0. The /saved-queries/* HTTP routes are Phase 4 work
|
|
84
|
-
// tracked in CEN-1198; the canonical SDK manager lands alongside them.
|
|
85
|
-
// Today's `client.smartQueries` namespace is the supported way to call
|
|
86
|
-
// saved queries from the SDK.)
|
|
87
|
-
// Top-level canonical overload
|
|
88
|
-
const r4 = yield client.queryRecords('orders', {
|
|
89
|
-
resource: 'orders',
|
|
90
|
-
where: { 'data.status': { eq: 'paid' } },
|
|
91
|
-
page: { limit: 100 },
|
|
92
|
-
});
|
|
93
|
-
console.log(r4.data, r4.meta);
|
|
94
|
-
// Legacy GET-adapter form still type-checks (and emits a one-shot warn at runtime)
|
|
95
|
-
const r5 = yield client.queryRecords('orders', {
|
|
96
|
-
'data.status': 'paid',
|
|
97
|
-
sort: '-createdAt',
|
|
98
|
-
});
|
|
99
|
-
console.log(r5.data);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
void exerciseSdk;
|