@powerhousedao/service-offering 0.0.8 → 0.0.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/resources-services/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAuC5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/resources-services/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAuC5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAmexE,CAAC"}
|
|
@@ -172,6 +172,41 @@ export const getResolvers = (subgraph) => {
|
|
|
172
172
|
errors: ["Team name is required"],
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
+
// Validate name lengths
|
|
176
|
+
if (name.length > 64) {
|
|
177
|
+
return {
|
|
178
|
+
success: false,
|
|
179
|
+
data: null,
|
|
180
|
+
errors: ["Name must be 64 characters or less"],
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (teamName.length > 64) {
|
|
184
|
+
return {
|
|
185
|
+
success: false,
|
|
186
|
+
data: null,
|
|
187
|
+
errors: ["Team name must be 64 characters or less"],
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
// Validate names contain only allowed characters (letters, numbers, spaces, hyphens, underscores)
|
|
191
|
+
const validNamePattern = /^[a-zA-Z0-9 _-]+$/;
|
|
192
|
+
if (!validNamePattern.test(name)) {
|
|
193
|
+
return {
|
|
194
|
+
success: false,
|
|
195
|
+
data: null,
|
|
196
|
+
errors: [
|
|
197
|
+
"Name can only contain letters, numbers, spaces, hyphens, and underscores",
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (!validNamePattern.test(teamName)) {
|
|
202
|
+
return {
|
|
203
|
+
success: false,
|
|
204
|
+
data: null,
|
|
205
|
+
errors: [
|
|
206
|
+
"Team name can only contain letters, numbers, spaces, hyphens, and underscores",
|
|
207
|
+
],
|
|
208
|
+
};
|
|
209
|
+
}
|
|
175
210
|
// Fetch the service offering to get resourceTemplateId and finalConfiguration
|
|
176
211
|
const serviceOfferingDoc = await reactor.getDocument(serviceOfferingId);
|
|
177
212
|
if (!serviceOfferingDoc) {
|
|
@@ -198,8 +233,17 @@ export const getResolvers = (subgraph) => {
|
|
|
198
233
|
errors: ["Service offering has no final configuration"],
|
|
199
234
|
};
|
|
200
235
|
}
|
|
201
|
-
|
|
202
|
-
const
|
|
236
|
+
// Sanitize names for use as drive id/slug: lowercase, trim, collapse whitespace, replace spaces with hyphens
|
|
237
|
+
const parsedTeamName = teamName
|
|
238
|
+
.trim()
|
|
239
|
+
.toLowerCase()
|
|
240
|
+
.replace(/\s+/g, "-")
|
|
241
|
+
.replace(/_/g, "-");
|
|
242
|
+
const parsedName = name
|
|
243
|
+
.trim()
|
|
244
|
+
.toLowerCase()
|
|
245
|
+
.replace(/\s+/g, "-")
|
|
246
|
+
.replace(/_/g, "-");
|
|
203
247
|
try {
|
|
204
248
|
// create team-builder-admin drive
|
|
205
249
|
const teamBuilderAdminDrive = await reactor.addDrive({
|