@zhama/tego-plugin-sdk 1.40.0 → 1.40.1

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/publish.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var $=Object.defineProperty;var s=(e,a)=>$(e,"name",{value:a,configurable:!0});var chunkQQOUNXLC_cjs=require("./chunk-QQOUNXLC.cjs");require("./chunk-6EKQMOYT.cjs"),require("./chunk-H6GXDFLP.cjs"),require("./chunk-45Y4CR4R.cjs");var chunk2P6UEAPV_cjs=require("./chunk-2P6UEAPV.cjs");require("./chunk-N4SXZZPY.cjs"),require("./chunk-IOZFHJ4F.cjs"),require("./chunk-AJY7ZHXK.cjs"),require("./chunk-OP64Y4IN.cjs");var promises=require("fs/promises"),path=require("path"),API_PREFIX="/api/v1/tego-os";async function publishPlugin(e){const a=e.log===null?()=>{}:e.log??(t=>console.log(t)),n=await chunkQQOUNXLC_cjs.packPlugin({root:e.root,log:a});return publishPackedPlugin(n,e)}s(publishPlugin,"publishPlugin");async function publishPackedPlugin(e,a){const n=a.log===null?()=>{}:a.log??(p=>console.log(p)),t=a.fetchImpl??fetch,r=createCaller(a.server,a.token,t),u=await promises.readFile(e.file),o=path.basename(e.file);n("\u203A presigning upload");const l=await r("POST","/admin/runtime-plugins/presign-stream",{filename:o,mimeType:"application/zip",size:u.byteLength});n(`\u203A uploading ${o} (${u.byteLength} bytes)`),await putArchive(a.server,l.uploadUrl,u,t),n("\u203A inspecting package");const c=await r("POST","/admin/runtime-plugins/inspect",{uploadToken:l.uploadToken});n(` ${c.pluginId}@${c.semanticVersion} \u2014 ${describeParts(c)}${c.isUpgrade?" (upgrade)":""}${c.requiresConfig?", needs config":""}`),n("\u203A finalizing release");const g=await r("POST","/admin/runtime-plugins/upload",{uploadToken:l.uploadToken,...a.meta});let i=g.release;n(` release ${i.id} (${i.status})`),(a.approve??!0)&&(n("\u203A approving release"),i=await r("POST",`/admin/runtime-plugins/releases/${encodeURIComponent(i.id)}/approve`,{}),n(` release ${i.id} (${i.status})`));let d=null;if(a.install??!0){const p=chunk2P6UEAPV_cjs.resolvePluginScope(e.manifest),f=p==="avatar"?{releaseId:i.id,avatarIds:a.avatarIds??[]}:{releaseId:i.id};n(`\u203A installing for tenant (${p}-scoped)`),d=await r("POST","/admin/runtime-plugins/installs",f),reportInstall(d,n)}return{packed:e,preview:c,catalog:g.catalog,release:i,install:d}}s(publishPackedPlugin,"publishPackedPlugin");function describeParts(e){const a=[];return e.parts.frontend&&a.push(`frontend (${e.parts.frontend.locales.length} locales)`),e.parts.backend&&a.push(`backend (${e.parts.backend.migrationCount} migrations)`),e.parts.claw&&a.push("claw"),a.join(", ")||"no parts"}s(describeParts,"describeParts");function reportInstall(e,a){const n=e.avatars;if(!n||n.attempted===0){a(` installed ${e.pluginId}@${e.version}`);return}const t=n.attempted-n.failures.length;a(` installed ${e.pluginId}@${e.version} \u2014 ${t}/${n.attempted} avatars`);for(const r of n.failures)a(` \u2717 ${r.avatarId}: ${r.message}`)}s(reportInstall,"reportInstall");function createCaller(e,a,n){const t=e.replace(/\/+$/,"");return s(async function(u,o,l){const c=await n(`${t}${API_PREFIX}${o}`,{method:u,headers:{authorization:`Bearer ${a}`,...l===void 0?{}:{"content-type":"application/json"}},...l===void 0?{}:{body:JSON.stringify(l)}});return unwrap(c,`${u} ${o}`)},"call")}s(createCaller,"createCaller");async function putArchive(e,a,n,t){const r=e.replace(/\/+$/,""),u=await t(`${r}${a}`,{method:"PUT",headers:{"content-type":"application/zip"},body:n});await unwrap(u,"PUT upload")}s(putArchive,"putArchive");async function unwrap(e,a){let n;try{n=await e.json()}catch{n=null}if(!e.ok||!n?.success){const t=n?.error?.message??`HTTP ${e.status}`;throw new Error(`${a} failed: ${t}`)}return n.data}s(unwrap,"unwrap"),exports.publishPackedPlugin=publishPackedPlugin,exports.publishPlugin=publishPlugin;
1
+ "use strict";var $=Object.defineProperty;var i=(e,n)=>$(e,"name",{value:n,configurable:!0});var chunkQQOUNXLC_cjs=require("./chunk-QQOUNXLC.cjs");require("./chunk-6EKQMOYT.cjs"),require("./chunk-H6GXDFLP.cjs"),require("./chunk-45Y4CR4R.cjs");var chunk2P6UEAPV_cjs=require("./chunk-2P6UEAPV.cjs");require("./chunk-N4SXZZPY.cjs"),require("./chunk-IOZFHJ4F.cjs"),require("./chunk-AJY7ZHXK.cjs"),require("./chunk-OP64Y4IN.cjs");var promises=require("fs/promises"),path=require("path"),API_PREFIX="/api/v1/tego-os";async function publishPlugin(e){const n=e.log===null?()=>{}:e.log??(r=>console.log(r)),a=await chunkQQOUNXLC_cjs.packPlugin({root:e.root,log:n});return publishPackedPlugin(a,e)}i(publishPlugin,"publishPlugin");async function publishPackedPlugin(e,n){const a=n.log===null?()=>{}:n.log??(p=>console.log(p)),r=n.fetchImpl??fetch,t=createCaller(n.server,n.token,r),s=await promises.readFile(e.file),o=path.basename(e.file);a("\u203A presigning upload");const c=await t("POST","/admin/runtime-plugins/presign-stream",{filename:o,mimeType:"application/zip",size:s.byteLength});a(`\u203A uploading ${o} (${s.byteLength} bytes)`),await putArchive(n.server,c.uploadUrl,s,r),a("\u203A inspecting package");const u=await t("POST","/admin/runtime-plugins/inspect",{uploadToken:c.uploadToken});a(` ${u.pluginId}@${u.semanticVersion} \u2014 ${describeParts(u)}${u.isUpgrade?" (upgrade)":""}${u.requiresConfig?", needs config":""}`),a("\u203A finalizing release");const g=await t("POST","/admin/runtime-plugins/upload",{uploadToken:c.uploadToken,...n.meta});let l=g.release;a(` release ${l.id} (${l.status})`),(n.approve??!0)&&(a("\u203A approving release"),l=await t("POST",`/admin/runtime-plugins/releases/${encodeURIComponent(l.id)}/approve`,{}),a(` release ${l.id} (${l.status})`));let d=null;if(n.install??!0){const p=chunk2P6UEAPV_cjs.resolvePluginScope(e.manifest),f=p==="avatar"?{releaseId:l.id,avatarIds:n.avatarIds??await currentAvatarIds(t,e.manifest.id,a)}:{releaseId:l.id};a(`\u203A installing for tenant (${p}-scoped)`),d=await t("POST","/admin/runtime-plugins/installs",f),reportInstall(d,a)}return{packed:e,preview:u,catalog:g.catalog,release:l,install:d}}i(publishPackedPlugin,"publishPackedPlugin");async function currentAvatarIds(e,n,a){const t=(await e("GET","/admin/runtime-plugins/installs")).find(s=>s.pluginId===n);return t?(a(` keeping the ${t.avatarIds.length} avatars it is installed on`),t.avatarIds):(a(" first install: no avatars selected (pass --avatar to choose)"),[])}i(currentAvatarIds,"currentAvatarIds");function describeParts(e){const n=[];return e.parts.frontend&&n.push(`frontend (${e.parts.frontend.locales.length} locales)`),e.parts.backend&&n.push(`backend (${e.parts.backend.migrationCount} migrations)`),e.parts.claw&&n.push("claw"),n.join(", ")||"no parts"}i(describeParts,"describeParts");function reportInstall(e,n){const a=e.avatars;if(!a||a.attempted===0){n(` installed ${e.pluginId}@${e.version}`);return}const r=a.attempted-a.failures.length;n(` installed ${e.pluginId}@${e.version} \u2014 ${r}/${a.attempted} avatars`);for(const t of a.failures)n(` \u2717 ${t.avatarId}: ${t.message}`)}i(reportInstall,"reportInstall");function createCaller(e,n,a){const r=e.replace(/\/+$/,"");return i(async function(s,o,c){const u=await a(`${r}${API_PREFIX}${o}`,{method:s,headers:{authorization:`Bearer ${n}`,...c===void 0?{}:{"content-type":"application/json"}},...c===void 0?{}:{body:JSON.stringify(c)}});return unwrap(u,`${s} ${o}`)},"call")}i(createCaller,"createCaller");async function putArchive(e,n,a,r){const t=e.replace(/\/+$/,""),s=await r(`${t}${n}`,{method:"PUT",headers:{"content-type":"application/zip"},body:a});await unwrap(s,"PUT upload")}i(putArchive,"putArchive");async function unwrap(e,n){let a;try{a=await e.json()}catch{a=null}if(!e.ok||!a?.success){const r=a?.error?.message??`HTTP ${e.status}`;throw new Error(`${n} failed: ${r}`)}return a.data}i(unwrap,"unwrap"),exports.publishPackedPlugin=publishPackedPlugin,exports.publishPlugin=publishPlugin;
@@ -9,9 +9,12 @@ interface PublishPluginOptions {
9
9
  /** Admin bearer token. The publish endpoints all sit behind `adminMiddleware`. */
10
10
  token: string;
11
11
  /**
12
- * Avatars to install onto, for an avatar-scoped plugin. An empty array
13
- * installs it for nobody, which is the server's own contract, not a no-op —
14
- * it still creates the tenant install. Ignored for a tenant-scoped plugin.
12
+ * Avatars to install onto, for an avatar-scoped plugin: the complete set, so
13
+ * any avatar left out is uninstalled. An empty array installs it for nobody,
14
+ * which is the server's own contract, not a no-op — it still creates the
15
+ * tenant install. Omitted, an upgrade keeps the avatars the plugin is
16
+ * installed on now and a first install selects none. Ignored for a
17
+ * tenant-scoped plugin.
15
18
  */
16
19
  avatarIds?: string[];
17
20
  /** Catalog metadata to stamp on the release. */
package/dist/publish.d.ts CHANGED
@@ -9,9 +9,12 @@ interface PublishPluginOptions {
9
9
  /** Admin bearer token. The publish endpoints all sit behind `adminMiddleware`. */
10
10
  token: string;
11
11
  /**
12
- * Avatars to install onto, for an avatar-scoped plugin. An empty array
13
- * installs it for nobody, which is the server's own contract, not a no-op —
14
- * it still creates the tenant install. Ignored for a tenant-scoped plugin.
12
+ * Avatars to install onto, for an avatar-scoped plugin: the complete set, so
13
+ * any avatar left out is uninstalled. An empty array installs it for nobody,
14
+ * which is the server's own contract, not a no-op — it still creates the
15
+ * tenant install. Omitted, an upgrade keeps the avatars the plugin is
16
+ * installed on now and a first install selects none. Ignored for a
17
+ * tenant-scoped plugin.
15
18
  */
16
19
  avatarIds?: string[];
17
20
  /** Catalog metadata to stamp on the release. */
package/dist/publish.js CHANGED
@@ -1 +1 @@
1
- var h=Object.defineProperty;var o=(e,a)=>h(e,"name",{value:a,configurable:!0});import{packPlugin as v}from"./chunk-UZBWS5AR.js";import"./chunk-44LPR67H.js";import"./chunk-2KXEYXM2.js";import"./chunk-2NTAWYCG.js";import{resolvePluginScope as P}from"./chunk-IVJECPGG.js";import"./chunk-INCA3GFW.js";import"./chunk-XOXUS4VI.js";import"./chunk-VMCGDDGP.js";import"./chunk-SNUCO2MK.js";import{readFile as w}from"fs/promises";import{basename as y}from"path";var I="/api/v1/tego-os";async function T(e){const a=e.log===null?()=>{}:e.log??(n=>console.log(n)),t=await v({root:e.root,log:a});return m(t,e)}o(T,"publishPlugin");async function m(e,a){const t=a.log===null?()=>{}:a.log??(p=>console.log(p)),n=a.fetchImpl??fetch,r=A(a.server,a.token,n),s=await w(e.file),c=y(e.file);t("\u203A presigning upload");const u=await r("POST","/admin/runtime-plugins/presign-stream",{filename:c,mimeType:"application/zip",size:s.byteLength});t(`\u203A uploading ${c} (${s.byteLength} bytes)`),await S(a.server,u.uploadUrl,s,n),t("\u203A inspecting package");const l=await r("POST","/admin/runtime-plugins/inspect",{uploadToken:u.uploadToken});t(` ${l.pluginId}@${l.semanticVersion} \u2014 ${b(l)}${l.isUpgrade?" (upgrade)":""}${l.requiresConfig?", needs config":""}`),t("\u203A finalizing release");const g=await r("POST","/admin/runtime-plugins/upload",{uploadToken:u.uploadToken,...a.meta});let i=g.release;t(` release ${i.id} (${i.status})`),(a.approve??!0)&&(t("\u203A approving release"),i=await r("POST",`/admin/runtime-plugins/releases/${encodeURIComponent(i.id)}/approve`,{}),t(` release ${i.id} (${i.status})`));let d=null;if(a.install??!0){const p=P(e.manifest),$=p==="avatar"?{releaseId:i.id,avatarIds:a.avatarIds??[]}:{releaseId:i.id};t(`\u203A installing for tenant (${p}-scoped)`),d=await r("POST","/admin/runtime-plugins/installs",$),k(d,t)}return{packed:e,preview:l,catalog:g.catalog,release:i,install:d}}o(m,"publishPackedPlugin");function b(e){const a=[];return e.parts.frontend&&a.push(`frontend (${e.parts.frontend.locales.length} locales)`),e.parts.backend&&a.push(`backend (${e.parts.backend.migrationCount} migrations)`),e.parts.claw&&a.push("claw"),a.join(", ")||"no parts"}o(b,"describeParts");function k(e,a){const t=e.avatars;if(!t||t.attempted===0){a(` installed ${e.pluginId}@${e.version}`);return}const n=t.attempted-t.failures.length;a(` installed ${e.pluginId}@${e.version} \u2014 ${n}/${t.attempted} avatars`);for(const r of t.failures)a(` \u2717 ${r.avatarId}: ${r.message}`)}o(k,"reportInstall");function A(e,a,t){const n=e.replace(/\/+$/,"");return o(async function(s,c,u){const l=await t(`${n}${I}${c}`,{method:s,headers:{authorization:`Bearer ${a}`,...u===void 0?{}:{"content-type":"application/json"}},...u===void 0?{}:{body:JSON.stringify(u)}});return f(l,`${s} ${c}`)},"call")}o(A,"createCaller");async function S(e,a,t,n){const r=e.replace(/\/+$/,""),s=await n(`${r}${a}`,{method:"PUT",headers:{"content-type":"application/zip"},body:t});await f(s,"PUT upload")}o(S,"putArchive");async function f(e,a){let t;try{t=await e.json()}catch{t=null}if(!e.ok||!t?.success){const n=t?.error?.message??`HTTP ${e.status}`;throw new Error(`${a} failed: ${n}`)}return t.data}o(f,"unwrap");export{m as publishPackedPlugin,T as publishPlugin};
1
+ var v=Object.defineProperty;var s=(a,e)=>v(a,"name",{value:e,configurable:!0});import{packPlugin as h}from"./chunk-UZBWS5AR.js";import"./chunk-44LPR67H.js";import"./chunk-2KXEYXM2.js";import"./chunk-2NTAWYCG.js";import{resolvePluginScope as I}from"./chunk-IVJECPGG.js";import"./chunk-INCA3GFW.js";import"./chunk-XOXUS4VI.js";import"./chunk-VMCGDDGP.js";import"./chunk-SNUCO2MK.js";import{readFile as w}from"fs/promises";import{basename as P}from"path";var y="/api/v1/tego-os";async function T(a){const e=a.log===null?()=>{}:a.log??(i=>console.log(i)),t=await h({root:a.root,log:e});return f(t,a)}s(T,"publishPlugin");async function f(a,e){const t=e.log===null?()=>{}:e.log??(p=>console.log(p)),i=e.fetchImpl??fetch,n=S(e.server,e.token,i),r=await w(a.file),c=P(a.file);t("\u203A presigning upload");const u=await n("POST","/admin/runtime-plugins/presign-stream",{filename:c,mimeType:"application/zip",size:r.byteLength});t(`\u203A uploading ${c} (${r.byteLength} bytes)`),await z(e.server,u.uploadUrl,r,i),t("\u203A inspecting package");const l=await n("POST","/admin/runtime-plugins/inspect",{uploadToken:u.uploadToken});t(` ${l.pluginId}@${l.semanticVersion} \u2014 ${k(l)}${l.isUpgrade?" (upgrade)":""}${l.requiresConfig?", needs config":""}`),t("\u203A finalizing release");const g=await n("POST","/admin/runtime-plugins/upload",{uploadToken:u.uploadToken,...e.meta});let o=g.release;t(` release ${o.id} (${o.status})`),(e.approve??!0)&&(t("\u203A approving release"),o=await n("POST",`/admin/runtime-plugins/releases/${encodeURIComponent(o.id)}/approve`,{}),t(` release ${o.id} (${o.status})`));let d=null;if(e.install??!0){const p=I(a.manifest),$=p==="avatar"?{releaseId:o.id,avatarIds:e.avatarIds??await b(n,a.manifest.id,t)}:{releaseId:o.id};t(`\u203A installing for tenant (${p}-scoped)`),d=await n("POST","/admin/runtime-plugins/installs",$),A(d,t)}return{packed:a,preview:l,catalog:g.catalog,release:o,install:d}}s(f,"publishPackedPlugin");async function b(a,e,t){const n=(await a("GET","/admin/runtime-plugins/installs")).find(r=>r.pluginId===e);return n?(t(` keeping the ${n.avatarIds.length} avatars it is installed on`),n.avatarIds):(t(" first install: no avatars selected (pass --avatar to choose)"),[])}s(b,"currentAvatarIds");function k(a){const e=[];return a.parts.frontend&&e.push(`frontend (${a.parts.frontend.locales.length} locales)`),a.parts.backend&&e.push(`backend (${a.parts.backend.migrationCount} migrations)`),a.parts.claw&&e.push("claw"),e.join(", ")||"no parts"}s(k,"describeParts");function A(a,e){const t=a.avatars;if(!t||t.attempted===0){e(` installed ${a.pluginId}@${a.version}`);return}const i=t.attempted-t.failures.length;e(` installed ${a.pluginId}@${a.version} \u2014 ${i}/${t.attempted} avatars`);for(const n of t.failures)e(` \u2717 ${n.avatarId}: ${n.message}`)}s(A,"reportInstall");function S(a,e,t){const i=a.replace(/\/+$/,"");return s(async function(r,c,u){const l=await t(`${i}${y}${c}`,{method:r,headers:{authorization:`Bearer ${e}`,...u===void 0?{}:{"content-type":"application/json"}},...u===void 0?{}:{body:JSON.stringify(u)}});return m(l,`${r} ${c}`)},"call")}s(S,"createCaller");async function z(a,e,t,i){const n=a.replace(/\/+$/,""),r=await i(`${n}${e}`,{method:"PUT",headers:{"content-type":"application/zip"},body:t});await m(r,"PUT upload")}s(z,"putArchive");async function m(a,e){let t;try{t=await a.json()}catch{t=null}if(!a.ok||!t?.success){const i=t?.error?.message??`HTTP ${a.status}`;throw new Error(`${e} failed: ${i}`)}return t.data}s(m,"unwrap");export{f as publishPackedPlugin,T as publishPlugin};
package/dist/server.d.cts CHANGED
@@ -15,32 +15,32 @@ declare const accountInviteSchema: z.ZodEffects<z.ZodObject<{
15
15
  requestId: string;
16
16
  organizationName: string;
17
17
  email?: string | undefined;
18
- phone?: string | undefined;
19
18
  username?: string | undefined;
19
+ phone?: string | undefined;
20
20
  userId?: string | undefined;
21
21
  fullName?: string | undefined;
22
22
  }, {
23
23
  requestId: string;
24
24
  organizationName: string;
25
25
  email?: string | undefined;
26
- phone?: string | undefined;
27
26
  username?: string | undefined;
27
+ phone?: string | undefined;
28
28
  userId?: string | undefined;
29
29
  fullName?: string | undefined;
30
30
  }>, {
31
31
  requestId: string;
32
32
  organizationName: string;
33
33
  email?: string | undefined;
34
- phone?: string | undefined;
35
34
  username?: string | undefined;
35
+ phone?: string | undefined;
36
36
  userId?: string | undefined;
37
37
  fullName?: string | undefined;
38
38
  }, {
39
39
  requestId: string;
40
40
  organizationName: string;
41
41
  email?: string | undefined;
42
- phone?: string | undefined;
43
42
  username?: string | undefined;
43
+ phone?: string | undefined;
44
44
  userId?: string | undefined;
45
45
  fullName?: string | undefined;
46
46
  }>;
@@ -59,36 +59,36 @@ declare const accountProvisionSchema: z.ZodEffects<z.ZodObject<{
59
59
  requestId: string;
60
60
  organizationName: string;
61
61
  email?: string | undefined;
62
- phone?: string | undefined;
63
62
  password?: string | undefined;
64
63
  username?: string | undefined;
64
+ phone?: string | undefined;
65
65
  userId?: string | undefined;
66
66
  fullName?: string | undefined;
67
67
  }, {
68
68
  requestId: string;
69
69
  organizationName: string;
70
70
  email?: string | undefined;
71
- phone?: string | undefined;
72
71
  password?: string | undefined;
73
72
  username?: string | undefined;
73
+ phone?: string | undefined;
74
74
  userId?: string | undefined;
75
75
  fullName?: string | undefined;
76
76
  }>, {
77
77
  requestId: string;
78
78
  organizationName: string;
79
79
  email?: string | undefined;
80
- phone?: string | undefined;
81
80
  password?: string | undefined;
82
81
  username?: string | undefined;
82
+ phone?: string | undefined;
83
83
  userId?: string | undefined;
84
84
  fullName?: string | undefined;
85
85
  }, {
86
86
  requestId: string;
87
87
  organizationName: string;
88
88
  email?: string | undefined;
89
- phone?: string | undefined;
90
89
  password?: string | undefined;
91
90
  username?: string | undefined;
91
+ phone?: string | undefined;
92
92
  userId?: string | undefined;
93
93
  fullName?: string | undefined;
94
94
  }>;
@@ -445,13 +445,13 @@ declare const pluginCollectionEnsureSchema: z.ZodObject<{
445
445
  /** @deprecated Accepted for older clients; reads use ordinary knowledge ACL. */
446
446
  policyScope: z.ZodOptional<z.ZodString>;
447
447
  }, "strict", z.ZodTypeAny, {
448
- key: string;
449
448
  name: string;
449
+ key: string;
450
450
  accessMode?: "managed" | "private" | undefined;
451
451
  policyScope?: string | undefined;
452
452
  }, {
453
- key: string;
454
453
  name: string;
454
+ key: string;
455
455
  accessMode?: "managed" | "private" | undefined;
456
456
  policyScope?: string | undefined;
457
457
  }>;
@@ -462,23 +462,23 @@ declare const pluginCollectionPermissionsSchema: z.ZodObject<{
462
462
  subjectType: z.ZodEnum<["user", "team", "role", "tenant"]>;
463
463
  subjectId: z.ZodString;
464
464
  }, "strict", z.ZodTypeAny, {
465
- subjectType: "tenant" | "user" | "team" | "role";
465
+ subjectType: "user" | "team" | "tenant" | "role";
466
466
  subjectId: string;
467
467
  }, {
468
- subjectType: "tenant" | "user" | "team" | "role";
468
+ subjectType: "user" | "team" | "tenant" | "role";
469
469
  subjectId: string;
470
470
  }>, "many">;
471
471
  }, "strict", z.ZodTypeAny, {
472
472
  key: string;
473
473
  grants: {
474
- subjectType: "tenant" | "user" | "team" | "role";
474
+ subjectType: "user" | "team" | "tenant" | "role";
475
475
  subjectId: string;
476
476
  }[];
477
477
  syncRevision?: string | undefined;
478
478
  }, {
479
479
  key: string;
480
480
  grants: {
481
- subjectType: "tenant" | "user" | "team" | "role";
481
+ subjectType: "user" | "team" | "tenant" | "role";
482
482
  subjectId: string;
483
483
  }[];
484
484
  syncRevision?: string | undefined;
@@ -524,23 +524,23 @@ declare const pluginCollectionAccessSchema: z.ZodEffects<z.ZodObject<{
524
524
  /** Identity snapshot returned by access({enabled:false}); required to resume. */
525
525
  identityRevision: z.ZodOptional<z.ZodString>;
526
526
  }, "strict", z.ZodTypeAny, {
527
- key?: string | undefined;
528
527
  enabled?: boolean | undefined;
528
+ key?: string | undefined;
529
529
  syncRevision?: string | undefined;
530
530
  identityRevision?: string | undefined;
531
531
  }, {
532
- key?: string | undefined;
533
532
  enabled?: boolean | undefined;
533
+ key?: string | undefined;
534
534
  syncRevision?: string | undefined;
535
535
  identityRevision?: string | undefined;
536
536
  }>, {
537
- key?: string | undefined;
538
537
  enabled?: boolean | undefined;
538
+ key?: string | undefined;
539
539
  syncRevision?: string | undefined;
540
540
  identityRevision?: string | undefined;
541
541
  }, {
542
- key?: string | undefined;
543
542
  enabled?: boolean | undefined;
543
+ key?: string | undefined;
544
544
  syncRevision?: string | undefined;
545
545
  identityRevision?: string | undefined;
546
546
  }>;
@@ -553,31 +553,31 @@ declare const pluginCollectionImportSchema: z.ZodObject<{
553
553
  text: z.ZodString;
554
554
  metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>;
555
555
  }, "strict", z.ZodTypeAny, {
556
- title: string;
557
556
  text: string;
557
+ title: string;
558
558
  externalId: string;
559
559
  metadata?: Record<string, string | number | boolean | null> | undefined;
560
560
  }, {
561
- title: string;
562
561
  text: string;
562
+ title: string;
563
563
  externalId: string;
564
564
  metadata?: Record<string, string | number | boolean | null> | undefined;
565
565
  }>, "many">, {
566
- title: string;
567
566
  text: string;
567
+ title: string;
568
568
  externalId: string;
569
569
  metadata?: Record<string, string | number | boolean | null> | undefined;
570
570
  }[], {
571
- title: string;
572
571
  text: string;
572
+ title: string;
573
573
  externalId: string;
574
574
  metadata?: Record<string, string | number | boolean | null> | undefined;
575
575
  }[]>;
576
576
  }, "strict", z.ZodTypeAny, {
577
577
  key: string;
578
578
  documents: {
579
- title: string;
580
579
  text: string;
580
+ title: string;
581
581
  externalId: string;
582
582
  metadata?: Record<string, string | number | boolean | null> | undefined;
583
583
  }[];
@@ -585,8 +585,8 @@ declare const pluginCollectionImportSchema: z.ZodObject<{
585
585
  }, {
586
586
  key: string;
587
587
  documents: {
588
- title: string;
589
588
  text: string;
589
+ title: string;
590
590
  externalId: string;
591
591
  metadata?: Record<string, string | number | boolean | null> | undefined;
592
592
  }[];
@@ -688,8 +688,8 @@ declare const pluginCollectionDocumentContentSchema: z.ZodObject<{
688
688
  page: z.ZodDefault<z.ZodNumber>;
689
689
  pageSize: z.ZodDefault<z.ZodNumber>;
690
690
  }, "strict", z.ZodTypeAny, {
691
- key: string;
692
691
  page: number;
692
+ key: string;
693
693
  externalId: string;
694
694
  pageSize: number;
695
695
  }, {
@@ -705,13 +705,13 @@ declare const pluginCollectionSearchSchema: z.ZodObject<{
705
705
  /** Equality per key; an array matches any of its values. */
706
706
  filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">]>>>;
707
707
  }, "strict", z.ZodTypeAny, {
708
- key: string;
709
708
  query: string;
709
+ key: string;
710
710
  topK: number;
711
711
  filter?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
712
712
  }, {
713
- key: string;
714
713
  query: string;
714
+ key: string;
715
715
  filter?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
716
716
  topK?: number | undefined;
717
717
  }>;
@@ -889,39 +889,39 @@ declare const pluginKnowledgeBaseInputSchema: z.ZodObject<{
889
889
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
890
890
  }, "strict", z.ZodTypeAny, {
891
891
  permission: "view" | "manage" | "use" | "operate";
892
- subjectType: "tenant" | "user" | "team" | "role";
892
+ subjectType: "user" | "team" | "tenant" | "role";
893
893
  subjectId: string;
894
894
  expiresAt?: string | null | undefined;
895
895
  }, {
896
896
  permission: "view" | "manage" | "use" | "operate";
897
- subjectType: "tenant" | "user" | "team" | "role";
897
+ subjectType: "user" | "team" | "tenant" | "role";
898
898
  subjectId: string;
899
899
  expiresAt?: string | null | undefined;
900
900
  }>, "many">;
901
901
  idempotencyKey: z.ZodString;
902
902
  }, "strict", z.ZodTypeAny, {
903
+ name: string;
903
904
  scope: {
904
905
  type: "team";
905
906
  teamId: string;
906
907
  };
907
- name: string;
908
908
  grants: {
909
909
  permission: "view" | "manage" | "use" | "operate";
910
- subjectType: "tenant" | "user" | "team" | "role";
910
+ subjectType: "user" | "team" | "tenant" | "role";
911
911
  subjectId: string;
912
912
  expiresAt?: string | null | undefined;
913
913
  }[];
914
914
  idempotencyKey: string;
915
915
  description?: string | undefined;
916
916
  }, {
917
+ name: string;
917
918
  scope: {
918
919
  type: "team";
919
920
  teamId: string;
920
921
  };
921
- name: string;
922
922
  grants: {
923
923
  permission: "view" | "manage" | "use" | "operate";
924
- subjectType: "tenant" | "user" | "team" | "role";
924
+ subjectType: "user" | "team" | "tenant" | "role";
925
925
  subjectId: string;
926
926
  expiresAt?: string | null | undefined;
927
927
  }[];
package/dist/server.d.ts CHANGED
@@ -15,32 +15,32 @@ declare const accountInviteSchema: z.ZodEffects<z.ZodObject<{
15
15
  requestId: string;
16
16
  organizationName: string;
17
17
  email?: string | undefined;
18
- phone?: string | undefined;
19
18
  username?: string | undefined;
19
+ phone?: string | undefined;
20
20
  userId?: string | undefined;
21
21
  fullName?: string | undefined;
22
22
  }, {
23
23
  requestId: string;
24
24
  organizationName: string;
25
25
  email?: string | undefined;
26
- phone?: string | undefined;
27
26
  username?: string | undefined;
27
+ phone?: string | undefined;
28
28
  userId?: string | undefined;
29
29
  fullName?: string | undefined;
30
30
  }>, {
31
31
  requestId: string;
32
32
  organizationName: string;
33
33
  email?: string | undefined;
34
- phone?: string | undefined;
35
34
  username?: string | undefined;
35
+ phone?: string | undefined;
36
36
  userId?: string | undefined;
37
37
  fullName?: string | undefined;
38
38
  }, {
39
39
  requestId: string;
40
40
  organizationName: string;
41
41
  email?: string | undefined;
42
- phone?: string | undefined;
43
42
  username?: string | undefined;
43
+ phone?: string | undefined;
44
44
  userId?: string | undefined;
45
45
  fullName?: string | undefined;
46
46
  }>;
@@ -59,36 +59,36 @@ declare const accountProvisionSchema: z.ZodEffects<z.ZodObject<{
59
59
  requestId: string;
60
60
  organizationName: string;
61
61
  email?: string | undefined;
62
- phone?: string | undefined;
63
62
  password?: string | undefined;
64
63
  username?: string | undefined;
64
+ phone?: string | undefined;
65
65
  userId?: string | undefined;
66
66
  fullName?: string | undefined;
67
67
  }, {
68
68
  requestId: string;
69
69
  organizationName: string;
70
70
  email?: string | undefined;
71
- phone?: string | undefined;
72
71
  password?: string | undefined;
73
72
  username?: string | undefined;
73
+ phone?: string | undefined;
74
74
  userId?: string | undefined;
75
75
  fullName?: string | undefined;
76
76
  }>, {
77
77
  requestId: string;
78
78
  organizationName: string;
79
79
  email?: string | undefined;
80
- phone?: string | undefined;
81
80
  password?: string | undefined;
82
81
  username?: string | undefined;
82
+ phone?: string | undefined;
83
83
  userId?: string | undefined;
84
84
  fullName?: string | undefined;
85
85
  }, {
86
86
  requestId: string;
87
87
  organizationName: string;
88
88
  email?: string | undefined;
89
- phone?: string | undefined;
90
89
  password?: string | undefined;
91
90
  username?: string | undefined;
91
+ phone?: string | undefined;
92
92
  userId?: string | undefined;
93
93
  fullName?: string | undefined;
94
94
  }>;
@@ -445,13 +445,13 @@ declare const pluginCollectionEnsureSchema: z.ZodObject<{
445
445
  /** @deprecated Accepted for older clients; reads use ordinary knowledge ACL. */
446
446
  policyScope: z.ZodOptional<z.ZodString>;
447
447
  }, "strict", z.ZodTypeAny, {
448
- key: string;
449
448
  name: string;
449
+ key: string;
450
450
  accessMode?: "managed" | "private" | undefined;
451
451
  policyScope?: string | undefined;
452
452
  }, {
453
- key: string;
454
453
  name: string;
454
+ key: string;
455
455
  accessMode?: "managed" | "private" | undefined;
456
456
  policyScope?: string | undefined;
457
457
  }>;
@@ -462,23 +462,23 @@ declare const pluginCollectionPermissionsSchema: z.ZodObject<{
462
462
  subjectType: z.ZodEnum<["user", "team", "role", "tenant"]>;
463
463
  subjectId: z.ZodString;
464
464
  }, "strict", z.ZodTypeAny, {
465
- subjectType: "tenant" | "user" | "team" | "role";
465
+ subjectType: "user" | "team" | "tenant" | "role";
466
466
  subjectId: string;
467
467
  }, {
468
- subjectType: "tenant" | "user" | "team" | "role";
468
+ subjectType: "user" | "team" | "tenant" | "role";
469
469
  subjectId: string;
470
470
  }>, "many">;
471
471
  }, "strict", z.ZodTypeAny, {
472
472
  key: string;
473
473
  grants: {
474
- subjectType: "tenant" | "user" | "team" | "role";
474
+ subjectType: "user" | "team" | "tenant" | "role";
475
475
  subjectId: string;
476
476
  }[];
477
477
  syncRevision?: string | undefined;
478
478
  }, {
479
479
  key: string;
480
480
  grants: {
481
- subjectType: "tenant" | "user" | "team" | "role";
481
+ subjectType: "user" | "team" | "tenant" | "role";
482
482
  subjectId: string;
483
483
  }[];
484
484
  syncRevision?: string | undefined;
@@ -524,23 +524,23 @@ declare const pluginCollectionAccessSchema: z.ZodEffects<z.ZodObject<{
524
524
  /** Identity snapshot returned by access({enabled:false}); required to resume. */
525
525
  identityRevision: z.ZodOptional<z.ZodString>;
526
526
  }, "strict", z.ZodTypeAny, {
527
- key?: string | undefined;
528
527
  enabled?: boolean | undefined;
528
+ key?: string | undefined;
529
529
  syncRevision?: string | undefined;
530
530
  identityRevision?: string | undefined;
531
531
  }, {
532
- key?: string | undefined;
533
532
  enabled?: boolean | undefined;
533
+ key?: string | undefined;
534
534
  syncRevision?: string | undefined;
535
535
  identityRevision?: string | undefined;
536
536
  }>, {
537
- key?: string | undefined;
538
537
  enabled?: boolean | undefined;
538
+ key?: string | undefined;
539
539
  syncRevision?: string | undefined;
540
540
  identityRevision?: string | undefined;
541
541
  }, {
542
- key?: string | undefined;
543
542
  enabled?: boolean | undefined;
543
+ key?: string | undefined;
544
544
  syncRevision?: string | undefined;
545
545
  identityRevision?: string | undefined;
546
546
  }>;
@@ -553,31 +553,31 @@ declare const pluginCollectionImportSchema: z.ZodObject<{
553
553
  text: z.ZodString;
554
554
  metadata: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>;
555
555
  }, "strict", z.ZodTypeAny, {
556
- title: string;
557
556
  text: string;
557
+ title: string;
558
558
  externalId: string;
559
559
  metadata?: Record<string, string | number | boolean | null> | undefined;
560
560
  }, {
561
- title: string;
562
561
  text: string;
562
+ title: string;
563
563
  externalId: string;
564
564
  metadata?: Record<string, string | number | boolean | null> | undefined;
565
565
  }>, "many">, {
566
- title: string;
567
566
  text: string;
567
+ title: string;
568
568
  externalId: string;
569
569
  metadata?: Record<string, string | number | boolean | null> | undefined;
570
570
  }[], {
571
- title: string;
572
571
  text: string;
572
+ title: string;
573
573
  externalId: string;
574
574
  metadata?: Record<string, string | number | boolean | null> | undefined;
575
575
  }[]>;
576
576
  }, "strict", z.ZodTypeAny, {
577
577
  key: string;
578
578
  documents: {
579
- title: string;
580
579
  text: string;
580
+ title: string;
581
581
  externalId: string;
582
582
  metadata?: Record<string, string | number | boolean | null> | undefined;
583
583
  }[];
@@ -585,8 +585,8 @@ declare const pluginCollectionImportSchema: z.ZodObject<{
585
585
  }, {
586
586
  key: string;
587
587
  documents: {
588
- title: string;
589
588
  text: string;
589
+ title: string;
590
590
  externalId: string;
591
591
  metadata?: Record<string, string | number | boolean | null> | undefined;
592
592
  }[];
@@ -688,8 +688,8 @@ declare const pluginCollectionDocumentContentSchema: z.ZodObject<{
688
688
  page: z.ZodDefault<z.ZodNumber>;
689
689
  pageSize: z.ZodDefault<z.ZodNumber>;
690
690
  }, "strict", z.ZodTypeAny, {
691
- key: string;
692
691
  page: number;
692
+ key: string;
693
693
  externalId: string;
694
694
  pageSize: number;
695
695
  }, {
@@ -705,13 +705,13 @@ declare const pluginCollectionSearchSchema: z.ZodObject<{
705
705
  /** Equality per key; an array matches any of its values. */
706
706
  filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, "many">]>>>;
707
707
  }, "strict", z.ZodTypeAny, {
708
- key: string;
709
708
  query: string;
709
+ key: string;
710
710
  topK: number;
711
711
  filter?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
712
712
  }, {
713
- key: string;
714
713
  query: string;
714
+ key: string;
715
715
  filter?: Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | undefined;
716
716
  topK?: number | undefined;
717
717
  }>;
@@ -889,39 +889,39 @@ declare const pluginKnowledgeBaseInputSchema: z.ZodObject<{
889
889
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
890
890
  }, "strict", z.ZodTypeAny, {
891
891
  permission: "view" | "manage" | "use" | "operate";
892
- subjectType: "tenant" | "user" | "team" | "role";
892
+ subjectType: "user" | "team" | "tenant" | "role";
893
893
  subjectId: string;
894
894
  expiresAt?: string | null | undefined;
895
895
  }, {
896
896
  permission: "view" | "manage" | "use" | "operate";
897
- subjectType: "tenant" | "user" | "team" | "role";
897
+ subjectType: "user" | "team" | "tenant" | "role";
898
898
  subjectId: string;
899
899
  expiresAt?: string | null | undefined;
900
900
  }>, "many">;
901
901
  idempotencyKey: z.ZodString;
902
902
  }, "strict", z.ZodTypeAny, {
903
+ name: string;
903
904
  scope: {
904
905
  type: "team";
905
906
  teamId: string;
906
907
  };
907
- name: string;
908
908
  grants: {
909
909
  permission: "view" | "manage" | "use" | "operate";
910
- subjectType: "tenant" | "user" | "team" | "role";
910
+ subjectType: "user" | "team" | "tenant" | "role";
911
911
  subjectId: string;
912
912
  expiresAt?: string | null | undefined;
913
913
  }[];
914
914
  idempotencyKey: string;
915
915
  description?: string | undefined;
916
916
  }, {
917
+ name: string;
917
918
  scope: {
918
919
  type: "team";
919
920
  teamId: string;
920
921
  };
921
- name: string;
922
922
  grants: {
923
923
  permission: "view" | "manage" | "use" | "operate";
924
- subjectType: "tenant" | "user" | "team" | "role";
924
+ subjectType: "user" | "team" | "tenant" | "role";
925
925
  subjectId: string;
926
926
  expiresAt?: string | null | undefined;
927
927
  }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhama/tego-plugin-sdk",
3
- "version": "1.40.0",
3
+ "version": "1.40.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",