buckyos 0.7.200 → 0.7.204
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 +2 -0
- package/cli/dist/cli.mjs +42 -1
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/modules/pikg.ts +7 -0
- package/cli/modules/pikg_protocol.ts +37 -0
- package/cli/version.ts +1 -1
- package/dist/{aiws_write-2f0baa6f.mjs → aiws_write-0606e098.mjs} +707 -291
- package/dist/aiws_write-0606e098.mjs.map +1 -0
- package/dist/aiws_write-7a9d71d1.js +13 -0
- package/dist/aiws_write-7a9d71d1.js.map +1 -0
- package/dist/app-frame.cjs +1 -1
- package/dist/app-frame.cjs.map +1 -1
- package/dist/app-frame.d.ts +131 -24
- package/dist/app-frame.d.ts.map +1 -1
- package/dist/app-frame.mjs +235 -70
- package/dist/app-frame.mjs.map +1 -1
- package/dist/audio.d.ts +84 -0
- package/dist/audio.d.ts.map +1 -0
- package/dist/browser.cjs +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +5 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.mjs +249 -219
- package/dist/browser.mjs.map +1 -1
- package/dist/content.cjs +1 -1
- package/dist/content.cjs.map +1 -1
- package/dist/content.mjs +357 -34
- package/dist/content.mjs.map +1 -1
- package/dist/{content_objid-0e63f1ff.js → content_objid-c69251aa.js} +2 -2
- package/dist/{content_objid-0e63f1ff.js.map → content_objid-c69251aa.js.map} +1 -1
- package/dist/{content_objid-8ebeead4.mjs → content_objid-e3fc56dd.mjs} +2 -2
- package/dist/{content_objid-8ebeead4.mjs.map → content_objid-e3fc56dd.mjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +249 -219
- package/dist/index.mjs.map +1 -1
- package/dist/msg_center_client.d.ts +37 -0
- package/dist/msg_center_client.d.ts.map +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.ts +5 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.mjs +246 -215
- package/dist/node.mjs.map +1 -1
- package/dist/open-app.cjs +2 -0
- package/dist/open-app.cjs.map +1 -0
- package/dist/open-app.mjs +160 -0
- package/dist/open-app.mjs.map +1 -0
- package/dist/open_app.d.ts +95 -0
- package/dist/open_app.d.ts.map +1 -0
- package/dist/provision.cjs +1 -1
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +1 -3
- package/dist/provision.mjs.map +1 -1
- package/dist/provision_activate.d.ts.map +1 -1
- package/dist/runtime_env-39e4df98.mjs +44 -0
- package/dist/runtime_env-39e4df98.mjs.map +1 -0
- package/dist/runtime_env-6396e1eb.js +2 -0
- package/dist/runtime_env-6396e1eb.js.map +1 -0
- package/dist/runtime_env.d.ts +53 -0
- package/dist/runtime_env.d.ts.map +1 -0
- package/dist/sdk_core.d.ts +4 -2
- package/dist/sdk_core.d.ts.map +1 -1
- package/dist/zone_clients.d.ts +35 -0
- package/dist/zone_clients.d.ts.map +1 -0
- package/package.json +6 -1
- package/dist/aiws_write-2f0baa6f.mjs.map +0 -1
- package/dist/aiws_write-ad97b561.js +0 -13
- package/dist/aiws_write-ad97b561.js.map +0 -1
- package/dist/content_mime-dc80d960.js +0 -2
- package/dist/content_mime-dc80d960.js.map +0 -1
- package/dist/content_mime-e42d5f8d.mjs +0 -335
- package/dist/content_mime-e42d5f8d.mjs.map +0 -1
package/dist/node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.mjs","sources":["../src/node.ts"],"sourcesContent":["import { createSDKModule } from './sdk_core'\nimport { hashPassword } from './account'\n\nconst sdkModule = createSDKModule('node')\n\nexport const buckyos = sdkModule.buckyos\nexport const initBuckyOS = sdkModule.initBuckyOS\nexport const getBuckyOSConfig = sdkModule.getBuckyOSConfig\nexport const getRuntimeType = sdkModule.getRuntimeType\nexport const getAppId = sdkModule.getAppId\nexport const getAppDid = sdkModule.getAppDid\nexport const getAppInstanceId = sdkModule.getAppInstanceId\nexport const getAppDataDir = sdkModule.getAppDataDir\nexport const getKEventClient = sdkModule.getKEventClient\nexport const createEventReader = sdkModule.createEventReader\nexport const create_event_reader = sdkModule.create_event_reader\nexport const subscribeKEvent = sdkModule.subscribeKEvent\nexport const attachEvent = sdkModule.attachEvent\nexport const removeEvent = sdkModule.removeEvent\nexport const getAccountInfo = sdkModule.getAccountInfo\nexport const getCurrentIdentity = sdkModule.getCurrentIdentity\nexport const loginByPassword = sdkModule.loginByPassword\nexport const loginByBrowserSSO = sdkModule.loginByBrowserSSO\nexport const loginByRuntimeSession = sdkModule.loginByRuntimeSession\nexport const login = sdkModule.login\nexport const logout = sdkModule.logout\nexport const getAppSetting = sdkModule.getAppSetting\nexport const setAppSetting = sdkModule.setAppSetting\nexport const getCurrentWalletUser = sdkModule.getCurrentWalletUser\nexport const resolve_did = sdkModule.resolve_did\nexport const walletSignWithActiveDid = sdkModule.walletSignWithActiveDid\nexport const openExternalUrl = sdkModule.openExternalUrl\nexport const getZoneHostName = sdkModule.getZoneHostName\nexport const getZoneServiceURL = sdkModule.getZoneServiceURL\nexport const getServiceRpcClient = sdkModule.getServiceRpcClient\nexport const getVerifyHubClient = sdkModule.getVerifyHubClient\nexport const getSystemConfigClient = sdkModule.getSystemConfigClient\nexport const getTaskManagerClient = sdkModule.getTaskManagerClient\nexport const getWorkflowClient = sdkModule.getWorkflowClient\n\nexport { hashPassword }\nexport * from './sdk_core'\nexport * from './types'\nexport * from './app_identity'\nexport * as namelib from './namelib'\nexport * as bns from './bns_client'\nexport * from './bns_evm_tx'\nexport * from './bns_tx_executor'\nexport * as sn from './sn_client'\nexport * as ndn from './ndn'\nexport * as ndm from './ndm_client'\nexport * as ndm_proxy from './ndm_proxy'\nexport * as bucket from './bucket_client'\nexport * as objectUrl from './object_url'\n\nexport * from './executor_client'\nexport * from './aiws_ext'\nexport * from './aiws_rrule'\nexport * from './aiws_schedule'\nexport * from './aiws_write'\nexport * from './aiws_bind'\nexport { AiwsFailure, aiwsTarget, commitWithParts } from './aiworkspace_client'\nexport { NfspClient } from './nfsp'\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.mjs","sources":["../src/node.ts"],"sourcesContent":["import { createSDKModule } from './sdk_core'\nimport { hashPassword } from './account'\n\nconst sdkModule = createSDKModule('node')\n\nexport const buckyos = sdkModule.buckyos\nexport const initBuckyOS = sdkModule.initBuckyOS\nexport const getBuckyOSConfig = sdkModule.getBuckyOSConfig\nexport const getRuntimeType = sdkModule.getRuntimeType\nexport const getAppId = sdkModule.getAppId\nexport const getAppDid = sdkModule.getAppDid\nexport const getAppInstanceId = sdkModule.getAppInstanceId\nexport const getAppDataDir = sdkModule.getAppDataDir\nexport const getKEventClient = sdkModule.getKEventClient\nexport const createEventReader = sdkModule.createEventReader\nexport const create_event_reader = sdkModule.create_event_reader\nexport const subscribeKEvent = sdkModule.subscribeKEvent\nexport const attachEvent = sdkModule.attachEvent\nexport const removeEvent = sdkModule.removeEvent\nexport const getAccountInfo = sdkModule.getAccountInfo\nexport const getCurrentIdentity = sdkModule.getCurrentIdentity\nexport const loginByPassword = sdkModule.loginByPassword\nexport const loginByBrowserSSO = sdkModule.loginByBrowserSSO\nexport const loginByRuntimeSession = sdkModule.loginByRuntimeSession\nexport const login = sdkModule.login\nexport const logout = sdkModule.logout\nexport const getAppSetting = sdkModule.getAppSetting\nexport const setAppSetting = sdkModule.setAppSetting\nexport const getCurrentWalletUser = sdkModule.getCurrentWalletUser\nexport const resolve_did = sdkModule.resolve_did\nexport const walletSignWithActiveDid = sdkModule.walletSignWithActiveDid\nexport const openExternalUrl = sdkModule.openExternalUrl\nexport const getZoneHostName = sdkModule.getZoneHostName\nexport const getZoneServiceURL = sdkModule.getZoneServiceURL\nexport const getServiceRpcClient = sdkModule.getServiceRpcClient\nexport const getVerifyHubClient = sdkModule.getVerifyHubClient\nexport const getSystemConfigClient = sdkModule.getSystemConfigClient\nexport const getTaskManagerClient = sdkModule.getTaskManagerClient\nexport const getWorkflowClient = sdkModule.getWorkflowClient\n\nexport { hashPassword }\nexport * from './sdk_core'\nexport * from './types'\nexport * from './app_identity'\nexport * as namelib from './namelib'\nexport * as bns from './bns_client'\nexport * from './bns_evm_tx'\nexport * from './bns_tx_executor'\nexport * as sn from './sn_client'\nexport * as ndn from './ndn'\nexport * as ndm from './ndm_client'\nexport * as ndm_proxy from './ndm_proxy'\nexport * from './open_app'\nexport * from './runtime_env'\nexport * from './audio'\nexport { createZoneClients, type ZoneClients, type ZoneClientsOptions } from './zone_clients'\nexport * as bucket from './bucket_client'\nexport * as objectUrl from './object_url'\n\nexport * from './executor_client'\nexport * from './aiws_ext'\nexport * from './aiws_rrule'\nexport * from './aiws_schedule'\nexport * from './aiws_write'\nexport * from './aiws_bind'\nexport { AiwsFailure, aiwsTarget, commitWithParts } from './aiworkspace_client'\nexport { NfspClient } from './nfsp'\n"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAM,YAAY,gBAAgB,MAAM;AAEjC,MAAM,UAAU,UAAU;AAC1B,MAAM,cAAc,UAAU;AAC9B,MAAM,mBAAmB,UAAU;AACnC,MAAM,iBAAiB,UAAU;AACjC,MAAM,WAAW,UAAU;AAC3B,MAAM,YAAY,UAAU;AAC5B,MAAM,mBAAmB,UAAU;AACnC,MAAM,gBAAgB,UAAU;AAChC,MAAM,kBAAkB,UAAU;AAClC,MAAM,oBAAoB,UAAU;AACpC,MAAM,sBAAsB,UAAU;AACtC,MAAM,kBAAkB,UAAU;AAClC,MAAM,cAAc,UAAU;AAC9B,MAAM,cAAc,UAAU;AAC9B,MAAM,iBAAiB,UAAU;AACjC,MAAM,qBAAqB,UAAU;AACrC,MAAM,kBAAkB,UAAU;AAClC,MAAM,oBAAoB,UAAU;AACpC,MAAM,wBAAwB,UAAU;AACxC,MAAM,QAAQ,UAAU;AACxB,MAAM,SAAS,UAAU;AACzB,MAAM,gBAAgB,UAAU;AAChC,MAAM,gBAAgB,UAAU;AAChC,MAAM,uBAAuB,UAAU;AACvC,MAAM,cAAc,UAAU;AAC9B,MAAM,0BAA0B,UAAU;AAC1C,MAAM,kBAAkB,UAAU;AAClC,MAAM,kBAAkB,UAAU;AAClC,MAAM,oBAAoB,UAAU;AACpC,MAAM,sBAAsB,UAAU;AACtC,MAAM,qBAAqB,UAAU;AACrC,MAAM,wBAAwB,UAAU;AACxC,MAAM,uBAAuB,UAAU;AACvC,MAAM,oBAAoB,UAAU;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function e(e,t,o=""){return[e,t,o].map(encodeURIComponent).join("|")}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>{if(/[\x00-\x1f\x7f]/.test(e))return!1;try{encodeURIComponent(e)}catch{return!1}return!0};function o(e){return"string"==typeof e&&e.length<=4096&&/^\/(?![\/\\])/.test(e)&&t(e)}function n(e){if(!e||"object"!=typeof e)return;const n=e;if(!(e=>"string"==typeof e&&/^[\w.@-]{1,255}$/.test(e))(n.app))return;const i={app:n.app};if(void 0!==n.zone){if("string"!=typeof n.zone||!n.zone||n.zone.length>255||!t(n.zone))return;i.zone=n.zone}if(void 0!==n.path){if(!o(n.path))return;i.path=n.path}if(void 0!==n.window){if(!(e=>"string"==typeof e&&e.length<=512&&t(e))(n.window))return;i.window=n.window}if(void 0!==n.mode){if("reuse"!==n.mode&&"new"!==n.mode)return;i.mode=n.mode}return i}const i=e=>e.flatMap((([e,t])=>void 0===t?[]:[`${e}=${encodeURIComponent(t)}`])).join("&");function p(e){const t=/^buckyos:\/\/([a-z0-9-]+(?:\.[a-z0-9-]+)*)\/?(?:\?([^#]*))?(?:#.*)?$/i.exec(e.trim());if(!t)return;const o=new URLSearchParams(t[2]??""),n=o.get("v")??"";return/^[1-9]\d{0,8}$/.test(n)?{action:t[1].toLowerCase(),version:Number(n),params:o}:void 0}const r="app.open";exports.APP_OPEN_ACTION=r,exports.appWindowId=e,exports.formatAppOpenUrl=function(e){return`buckyos://${r}?${i([["v","1"],["zone",e.zoneHost],["app",e.app],["path",e.path],["window",e.window]])}`},exports.isAppPath=o,exports.parseAppOpenUrl=function(e){var t;const o=p(e);if(!o||o.action!==r||1!==o.version)return;const i=null==(t=o.params.get("zone"))?void 0:t.toLowerCase();if(!i||!/^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:\d{1,5})?$/i.test(i))return;const a=n({app:o.params.get("app")??void 0,path:o.params.get("path")??void 0,window:o.params.get("window")??void 0});return a?{zoneHost:i,app:a.app,...void 0!==a.path?{path:a.path}:{},...void 0!==a.window?{window:a.window}:{}}:void 0},exports.parseAppWindowId=function(e){const t=e.split("|");if(3===t.length)try{const[e,o,n]=t.map(decodeURIComponent);return e&&o?{zone:e,appInstance:o,windowPath:n}:void 0}catch{return}},exports.parseBuckyosUrl=p,exports.parseSystemOpenApp=function(e){return n({app:e.get("open-app")??void 0,path:e.get("path")??void 0,window:e.get("window")??void 0,mode:"new"===e.get("mode")?"new":void 0})},exports.readAppOpenRequest=n,exports.readAppWindowDeclaration=function(e){const t=e&&"object"==typeof e?e:{},o={instance:"multi"===t.instance?"multi":"single",default_mode:"maximized"===t.default_mode?"maximized":"windowed",resizable:!1!==t.resizable,allow_minimize:!1!==t.allow_minimize,allow_maximize:!1!==t.allow_maximize,mobile_header:"compact"===t.mobile_header?"compact":"standard"};for(const n of["width","height","min_width","min_height"]){const e=t[n];"number"==typeof e&&Number.isFinite(e)&&e>=1&&(o[n]=Math.round(e))}return o},exports.resolveOpenApp=function(t,o,n,i){const p=i.filter((e=>e.zone===t.zone&&e.appInstance===o)),r=t.path||void 0,a=n=>({action:"create",windowId:e(t.zone,o,n),windowPath:n,...r?{path:r}:{}}),d=e=>({action:"focus",windowId:e.id,...r&&r!==e.path?{navigate:r}:{}}),s="multi"===n.instance;if(s&&"new"===t.mode){const e=new Set(p.map((e=>e.windowPath))),o=t.window??"";let n=o;for(let t=2;e.has(n);t++)n=`${o}~${t}`;return a(n)}if(s&&void 0!==t.window){const e=p.find((e=>e.windowPath===t.window));return e?d(e):a(t.window)}const w=p.reduce(((e,t)=>!e||t.lastActive>e.lastActive?t:e),void 0);return w?d(w):a("")},exports.systemOpenAppUrl=function(e,t){return`${new URL("/",e).href}?${i([["open-app",t.app],["path",t.path],["window",t.window],["mode","new"===t.mode?"new":void 0]])}`};
|
|
2
|
+
//# sourceMappingURL=open-app.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-app.cjs","sources":["../src/open_app.ts"],"sourcesContent":["/**\n * Opening an App. Whatever starts it (an icon, a notification, another App, an external link) becomes one\n * `OpenAppRequest`; `resolveOpenApp` decides between a new window and one that is already open. The shell and the\n * native client share these rules, and `tests/open_app_vectors.json` holds the cases both run.\n */\nexport interface OpenAppRequest {\n /** Zone DID. Required: there is no implicit \"current Zone\". */\n zone: string\n /** App id; a system App uses its id in the system App list (`files`, `messagehub`, …). */\n app: string\n /** The page inside the App, with its query and fragment. */\n path?: string\n /** Window path, named by the App: the same path is the same window. Empty is the App's main window. */\n window?: string\n /** Defaults to `reuse`. `new` only applies to Apps that declare several windows. */\n mode?: 'reuse' | 'new'\n}\n\n/** `window` of an AppDoc and of an entry in the system App list. */\nexport interface AppWindowDeclaration {\n instance: 'single' | 'multi'\n default_mode: 'windowed' | 'maximized'\n width?: number\n height?: number\n min_width?: number\n min_height?: number\n resizable: boolean\n allow_minimize: boolean\n allow_maximize: boolean\n mobile_header: 'standard' | 'compact'\n}\n\n/** Reads a declaration leniently: a missing or invalid field takes its default. */\nexport function readAppWindowDeclaration(value: unknown): AppWindowDeclaration {\n const v = (value && typeof value === 'object' ? value : {}) as Record<string, unknown>\n const declaration: AppWindowDeclaration = {\n instance: v.instance === 'multi' ? 'multi' : 'single',\n default_mode: v.default_mode === 'maximized' ? 'maximized' : 'windowed',\n resizable: v.resizable !== false,\n allow_minimize: v.allow_minimize !== false,\n allow_maximize: v.allow_maximize !== false,\n mobile_header: v.mobile_header === 'compact' ? 'compact' : 'standard',\n }\n for (const key of ['width', 'height', 'min_width', 'min_height'] as const) {\n const size = v[key]\n if (typeof size === 'number' && Number.isFinite(size) && size >= 1) declaration[key] = Math.round(size)\n }\n return declaration\n}\n\n/** `<zone>|<appInstance>|<windowPath>`, each part percent-encoded. */\nexport function appWindowId(zone: string, appInstance: string, windowPath = ''): string {\n return [zone, appInstance, windowPath].map(encodeURIComponent).join('|')\n}\n\nexport function parseAppWindowId(id: string): { zone: string; appInstance: string; windowPath: string } | undefined {\n const parts = id.split('|')\n if (parts.length !== 3) return undefined\n try {\n const [zone, appInstance, windowPath] = parts.map(decodeURIComponent)\n return zone && appInstance ? { zone, appInstance, windowPath } : undefined\n } catch {\n return undefined\n }\n}\n\nexport interface OpenAppWindow {\n id: string\n zone: string\n appInstance: string\n windowPath: string\n /** The page shown now, when it is known. */\n path?: string\n /** When the window was last used; only compared with that of other windows. */\n lastActive: number\n}\n\nexport type OpenAppDecision =\n | { action: 'create'; windowId: string; windowPath: string; path?: string }\n /** `navigate`: the page to go to inside that window. */\n | { action: 'focus'; windowId: string; navigate?: string }\n\n/**\n * Where a request goes. `appInstance` is what the caller resolved `request.app` to; `windows` are all open windows\n * (those of other Zones and Apps are ignored here). A window path given as `''` names the main window, which is not\n * the same as giving none.\n */\nexport function resolveOpenApp(request: OpenAppRequest, appInstance: string, declaration: AppWindowDeclaration, windows: OpenAppWindow[]): OpenAppDecision {\n const own = windows.filter(w => w.zone === request.zone && w.appInstance === appInstance)\n const path = request.path || undefined\n const create = (windowPath: string): OpenAppDecision =>\n ({ action: 'create', windowId: appWindowId(request.zone, appInstance, windowPath), windowPath, ...(path ? { path } : {}) })\n const focus = (window: OpenAppWindow): OpenAppDecision =>\n ({ action: 'focus', windowId: window.id, ...(path && path !== window.path ? { navigate: path } : {}) })\n const multi = declaration.instance === 'multi'\n\n if (multi && request.mode === 'new') {\n const taken = new Set(own.map(w => w.windowPath))\n const base = request.window ?? ''\n let windowPath = base\n for (let n = 2; taken.has(windowPath); n++) windowPath = `${base}~${n}`\n return create(windowPath)\n }\n if (multi && request.window !== undefined) {\n const existing = own.find(w => w.windowPath === request.window)\n return existing ? focus(existing) : create(request.window)\n }\n const latest = own.reduce<OpenAppWindow | undefined>((best, w) => !best || w.lastActive > best.lastActive ? w : best, undefined)\n return latest ? focus(latest) : create('')\n}\n\n/** A request from an App: without a Zone it means the App's own. */\nexport type AppOpenRequest = Omit<OpenAppRequest, 'zone'> & { zone?: string }\n\nconst wellFormed = (value: string): boolean => {\n if (/[\\x00-\\x1f\\x7f]/.test(value)) return false\n try { encodeURIComponent(value) } catch { return false }\n return true\n}\nconst isAppId = (value: unknown): value is string => typeof value === 'string' && /^[\\w.@-]{1,255}$/.test(value)\nconst isWindowPath = (value: unknown): value is string => typeof value === 'string' && value.length <= 512 && wellFormed(value)\nconst isZoneHost = (value: string): boolean => /^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:\\d{1,5})?$/i.test(value)\n\n/** A page inside an App: `/…` that cannot leave the App's origin when it is resolved against it. */\nexport function isAppPath(value: unknown): value is string {\n return typeof value === 'string' && value.length <= 4096 && /^\\/(?![\\/\\\\])/.test(value) && wellFormed(value)\n}\n\n/** Checks a request that crossed a window boundary and returns a clean copy. */\nexport function readAppOpenRequest(value: unknown): AppOpenRequest | undefined {\n if (!value || typeof value !== 'object') return undefined\n const v = value as Record<string, unknown>\n if (!isAppId(v.app)) return undefined\n const request: AppOpenRequest = { app: v.app }\n if (v.zone !== undefined) {\n if (typeof v.zone !== 'string' || !v.zone || v.zone.length > 255 || !wellFormed(v.zone)) return undefined\n request.zone = v.zone\n }\n if (v.path !== undefined) {\n if (!isAppPath(v.path)) return undefined\n request.path = v.path\n }\n if (v.window !== undefined) {\n if (!isWindowPath(v.window)) return undefined\n request.window = v.window\n }\n if (v.mode !== undefined) {\n if (v.mode !== 'reuse' && v.mode !== 'new') return undefined\n request.mode = v.mode\n }\n return request\n}\n\nconst query = (params: Array<[string, string | undefined]>): string =>\n params.flatMap(([key, value]) => value === undefined ? [] : [`${key}=${encodeURIComponent(value)}`]).join('&')\n\n/** The Zone root page that opens an App: where a standalone tab sends the user. */\nexport function systemOpenAppUrl(systemOrigin: string, request: Omit<AppOpenRequest, 'zone'>): string {\n return `${new URL('/', systemOrigin).href}?${query([\n ['open-app', request.app], ['path', request.path], ['window', request.window], ['mode', request.mode === 'new' ? 'new' : undefined],\n ])}`\n}\n\n/** Inverse of `systemOpenAppUrl`; the Zone is the one serving the page. */\nexport function parseSystemOpenApp(params: URLSearchParams): Omit<AppOpenRequest, 'zone'> | undefined {\n return readAppOpenRequest({\n app: params.get('open-app') ?? undefined, path: params.get('path') ?? undefined,\n window: params.get('window') ?? undefined, mode: params.get('mode') === 'new' ? 'new' : undefined,\n })\n}\n\n/** `buckyos://<action>?v=<version>&…`. Undefined when it is not a well-formed BuckyOS address. */\nexport function parseBuckyosUrl(url: string): { action: string; version: number; params: URLSearchParams } | undefined {\n const match = /^buckyos:\\/\\/([a-z0-9-]+(?:\\.[a-z0-9-]+)*)\\/?(?:\\?([^#]*))?(?:#.*)?$/i.exec(url.trim())\n if (!match) return undefined\n const params = new URLSearchParams(match[2] ?? '')\n const version = params.get('v') ?? ''\n if (!/^[1-9]\\d{0,8}$/.test(version)) return undefined\n return { action: match[1].toLowerCase(), version: Number(version), params }\n}\n\nexport interface AppOpenLink {\n zoneHost: string\n app: string\n path?: string\n window?: string\n}\n\nexport const APP_OPEN_ACTION = 'app.open'\n\nexport function formatAppOpenUrl(link: AppOpenLink): string {\n return `buckyos://${APP_OPEN_ACTION}?${query([['v', '1'], ['zone', link.zoneHost], ['app', link.app], ['path', link.path], ['window', link.window]])}`\n}\n\nexport function parseAppOpenUrl(url: string): AppOpenLink | undefined {\n const parsed = parseBuckyosUrl(url)\n if (!parsed || parsed.action !== APP_OPEN_ACTION || parsed.version !== 1) return undefined\n const zoneHost = parsed.params.get('zone')?.toLowerCase()\n if (!zoneHost || !isZoneHost(zoneHost)) return undefined\n const request = readAppOpenRequest({\n app: parsed.params.get('app') ?? undefined, path: parsed.params.get('path') ?? undefined, window: parsed.params.get('window') ?? undefined,\n })\n if (!request) return undefined\n return { zoneHost, app: request.app, ...(request.path !== undefined ? { path: request.path } : {}), ...(request.window !== undefined ? { window: request.window } : {}) }\n}\n"],"names":["appWindowId","zone","appInstance","windowPath","map","encodeURIComponent","join","wellFormed","value","test","isAppPath","length","readAppOpenRequest","v","isAppId","app","request","path","window","isWindowPath","mode","query","params","flatMap","key","parseBuckyosUrl","url","match","exec","trim","URLSearchParams","version","get","action","toLowerCase","Number","APP_OPEN_ACTION","link","zoneHost","parsed","_a","id","parts","split","decodeURIComponent","declaration","instance","default_mode","resizable","allow_minimize","allow_maximize","mobile_header","size","isFinite","Math","round","windows","own","filter","w","create","windowId","focus","navigate","multi","taken","Set","base","n","has","existing","find","latest","reduce","best","lastActive","systemOrigin","URL","href"],"mappings":"aAmDO,SAASA,EAAYC,EAAcC,EAAqBC,EAAa,IACnE,MAAA,CAACF,EAAMC,EAAaC,GAAYC,IAAIC,oBAAoBC,KAAK,IACtE,oEA6DA,MAAMC,EAAcC,IACd,GAAA,kBAAkBC,KAAKD,GAAe,OAAA,EACtC,IAAEH,mBAAmBG,EAAK,CAAU,MAAS,OAAA,CAAM,CAChD,OAAA,CAAA,EAOF,SAASE,EAAUF,GACjB,MAAiB,iBAAVA,GAAsBA,EAAMG,QAAU,MAAQ,gBAAgBF,KAAKD,IAAUD,EAAWC,EACxG,CAGO,SAASI,EAAmBJ,GAC7B,IAACA,GAA0B,iBAAVA,EAA2B,OAChD,MAAMK,EAAIL,EACN,IAbU,CAACA,GAAqD,iBAAVA,GAAsB,mBAAmBC,KAAKD,GAanGM,CAAQD,EAAEE,KAAa,OAC5B,MAAMC,EAA0B,CAAED,IAAKF,EAAEE,KACrC,QAAW,IAAXF,EAAEZ,KAAoB,CACxB,GAAsB,iBAAXY,EA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EAAMU,GAAUZ,EAAO,GACzC,2BAgDgB,SAAiBgB,EAAsB5D,GAC9C,MAAA,GAAG,IAAI6D,IAAI,IAAKD,GAAcE,QAAQzD,EAAM,CACjD,CAAC,WAAYL,EAAQD,KAAM,CAAC,OAAQC,EAAQC,MAAO,CAAC,SAAUD,EAAQE,QAAS,CAAC,OAAyB,QAAjBF,EAAQI,KAAiB,WAAQ,MAE7H"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
function readAppWindowDeclaration(value) {
|
|
2
|
+
const v = value && typeof value === "object" ? value : {};
|
|
3
|
+
const declaration = {
|
|
4
|
+
instance: v.instance === "multi" ? "multi" : "single",
|
|
5
|
+
default_mode: v.default_mode === "maximized" ? "maximized" : "windowed",
|
|
6
|
+
resizable: v.resizable !== false,
|
|
7
|
+
allow_minimize: v.allow_minimize !== false,
|
|
8
|
+
allow_maximize: v.allow_maximize !== false,
|
|
9
|
+
mobile_header: v.mobile_header === "compact" ? "compact" : "standard"
|
|
10
|
+
};
|
|
11
|
+
for (const key of ["width", "height", "min_width", "min_height"]) {
|
|
12
|
+
const size = v[key];
|
|
13
|
+
if (typeof size === "number" && Number.isFinite(size) && size >= 1)
|
|
14
|
+
declaration[key] = Math.round(size);
|
|
15
|
+
}
|
|
16
|
+
return declaration;
|
|
17
|
+
}
|
|
18
|
+
function appWindowId(zone, appInstance, windowPath = "") {
|
|
19
|
+
return [zone, appInstance, windowPath].map(encodeURIComponent).join("|");
|
|
20
|
+
}
|
|
21
|
+
function parseAppWindowId(id) {
|
|
22
|
+
const parts = id.split("|");
|
|
23
|
+
if (parts.length !== 3)
|
|
24
|
+
return void 0;
|
|
25
|
+
try {
|
|
26
|
+
const [zone, appInstance, windowPath] = parts.map(decodeURIComponent);
|
|
27
|
+
return zone && appInstance ? { zone, appInstance, windowPath } : void 0;
|
|
28
|
+
} catch {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function resolveOpenApp(request, appInstance, declaration, windows) {
|
|
33
|
+
const own = windows.filter((w) => w.zone === request.zone && w.appInstance === appInstance);
|
|
34
|
+
const path = request.path || void 0;
|
|
35
|
+
const create = (windowPath) => ({ action: "create", windowId: appWindowId(request.zone, appInstance, windowPath), windowPath, ...path ? { path } : {} });
|
|
36
|
+
const focus = (window) => ({ action: "focus", windowId: window.id, ...path && path !== window.path ? { navigate: path } : {} });
|
|
37
|
+
const multi = declaration.instance === "multi";
|
|
38
|
+
if (multi && request.mode === "new") {
|
|
39
|
+
const taken = new Set(own.map((w) => w.windowPath));
|
|
40
|
+
const base = request.window ?? "";
|
|
41
|
+
let windowPath = base;
|
|
42
|
+
for (let n = 2; taken.has(windowPath); n++)
|
|
43
|
+
windowPath = `${base}~${n}`;
|
|
44
|
+
return create(windowPath);
|
|
45
|
+
}
|
|
46
|
+
if (multi && request.window !== void 0) {
|
|
47
|
+
const existing = own.find((w) => w.windowPath === request.window);
|
|
48
|
+
return existing ? focus(existing) : create(request.window);
|
|
49
|
+
}
|
|
50
|
+
const latest = own.reduce((best, w) => !best || w.lastActive > best.lastActive ? w : best, void 0);
|
|
51
|
+
return latest ? focus(latest) : create("");
|
|
52
|
+
}
|
|
53
|
+
const wellFormed = (value) => {
|
|
54
|
+
if (/[\x00-\x1f\x7f]/.test(value))
|
|
55
|
+
return false;
|
|
56
|
+
try {
|
|
57
|
+
encodeURIComponent(value);
|
|
58
|
+
} catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
};
|
|
63
|
+
const isAppId = (value) => typeof value === "string" && /^[\w.@-]{1,255}$/.test(value);
|
|
64
|
+
const isWindowPath = (value) => typeof value === "string" && value.length <= 512 && wellFormed(value);
|
|
65
|
+
const isZoneHost = (value) => /^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:\d{1,5})?$/i.test(value);
|
|
66
|
+
function isAppPath(value) {
|
|
67
|
+
return typeof value === "string" && value.length <= 4096 && /^\/(?![\/\\])/.test(value) && wellFormed(value);
|
|
68
|
+
}
|
|
69
|
+
function readAppOpenRequest(value) {
|
|
70
|
+
if (!value || typeof value !== "object")
|
|
71
|
+
return void 0;
|
|
72
|
+
const v = value;
|
|
73
|
+
if (!isAppId(v.app))
|
|
74
|
+
return void 0;
|
|
75
|
+
const request = { app: v.app };
|
|
76
|
+
if (v.zone !== void 0) {
|
|
77
|
+
if (typeof v.zone !== "string" || !v.zone || v.zone.length > 255 || !wellFormed(v.zone))
|
|
78
|
+
return void 0;
|
|
79
|
+
request.zone = v.zone;
|
|
80
|
+
}
|
|
81
|
+
if (v.path !== void 0) {
|
|
82
|
+
if (!isAppPath(v.path))
|
|
83
|
+
return void 0;
|
|
84
|
+
request.path = v.path;
|
|
85
|
+
}
|
|
86
|
+
if (v.window !== void 0) {
|
|
87
|
+
if (!isWindowPath(v.window))
|
|
88
|
+
return void 0;
|
|
89
|
+
request.window = v.window;
|
|
90
|
+
}
|
|
91
|
+
if (v.mode !== void 0) {
|
|
92
|
+
if (v.mode !== "reuse" && v.mode !== "new")
|
|
93
|
+
return void 0;
|
|
94
|
+
request.mode = v.mode;
|
|
95
|
+
}
|
|
96
|
+
return request;
|
|
97
|
+
}
|
|
98
|
+
const query = (params) => params.flatMap(([key, value]) => value === void 0 ? [] : [`${key}=${encodeURIComponent(value)}`]).join("&");
|
|
99
|
+
function systemOpenAppUrl(systemOrigin, request) {
|
|
100
|
+
return `${new URL("/", systemOrigin).href}?${query([
|
|
101
|
+
["open-app", request.app],
|
|
102
|
+
["path", request.path],
|
|
103
|
+
["window", request.window],
|
|
104
|
+
["mode", request.mode === "new" ? "new" : void 0]
|
|
105
|
+
])}`;
|
|
106
|
+
}
|
|
107
|
+
function parseSystemOpenApp(params) {
|
|
108
|
+
return readAppOpenRequest({
|
|
109
|
+
app: params.get("open-app") ?? void 0,
|
|
110
|
+
path: params.get("path") ?? void 0,
|
|
111
|
+
window: params.get("window") ?? void 0,
|
|
112
|
+
mode: params.get("mode") === "new" ? "new" : void 0
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function parseBuckyosUrl(url) {
|
|
116
|
+
const match = /^buckyos:\/\/([a-z0-9-]+(?:\.[a-z0-9-]+)*)\/?(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
|
|
117
|
+
if (!match)
|
|
118
|
+
return void 0;
|
|
119
|
+
const params = new URLSearchParams(match[2] ?? "");
|
|
120
|
+
const version = params.get("v") ?? "";
|
|
121
|
+
if (!/^[1-9]\d{0,8}$/.test(version))
|
|
122
|
+
return void 0;
|
|
123
|
+
return { action: match[1].toLowerCase(), version: Number(version), params };
|
|
124
|
+
}
|
|
125
|
+
const APP_OPEN_ACTION = "app.open";
|
|
126
|
+
function formatAppOpenUrl(link) {
|
|
127
|
+
return `buckyos://${APP_OPEN_ACTION}?${query([["v", "1"], ["zone", link.zoneHost], ["app", link.app], ["path", link.path], ["window", link.window]])}`;
|
|
128
|
+
}
|
|
129
|
+
function parseAppOpenUrl(url) {
|
|
130
|
+
var _a;
|
|
131
|
+
const parsed = parseBuckyosUrl(url);
|
|
132
|
+
if (!parsed || parsed.action !== APP_OPEN_ACTION || parsed.version !== 1)
|
|
133
|
+
return void 0;
|
|
134
|
+
const zoneHost = (_a = parsed.params.get("zone")) == null ? void 0 : _a.toLowerCase();
|
|
135
|
+
if (!zoneHost || !isZoneHost(zoneHost))
|
|
136
|
+
return void 0;
|
|
137
|
+
const request = readAppOpenRequest({
|
|
138
|
+
app: parsed.params.get("app") ?? void 0,
|
|
139
|
+
path: parsed.params.get("path") ?? void 0,
|
|
140
|
+
window: parsed.params.get("window") ?? void 0
|
|
141
|
+
});
|
|
142
|
+
if (!request)
|
|
143
|
+
return void 0;
|
|
144
|
+
return { zoneHost, app: request.app, ...request.path !== void 0 ? { path: request.path } : {}, ...request.window !== void 0 ? { window: request.window } : {} };
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
APP_OPEN_ACTION,
|
|
148
|
+
appWindowId,
|
|
149
|
+
formatAppOpenUrl,
|
|
150
|
+
isAppPath,
|
|
151
|
+
parseAppOpenUrl,
|
|
152
|
+
parseAppWindowId,
|
|
153
|
+
parseBuckyosUrl,
|
|
154
|
+
parseSystemOpenApp,
|
|
155
|
+
readAppOpenRequest,
|
|
156
|
+
readAppWindowDeclaration,
|
|
157
|
+
resolveOpenApp,
|
|
158
|
+
systemOpenAppUrl
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=open-app.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-app.mjs","sources":["../src/open_app.ts"],"sourcesContent":["/**\n * Opening an App. Whatever starts it (an icon, a notification, another App, an external link) becomes one\n * `OpenAppRequest`; `resolveOpenApp` decides between a new window and one that is already open. The shell and the\n * native client share these rules, and `tests/open_app_vectors.json` holds the cases both run.\n */\nexport interface OpenAppRequest {\n /** Zone DID. Required: there is no implicit \"current Zone\". */\n zone: string\n /** App id; a system App uses its id in the system App list (`files`, `messagehub`, …). */\n app: string\n /** The page inside the App, with its query and fragment. */\n path?: string\n /** Window path, named by the App: the same path is the same window. Empty is the App's main window. */\n window?: string\n /** Defaults to `reuse`. `new` only applies to Apps that declare several windows. */\n mode?: 'reuse' | 'new'\n}\n\n/** `window` of an AppDoc and of an entry in the system App list. */\nexport interface AppWindowDeclaration {\n instance: 'single' | 'multi'\n default_mode: 'windowed' | 'maximized'\n width?: number\n height?: number\n min_width?: number\n min_height?: number\n resizable: boolean\n allow_minimize: boolean\n allow_maximize: boolean\n mobile_header: 'standard' | 'compact'\n}\n\n/** Reads a declaration leniently: a missing or invalid field takes its default. */\nexport function readAppWindowDeclaration(value: unknown): AppWindowDeclaration {\n const v = (value && typeof value === 'object' ? value : {}) as Record<string, unknown>\n const declaration: AppWindowDeclaration = {\n instance: v.instance === 'multi' ? 'multi' : 'single',\n default_mode: v.default_mode === 'maximized' ? 'maximized' : 'windowed',\n resizable: v.resizable !== false,\n allow_minimize: v.allow_minimize !== false,\n allow_maximize: v.allow_maximize !== false,\n mobile_header: v.mobile_header === 'compact' ? 'compact' : 'standard',\n }\n for (const key of ['width', 'height', 'min_width', 'min_height'] as const) {\n const size = v[key]\n if (typeof size === 'number' && Number.isFinite(size) && size >= 1) declaration[key] = Math.round(size)\n }\n return declaration\n}\n\n/** `<zone>|<appInstance>|<windowPath>`, each part percent-encoded. */\nexport function appWindowId(zone: string, appInstance: string, windowPath = ''): string {\n return [zone, appInstance, windowPath].map(encodeURIComponent).join('|')\n}\n\nexport function parseAppWindowId(id: string): { zone: string; appInstance: string; windowPath: string } | undefined {\n const parts = id.split('|')\n if (parts.length !== 3) return undefined\n try {\n const [zone, appInstance, windowPath] = parts.map(decodeURIComponent)\n return zone && appInstance ? { zone, appInstance, windowPath } : undefined\n } catch {\n return undefined\n }\n}\n\nexport interface OpenAppWindow {\n id: string\n zone: string\n appInstance: string\n windowPath: string\n /** The page shown now, when it is known. */\n path?: string\n /** When the window was last used; only compared with that of other windows. */\n lastActive: number\n}\n\nexport type OpenAppDecision =\n | { action: 'create'; windowId: string; windowPath: string; path?: string }\n /** `navigate`: the page to go to inside that window. */\n | { action: 'focus'; windowId: string; navigate?: string }\n\n/**\n * Where a request goes. `appInstance` is what the caller resolved `request.app` to; `windows` are all open windows\n * (those of other Zones and Apps are ignored here). A window path given as `''` names the main window, which is not\n * the same as giving none.\n */\nexport function resolveOpenApp(request: OpenAppRequest, appInstance: string, declaration: AppWindowDeclaration, windows: OpenAppWindow[]): OpenAppDecision {\n const own = windows.filter(w => w.zone === request.zone && w.appInstance === appInstance)\n const path = request.path || undefined\n const create = (windowPath: string): OpenAppDecision =>\n ({ action: 'create', windowId: appWindowId(request.zone, appInstance, windowPath), windowPath, ...(path ? { path } : {}) })\n const focus = (window: OpenAppWindow): OpenAppDecision =>\n ({ action: 'focus', windowId: window.id, ...(path && path !== window.path ? { navigate: path } : {}) })\n const multi = declaration.instance === 'multi'\n\n if (multi && request.mode === 'new') {\n const taken = new Set(own.map(w => w.windowPath))\n const base = request.window ?? ''\n let windowPath = base\n for (let n = 2; taken.has(windowPath); n++) windowPath = `${base}~${n}`\n return create(windowPath)\n }\n if (multi && request.window !== undefined) {\n const existing = own.find(w => w.windowPath === request.window)\n return existing ? focus(existing) : create(request.window)\n }\n const latest = own.reduce<OpenAppWindow | undefined>((best, w) => !best || w.lastActive > best.lastActive ? w : best, undefined)\n return latest ? focus(latest) : create('')\n}\n\n/** A request from an App: without a Zone it means the App's own. */\nexport type AppOpenRequest = Omit<OpenAppRequest, 'zone'> & { zone?: string }\n\nconst wellFormed = (value: string): boolean => {\n if (/[\\x00-\\x1f\\x7f]/.test(value)) return false\n try { encodeURIComponent(value) } catch { return false }\n return true\n}\nconst isAppId = (value: unknown): value is string => typeof value === 'string' && /^[\\w.@-]{1,255}$/.test(value)\nconst isWindowPath = (value: unknown): value is string => typeof value === 'string' && value.length <= 512 && wellFormed(value)\nconst isZoneHost = (value: string): boolean => /^[a-z0-9]([a-z0-9.-]*[a-z0-9])?(:\\d{1,5})?$/i.test(value)\n\n/** A page inside an App: `/…` that cannot leave the App's origin when it is resolved against it. */\nexport function isAppPath(value: unknown): value is string {\n return typeof value === 'string' && value.length <= 4096 && /^\\/(?![\\/\\\\])/.test(value) && wellFormed(value)\n}\n\n/** Checks a request that crossed a window boundary and returns a clean copy. */\nexport function readAppOpenRequest(value: unknown): AppOpenRequest | undefined {\n if (!value || typeof value !== 'object') return undefined\n const v = value as Record<string, unknown>\n if (!isAppId(v.app)) return undefined\n const request: AppOpenRequest = { app: v.app }\n if (v.zone !== undefined) {\n if (typeof v.zone !== 'string' || !v.zone || v.zone.length > 255 || !wellFormed(v.zone)) return undefined\n request.zone = v.zone\n }\n if (v.path !== undefined) {\n if (!isAppPath(v.path)) return undefined\n request.path = v.path\n }\n if (v.window !== undefined) {\n if (!isWindowPath(v.window)) return undefined\n request.window = v.window\n }\n if (v.mode !== undefined) {\n if (v.mode !== 'reuse' && v.mode !== 'new') return undefined\n request.mode = v.mode\n }\n return request\n}\n\nconst query = (params: Array<[string, string | undefined]>): string =>\n params.flatMap(([key, value]) => value === undefined ? [] : [`${key}=${encodeURIComponent(value)}`]).join('&')\n\n/** The Zone root page that opens an App: where a standalone tab sends the user. */\nexport function systemOpenAppUrl(systemOrigin: string, request: Omit<AppOpenRequest, 'zone'>): string {\n return `${new URL('/', systemOrigin).href}?${query([\n ['open-app', request.app], ['path', request.path], ['window', request.window], ['mode', request.mode === 'new' ? 'new' : undefined],\n ])}`\n}\n\n/** Inverse of `systemOpenAppUrl`; the Zone is the one serving the page. */\nexport function parseSystemOpenApp(params: URLSearchParams): Omit<AppOpenRequest, 'zone'> | undefined {\n return readAppOpenRequest({\n app: params.get('open-app') ?? undefined, path: params.get('path') ?? undefined,\n window: params.get('window') ?? undefined, mode: params.get('mode') === 'new' ? 'new' : undefined,\n })\n}\n\n/** `buckyos://<action>?v=<version>&…`. Undefined when it is not a well-formed BuckyOS address. */\nexport function parseBuckyosUrl(url: string): { action: string; version: number; params: URLSearchParams } | undefined {\n const match = /^buckyos:\\/\\/([a-z0-9-]+(?:\\.[a-z0-9-]+)*)\\/?(?:\\?([^#]*))?(?:#.*)?$/i.exec(url.trim())\n if (!match) return undefined\n const params = new URLSearchParams(match[2] ?? '')\n const version = params.get('v') ?? ''\n if (!/^[1-9]\\d{0,8}$/.test(version)) return undefined\n return { action: match[1].toLowerCase(), version: Number(version), params }\n}\n\nexport interface AppOpenLink {\n zoneHost: string\n app: string\n path?: string\n window?: string\n}\n\nexport const APP_OPEN_ACTION = 'app.open'\n\nexport function formatAppOpenUrl(link: AppOpenLink): string {\n return `buckyos://${APP_OPEN_ACTION}?${query([['v', '1'], ['zone', link.zoneHost], ['app', link.app], ['path', link.path], ['window', link.window]])}`\n}\n\nexport function parseAppOpenUrl(url: string): AppOpenLink | undefined {\n const parsed = parseBuckyosUrl(url)\n if (!parsed || parsed.action !== APP_OPEN_ACTION || parsed.version !== 1) return undefined\n const zoneHost = parsed.params.get('zone')?.toLowerCase()\n if (!zoneHost || !isZoneHost(zoneHost)) return undefined\n const request = readAppOpenRequest({\n app: parsed.params.get('app') ?? undefined, path: parsed.params.get('path') ?? undefined, window: parsed.params.get('window') ?? undefined,\n })\n if (!request) return undefined\n return { zoneHost, app: request.app, ...(request.path !== undefined ? { path: request.path } : {}), ...(request.window !== undefined ? { window: request.window } : {}) }\n}\n"],"names":[],"mappings":"AAiCO,SAAS,yBAAyB,OAAsC;AAC7E,QAAM,IAAK,SAAS,OAAO,UAAU,WAAW,QAAQ;AACxD,QAAM,cAAoC;AAAA,IACxC,UAAU,EAAE,aAAa,UAAU,UAAU;AAAA,IAC7C,cAAc,EAAE,iBAAiB,cAAc,cAAc;AAAA,IAC7D,WAAW,EAAE,cAAc;AAAA,IAC3B,gBAAgB,EAAE,mBAAmB;AAAA,IACrC,gBAAgB,EAAE,mBAAmB;AAAA,IACrC,eAAe,EAAE,kBAAkB,YAAY,YAAY;AAAA,EAAA;AAE7D,aAAW,OAAO,CAAC,SAAS,UAAU,aAAa,YAAY,GAAY;AACnE,UAAA,OAAO,EAAE,GAAG;AAClB,QAAI,OAAO,SAAS,YAAY,OAAO,SAAS,IAAI,KAAK,QAAQ;AAAG,kBAAY,GAAG,IAAI,KAAK,MAAM,IAAI;AAAA,EACxG;AACO,SAAA;AACT;AAGO,SAAS,YAAY,MAAc,aAAqB,aAAa,IAAY;AAC/E,SAAA,CAAC,MAAM,aAAa,UAAU,EAAE,IAAI,kBAAkB,EAAE,KAAK,GAAG;AACzE;AAEO,SAAS,iBAAiB,IAAmF;AAC5G,QAAA,QAAQ,GAAG,MAAM,GAAG;AAC1B,MAAI,MAAM,WAAW;AAAU,WAAA;AAC3B,MAAA;AACF,UAAM,CAAC,MAAM,aAAa,UAAU,IAAI,MAAM,IAAI,kBAAkB;AACpE,WAAO,QAAQ,cAAc,EAAE,MAAM,aAAa,eAAe;AAAA,EAAA,QAC3D;AACC,WAAA;AAAA,EACT;AACF;AAuBO,SAAS,eAAe,SAAyB,aAAq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AAClC,MAAI,CAAC,UAAU,OAAO,WAAW,mBAAmB,OAAO,YAAY;AAAU,WAAA;AACjF,QAAM,YAAW,YAAO,OAAO,IAAI,MAAM,MAAxB,mBAA2B;AAC5C,MAAI,CAAC,YAAY,CAAC,WAAW,QAAQ;AAAU,WAAA;AAC/C,QAAM,UAAU,mBAAmB;AAAA,IACjC,KAAK,OAAO,OAAO,IAAI,KAAK,KAAK;AAAA,IAAW,MAAM,OAAO,OAAO,IAAI,MAAM,KAAK;AAAA,IAAW,QAAQ,OAAO,OAAO,IAAI,QAAQ,KAAK;AAAA,EAAA,CAClI;AACD,MAAI,CAAC;AAAgB,WAAA;AACd,SAAA,EAAE,UAAU,KAAK,QAAQ,KAAK,GAAI,QAAQ,SAAS,SAAY,EAAE,MAAM,QAAQ,SAAS,IAAK,GAAI,QAAQ,WAAW,SAAY,EAAE,QAAQ,QAAQ,OAAW,IAAA,CAAI,EAAA;AAC1K;"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opening an App. Whatever starts it (an icon, a notification, another App, an external link) becomes one
|
|
3
|
+
* `OpenAppRequest`; `resolveOpenApp` decides between a new window and one that is already open. The shell and the
|
|
4
|
+
* native client share these rules, and `tests/open_app_vectors.json` holds the cases both run.
|
|
5
|
+
*/
|
|
6
|
+
export interface OpenAppRequest {
|
|
7
|
+
/** Zone DID. Required: there is no implicit "current Zone". */
|
|
8
|
+
zone: string;
|
|
9
|
+
/** App id; a system App uses its id in the system App list (`files`, `messagehub`, …). */
|
|
10
|
+
app: string;
|
|
11
|
+
/** The page inside the App, with its query and fragment. */
|
|
12
|
+
path?: string;
|
|
13
|
+
/** Window path, named by the App: the same path is the same window. Empty is the App's main window. */
|
|
14
|
+
window?: string;
|
|
15
|
+
/** Defaults to `reuse`. `new` only applies to Apps that declare several windows. */
|
|
16
|
+
mode?: 'reuse' | 'new';
|
|
17
|
+
}
|
|
18
|
+
/** `window` of an AppDoc and of an entry in the system App list. */
|
|
19
|
+
export interface AppWindowDeclaration {
|
|
20
|
+
instance: 'single' | 'multi';
|
|
21
|
+
default_mode: 'windowed' | 'maximized';
|
|
22
|
+
width?: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
min_width?: number;
|
|
25
|
+
min_height?: number;
|
|
26
|
+
resizable: boolean;
|
|
27
|
+
allow_minimize: boolean;
|
|
28
|
+
allow_maximize: boolean;
|
|
29
|
+
mobile_header: 'standard' | 'compact';
|
|
30
|
+
}
|
|
31
|
+
/** Reads a declaration leniently: a missing or invalid field takes its default. */
|
|
32
|
+
export declare function readAppWindowDeclaration(value: unknown): AppWindowDeclaration;
|
|
33
|
+
/** `<zone>|<appInstance>|<windowPath>`, each part percent-encoded. */
|
|
34
|
+
export declare function appWindowId(zone: string, appInstance: string, windowPath?: string): string;
|
|
35
|
+
export declare function parseAppWindowId(id: string): {
|
|
36
|
+
zone: string;
|
|
37
|
+
appInstance: string;
|
|
38
|
+
windowPath: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
export interface OpenAppWindow {
|
|
41
|
+
id: string;
|
|
42
|
+
zone: string;
|
|
43
|
+
appInstance: string;
|
|
44
|
+
windowPath: string;
|
|
45
|
+
/** The page shown now, when it is known. */
|
|
46
|
+
path?: string;
|
|
47
|
+
/** When the window was last used; only compared with that of other windows. */
|
|
48
|
+
lastActive: number;
|
|
49
|
+
}
|
|
50
|
+
export type OpenAppDecision = {
|
|
51
|
+
action: 'create';
|
|
52
|
+
windowId: string;
|
|
53
|
+
windowPath: string;
|
|
54
|
+
path?: string;
|
|
55
|
+
}
|
|
56
|
+
/** `navigate`: the page to go to inside that window. */
|
|
57
|
+
| {
|
|
58
|
+
action: 'focus';
|
|
59
|
+
windowId: string;
|
|
60
|
+
navigate?: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Where a request goes. `appInstance` is what the caller resolved `request.app` to; `windows` are all open windows
|
|
64
|
+
* (those of other Zones and Apps are ignored here). A window path given as `''` names the main window, which is not
|
|
65
|
+
* the same as giving none.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveOpenApp(request: OpenAppRequest, appInstance: string, declaration: AppWindowDeclaration, windows: OpenAppWindow[]): OpenAppDecision;
|
|
68
|
+
/** A request from an App: without a Zone it means the App's own. */
|
|
69
|
+
export type AppOpenRequest = Omit<OpenAppRequest, 'zone'> & {
|
|
70
|
+
zone?: string;
|
|
71
|
+
};
|
|
72
|
+
/** A page inside an App: `/…` that cannot leave the App's origin when it is resolved against it. */
|
|
73
|
+
export declare function isAppPath(value: unknown): value is string;
|
|
74
|
+
/** Checks a request that crossed a window boundary and returns a clean copy. */
|
|
75
|
+
export declare function readAppOpenRequest(value: unknown): AppOpenRequest | undefined;
|
|
76
|
+
/** The Zone root page that opens an App: where a standalone tab sends the user. */
|
|
77
|
+
export declare function systemOpenAppUrl(systemOrigin: string, request: Omit<AppOpenRequest, 'zone'>): string;
|
|
78
|
+
/** Inverse of `systemOpenAppUrl`; the Zone is the one serving the page. */
|
|
79
|
+
export declare function parseSystemOpenApp(params: URLSearchParams): Omit<AppOpenRequest, 'zone'> | undefined;
|
|
80
|
+
/** `buckyos://<action>?v=<version>&…`. Undefined when it is not a well-formed BuckyOS address. */
|
|
81
|
+
export declare function parseBuckyosUrl(url: string): {
|
|
82
|
+
action: string;
|
|
83
|
+
version: number;
|
|
84
|
+
params: URLSearchParams;
|
|
85
|
+
} | undefined;
|
|
86
|
+
export interface AppOpenLink {
|
|
87
|
+
zoneHost: string;
|
|
88
|
+
app: string;
|
|
89
|
+
path?: string;
|
|
90
|
+
window?: string;
|
|
91
|
+
}
|
|
92
|
+
export declare const APP_OPEN_ACTION = "app.open";
|
|
93
|
+
export declare function formatAppOpenUrl(link: AppOpenLink): string;
|
|
94
|
+
export declare function parseAppOpenUrl(url: string): AppOpenLink | undefined;
|
|
95
|
+
//# sourceMappingURL=open_app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open_app.d.ts","sourceR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