Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,56 @@
"import": "./dist/dist-node.js",
"browser": "./dist/index.js",
"default": "./dist/dist-node.js"
},
"./shared/cache": {
"types": "./dist/api/shared/cache.d.ts",
"import": "./dist/api/shared/cache.js",
"default": "./dist/api/shared/cache.js"
},
"./shared/errors": {
"types": "./dist/api/shared/errors.d.ts",
"import": "./dist/api/shared/errors.js",
"default": "./dist/api/shared/errors.js"
},
"./shared/http-utils": {
"types": "./dist/api/shared/http-utils.d.ts",
"import": "./dist/api/shared/http-utils.js",
"default": "./dist/api/shared/http-utils.js"
},
"./shared/models": {
"types": "./dist/api/shared/models.d.ts",
"import": "./dist/api/shared/models.js",
"default": "./dist/api/shared/models.js"
},
"./ogc-api": {
"types": "./dist/api/ogc-api.d.ts",
"import": "./dist/api/ogc-api.js",
"default": "./dist/api/ogc-api.js"
},
"./tms": {
"types": "./dist/api/tms.d.ts",
"import": "./dist/api/tms.js",
"default": "./dist/api/tms.js"
},
"./wfs": {
"types": "./dist/api/wfs.d.ts",
"import": "./dist/api/wfs.js",
"default": "./dist/api/wfs.js"
},
"./wms": {
"types": "./dist/api/wms.d.ts",
"import": "./dist/api/wms.js",
"default": "./dist/api/wms.js"
},
"./wmts": {
"types": "./dist/api/wmts.d.ts",
"import": "./dist/api/wmts.js",
"default": "./dist/api/wmts.js"
},
"./worker": {
"types": "./dist/api/worker.d.ts",
"import": "./dist/api/worker.js",
"default": "./dist/api/worker.js"
}
},
"dependencies": {
Expand Down
26 changes: 26 additions & 0 deletions src/api/ogc-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export { default as OgcApiEndpoint } from '../ogc-api/endpoint.js';
export { DataQueryTypes, CollectionParameterTypes } from '../ogc-api/model.js';
export type {
ConformanceClass,
OgcApiEndpointInfo,
DataQueryType,
CollectionParameterType,
CollectionParameter,
EdrParameterInfo,
OgcApiCollectionInfo,
OgcApiDocumentLink,
OgcApiDocument,
OgcApiRecordContact,
OgcApiRecordLanguage,
OgcApiRecordProperties,
OgcApiRecord,
OgcApiCollectionItem,
TileMatrixSet,
StyleItem,
OgcStyleFull,
OgcStyleBrief,
OgcApiStylesDocument,
OgcApiStyleRecord,
OgcApiStylesheet,
OgcApiStyleMetadata,
} from '../ogc-api/model.js';
1 change: 1 addition & 0 deletions src/api/shared/cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useCache, clearCache } from '../../shared/cache.js';
5 changes: 5 additions & 0 deletions src/api/shared/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export {
check,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can probably drop this to be honest, I can't remember why it's part of the API in the first place; to be investigated more

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess officially that would be an API break and a new major version since this function is already exposed?

Maybe in the first instance keep the export but mark it as @deprecated?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be a major version yes, but I think we're heading that way because we dropped support for older versions of node

ServiceExceptionError,
EndpointError,
} from '../../shared/errors.js';
6 changes: 6 additions & 0 deletions src/api/shared/http-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export {
sharedFetch,
setFetchOptions,
setQueryParams,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not put this in the API, even though it's useful it's also specific to what we do inside the library and we need toe flexibility to change its behavior without notice

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other functions already exposed from http-utils should stay though?

Since re-using this function was my original motivation for this then it's a shame, but I understand your reasons for not wanting it to be part of the API: I guess I'll just have to copy and paste it into my local library instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well we might also leave it exported but mark it as not part of the official API; then we still have the freedom of changing it in the future!

Could you describe a bit more your use case? maybe we can expose something a bit more high level in the API too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to look what I'm actually doing with it! Looks like building up custom WFS queries in a scenario where I'm not wanting to first retrieve the capabilities (capabilities are retrieved once when the layer is added and the configuration saved - when the map is re-opened then no new capabilities request is made).

I think I actually replaced a local function I had with this function since it is a nice implementation of all the special cases needed for dealing with OWS GET requests, particularly case-sensitive parameter names, and was better than what I previously had.

For such nice general-purpose functions I always find it a shame when libraries don't expose them for re-use, although I can understand the argument of wanting to keep the API surface higher-level.

resetFetchOptions,
} from '../../shared/http-utils.js';
12 changes: 12 additions & 0 deletions src/api/shared/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export type {
Address,
Contact,
Provider,
LayerStyle,
BoundingBox,
MetadataURL,
FetchOptions,
GenericEndpointInfo,
MimeType,
CrsCode,
} from '../../shared/models.js';
14 changes: 14 additions & 0 deletions src/api/tms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export { default as TmsEndpoint } from '../tms/endpoint.js';
export type {
TileMapService,
TmsEndpointInfo,
TileMapInfo,
ContactInformation,
Metadata,
Attribution,
TileMapReference,
TileSet,
TileFormat,
Origin,
TmsProfile,
} from '../tms/model.js';
14 changes: 14 additions & 0 deletions src/api/wfs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export { default as WfsEndpoint } from '../wfs/endpoint.js';
export type {
WfsVersion,
WfsFeatureWithProps,
WfsFeatureTypeSummary,
WfsFeatureTypeBrief,
FeatureGeometryType,
FeaturePropertyType,
WfsFeatureTypeFull,
WfsFeatureTypePropDetails,
WfsFeatureTypePropsDetails,
WfsFeatureTypeUniqueValue,
WfsGetFeatureOptions,
} from '../wfs/model.js';
7 changes: 7 additions & 0 deletions src/api/wms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export { default as WmsEndpoint } from '../wms/endpoint.js';
export type {
WmsLayerFull,
WmsVersion,
WmsLayerSummary,
WmsLayerAttribution,
} from '../wms/model.js';
8 changes: 8 additions & 0 deletions src/api/wmts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { default as WmtsEndpoint } from '../wmts/endpoint.js';
export type {
WmtsLayerDimensionValue,
WmtsLayerResourceLink,
WmtsEndpointInfo,
WmtsLayer,
WmtsMatrixSet,
} from '../wmts/model.js';
2 changes: 2 additions & 0 deletions src/api/worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { enableFallbackWithoutWorker } from '../worker/index.js';
import '../worker-fallback/index.js';
68 changes: 10 additions & 58 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,12 @@
export { default as WfsEndpoint } from './wfs/endpoint.js';
export type {
WfsVersion,
WfsFeatureWithProps,
WfsFeatureTypeSummary,
WfsFeatureTypeBrief,
FeatureGeometryType,
FeaturePropertyType,
WfsFeatureTypeFull,
WfsFeatureTypePropDetails,
WfsFeatureTypePropsDetails,
WfsFeatureTypeUniqueValue,
WfsGetFeatureOptions,
} from './wfs/model.js';
export { default as WmsEndpoint } from './wms/endpoint.js';
export type {
WmsLayerFull,
WmsVersion,
WmsLayerSummary,
WmsLayerAttribution,
} from './wms/model.js';
export { default as WmtsEndpoint } from './wmts/endpoint.js';
export type {
WmtsLayerDimensionValue,
WmtsLayerResourceLink,
WmtsEndpointInfo,
WmtsLayer,
WmtsMatrixSet,
} from './wmts/model.js';
export type {
Address,
Contact,
Provider,
LayerStyle,
BoundingBox,
MetadataURL,
FetchOptions,
GenericEndpointInfo,
MimeType,
CrsCode,
} from './shared/models.js';
export { default as OgcApiEndpoint } from './ogc-api/endpoint.js';
export * from './ogc-api/model.js';
export { default as TmsEndpoint } from './tms/endpoint.js';
export * from './tms/model.js';
export * from './api/ogc-api.js';
export * from './api/tms.js';
export * from './api/wfs.js';
export * from './api/wms.js';
export * from './api/wmts.js';

export { useCache, clearCache } from './shared/cache.js';
export {
sharedFetch,
setFetchOptions,
resetFetchOptions,
} from './shared/http-utils.js';
export {
check,
ServiceExceptionError,
EndpointError,
} from './shared/errors.js';
export * from './api/shared/cache.js';
export * from './api/shared/errors.js';
export * from './api/shared/http-utils.js';
export type * from './api/shared/models.js';

export { enableFallbackWithoutWorker } from './worker/index.js';
import './worker-fallback/index.js';
export * from './api/worker.js';