@smartspace/api-client 0.1.0-pr.1283.8c8b984 → 0.1.0-pr.1286.59ac4f9

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.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Generated from each GET operation's `x-tags` by scripts/operation-tags.js. Do not edit manually.
3
+ * Each function takes the request's path arguments, in the same order as the request, and returns
4
+ * the change tags the response depends on: put them on the query (`meta.tags`).
5
+ */
6
+ export declare const OperationTags: {
7
+ /** GET /v1/Files/{id} */
8
+ readonly filesGetFileInfo: (id: string) => readonly [`files:${string}`];
9
+ /** GET /v1/MessageThreads/{id} */
10
+ readonly messageThreadsGetMessageThreadId: (id: string) => readonly [`messageThreads:${string}`];
11
+ /** GET /v1/MessageThreads/{id}/comments */
12
+ readonly messageThreadsGetComments: (id: string) => readonly [`messageThreads:${string}/comments`];
13
+ /** GET /v1/MessageThreads/{id}/messages */
14
+ readonly messageThreadsThreadMessagesIdMessages: (id: string) => readonly [`messageThreads:${string}/messages`];
15
+ /** GET /v1/Messages/{id}/comments */
16
+ readonly messagesGetComments: (id: string) => readonly [`messages:${string}/comments`];
17
+ /** GET /v1/Models */
18
+ readonly modelsGetModels: () => readonly ["models"];
19
+ /** GET /v1/Models/{id} */
20
+ readonly modelsGetModel: (id: string) => readonly [`models:${string}`];
21
+ /** GET /v1/WorkSpaces */
22
+ readonly workSpacesGetGet: () => readonly ["workspaces"];
23
+ /** GET /v1/WorkSpaces/{id} */
24
+ readonly workSpacesGetId: (id: string) => readonly [`workspaces:${string}`];
25
+ /** GET /v1/WorkSpaces/{id}/messageThreads */
26
+ readonly workSpacesThread: (id: string) => readonly [`workspaces:${string}/messageThreads`];
27
+ /** GET /v1/workspaces/{workspaceId}/messagethreads/{id} */
28
+ readonly messageThreadsGetMessageThreadWorkspacesWorkspaceIdMessagethreadsId: (_workspaceId: string, id: string) => readonly [`messageThreads:${string}`];
29
+ /** GET /v1/workspaces/{workspaceId}/messagethreads/{id}/messages */
30
+ readonly messageThreadsThreadMessagesWorkspacesWorkspaceIdMessagethreadsIdMessages: (_workspaceId: string, id: string) => readonly [`messageThreads:${string}/messages`];
31
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Generated from each GET operation's `x-tags` by scripts/operation-tags.js. Do not edit manually.
4
+ * Each function takes the request's path arguments, in the same order as the request, and returns
5
+ * the change tags the response depends on: put them on the query (`meta.tags`).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.OperationTags = void 0;
9
+ exports.OperationTags = {
10
+ /** GET /v1/Files/{id} */
11
+ filesGetFileInfo: (id) => [`files:${id}`],
12
+ /** GET /v1/MessageThreads/{id} */
13
+ messageThreadsGetMessageThreadId: (id) => [`messageThreads:${id}`],
14
+ /** GET /v1/MessageThreads/{id}/comments */
15
+ messageThreadsGetComments: (id) => [`messageThreads:${id}/comments`],
16
+ /** GET /v1/MessageThreads/{id}/messages */
17
+ messageThreadsThreadMessagesIdMessages: (id) => [`messageThreads:${id}/messages`],
18
+ /** GET /v1/Messages/{id}/comments */
19
+ messagesGetComments: (id) => [`messages:${id}/comments`],
20
+ /** GET /v1/Models */
21
+ modelsGetModels: () => ['models'],
22
+ /** GET /v1/Models/{id} */
23
+ modelsGetModel: (id) => [`models:${id}`],
24
+ /** GET /v1/WorkSpaces */
25
+ workSpacesGetGet: () => ['workspaces'],
26
+ /** GET /v1/WorkSpaces/{id} */
27
+ workSpacesGetId: (id) => [`workspaces:${id}`],
28
+ /** GET /v1/WorkSpaces/{id}/messageThreads */
29
+ workSpacesThread: (id) => [`workspaces:${id}/messageThreads`],
30
+ /** GET /v1/workspaces/{workspaceId}/messagethreads/{id} */
31
+ messageThreadsGetMessageThreadWorkspacesWorkspaceIdMessagethreadsId: (_workspaceId, id) => [`messageThreads:${id}`],
32
+ /** GET /v1/workspaces/{workspaceId}/messagethreads/{id}/messages */
33
+ messageThreadsThreadMessagesWorkspacesWorkspaceIdMessagethreadsIdMessages: (_workspaceId, id) => [`messageThreads:${id}/messages`],
34
+ };
@@ -869,8 +869,8 @@ const getSmartSpaceAdminAPI = () => {
869
869
  });
