industrial-model 0.11.2 → 0.12.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 +17 -0
- package/dist/calculator/index.cjs +892 -0
- package/dist/calculator/index.cjs.map +1 -0
- package/dist/calculator/index.d.cts +250 -0
- package/dist/calculator/index.d.ts +250 -0
- package/dist/calculator/index.js +879 -0
- package/dist/calculator/index.js.map +1 -0
- package/dist/cli/index.cjs +191 -169
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cognite-core/index.cjs +85 -14
- package/dist/cognite-core/index.cjs.map +1 -1
- package/dist/cognite-core/index.d.cts +1 -1
- package/dist/cognite-core/index.d.ts +1 -1
- package/dist/cognite-core/index.js +85 -14
- package/dist/cognite-core/index.js.map +1 -1
- package/dist/index.cjs +84 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +84 -14
- package/dist/index.js.map +1 -1
- package/dist/{types-69DRhgww.d.cts → types-CFkHwXW6.d.cts} +362 -1
- package/dist/{types-69DRhgww.d.ts → types-CFkHwXW6.d.ts} +362 -1
- package/package.json +18 -2
|
@@ -1,3 +1,188 @@
|
|
|
1
|
+
interface ViewReference {
|
|
2
|
+
type: "view";
|
|
3
|
+
space: string;
|
|
4
|
+
externalId: string;
|
|
5
|
+
version: string;
|
|
6
|
+
}
|
|
7
|
+
interface ViewPropertyType {
|
|
8
|
+
type?: string;
|
|
9
|
+
source?: ViewReference;
|
|
10
|
+
list?: boolean;
|
|
11
|
+
values?: Record<string, {
|
|
12
|
+
name?: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
interface ViewPropertyDefinition {
|
|
16
|
+
container: unknown;
|
|
17
|
+
containerPropertyIdentifier: string;
|
|
18
|
+
type: ViewPropertyType;
|
|
19
|
+
nullable?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface ReverseDirectRelationConnection {
|
|
22
|
+
through: {
|
|
23
|
+
source: ViewReference;
|
|
24
|
+
identifier: string;
|
|
25
|
+
};
|
|
26
|
+
source: ViewReference;
|
|
27
|
+
connectionType?: string;
|
|
28
|
+
targetsList?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface EdgeConnection {
|
|
31
|
+
type: unknown;
|
|
32
|
+
source: ViewReference;
|
|
33
|
+
direction?: "outwards" | "inwards";
|
|
34
|
+
}
|
|
35
|
+
type ViewDefinitionProperty = ViewPropertyDefinition | ReverseDirectRelationConnection | EdgeConnection;
|
|
36
|
+
interface ViewDefinition {
|
|
37
|
+
space: string;
|
|
38
|
+
externalId: string;
|
|
39
|
+
version: string;
|
|
40
|
+
properties: Record<string, ViewDefinitionProperty>;
|
|
41
|
+
}
|
|
42
|
+
type FilterDefinition = {
|
|
43
|
+
and: FilterDefinition[];
|
|
44
|
+
} | {
|
|
45
|
+
or: FilterDefinition[];
|
|
46
|
+
} | {
|
|
47
|
+
not: FilterDefinition;
|
|
48
|
+
} | {
|
|
49
|
+
equals: {
|
|
50
|
+
property: string[];
|
|
51
|
+
value: string | number | boolean;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
in: {
|
|
55
|
+
property: string[];
|
|
56
|
+
values: (string | number | boolean)[];
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
range: {
|
|
60
|
+
property: string[];
|
|
61
|
+
gt?: number | string;
|
|
62
|
+
gte?: number | string;
|
|
63
|
+
lt?: number | string;
|
|
64
|
+
lte?: number | string;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
exists: {
|
|
68
|
+
property: string[];
|
|
69
|
+
};
|
|
70
|
+
} | {
|
|
71
|
+
prefix: {
|
|
72
|
+
property: string[];
|
|
73
|
+
value: string;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
containsAll: {
|
|
77
|
+
property: string[];
|
|
78
|
+
values: (string | number | boolean)[];
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
containsAny: {
|
|
82
|
+
property: string[];
|
|
83
|
+
values: (string | number | boolean)[];
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
nested: {
|
|
87
|
+
scope: string[];
|
|
88
|
+
filter: FilterDefinition;
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
instanceReferences: Array<{
|
|
92
|
+
space: string;
|
|
93
|
+
externalId: string;
|
|
94
|
+
}>;
|
|
95
|
+
} | {
|
|
96
|
+
hasData: ViewReference[];
|
|
97
|
+
};
|
|
98
|
+
type TableExpressionFilter = FilterDefinition | {
|
|
99
|
+
and: FilterDefinition[];
|
|
100
|
+
};
|
|
101
|
+
interface PropertySort {
|
|
102
|
+
property: string[];
|
|
103
|
+
direction: SortDirection;
|
|
104
|
+
nullsFirst: boolean;
|
|
105
|
+
}
|
|
106
|
+
interface QuerySelectExpression {
|
|
107
|
+
sources?: Array<{
|
|
108
|
+
source: ViewReference;
|
|
109
|
+
properties: string[];
|
|
110
|
+
}>;
|
|
111
|
+
}
|
|
112
|
+
interface QueryNodeTableExpression {
|
|
113
|
+
nodes: {
|
|
114
|
+
filter?: TableExpressionFilter;
|
|
115
|
+
from?: string;
|
|
116
|
+
direction?: "outwards" | "inwards";
|
|
117
|
+
through?: {
|
|
118
|
+
view: ViewReference;
|
|
119
|
+
identifier: string;
|
|
120
|
+
} | {
|
|
121
|
+
source: ViewReference;
|
|
122
|
+
identifier: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
sort?: PropertySort[];
|
|
126
|
+
limit?: number;
|
|
127
|
+
}
|
|
128
|
+
interface QueryEdgeTableExpression {
|
|
129
|
+
edges: {
|
|
130
|
+
from: string;
|
|
131
|
+
maxDistance?: number;
|
|
132
|
+
filter?: TableExpressionFilter;
|
|
133
|
+
direction?: "outwards" | "inwards";
|
|
134
|
+
};
|
|
135
|
+
limit?: number;
|
|
136
|
+
}
|
|
137
|
+
type QueryTableExpression = QueryNodeTableExpression | QueryEdgeTableExpression;
|
|
138
|
+
interface InstancesQueryRequest {
|
|
139
|
+
with: Record<string, QueryTableExpression>;
|
|
140
|
+
select: Record<string, QuerySelectExpression | Record<string, never>>;
|
|
141
|
+
cursors?: Record<string, string>;
|
|
142
|
+
}
|
|
143
|
+
interface InstancesApplySource {
|
|
144
|
+
source: ViewReference;
|
|
145
|
+
properties: Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
interface InstancesApplyNodeWrite {
|
|
148
|
+
instanceType: "node";
|
|
149
|
+
space: string;
|
|
150
|
+
externalId: string;
|
|
151
|
+
existingVersion?: number;
|
|
152
|
+
sources?: InstancesApplySource[];
|
|
153
|
+
}
|
|
154
|
+
interface InstancesApplyEdgeWrite {
|
|
155
|
+
instanceType: "edge";
|
|
156
|
+
space: string;
|
|
157
|
+
externalId: string;
|
|
158
|
+
type: unknown;
|
|
159
|
+
startNode: NodeId;
|
|
160
|
+
endNode: NodeId;
|
|
161
|
+
existingVersion?: number;
|
|
162
|
+
sources?: InstancesApplySource[];
|
|
163
|
+
}
|
|
164
|
+
interface InstancesApplyDelete {
|
|
165
|
+
instanceType: "node" | "edge";
|
|
166
|
+
space: string;
|
|
167
|
+
externalId: string;
|
|
168
|
+
}
|
|
169
|
+
interface InstancesApplyRequest {
|
|
170
|
+
items: Array<InstancesApplyNodeWrite | InstancesApplyEdgeWrite>;
|
|
171
|
+
delete?: InstancesApplyDelete[];
|
|
172
|
+
replace?: boolean;
|
|
173
|
+
}
|
|
174
|
+
interface InstancesApplyResultItem {
|
|
175
|
+
instanceType: "node" | "edge";
|
|
176
|
+
version?: number;
|
|
177
|
+
wasModified?: boolean;
|
|
178
|
+
space: string;
|
|
179
|
+
externalId: string;
|
|
180
|
+
createdTime?: number;
|
|
181
|
+
lastUpdatedTime?: number;
|
|
182
|
+
}
|
|
183
|
+
interface InstancesApplyResponse {
|
|
184
|
+
items: InstancesApplyResultItem[];
|
|
185
|
+
}
|
|
1
186
|
interface NodeDefinition {
|
|
2
187
|
instanceType: "node";
|
|
3
188
|
version?: number;
|
|
@@ -8,6 +193,182 @@ interface NodeDefinition {
|
|
|
8
193
|
deletedTime?: number;
|
|
9
194
|
lastUpdatedTime?: number;
|
|
10
195
|
}
|
|
196
|
+
interface EdgeDefinition {
|
|
197
|
+
instanceType: "edge";
|
|
198
|
+
space: string;
|
|
199
|
+
externalId: string;
|
|
200
|
+
startNode: {
|
|
201
|
+
space: string;
|
|
202
|
+
externalId: string;
|
|
203
|
+
};
|
|
204
|
+
endNode: {
|
|
205
|
+
space: string;
|
|
206
|
+
externalId: string;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
type NodeOrEdge = NodeDefinition | EdgeDefinition;
|
|
210
|
+
interface InstancesQueryResponse {
|
|
211
|
+
items: Record<string, NodeOrEdge[]>;
|
|
212
|
+
nextCursor: Record<string, string>;
|
|
213
|
+
}
|
|
214
|
+
interface InstancesSearchRequest {
|
|
215
|
+
view: ViewReference;
|
|
216
|
+
query: string;
|
|
217
|
+
instanceType: "node";
|
|
218
|
+
properties: string[];
|
|
219
|
+
operator?: "OR" | "AND";
|
|
220
|
+
filter?: FilterDefinition;
|
|
221
|
+
limit?: number;
|
|
222
|
+
}
|
|
223
|
+
interface InstancesSearchResponse {
|
|
224
|
+
items: NodeOrEdge[];
|
|
225
|
+
}
|
|
226
|
+
interface DataModelRetrieveItem {
|
|
227
|
+
views?: ViewDefinition[];
|
|
228
|
+
createdTime: number;
|
|
229
|
+
}
|
|
230
|
+
interface DataModelRetrieveOptions {
|
|
231
|
+
inlineViews?: boolean;
|
|
232
|
+
}
|
|
233
|
+
type AggregateFunctionName = "avg" | "min" | "max" | "sum" | "count";
|
|
234
|
+
type InstancesAggregateDefinition = {
|
|
235
|
+
avg: {
|
|
236
|
+
property: string;
|
|
237
|
+
};
|
|
238
|
+
} | {
|
|
239
|
+
min: {
|
|
240
|
+
property: string;
|
|
241
|
+
};
|
|
242
|
+
} | {
|
|
243
|
+
max: {
|
|
244
|
+
property: string;
|
|
245
|
+
};
|
|
246
|
+
} | {
|
|
247
|
+
sum: {
|
|
248
|
+
property: string;
|
|
249
|
+
};
|
|
250
|
+
} | {
|
|
251
|
+
count: {
|
|
252
|
+
property?: string;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
interface InstancesAggregateRequest {
|
|
256
|
+
view: ViewReference;
|
|
257
|
+
instanceType: "node";
|
|
258
|
+
limit: number;
|
|
259
|
+
filter?: FilterDefinition;
|
|
260
|
+
groupBy?: string[];
|
|
261
|
+
aggregates?: InstancesAggregateDefinition[];
|
|
262
|
+
}
|
|
263
|
+
interface InstancesAggregateValue {
|
|
264
|
+
aggregate: AggregateFunctionName;
|
|
265
|
+
property?: string;
|
|
266
|
+
value?: number;
|
|
267
|
+
}
|
|
268
|
+
interface InstancesAggregateResultItem {
|
|
269
|
+
aggregates: InstancesAggregateValue[];
|
|
270
|
+
group?: Record<string, string | number | boolean | {
|
|
271
|
+
space: string;
|
|
272
|
+
externalId: string;
|
|
273
|
+
}>;
|
|
274
|
+
instanceType: "node" | "edge";
|
|
275
|
+
}
|
|
276
|
+
interface InstancesAggregateResponse {
|
|
277
|
+
items: InstancesAggregateResultItem[];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** Numeric datapoint from a raw (non-aggregate) time series query. */
|
|
281
|
+
type CogniteDoubleDatapoint = {
|
|
282
|
+
timestamp: Date;
|
|
283
|
+
value: number;
|
|
284
|
+
};
|
|
285
|
+
/** Numeric datapoint from an aggregate time series query.
|
|
286
|
+
* Each field corresponds to one aggregate function as defined by the Cognite API. */
|
|
287
|
+
type CogniteAggregateDatapoint = {
|
|
288
|
+
timestamp: Date;
|
|
289
|
+
} & {
|
|
290
|
+
[K in DatapointAggregate]?: number;
|
|
291
|
+
};
|
|
292
|
+
/** A numeric datapoint as returned by the Cognite API.
|
|
293
|
+
* String time series datapoints are excluded — they are filtered out before processing. */
|
|
294
|
+
type CogniteNumericDatapoint = CogniteDoubleDatapoint | CogniteAggregateDatapoint;
|
|
295
|
+
interface CogniteDatapointResultItem {
|
|
296
|
+
space?: string;
|
|
297
|
+
externalId?: string;
|
|
298
|
+
isString: boolean;
|
|
299
|
+
unit?: string;
|
|
300
|
+
datapoints: CogniteNumericDatapoint[];
|
|
301
|
+
nextCursor?: string;
|
|
302
|
+
}
|
|
303
|
+
interface CogniteDatapointRetrieveItem extends NodeId {
|
|
304
|
+
start?: string | number | Date;
|
|
305
|
+
end?: string | number | Date;
|
|
306
|
+
limit?: number;
|
|
307
|
+
cursor?: string;
|
|
308
|
+
aggregates?: DatapointAggregate[];
|
|
309
|
+
granularity?: string;
|
|
310
|
+
includeOutsidePoints?: boolean;
|
|
311
|
+
targetUnit?: string;
|
|
312
|
+
targetUnitSystem?: string;
|
|
313
|
+
timeZone?: string;
|
|
314
|
+
}
|
|
315
|
+
interface CogniteDatapointRetrieveOptions {
|
|
316
|
+
items: CogniteDatapointRetrieveItem[];
|
|
317
|
+
start?: string | number | Date;
|
|
318
|
+
end?: string | number | Date;
|
|
319
|
+
limit?: number;
|
|
320
|
+
aggregates?: DatapointAggregate[];
|
|
321
|
+
granularity?: string;
|
|
322
|
+
includeOutsidePoints?: boolean;
|
|
323
|
+
ignoreUnknownIds?: boolean;
|
|
324
|
+
timeZone?: string;
|
|
325
|
+
}
|
|
326
|
+
interface CogniteDatapointLatestItem extends NodeId {
|
|
327
|
+
before?: string | Date | number;
|
|
328
|
+
}
|
|
329
|
+
interface CogniteDatapointInsertItem extends NodeId {
|
|
330
|
+
datapoints: Array<{
|
|
331
|
+
timestamp: number | Date;
|
|
332
|
+
value: number;
|
|
333
|
+
}>;
|
|
334
|
+
}
|
|
335
|
+
interface CogniteDatapointDeleteItem extends NodeId {
|
|
336
|
+
inclusiveBegin: number | Date;
|
|
337
|
+
exclusiveEnd?: number | Date;
|
|
338
|
+
}
|
|
339
|
+
interface CogniteFileInstanceId {
|
|
340
|
+
space?: string;
|
|
341
|
+
externalId?: string;
|
|
342
|
+
}
|
|
343
|
+
interface CogniteFileInfo {
|
|
344
|
+
instanceId?: CogniteFileInstanceId;
|
|
345
|
+
name: string;
|
|
346
|
+
uploaded: boolean;
|
|
347
|
+
uploadedTime?: Date;
|
|
348
|
+
createdTime: Date;
|
|
349
|
+
lastUpdatedTime: Date;
|
|
350
|
+
mimeType?: string;
|
|
351
|
+
directory?: string;
|
|
352
|
+
source?: string;
|
|
353
|
+
}
|
|
354
|
+
interface CogniteFileUploadResult extends CogniteFileInfo {
|
|
355
|
+
uploadUrl?: string;
|
|
356
|
+
}
|
|
357
|
+
interface CogniteFileUploadInfo {
|
|
358
|
+
instanceId: {
|
|
359
|
+
space: string;
|
|
360
|
+
externalId: string;
|
|
361
|
+
};
|
|
362
|
+
name: string;
|
|
363
|
+
mimeType?: string;
|
|
364
|
+
directory?: string;
|
|
365
|
+
source?: string;
|
|
366
|
+
metadata?: Record<string, string>;
|
|
367
|
+
}
|
|
368
|
+
interface CogniteFileDownloadUrl {
|
|
369
|
+
instanceId?: CogniteFileInstanceId;
|
|
370
|
+
downloadUrl: string;
|
|
371
|
+
}
|
|
11
372
|
|
|
12
373
|
type NodeId = {
|
|
13
374
|
externalId: string;
|
|
@@ -340,4 +701,4 @@ type WhereInput<TModel> = {
|
|
|
340
701
|
[K in keyof ModelProps<TModel> | RelationKeys<TModel>]?: QueryFilterValue<TModel, K>;
|
|
341
702
|
};
|
|
342
703
|
|
|
343
|
-
export type { AggregateExecutor as A, QuerySelect as B, UpsertNode as C, DataModelId as D, EdgeCreationCallback as E, FilesExecutor as F, UpsertOptions as G, UpsertProperties as H, IndustrialModelClientOptions as I, UpsertResult as J, UpsertResultItem as K, ModelProps as M, NodeId as N, OnEdgeCreation as O, QueryExecutor as Q, RawDatapoint as R, UpsertExecutor as U, DatapointsExecutor as a, DeleteResult as b, AggregateOptions as c, AggregateResult as d, AggregateResultItem as e, DatapointAggregate as f, DatapointSeriesResult as g, DatapointsDeleteRange as h, DatapointsInsertItem as i, DatapointsLatestOptions as j, DatapointsLatestSeries as k, DatapointsResult as l, DatapointsRetrieveOptions as m, DeleteExecutor as n, DeleteResultItem as o, EdgeCreationCallbacks as p, EdgeCreationContext as q, EdgeMode as r, FileDownloadUrl as s, FileUploadInfo as t, FileUploadResult as u, IndustrialModel as v, ModelRelations as w, QueryOptions as x, QueryResult as y, QueryResultItem as z };
|
|
704
|
+
export type { InstancesApplyResponse as $, AggregateExecutor as A, QuerySelect as B, UpsertNode as C, DataModelId as D, EdgeCreationCallback as E, FilesExecutor as F, UpsertOptions as G, UpsertProperties as H, IndustrialModelClientOptions as I, UpsertResult as J, UpsertResultItem as K, DataModelRetrieveOptions as L, ModelProps as M, NodeId as N, OnEdgeCreation as O, DataModelRetrieveItem as P, QueryExecutor as Q, RawDatapoint as R, InstancesQueryRequest as S, InstancesQueryResponse as T, UpsertExecutor as U, ViewDefinition as V, InstancesSearchRequest as W, InstancesSearchResponse as X, InstancesAggregateRequest as Y, InstancesAggregateResponse as Z, InstancesApplyRequest as _, DatapointsExecutor as a, CogniteDatapointRetrieveOptions as a0, CogniteDatapointResultItem as a1, CogniteDatapointLatestItem as a2, CogniteDatapointInsertItem as a3, CogniteDatapointDeleteItem as a4, CogniteFileUploadInfo as a5, CogniteFileUploadResult as a6, CogniteFileDownloadUrl as a7, DeleteResult as b, AggregateOptions as c, AggregateResult as d, AggregateResultItem as e, DatapointAggregate as f, DatapointSeriesResult as g, DatapointsDeleteRange as h, DatapointsInsertItem as i, DatapointsLatestOptions as j, DatapointsLatestSeries as k, DatapointsResult as l, DatapointsRetrieveOptions as m, DeleteExecutor as n, DeleteResultItem as o, EdgeCreationCallbacks as p, EdgeCreationContext as q, EdgeMode as r, FileDownloadUrl as s, FileUploadInfo as t, FileUploadResult as u, IndustrialModel as v, ModelRelations as w, QueryOptions as x, QueryResult as y, QueryResultItem as z };
|