@sso-id/node 0.2.6 → 0.2.8

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.
Files changed (2) hide show
  1. package/dist/management.js +20 -26
  2. package/package.json +36 -36
@@ -311,48 +311,42 @@ export class ManagementClient {
311
311
  const appId = await this.getApplicationId();
312
312
  if (!appId)
313
313
  return [];
314
- const res = await this.request(`/api/applications/${encodeURIComponent(appId)}/menus`).catch(() => []);
315
- return this.unwrapList(res);
314
+ const res = await this.request('GET', `/api/applications/${encodeURIComponent(appId)}/menus`).catch(() => []);
315
+ return Array.isArray(res) ? res : [];
316
316
  },
317
317
  createMenu: async (data) => {
318
318
  const appId = await this.getApplicationId();
319
319
  if (!appId)
320
320
  throw new Error('Application not found for clientId');
321
- return this.request(`/api/applications/${encodeURIComponent(appId)}/menus`, {
322
- method: 'POST',
323
- body: JSON.stringify({
324
- applicationId: appId,
325
- menuTitle: data.menuTitle,
326
- menuUrl: data.menuUrl,
327
- menuDescription: data.menuDescription || '',
328
- parentId: data.parentId || '',
329
- sortOrder: data.sortOrder ?? 1,
330
- isCategory: data.isCategory ?? false,
331
- }),
321
+ return this.request('POST', `/api/applications/${encodeURIComponent(appId)}/menus`, {
322
+ applicationId: appId,
323
+ menuTitle: data.menuTitle,
324
+ menuUrl: data.menuUrl,
325
+ menuDescription: data.menuDescription || '',
326
+ parentId: data.parentId || '',
327
+ sortOrder: data.sortOrder ?? 1,
328
+ isCategory: data.isCategory ?? false,
332
329
  });
333
330
  },
334
331
  listApis: async () => {
335
332
  const appId = await this.getApplicationId();
336
333
  if (!appId)
337
334
  return [];
338
- const res = await this.request(`/api/applications/${encodeURIComponent(appId)}/apis`).catch(() => []);
339
- return this.unwrapList(res);
335
+ const res = await this.request('GET', `/api/applications/${encodeURIComponent(appId)}/apis`).catch(() => []);
336
+ return Array.isArray(res) ? res : [];
340
337
  },
341
338
  createApi: async (data) => {
342
339
  const appId = await this.getApplicationId();
343
340
  if (!appId)
344
341
  throw new Error('Application not found for clientId');
345
- return this.request(`/api/applications/${encodeURIComponent(appId)}/apis`, {
346
- method: 'POST',
347
- body: JSON.stringify({
348
- applicationId: appId,
349
- apiName: data.apiName,
350
- apiUrl: data.apiUrl,
351
- httpMethod: data.httpMethod || 'GET,POST',
352
- apiDescription: data.apiDescription || '',
353
- menuId: data.menuId || '',
354
- sortOrder: data.sortOrder ?? 1,
355
- }),
342
+ return this.request('POST', `/api/applications/${encodeURIComponent(appId)}/apis`, {
343
+ applicationId: appId,
344
+ apiName: data.apiName,
345
+ apiUrl: data.apiUrl,
346
+ httpMethod: data.httpMethod || 'GET,POST',
347
+ apiDescription: data.apiDescription || '',
348
+ menuId: data.menuId || '',
349
+ sortOrder: data.sortOrder ?? 1,
356
350
  });
357
351
  },
358
352
  };
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "name": "@sso-id/node",
3
- "version": "0.2.6",
4
- "type": "module",
5
- "description": "Official SSO.ID Node.js SDK (RS256 JWKS JWT verification, Express/Fastify middleware, Management API client)",
6
- "main": "dist/index.js",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "scripts": {
10
- "build": "tsc",
11
- "test": "node --test tests/*.test.mjs"
12
- },
13
- "keywords": [
14
- "sso.id",
15
- "node",
16
- "jwt",
17
- "jwks",
18
- "oauth2",
19
- "oidc",
20
- "management-api"
21
- ],
22
- "license": "MIT",
23
- "engines": {
24
- "node": ">=18.0.0"
25
- },
26
- "devDependencies": {
27
- "@types/node": "^20.11.0",
28
- "typescript": "^5.4.0"
29
- },
30
- "publishConfig": {
31
- "access": "public"
32
- },
33
- "files": [
34
- "dist"
35
- ]
36
- }
1
+ {
2
+ "name": "@sso-id/node",
3
+ "version": "0.2.8",
4
+ "type": "module",
5
+ "description": "Official SSO.ID Node.js SDK (RS256 JWKS JWT verification, Express/Fastify middleware, Management API client)",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "test": "node --test tests/*.test.mjs"
12
+ },
13
+ "keywords": [
14
+ "sso.id",
15
+ "node",
16
+ "jwt",
17
+ "jwks",
18
+ "oauth2",
19
+ "oidc",
20
+ "management-api"
21
+ ],
22
+ "license": "MIT",
23
+ "engines": {
24
+ "node": "\u003e=18.0.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^20.11.0",
28
+ "typescript": "^5.4.0"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ]
36
+ }