basyx-typescript-sdk 2.3.1 → 2.4.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 +68 -1
- package/bundle/index.cjs +1412 -89
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +1344 -90
- package/bundle/index.mjs.map +1 -1
- package/dist/clients/AasRegistryClient.d.ts +20 -0
- package/dist/clients/AasRegistryClient.js +40 -0
- package/dist/clients/AasRepositoryClient.d.ts +20 -0
- package/dist/clients/AasRepositoryClient.js +40 -0
- package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +20 -0
- package/dist/clients/ConceptDescriptionRepositoryClient.js +40 -0
- package/dist/clients/SubmodelRegistryClient.d.ts +20 -0
- package/dist/clients/SubmodelRegistryClient.js +40 -0
- package/dist/clients/SubmodelRepositoryClient.d.ts +20 -0
- package/dist/clients/SubmodelRepositoryClient.js +40 -0
- package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +14 -1
- package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +29 -0
- package/dist/generated/AasRegistryService/models/index.d.ts +374 -0
- package/dist/generated/AasRegistryService/models/index.js +6 -0
- package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +14 -1
- package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +29 -0
- package/dist/generated/AasRepositoryService/models/index.d.ts +381 -0
- package/dist/generated/AasRepositoryService/models/index.js +7 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.d.ts +14 -1
- package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.js +29 -0
- package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +381 -0
- package/dist/generated/ConceptDescriptionRepositoryService/models/index.js +7 -0
- package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.d.ts +14 -1
- package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.js +29 -0
- package/dist/generated/SubmodelRegistryService/models/index.d.ts +381 -0
- package/dist/generated/SubmodelRegistryService/models/index.js +7 -0
- package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.d.ts +14 -1
- package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +29 -0
- package/dist/generated/SubmodelRepositoryService/models/index.d.ts +381 -0
- package/dist/generated/SubmodelRepositoryService/models/index.js +7 -0
- package/dist/lib/endpointConfiguration.d.ts +71 -0
- package/dist/lib/endpointConfiguration.js +101 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/queryJsonization.d.ts +17 -0
- package/dist/lib/queryJsonization.js +309 -0
- package/dist/lib/queryRequests.d.ts +24 -0
- package/dist/lib/queryRequests.js +44 -0
- package/dist/models/Query.d.ts +378 -0
- package/dist/models/Query.js +430 -0
- package/dist/models/QueryResult.d.ts +22 -0
- package/dist/models/QueryResult.js +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/services/AasService.d.ts +15 -4
- package/dist/services/AasService.js +38 -40
- package/dist/services/SubmodelService.d.ts +9 -8
- package/dist/services/SubmodelService.js +17 -34
- package/dist/services/index.d.ts +1 -0
- package/dist/utils/DescriptorUtils.d.ts +27 -1
- package/dist/utils/DescriptorUtils.js +65 -27
- package/dist/utils/ServiceDescriptionUtils.d.ts +30 -0
- package/dist/utils/ServiceDescriptionUtils.js +43 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/package.json +1 -1
|
@@ -2222,6 +2222,182 @@ export interface LevelType {
|
|
|
2222
2222
|
*/
|
|
2223
2223
|
max: boolean;
|
|
2224
2224
|
}
|
|
2225
|
+
/**
|
|
2226
|
+
*
|
|
2227
|
+
* @export
|
|
2228
|
+
* @interface LogicalExpression
|
|
2229
|
+
*/
|
|
2230
|
+
export interface LogicalExpression {
|
|
2231
|
+
/**
|
|
2232
|
+
*
|
|
2233
|
+
* @type {Array<LogicalExpression>}
|
|
2234
|
+
* @memberof LogicalExpression
|
|
2235
|
+
*/
|
|
2236
|
+
$and?: Array<LogicalExpression>;
|
|
2237
|
+
/**
|
|
2238
|
+
*
|
|
2239
|
+
* @type {Array<MatchExpression>}
|
|
2240
|
+
* @memberof LogicalExpression
|
|
2241
|
+
*/
|
|
2242
|
+
$match?: Array<MatchExpression>;
|
|
2243
|
+
/**
|
|
2244
|
+
*
|
|
2245
|
+
* @type {Array<LogicalExpression>}
|
|
2246
|
+
* @memberof LogicalExpression
|
|
2247
|
+
*/
|
|
2248
|
+
$or?: Array<LogicalExpression>;
|
|
2249
|
+
/**
|
|
2250
|
+
*
|
|
2251
|
+
* @type {LogicalExpression}
|
|
2252
|
+
* @memberof LogicalExpression
|
|
2253
|
+
*/
|
|
2254
|
+
$not?: LogicalExpression | null;
|
|
2255
|
+
/**
|
|
2256
|
+
*
|
|
2257
|
+
* @type {Array<Value>}
|
|
2258
|
+
* @memberof LogicalExpression
|
|
2259
|
+
*/
|
|
2260
|
+
$eq?: Array<Value>;
|
|
2261
|
+
/**
|
|
2262
|
+
*
|
|
2263
|
+
* @type {Array<Value>}
|
|
2264
|
+
* @memberof LogicalExpression
|
|
2265
|
+
*/
|
|
2266
|
+
$ne?: Array<Value>;
|
|
2267
|
+
/**
|
|
2268
|
+
*
|
|
2269
|
+
* @type {Array<Value>}
|
|
2270
|
+
* @memberof LogicalExpression
|
|
2271
|
+
*/
|
|
2272
|
+
$gt?: Array<Value>;
|
|
2273
|
+
/**
|
|
2274
|
+
*
|
|
2275
|
+
* @type {Array<Value>}
|
|
2276
|
+
* @memberof LogicalExpression
|
|
2277
|
+
*/
|
|
2278
|
+
$ge?: Array<Value>;
|
|
2279
|
+
/**
|
|
2280
|
+
*
|
|
2281
|
+
* @type {Array<Value>}
|
|
2282
|
+
* @memberof LogicalExpression
|
|
2283
|
+
*/
|
|
2284
|
+
$lt?: Array<Value>;
|
|
2285
|
+
/**
|
|
2286
|
+
*
|
|
2287
|
+
* @type {Array<Value>}
|
|
2288
|
+
* @memberof LogicalExpression
|
|
2289
|
+
*/
|
|
2290
|
+
$le?: Array<Value>;
|
|
2291
|
+
/**
|
|
2292
|
+
*
|
|
2293
|
+
* @type {Array<StringValue>}
|
|
2294
|
+
* @memberof LogicalExpression
|
|
2295
|
+
*/
|
|
2296
|
+
$contains?: Array<StringValue>;
|
|
2297
|
+
/**
|
|
2298
|
+
*
|
|
2299
|
+
* @type {Array<StringValue>}
|
|
2300
|
+
* @memberof LogicalExpression
|
|
2301
|
+
*/
|
|
2302
|
+
'$starts-with'?: Array<StringValue>;
|
|
2303
|
+
/**
|
|
2304
|
+
*
|
|
2305
|
+
* @type {Array<StringValue>}
|
|
2306
|
+
* @memberof LogicalExpression
|
|
2307
|
+
*/
|
|
2308
|
+
'$ends-with'?: Array<StringValue>;
|
|
2309
|
+
/**
|
|
2310
|
+
*
|
|
2311
|
+
* @type {Array<StringValue>}
|
|
2312
|
+
* @memberof LogicalExpression
|
|
2313
|
+
*/
|
|
2314
|
+
$regex?: Array<StringValue>;
|
|
2315
|
+
/**
|
|
2316
|
+
*
|
|
2317
|
+
* @type {boolean}
|
|
2318
|
+
* @memberof LogicalExpression
|
|
2319
|
+
*/
|
|
2320
|
+
$boolean?: boolean;
|
|
2321
|
+
}
|
|
2322
|
+
/**
|
|
2323
|
+
*
|
|
2324
|
+
* @export
|
|
2325
|
+
* @interface MatchExpression
|
|
2326
|
+
*/
|
|
2327
|
+
export interface MatchExpression {
|
|
2328
|
+
/**
|
|
2329
|
+
*
|
|
2330
|
+
* @type {Array<MatchExpression>}
|
|
2331
|
+
* @memberof MatchExpression
|
|
2332
|
+
*/
|
|
2333
|
+
$match?: Array<MatchExpression>;
|
|
2334
|
+
/**
|
|
2335
|
+
*
|
|
2336
|
+
* @type {Array<Value>}
|
|
2337
|
+
* @memberof MatchExpression
|
|
2338
|
+
*/
|
|
2339
|
+
$eq?: Array<Value>;
|
|
2340
|
+
/**
|
|
2341
|
+
*
|
|
2342
|
+
* @type {Array<Value>}
|
|
2343
|
+
* @memberof MatchExpression
|
|
2344
|
+
*/
|
|
2345
|
+
$ne?: Array<Value>;
|
|
2346
|
+
/**
|
|
2347
|
+
*
|
|
2348
|
+
* @type {Array<Value>}
|
|
2349
|
+
* @memberof MatchExpression
|
|
2350
|
+
*/
|
|
2351
|
+
$gt?: Array<Value>;
|
|
2352
|
+
/**
|
|
2353
|
+
*
|
|
2354
|
+
* @type {Array<Value>}
|
|
2355
|
+
* @memberof MatchExpression
|
|
2356
|
+
*/
|
|
2357
|
+
$ge?: Array<Value>;
|
|
2358
|
+
/**
|
|
2359
|
+
*
|
|
2360
|
+
* @type {Array<Value>}
|
|
2361
|
+
* @memberof MatchExpression
|
|
2362
|
+
*/
|
|
2363
|
+
$lt?: Array<Value>;
|
|
2364
|
+
/**
|
|
2365
|
+
*
|
|
2366
|
+
* @type {Array<Value>}
|
|
2367
|
+
* @memberof MatchExpression
|
|
2368
|
+
*/
|
|
2369
|
+
$le?: Array<Value>;
|
|
2370
|
+
/**
|
|
2371
|
+
*
|
|
2372
|
+
* @type {Array<StringValue>}
|
|
2373
|
+
* @memberof MatchExpression
|
|
2374
|
+
*/
|
|
2375
|
+
$contains?: Array<StringValue>;
|
|
2376
|
+
/**
|
|
2377
|
+
*
|
|
2378
|
+
* @type {Array<StringValue>}
|
|
2379
|
+
* @memberof MatchExpression
|
|
2380
|
+
*/
|
|
2381
|
+
'$starts-with'?: Array<StringValue>;
|
|
2382
|
+
/**
|
|
2383
|
+
*
|
|
2384
|
+
* @type {Array<StringValue>}
|
|
2385
|
+
* @memberof MatchExpression
|
|
2386
|
+
*/
|
|
2387
|
+
'$ends-with'?: Array<StringValue>;
|
|
2388
|
+
/**
|
|
2389
|
+
*
|
|
2390
|
+
* @type {Array<StringValue>}
|
|
2391
|
+
* @memberof MatchExpression
|
|
2392
|
+
*/
|
|
2393
|
+
$regex?: Array<StringValue>;
|
|
2394
|
+
/**
|
|
2395
|
+
*
|
|
2396
|
+
* @type {boolean}
|
|
2397
|
+
* @memberof MatchExpression
|
|
2398
|
+
*/
|
|
2399
|
+
$boolean?: boolean;
|
|
2400
|
+
}
|
|
2225
2401
|
/**
|
|
2226
2402
|
*
|
|
2227
2403
|
* @export
|
|
@@ -3104,6 +3280,77 @@ export declare const QualifierKind: {
|
|
|
3104
3280
|
readonly ValueQualifier: "ValueQualifier";
|
|
3105
3281
|
};
|
|
3106
3282
|
export type QualifierKind = typeof QualifierKind[keyof typeof QualifierKind];
|
|
3283
|
+
/**
|
|
3284
|
+
*
|
|
3285
|
+
* @export
|
|
3286
|
+
* @interface Query
|
|
3287
|
+
*/
|
|
3288
|
+
export interface Query {
|
|
3289
|
+
/**
|
|
3290
|
+
*
|
|
3291
|
+
* @type {string}
|
|
3292
|
+
* @memberof Query
|
|
3293
|
+
*/
|
|
3294
|
+
$select?: string;
|
|
3295
|
+
/**
|
|
3296
|
+
*
|
|
3297
|
+
* @type {LogicalExpression}
|
|
3298
|
+
* @memberof Query
|
|
3299
|
+
*/
|
|
3300
|
+
$condition: LogicalExpression | null;
|
|
3301
|
+
}
|
|
3302
|
+
/**
|
|
3303
|
+
*
|
|
3304
|
+
* @export
|
|
3305
|
+
* @interface QueryResultSubmodel
|
|
3306
|
+
*/
|
|
3307
|
+
export interface QueryResultSubmodel {
|
|
3308
|
+
/**
|
|
3309
|
+
*
|
|
3310
|
+
* @type {QueryResultSubmodelPagingMetadata}
|
|
3311
|
+
* @memberof QueryResultSubmodel
|
|
3312
|
+
*/
|
|
3313
|
+
paging_metadata: QueryResultSubmodelPagingMetadata;
|
|
3314
|
+
/**
|
|
3315
|
+
*
|
|
3316
|
+
* @type {Array<QueryResultSubmodelResultInner>}
|
|
3317
|
+
* @memberof QueryResultSubmodel
|
|
3318
|
+
*/
|
|
3319
|
+
result?: Array<QueryResultSubmodelResultInner>;
|
|
3320
|
+
}
|
|
3321
|
+
/**
|
|
3322
|
+
*
|
|
3323
|
+
* @export
|
|
3324
|
+
* @interface QueryResultSubmodelPagingMetadata
|
|
3325
|
+
*/
|
|
3326
|
+
export interface QueryResultSubmodelPagingMetadata {
|
|
3327
|
+
/**
|
|
3328
|
+
*
|
|
3329
|
+
* @type {string}
|
|
3330
|
+
* @memberof QueryResultSubmodelPagingMetadata
|
|
3331
|
+
*/
|
|
3332
|
+
cursor?: string;
|
|
3333
|
+
/**
|
|
3334
|
+
*
|
|
3335
|
+
* @type {string}
|
|
3336
|
+
* @memberof QueryResultSubmodelPagingMetadata
|
|
3337
|
+
*/
|
|
3338
|
+
resultType?: QueryResultSubmodelPagingMetadataResultTypeEnum;
|
|
3339
|
+
}
|
|
3340
|
+
/**
|
|
3341
|
+
* @export
|
|
3342
|
+
*/
|
|
3343
|
+
export declare const QueryResultSubmodelPagingMetadataResultTypeEnum: {
|
|
3344
|
+
readonly Submodel: "Submodel";
|
|
3345
|
+
readonly Identifier: "Identifier";
|
|
3346
|
+
};
|
|
3347
|
+
export type QueryResultSubmodelPagingMetadataResultTypeEnum = typeof QueryResultSubmodelPagingMetadataResultTypeEnum[keyof typeof QueryResultSubmodelPagingMetadataResultTypeEnum];
|
|
3348
|
+
/**
|
|
3349
|
+
* @type QueryResultSubmodelResultInner
|
|
3350
|
+
*
|
|
3351
|
+
* @export
|
|
3352
|
+
*/
|
|
3353
|
+
export type QueryResultSubmodelResultInner = Submodel | string;
|
|
3107
3354
|
/**
|
|
3108
3355
|
*
|
|
3109
3356
|
* @export
|
|
@@ -3915,6 +4162,31 @@ export declare const StateOfEvent: {
|
|
|
3915
4162
|
readonly On: "on";
|
|
3916
4163
|
};
|
|
3917
4164
|
export type StateOfEvent = typeof StateOfEvent[keyof typeof StateOfEvent];
|
|
4165
|
+
/**
|
|
4166
|
+
*
|
|
4167
|
+
* @export
|
|
4168
|
+
* @interface StringValue
|
|
4169
|
+
*/
|
|
4170
|
+
export interface StringValue {
|
|
4171
|
+
/**
|
|
4172
|
+
*
|
|
4173
|
+
* @type {string}
|
|
4174
|
+
* @memberof StringValue
|
|
4175
|
+
*/
|
|
4176
|
+
$field?: string;
|
|
4177
|
+
/**
|
|
4178
|
+
*
|
|
4179
|
+
* @type {string}
|
|
4180
|
+
* @memberof StringValue
|
|
4181
|
+
*/
|
|
4182
|
+
$strVal?: string;
|
|
4183
|
+
/**
|
|
4184
|
+
*
|
|
4185
|
+
* @type {Value}
|
|
4186
|
+
* @memberof StringValue
|
|
4187
|
+
*/
|
|
4188
|
+
$strCast?: Value | null;
|
|
4189
|
+
}
|
|
3918
4190
|
/**
|
|
3919
4191
|
*
|
|
3920
4192
|
* @export
|
|
@@ -4589,6 +4861,115 @@ export interface SubmodelMetadata {
|
|
|
4589
4861
|
*/
|
|
4590
4862
|
kind?: ModellingKind;
|
|
4591
4863
|
}
|
|
4864
|
+
/**
|
|
4865
|
+
*
|
|
4866
|
+
* @export
|
|
4867
|
+
* @interface Value
|
|
4868
|
+
*/
|
|
4869
|
+
export interface Value {
|
|
4870
|
+
/**
|
|
4871
|
+
*
|
|
4872
|
+
* @type {string}
|
|
4873
|
+
* @memberof Value
|
|
4874
|
+
*/
|
|
4875
|
+
$field?: string;
|
|
4876
|
+
/**
|
|
4877
|
+
*
|
|
4878
|
+
* @type {string}
|
|
4879
|
+
* @memberof Value
|
|
4880
|
+
*/
|
|
4881
|
+
$strVal?: string;
|
|
4882
|
+
/**
|
|
4883
|
+
*
|
|
4884
|
+
* @type {number}
|
|
4885
|
+
* @memberof Value
|
|
4886
|
+
*/
|
|
4887
|
+
$numVal?: number;
|
|
4888
|
+
/**
|
|
4889
|
+
*
|
|
4890
|
+
* @type {string}
|
|
4891
|
+
* @memberof Value
|
|
4892
|
+
*/
|
|
4893
|
+
$hexVal?: string;
|
|
4894
|
+
/**
|
|
4895
|
+
*
|
|
4896
|
+
* @type {string}
|
|
4897
|
+
* @memberof Value
|
|
4898
|
+
*/
|
|
4899
|
+
$dateTimeVal?: string;
|
|
4900
|
+
/**
|
|
4901
|
+
*
|
|
4902
|
+
* @type {string}
|
|
4903
|
+
* @memberof Value
|
|
4904
|
+
*/
|
|
4905
|
+
$timeVal?: string;
|
|
4906
|
+
/**
|
|
4907
|
+
*
|
|
4908
|
+
* @type {boolean}
|
|
4909
|
+
* @memberof Value
|
|
4910
|
+
*/
|
|
4911
|
+
$boolean?: boolean;
|
|
4912
|
+
/**
|
|
4913
|
+
*
|
|
4914
|
+
* @type {Value}
|
|
4915
|
+
* @memberof Value
|
|
4916
|
+
*/
|
|
4917
|
+
$strCast?: Value | null;
|
|
4918
|
+
/**
|
|
4919
|
+
*
|
|
4920
|
+
* @type {Value}
|
|
4921
|
+
* @memberof Value
|
|
4922
|
+
*/
|
|
4923
|
+
$numCast?: Value | null;
|
|
4924
|
+
/**
|
|
4925
|
+
*
|
|
4926
|
+
* @type {Value}
|
|
4927
|
+
* @memberof Value
|
|
4928
|
+
*/
|
|
4929
|
+
$hexCast?: Value | null;
|
|
4930
|
+
/**
|
|
4931
|
+
*
|
|
4932
|
+
* @type {Value}
|
|
4933
|
+
* @memberof Value
|
|
4934
|
+
*/
|
|
4935
|
+
$boolCast?: Value | null;
|
|
4936
|
+
/**
|
|
4937
|
+
*
|
|
4938
|
+
* @type {Value}
|
|
4939
|
+
* @memberof Value
|
|
4940
|
+
*/
|
|
4941
|
+
$dateTimeCast?: Value | null;
|
|
4942
|
+
/**
|
|
4943
|
+
*
|
|
4944
|
+
* @type {Value}
|
|
4945
|
+
* @memberof Value
|
|
4946
|
+
*/
|
|
4947
|
+
$timeCast?: Value | null;
|
|
4948
|
+
/**
|
|
4949
|
+
*
|
|
4950
|
+
* @type {string}
|
|
4951
|
+
* @memberof Value
|
|
4952
|
+
*/
|
|
4953
|
+
$dayOfWeek?: string;
|
|
4954
|
+
/**
|
|
4955
|
+
*
|
|
4956
|
+
* @type {string}
|
|
4957
|
+
* @memberof Value
|
|
4958
|
+
*/
|
|
4959
|
+
$dayOfMonth?: string;
|
|
4960
|
+
/**
|
|
4961
|
+
*
|
|
4962
|
+
* @type {string}
|
|
4963
|
+
* @memberof Value
|
|
4964
|
+
*/
|
|
4965
|
+
$month?: string;
|
|
4966
|
+
/**
|
|
4967
|
+
*
|
|
4968
|
+
* @type {string}
|
|
4969
|
+
* @memberof Value
|
|
4970
|
+
*/
|
|
4971
|
+
$year?: string;
|
|
4972
|
+
}
|
|
4592
4973
|
/**
|
|
4593
4974
|
*
|
|
4594
4975
|
* @export
|
|
@@ -203,6 +203,13 @@ export const QualifierKind = {
|
|
|
203
203
|
TemplateQualifier: 'TemplateQualifier',
|
|
204
204
|
ValueQualifier: 'ValueQualifier'
|
|
205
205
|
};
|
|
206
|
+
/**
|
|
207
|
+
* @export
|
|
208
|
+
*/
|
|
209
|
+
export const QueryResultSubmodelPagingMetadataResultTypeEnum = {
|
|
210
|
+
Submodel: 'Submodel',
|
|
211
|
+
Identifier: 'Identifier'
|
|
212
|
+
};
|
|
206
213
|
/**
|
|
207
214
|
*
|
|
208
215
|
* @export
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Configuration } from '../generated/runtime';
|
|
2
|
+
import { AssetAdministrationShellDescriptor, SubmodelDescriptor } from '../models/Descriptors';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the configuration for requests to a descriptor endpoint, or `null` to reject the endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Called with the full endpoint href (e.g. `https://host/aas-env/shells/{id}`) before any request is sent.
|
|
7
|
+
* The `basePath` of the returned configuration is ignored; it is derived from the href.
|
|
8
|
+
* A rejected endpoint is not contacted and is reported with `errorType: 'EndpointRejected'`.
|
|
9
|
+
*/
|
|
10
|
+
export type EndpointConfigurationResolver = (href: string) => Configuration | null | undefined | Promise<Configuration | null | undefined>;
|
|
11
|
+
export type EndpointConfigurationResult = {
|
|
12
|
+
success: true;
|
|
13
|
+
configuration: Configuration;
|
|
14
|
+
} | {
|
|
15
|
+
success: false;
|
|
16
|
+
error: {
|
|
17
|
+
errorType: 'EndpointRejected';
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A resolved descriptor endpoint.
|
|
23
|
+
*
|
|
24
|
+
* `href` is the URL of the resource itself; `basePath` is the URL of the repository serving it.
|
|
25
|
+
*/
|
|
26
|
+
export interface ResolvedDescriptorEndpoint {
|
|
27
|
+
href: string;
|
|
28
|
+
basePath: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Splits a resource URL like `http://host/prefix/shells/{encodedId}` into the repository base path and the
|
|
32
|
+
* encoded identifier.
|
|
33
|
+
*
|
|
34
|
+
* @param href The resource URL
|
|
35
|
+
* @param collection The collection segment (`shells` or `submodels`)
|
|
36
|
+
* @returns The base path and encoded identifier, or `undefined` if the URL does not match
|
|
37
|
+
*/
|
|
38
|
+
export declare function splitResourceHref(href: string, collection: 'shells' | 'submodels'): {
|
|
39
|
+
basePath: string;
|
|
40
|
+
encodedId: string;
|
|
41
|
+
} | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves the endpoint of a descriptor for the given interface family (`AAS` or `SUBMODEL`).
|
|
44
|
+
* Repository interface endpoints are expanded to the resource URL of the descriptor's identifier.
|
|
45
|
+
*
|
|
46
|
+
* @param descriptor The descriptor
|
|
47
|
+
* @param interfaceName `AAS` or `SUBMODEL`
|
|
48
|
+
* @returns The resolved endpoint, or `undefined` if the descriptor has no usable endpoint
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveDescriptorEndpoint(descriptor: AssetAdministrationShellDescriptor | SubmodelDescriptor, interfaceName: 'AAS' | 'SUBMODEL'): ResolvedDescriptorEndpoint | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a configuration for the given base path that keeps the auth, fetch and middleware settings of `source`.
|
|
53
|
+
*
|
|
54
|
+
* @param basePath The base path to target
|
|
55
|
+
* @param source The configuration to take the settings from
|
|
56
|
+
* @returns The new configuration
|
|
57
|
+
*/
|
|
58
|
+
export declare function withBasePath(basePath: string, source?: Configuration): Configuration;
|
|
59
|
+
/**
|
|
60
|
+
* Determines the configuration for a request to a descriptor endpoint.
|
|
61
|
+
*
|
|
62
|
+
* If a resolver is given, it decides: it returns the configuration to use, or rejects the endpoint by returning
|
|
63
|
+
* `null`/`undefined` or throwing. Otherwise, the settings of the fallback configuration (if any) are used.
|
|
64
|
+
*
|
|
65
|
+
* @param href The full endpoint URL
|
|
66
|
+
* @param basePath The base path to send the request to
|
|
67
|
+
* @param resolver The caller's endpoint configuration hook
|
|
68
|
+
* @param fallback The configuration to take settings from if no resolver is given
|
|
69
|
+
* @returns The configuration, or an `EndpointRejected` error
|
|
70
|
+
*/
|
|
71
|
+
export declare function createEndpointConfiguration(href: string, basePath: string, resolver: EndpointConfigurationResolver | undefined, fallback: Configuration | undefined): Promise<EndpointConfigurationResult>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Configuration } from '../generated/runtime';
|
|
2
|
+
import { findEndpoint, isRepositoryEndpoint } from '../utils/DescriptorUtils';
|
|
3
|
+
import { base64Encode } from './base64Url';
|
|
4
|
+
/**
|
|
5
|
+
* Splits a resource URL like `http://host/prefix/shells/{encodedId}` into the repository base path and the
|
|
6
|
+
* encoded identifier.
|
|
7
|
+
*
|
|
8
|
+
* @param href The resource URL
|
|
9
|
+
* @param collection The collection segment (`shells` or `submodels`)
|
|
10
|
+
* @returns The base path and encoded identifier, or `undefined` if the URL does not match
|
|
11
|
+
*/
|
|
12
|
+
export function splitResourceHref(href, collection) {
|
|
13
|
+
const match = href.match(new RegExp(String.raw `^(https?:\/\/[^/?#]+(?:\/[^?#]*?)?)\/${collection}\/([^/?#]+)\/?$`));
|
|
14
|
+
if (!match)
|
|
15
|
+
return undefined;
|
|
16
|
+
return { basePath: match[1], encodedId: match[2] };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the endpoint of a descriptor for the given interface family (`AAS` or `SUBMODEL`).
|
|
20
|
+
* Repository interface endpoints are expanded to the resource URL of the descriptor's identifier.
|
|
21
|
+
*
|
|
22
|
+
* @param descriptor The descriptor
|
|
23
|
+
* @param interfaceName `AAS` or `SUBMODEL`
|
|
24
|
+
* @returns The resolved endpoint, or `undefined` if the descriptor has no usable endpoint
|
|
25
|
+
*/
|
|
26
|
+
export function resolveDescriptorEndpoint(descriptor, interfaceName) {
|
|
27
|
+
const endpoint = findEndpoint(descriptor, `${interfaceName}-3.0`);
|
|
28
|
+
const endpointHref = endpoint?.protocolInformation?.href?.trim();
|
|
29
|
+
if (!endpoint || !endpointHref)
|
|
30
|
+
return undefined;
|
|
31
|
+
const collection = interfaceName === 'AAS' ? 'shells' : 'submodels';
|
|
32
|
+
if (isRepositoryEndpoint(endpoint)) {
|
|
33
|
+
if (!descriptor.id)
|
|
34
|
+
return undefined;
|
|
35
|
+
const basePath = endpointHref.replace(/\/+$/, '');
|
|
36
|
+
return { href: `${basePath}/${collection}/${base64Encode(descriptor.id)}`, basePath };
|
|
37
|
+
}
|
|
38
|
+
const parts = splitResourceHref(endpointHref, collection);
|
|
39
|
+
return { href: endpointHref, basePath: parts?.basePath ?? endpointHref };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Creates a configuration for the given base path that keeps the auth, fetch and middleware settings of `source`.
|
|
43
|
+
*
|
|
44
|
+
* @param basePath The base path to target
|
|
45
|
+
* @param source The configuration to take the settings from
|
|
46
|
+
* @returns The new configuration
|
|
47
|
+
*/
|
|
48
|
+
export function withBasePath(basePath, source) {
|
|
49
|
+
if (!source) {
|
|
50
|
+
return new Configuration({ basePath });
|
|
51
|
+
}
|
|
52
|
+
return new Configuration({
|
|
53
|
+
basePath,
|
|
54
|
+
fetchApi: source.fetchApi,
|
|
55
|
+
middleware: source.middleware,
|
|
56
|
+
queryParamsStringify: source.queryParamsStringify,
|
|
57
|
+
username: source.username,
|
|
58
|
+
password: source.password,
|
|
59
|
+
apiKey: source.apiKey,
|
|
60
|
+
accessToken: source.accessToken,
|
|
61
|
+
headers: source.headers,
|
|
62
|
+
credentials: source.credentials,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Determines the configuration for a request to a descriptor endpoint.
|
|
67
|
+
*
|
|
68
|
+
* If a resolver is given, it decides: it returns the configuration to use, or rejects the endpoint by returning
|
|
69
|
+
* `null`/`undefined` or throwing. Otherwise, the settings of the fallback configuration (if any) are used.
|
|
70
|
+
*
|
|
71
|
+
* @param href The full endpoint URL
|
|
72
|
+
* @param basePath The base path to send the request to
|
|
73
|
+
* @param resolver The caller's endpoint configuration hook
|
|
74
|
+
* @param fallback The configuration to take settings from if no resolver is given
|
|
75
|
+
* @returns The configuration, or an `EndpointRejected` error
|
|
76
|
+
*/
|
|
77
|
+
export async function createEndpointConfiguration(href, basePath, resolver, fallback) {
|
|
78
|
+
if (!resolver) {
|
|
79
|
+
return { success: true, configuration: withBasePath(basePath, fallback) };
|
|
80
|
+
}
|
|
81
|
+
let configuration;
|
|
82
|
+
try {
|
|
83
|
+
configuration = await resolver(href);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
return {
|
|
87
|
+
success: false,
|
|
88
|
+
error: {
|
|
89
|
+
errorType: 'EndpointRejected',
|
|
90
|
+
message: `Endpoint ${href} was rejected: ${error instanceof Error ? error.message : String(error)}`,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (!configuration) {
|
|
95
|
+
return {
|
|
96
|
+
success: false,
|
|
97
|
+
error: { errorType: 'EndpointRejected', message: `Endpoint ${href} was rejected` },
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return { success: true, configuration: withBasePath(basePath, configuration) };
|
|
101
|
+
}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { convertApiAssetIdToCoreAssetId, convertCoreAssetIdToApiAssetId } from '
|
|
|
4
4
|
export { convertApiAasToCoreAas, convertApiAssetInformationToCoreAssetInformation, convertApiReferenceToCoreReference, convertCoreAasToApiAas, convertCoreAssetInformationToApiAssetInformation, convertCoreReferenceToApiReference, } from './convertAasTypes';
|
|
5
5
|
export { convertApiCDToCoreCD, convertCoreCDToApiCD } from './convertConceptDescriptionTypes';
|
|
6
6
|
export { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from './convertSubmodelTypes';
|
|
7
|
+
export { queryFromJsonable, toJsonableQuery } from './queryJsonization';
|
|
7
8
|
export { applyDefaults } from './apiConfig';
|
|
8
9
|
export { base64Decode, base64Encode } from './base64Url';
|
|
9
10
|
export { handleApiError } from './errorHandler';
|
package/dist/lib/index.js
CHANGED
|
@@ -6,6 +6,8 @@ export { convertApiAssetIdToCoreAssetId, convertCoreAssetIdToApiAssetId } from '
|
|
|
6
6
|
export { convertApiAasToCoreAas, convertApiAssetInformationToCoreAssetInformation, convertApiReferenceToCoreReference, convertCoreAasToApiAas, convertCoreAssetInformationToApiAssetInformation, convertCoreReferenceToApiReference, } from './convertAasTypes';
|
|
7
7
|
export { convertApiCDToCoreCD, convertCoreCDToApiCD } from './convertConceptDescriptionTypes';
|
|
8
8
|
export { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from './convertSubmodelTypes';
|
|
9
|
+
// Query Language Serialization/Deserialization
|
|
10
|
+
export { queryFromJsonable, toJsonableQuery } from './queryJsonization';
|
|
9
11
|
// Utilities
|
|
10
12
|
export { applyDefaults } from './apiConfig';
|
|
11
13
|
export { base64Decode, base64Encode } from './base64Url';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { common } from '@aas-core-works/aas-core3.1-typescript';
|
|
2
|
+
import { DeserializationError, JsonObject, JsonValue } from '@aas-core-works/aas-core3.1-typescript/jsonization';
|
|
3
|
+
import { Query } from '../models/Query';
|
|
4
|
+
/**
|
|
5
|
+
* Serialize a query to the JSON of the AAS Query Language, as sent in the body of the `/query/*` endpoints.
|
|
6
|
+
*
|
|
7
|
+
* @param query The query to serialize
|
|
8
|
+
* @returns The JSON-able object, e.g. `{ "$condition": { "$eq": [{ "$field": "$aas#idShort" }, { "$strVal": "x" }] } }`
|
|
9
|
+
*/
|
|
10
|
+
export declare function toJsonableQuery(query: Query): JsonObject;
|
|
11
|
+
/**
|
|
12
|
+
* Parse the JSON of the AAS Query Language as a {@link Query}.
|
|
13
|
+
*
|
|
14
|
+
* @param jsonable The JSON-able value to parse, e.g. the result of `JSON.parse`
|
|
15
|
+
* @returns Either the parsed query, or the error with the path to the invalid value
|
|
16
|
+
*/
|
|
17
|
+
export declare function queryFromJsonable(jsonable: JsonValue): common.Either<Query, DeserializationError>;
|