@centia-io/sdk 0.2.1 → 0.2.3
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/LICENSE +21 -21
- package/README.md +639 -570
- package/dist/centia-io-sdk-node.js.map +1 -1
- package/dist/centia-io-sdk.cjs +306 -3
- package/dist/centia-io-sdk.d.cts +229 -3
- package/dist/centia-io-sdk.d.cts.map +1 -1
- package/dist/centia-io-sdk.d.ts +229 -3
- package/dist/centia-io-sdk.d.ts.map +1 -1
- package/dist/centia-io-sdk.js +305 -4
- package/dist/centia-io-sdk.js.map +1 -1
- package/dist/centia-io-sdk.umd.js +306 -3
- package/node.d.ts +1 -1
- package/package.json +48 -48
package/dist/centia-io-sdk.js
CHANGED
|
@@ -2351,6 +2351,169 @@ var Rules = class {
|
|
|
2351
2351
|
}
|
|
2352
2352
|
};
|
|
2353
2353
|
|
|
2354
|
+
//#endregion
|
|
2355
|
+
//#region src/provisioning/Layers.ts
|
|
2356
|
+
var Layers = class {
|
|
2357
|
+
constructor(client) {
|
|
2358
|
+
this.client = client;
|
|
2359
|
+
}
|
|
2360
|
+
layerPath(layer) {
|
|
2361
|
+
return `api/v4/layers/${encodeURIComponent(layer)}`;
|
|
2362
|
+
}
|
|
2363
|
+
classPath(layer, classId) {
|
|
2364
|
+
return `${this.layerPath(layer)}/classes/${encodeURIComponent(classId)}`;
|
|
2365
|
+
}
|
|
2366
|
+
async getLayer(layer, opts) {
|
|
2367
|
+
var _this = this;
|
|
2368
|
+
const path = layer ? _this.layerPath(layer) : "api/v4/layers";
|
|
2369
|
+
const query = {};
|
|
2370
|
+
if (opts === null || opts === void 0 ? void 0 : opts.namesOnly) query.namesOnly = "true";
|
|
2371
|
+
return _this.client.request({
|
|
2372
|
+
path,
|
|
2373
|
+
method: "GET",
|
|
2374
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
/** Configure existing layer(s): set properties and replace classes. */
|
|
2378
|
+
async postLayer(body) {
|
|
2379
|
+
var _this2 = this;
|
|
2380
|
+
var _res$getHeader;
|
|
2381
|
+
return { location: (_res$getHeader = (await _this2.client.requestFull({
|
|
2382
|
+
path: "api/v4/layers",
|
|
2383
|
+
method: "POST",
|
|
2384
|
+
body,
|
|
2385
|
+
expectedStatus: 201
|
|
2386
|
+
})).getHeader("Location")) !== null && _res$getHeader !== void 0 ? _res$getHeader : "" };
|
|
2387
|
+
}
|
|
2388
|
+
/** Update layer properties (key-merge on the def JSON). */
|
|
2389
|
+
async patchLayer(layer, body) {
|
|
2390
|
+
var _this3 = this;
|
|
2391
|
+
var _res$getHeader2;
|
|
2392
|
+
return { location: (_res$getHeader2 = (await _this3.client.requestFull({
|
|
2393
|
+
path: _this3.layerPath(layer),
|
|
2394
|
+
method: "PATCH",
|
|
2395
|
+
body,
|
|
2396
|
+
expectedStatus: 303
|
|
2397
|
+
})).getHeader("Location")) !== null && _res$getHeader2 !== void 0 ? _res$getHeader2 : "" };
|
|
2398
|
+
}
|
|
2399
|
+
async getLayerClass(layer, classId) {
|
|
2400
|
+
var _this4 = this;
|
|
2401
|
+
const path = classId != null ? _this4.classPath(layer, classId) : `${_this4.layerPath(layer)}/classes`;
|
|
2402
|
+
return _this4.client.request({
|
|
2403
|
+
path,
|
|
2404
|
+
method: "GET"
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
async postLayerClass(layer, body) {
|
|
2408
|
+
var _this5 = this;
|
|
2409
|
+
var _res$getHeader3;
|
|
2410
|
+
return { location: (_res$getHeader3 = (await _this5.client.requestFull({
|
|
2411
|
+
path: `${_this5.layerPath(layer)}/classes`,
|
|
2412
|
+
method: "POST",
|
|
2413
|
+
body,
|
|
2414
|
+
expectedStatus: 201
|
|
2415
|
+
})).getHeader("Location")) !== null && _res$getHeader3 !== void 0 ? _res$getHeader3 : "" };
|
|
2416
|
+
}
|
|
2417
|
+
/** Update a class (key-merge). Styles/labels are managed via their own methods. */
|
|
2418
|
+
async patchLayerClass(layer, classId, body) {
|
|
2419
|
+
var _this6 = this;
|
|
2420
|
+
var _res$getHeader4;
|
|
2421
|
+
return { location: (_res$getHeader4 = (await _this6.client.requestFull({
|
|
2422
|
+
path: _this6.classPath(layer, classId),
|
|
2423
|
+
method: "PATCH",
|
|
2424
|
+
body,
|
|
2425
|
+
expectedStatus: 303
|
|
2426
|
+
})).getHeader("Location")) !== null && _res$getHeader4 !== void 0 ? _res$getHeader4 : "" };
|
|
2427
|
+
}
|
|
2428
|
+
/** Delete class(es). `classId` may be a comma-separated list of ids. */
|
|
2429
|
+
async deleteLayerClass(layer, classId) {
|
|
2430
|
+
var _this7 = this;
|
|
2431
|
+
await _this7.client.request({
|
|
2432
|
+
path: _this7.classPath(layer, classId),
|
|
2433
|
+
method: "DELETE",
|
|
2434
|
+
expectedStatus: 204
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
async getStyle(layer, classId, styleId) {
|
|
2438
|
+
var _this8 = this;
|
|
2439
|
+
const base = `${_this8.classPath(layer, classId)}/styles`;
|
|
2440
|
+
const path = styleId != null ? `${base}/${encodeURIComponent(styleId)}` : base;
|
|
2441
|
+
return _this8.client.request({
|
|
2442
|
+
path,
|
|
2443
|
+
method: "GET"
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
async postStyle(layer, classId, body) {
|
|
2447
|
+
var _this9 = this;
|
|
2448
|
+
var _res$getHeader5;
|
|
2449
|
+
return { location: (_res$getHeader5 = (await _this9.client.requestFull({
|
|
2450
|
+
path: `${_this9.classPath(layer, classId)}/styles`,
|
|
2451
|
+
method: "POST",
|
|
2452
|
+
body,
|
|
2453
|
+
expectedStatus: 201
|
|
2454
|
+
})).getHeader("Location")) !== null && _res$getHeader5 !== void 0 ? _res$getHeader5 : "" };
|
|
2455
|
+
}
|
|
2456
|
+
/** Update a style (key-merge). */
|
|
2457
|
+
async patchStyle(layer, classId, styleId, body) {
|
|
2458
|
+
var _this10 = this;
|
|
2459
|
+
var _res$getHeader6;
|
|
2460
|
+
return { location: (_res$getHeader6 = (await _this10.client.requestFull({
|
|
2461
|
+
path: `${_this10.classPath(layer, classId)}/styles/${encodeURIComponent(styleId)}`,
|
|
2462
|
+
method: "PATCH",
|
|
2463
|
+
body,
|
|
2464
|
+
expectedStatus: 303
|
|
2465
|
+
})).getHeader("Location")) !== null && _res$getHeader6 !== void 0 ? _res$getHeader6 : "" };
|
|
2466
|
+
}
|
|
2467
|
+
/** Delete style(s). `styleId` may be a comma-separated list of ids. */
|
|
2468
|
+
async deleteStyle(layer, classId, styleId) {
|
|
2469
|
+
var _this11 = this;
|
|
2470
|
+
await _this11.client.request({
|
|
2471
|
+
path: `${_this11.classPath(layer, classId)}/styles/${encodeURIComponent(styleId)}`,
|
|
2472
|
+
method: "DELETE",
|
|
2473
|
+
expectedStatus: 204
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2476
|
+
async getLabel(layer, classId, labelId) {
|
|
2477
|
+
var _this12 = this;
|
|
2478
|
+
const base = `${_this12.classPath(layer, classId)}/labels`;
|
|
2479
|
+
const path = labelId != null ? `${base}/${encodeURIComponent(labelId)}` : base;
|
|
2480
|
+
return _this12.client.request({
|
|
2481
|
+
path,
|
|
2482
|
+
method: "GET"
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
async postLabel(layer, classId, body) {
|
|
2486
|
+
var _this13 = this;
|
|
2487
|
+
var _res$getHeader7;
|
|
2488
|
+
return { location: (_res$getHeader7 = (await _this13.client.requestFull({
|
|
2489
|
+
path: `${_this13.classPath(layer, classId)}/labels`,
|
|
2490
|
+
method: "POST",
|
|
2491
|
+
body,
|
|
2492
|
+
expectedStatus: 201
|
|
2493
|
+
})).getHeader("Location")) !== null && _res$getHeader7 !== void 0 ? _res$getHeader7 : "" };
|
|
2494
|
+
}
|
|
2495
|
+
/** Update a label (key-merge). */
|
|
2496
|
+
async patchLabel(layer, classId, labelId, body) {
|
|
2497
|
+
var _this14 = this;
|
|
2498
|
+
var _res$getHeader8;
|
|
2499
|
+
return { location: (_res$getHeader8 = (await _this14.client.requestFull({
|
|
2500
|
+
path: `${_this14.classPath(layer, classId)}/labels/${encodeURIComponent(labelId)}`,
|
|
2501
|
+
method: "PATCH",
|
|
2502
|
+
body,
|
|
2503
|
+
expectedStatus: 303
|
|
2504
|
+
})).getHeader("Location")) !== null && _res$getHeader8 !== void 0 ? _res$getHeader8 : "" };
|
|
2505
|
+
}
|
|
2506
|
+
/** Delete label(s). `labelId` may be a comma-separated list of ids. */
|
|
2507
|
+
async deleteLabel(layer, classId, labelId) {
|
|
2508
|
+
var _this15 = this;
|
|
2509
|
+
await _this15.client.request({
|
|
2510
|
+
path: `${_this15.classPath(layer, classId)}/labels/${encodeURIComponent(labelId)}`,
|
|
2511
|
+
method: "DELETE",
|
|
2512
|
+
expectedStatus: 204
|
|
2513
|
+
});
|
|
2514
|
+
}
|
|
2515
|
+
};
|
|
2516
|
+
|
|
2354
2517
|
//#endregion
|
|
2355
2518
|
//#region src/provisioning/Privileges.ts
|
|
2356
2519
|
var Privileges = class {
|
|
@@ -2524,11 +2687,14 @@ var MetadataWrite = class {
|
|
|
2524
2687
|
this.client = client;
|
|
2525
2688
|
}
|
|
2526
2689
|
async patchMetaData(body) {
|
|
2527
|
-
|
|
2690
|
+
var _this = this;
|
|
2691
|
+
var _res$getHeader;
|
|
2692
|
+
return { location: (_res$getHeader = (await _this.client.requestFull({
|
|
2528
2693
|
path: "api/v4/meta",
|
|
2529
2694
|
method: "PATCH",
|
|
2530
|
-
body
|
|
2531
|
-
|
|
2695
|
+
body,
|
|
2696
|
+
expectedStatus: 303
|
|
2697
|
+
})).getHeader("Location")) !== null && _res$getHeader !== void 0 ? _res$getHeader : "" };
|
|
2532
2698
|
}
|
|
2533
2699
|
};
|
|
2534
2700
|
|
|
@@ -2650,6 +2816,7 @@ function createCentiaAdminClient(config) {
|
|
|
2650
2816
|
users: new ProvisioningUsers(http),
|
|
2651
2817
|
clients: new ProvisioningClients(http),
|
|
2652
2818
|
rules: new Rules(http),
|
|
2819
|
+
layers: new Layers(http),
|
|
2653
2820
|
privileges: new Privileges(http),
|
|
2654
2821
|
rpcMethods: new RpcMethods(http),
|
|
2655
2822
|
functions: new Functions(http),
|
|
@@ -2661,6 +2828,140 @@ function createCentiaAdminClient(config) {
|
|
|
2661
2828
|
};
|
|
2662
2829
|
}
|
|
2663
2830
|
|
|
2831
|
+
//#endregion
|
|
2832
|
+
//#region src/ogc/Ows.ts
|
|
2833
|
+
function toQuery$1(params) {
|
|
2834
|
+
if (!params) return void 0;
|
|
2835
|
+
const query = {};
|
|
2836
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
|
|
2837
|
+
return Object.keys(query).length > 0 ? query : void 0;
|
|
2838
|
+
}
|
|
2839
|
+
/**
|
|
2840
|
+
* OWS (WMS/WFS/UTFGRID) endpoint wrapper.
|
|
2841
|
+
*
|
|
2842
|
+
* Token-authenticated clients use `getOws`/`postOws`; anonymous and HTTP-Basic
|
|
2843
|
+
* clients use the `...NoToken` variants, which include the database in the path.
|
|
2844
|
+
*
|
|
2845
|
+
* Responses are streamed from the backend and returned as text (XML) or, for
|
|
2846
|
+
* JSON responses such as UTFGRID, as parsed JSON. Binary responses (e.g. WMS
|
|
2847
|
+
* GetMap images) are not supported by this wrapper — request those directly.
|
|
2848
|
+
*/
|
|
2849
|
+
var Ows = class {
|
|
2850
|
+
constructor(client) {
|
|
2851
|
+
this.client = client;
|
|
2852
|
+
}
|
|
2853
|
+
/** Token-authenticated OWS GET (WMS/WFS/UTFGRID). */
|
|
2854
|
+
async getOws(schema, params) {
|
|
2855
|
+
return this.client.request({
|
|
2856
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
|
|
2857
|
+
method: "GET",
|
|
2858
|
+
query: toQuery$1(params),
|
|
2859
|
+
accept: "*/*"
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
/** Token-authenticated OWS POST (WFS XML). */
|
|
2863
|
+
async postOws(schema, xml) {
|
|
2864
|
+
return this.client.request({
|
|
2865
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
|
|
2866
|
+
method: "POST",
|
|
2867
|
+
body: xml,
|
|
2868
|
+
contentType: "text/xml",
|
|
2869
|
+
accept: "*/*"
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
/** Anonymous/HTTP-Basic OWS GET (WMS/WFS/UTFGRID). */
|
|
2873
|
+
async getOwsNoToken(schema, database, params) {
|
|
2874
|
+
return this.client.request({
|
|
2875
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
|
|
2876
|
+
method: "GET",
|
|
2877
|
+
query: toQuery$1(params),
|
|
2878
|
+
accept: "*/*"
|
|
2879
|
+
});
|
|
2880
|
+
}
|
|
2881
|
+
/** Anonymous/HTTP-Basic OWS POST (WFS XML). */
|
|
2882
|
+
async postOwsNoToken(schema, database, xml) {
|
|
2883
|
+
return this.client.request({
|
|
2884
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
|
|
2885
|
+
method: "POST",
|
|
2886
|
+
body: xml,
|
|
2887
|
+
contentType: "text/xml",
|
|
2888
|
+
accept: "*/*"
|
|
2889
|
+
});
|
|
2890
|
+
}
|
|
2891
|
+
};
|
|
2892
|
+
|
|
2893
|
+
//#endregion
|
|
2894
|
+
//#region src/ogc/Wfs.ts
|
|
2895
|
+
function wfsPath(base, options) {
|
|
2896
|
+
let path = base;
|
|
2897
|
+
if ((options === null || options === void 0 ? void 0 : options.timeSlice) != null && options.srs == null) throw new Error("timeSlice requires srs to be set");
|
|
2898
|
+
if ((options === null || options === void 0 ? void 0 : options.srs) != null) {
|
|
2899
|
+
path += `/srs/${encodeURIComponent(options.srs)}`;
|
|
2900
|
+
if (options.timeSlice != null) path += `/${encodeURIComponent(options.timeSlice)}`;
|
|
2901
|
+
}
|
|
2902
|
+
return path;
|
|
2903
|
+
}
|
|
2904
|
+
function toQuery(params) {
|
|
2905
|
+
const query = { SERVICE: "WFS" };
|
|
2906
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
|
|
2907
|
+
return query;
|
|
2908
|
+
}
|
|
2909
|
+
/**
|
|
2910
|
+
* WFS endpoint wrapper (GetCapabilities, DescribeFeatureType, GetFeature and
|
|
2911
|
+
* WFS-T transactions).
|
|
2912
|
+
*
|
|
2913
|
+
* Token-authenticated clients use `getWfs`/`postWfs`; anonymous and HTTP-Basic
|
|
2914
|
+
* clients (e.g. QGIS) use the `...NoToken` variants, which include the
|
|
2915
|
+
* database in the path. Responses are returned as XML text.
|
|
2916
|
+
*/
|
|
2917
|
+
var Wfs = class {
|
|
2918
|
+
constructor(client) {
|
|
2919
|
+
this.client = client;
|
|
2920
|
+
}
|
|
2921
|
+
/** Token-authenticated WFS GET. */
|
|
2922
|
+
async getWfs(schema, params, options) {
|
|
2923
|
+
return this.client.request({
|
|
2924
|
+
path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
|
|
2925
|
+
method: "GET",
|
|
2926
|
+
query: toQuery(params),
|
|
2927
|
+
accept: "text/xml"
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
/** Token-authenticated WFS POST (XML-encoded GetFeature or Transaction). */
|
|
2931
|
+
async postWfs(schema, xml, options) {
|
|
2932
|
+
return this.client.request({
|
|
2933
|
+
path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
|
|
2934
|
+
method: "POST",
|
|
2935
|
+
body: xml,
|
|
2936
|
+
contentType: "text/xml",
|
|
2937
|
+
accept: "text/xml"
|
|
2938
|
+
});
|
|
2939
|
+
}
|
|
2940
|
+
/** Anonymous/HTTP-Basic WFS GET. */
|
|
2941
|
+
async getWfsNoToken(schema, database, params, options) {
|
|
2942
|
+
var _this3 = this;
|
|
2943
|
+
const base = `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
|
|
2944
|
+
return _this3.client.request({
|
|
2945
|
+
path: wfsPath(base, options),
|
|
2946
|
+
method: "GET",
|
|
2947
|
+
query: toQuery(params),
|
|
2948
|
+
accept: "text/xml"
|
|
2949
|
+
});
|
|
2950
|
+
}
|
|
2951
|
+
/** Anonymous/HTTP-Basic WFS POST (XML-encoded GetFeature or Transaction). */
|
|
2952
|
+
async postWfsNoToken(schema, database, xml, options) {
|
|
2953
|
+
var _this4 = this;
|
|
2954
|
+
const base = `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
|
|
2955
|
+
return _this4.client.request({
|
|
2956
|
+
path: wfsPath(base, options),
|
|
2957
|
+
method: "POST",
|
|
2958
|
+
body: xml,
|
|
2959
|
+
contentType: "text/xml",
|
|
2960
|
+
accept: "text/xml"
|
|
2961
|
+
});
|
|
2962
|
+
}
|
|
2963
|
+
};
|
|
2964
|
+
|
|
2664
2965
|
//#endregion
|
|
2665
2966
|
//#region src/auth/errors.ts
|
|
2666
2967
|
/**
|
|
@@ -2783,5 +3084,5 @@ function isExpired(jwt, skewSeconds) {
|
|
|
2783
3084
|
*/
|
|
2784
3085
|
|
|
2785
3086
|
//#endregion
|
|
2786
|
-
export { CentiaApiError, Claims, CodeFlow, Gql, Meta, NotLoggedInError, PasswordFlow, Rpc, SessionExpiredError, SignUp, Sql, SqlNoToken, Stats, Status, Tables, Users, Ws, createApi, createCentiaAdminClient, createCentiaClient, createSqlBuilder, createTokenProvider, isCentiaApiError };
|
|
3087
|
+
export { CentiaApiError, Claims, CodeFlow, Gql, Meta, NotLoggedInError, Ows, PasswordFlow, Rpc, SessionExpiredError, SignUp, Sql, SqlNoToken, Stats, Status, Tables, Users, Wfs, Ws, createApi, createCentiaAdminClient, createCentiaClient, createSqlBuilder, createTokenProvider, isCentiaApiError };
|
|
2787
3088
|
//# sourceMappingURL=centia-io-sdk.js.map
|