@esri/hub-common 24.2.0 → 24.3.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/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layouts/layout-system-types.js.map +1 -1
- package/dist/esm/layouts/updateLayout.js +33 -0
- package/dist/esm/layouts/updateLayout.js.map +1 -0
- package/dist/esm/layouts/upsertLayoutResource.js +78 -0
- package/dist/esm/layouts/upsertLayoutResource.js.map +1 -0
- package/dist/esm/newsletters/api/orval/api/orval-newsletters.js.map +1 -1
- package/dist/esm/newsletters-scheduler/api/orval/api/orval-newsletters-scheduler.js.map +1 -1
- package/dist/esm/objects/deepMerge.js +13 -6
- package/dist/esm/objects/deepMerge.js.map +1 -1
- package/dist/esm/projects/edit.js +2 -0
- package/dist/esm/projects/edit.js.map +1 -1
- package/dist/esm/resources/doesResourceExist.js +3 -2
- package/dist/esm/resources/doesResourceExist.js.map +1 -1
- package/dist/esm/resources/upsertResource.js +1 -1
- package/dist/esm/resources/upsertResource.js.map +1 -1
- package/dist/esm/resources-api/api/orval/api/orval-resources.js +70 -0
- package/dist/esm/resources-api/api/orval/api/orval-resources.js.map +1 -0
- package/dist/esm/resources-api/api/orval/custom-client.js +44 -0
- package/dist/esm/resources-api/api/orval/custom-client.js.map +1 -0
- package/dist/esm/resources-api/api/resources.js +23 -0
- package/dist/esm/resources-api/api/resources.js.map +1 -0
- package/dist/esm/resources-api/api/types.js +2 -0
- package/dist/esm/resources-api/api/types.js.map +1 -0
- package/dist/esm/resources-api/api/utils/authenticate-request.js +15 -0
- package/dist/esm/resources-api/api/utils/authenticate-request.js.map +1 -0
- package/dist/node/index.js +15 -9
- package/dist/node/index.js.map +1 -1
- package/dist/node/layouts/layout-system-types.js.map +1 -1
- package/dist/node/layouts/updateLayout.js +36 -0
- package/dist/node/layouts/updateLayout.js.map +1 -0
- package/dist/node/layouts/upsertLayoutResource.js +81 -0
- package/dist/node/layouts/upsertLayoutResource.js.map +1 -0
- package/dist/node/newsletters/api/orval/api/orval-newsletters.js.map +1 -1
- package/dist/node/newsletters-scheduler/api/orval/api/orval-newsletters-scheduler.js.map +1 -1
- package/dist/node/objects/deepMerge.js +13 -6
- package/dist/node/objects/deepMerge.js.map +1 -1
- package/dist/node/projects/edit.js +2 -0
- package/dist/node/projects/edit.js.map +1 -1
- package/dist/node/resources/doesResourceExist.js +3 -2
- package/dist/node/resources/doesResourceExist.js.map +1 -1
- package/dist/node/resources/upsertResource.js +1 -1
- package/dist/node/resources/upsertResource.js.map +1 -1
- package/dist/node/resources-api/api/orval/api/orval-resources.js +78 -0
- package/dist/node/resources-api/api/orval/api/orval-resources.js.map +1 -0
- package/dist/node/resources-api/api/orval/custom-client.js +47 -0
- package/dist/node/resources-api/api/orval/custom-client.js.map +1 -0
- package/dist/node/resources-api/api/resources.js +27 -0
- package/dist/node/resources-api/api/resources.js.map +1 -0
- package/dist/node/resources-api/api/types.js +7 -0
- package/dist/node/resources-api/api/types.js.map +1 -0
- package/dist/node/resources-api/api/utils/authenticate-request.js +18 -0
- package/dist/node/resources-api/api/utils/authenticate-request.js.map +1 -0
- package/dist/types/events/api/orval/api/orval-events.d.ts +0 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/layouts/layout-system-types.d.ts +3 -3
- package/dist/types/layouts/migrations/types/ILayoutV2.d.ts +2 -0
- package/dist/types/layouts/updateLayout.d.ts +4 -0
- package/dist/types/layouts/upsertLayoutResource.d.ts +26 -0
- package/dist/types/newsletters/api/orval/api/orval-newsletters.d.ts +0 -1
- package/dist/types/newsletters-scheduler/api/orval/api/orval-newsletters-scheduler.d.ts +0 -1
- package/dist/types/resources/doesResourceExist.d.ts +1 -1
- package/dist/types/resources-api/api/orval/api/orval-resources.d.ts +90 -0
- package/dist/types/resources-api/api/orval/custom-client.d.ts +22 -0
- package/dist/types/resources-api/api/resources.d.ts +15 -0
- package/dist/types/resources-api/api/types.d.ts +24 -0
- package/dist/types/resources-api/api/utils/authenticate-request.d.ts +9 -0
- package/package.json +1 -1
- package/dist/esm/newsletters/api/orval/awaited-type.js +0 -2
- package/dist/esm/newsletters/api/orval/awaited-type.js.map +0 -1
- package/dist/esm/newsletters-scheduler/api/orval/awaited-type.js +0 -2
- package/dist/esm/newsletters-scheduler/api/orval/awaited-type.js.map +0 -1
- package/dist/node/newsletters/api/orval/awaited-type.js +0 -3
- package/dist/node/newsletters/api/orval/awaited-type.js.map +0 -1
- package/dist/node/newsletters-scheduler/api/orval/awaited-type.js +0 -3
- package/dist/node/newsletters-scheduler/api/orval/awaited-type.js.map +0 -1
- package/dist/types/newsletters/api/orval/awaited-type.d.ts +0 -5
- package/dist/types/newsletters-scheduler/api/orval/awaited-type.d.ts +0 -5
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customClient = customClient;
|
|
4
|
+
async function customClient(orvalParams, customParams) {
|
|
5
|
+
const { url, method, data } = orvalParams;
|
|
6
|
+
const { mode, cache, credentials } = customParams;
|
|
7
|
+
const { headers, params } = combineParams(orvalParams, customParams);
|
|
8
|
+
const baseUrl = removeTrailingSlash(customParams.hubApiUrl);
|
|
9
|
+
const requestUrl = `${baseUrl}${url}?${new URLSearchParams(params)}`;
|
|
10
|
+
const requestOptions = {
|
|
11
|
+
headers,
|
|
12
|
+
method,
|
|
13
|
+
cache,
|
|
14
|
+
credentials,
|
|
15
|
+
mode,
|
|
16
|
+
};
|
|
17
|
+
if (data) {
|
|
18
|
+
requestOptions.body = JSON.stringify(data);
|
|
19
|
+
}
|
|
20
|
+
const res = await fetch(requestUrl, requestOptions);
|
|
21
|
+
const { statusText, status } = res;
|
|
22
|
+
if (res.ok) {
|
|
23
|
+
return res.json();
|
|
24
|
+
}
|
|
25
|
+
const error = await res.json();
|
|
26
|
+
throw new RemoteServerError(statusText, requestUrl, status, JSON.stringify(error.message));
|
|
27
|
+
}
|
|
28
|
+
function removeTrailingSlash(hubApiUrl = "https://hub.arcgis.com") {
|
|
29
|
+
return hubApiUrl.replace(/\/$/, "");
|
|
30
|
+
}
|
|
31
|
+
function combineParams(orvalParams, options) {
|
|
32
|
+
const headers = new Headers(Object.assign(Object.assign({}, orvalParams.headers), options.headers));
|
|
33
|
+
if (options.token) {
|
|
34
|
+
headers.set("Authorization", options.token);
|
|
35
|
+
}
|
|
36
|
+
const params = Object.assign(Object.assign({}, orvalParams.params), options.params);
|
|
37
|
+
return { headers, params };
|
|
38
|
+
}
|
|
39
|
+
class RemoteServerError extends Error {
|
|
40
|
+
constructor(message, url, status, error) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.status = status;
|
|
43
|
+
this.url = url;
|
|
44
|
+
this.error = error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=custom-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-client.js","sourceRoot":"","sources":["../../../../../src/resources-api/api/orval/custom-client.ts"],"names":[],"mappings":";;AAuBA,oCAoCC;AApCM,KAAK,UAAU,YAAY,CAChC,WAAyB,EACzB,YAA2B;IAE3B,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;IAC1C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAClD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAErE,MAAM,OAAO,GAAG,mBAAmB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,GAAG,OAAO,GAAG,GAAG,IAAI,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IAErE,MAAM,cAAc,GAAgB;QAClC,OAAO;QACP,MAAM;QACN,KAAK;QACL,WAAW;QACX,IAAI;KACL,CAAC;IACF,IAAI,IAAI,EAAE,CAAC;QACT,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACpD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEnC,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,IAAI,iBAAiB,CACzB,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,SAAS,GAAG,wBAAwB;IAC/D,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,aAAa,CAAC,WAAyB,EAAE,OAAsB;IACtE,MAAM,OAAO,GAAG,IAAI,OAAO,iCACtB,WAAW,CAAC,OAAO,GACnB,OAAO,CAAC,OAAO,EAClB,CAAC;IACH,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,MAAM,mCACP,WAAW,CAAC,MAAM,GAClB,OAAO,CAAC,MAAM,CAClB,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAKnC,YAAY,OAAe,EAAE,GAAW,EAAE,MAAc,EAAE,KAAa;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createResource = createResource;
|
|
4
|
+
exports.getResource = getResource;
|
|
5
|
+
const authenticate_request_1 = require("./utils/authenticate-request");
|
|
6
|
+
const orval_resources_1 = require("./orval/api/orval-resources");
|
|
7
|
+
/**
|
|
8
|
+
* create a resource
|
|
9
|
+
*
|
|
10
|
+
* @param {ICreateResourceParams} options
|
|
11
|
+
* @return {Promise<IResource>}
|
|
12
|
+
*/
|
|
13
|
+
async function createResource(options) {
|
|
14
|
+
options.token = await (0, authenticate_request_1.authenticateRequest)(options);
|
|
15
|
+
return (0, orval_resources_1.createResource)(options.data, options);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* get a resource by id
|
|
19
|
+
*
|
|
20
|
+
* @param {IGetResourceParams} options
|
|
21
|
+
* @return {Promise<IResource>}
|
|
22
|
+
*/
|
|
23
|
+
async function getResource(options) {
|
|
24
|
+
options.token = await (0, authenticate_request_1.authenticateRequest)(options);
|
|
25
|
+
return (0, orval_resources_1.getResource)(options.id, options);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../../src/resources-api/api/resources.ts"],"names":[],"mappings":";;AAaA,wCAKC;AAQD,kCAKC;AA9BD,uEAAmE;AACnE,iEAGqC;AAErC;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAClC,OAA8B;IAE9B,OAAO,CAAC,KAAK,GAAG,MAAM,IAAA,0CAAmB,EAAC,OAAO,CAAC,CAAC;IACnD,OAAO,IAAA,gCAAe,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA2B;IAE3B,OAAO,CAAC,KAAK,GAAG,MAAM,IAAA,0CAAmB,EAAC,OAAO,CAAC,CAAC;IACnD,OAAO,IAAA,6BAAY,EAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ICreateResourceEntityType = exports.ICreateResourceMimeType = void 0;
|
|
4
|
+
var orval_resources_1 = require("./orval/api/orval-resources");
|
|
5
|
+
Object.defineProperty(exports, "ICreateResourceMimeType", { enumerable: true, get: function () { return orval_resources_1.ICreateResourceMimeType; } });
|
|
6
|
+
Object.defineProperty(exports, "ICreateResourceEntityType", { enumerable: true, get: function () { return orval_resources_1.ICreateResourceEntityType; } });
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/resources-api/api/types.ts"],"names":[],"mappings":";;;AAAA,+DAKqC;AAFnC,0HAAA,uBAAuB,OAAA;AACvB,4HAAA,yBAAyB,OAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authenticateRequest = authenticateRequest;
|
|
4
|
+
/**
|
|
5
|
+
* return a token created using options.authentication or set on options.token
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @param {IResourcesRequestOptions} options
|
|
9
|
+
* @return {*} {Promise<string>}
|
|
10
|
+
*/
|
|
11
|
+
function authenticateRequest(options) {
|
|
12
|
+
const { token, authentication } = options;
|
|
13
|
+
if (authentication) {
|
|
14
|
+
return authentication.getToken(authentication.portal);
|
|
15
|
+
}
|
|
16
|
+
return Promise.resolve(token);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=authenticate-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticate-request.js","sourceRoot":"","sources":["../../../../../src/resources-api/api/utils/authenticate-request.ts"],"names":[],"mappings":";;AASA,kDAUC;AAjBD;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,OAAiC;IAEjC,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAE1C,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -292,6 +292,8 @@ export { INewslettersSchedulerRequestOptions, INotify, INotifyParams, IScheduler
|
|
|
292
292
|
export { createSubscription, getSubscription, getSubscriptions, subscribe, updateSubscription, } from "./newsletters/api/subscriptions";
|
|
293
293
|
export { DeliveryMethod, ICreateEventMetadata, ICreateSubscriptionParams, ICreateTelemetryReportMetadata, ICreateUserParams, IDeleteUserParams, IGetSubscriptionParams, IGetSubscriptionsParams, IGetUserParams, INewslettersRequestOptions, INotificationSpec, ISubscribeMetadata, ISubscribeParams, ISubscription, ISubscriptionMetadata, IUpdateSubscriptionParams, IUpdateUserParams, IUser, NewsletterCadence, SubscriptionAction, SystemNotificationSpecNames, } from "./newsletters/api/types";
|
|
294
294
|
export { createUser, deleteUser, getUser, updateUser, } from "./newsletters/api/users";
|
|
295
|
+
export { IResource, ICreateResource, ICreateResourceMimeType, ICreateResourceEntityType, IResourcesRequestOptions, ICreateResourceParams, IGetResourceParams, } from "./resources-api/api/types";
|
|
296
|
+
export { createResource, getResource } from "./resources-api/api/resources";
|
|
295
297
|
export { _deepMapValues, _isDate, _isFunction, _isObject, _isRegExp, _isString, } from "./objects/_deep-map-values";
|
|
296
298
|
export { _mapValues } from "./objects/_map-values";
|
|
297
299
|
export { deepSet } from "./objects/deep-set";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HubEntity } from "../core/types/HubEntity";
|
|
2
|
-
import type { IConfigurationSchema } from "../core/schemas/types";
|
|
2
|
+
import type { IConfigurationSchema, IConfigurationValues } from "../core/schemas/types";
|
|
3
3
|
import type { IEntityPermissionPolicy } from "../permissions/types/IEntityPermissionPolicy";
|
|
4
4
|
import type { IHubSite } from "../core/types/IHubSite";
|
|
5
5
|
import type { IUiSchema } from "../core/schemas/types";
|
|
@@ -315,13 +315,13 @@ type LayoutNodeEditorConfigBase = {
|
|
|
315
315
|
* Optional callback to transform values before
|
|
316
316
|
* passing to the editor.
|
|
317
317
|
*/
|
|
318
|
-
valuesInCallback?: (val:
|
|
318
|
+
valuesInCallback?: (val: IConfigurationValues) => unknown;
|
|
319
319
|
/**
|
|
320
320
|
* Optional callback to transform values after
|
|
321
321
|
* editing, before mapping back to the node's
|
|
322
322
|
* properties.
|
|
323
323
|
*/
|
|
324
|
-
valuesOutCallback?: (
|
|
324
|
+
valuesOutCallback?: (vals: IConfigurationValues, options?: Record<string, unknown>) => unknown;
|
|
325
325
|
/** Additional properties to pass to the editor. */
|
|
326
326
|
properties?: Record<string, unknown>;
|
|
327
327
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IUserRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { IHubItemEntity } from "../core/types/IHubItemEntity.js";
|
|
3
|
+
import { ILayout } from "./types.js";
|
|
4
|
+
export declare function updateLayout(entity: IHubItemEntity, layout: ILayout, requestOptions: IUserRequestOptions): Promise<ILayout>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IUserRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
+
/**
|
|
3
|
+
* Given an item, and owner, Search for if the resource exists
|
|
4
|
+
* and if does, update it, otherwise add it. Returns a url for the item.
|
|
5
|
+
*
|
|
6
|
+
* Note that layout resources are typically stored with
|
|
7
|
+
* - a "layout/" prefix (so we can find them)
|
|
8
|
+
* - a name that starts with the cardId
|
|
9
|
+
* - and a -{timestamp} suffix (to bust the cache)
|
|
10
|
+
* thus 'update' is not really an update, it is:
|
|
11
|
+
* - upload the new one
|
|
12
|
+
* - then find the old one (which has a different suffix) and delete it.
|
|
13
|
+
*
|
|
14
|
+
* this is why we cannot simply use upsertResource
|
|
15
|
+
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
* @param {string} id
|
|
19
|
+
* @param {string} owner
|
|
20
|
+
* @param {*} resource
|
|
21
|
+
* @param {string} name
|
|
22
|
+
* @param {string} extension
|
|
23
|
+
* @param {IUserRequestOptions} ro
|
|
24
|
+
* @return {*} {Promise<string>}
|
|
25
|
+
*/
|
|
26
|
+
export declare function upsertLayoutResource(id: string, owner: string, resource: unknown, name: string, extension: string, ro: IUserRequestOptions): Promise<string>;
|
|
@@ -7,4 +7,4 @@ import type { IUserRequestOptions } from "@esri/arcgis-rest-request";
|
|
|
7
7
|
* @param ro Request options
|
|
8
8
|
* @returns boolean
|
|
9
9
|
*/
|
|
10
|
-
export declare function doesResourceExist(id: string, name: string, ro: IUserRequestOptions): Promise<boolean>;
|
|
10
|
+
export declare function doesResourceExist(id: string, name: string, ro: IUserRequestOptions, prefix?: string): Promise<boolean>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v6.31.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Hub Resources Service
|
|
5
|
+
* OpenAPI spec version: 0.0.1
|
|
6
|
+
*/
|
|
7
|
+
import { customClient } from "../custom-client";
|
|
8
|
+
export interface UpdateResourceDto {
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare enum ResourceStatus {
|
|
12
|
+
PENDING = "PENDING",
|
|
13
|
+
UPLOADED = "UPLOADED",
|
|
14
|
+
FAILED = "FAILED"
|
|
15
|
+
}
|
|
16
|
+
export interface IResource {
|
|
17
|
+
/** @nullable */
|
|
18
|
+
altText: string | null;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
entityId: string;
|
|
21
|
+
entityType: string;
|
|
22
|
+
fileName: string;
|
|
23
|
+
id: string;
|
|
24
|
+
mimeType: string;
|
|
25
|
+
presignedUrl: string;
|
|
26
|
+
s3Key: string;
|
|
27
|
+
/** @nullable */
|
|
28
|
+
sizeBytes: number | null;
|
|
29
|
+
status: ResourceStatus;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
uploadedBy: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* MIME type of the resource
|
|
35
|
+
*/
|
|
36
|
+
export declare enum ICreateResourceMimeType {
|
|
37
|
+
"image/jpeg" = "image/jpeg",
|
|
38
|
+
"image/png" = "image/png",
|
|
39
|
+
"image/webp" = "image/webp"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Type of entity associated with the resource
|
|
43
|
+
*/
|
|
44
|
+
export declare enum ICreateResourceEntityType {
|
|
45
|
+
event = "event"
|
|
46
|
+
}
|
|
47
|
+
export interface ICreateResource {
|
|
48
|
+
/**
|
|
49
|
+
* Alternative text for the resource
|
|
50
|
+
* @nullable
|
|
51
|
+
*/
|
|
52
|
+
altText?: string | null;
|
|
53
|
+
/** Entity ID associated with the resource */
|
|
54
|
+
entityId: string;
|
|
55
|
+
/** Type of entity associated with the resource */
|
|
56
|
+
entityType: ICreateResourceEntityType;
|
|
57
|
+
/** File name */
|
|
58
|
+
fileName: string;
|
|
59
|
+
/** MIME type of the resource */
|
|
60
|
+
mimeType: ICreateResourceMimeType;
|
|
61
|
+
/** AGO ID of the user who uploaded the resource */
|
|
62
|
+
uploadedBy: string;
|
|
63
|
+
}
|
|
64
|
+
type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
|
|
65
|
+
/**
|
|
66
|
+
* Create a new resource.
|
|
67
|
+
*/
|
|
68
|
+
export declare const createResource: (iCreateResource: ICreateResource, options?: SecondParameter<typeof customClient>) => Promise<IResource>;
|
|
69
|
+
/**
|
|
70
|
+
* Search for resources matching request criteria.
|
|
71
|
+
*/
|
|
72
|
+
export declare const searchResources: (options?: SecondParameter<typeof customClient>) => Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Get a single resource.
|
|
75
|
+
*/
|
|
76
|
+
export declare const getResource: (id: string, options?: SecondParameter<typeof customClient>) => Promise<IResource>;
|
|
77
|
+
/**
|
|
78
|
+
* Update an existing resource.
|
|
79
|
+
*/
|
|
80
|
+
export declare const updateResource: (id: string, updateResourceDto: UpdateResourceDto, options?: SecondParameter<typeof customClient>) => Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Delete an existing resource.
|
|
83
|
+
*/
|
|
84
|
+
export declare const deleteResource: (id: string, options?: SecondParameter<typeof customClient>) => Promise<void>;
|
|
85
|
+
export type CreateResourceResult = NonNullable<Awaited<ReturnType<typeof createResource>>>;
|
|
86
|
+
export type SearchResourcesResult = NonNullable<Awaited<ReturnType<typeof searchResources>>>;
|
|
87
|
+
export type GetResourceResult = NonNullable<Awaited<ReturnType<typeof getResource>>>;
|
|
88
|
+
export type UpdateResourceResult = NonNullable<Awaited<ReturnType<typeof updateResource>>>;
|
|
89
|
+
export type DeleteResourceResult = NonNullable<Awaited<ReturnType<typeof deleteResource>>>;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated and copied from the [hub engagement repo](https://github.com/ArcGIS/hub-engagement/blob/master/orval/custom-client.ts)
|
|
3
|
+
* Do not edit manually
|
|
4
|
+
*/
|
|
5
|
+
export interface IOrvalParams {
|
|
6
|
+
url: string;
|
|
7
|
+
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
8
|
+
headers?: HeadersInit;
|
|
9
|
+
params?: Record<string, any>;
|
|
10
|
+
data?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
export interface ICustomParams {
|
|
13
|
+
hubApiUrl?: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
headers?: HeadersInit;
|
|
16
|
+
params?: Record<string, any>;
|
|
17
|
+
data?: Record<string, any>;
|
|
18
|
+
mode?: RequestMode;
|
|
19
|
+
cache?: RequestCache;
|
|
20
|
+
credentials?: RequestCredentials;
|
|
21
|
+
}
|
|
22
|
+
export declare function customClient<T>(orvalParams: IOrvalParams, customParams: ICustomParams): Promise<T>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICreateResourceParams, IGetResourceParams, IResource } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* create a resource
|
|
4
|
+
*
|
|
5
|
+
* @param {ICreateResourceParams} options
|
|
6
|
+
* @return {Promise<IResource>}
|
|
7
|
+
*/
|
|
8
|
+
export declare function createResource(options: ICreateResourceParams): Promise<IResource>;
|
|
9
|
+
/**
|
|
10
|
+
* get a resource by id
|
|
11
|
+
*
|
|
12
|
+
* @param {IGetResourceParams} options
|
|
13
|
+
* @return {Promise<IResource>}
|
|
14
|
+
*/
|
|
15
|
+
export declare function getResource(options: IGetResourceParams): Promise<IResource>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { IResource, ICreateResource, ICreateResourceMimeType, ICreateResourceEntityType, } from "./orval/api/orval-resources";
|
|
2
|
+
import { IHubRequestOptions } from "../../hub-types";
|
|
3
|
+
import { ICreateResource } from "./orval/api/orval-resources";
|
|
4
|
+
/**
|
|
5
|
+
* options for making requests against the Resources API
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @interface IResourcesRequestOptions
|
|
9
|
+
* @extends IHubRequestOptions
|
|
10
|
+
*/
|
|
11
|
+
export interface IResourcesRequestOptions extends Omit<IHubRequestOptions, "httpMethod" | "isPortal">, Pick<RequestInit, "mode" | "cache" | "credentials"> {
|
|
12
|
+
httpMethod?: "GET" | "POST" | "PATCH" | "DELETE";
|
|
13
|
+
isPortal?: boolean;
|
|
14
|
+
token?: string;
|
|
15
|
+
data?: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface ICreateResourceParams extends IResourcesRequestOptions {
|
|
20
|
+
data: ICreateResource;
|
|
21
|
+
}
|
|
22
|
+
export interface IGetResourceParams extends IResourcesRequestOptions {
|
|
23
|
+
id: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IResourcesRequestOptions } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* return a token created using options.authentication or set on options.token
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @param {IResourcesRequestOptions} options
|
|
7
|
+
* @return {*} {Promise<string>}
|
|
8
|
+
*/
|
|
9
|
+
export declare function authenticateRequest(options: IResourcesRequestOptions): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"awaited-type.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/orval/awaited-type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"awaited-type.js","sourceRoot":"","sources":["../../../../../src/newsletters-scheduler/api/orval/awaited-type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"awaited-type.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/orval/awaited-type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"awaited-type.js","sourceRoot":"","sources":["../../../../../src/newsletters-scheduler/api/orval/awaited-type.ts"],"names":[],"mappings":""}
|