mnfst 0.5.144 → 0.5.145

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.
@@ -108,6 +108,20 @@ async function getAppwriteConfig() {
108
108
  // Creator role: string reference to a role in memberRoles (role creator gets by default)
109
109
  const creatorRole = appwriteConfig.auth?.creatorRole || null;
110
110
 
111
+ // Creator roles (plural): the custom role(s) the team creator is assigned, atomically,
112
+ // at team creation. Accepts string | string[] | null. An explicit null / [] means
113
+ // "no template role — creator holds only Appwrite's intrinsic owner". Takes precedence
114
+ // over the legacy singular `creatorRole`. When NEITHER is set, createTeam keeps its
115
+ // historical default (first defined role). Resolved to: array (configured, [] = owner-only)
116
+ // or null (unconfigured → use the historical default).
117
+ let creatorRoles = null;
118
+ if (appwriteConfig.auth && Object.prototype.hasOwnProperty.call(appwriteConfig.auth, 'creatorRoles')) {
119
+ const raw = appwriteConfig.auth.creatorRoles;
120
+ creatorRoles = raw == null ? [] : (Array.isArray(raw) ? raw.filter(r => typeof r === 'string') : [raw]).filter(Boolean);
121
+ } else if (creatorRole && memberRoles && memberRoles[creatorRole]) {
122
+ creatorRoles = [creatorRole];
123
+ }
124
+
111
125
  // Guest migration: id of the deployed guest-migration Appwrite Function. When set,
112
126
  // a guest's teams are carried over to the account they sign into via OTP (which
113
127
  // Appwrite can't convert in place). See templates/guest-migration-function.
@@ -135,7 +149,8 @@ async function getAppwriteConfig() {
135
149
  memberRoles: memberRoles, // Role definitions: { "RoleName": ["permission1", "permission2"] }
136
150
  permanentRoles: permanentRoles, // Object: { "RoleName": ["permission1", ...] } (cannot be deleted)
137
151
  templateRoles: templateRoles, // Object: { "RoleName": ["permission1", ...] } (can be deleted)
138
- creatorRole: creatorRole // String reference to memberRoles key
152
+ creatorRole: creatorRole, // String reference to memberRoles key (legacy singular)
153
+ creatorRoles: creatorRoles // array (configured; [] = owner-only) or null (use historical default)
139
154
  };
140
155
  }
141
156
 
@@ -1402,13 +1417,14 @@ function initializeTeamsCore() {
1402
1417
  // Determine initial roles for team creator
1403
1418
  let creatorRoles = roles;
1404
1419
  if (creatorRoles.length === 0) {
1405
- // If no roles specified, use creatorRole from config
1406
1420
  const memberRoles = appwriteConfig?.memberRoles;
1407
- const creatorRoleName = appwriteConfig?.creatorRole;
1421
+ const configuredCreatorRoles = appwriteConfig?.creatorRoles; // array | null
1408
1422
 
1409
- if (memberRoles && creatorRoleName && memberRoles[creatorRoleName]) {
1410
- // Use specified creatorRole
1411
- creatorRoles = [creatorRoleName];
1423
+ if (Array.isArray(configuredCreatorRoles)) {
1424
+ // Explicitly configured via auth.creatorRoles (or legacy creatorRole).
1425
+ // An empty array means "owner-only" — the creator holds just
1426
+ // Appwrite's intrinsic owner, with no template role assigned.
1427
+ creatorRoles = configuredCreatorRoles.length ? configuredCreatorRoles.slice() : ['owner'];
1412
1428
  } else if (memberRoles && Object.keys(memberRoles).length > 0) {
1413
1429
  // No creatorRole specified, find role with all owner permissions or use first
1414
1430
  let foundRole = null;
@@ -1,5 +1,5 @@
1
1
  {
2
- "manifest.appwrite.auth.js": "sha384-/IbcczrhhYWlsQFvFmHkulV1JPIBBFvMH513PwsnJo+D0F+YKhGJ1ig/UmJbGSe/",
2
+ "manifest.appwrite.auth.js": "sha384-1Kz/Dlerds1/7iKrEVDIRbFDyngZ0L+f81td9eW3w4t3nGFU+w4gjyGhwn+IiTRM",
3
3
  "manifest.appwrite.data.js": "sha384-00ulLT+GAIuPHA/rRT9p98vYlsyDzkyKXtg86BDQ6FGQa5vVVN+W6kuforniBAsz",
4
4
  "manifest.appwrite.presence.js": "sha384-uxRpx9/Jj0kGtklH5QmUlAzD3zdSvFRfK6bcJQqxl+Bsf5tOo4zgwqJTQgtZoHQP",
5
5
  "manifest.charts.js": "sha384-RuV7gWXt3s+JegxWgDieR/P5U99sbOYWiYHdJGe2uCJjDFU1cPp0mJ1QT55ec9uz",
@@ -197,7 +197,15 @@
197
197
  }
198
198
  }
199
199
  },
200
- "creatorRole": { "type": "string" }
200
+ "creatorRole": { "type": "string" },
201
+ "creatorRoles": {
202
+ "description": "Role(s) the team creator is assigned atomically at creation. null or [] = owner-only (creator holds just Appwrite's intrinsic owner; no template role). Takes precedence over creatorRole.",
203
+ "oneOf": [
204
+ { "type": "string" },
205
+ { "type": "array", "items": { "type": "string" } },
206
+ { "type": "null" }
207
+ ]
208
+ }
201
209
  }
202
210
  }
203
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.144",
3
+ "version": "0.5.145",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",