@eaera-com/cms-sdk 0.1.66 → 0.1.67
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/chunks/{_shared-DdBWuPm_.js → _shared-DZlTUzoa.js} +2 -2
- package/dist/chunks/{_shared-DdBWuPm_.js.map → _shared-DZlTUzoa.js.map} +1 -1
- package/dist/chunks/{storage.constant--64BDSPW.js → storage.constant-CVWam5ls.js} +2 -1
- package/dist/chunks/storage.constant-CVWam5ls.js.map +1 -0
- package/dist/common/constants/storage.constant.d.ts +1 -0
- package/dist/common/constants/storage.constant.d.ts.map +1 -1
- package/dist/index.js +171 -118
- package/dist/index.js.map +1 -1
- package/dist/server/auth/cbs-callback.post.js +2 -2
- package/dist/server/auth/cbs-start.post.js +1 -1
- package/dist/server/auth/idp-callback.get.js +2 -2
- package/dist/server/auth/idp-link.post.js +2 -2
- package/dist/server/auth/idp-login.get.js +1 -1
- package/dist/server/auth/idp-unlink.delete.js +2 -2
- package/dist/server/auth/login.post.js +2 -2
- package/dist/server/auth/logout.post.js +2 -2
- package/dist/server/auth/refresh.post.js +2 -2
- package/dist/server/authz/portal-access.get.js +2 -2
- package/dist/server/clear-token.delete.js +1 -1
- package/dist/server/persist.post.js +1 -1
- package/dist/server/set-token.post.js +1 -1
- package/dist/services/executions/executions.type.d.ts +8 -0
- package/dist/services/executions/executions.type.d.ts.map +1 -1
- package/dist/services/notifications/index.d.ts.map +1 -1
- package/dist/services/notifications/notifications.type.d.ts +7 -0
- package/dist/services/notifications/notifications.type.d.ts.map +1 -1
- package/dist/services/people/packops/index.d.ts +13 -6
- package/dist/services/people/packops/index.d.ts.map +1 -1
- package/dist/services/people/process/actions.d.ts +8 -1
- package/dist/services/people/process/actions.d.ts.map +1 -1
- package/dist/services/people/process/ct.types.d.ts +7 -0
- package/dist/services/people/process/ct.types.d.ts.map +1 -1
- package/dist/stores/authz.d.ts +1 -1
- package/dist/stores/authz.d.ts.map +1 -1
- package/dist/stores/executions.d.ts +12 -0
- package/dist/stores/executions.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/storage.constant--64BDSPW.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as COOKIE_DEFAULTS } from './storage.constant
|
|
1
|
+
import { a as COOKIE_DEFAULTS } from './storage.constant-CVWam5ls.js';
|
|
2
2
|
import { useRuntimeConfig } from '#imports';
|
|
3
3
|
|
|
4
4
|
const TOKEN_COOKIE_OPTIONS = {
|
|
@@ -24,4 +24,4 @@ function readSdkConfig(event) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export { TOKEN_COOKIE_OPTIONS as T, readSdkConfig as r };
|
|
27
|
-
//# sourceMappingURL=_shared-
|
|
27
|
+
//# sourceMappingURL=_shared-DZlTUzoa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared-
|
|
1
|
+
{"version":3,"file":"_shared-DZlTUzoa.js","sources":["../../src/server/auth/_shared.ts"],"sourcesContent":["import {\n COOKIE_DEFAULTS,\n REFRESH_TOKEN_STORAGE_KEY,\n TOKEN_STORAGE_KEY,\n} from '../../common/constants/storage.constant';\nimport type { RequestCasing, ResponseCasing } from '../../common/constants/http.constant';\nimport { useRuntimeConfig } from '#imports';\n\n/** Cookie options for the httpOnly access-token cookie (server-side set). */\nexport const TOKEN_COOKIE_OPTIONS = {\n httpOnly: COOKIE_DEFAULTS.HTTP_ONLY,\n secure: COOKIE_DEFAULTS.SECURE,\n sameSite: COOKIE_DEFAULTS.SAME_SITE.toLowerCase() as 'lax',\n path: COOKIE_DEFAULTS.PATH,\n maxAge: COOKIE_DEFAULTS.MAX_AGE_SECONDS,\n};\n\nexport { TOKEN_STORAGE_KEY, REFRESH_TOKEN_STORAGE_KEY };\n\n/**\n * Resolve the CMS backend URL + client id from the module options the Nuxt\n * module stored on `runtimeConfig.public.cmsSdkOptions` (mirrors the plugin\n * resolution). Runs inside the consumer's Nitro server where `useRuntimeConfig`\n * is auto-imported.\n */\nexport function readSdkConfig(event: unknown): {\n cmsUrl: string;\n clientId: string;\n /** Default portal id for portal-scoped flows (module option `cmsSdk.portal`). */\n portal?: string;\n requestCasing?: RequestCasing;\n responseCasing?: ResponseCasing;\n} {\n const config = useRuntimeConfig(event) as { public?: Record<string, any> } | undefined;\n const pub = (config?.public ?? {}) as Record<string, any>;\n const opts = (pub.cmsSdkOptions ?? {}) as {\n endpoints?: Record<string, string>;\n clientId?: string;\n portal?: string;\n requestCasing?: RequestCasing;\n responseCasing?: ResponseCasing;\n };\n const cmsUrl = pub[opts.endpoints?.cms ?? 'cmsUrl'];\n const clientId = pub[opts.clientId ?? 'clientId'];\n return {\n cmsUrl,\n clientId,\n portal: opts.portal,\n requestCasing: opts.requestCasing,\n responseCasing: opts.responseCasing,\n };\n}\n"],"names":[],"mappings":";;;AASO,MAAM,oBAAA,GAAuB;AAAA,EAClC,UAAU,eAAA,CAAgB,SAAA;AAAA,EAC1B,QAAQ,eAAA,CAAgB,MAAA;AAAA,EACxB,QAAA,EAAU,eAAA,CAAgB,SAAA,CAAU,WAAA,EAAY;AAAA,EAChD,MAAM,eAAA,CAAgB,IAAA;AAAA,EACtB,QAAQ,eAAA,CAAgB;AAC1B;AAUO,SAAS,cAAc,KAAA,EAO5B;AACA,EAAA,MAAM,MAAA,GAAS,iBAAiB,KAAK,CAAA;AACrC,EAAA,MAAM,GAAA,GAAO,MAAA,EAAQ,MAAA,IAAU,EAAC;AAChC,EAAA,MAAM,IAAA,GAAQ,GAAA,CAAI,aAAA,IAAiB,EAAC;AAOpC,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,IAAA,CAAK,SAAA,EAAW,OAAO,QAAQ,CAAA;AAClD,EAAA,MAAM,QAAA,GAAW,GAAA,CAAI,IAAA,CAAK,QAAA,IAAY,UAAU,CAAA;AAChD,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAQ,IAAA,CAAK,MAAA;AAAA,IACb,eAAe,IAAA,CAAK,aAAA;AAAA,IACpB,gBAAgB,IAAA,CAAK;AAAA,GACvB;AACF;;;;"}
|
|
@@ -10,6 +10,7 @@ const COOKIE_DEFAULTS = {
|
|
|
10
10
|
};
|
|
11
11
|
const STORE_PERSIST_KEY = {
|
|
12
12
|
AUTH: "cms-auth-v1",
|
|
13
|
+
AUTHZ: "cms-authz-v1",
|
|
13
14
|
CONTENT: "cms-content-v1",
|
|
14
15
|
RULES: "cms-rules-v1",
|
|
15
16
|
EXECUTIONS: "cms-executions-v1",
|
|
@@ -41,4 +42,4 @@ const COOKIE_SAME_SITE = {
|
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
export { COOKIE_SAME_SITE as C, PERSIST_KEY as P, REFRESH_TOKEN_STORAGE_KEY as R, STORE_PERSIST_KEY as S, TOKEN_STORAGE_KEY as T, COOKIE_DEFAULTS as a, PERSIST_ALLOWED_KEYS as b, PERSIST_MAX_BYTES as c, PERSIST_PREFIX as d, STORAGE_NAME as e };
|
|
44
|
-
//# sourceMappingURL=storage.constant
|
|
45
|
+
//# sourceMappingURL=storage.constant-CVWam5ls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.constant-CVWam5ls.js","sources":["../../src/common/constants/storage.constant.ts"],"sourcesContent":["/**\n * Token storage constants — the single source for the storage key so the\n * memory/localStorage/cookie adapters never drift apart.\n */\nexport const TOKEN_STORAGE_KEY = 'cms_access_token' as const;\n\n/**\n * Refresh-token cookie key. Stored as an httpOnly cookie (parallel to the access\n * token) so the SDK can silently rotate the access token when it expires.\n */\nexport const REFRESH_TOKEN_STORAGE_KEY = 'cms_refresh_token' as const;\n\n/** Cookie adapter defaults (overridable via `credentials.cookie`). */\nexport const COOKIE_DEFAULTS = {\n MAX_AGE_SECONDS: 60 * 60 * 24 * 30, // 30 days\n PATH: '/',\n SECURE: true,\n SAME_SITE: 'Lax',\n HTTP_ONLY: true,\n} as const;\n\n/** Pinia persistence keys (versioned for schema migration). */\nexport const STORE_PERSIST_KEY = {\n AUTH: 'cms-auth-v1',\n AUTHZ: 'cms-authz-v1',\n CONTENT: 'cms-content-v1',\n RULES: 'cms-rules-v1',\n EXECUTIONS: 'cms-executions-v1',\n SETTINGS: 'cms-settings-v1',\n LLM: 'cms-llm-v1',\n LLM_PROVIDERS: 'cms-llm-providers-v1',\n BARS: 'cms-bars-v1',\n HISTORY: 'cms-history-v1',\n KALSHI: 'cms-kalshi-v1',\n GOV: 'cms-gov-v1',\n PEOPLE: 'cms-people-v1',\n} as const;\n\n/**\n * Internal cookie persistence (replaces pinia-plugin-persistedstate).\n *\n * Each persisted state → its own cookie `${PERSIST_KEY.<store>}.${field}`.\n * The common `/api/cms-sdk/persist` endpoint may only set keys in\n * `PERSIST_ALLOWED_KEYS` (single source of truth, shared by the plugin + the\n * endpoint). The token key is always excluded as a belt-and-suspenders guard.\n */\nexport const PERSIST_PREFIX = 'cms-persist-' as const;\n\nexport const PERSIST_KEY = {\n AUTH: 'cms-persist-auth',\n} as const;\n\n/** Max bytes per persisted cookie value (~4KB cookie cap, with headroom). */\nexport const PERSIST_MAX_BYTES = 3500;\n\n/** Allowlist of cookie keys the persist endpoint may set. */\nexport const PERSIST_ALLOWED_KEYS = [`${PERSIST_KEY.AUTH}.authUser`] as const;\n\n/**\n * Storage backend names accepted by `TokenManager`. Kept in sync with\n * `IStorageName` in `core/credentials/credential.type.ts`. The\n * `httpOnlyBridge` value is the recommended production backend (delegates\n * to a Nuxt server route).\n */\nexport const STORAGE_NAME = {\n MEMORY: 'memory',\n LOCAL_STORAGE: 'localStorage',\n COOKIE: 'cookie',\n HTTP_ONLY_BRIDGE: 'httpOnlyBridge',\n} as const;\nexport type StorageName = (typeof STORAGE_NAME)[keyof typeof STORAGE_NAME];\n\n/**\n * `Cookie SameSite` values (RFC 6265). Used by `cookieStorage` and the\n * SDK Nuxt module when setting the httpOnly access-token cookie. Mirrors\n * the `CookieSameSite` type in `core/credentials/storages/cookieStorage.ts`.\n */\nexport const COOKIE_SAME_SITE = {\n STRICT: 'Strict',\n LAX: 'Lax',\n NONE: 'None',\n} as const;\nexport type CookieSameSite = (typeof COOKIE_SAME_SITE)[keyof typeof COOKIE_SAME_SITE];\n"],"names":[],"mappings":"AAIO,MAAM,iBAAA,GAAoB;AAM1B,MAAM,yBAAA,GAA4B;AAGlC,MAAM,eAAA,GAAkB;AAAA,EAC7B,eAAA,EAAiB,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK,EAAA;AAAA;AAAA,EAChC,IAAA,EAAM,GAAA;AAAA,EACN,MAAA,EAAQ,IAAA;AAAA,EACR,SAAA,EAAW,KAAA;AAAA,EACX,SAAA,EAAW;AACb;AAGO,MAAM,iBAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,aAAA;AAAA,EACN,KAAA,EAAO,cAAA;AAAA,EACP,OAAA,EAAS,gBAAA;AAAA,EACT,KAAA,EAAO,cAAA;AAAA,EACP,UAAA,EAAY,mBAAA;AAAA,EACZ,QAAA,EAAU,iBAAA;AAAA,EACV,GAAA,EAAK,YAAA;AAAA,EACL,aAAA,EAAe,sBAAA;AAAA,EACf,IAAA,EAAM,aAAA;AAAA,EACN,OAAA,EAAS,gBAAA;AAAA,EACT,MAAA,EAAQ,eAAA;AAAA,EACR,GAAA,EAAK,YAAA;AAAA,EACL,MAAA,EAAQ;AACV;AAUO,MAAM,cAAA,GAAiB;AAEvB,MAAM,WAAA,GAAc;AAAA,EACzB,IAAA,EAAM;AACR;AAGO,MAAM,iBAAA,GAAoB;AAG1B,MAAM,oBAAA,GAAuB,CAAC,CAAA,EAAG,WAAA,CAAY,IAAI,CAAA,SAAA,CAAW;AAQ5D,MAAM,YAAA,GAAe;AAAA,EAC1B,MAAA,EAAQ,QAAA;AAAA,EACR,aAAA,EAAe,cAAA;AAAA,EACf,MAAA,EAAQ,QAAA;AAAA,EACR,gBAAA,EAAkB;AACpB;AAQO,MAAM,gBAAA,GAAmB;AAAA,EAC9B,MAAA,EAAQ,QAAA;AAAA,EACR,GAAA,EAAK,KAAA;AAAA,EACL,IAAA,EAAM;AACR;;;;"}
|
|
@@ -19,6 +19,7 @@ export declare const COOKIE_DEFAULTS: {
|
|
|
19
19
|
/** Pinia persistence keys (versioned for schema migration). */
|
|
20
20
|
export declare const STORE_PERSIST_KEY: {
|
|
21
21
|
readonly AUTH: "cms-auth-v1";
|
|
22
|
+
readonly AUTHZ: "cms-authz-v1";
|
|
22
23
|
readonly CONTENT: "cms-content-v1";
|
|
23
24
|
readonly RULES: "cms-rules-v1";
|
|
24
25
|
readonly EXECUTIONS: "cms-executions-v1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.constant.d.ts","sourceRoot":"","sources":["../../../src/common/constants/storage.constant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAG,kBAA2B,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAG,mBAA4B,CAAC;AAEtE,sEAAsE;AACtE,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAC;AAEX,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"storage.constant.d.ts","sourceRoot":"","sources":["../../../src/common/constants/storage.constant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAG,kBAA2B,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAG,mBAA4B,CAAC;AAEtE,sEAAsE;AACtE,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAC;AAEX,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;CAcpB,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAG,cAAuB,CAAC;AAEtD,eAAO,MAAM,WAAW;;CAEd,CAAC;AAEX,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,wCAA4C,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { H as HTTP_DEFAULTS, a as HTTP_RETRY_STATUS_CODES, b as HTTP_HEADER, R a
|
|
|
3
3
|
export { S as SERIALIZATION_FORMAT } from './chunks/http.constant-BzH5tJTG.js';
|
|
4
4
|
import { A as AUTH_PROXY_PATH, a as AUTH_ENDPOINT } from './chunks/auth.constant-CMI1lqQc.js';
|
|
5
5
|
import { A as AUTHZ_PROXY_PATH, a as AUTHZ_ENDPOINT } from './chunks/authz.constant-BAarvacV.js';
|
|
6
|
-
import { C as COOKIE_SAME_SITE, a as COOKIE_DEFAULTS, T as TOKEN_STORAGE_KEY, P as PERSIST_KEY, S as STORE_PERSIST_KEY } from './chunks/storage.constant
|
|
7
|
-
export { b as PERSIST_ALLOWED_KEYS, c as PERSIST_MAX_BYTES, d as PERSIST_PREFIX, e as STORAGE_NAME } from './chunks/storage.constant
|
|
6
|
+
import { C as COOKIE_SAME_SITE, a as COOKIE_DEFAULTS, T as TOKEN_STORAGE_KEY, P as PERSIST_KEY, S as STORE_PERSIST_KEY } from './chunks/storage.constant-CVWam5ls.js';
|
|
7
|
+
export { b as PERSIST_ALLOWED_KEYS, c as PERSIST_MAX_BYTES, d as PERSIST_PREFIX, e as STORAGE_NAME } from './chunks/storage.constant-CVWam5ls.js';
|
|
8
8
|
import { ref, shallowRef, watch, computed } from 'vue';
|
|
9
9
|
import { W as WS_RECONNECT_INITIAL_MS, a as WS_RECONNECT_MAX_MS, b as WS_CONNECTION_STATE, c as WS_PING_INTERVAL_MS, d as WS_MESSAGE_TYPE, e as WS_CLOSE_CODE, f as WS_MAX_RECONNECT_ATTEMPTS, g as WS_AUTH_TIMEOUT_MS, h as WS_RECONNECT_JITTER_MS, i as WS_PING_WATCHDOG_CHECK_MS, j as WS_MAX_SUBSCRIPTIONS, k as WS_PING_WATCHDOG_FACTOR } from './chunks/mt5Retcode-DlZLQOLA.js';
|
|
10
10
|
export { M as MT5_RETCODE, l as WS_ACTION_ACCEPTED_ERROR_CODE, m as WS_ACTION_ERROR_CODE, n as WS_ACTION_RESULT_ERROR_CODE, o as WS_ACTION_RESULT_TTL_MS, p as WS_AUTH_ERROR_CODE, q as WS_CLOSE_REASON, r as WS_MT5_EVENT_TYPE, s as WS_TOPIC, t as WS_TOPIC_NAMESPACE, u as accountTopic, v as adminTopic, w as mt5Topic, x as streamTopic, y as symbolTopic, z as userTopic, A as viewMt5Retcode } from './chunks/mt5Retcode-DlZLQOLA.js';
|
|
@@ -1192,7 +1192,7 @@ function createContentService(opts) {
|
|
|
1192
1192
|
if (mock())
|
|
1193
1193
|
return _okList(mockContentList(query));
|
|
1194
1194
|
return api(CONTENT_ENDPOINT.BASE, {
|
|
1195
|
-
query: _wireQuery(query)
|
|
1195
|
+
query: _wireQuery$1(query)
|
|
1196
1196
|
});
|
|
1197
1197
|
},
|
|
1198
1198
|
async detail(uuid) {
|
|
@@ -1247,7 +1247,7 @@ function createContentService(opts) {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
};
|
|
1249
1249
|
}
|
|
1250
|
-
function _wireQuery(query) {
|
|
1250
|
+
function _wireQuery$1(query) {
|
|
1251
1251
|
const out = { ...query };
|
|
1252
1252
|
if (out.packId !== void 0) {
|
|
1253
1253
|
out.pack_id = out.packId;
|
|
@@ -1795,18 +1795,18 @@ function createExecutionsService(opts) {
|
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
1797
|
if (params.contentId) {
|
|
1798
|
-
const { contentId: _id, offset = 0, limit = 50, ...
|
|
1798
|
+
const { contentId: _id, offset = 0, limit = 50, ...rest2 } = params;
|
|
1799
1799
|
const rows = await api(
|
|
1800
1800
|
EXECUTIONS_ENDPOINT.byContent(params.contentId),
|
|
1801
1801
|
{
|
|
1802
|
-
query: { offset, limit, ...
|
|
1802
|
+
query: { offset, limit, ..._wireQuery(rest2) }
|
|
1803
1803
|
}
|
|
1804
1804
|
);
|
|
1805
1805
|
const page = Math.floor(offset / Math.max(limit, 1)) + 1;
|
|
1806
1806
|
return { items: rows, total: rows.length, page, perPage: limit };
|
|
1807
1807
|
}
|
|
1808
|
-
const { contentId: _drop, offset: _o, limit: _l, sourceType: _s, ...
|
|
1809
|
-
return api(EXECUTIONS_ENDPOINT.BASE, { query });
|
|
1808
|
+
const { contentId: _drop, offset: _o, limit: _l, sourceType: _s, ...rest } = params;
|
|
1809
|
+
return api(EXECUTIONS_ENDPOINT.BASE, { query: _wireQuery(rest) });
|
|
1810
1810
|
},
|
|
1811
1811
|
async detail(uuid) {
|
|
1812
1812
|
if (mock()) return _mustFind$1(mockExecutionDetail(uuid), uuid);
|
|
@@ -1814,6 +1814,16 @@ function createExecutionsService(opts) {
|
|
|
1814
1814
|
}
|
|
1815
1815
|
};
|
|
1816
1816
|
}
|
|
1817
|
+
function _wireQuery(params) {
|
|
1818
|
+
const { contentUuid, perPage, excludeParams, includeUnlinked, llmOnly, ...rest } = params;
|
|
1819
|
+
const q = { ...rest };
|
|
1820
|
+
if (contentUuid != null) q.content_uuid = contentUuid;
|
|
1821
|
+
if (perPage != null) q.per_page = perPage;
|
|
1822
|
+
if (excludeParams != null) q.exclude_params = excludeParams;
|
|
1823
|
+
if (includeUnlinked != null) q.include_unlinked = includeUnlinked;
|
|
1824
|
+
if (llmOnly != null) q.llm_only = llmOnly;
|
|
1825
|
+
return q;
|
|
1826
|
+
}
|
|
1817
1827
|
function _mustFind$1(exec, uuid) {
|
|
1818
1828
|
if (!exec) throw _notFound$2(`Execution ${uuid} not found`);
|
|
1819
1829
|
return deepClone(exec);
|
|
@@ -3216,6 +3226,8 @@ function createNotificationsService(opts) {
|
|
|
3216
3226
|
if (query.category) q.category = query.category;
|
|
3217
3227
|
if (query.page != null) q.page = query.page;
|
|
3218
3228
|
if (query.perPage != null) q.per_page = query.perPage;
|
|
3229
|
+
if (query.sortBy) q.sort_by = query.sortBy;
|
|
3230
|
+
if (query.sortDirection) q.sort_direction = query.sortDirection;
|
|
3219
3231
|
return q;
|
|
3220
3232
|
};
|
|
3221
3233
|
return {
|
|
@@ -4049,17 +4061,30 @@ function createPeoplePackOpsService(opts) {
|
|
|
4049
4061
|
async uninstall(slug, force = false) {
|
|
4050
4062
|
await api(`${PACKS_ENDPOINT}/${encodeURIComponent(slug)}`, {
|
|
4051
4063
|
method: "DELETE",
|
|
4052
|
-
|
|
4064
|
+
body: force ? { force: true } : void 0
|
|
4053
4065
|
});
|
|
4054
4066
|
},
|
|
4055
4067
|
async updateMetadata(slug, patch) {
|
|
4056
|
-
const
|
|
4057
|
-
|
|
4058
|
-
|
|
4068
|
+
const row = await api(
|
|
4069
|
+
`${PACKS_ENDPOINT}/${encodeURIComponent(slug)}`
|
|
4070
|
+
);
|
|
4071
|
+
const currentMeta = row?.metadata ?? {};
|
|
4072
|
+
const merged = {
|
|
4073
|
+
...currentMeta,
|
|
4074
|
+
...patch.metadata ?? {}
|
|
4059
4075
|
};
|
|
4076
|
+
if (patch.disabled !== void 0) merged["people.pack.disabled"] = patch.disabled;
|
|
4077
|
+
for (const key of [
|
|
4078
|
+
"installedRef",
|
|
4079
|
+
"installedRequestedRef",
|
|
4080
|
+
"installed_ref",
|
|
4081
|
+
"installed_requested_ref"
|
|
4082
|
+
]) {
|
|
4083
|
+
if (currentMeta[key] !== void 0) merged[key] = currentMeta[key];
|
|
4084
|
+
}
|
|
4060
4085
|
return api(`${PACKS_ENDPOINT}/${encodeURIComponent(slug)}`, {
|
|
4061
4086
|
method: "PUT",
|
|
4062
|
-
body: { metadata }
|
|
4087
|
+
body: { metadata: merged }
|
|
4063
4088
|
});
|
|
4064
4089
|
},
|
|
4065
4090
|
async conflicts(slug) {
|
|
@@ -6909,116 +6934,134 @@ function _noSdk$a() {
|
|
|
6909
6934
|
return new Error("Auth store: SDK not attached. Call setSdk() first.");
|
|
6910
6935
|
}
|
|
6911
6936
|
|
|
6912
|
-
const useAuthzStore = defineStore(
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
const
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
loaded.value = false;
|
|
6957
|
-
isLoading.value = false;
|
|
6958
|
-
errorCode.value = "";
|
|
6959
|
-
inFlight = null;
|
|
6960
|
-
};
|
|
6961
|
-
const loadPortalAccess = async (opts) => {
|
|
6962
|
-
if (!sdk.value) throw new Error("Authz store: SDK not attached. Call setSdk() first.");
|
|
6963
|
-
if (opts?.portal) portal.value = opts.portal;
|
|
6964
|
-
if (loaded.value && !opts?.force) return;
|
|
6965
|
-
if (inFlight) return inFlight;
|
|
6966
|
-
isLoading.value = true;
|
|
6967
|
-
inFlight = (async () => {
|
|
6968
|
-
try {
|
|
6969
|
-
portalAccess.value = await sdk.value.authz.portalAccess(portal.value || void 0);
|
|
6970
|
-
errorCode.value = "";
|
|
6971
|
-
} catch (e) {
|
|
6972
|
-
portalAccess.value = null;
|
|
6973
|
-
errorCode.value = _extractErrorCode(e);
|
|
6974
|
-
if (!errorCode.value) console.error("[cms-authz] portalAccess failed:", e);
|
|
6975
|
-
} finally {
|
|
6976
|
-
loaded.value = true;
|
|
6977
|
-
isLoading.value = false;
|
|
6978
|
-
inFlight = null;
|
|
6979
|
-
}
|
|
6980
|
-
})();
|
|
6981
|
-
return inFlight;
|
|
6982
|
-
};
|
|
6983
|
-
const auth = useAuthStore();
|
|
6984
|
-
watch(
|
|
6985
|
-
() => auth.loginEpoch,
|
|
6986
|
-
() => {
|
|
6937
|
+
const useAuthzStore = defineStore(
|
|
6938
|
+
"cms-authz",
|
|
6939
|
+
() => {
|
|
6940
|
+
const sdk = shallowRef(null);
|
|
6941
|
+
const portal = ref("");
|
|
6942
|
+
const portalAccess = ref(null);
|
|
6943
|
+
const loaded = ref(false);
|
|
6944
|
+
const isLoading = ref(false);
|
|
6945
|
+
const errorCode = ref("");
|
|
6946
|
+
let inFlight = null;
|
|
6947
|
+
const hasAccess = computed(() => portalAccess.value?.hasAccess ?? false);
|
|
6948
|
+
const permissions = computed(() => portalAccess.value?.permissions ?? []);
|
|
6949
|
+
const roles = computed(() => portalAccess.value?.roles ?? []);
|
|
6950
|
+
const SESSION_INVALID_CODES = /* @__PURE__ */ new Set([
|
|
6951
|
+
"UNAUTHENTICATED",
|
|
6952
|
+
"INVALID_TOKEN_AUDIENCE"
|
|
6953
|
+
]);
|
|
6954
|
+
const ACCESS_DENIED_CODE = "PORTAL_ACCESS_DENIED";
|
|
6955
|
+
const isSessionInvalid = computed(
|
|
6956
|
+
() => loaded.value && SESSION_INVALID_CODES.has(errorCode.value)
|
|
6957
|
+
);
|
|
6958
|
+
const isAccessDenied = computed(() => loaded.value && errorCode.value === ACCESS_DENIED_CODE);
|
|
6959
|
+
const can = (permission) => {
|
|
6960
|
+
if (!loaded.value || !hasAccess.value) return false;
|
|
6961
|
+
return permissions.value.some((g) => _permissionMatches(g, permission));
|
|
6962
|
+
};
|
|
6963
|
+
const hasRole = (role) => roles.value.includes(role);
|
|
6964
|
+
const hasAnyPermission = (list) => {
|
|
6965
|
+
if (!loaded.value || !hasAccess.value) return false;
|
|
6966
|
+
const granted = permissions.value;
|
|
6967
|
+
return list.some((p) => granted.some((g) => _permissionMatches(g, p)));
|
|
6968
|
+
};
|
|
6969
|
+
const hasAllPermissions = (list) => {
|
|
6970
|
+
if (!loaded.value || !hasAccess.value) return false;
|
|
6971
|
+
const granted = permissions.value;
|
|
6972
|
+
return list.every((p) => granted.some((g) => _permissionMatches(g, p)));
|
|
6973
|
+
};
|
|
6974
|
+
const setSdk = (instance) => {
|
|
6975
|
+
sdk.value = instance;
|
|
6976
|
+
};
|
|
6977
|
+
const setPortal = (id) => {
|
|
6978
|
+
portal.value = id;
|
|
6979
|
+
};
|
|
6980
|
+
const _reset = () => {
|
|
6987
6981
|
portalAccess.value = null;
|
|
6988
6982
|
loaded.value = false;
|
|
6983
|
+
isLoading.value = false;
|
|
6989
6984
|
errorCode.value = "";
|
|
6990
6985
|
inFlight = null;
|
|
6986
|
+
};
|
|
6987
|
+
const loadPortalAccess = async (opts) => {
|
|
6988
|
+
if (!sdk.value) throw new Error("Authz store: SDK not attached. Call setSdk() first.");
|
|
6989
|
+
if (opts?.portal) portal.value = opts.portal;
|
|
6990
|
+
if (loaded.value && !opts?.force) return;
|
|
6991
|
+
if (inFlight) return inFlight;
|
|
6992
|
+
isLoading.value = true;
|
|
6993
|
+
inFlight = (async () => {
|
|
6994
|
+
try {
|
|
6995
|
+
portalAccess.value = await sdk.value.authz.portalAccess(portal.value || void 0);
|
|
6996
|
+
errorCode.value = "";
|
|
6997
|
+
} catch (e) {
|
|
6998
|
+
portalAccess.value = null;
|
|
6999
|
+
errorCode.value = _extractErrorCode(e);
|
|
7000
|
+
if (!errorCode.value) console.error("[cms-authz] portalAccess failed:", e);
|
|
7001
|
+
} finally {
|
|
7002
|
+
loaded.value = true;
|
|
7003
|
+
isLoading.value = false;
|
|
7004
|
+
inFlight = null;
|
|
7005
|
+
}
|
|
7006
|
+
})();
|
|
7007
|
+
return inFlight;
|
|
7008
|
+
};
|
|
7009
|
+
const auth = useAuthStore();
|
|
7010
|
+
watch(
|
|
7011
|
+
() => auth.loginEpoch,
|
|
7012
|
+
() => {
|
|
7013
|
+
portalAccess.value = null;
|
|
7014
|
+
loaded.value = false;
|
|
7015
|
+
errorCode.value = "";
|
|
7016
|
+
inFlight = null;
|
|
7017
|
+
}
|
|
7018
|
+
);
|
|
7019
|
+
watch(
|
|
7020
|
+
() => auth.isLoggedIn,
|
|
7021
|
+
(loggedIn) => {
|
|
7022
|
+
if (!loggedIn) _reset();
|
|
7023
|
+
}
|
|
7024
|
+
);
|
|
7025
|
+
return {
|
|
7026
|
+
// state
|
|
7027
|
+
portal,
|
|
7028
|
+
portalAccess,
|
|
7029
|
+
loaded,
|
|
7030
|
+
isLoading,
|
|
7031
|
+
errorCode,
|
|
7032
|
+
// getters
|
|
7033
|
+
hasAccess,
|
|
7034
|
+
permissions,
|
|
7035
|
+
roles,
|
|
7036
|
+
isSessionInvalid,
|
|
7037
|
+
isAccessDenied,
|
|
7038
|
+
// actions
|
|
7039
|
+
setSdk,
|
|
7040
|
+
setPortal,
|
|
7041
|
+
loadPortalAccess,
|
|
7042
|
+
can,
|
|
7043
|
+
hasRole,
|
|
7044
|
+
hasAnyPermission,
|
|
7045
|
+
hasAllPermissions
|
|
7046
|
+
};
|
|
7047
|
+
},
|
|
7048
|
+
{
|
|
7049
|
+
// Rehydrate the portal-access cache across reloads — `permissions`,
|
|
7050
|
+
// `roles`, and `hasAccess` are computeds derived from `portalAccess`,
|
|
7051
|
+
// so persisting the source (plus `loaded` so `can()` trusts the cache
|
|
7052
|
+
// on the first render after F5, per the store contract "read the cache,
|
|
7053
|
+
// never fetch before rendering") restores the full authorization
|
|
7054
|
+
// surface. App-level session-restore middleware is expected to call
|
|
7055
|
+
// `loadPortalAccess({ force: true })` afterwards to refresh from the
|
|
7056
|
+
// server — same fetch-on-restore contract as login / `loginEpoch` bump.
|
|
7057
|
+
// Size: `IPortalAccess` is `{ portal, hasAccess, permissions[], roles[] }`,
|
|
7058
|
+
// well under the `PERSIST_MAX_BYTES` cookie cap.
|
|
7059
|
+
persist: {
|
|
7060
|
+
key: STORE_PERSIST_KEY.AUTHZ,
|
|
7061
|
+
pick: ["portalAccess", "loaded", "errorCode"]
|
|
6991
7062
|
}
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
() => auth.isLoggedIn,
|
|
6995
|
-
(loggedIn) => {
|
|
6996
|
-
if (!loggedIn) _reset();
|
|
6997
|
-
}
|
|
6998
|
-
);
|
|
6999
|
-
return {
|
|
7000
|
-
// state
|
|
7001
|
-
portal,
|
|
7002
|
-
portalAccess,
|
|
7003
|
-
loaded,
|
|
7004
|
-
isLoading,
|
|
7005
|
-
errorCode,
|
|
7006
|
-
// getters
|
|
7007
|
-
hasAccess,
|
|
7008
|
-
permissions,
|
|
7009
|
-
roles,
|
|
7010
|
-
isSessionInvalid,
|
|
7011
|
-
isAccessDenied,
|
|
7012
|
-
// actions
|
|
7013
|
-
setSdk,
|
|
7014
|
-
setPortal,
|
|
7015
|
-
loadPortalAccess,
|
|
7016
|
-
can,
|
|
7017
|
-
hasRole,
|
|
7018
|
-
hasAnyPermission,
|
|
7019
|
-
hasAllPermissions
|
|
7020
|
-
};
|
|
7021
|
-
});
|
|
7063
|
+
}
|
|
7064
|
+
);
|
|
7022
7065
|
function _extractErrorCode(e) {
|
|
7023
7066
|
const err = e;
|
|
7024
7067
|
const payload = err?.data?.data ?? err?.data;
|
|
@@ -7026,6 +7069,16 @@ function _extractErrorCode(e) {
|
|
|
7026
7069
|
const code = detail?.error ?? payload?.error;
|
|
7027
7070
|
return typeof code === "string" ? code : "";
|
|
7028
7071
|
}
|
|
7072
|
+
function _permissionMatches(granted, requested) {
|
|
7073
|
+
if (granted === "*") return true;
|
|
7074
|
+
const g = granted.split(":");
|
|
7075
|
+
if (g.every((seg) => seg === "*")) return true;
|
|
7076
|
+
const r = requested.split(":");
|
|
7077
|
+
if (g.length > r.length) return false;
|
|
7078
|
+
if (!g.every((seg, i) => seg === "*" || seg === r[i])) return false;
|
|
7079
|
+
if (g.length < r.length && g.at(-1) !== "*") return false;
|
|
7080
|
+
return true;
|
|
7081
|
+
}
|
|
7029
7082
|
|
|
7030
7083
|
const useBarsStore = defineStore(
|
|
7031
7084
|
"cms-bars",
|