@zlooks.cn/password-auth-server 1.0.3 → 1.0.4
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/.hile-rsc/{build-mtsn68qv-a841a566/client-browser/src-plugin-password-form-3bd63d69e5-G5UQAB5W.js → build-mtu1gn28-ec03cfb2/client-browser/src-plugin-password-form-3bd63d69e5-BCAMXKEX.js} +152 -19
- package/.hile-rsc/{build-mtsn68qv-a841a566/client-ssr/src-plugin-password-form-3bd63d69e5-UV3K6EC6.js → build-mtu1gn28-ec03cfb2/client-ssr/src-plugin-password-form-3bd63d69e5-KF6ZLTDT.js} +357 -224
- package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/plugin.json +6 -6
- package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/server-rsc/index.js +160 -27
- package/package.json +4 -4
- /package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/client-browser/chunks/chunk-CZF5VGOJ.js +0 -0
- /package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/client-browser/src-plugin-page-frame-07c4de56a6-3F24AYCH.css +0 -0
- /package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/client-browser/src-plugin-page-frame-07c4de56a6-C2WHPDGD.js +0 -0
- /package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/client-browser/src-plugin-password-form-3bd63d69e5-TRYMJX4F.css +0 -0
- /package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/client-ssr/chunks/chunk-RMKQVF3F.js +0 -0
- /package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/client-ssr/src-plugin-page-frame-07c4de56a6-ICZZGKBP.js +0 -0
- /package/.hile-rsc/{build-mtsn68qv-a841a566 → build-mtu1gn28-ec03cfb2}/styles/4b3193c4f2b317ffed425ccf401342a4bdd6ccfd5f9c42def3315e776f166975.css +0 -0
|
@@ -254,6 +254,12 @@ var eventType = external_exports.string().max(256).regex(/^[a-z][a-z0-9]*(?:\.[a
|
|
|
254
254
|
var serviceNamespace = external_exports.string().max(256).regex(/^[a-z][a-z0-9]*(?:\.[a-z][a-z0-9]*)+$/);
|
|
255
255
|
var aggregateType = external_exports.string().regex(/^[a-z][a-z0-9-]{0,63}$/);
|
|
256
256
|
var aggregateId = external_exports.string().trim().min(1).max(256);
|
|
257
|
+
var providerId = external_exports.string().max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/);
|
|
258
|
+
var contractPackage = external_exports.string().max(128).regex(/^@zlooks\.cn\/[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
259
|
+
var exportName = external_exports.string().max(128).regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/);
|
|
260
|
+
var title = external_exports.string().trim().min(1).max(120);
|
|
261
|
+
var description = external_exports.string().trim().min(1).max(1e3);
|
|
262
|
+
var jsonValueSchema = external_exports.json();
|
|
257
263
|
var eventEnvelopeSchema = external_exports.strictObject({
|
|
258
264
|
protocol: external_exports.literal("zlooks.event"),
|
|
259
265
|
protocolVersion: external_exports.literal(1),
|
|
@@ -265,42 +271,130 @@ var eventEnvelopeSchema = external_exports.strictObject({
|
|
|
265
271
|
id: aggregateId
|
|
266
272
|
}).readonly(),
|
|
267
273
|
occurredAt: external_exports.iso.datetime({ offset: true }),
|
|
268
|
-
data:
|
|
274
|
+
data: jsonValueSchema
|
|
269
275
|
}).readonly();
|
|
270
|
-
function
|
|
276
|
+
function parseDomainEvent(input) {
|
|
277
|
+
const envelope = eventEnvelopeSchema.parse(input);
|
|
278
|
+
return Object.freeze({
|
|
279
|
+
...envelope,
|
|
280
|
+
aggregate: Object.freeze({ ...envelope.aggregate })
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function defineEvent(type, dataSchema5, options) {
|
|
271
284
|
const parsedType = eventType.parse(type);
|
|
285
|
+
const producer = serviceNamespace.parse(options.producer);
|
|
286
|
+
const parsedAggregateType = aggregateType.parse(options.aggregateType);
|
|
287
|
+
const selectAggregateId = options.aggregateId;
|
|
288
|
+
if (typeof selectAggregateId !== "function")
|
|
289
|
+
throw new TypeError("Event aggregateId must be a function");
|
|
272
290
|
return Object.freeze({
|
|
273
291
|
type: parsedType,
|
|
292
|
+
producer,
|
|
293
|
+
aggregateType: parsedAggregateType,
|
|
294
|
+
dataSchema: dataSchema5,
|
|
274
295
|
parse(value) {
|
|
275
|
-
const envelope =
|
|
296
|
+
const envelope = parseDomainEvent(value);
|
|
276
297
|
if (envelope.type !== parsedType) {
|
|
277
298
|
throw new TypeError(`Expected event type ${parsedType}`);
|
|
278
299
|
}
|
|
300
|
+
if (envelope.producer !== producer) {
|
|
301
|
+
throw new TypeError(`Expected event producer ${producer}`);
|
|
302
|
+
}
|
|
303
|
+
const data = dataSchema5.parse(envelope.data);
|
|
304
|
+
jsonValueSchema.parse(data);
|
|
305
|
+
const expectedAggregateId = aggregateId.parse(selectAggregateId(data));
|
|
306
|
+
if (envelope.aggregate.type !== parsedAggregateType || envelope.aggregate.id !== expectedAggregateId) {
|
|
307
|
+
throw new TypeError(`${parsedType} aggregate does not identify its event data`);
|
|
308
|
+
}
|
|
279
309
|
return Object.freeze({
|
|
280
310
|
...envelope,
|
|
281
311
|
type: parsedType,
|
|
282
312
|
aggregate: Object.freeze({ ...envelope.aggregate }),
|
|
283
|
-
data
|
|
313
|
+
data
|
|
284
314
|
});
|
|
285
315
|
}
|
|
286
316
|
});
|
|
287
317
|
}
|
|
318
|
+
function defineEventCatalog(input) {
|
|
319
|
+
const parsedProviderId = providerId.parse(input.providerId);
|
|
320
|
+
const parsedDisplayName = title.parse(input.displayName);
|
|
321
|
+
const parsedContractPackage = contractPackage.parse(input.contractPackage);
|
|
322
|
+
if (input.events.length === 0 || input.events.length > 256) {
|
|
323
|
+
throw new TypeError("Event catalog must contain between 1 and 256 events");
|
|
324
|
+
}
|
|
325
|
+
const producer = input.events[0].definition.producer;
|
|
326
|
+
const eventTypes = /* @__PURE__ */ new Set();
|
|
327
|
+
const consumerExports = /* @__PURE__ */ new Set();
|
|
328
|
+
const events = input.events.map((entry) => {
|
|
329
|
+
if (entry.definition.producer !== producer) {
|
|
330
|
+
throw new TypeError("Event catalog definitions must have one producer");
|
|
331
|
+
}
|
|
332
|
+
if (eventTypes.has(entry.definition.type)) {
|
|
333
|
+
throw new TypeError("Event catalog event types must be unique");
|
|
334
|
+
}
|
|
335
|
+
const parsedConsumerExport = exportName.parse(entry.consumerExport);
|
|
336
|
+
if (consumerExports.has(parsedConsumerExport)) {
|
|
337
|
+
throw new TypeError("Event catalog Consumer exports must be unique");
|
|
338
|
+
}
|
|
339
|
+
eventTypes.add(entry.definition.type);
|
|
340
|
+
consumerExports.add(parsedConsumerExport);
|
|
341
|
+
const dataSchema5 = immutableJson(external_exports.toJSONSchema(entry.definition.dataSchema, {
|
|
342
|
+
target: "draft-2020-12",
|
|
343
|
+
unrepresentable: "any",
|
|
344
|
+
io: "input"
|
|
345
|
+
}));
|
|
346
|
+
if (!isJsonObject(dataSchema5))
|
|
347
|
+
throw new TypeError("Event data schema must serialize to a JSON object");
|
|
348
|
+
return Object.freeze({
|
|
349
|
+
type: entry.definition.type,
|
|
350
|
+
title: title.parse(entry.title),
|
|
351
|
+
description: description.parse(entry.description),
|
|
352
|
+
producer,
|
|
353
|
+
aggregateType: entry.definition.aggregateType,
|
|
354
|
+
consumer: Object.freeze({
|
|
355
|
+
packageName: parsedContractPackage,
|
|
356
|
+
exportName: parsedConsumerExport
|
|
357
|
+
}),
|
|
358
|
+
dataSchema: dataSchema5
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
return Object.freeze({
|
|
362
|
+
protocol: "zlooks.event-catalog",
|
|
363
|
+
protocolVersion: 1,
|
|
364
|
+
providerId: parsedProviderId,
|
|
365
|
+
displayName: parsedDisplayName,
|
|
366
|
+
producer,
|
|
367
|
+
contractPackage: parsedContractPackage,
|
|
368
|
+
count: events.length,
|
|
369
|
+
delivery: Object.freeze({ guarantee: "at-least-once", deduplicateBy: "eventId" }),
|
|
370
|
+
events: Object.freeze(events)
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function immutableJson(value) {
|
|
374
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
375
|
+
return value;
|
|
376
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
377
|
+
return value;
|
|
378
|
+
if (Array.isArray(value))
|
|
379
|
+
return Object.freeze(value.map(immutableJson));
|
|
380
|
+
if (isRecord(value)) {
|
|
381
|
+
return Object.freeze(Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0).map(([key, item]) => [key, immutableJson(item)])));
|
|
382
|
+
}
|
|
383
|
+
throw new TypeError("Event JSON Schema contains a non-JSON value");
|
|
384
|
+
}
|
|
385
|
+
function isJsonObject(value) {
|
|
386
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
387
|
+
}
|
|
388
|
+
function isRecord(value) {
|
|
389
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
390
|
+
}
|
|
288
391
|
|
|
289
392
|
// ../user-shared/dist/events/definition.js
|
|
290
393
|
function defineUserEvent(type, aggregateType2, dataSchema5, aggregateId2) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const event = base.parse(input);
|
|
296
|
-
if (event.producer !== USER_SERVICE_NAMESPACE) {
|
|
297
|
-
throw new TypeError(`Expected event producer ${USER_SERVICE_NAMESPACE}`);
|
|
298
|
-
}
|
|
299
|
-
if (event.aggregate.type !== aggregateType2 || event.aggregate.id !== aggregateId2(event.data)) {
|
|
300
|
-
throw new TypeError(`${type} aggregate does not identify its event data`);
|
|
301
|
-
}
|
|
302
|
-
return event;
|
|
303
|
-
}
|
|
394
|
+
return defineEvent(type, dataSchema5, {
|
|
395
|
+
producer: USER_SERVICE_NAMESPACE,
|
|
396
|
+
aggregateType: aggregateType2,
|
|
397
|
+
aggregateId: aggregateId2
|
|
304
398
|
});
|
|
305
399
|
}
|
|
306
400
|
|
|
@@ -385,6 +479,45 @@ var dataSchema4 = external_exports.strictObject({
|
|
|
385
479
|
}).readonly();
|
|
386
480
|
var userSessionRevokedEvent = defineUserEvent(USER_SESSION_REVOKED_EVENT_TYPE, "session-family", dataSchema4, (data) => data.sessionFamily.id);
|
|
387
481
|
|
|
482
|
+
// ../user-shared/dist/events/catalog.js
|
|
483
|
+
var USER_EVENT_CATALOG = defineEventCatalog({
|
|
484
|
+
providerId: "user",
|
|
485
|
+
displayName: "\u7528\u6237\u670D\u52A1\u4E8B\u4EF6",
|
|
486
|
+
contractPackage: "@zlooks.cn/user-shared",
|
|
487
|
+
events: [
|
|
488
|
+
{
|
|
489
|
+
definition: userRegisteredEvent,
|
|
490
|
+
title: "\u7528\u6237\u5DF2\u6CE8\u518C",
|
|
491
|
+
description: "\u7528\u6237\u8D26\u6237\u5DF2\u7ECF\u5B8C\u6210\u6301\u4E45\u5316\u521B\u5EFA\u5E76\u5904\u4E8E\u53EF\u7528\u72B6\u6001\u3002",
|
|
492
|
+
consumerExport: "consumeUserRegisteredEvent"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
definition: userEmailVerifiedEvent,
|
|
496
|
+
title: "\u7528\u6237\u90AE\u7BB1\u5DF2\u9A8C\u8BC1",
|
|
497
|
+
description: "\u7528\u6237\u90AE\u7BB1\u4ECE\u672A\u9A8C\u8BC1\u72B6\u6001\u771F\u5B9E\u8F6C\u6362\u4E3A\u5DF2\u9A8C\u8BC1\u72B6\u6001\u3002",
|
|
498
|
+
consumerExport: "consumeUserEmailVerifiedEvent"
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
definition: userProfileUpdatedEvent,
|
|
502
|
+
title: "\u7528\u6237\u8D44\u6599\u5DF2\u66F4\u65B0",
|
|
503
|
+
description: "\u7528\u6237\u516C\u5F00\u8D44\u6599\u5B57\u6BB5\u53D1\u751F\u771F\u5B9E\u53D8\u5316\u5E76\u643A\u5E26\u53D8\u66F4\u540E\u7684\u5B8C\u6574\u5B89\u5168\u5FEB\u7167\u3002",
|
|
504
|
+
consumerExport: "consumeUserProfileUpdatedEvent"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
definition: userSessionCreatedEvent,
|
|
508
|
+
title: "\u7528\u6237\u4F1A\u8BDD\u65CF\u5DF2\u521B\u5EFA",
|
|
509
|
+
description: "\u767B\u5F55\u3001\u6CE8\u518C\u6216\u6062\u590D\u6D41\u7A0B\u5DF2\u7ECF\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u6D3B\u52A8\u4F1A\u8BDD\u65CF\u3002",
|
|
510
|
+
consumerExport: "consumeUserSessionCreatedEvent"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
definition: userSessionRevokedEvent,
|
|
514
|
+
title: "\u7528\u6237\u4F1A\u8BDD\u65CF\u5DF2\u64A4\u9500",
|
|
515
|
+
description: "\u7528\u6237\u4F1A\u8BDD\u65CF\u4ECE\u6D3B\u52A8\u72B6\u6001\u771F\u5B9E\u8F6C\u6362\u4E3A\u5DF2\u64A4\u9500\u72B6\u6001\u3002",
|
|
516
|
+
consumerExport: "consumeUserSessionRevokedEvent"
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
});
|
|
520
|
+
|
|
388
521
|
// ../user-shared/dist/index.js
|
|
389
522
|
var USER_BROWSER_API_PUBLIC_ROUTES = Object.freeze([
|
|
390
523
|
Object.freeze({
|
|
@@ -1191,7 +1324,7 @@ var InternalSegmentedOption = ({
|
|
|
1191
1324
|
disabled,
|
|
1192
1325
|
checked,
|
|
1193
1326
|
label,
|
|
1194
|
-
title,
|
|
1327
|
+
title: title2,
|
|
1195
1328
|
value,
|
|
1196
1329
|
name,
|
|
1197
1330
|
onChange,
|
|
@@ -1227,7 +1360,7 @@ var InternalSegmentedOption = ({
|
|
|
1227
1360
|
onKeyUp
|
|
1228
1361
|
}), /* @__PURE__ */ createElement("div", {
|
|
1229
1362
|
className: clsx(`${prefixCls}-item-label`, segmentedClassNames?.label),
|
|
1230
|
-
title,
|
|
1363
|
+
title: title2,
|
|
1231
1364
|
style: styles?.label
|
|
1232
1365
|
}, label));
|
|
1233
1366
|
return itemRender(itemContent, {
|