@centia-io/sdk 0.2.10 → 0.2.11
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 +38 -0
- package/dist/centia-io-sdk.cjs +77 -0
- package/dist/centia-io-sdk.d.cts +71 -1
- package/dist/centia-io-sdk.d.cts.map +1 -1
- package/dist/centia-io-sdk.d.ts +71 -1
- package/dist/centia-io-sdk.d.ts.map +1 -1
- package/dist/centia-io-sdk.js +77 -1
- package/dist/centia-io-sdk.js.map +1 -1
- package/dist/centia-io-sdk.umd.js +77 -0
- package/package.json +1 -1
package/dist/centia-io-sdk.js
CHANGED
|
@@ -3097,6 +3097,82 @@ var Keyvalue = class {
|
|
|
3097
3097
|
}
|
|
3098
3098
|
};
|
|
3099
3099
|
|
|
3100
|
+
//#endregion
|
|
3101
|
+
//#region src/features/Features.ts
|
|
3102
|
+
function featurePath(schema, table, feature) {
|
|
3103
|
+
const base = `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}/features`;
|
|
3104
|
+
if (feature === void 0) return base;
|
|
3105
|
+
return `${base}/${(Array.isArray(feature) ? feature : [feature]).map((k) => encodeURIComponent(String(k))).join(",")}`;
|
|
3106
|
+
}
|
|
3107
|
+
/**
|
|
3108
|
+
* Client for the Feature API (`/api/v4/schemas/{schema}/tables/{table}/features`).
|
|
3109
|
+
*
|
|
3110
|
+
* Reads and writes table rows as GeoJSON through WFS-T transactions. Read auth,
|
|
3111
|
+
* geofence rules and versioning filters are applied by the WFS engine.
|
|
3112
|
+
*
|
|
3113
|
+
* ```ts
|
|
3114
|
+
* const features = new Features(createCentiaClient({ baseUrl, auth }));
|
|
3115
|
+
* const feature = await features.getFeature('my_schema', 'my_table', 1);
|
|
3116
|
+
* ```
|
|
3117
|
+
*/
|
|
3118
|
+
var Features = class {
|
|
3119
|
+
constructor(client) {
|
|
3120
|
+
this.client = client;
|
|
3121
|
+
}
|
|
3122
|
+
/**
|
|
3123
|
+
* Get one or more features by primary key. A single match returns a bare
|
|
3124
|
+
* GeoJSON `Feature`; several matches return a `FeatureCollection`.
|
|
3125
|
+
* Throws a 404 `CentiaApiError` when no keys match.
|
|
3126
|
+
*/
|
|
3127
|
+
async getFeature(schema, table, feature, options) {
|
|
3128
|
+
return this.client.request({
|
|
3129
|
+
path: featurePath(schema, table, feature),
|
|
3130
|
+
method: "GET",
|
|
3131
|
+
query: (options === null || options === void 0 ? void 0 : options.srs) !== void 0 ? { srs: String(options.srs) } : void 0
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* Insert features from a GeoJSON `Feature` or `FeatureCollection`.
|
|
3136
|
+
* A primary-key value in `properties` is used as the new key; otherwise one
|
|
3137
|
+
* is generated. The returned location points at the new feature(s).
|
|
3138
|
+
*/
|
|
3139
|
+
async postFeature(schema, table, body, options) {
|
|
3140
|
+
var _this2 = this;
|
|
3141
|
+
var _res$getHeader;
|
|
3142
|
+
return { location: (_res$getHeader = (await _this2.client.requestFull({
|
|
3143
|
+
path: featurePath(schema, table),
|
|
3144
|
+
method: "POST",
|
|
3145
|
+
body,
|
|
3146
|
+
query: (options === null || options === void 0 ? void 0 : options.srs) !== void 0 ? { srs: String(options.srs) } : void 0,
|
|
3147
|
+
expectedStatus: 201
|
|
3148
|
+
})).getHeader("Location")) !== null && _res$getHeader !== void 0 ? _res$getHeader : "" };
|
|
3149
|
+
}
|
|
3150
|
+
/**
|
|
3151
|
+
* Update features from a GeoJSON `Feature` or `FeatureCollection`. Pass
|
|
3152
|
+
* `options.feature` to address a single feature by path; otherwise each
|
|
3153
|
+
* feature must carry its primary-key value in `properties`.
|
|
3154
|
+
*/
|
|
3155
|
+
async patchFeature(schema, table, body, options) {
|
|
3156
|
+
var _this3 = this;
|
|
3157
|
+
var _res$getHeader2;
|
|
3158
|
+
return { location: (_res$getHeader2 = (await _this3.client.requestFull({
|
|
3159
|
+
path: featurePath(schema, table, options === null || options === void 0 ? void 0 : options.feature),
|
|
3160
|
+
method: "PATCH",
|
|
3161
|
+
body,
|
|
3162
|
+
query: (options === null || options === void 0 ? void 0 : options.srs) !== void 0 ? { srs: String(options.srs) } : void 0,
|
|
3163
|
+
expectedStatus: 303
|
|
3164
|
+
})).getHeader("Location")) !== null && _res$getHeader2 !== void 0 ? _res$getHeader2 : "" };
|
|
3165
|
+
}
|
|
3166
|
+
/** Delete a single feature by primary key. */
|
|
3167
|
+
async deleteFeature(schema, table, feature) {
|
|
3168
|
+
await this.client.request({
|
|
3169
|
+
path: featurePath(schema, table, feature),
|
|
3170
|
+
method: "DELETE",
|
|
3171
|
+
expectedStatus: 204
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
};
|
|
3175
|
+
|
|
3100
3176
|
//#endregion
|
|
3101
3177
|
//#region src/auth/errors.ts
|
|
3102
3178
|
/**
|
|
@@ -3219,5 +3295,5 @@ function isExpired(jwt, skewSeconds) {
|
|
|
3219
3295
|
*/
|
|
3220
3296
|
|
|
3221
3297
|
//#endregion
|
|
3222
|
-
export { CentiaApiError, Claims, CodeFlow, Gql, Keyvalue, Mapcache, Meta, NotLoggedInError, Ows, PasswordFlow, Rpc, SessionExpiredError, SignUp, Sql, SqlNoToken, Stats, Status, Tables, Users, Wfs, Ws, createApi, createCentiaAdminClient, createCentiaClient, createSqlBuilder, createTokenProvider, isCentiaApiError };
|
|
3298
|
+
export { CentiaApiError, Claims, CodeFlow, Features, Gql, Keyvalue, Mapcache, Meta, NotLoggedInError, Ows, PasswordFlow, Rpc, SessionExpiredError, SignUp, Sql, SqlNoToken, Stats, Status, Tables, Users, Wfs, Ws, createApi, createCentiaAdminClient, createCentiaClient, createSqlBuilder, createTokenProvider, isCentiaApiError };
|
|
3223
3299
|
//# sourceMappingURL=centia-io-sdk.js.map
|