@synopackageland/sdk 0.31.5 → 0.32.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/README.md +4 -3
- package/dist/index.js +31 -5
- package/dist/src/entry/EntryGuard.vue.d.ts +27 -0
- package/dist/src/entry/check.d.ts +13 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/protocol/v1.d.ts +2 -2
- package/dist/src/vue.d.ts +1 -0
- package/dist/vue.js +1437 -1360
- package/executor-manifest.json +5 -5
- package/package.json +1 -1
- package/spec/protocol/v1/README.md +9 -0
- package/spec/protocol/v1/errors.json +2 -2
- package/spec/protocol/v1/schema/files.write.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ App's `backend/go.mod`.
|
|
|
7
7
|
| Import | Contents |
|
|
8
8
|
|---|---|
|
|
9
9
|
| `@synopackageland/sdk` | Headless: `Context` and the other types, `createBackgroundSaveFacade`, `createNasProvider`, `scopedPicker`, `createPortalAccess`, copy catalogs (`uiLocale`, `saveCopy`, …). Never imports Vue. |
|
|
10
|
-
| `@synopackageland/sdk/vue` | Everything above plus the components (`AppShell`, `PageActions`, `PageInfo`, `FilesPage`, `NasPicker`, `LoginPage`, `PortalSettings`, `BackgroundPanel`, `ExecutorSettings`, `ExecutorApproval`, `ExecutorNotice`, `UiUpdateNotice`, `DelegatePanel`, `BackgroundSavePanel`, `BackgroundSaveSettings`, `AuthorizationGate`, `AuthorizationSettings`) and composables (`createSession`, `useExecutorSetup`, `ExecutorSetupKey`, `useAuthorization`). |
|
|
10
|
+
| `@synopackageland/sdk/vue` | Everything above plus the components (`AppShell`, `PageActions`, `PageInfo`, `FilesPage`, `NasPicker`, `LoginPage`, `PortalSettings`, `BackgroundPanel`, `ExecutorSettings`, `ExecutorApproval`, `ExecutorNotice`, `UiUpdateNotice`, `DelegatePanel`, `BackgroundSavePanel`, `BackgroundSaveSettings`, `AuthorizationGate`, `AuthorizationSettings`, `EntryGuard`) and composables (`createSession`, `useExecutorSetup`, `ExecutorSetupKey`, `useAuthorization`). |
|
|
11
11
|
| `@synopackageland/sdk/vue/style.css` | The component stylesheet. Import it once next to `@synopackageland/ui`'s theme in the App entry. |
|
|
12
12
|
| `@synopackageland/sdk/native` | For a native product with its own pinned root tasks: `ROOT_RUNTIME` (`createRootAccess`) and `AUTHORIZATION_RUNTIME` (`createAuthorizationAccess`), plain ES5 source the product renders into its own DSM window; `AuthorizationGate` shows the result. Generated Apps use the executor instead. Never imports Vue. |
|
|
13
13
|
| `@synopackageland/sdk/i18n/<capability>/<locale>.json` | Copy in `en`, `zh-TW`, `zh-CN`, `ja`, `ko`, `de`, `fr`, `es`, `it`. |
|
|
@@ -237,8 +237,9 @@ otherwise picks the first page the sidebar shows. A router drives the shell
|
|
|
237
237
|
through `v-model`:
|
|
238
238
|
`:model-value="route.name" @update:model-value="name => router.push({name})"`.
|
|
239
239
|
|
|
240
|
-
Render the shell
|
|
241
|
-
|
|
240
|
+
Render the shell immediately, with [`EntryGuard`](../docs/app-entry.md) checking
|
|
241
|
+
session/admin access in the background, and pass `loading` while startup reads
|
|
242
|
+
run. The sidebar and title show immediately; the page body shows
|
|
242
243
|
its loading area and the actions slot waits. With the current CLI/SDK, use
|
|
243
244
|
`ctx.batch` for independent startup reads so they share one HTTP request and
|
|
244
245
|
App process:
|
package/dist/index.js
CHANGED
|
@@ -4308,7 +4308,7 @@ const KO = {
|
|
|
4308
4308
|
"too-many-tasks": { kind: "refusal", retryable: !0, httpStatus: 429 },
|
|
4309
4309
|
/** The executor operation queue is full. */
|
|
4310
4310
|
"queue-full": { kind: "refusal", retryable: !0, httpStatus: 429 },
|
|
4311
|
-
/** The file is larger than max_bytes, or root output is larger than its policy max_output. */
|
|
4311
|
+
/** The file is larger than max_bytes (files.read) or 100 MiB (files.write), or root output is larger than its policy max_output. */
|
|
4312
4312
|
"limit-exceeded": { kind: "refusal", retryable: !1, httpStatus: 413 },
|
|
4313
4313
|
/** The operation was canceled; reason says why. */
|
|
4314
4314
|
OPERATION_CANCELED: { kind: "outcome", retryable: !1, httpStatus: 409 },
|
|
@@ -4399,6 +4399,31 @@ function C6(e) {
|
|
|
4399
4399
|
const a = t.code;
|
|
4400
4400
|
return (KO[a]?.kind !== "refusal" || typeof t.message != "string") && M(), { ok: !1, code: a, message: t.message };
|
|
4401
4401
|
}
|
|
4402
|
+
function P6(e, t, a) {
|
|
4403
|
+
const n = new AbortController();
|
|
4404
|
+
let o;
|
|
4405
|
+
async function i() {
|
|
4406
|
+
let s;
|
|
4407
|
+
try {
|
|
4408
|
+
const r = await e.call("app.status", {}, { signal: n.signal });
|
|
4409
|
+
!r || typeof r.user != "string" || !r.user || typeof r.admin != "boolean" ? s = { code: "auth_unavailable" } : t === "admin-only" && !r.admin && (s = { code: "admin_required" });
|
|
4410
|
+
} catch (r) {
|
|
4411
|
+
const c = r?.code;
|
|
4412
|
+
s = { code: c === "session_required" || c === "admin_required" || c === "app_privilege_denied" ? c : "auth_unavailable" };
|
|
4413
|
+
}
|
|
4414
|
+
n.signal.aborted || a(s);
|
|
4415
|
+
}
|
|
4416
|
+
return {
|
|
4417
|
+
check() {
|
|
4418
|
+
return n.signal.aborted ? Promise.resolve() : (o || (o = i().finally(() => {
|
|
4419
|
+
o = void 0;
|
|
4420
|
+
})), o);
|
|
4421
|
+
},
|
|
4422
|
+
dispose() {
|
|
4423
|
+
n.abort();
|
|
4424
|
+
}
|
|
4425
|
+
};
|
|
4426
|
+
}
|
|
4402
4427
|
function YO(e) {
|
|
4403
4428
|
return function(a, n) {
|
|
4404
4429
|
return !Array.isArray(a) || a.length < 1 || a.length > 8 || a.some(function(o) {
|
|
@@ -4417,7 +4442,7 @@ function YO(e) {
|
|
|
4417
4442
|
});
|
|
4418
4443
|
};
|
|
4419
4444
|
}
|
|
4420
|
-
function
|
|
4445
|
+
function M6(e) {
|
|
4421
4446
|
const t = e.fetch ?? globalThis.fetch;
|
|
4422
4447
|
async function a(n, o) {
|
|
4423
4448
|
const i = new AbortController(), s = { code: "request_canceled", message: "request canceled" };
|
|
@@ -4445,7 +4470,7 @@ function P6(e) {
|
|
|
4445
4470
|
}
|
|
4446
4471
|
return { call: (n, o, i) => a({ method: n, params: o ?? {} }, i), batch: YO(a) };
|
|
4447
4472
|
}
|
|
4448
|
-
async function
|
|
4473
|
+
async function q6(e) {
|
|
4449
4474
|
let t;
|
|
4450
4475
|
const a = new AbortController();
|
|
4451
4476
|
try {
|
|
@@ -4517,9 +4542,10 @@ export {
|
|
|
4517
4542
|
I as clientTimeout,
|
|
4518
4543
|
c6 as createBackgroundPickerProvider,
|
|
4519
4544
|
o6 as createBackgroundSaveFacade,
|
|
4520
|
-
|
|
4545
|
+
M6 as createClient,
|
|
4521
4546
|
oe as createDsmFileStation,
|
|
4522
4547
|
be as createDsmSession,
|
|
4548
|
+
P6 as createEntryCheck,
|
|
4523
4549
|
Ue as createFileTransfers,
|
|
4524
4550
|
Ne as createNasProvider,
|
|
4525
4551
|
y6 as createPortalAccess,
|
|
@@ -4555,7 +4581,7 @@ export {
|
|
|
4555
4581
|
KO as protocolCodes,
|
|
4556
4582
|
w6 as protocolOps,
|
|
4557
4583
|
GO as protocolSchemas,
|
|
4558
|
-
|
|
4584
|
+
q6 as readDsmPorts,
|
|
4559
4585
|
d6 as requestKey,
|
|
4560
4586
|
ge as saveCatalogs,
|
|
4561
4587
|
B4 as saveCopy,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Context } from '../context';
|
|
2
|
+
import { type EntryMode } from './check';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
ctx: Pick<Context, 'call'> & Partial<Pick<Context, 'reopen' | 'displayName'>>;
|
|
5
|
+
mode: EntryMode;
|
|
6
|
+
locale?: string;
|
|
7
|
+
messages?: {
|
|
8
|
+
title: string;
|
|
9
|
+
session: string;
|
|
10
|
+
unavailable: string;
|
|
11
|
+
retry: string;
|
|
12
|
+
dismiss: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare var __VLS_1: {};
|
|
16
|
+
type __VLS_Slots = {} & {
|
|
17
|
+
default?: (props: typeof __VLS_1) => any;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Context } from '../context';
|
|
2
|
+
export type EntryMode = 'admin-only' | 'app-privilege';
|
|
3
|
+
export type EntryFailure = {
|
|
4
|
+
code: 'session_required' | 'admin_required' | 'app_privilege_denied' | 'auth_unavailable';
|
|
5
|
+
};
|
|
6
|
+
export interface EntryCheck {
|
|
7
|
+
check(): Promise<void>;
|
|
8
|
+
dispose(): void;
|
|
9
|
+
}
|
|
10
|
+
/** A background presentation check. The CGI's EntryGate is the authority.
|
|
11
|
+
* A fresh app.status traverses its session and entry checks; ctx.user is
|
|
12
|
+
* display metadata and cannot establish the current session's privileges. */
|
|
13
|
+
export declare function createEntryCheck(ctx: Pick<Context, 'call'>, mode: EntryMode, onResult: (failure: EntryFailure | undefined) => void): EntryCheck;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -37,5 +37,6 @@ export { createSharedFolderAccess, sharedFolderAccessFor, type SharedFolderOptio
|
|
|
37
37
|
export * from './protocol/v1';
|
|
38
38
|
export { encodeRequest, decodeResponse, type ProtocolAuth, type ProtocolResponse } from './protocol/codec';
|
|
39
39
|
export { appDenial, appRefusal, type AppDenial } from './authorization/refusal';
|
|
40
|
+
export { createEntryCheck, type EntryCheck, type EntryFailure, type EntryMode } from './entry/check';
|
|
40
41
|
export { createClient, type Batch, type BatchCall, type BatchResult, type ClientOptions } from './client';
|
|
41
42
|
export { readDsmPorts, type DsmPort, type DsmPortRange } from './dsm/service-ports';
|
|
@@ -276,7 +276,7 @@ export declare const protocolCodes: {
|
|
|
276
276
|
readonly retryable: true;
|
|
277
277
|
readonly httpStatus: 429;
|
|
278
278
|
};
|
|
279
|
-
/** The file is larger than max_bytes, or root output is larger than its policy max_output. */
|
|
279
|
+
/** The file is larger than max_bytes (files.read) or 100 MiB (files.write), or root output is larger than its policy max_output. */
|
|
280
280
|
readonly "limit-exceeded": {
|
|
281
281
|
readonly kind: "refusal";
|
|
282
282
|
readonly retryable: false;
|
|
@@ -518,7 +518,7 @@ export interface FilesTaskStatusParams {
|
|
|
518
518
|
job_id: string;
|
|
519
519
|
task_id: string;
|
|
520
520
|
}
|
|
521
|
-
/** files.write: Publish a staged file synchronously. Since 0.9.0. */
|
|
521
|
+
/** files.write: Publish a staged file synchronously. The staged file may be at most 104857600 bytes (100 MiB); a larger one is refused with limit-exceeded. Since 0.9.0. */
|
|
522
522
|
export interface FilesWriteParams {
|
|
523
523
|
delegation_id: string;
|
|
524
524
|
job_id: string;
|
package/dist/src/vue.d.ts
CHANGED
|
@@ -26,3 +26,4 @@ export { default as BackgroundSaveSettings } from './delegate/BackgroundSaveSett
|
|
|
26
26
|
export { default as AuthorizationGate } from './authorization/AuthorizationGate.vue';
|
|
27
27
|
export { useAuthorization, type AuthorizationControl, type AuthorizationGateState } from './authorization/use-authorization';
|
|
28
28
|
export { default as AuthorizationSettings } from './authorization/AuthorizationSettings.vue';
|
|
29
|
+
export { default as EntryGuard } from './entry/EntryGuard.vue';
|