870
870
  };
871
871
  /**
872
- * @summary Upserts the override value for a parameter. Type-checked against the registry: a
873
- boolean key requires a JSON boolean value, etc.
872
+ * @summary Upserts the override value for a parameter. The management API type-checks it against the
873
+ registry (a boolean key requires a JSON boolean value, etc.); this route forwards it unchanged.
874
874
  */
875
875
  const installParametersUpsert = (key, coreManagementUpsertInstallParameterModel) => {
876
876
  return (0, instance_1.customInstance)({ url: `/v1/InstallParameters/${key}`, method: 'PUT',
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Generated from each GET operation's `x-tags` by scripts/operation-tags.js. Do not edit manually.
3
+ * Each function takes the request's path arguments, in the same order as the request, and returns
4
+ * the change tags the response depends on: put them on the query (`meta.tags`).
5
+ */
6
+ export declare const OperationTags: {
7
+ /** GET /v1/DataSets */
8
+ readonly dataSetsGet: () => readonly ["datasets"];
9
+ /** GET /v1/DataSets/{id} */
10
+ readonly dataSetsGetById: (id: string) => readonly [`datasets:${string}`];
11
+ /** GET /v1/DataSources */
12
+ readonly dataSourcesGet: () => readonly ["datasources"];
13
+ /** GET /v1/DataSpaces */
14
+ readonly dataSpacesGet: () => readonly ["dataspaces"];
15
+ /** GET /v1/DataSpaces/{id} */
16
+ readonly dataSpacesGetById: (id: string) => readonly [`dataspaces:${string}`];
17
+ /** GET /v1/DataSpaces/{id}/datasets */
18
+ readonly dataSpacesGetDataSets: (id: string) => readonly [`dataspaces:${string}/datasets`];
19
+ /** GET /v1/Files/{id} */
20
+ readonly filesGetFileInfo: (id: string) => readonly [`files:${string}`];
21
+ /** GET /v1/Models */
22
+ readonly modelsGetModels: () => readonly ["models"];
23
+ /** GET /v1/Models/default */
24
+ readonly modelsGetDefaultModel: () => readonly ["models"];
25
+ /** GET /v1/Models/{id} */
26
+ readonly modelsGetModel: (id: string) => readonly [`models:${string}`];
27
+ /** GET /v1/WorkSpaces */
28
+ readonly workSpacesGetGet: () => readonly ["workspaces"];
29
+ /** GET /v1/WorkSpaces/{id} */
30
+ readonly workSpacesGetId: (id: string) => readonly [`workspaces:${string}`];
31
+ /** GET /v1/WorkSpaces/{id}/messageThreads */
32
+ readonly workSpacesGetThreads: (id: string) => readonly [`workspaces:${string}/messageThreads`];
33
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Generated from each GET operation's `x-tags` by scripts/operation-tags.js. Do not edit manually.
4
+ * Each function takes the request's path arguments, in the same order as the request, and returns
5
+ * the change tags the response depends on: put them on the query (`meta.tags`).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.OperationTags = void 0;
9
+ exports.OperationTags = {
10
+ /** GET /v1/DataSets */
11
+ dataSetsGet: () => ['datasets'],
12
+ /** GET /v1/DataSets/{id} */
13
+ dataSetsGetById: (id) => [`datasets:${id}`],
14
+ /** GET /v1/DataSources */
15
+ dataSourcesGet: () => ['datasources'],
16
+ /** GET /v1/DataSpaces */
17
+ dataSpacesGet: () => ['dataspaces'],
18
+ /** GET /v1/DataSpaces/{id} */
19
+ dataSpacesGetById: (id) => [`dataspaces:${id}`],
20
+ /** GET /v1/DataSpaces/{id}/datasets */
21
+ dataSpacesGetDataSets: (id) => [`dataspaces:${id}/datasets`],
22
+ /** GET /v1/Files/{id} */
23
+ filesGetFileInfo: (id) => [`files:${id}`],
24
+ /** GET /v1/Models */
25
+ modelsGetModels: () => ['models'],
26
+ /** GET /v1/Models/default */
27
+ modelsGetDefaultModel: () => ['models'],
28
+ /** GET /v1/Models/{id} */
29
+ modelsGetModel: (id) => [`models:${id}`],
30
+ /** GET /v1/WorkSpaces */
31
+ workSpacesGetGet: () => ['workspaces'],
32
+ /** GET /v1/WorkSpaces/{id} */
33
+ workSpacesGetId: (id) => [`workspaces:${id}`],
34
+ /** GET /v1/WorkSpaces/{id}/messageThreads */
35
+ workSpacesGetThreads: (id) => [`workspaces:${id}/messageThreads`],
36
+ };
@@ -2653,8 +2653,8 @@ export declare const installParametersGetResponse: zod.ZodObject<{
2653
2653
  key: zod.ZodString;
2654
2654
  }, zod.core.$strip>;
2655
2655
  /**
2656
- * @summary Upserts the override value for a parameter. Type-checked against the registry: a
2657
- boolean key requires a JSON boolean value, etc.
2656
+ * @summary Upserts the override value for a parameter. The management API type-checks it against the
2657
+ registry (a boolean key requires a JSON boolean value, etc.); this route forwards it unchanged.
2658
2658
  */
2659
2659
  export declare const installParametersUpsertParams: zod.ZodObject<{
2660
2660
  key: zod.ZodString;
@@ -2353,8 +2353,8 @@ exports.installParametersGetResponse = zod_1.default.object({
2353
2353
  "key": zod_1.default.string()
2354
2354
  });
2355
2355
  /**
2356
- * @summary Upserts the override value for a parameter. Type-checked against the registry: a
2357
- boolean key requires a JSON boolean value, etc.
2356
+ * @summary Upserts the override value for a parameter. The management API type-checks it against the
2357
+ registry (a boolean key requires a JSON boolean value, etc.); this route forwards it unchanged.
2358
2358
  */
2359
2359
  exports.installParametersUpsertParams = zod_1.default.strictObject({
2360
2360
  "key": zod_1.default.string()
package/dist/index.d.ts CHANGED
@@ -6,4 +6,7 @@ export * as ConfigModels from './generated/config/models';
6
6
  export * as ConfigZod from './generated/config/zod';
7
7
  export * as SignalR from './signalr';
8
8
  export { AXIOS_INSTANCE } from './instance';
9
+ export { isApiProblem, type ApiProblem } from './problem';
9
10
  export * from './generated/config/change-tags';
11
+ export { OperationTags as ConfigOperationTags } from './generated/config/operation-tags';
12
+ export { OperationTags as ChatOperationTags } from './generated/chat/operation-tags';
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.AXIOS_INSTANCE = exports.SignalR = exports.ConfigZod = exports.ConfigModels = exports.ConfigApi = exports.ChatZod = exports.ChatModels = exports.ChatApi = void 0;
39
+ exports.ChatOperationTags = exports.ConfigOperationTags = exports.isApiProblem = exports.AXIOS_INSTANCE = exports.SignalR = exports.ConfigZod = exports.ConfigModels = exports.ConfigApi = exports.ChatZod = exports.ChatModels = exports.ChatApi = void 0;
40
40
  exports.ChatApi = __importStar(require("./generated/chat/api"));
41
41
  exports.ChatModels = __importStar(require("./generated/chat/models"));
42
42
  exports.ChatZod = __importStar(require("./generated/chat/zod"));
@@ -46,4 +46,10 @@ exports.ConfigZod = __importStar(require("./generated/config/zod"));
46
46
  exports.SignalR = __importStar(require("./signalr"));
47
47
  var instance_1 = require("./instance");
48
48
  Object.defineProperty(exports, "AXIOS_INSTANCE", { enumerable: true, get: function () { return instance_1.AXIOS_INSTANCE; } });
49
+ var problem_1 = require("./problem");
50
+ Object.defineProperty(exports, "isApiProblem", { enumerable: true, get: function () { return problem_1.isApiProblem; } });
49
51
  __exportStar(require("./generated/config/change-tags"), exports);
52
+ var operation_tags_1 = require("./generated/config/operation-tags");
53
+ Object.defineProperty(exports, "ConfigOperationTags", { enumerable: true, get: function () { return operation_tags_1.OperationTags; } });
54
+ var operation_tags_2 = require("./generated/chat/operation-tags");
55
+ Object.defineProperty(exports, "ChatOperationTags", { enumerable: true, get: function () { return operation_tags_2.OperationTags; } });
@@ -0,0 +1,12 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+ import type { MicrosoftAspNetCoreMvcProblemDetails } from './generated/chat/models';
3
+ /** The problem+json body every SmartSpace API error response carries. */
4
+ export type ApiProblem = MicrosoftAspNetCoreMvcProblemDetails;
5
+ /**
6
+ * Narrows a thrown error to an API error response with a problem+json body, so `code`,
7
+ * `retryable` and `traceId` are typed without a cast. False for network errors, cancellations
8
+ * and error responses that did not come from the API (a gateway's HTML 502, for one).
9
+ */
10
+ export declare const isApiProblem: (error: unknown) => error is AxiosError<ApiProblem> & {
11
+ response: AxiosResponse<ApiProblem>;
12
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isApiProblem = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ /**
9
+ * Narrows a thrown error to an API error response with a problem+json body, so `code`,
10
+ * `retryable` and `traceId` are typed without a cast. False for network errors, cancellations
11
+ * and error responses that did not come from the API (a gateway's HTML 502, for one).
12
+ */
13
+ const isApiProblem = (error) => {
14
+ if (!axios_1.default.isAxiosError(error))
15
+ return false;
16
+ const body = error.response?.data;
17
+ if (!body || typeof body !== 'object')
18
+ return false;
19
+ const { code, retryable, traceId } = body;
20
+ return typeof code === 'string' && typeof retryable === 'boolean' && typeof traceId === 'string';
21
+ };
22
+ exports.isApiProblem = isApiProblem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartspace/api-client",
3
- "version": "0.1.0-pr.1283.8c8b984",
3
+ "version": "0.1.0-pr.1286.59ac4f9",
4
4
  "description": "Generated TypeScript client for SmartSpace APIs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "generate": "npm run generate:rest && npm run generate:signalr",
22
- "generate:rest": "orval --config orval.config.ts && node ./scripts/extensible-enums.js && node ./scripts/change-tags.js",
22
+ "generate:rest": "orval --config orval.config.ts && node ./scripts/extensible-enums.js && node ./scripts/change-tags.js && node ./scripts/operation-tags.js",
23
23
  "generate:signalr": "dotnet tsrts --project ../../SmartSpace.App.Business/SmartSpace.App.Business.csproj --output src/generated/signalr --asm --enum Name",
24
24
  "build": "tsc",
25
25
  "prepublishOnly": "npm run generate && npm run build"