@centia-io/sdk 0.2.1 → 0.2.2
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 +300 -0
- package/dist/centia-io-sdk.d.cts +228 -2
- package/dist/centia-io-sdk.d.cts.map +1 -1
- package/dist/centia-io-sdk.d.ts +228 -2
- package/dist/centia-io-sdk.d.ts.map +1 -1
- package/dist/centia-io-sdk.js +299 -1
- package/dist/centia-io-sdk.js.map +1 -1
- package/dist/centia-io-sdk.umd.js +300 -0
- 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 {
|
|
@@ -2650,6 +2813,7 @@ function createCentiaAdminClient(config) {
|
|
|
2650
2813
|
users: new ProvisioningUsers(http),
|
|
2651
2814
|
clients: new ProvisioningClients(http),
|
|
2652
2815
|
rules: new Rules(http),
|
|
2816
|
+
layers: new Layers(http),
|
|
2653
2817
|
privileges: new Privileges(http),
|
|
2654
2818
|
rpcMethods: new RpcMethods(http),
|
|
2655
2819
|
functions: new Functions(http),
|
|
@@ -2661,6 +2825,140 @@ function createCentiaAdminClient(config) {
|
|
|
2661
2825
|
};
|
|
2662
2826
|
}
|
|
2663
2827
|
|
|
2828
|
+
//#endregion
|
|
2829
|
+
//#region src/ogc/Ows.ts
|
|
2830
|
+
function toQuery$1(params) {
|
|
2831
|
+
if (!params) return void 0;
|
|
2832
|
+
const query = {};
|
|
2833
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
|
|
2834
|
+
return Object.keys(query).length > 0 ? query : void 0;
|
|
2835
|
+
}
|
|
2836
|
+
/**
|
|
2837
|
+
* OWS (WMS/WFS/UTFGRID) endpoint wrapper.
|
|
2838
|
+
*
|
|
2839
|
+
* Token-authenticated clients use `getOws`/`postOws`; anonymous and HTTP-Basic
|
|
2840
|
+
* clients use the `...NoToken` variants, which include the database in the path.
|
|
2841
|
+
*
|
|
2842
|
+
* Responses are streamed from the backend and returned as text (XML) or, for
|
|
2843
|
+
* JSON responses such as UTFGRID, as parsed JSON. Binary responses (e.g. WMS
|
|
2844
|
+
* GetMap images) are not supported by this wrapper — request those directly.
|
|
2845
|
+
*/
|
|
2846
|
+
var Ows = class {
|
|
2847
|
+
constructor(client) {
|
|
2848
|
+
this.client = client;
|
|
2849
|
+
}
|
|
2850
|
+
/** Token-authenticated OWS GET (WMS/WFS/UTFGRID). */
|
|
2851
|
+
async getOws(schema, params) {
|
|
2852
|
+
return this.client.request({
|
|
2853
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
|
|
2854
|
+
method: "GET",
|
|
2855
|
+
query: toQuery$1(params),
|
|
2856
|
+
accept: "*/*"
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
/** Token-authenticated OWS POST (WFS XML). */
|
|
2860
|
+
async postOws(schema, xml) {
|
|
2861
|
+
return this.client.request({
|
|
2862
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
|
|
2863
|
+
method: "POST",
|
|
2864
|
+
body: xml,
|
|
2865
|
+
contentType: "text/xml",
|
|
2866
|
+
accept: "*/*"
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
/** Anonymous/HTTP-Basic OWS GET (WMS/WFS/UTFGRID). */
|
|
2870
|
+
async getOwsNoToken(schema, database, params) {
|
|
2871
|
+
return this.client.request({
|
|
2872
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
|
|
2873
|
+
method: "GET",
|
|
2874
|
+
query: toQuery$1(params),
|
|
2875
|
+
accept: "*/*"
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
/** Anonymous/HTTP-Basic OWS POST (WFS XML). */
|
|
2879
|
+
async postOwsNoToken(schema, database, xml) {
|
|
2880
|
+
return this.client.request({
|
|
2881
|
+
path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
|
|
2882
|
+
method: "POST",
|
|
2883
|
+
body: xml,
|
|
2884
|
+
contentType: "text/xml",
|
|
2885
|
+
accept: "*/*"
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2888
|
+
};
|
|
2889
|
+
|
|
2890
|
+
//#endregion
|
|
2891
|
+
//#region src/ogc/Wfs.ts
|
|
2892
|
+
function wfsPath(base, options) {
|
|
2893
|
+
let path = base;
|
|
2894
|
+
if ((options === null || options === void 0 ? void 0 : options.timeSlice) != null && options.srs == null) throw new Error("timeSlice requires srs to be set");
|
|
2895
|
+
if ((options === null || options === void 0 ? void 0 : options.srs) != null) {
|
|
2896
|
+
path += `/srs/${encodeURIComponent(options.srs)}`;
|
|
2897
|
+
if (options.timeSlice != null) path += `/${encodeURIComponent(options.timeSlice)}`;
|
|
2898
|
+
}
|
|
2899
|
+
return path;
|
|
2900
|
+
}
|
|
2901
|
+
function toQuery(params) {
|
|
2902
|
+
const query = { SERVICE: "WFS" };
|
|
2903
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
|
|
2904
|
+
return query;
|
|
2905
|
+
}
|
|
2906
|
+
/**
|
|
2907
|
+
* WFS endpoint wrapper (GetCapabilities, DescribeFeatureType, GetFeature and
|
|
2908
|
+
* WFS-T transactions).
|
|
2909
|
+
*
|
|
2910
|
+
* Token-authenticated clients use `getWfs`/`postWfs`; anonymous and HTTP-Basic
|
|
2911
|
+
* clients (e.g. QGIS) use the `...NoToken` variants, which include the
|
|
2912
|
+
* database in the path. Responses are returned as XML text.
|
|
2913
|
+
*/
|
|
2914
|
+
var Wfs = class {
|
|
2915
|
+
constructor(client) {
|
|
2916
|
+
this.client = client;
|
|
2917
|
+
}
|
|
2918
|
+
/** Token-authenticated WFS GET. */
|
|
2919
|
+
async getWfs(schema, params, options) {
|
|
2920
|
+
return this.client.request({
|
|
2921
|
+
path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
|
|
2922
|
+
method: "GET",
|
|
2923
|
+
query: toQuery(params),
|
|
2924
|
+
accept: "text/xml"
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
/** Token-authenticated WFS POST (XML-encoded GetFeature or Transaction). */
|
|
2928
|
+
async postWfs(schema, xml, options) {
|
|
2929
|
+
return this.client.request({
|
|
2930
|
+
path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
|
|
2931
|
+
method: "POST",
|
|
2932
|
+
body: xml,
|
|
2933
|
+
contentType: "text/xml",
|
|
2934
|
+
accept: "text/xml"
|
|
2935
|
+
});
|
|
2936
|
+
}
|
|
2937
|
+
/** Anonymous/HTTP-Basic WFS GET. */
|
|
2938
|
+
async getWfsNoToken(schema, database, params, options) {
|
|
2939
|
+
var _this3 = this;
|
|
2940
|
+
const base = `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
|
|
2941
|
+
return _this3.client.request({
|
|
2942
|
+
path: wfsPath(base, options),
|
|
2943
|
+
method: "GET",
|
|
2944
|
+
query: toQuery(params),
|
|
2945
|
+
accept: "text/xml"
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
/** Anonymous/HTTP-Basic WFS POST (XML-encoded GetFeature or Transaction). */
|
|
2949
|
+
async postWfsNoToken(schema, database, xml, options) {
|
|
2950
|
+
var _this4 = this;
|
|
2951
|
+
const base = `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
|
|
2952
|
+
return _this4.client.request({
|
|
2953
|
+
path: wfsPath(base, options),
|
|
2954
|
+
method: "POST",
|
|
2955
|
+
body: xml,
|
|
2956
|
+
contentType: "text/xml",
|
|
2957
|
+
accept: "text/xml"
|
|
2958
|
+
});
|
|
2959
|
+
}
|
|
2960
|
+
};
|
|
2961
|
+
|
|
2664
2962
|
//#endregion
|
|
2665
2963
|
//#region src/auth/errors.ts
|
|
2666
2964
|
/**
|
|
@@ -2783,5 +3081,5 @@ function isExpired(jwt, skewSeconds) {
|
|
|
2783
3081
|
*/
|
|
2784
3082
|
|
|
2785
3083
|
//#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 };
|
|
3084
|
+
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
3085
|
//# sourceMappingURL=centia-io-sdk.js.map
|