@headless-lms/core 0.1.0 → 0.3.0
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/assets/events.d.ts +90 -9
- package/dist/assets/events.js +19 -3
- package/dist/assets/events.js.map +1 -1
- package/dist/assets/file-urls.d.ts +20 -0
- package/dist/assets/file-urls.js +25 -0
- package/dist/assets/file-urls.js.map +1 -0
- package/dist/assets/index.d.ts +5 -4
- package/dist/assets/index.js +3 -2
- package/dist/assets/model.d.ts +2 -2
- package/dist/assets/ports.d.ts +45 -15
- package/dist/assets/service.d.ts +39 -7
- package/dist/assets/service.js +292 -37
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.d.ts +12 -15
- package/dist/automations/actions.js +188 -30
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.d.ts +5 -1
- package/dist/automations/catalog.js +514 -197
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/community-derivations.d.ts +14 -0
- package/dist/automations/community-derivations.js +439 -0
- package/dist/automations/community-derivations.js.map +1 -0
- package/dist/automations/community-mail.d.ts +112 -0
- package/dist/automations/community-mail.js +90 -0
- package/dist/automations/community-mail.js.map +1 -0
- package/dist/automations/community-notifications.d.ts +16 -0
- package/dist/automations/community-notifications.js +84 -0
- package/dist/automations/community-notifications.js.map +1 -0
- package/dist/automations/events.d.ts +74 -24
- package/dist/automations/events.js +5 -5
- package/dist/automations/events.js.map +1 -1
- package/dist/automations/index.d.ts +7 -5
- package/dist/automations/index.js +3 -2
- package/dist/automations/model.d.ts +20 -3
- package/dist/automations/model.js +36 -3
- package/dist/automations/model.js.map +1 -1
- package/dist/automations/ports.d.ts +27 -8
- package/dist/automations/schedule.d.ts +6 -0
- package/dist/automations/schedule.js +41 -0
- package/dist/automations/schedule.js.map +1 -0
- package/dist/automations/seeds.d.ts +17 -0
- package/dist/automations/seeds.js +235 -0
- package/dist/automations/seeds.js.map +1 -0
- package/dist/automations/service.d.ts +41 -6
- package/dist/automations/service.js +542 -59
- package/dist/automations/service.js.map +1 -1
- package/dist/automations/types.d.ts +2 -2
- package/dist/automations/webhook-signing.d.ts +7 -0
- package/dist/automations/webhook-signing.js +22 -0
- package/dist/automations/webhook-signing.js.map +1 -0
- package/dist/content/events.d.ts +1013 -25
- package/dist/content/events.js +168 -19
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +5 -5
- package/dist/content/index.js +2 -2
- package/dist/content/model.d.ts +2 -2
- package/dist/content/ports.d.ts +109 -25
- package/dist/content/service.d.ts +68 -23
- package/dist/content/service.js +647 -60
- package/dist/content/service.js.map +1 -1
- package/dist/content/types.d.ts +2 -2
- package/dist/discussion/authors.d.ts +10 -0
- package/dist/discussion/authors.js +23 -0
- package/dist/discussion/authors.js.map +1 -0
- package/dist/discussion/chats.d.ts +104 -0
- package/dist/discussion/chats.js +798 -0
- package/dist/discussion/chats.js.map +1 -0
- package/dist/discussion/events.d.ts +633 -14
- package/dist/discussion/events.js +134 -5
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/index.d.ts +7 -3
- package/dist/discussion/index.js +4 -1
- package/dist/discussion/model.d.ts +1 -2
- package/dist/discussion/ports.d.ts +288 -27
- package/dist/discussion/ports.js +6 -1
- package/dist/discussion/ports.js.map +1 -0
- package/dist/discussion/posts.d.ts +103 -0
- package/dist/discussion/posts.js +723 -0
- package/dist/discussion/posts.js.map +1 -0
- package/dist/discussion/service.d.ts +33 -11
- package/dist/discussion/service.js +297 -81
- package/dist/discussion/service.js.map +1 -1
- package/dist/entitlements/events.d.ts +264 -13
- package/dist/entitlements/events.js +49 -5
- package/dist/entitlements/events.js.map +1 -1
- package/dist/entitlements/index.d.ts +5 -4
- package/dist/entitlements/index.js +2 -1
- package/dist/entitlements/model.d.ts +3 -2
- package/dist/entitlements/ports.d.ts +124 -11
- package/dist/entitlements/rules.d.ts +12 -0
- package/dist/entitlements/rules.js +17 -0
- package/dist/entitlements/rules.js.map +1 -0
- package/dist/entitlements/service.d.ts +54 -3
- package/dist/entitlements/service.js +473 -2
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/access.d.ts +6 -0
- package/dist/identity/access.js +7 -0
- package/dist/identity/access.js.map +1 -0
- package/dist/identity/events.d.ts +17 -3
- package/dist/identity/events.js +12 -2
- package/dist/identity/events.js.map +1 -1
- package/dist/identity/index.d.ts +6 -4
- package/dist/identity/index.js +3 -1
- package/dist/identity/model.d.ts +2 -1
- package/dist/identity/notifications.d.ts +27 -0
- package/dist/identity/notifications.js +101 -0
- package/dist/identity/notifications.js.map +1 -0
- package/dist/identity/ports.d.ts +76 -3
- package/dist/identity/service.d.ts +17 -3
- package/dist/identity/service.js +73 -5
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/events.d.ts +27 -3
- package/dist/integrations/events.js +15 -3
- package/dist/integrations/events.js.map +1 -1
- package/dist/integrations/model.js +1 -1
- package/dist/integrations/model.js.map +1 -1
- package/dist/integrations/service.js +2 -2
- package/dist/integrations/service.js.map +1 -1
- package/dist/organizations/access-scopes.d.ts +19 -0
- package/dist/organizations/access-scopes.js +89 -0
- package/dist/organizations/access-scopes.js.map +1 -0
- package/dist/organizations/events.d.ts +234 -25
- package/dist/organizations/events.js +58 -9
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +8 -7
- package/dist/organizations/index.js +4 -3
- package/dist/organizations/members.d.ts +8 -5
- package/dist/organizations/members.js.map +1 -1
- package/dist/organizations/ports.d.ts +20 -21
- package/dist/organizations/roles.d.ts +6 -10
- package/dist/organizations/roles.js +19 -7
- package/dist/organizations/roles.js.map +1 -1
- package/dist/organizations/service.d.ts +28 -14
- package/dist/organizations/service.js +274 -105
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/types.d.ts +2 -11
- package/dist/progress/events.d.ts +34 -2
- package/dist/progress/events.js +15 -2
- package/dist/progress/events.js.map +1 -1
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/ports.d.ts +6 -1
- package/dist/progress/service.d.ts +5 -3
- package/dist/progress/service.js +9 -3
- package/dist/progress/service.js.map +1 -1
- package/dist/reporting/admin/index.d.ts +4 -0
- package/dist/reporting/admin/index.js +2 -0
- package/dist/reporting/admin/model.d.ts +108 -0
- package/dist/reporting/admin/ports.d.ts +27 -0
- package/dist/reporting/admin/service.d.ts +22 -0
- package/dist/reporting/admin/service.js +38 -0
- package/dist/reporting/admin/service.js.map +1 -0
- package/dist/reporting/member/index.d.ts +5 -0
- package/dist/reporting/member/index.js +2 -0
- package/dist/reporting/member/model.d.ts +124 -0
- package/dist/reporting/member/ports.d.ts +45 -0
- package/dist/reporting/member/service.d.ts +73 -0
- package/dist/reporting/member/service.js +286 -0
- package/dist/reporting/member/service.js.map +1 -0
- package/dist/shared/actor.d.ts +9 -0
- package/dist/shared/errors.d.ts +7 -1
- package/dist/shared/errors.js +10 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/events.d.ts +5 -3
- package/dist/shared/events.js +1 -0
- package/dist/shared/events.js.map +1 -1
- package/dist/shared/id.d.ts +12 -0
- package/dist/shared/id.js +13 -1
- package/dist/shared/id.js.map +1 -1
- package/dist/shared/mailer.d.ts +6 -1
- package/dist/shared/mailer.js.map +1 -1
- package/dist/shared/network.d.ts +10 -0
- package/dist/shared/network.js +211 -0
- package/dist/shared/network.js.map +1 -0
- package/dist/shared/settings.js.map +1 -1
- package/dist/types/assets.d.ts +2 -2
- package/dist/types/automations.d.ts +21 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +12 -3
- package/dist/types/email-templates.d.ts +124 -1
- package/dist/types/entitlements.d.ts +2 -2
- package/dist/types/events.d.ts +3 -3
- package/dist/types/identity.d.ts +48 -2
- package/dist/types/index.d.ts +10 -10
- package/dist/types/organizations.d.ts +2 -2
- package/dist/types/ports.d.ts +7 -1
- package/dist/types/schemas/assets.d.ts +67 -36
- package/dist/types/schemas/assets.js +19 -13
- package/dist/types/schemas/assets.js.map +1 -1
- package/dist/types/schemas/automations.d.ts +88 -4
- package/dist/types/schemas/automations.js +46 -6
- package/dist/types/schemas/automations.js.map +1 -1
- package/dist/types/schemas/content.d.ts +385 -20
- package/dist/types/schemas/content.js +178 -15
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/credentials.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +379 -4
- package/dist/types/schemas/discussion.js +209 -7
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +44 -4
- package/dist/types/schemas/entitlements.js +32 -4
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/identity.d.ts +115 -5
- package/dist/types/schemas/identity.js +59 -6
- package/dist/types/schemas/identity.js.map +1 -1
- package/dist/types/schemas/index.d.ts +9 -9
- package/dist/types/schemas/index.js +9 -9
- package/dist/types/schemas/integrations.js.map +1 -1
- package/dist/types/schemas/organizations.d.ts +27 -5
- package/dist/types/schemas/organizations.js +14 -7
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/outbox.d.ts +1 -0
- package/dist/types/schemas/outbox.js +1 -0
- package/dist/types/schemas/outbox.js.map +1 -1
- package/dist/types/schemas/progress.d.ts +1 -0
- package/dist/types/schemas/progress.js +1 -0
- package/dist/types/schemas/progress.js.map +1 -1
- package/dist/types/schemas/settings.js.map +1 -1
- package/dist/types/schemas/shared.d.ts +4 -1
- package/dist/types/schemas/shared.js +7 -1
- package/dist/types/schemas/shared.js.map +1 -1
- package/dist/types/shared.d.ts +1 -1
- package/package.json +2 -2
- package/dist/reporting/dashboard/index.d.ts +0 -4
- package/dist/reporting/dashboard/index.js +0 -2
- package/dist/reporting/dashboard/model.d.ts +0 -14
- package/dist/reporting/dashboard/ports.d.ts +0 -13
- package/dist/reporting/dashboard/service.d.ts +0 -19
- package/dist/reporting/dashboard/service.js +0 -20
- package/dist/reporting/dashboard/service.js.map +0 -1
- package/dist/reporting/learn/index.d.ts +0 -5
- package/dist/reporting/learn/index.js +0 -2
- package/dist/reporting/learn/model.d.ts +0 -23
- package/dist/reporting/learn/ports.d.ts +0 -42
- package/dist/reporting/learn/service.d.ts +0 -48
- package/dist/reporting/learn/service.js +0 -111
- package/dist/reporting/learn/service.js.map +0 -1
- package/dist/reporting/students/index.d.ts +0 -4
- package/dist/reporting/students/index.js +0 -2
- package/dist/reporting/students/model.d.ts +0 -31
- package/dist/reporting/students/ports.d.ts +0 -13
- package/dist/reporting/students/ports.js +0 -1
- package/dist/reporting/students/service.d.ts +0 -19
- package/dist/reporting/students/service.js +0 -20
- package/dist/reporting/students/service.js.map +0 -1
- /package/dist/reporting/{dashboard → admin}/model.js +0 -0
- /package/dist/reporting/{dashboard → admin}/ports.js +0 -0
- /package/dist/reporting/{learn → member}/model.js +0 -0
- /package/dist/reporting/{learn → member}/ports.js +0 -0
- /package/dist/{reporting/students/model.js → shared/actor.js} +0 -0
package/dist/shared/events.d.ts
CHANGED
|
@@ -14,18 +14,20 @@ type VersionedDomainEvent<TData = unknown, TType extends string = string, TVersi
|
|
|
14
14
|
readonly occurredAt: string;
|
|
15
15
|
readonly data: TData;
|
|
16
16
|
};
|
|
17
|
-
interface RuntimeEventDefinition<E extends VersionedDomainEvent, TMakeData = E['data']> extends EventDefinition<E, TMakeData> {
|
|
17
|
+
interface RuntimeEventDefinition<E extends VersionedDomainEvent, TMakeData = E['data'], TPublicSchema extends z.ZodType | undefined = z.ZodType | undefined> extends EventDefinition<E, TMakeData> {
|
|
18
18
|
readonly dataSchema: z.ZodType;
|
|
19
19
|
readonly eventSchema: z.ZodType<E>;
|
|
20
|
+
readonly publicData: TPublicSchema;
|
|
20
21
|
}
|
|
21
22
|
type EventOf<TDefinition extends EventDefinition<DomainEvent, unknown>> = TDefinition extends EventDefinition<infer E, unknown> ? E : never;
|
|
22
23
|
type EventOfValues<TDefinitions extends Record<string, EventDefinition<DomainEvent, unknown>>> = EventOf<TDefinitions[keyof TDefinitions]>;
|
|
23
|
-
interface DefineEventInput<TType extends string, TVersion extends number, TDataSchema extends z.ZodType> {
|
|
24
|
+
interface DefineEventInput<TType extends string, TVersion extends number, TDataSchema extends z.ZodType, TPublicSchema extends z.ZodType | undefined = undefined> {
|
|
24
25
|
readonly type: TType;
|
|
25
26
|
readonly version: TVersion;
|
|
26
27
|
readonly data: TDataSchema;
|
|
28
|
+
readonly publicData?: TPublicSchema;
|
|
27
29
|
}
|
|
28
|
-
declare function defineEvent<const TType extends string, const TVersion extends number, TDataSchema extends z.ZodType>(input: DefineEventInput<TType, TVersion, TDataSchema>): RuntimeEventDefinition<VersionedDomainEvent<z.output<TDataSchema>, TType, TVersion>, z.input<TDataSchema
|
|
30
|
+
declare function defineEvent<const TType extends string, const TVersion extends number, TDataSchema extends z.ZodType, TPublicSchema extends z.ZodType | undefined = undefined>(input: DefineEventInput<TType, TVersion, TDataSchema, TPublicSchema>): RuntimeEventDefinition<VersionedDomainEvent<z.output<TDataSchema>, TType, TVersion>, z.input<TDataSchema>, TPublicSchema>;
|
|
29
31
|
//#endregion
|
|
30
32
|
export { DefineEventInput, type EventDefinition, EventOf, EventOfValues, type EventParseResult, InvalidDomainEventError, type MakeEventInput, RuntimeEventDefinition, VersionedDomainEvent, defineEvent, eventIdSchema, eventJsonValueSchema, eventMetadataSchema };
|
|
31
33
|
//# sourceMappingURL=events.d.ts.map
|
package/dist/shared/events.js
CHANGED
|
@@ -36,6 +36,7 @@ function defineEvent(input) {
|
|
|
36
36
|
version: input.version,
|
|
37
37
|
dataSchema: input.data,
|
|
38
38
|
eventSchema,
|
|
39
|
+
publicData: input.publicData,
|
|
39
40
|
make(value) {
|
|
40
41
|
const result = makeInputSchema.safeParse(value);
|
|
41
42
|
if (!result.success) throw invalidEvent(input.type, result.error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":[],"sources":["../../src/shared/events.ts"],"sourcesContent":["import { z } from 'zod';\nimport type {\n ContractNewDomainEvent,\n DomainEvent,\n EventDefinition,\n EventMetadata,\n EventParseResult,\n JsonValue,\n MakeEventInput,\n} from '../types/index.js';\n\nexport class InvalidDomainEventError extends Error {\n constructor(type: string, detail: string) {\n super(`invalid ${type} event: ${detail}`);\n this.name = 'InvalidDomainEventError';\n }\n}\n\nexport const eventIdSchema: z.ZodString = z.string().trim().min(1);\n\nexport const eventJsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([\n z.null(),\n z.string(),\n z.number().finite(),\n z.boolean(),\n z.array(eventJsonValueSchema),\n z.record(z.string(), eventJsonValueSchema),\n ]),\n);\n\nexport const eventMetadataSchema: z.ZodType<EventMetadata> = z.record(\n z.string(),\n eventJsonValueSchema,\n);\n\nexport type VersionedDomainEvent<\n TData = unknown,\n TType extends string = string,\n TVersion extends number = number,\n> = DomainEvent<TData, TType, TVersion> & {\n readonly version: TVersion;\n readonly occurredAt: string;\n readonly data: TData;\n};\n\nexport interface RuntimeEventDefinition<\n E extends VersionedDomainEvent,\n TMakeData = E['data'],\n> extends EventDefinition<E, TMakeData> {\n readonly dataSchema: z.ZodType;\n readonly eventSchema: z.ZodType<E>;\n}\n\nexport type EventOf<TDefinition extends EventDefinition<DomainEvent, unknown>> =\n TDefinition extends EventDefinition<infer E, unknown> ? E : never;\n\nexport type EventOfValues
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../src/shared/events.ts"],"sourcesContent":["import { z } from 'zod';\nimport type {\n ContractNewDomainEvent,\n DomainEvent,\n EventDefinition,\n EventMetadata,\n EventParseResult,\n JsonValue,\n MakeEventInput,\n} from '../types/index.js';\n\nexport class InvalidDomainEventError extends Error {\n constructor(type: string, detail: string) {\n super(`invalid ${type} event: ${detail}`);\n this.name = 'InvalidDomainEventError';\n }\n}\n\nexport const eventIdSchema: z.ZodString = z.string().trim().min(1);\n\nexport const eventJsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([\n z.null(),\n z.string(),\n z.number().finite(),\n z.boolean(),\n z.array(eventJsonValueSchema),\n z.record(z.string(), eventJsonValueSchema),\n ]),\n);\n\nexport const eventMetadataSchema: z.ZodType<EventMetadata> = z.record(\n z.string(),\n eventJsonValueSchema,\n);\n\nexport type VersionedDomainEvent<\n TData = unknown,\n TType extends string = string,\n TVersion extends number = number,\n> = DomainEvent<TData, TType, TVersion> & {\n readonly version: TVersion;\n readonly occurredAt: string;\n readonly data: TData;\n};\n\nexport interface RuntimeEventDefinition<\n E extends VersionedDomainEvent,\n TMakeData = E['data'],\n TPublicSchema extends z.ZodType | undefined = z.ZodType | undefined,\n> extends EventDefinition<E, TMakeData> {\n readonly dataSchema: z.ZodType;\n readonly eventSchema: z.ZodType<E>;\n readonly publicData: TPublicSchema;\n}\n\nexport type EventOf<TDefinition extends EventDefinition<DomainEvent, unknown>> =\n TDefinition extends EventDefinition<infer E, unknown> ? E : never;\n\nexport type EventOfValues<\n TDefinitions extends Record<string, EventDefinition<DomainEvent, unknown>>,\n> = EventOf<TDefinitions[keyof TDefinitions]>;\n\nexport interface DefineEventInput<\n TType extends string,\n TVersion extends number,\n TDataSchema extends z.ZodType,\n TPublicSchema extends z.ZodType | undefined = undefined,\n> {\n readonly type: TType;\n readonly version: TVersion;\n readonly data: TDataSchema;\n readonly publicData?: TPublicSchema;\n}\n\nexport function defineEvent<\n const TType extends string,\n const TVersion extends number,\n TDataSchema extends z.ZodType,\n TPublicSchema extends z.ZodType | undefined = undefined,\n>(\n input: DefineEventInput<TType, TVersion, TDataSchema, TPublicSchema>,\n): RuntimeEventDefinition<\n VersionedDomainEvent<z.output<TDataSchema>, TType, TVersion>,\n z.input<TDataSchema>,\n TPublicSchema\n> {\n type Event = VersionedDomainEvent<z.output<TDataSchema>, TType, TVersion>;\n const makeInputSchema = z\n .object({\n orgId: eventIdSchema,\n data: input.data,\n metadata: eventMetadataSchema.optional(),\n })\n .strict();\n const eventSchema = z\n .object({\n type: z.literal(input.type),\n version: z.literal(input.version),\n id: eventIdSchema,\n orgId: eventIdSchema,\n occurredAt: z.string().trim().min(1),\n data: input.data,\n metadata: eventMetadataSchema.optional(),\n })\n .strict();\n\n return {\n type: input.type,\n version: input.version,\n dataSchema: input.data,\n eventSchema: eventSchema as unknown as z.ZodType<Event>,\n publicData: input.publicData as TPublicSchema,\n make(value: MakeEventInput<z.input<TDataSchema>>) {\n const result = makeInputSchema.safeParse(value);\n if (!result.success) {\n throw invalidEvent(input.type, result.error);\n }\n return {\n type: input.type,\n version: input.version,\n ...result.data,\n } as ContractNewDomainEvent<Event>;\n },\n is(event: unknown): event is Event {\n return eventSchema.safeParse(event).success;\n },\n parse(event: unknown) {\n const result = eventSchema.safeParse(event);\n if (!result.success) {\n throw invalidEvent(input.type, result.error);\n }\n return result.data as Event;\n },\n safeParse(event: unknown): EventParseResult<Event> {\n const result = eventSchema.safeParse(event);\n if (!result.success) {\n return { success: false, error: invalidEvent(input.type, result.error) };\n }\n return { success: true, data: result.data as Event };\n },\n };\n}\n\nfunction invalidEvent(type: string, error: z.ZodError): InvalidDomainEventError {\n return new InvalidDomainEventError(\n type,\n error.issues.map((issue) => `${issue.path.join('.') || 'event'}: ${issue.message}`).join('; '),\n );\n}\n\nexport type { EventDefinition, EventParseResult, MakeEventInput };\n"],"mappings":";;AAWA,IAAa,0BAAb,cAA6C,MAAM;CACjD,YAAY,MAAc,QAAgB;EACxC,MAAM,WAAW,KAAK,UAAU,QAAQ;EACxC,KAAK,OAAO;CACd;AACF;AAEA,MAAa,gBAA6B,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AAEjE,MAAa,uBAA6C,EAAE,WAC1D,EAAE,MAAM;CACN,EAAE,KAAK;CACP,EAAE,OAAO;CACT,EAAE,OAAO,CAAC,CAAC,OAAO;CAClB,EAAE,QAAQ;CACV,EAAE,MAAM,oBAAoB;CAC5B,EAAE,OAAO,EAAE,OAAO,GAAG,oBAAoB;AAC3C,CAAC,CACH;AAEA,MAAa,sBAAgD,EAAE,OAC7D,EAAE,OAAO,GACT,oBACF;AAyCA,SAAgB,YAMd,OAKA;CAEA,MAAM,kBAAkB,EACrB,OAAO;EACN,OAAO;EACP,MAAM,MAAM;EACZ,UAAU,oBAAoB,SAAS;CACzC,CAAC,CAAC,CACD,OAAO;CACV,MAAM,cAAc,EACjB,OAAO;EACN,MAAM,EAAE,QAAQ,MAAM,IAAI;EAC1B,SAAS,EAAE,QAAQ,MAAM,OAAO;EAChC,IAAI;EACJ,OAAO;EACP,YAAY,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;EACnC,MAAM,MAAM;EACZ,UAAU,oBAAoB,SAAS;CACzC,CAAC,CAAC,CACD,OAAO;CAEV,OAAO;EACL,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,YAAY,MAAM;EACL;EACb,YAAY,MAAM;EAClB,KAAK,OAA6C;GAChD,MAAM,SAAS,gBAAgB,UAAU,KAAK;GAC9C,IAAI,CAAC,OAAO,SACV,MAAM,aAAa,MAAM,MAAM,OAAO,KAAK;GAE7C,OAAO;IACL,MAAM,MAAM;IACZ,SAAS,MAAM;IACf,GAAG,OAAO;GACZ;EACF;EACA,GAAG,OAAgC;GACjC,OAAO,YAAY,UAAU,KAAK,CAAC,CAAC;EACtC;EACA,MAAM,OAAgB;GACpB,MAAM,SAAS,YAAY,UAAU,KAAK;GAC1C,IAAI,CAAC,OAAO,SACV,MAAM,aAAa,MAAM,MAAM,OAAO,KAAK;GAE7C,OAAO,OAAO;EAChB;EACA,UAAU,OAAyC;GACjD,MAAM,SAAS,YAAY,UAAU,KAAK;GAC1C,IAAI,CAAC,OAAO,SACV,OAAO;IAAE,SAAS;IAAO,OAAO,aAAa,MAAM,MAAM,OAAO,KAAK;GAAE;GAEzE,OAAO;IAAE,SAAS;IAAM,MAAM,OAAO;GAAc;EACrD;CACF;AACF;AAEA,SAAS,aAAa,MAAc,OAA4C;CAC9E,OAAO,IAAI,wBACT,MACA,MAAM,OAAO,KAAK,UAAU,GAAG,MAAM,KAAK,KAAK,GAAG,KAAK,QAAQ,IAAI,MAAM,SAAS,CAAC,CAAC,KAAK,IAAI,CAC/F;AACF"}
|
package/dist/shared/id.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare const ID_PREFIXES: {
|
|
|
13
13
|
readonly student: "stu";
|
|
14
14
|
readonly orgUser: "orm";
|
|
15
15
|
readonly invite: "ivt";
|
|
16
|
+
readonly bundle: "bun";
|
|
16
17
|
readonly course: "crs";
|
|
17
18
|
readonly module: "mod";
|
|
18
19
|
readonly activity: "act";
|
|
@@ -29,6 +30,17 @@ declare const ID_PREFIXES: {
|
|
|
29
30
|
readonly automationRun: "run";
|
|
30
31
|
readonly comment: "cmt";
|
|
31
32
|
readonly commentReport: "crp";
|
|
33
|
+
readonly community: "cmy";
|
|
34
|
+
readonly space: "spc";
|
|
35
|
+
readonly topic: "top";
|
|
36
|
+
readonly spaceLink: "slk";
|
|
37
|
+
readonly spaceMember: "spm";
|
|
38
|
+
readonly post: "pst";
|
|
39
|
+
readonly postFlag: "pfl";
|
|
40
|
+
readonly chat: "cht";
|
|
41
|
+
readonly message: "msg";
|
|
42
|
+
readonly messageFlag: "mfl";
|
|
43
|
+
readonly notification: "ntf";
|
|
32
44
|
};
|
|
33
45
|
type IdType = keyof typeof ID_PREFIXES;
|
|
34
46
|
/** A bare KSUID body (27-char base62, time-sortable), no prefix. */
|
package/dist/shared/id.js
CHANGED
|
@@ -14,6 +14,7 @@ const ID_PREFIXES = {
|
|
|
14
14
|
student: "stu",
|
|
15
15
|
orgUser: "orm",
|
|
16
16
|
invite: "ivt",
|
|
17
|
+
bundle: "bun",
|
|
17
18
|
course: "crs",
|
|
18
19
|
module: "mod",
|
|
19
20
|
activity: "act",
|
|
@@ -29,7 +30,18 @@ const ID_PREFIXES = {
|
|
|
29
30
|
automation: "atm",
|
|
30
31
|
automationRun: "run",
|
|
31
32
|
comment: "cmt",
|
|
32
|
-
commentReport: "crp"
|
|
33
|
+
commentReport: "crp",
|
|
34
|
+
community: "cmy",
|
|
35
|
+
space: "spc",
|
|
36
|
+
topic: "top",
|
|
37
|
+
spaceLink: "slk",
|
|
38
|
+
spaceMember: "spm",
|
|
39
|
+
post: "pst",
|
|
40
|
+
postFlag: "pfl",
|
|
41
|
+
chat: "cht",
|
|
42
|
+
message: "msg",
|
|
43
|
+
messageFlag: "mfl",
|
|
44
|
+
notification: "ntf"
|
|
33
45
|
};
|
|
34
46
|
/** A bare KSUID body (27-char base62, time-sortable), no prefix. */
|
|
35
47
|
function ksuid() {
|
package/dist/shared/id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","names":[],"sources":["../../src/shared/id.ts"],"sourcesContent":["import KSUID from 'ksuid';\n\n/**\n * Prefixed, KSUID-bodied string ids — `${prefix}_${ksuid}`, e.g. `org_2QZ4mK...`.\n *\n * The body is a real KSUID (27-char base62, 4-byte timestamp + 16 random bytes),\n * so ids are lexicographically time-sortable. The prefix marks the entity type at\n * a glance. A core utility (one implementation, nothing to swap), called directly\n * by core services and used as the Drizzle `.$defaultFn` for every domain id column.\n */\nexport const ID_PREFIXES = {\n organization: 'org',\n user: 'usr',\n student: 'stu',\n orgUser: 'orm',\n invite: 'ivt',\n course: 'crs',\n module: 'mod',\n activity: 'act',\n activityAsset: 'aca',\n download: 'dwn',\n downloadAsset: 'dla',\n asset: 'ast',\n entitlement: 'ent',\n progress: 'prg',\n credential: 'crd',\n connection: 'con',\n event: 'evt',\n automation: 'atm',\n automationRun: 'run',\n comment: 'cmt',\n commentReport: 'crp',\n} as const;\n\nexport type IdType = keyof typeof ID_PREFIXES;\n\n/** A bare KSUID body (27-char base62, time-sortable), no prefix. */\nexport function ksuid(): string {\n return KSUID.randomSync().string;\n}\n\n/** Attach an arbitrary prefix to a fresh KSUID — `${prefix}_${ksuid}`. */\nexport function prefixId(prefix: string): string {\n return `${prefix}_${ksuid()}`;\n}\n\n/** Generate a prefixed, time-sortable id for the given domain entity type. */\nexport function genId(type: IdType): string {\n return prefixId(ID_PREFIXES[type]);\n}\n\n/** True when `value` carries the prefix for `type` (shape check only, not existence). */\nexport function isId(type: IdType, value: string): boolean {\n return value.startsWith(`${ID_PREFIXES[type]}_`);\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,cAAc;CACzB,cAAc;CACd,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,eAAe;CACf,UAAU;CACV,eAAe;CACf,OAAO;CACP,aAAa;CACb,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,OAAO;CACP,YAAY;CACZ,eAAe;CACf,SAAS;CACT,eAAe;
|
|
1
|
+
{"version":3,"file":"id.js","names":[],"sources":["../../src/shared/id.ts"],"sourcesContent":["import KSUID from 'ksuid';\n\n/**\n * Prefixed, KSUID-bodied string ids — `${prefix}_${ksuid}`, e.g. `org_2QZ4mK...`.\n *\n * The body is a real KSUID (27-char base62, 4-byte timestamp + 16 random bytes),\n * so ids are lexicographically time-sortable. The prefix marks the entity type at\n * a glance. A core utility (one implementation, nothing to swap), called directly\n * by core services and used as the Drizzle `.$defaultFn` for every domain id column.\n */\nexport const ID_PREFIXES = {\n organization: 'org',\n user: 'usr',\n student: 'stu',\n orgUser: 'orm',\n invite: 'ivt',\n bundle: 'bun',\n course: 'crs',\n module: 'mod',\n activity: 'act',\n activityAsset: 'aca',\n download: 'dwn',\n downloadAsset: 'dla',\n asset: 'ast',\n entitlement: 'ent',\n progress: 'prg',\n credential: 'crd',\n connection: 'con',\n event: 'evt',\n automation: 'atm',\n automationRun: 'run',\n comment: 'cmt',\n commentReport: 'crp',\n community: 'cmy',\n space: 'spc',\n topic: 'top',\n spaceLink: 'slk',\n spaceMember: 'spm',\n post: 'pst',\n postFlag: 'pfl',\n chat: 'cht',\n message: 'msg',\n messageFlag: 'mfl',\n notification: 'ntf',\n} as const;\n\nexport type IdType = keyof typeof ID_PREFIXES;\n\n/** A bare KSUID body (27-char base62, time-sortable), no prefix. */\nexport function ksuid(): string {\n return KSUID.randomSync().string;\n}\n\n/** Attach an arbitrary prefix to a fresh KSUID — `${prefix}_${ksuid}`. */\nexport function prefixId(prefix: string): string {\n return `${prefix}_${ksuid()}`;\n}\n\n/** Generate a prefixed, time-sortable id for the given domain entity type. */\nexport function genId(type: IdType): string {\n return prefixId(ID_PREFIXES[type]);\n}\n\n/** True when `value` carries the prefix for `type` (shape check only, not existence). */\nexport function isId(type: IdType, value: string): boolean {\n return value.startsWith(`${ID_PREFIXES[type]}_`);\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAa,cAAc;CACzB,cAAc;CACd,MAAM;CACN,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,eAAe;CACf,UAAU;CACV,eAAe;CACf,OAAO;CACP,aAAa;CACb,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,OAAO;CACP,YAAY;CACZ,eAAe;CACf,SAAS;CACT,eAAe;CACf,WAAW;CACX,OAAO;CACP,OAAO;CACP,WAAW;CACX,aAAa;CACb,MAAM;CACN,UAAU;CACV,MAAM;CACN,SAAS;CACT,aAAa;CACb,cAAc;AAChB;;AAKA,SAAgB,QAAgB;CAC9B,OAAO,MAAM,WAAW,CAAC,CAAC;AAC5B;;AAGA,SAAgB,SAAS,QAAwB;CAC/C,OAAO,GAAG,OAAO,GAAG,MAAM;AAC5B;;AAGA,SAAgB,MAAM,MAAsB;CAC1C,OAAO,SAAS,YAAY,KAAK;AACnC;;AAGA,SAAgB,KAAK,MAAc,OAAwB;CACzD,OAAO,MAAM,WAAW,GAAG,YAAY,MAAM,EAAE;AACjD"}
|
package/dist/shared/mailer.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { EmailSender } from "../types/ports.js";
|
|
2
|
+
import { ContentType } from "../types/schemas/content.js";
|
|
2
3
|
import { EmailTemplateId, EmailTemplateParams, TemplateContext, TemplateRenderer } from "../types/email-templates.js";
|
|
3
4
|
import "./ports.js";
|
|
4
5
|
//#region src/shared/mailer.d.ts
|
|
5
6
|
/** Resolves the recipient/content details a template needs when the
|
|
6
7
|
* triggering event carries only row ids. Wired by the app layer. */
|
|
7
8
|
interface MailerLookups {
|
|
8
|
-
|
|
9
|
+
orgUserPerson(orgId: string, orgUserId: string): Promise<{
|
|
10
|
+
userId: string;
|
|
11
|
+
email: string;
|
|
12
|
+
} | null>;
|
|
9
13
|
contentInfo(orgId: string, contentId: string): Promise<{
|
|
10
14
|
id: string;
|
|
11
15
|
title: string;
|
|
16
|
+
type: ContentType;
|
|
12
17
|
} | null>;
|
|
13
18
|
}
|
|
14
19
|
declare class Mailer {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailer.js","names":[],"sources":["../../src/shared/mailer.ts"],"sourcesContent":["// Composes a TemplateRenderer with an EmailSender: callers name a template,\n// the mailer resolves content and hands it to the transport.\nimport type {\n EmailSender,\n EmailTemplateId,\n EmailTemplateParams,\n TemplateContext,\n TemplateRenderer,\n} from './ports.js';\n\n/** Resolves the recipient/content details a template needs when the\n * triggering event carries only row ids. Wired by the app layer. */\nexport interface MailerLookups {\n
|
|
1
|
+
{"version":3,"file":"mailer.js","names":[],"sources":["../../src/shared/mailer.ts"],"sourcesContent":["// Composes a TemplateRenderer with an EmailSender: callers name a template,\n// the mailer resolves content and hands it to the transport.\nimport type {\n EmailSender,\n EmailTemplateId,\n EmailTemplateParams,\n TemplateContext,\n TemplateRenderer,\n} from './ports.js';\nimport type { ContentType } from '../types/schemas/content.js';\n\n/** Resolves the recipient/content details a template needs when the\n * triggering event carries only row ids. Wired by the app layer. */\nexport interface MailerLookups {\n orgUserPerson(\n orgId: string,\n orgUserId: string,\n ): Promise<{ userId: string; email: string } | null>;\n contentInfo(\n orgId: string,\n contentId: string,\n ): Promise<{ id: string; title: string; type: ContentType } | null>;\n}\n\nexport class Mailer {\n constructor(\n private readonly templates: TemplateRenderer,\n private readonly email: EmailSender,\n private readonly ctx: TemplateContext,\n ) {}\n\n async send<K extends EmailTemplateId>(\n to: string,\n id: K,\n params: EmailTemplateParams[K],\n ctx?: Partial<TemplateContext>,\n ): Promise<void> {\n const content = await this.templates.render(id, { ...this.ctx, ...ctx }, params);\n await this.email.send({ to, subject: content.subject, text: content.text, html: content.html });\n }\n}\n"],"mappings":";AAwBA,IAAa,SAAb,MAAoB;CAEC;CACA;CACA;CAHnB,YACE,WACA,OACA,KACA;EAHiB,KAAA,YAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;CAChB;CAEH,MAAM,KACJ,IACA,IACA,QACA,KACe;EACf,MAAM,UAAU,MAAM,KAAK,UAAU,OAAO,IAAI;GAAE,GAAG,KAAK;GAAK,GAAG;EAAI,GAAG,MAAM;EAC/E,MAAM,KAAK,MAAM,KAAK;GAAE;GAAI,SAAS,QAAQ;GAAS,MAAM,QAAQ;GAAM,MAAM,QAAQ;EAAK,CAAC;CAChG;AACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/shared/network.d.ts
|
|
2
|
+
/** True when `address` is an IP literal; brackets and an IPv6 zone are allowed. */
|
|
3
|
+
declare function isIpLiteral(address: string): boolean;
|
|
4
|
+
/** True only for an IP literal routable on the public internet; anything unparseable is not public. */
|
|
5
|
+
declare function isPublicIp(address: string): boolean;
|
|
6
|
+
/** False for localhost names and for IP literals outside the public internet. */
|
|
7
|
+
declare function isPublicHostname(hostname: string): boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { isIpLiteral, isPublicHostname, isPublicIp };
|
|
10
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
//#region src/shared/network.ts
|
|
2
|
+
const NON_PUBLIC_IPV4 = [
|
|
3
|
+
[ipv4Number([
|
|
4
|
+
0,
|
|
5
|
+
0,
|
|
6
|
+
0,
|
|
7
|
+
0
|
|
8
|
+
]), 8],
|
|
9
|
+
[ipv4Number([
|
|
10
|
+
10,
|
|
11
|
+
0,
|
|
12
|
+
0,
|
|
13
|
+
0
|
|
14
|
+
]), 8],
|
|
15
|
+
[ipv4Number([
|
|
16
|
+
100,
|
|
17
|
+
64,
|
|
18
|
+
0,
|
|
19
|
+
0
|
|
20
|
+
]), 10],
|
|
21
|
+
[ipv4Number([
|
|
22
|
+
127,
|
|
23
|
+
0,
|
|
24
|
+
0,
|
|
25
|
+
0
|
|
26
|
+
]), 8],
|
|
27
|
+
[ipv4Number([
|
|
28
|
+
169,
|
|
29
|
+
254,
|
|
30
|
+
0,
|
|
31
|
+
0
|
|
32
|
+
]), 16],
|
|
33
|
+
[ipv4Number([
|
|
34
|
+
172,
|
|
35
|
+
16,
|
|
36
|
+
0,
|
|
37
|
+
0
|
|
38
|
+
]), 12],
|
|
39
|
+
[ipv4Number([
|
|
40
|
+
192,
|
|
41
|
+
0,
|
|
42
|
+
0,
|
|
43
|
+
0
|
|
44
|
+
]), 24],
|
|
45
|
+
[ipv4Number([
|
|
46
|
+
192,
|
|
47
|
+
0,
|
|
48
|
+
2,
|
|
49
|
+
0
|
|
50
|
+
]), 24],
|
|
51
|
+
[ipv4Number([
|
|
52
|
+
192,
|
|
53
|
+
88,
|
|
54
|
+
99,
|
|
55
|
+
0
|
|
56
|
+
]), 24],
|
|
57
|
+
[ipv4Number([
|
|
58
|
+
192,
|
|
59
|
+
168,
|
|
60
|
+
0,
|
|
61
|
+
0
|
|
62
|
+
]), 16],
|
|
63
|
+
[ipv4Number([
|
|
64
|
+
198,
|
|
65
|
+
18,
|
|
66
|
+
0,
|
|
67
|
+
0
|
|
68
|
+
]), 15],
|
|
69
|
+
[ipv4Number([
|
|
70
|
+
198,
|
|
71
|
+
51,
|
|
72
|
+
100,
|
|
73
|
+
0
|
|
74
|
+
]), 24],
|
|
75
|
+
[ipv4Number([
|
|
76
|
+
203,
|
|
77
|
+
0,
|
|
78
|
+
113,
|
|
79
|
+
0
|
|
80
|
+
]), 24],
|
|
81
|
+
[ipv4Number([
|
|
82
|
+
224,
|
|
83
|
+
0,
|
|
84
|
+
0,
|
|
85
|
+
0
|
|
86
|
+
]), 4],
|
|
87
|
+
[ipv4Number([
|
|
88
|
+
240,
|
|
89
|
+
0,
|
|
90
|
+
0,
|
|
91
|
+
0
|
|
92
|
+
]), 4]
|
|
93
|
+
];
|
|
94
|
+
function ipv4Number(octets) {
|
|
95
|
+
return (octets[0] << 24 | octets[1] << 16 | octets[2] << 8 | octets[3]) >>> 0;
|
|
96
|
+
}
|
|
97
|
+
function parseIpv4(value) {
|
|
98
|
+
const parts = value.split(".");
|
|
99
|
+
if (parts.length !== 4 || !parts.every((part) => /^\d{1,3}$/.test(part))) return null;
|
|
100
|
+
const octets = parts.map(Number);
|
|
101
|
+
return octets.every((octet) => octet <= 255) ? octets : null;
|
|
102
|
+
}
|
|
103
|
+
function parseHextets(part) {
|
|
104
|
+
if (part === "") return [];
|
|
105
|
+
const groups = part.split(":");
|
|
106
|
+
const hextets = [];
|
|
107
|
+
for (const [i, group] of groups.entries()) if (i === groups.length - 1 && group.includes(".")) {
|
|
108
|
+
const octets = parseIpv4(group);
|
|
109
|
+
if (!octets) return null;
|
|
110
|
+
hextets.push(octets[0] << 8 | octets[1], octets[2] << 8 | octets[3]);
|
|
111
|
+
} else if (/^[0-9a-f]{1,4}$/i.test(group)) hextets.push(parseInt(group, 16));
|
|
112
|
+
else return null;
|
|
113
|
+
return hextets;
|
|
114
|
+
}
|
|
115
|
+
function parseIpv6(value) {
|
|
116
|
+
const halves = value.split("%")[0].split("::");
|
|
117
|
+
if (halves.length > 2) return null;
|
|
118
|
+
const head = parseHextets(halves[0]);
|
|
119
|
+
const tail = halves.length === 2 ? parseHextets(halves[1]) : [];
|
|
120
|
+
if (!head || !tail) return null;
|
|
121
|
+
const missing = 8 - head.length - tail.length;
|
|
122
|
+
if (halves.length === 2 ? missing < 1 : missing !== 0) return null;
|
|
123
|
+
return [
|
|
124
|
+
...head,
|
|
125
|
+
...new Array(missing).fill(0),
|
|
126
|
+
...tail
|
|
127
|
+
].flatMap((hextet) => [hextet >> 8, hextet & 255]);
|
|
128
|
+
}
|
|
129
|
+
function isPublicIpv4(octets) {
|
|
130
|
+
const address = ipv4Number(octets);
|
|
131
|
+
return NON_PUBLIC_IPV4.every(([network, bits]) => {
|
|
132
|
+
const mask = bits === 0 ? 0 : -1 << 32 - bits >>> 0;
|
|
133
|
+
return (address & mask) >>> 0 !== network;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function startsWith(bytes, prefix) {
|
|
137
|
+
return prefix.every((byte, i) => bytes[i] === byte);
|
|
138
|
+
}
|
|
139
|
+
function isPublicIpv6(bytes) {
|
|
140
|
+
if (bytes.slice(0, 10).every((b) => b === 0)) {
|
|
141
|
+
const mapped = bytes[10] === 255 && bytes[11] === 255;
|
|
142
|
+
const compatible = bytes[10] === 0 && bytes[11] === 0;
|
|
143
|
+
return (mapped || compatible) && isPublicIpv4(bytes.slice(12));
|
|
144
|
+
}
|
|
145
|
+
if (startsWith(bytes, [
|
|
146
|
+
0,
|
|
147
|
+
100,
|
|
148
|
+
255,
|
|
149
|
+
155,
|
|
150
|
+
0,
|
|
151
|
+
0,
|
|
152
|
+
0,
|
|
153
|
+
0,
|
|
154
|
+
0,
|
|
155
|
+
0,
|
|
156
|
+
0,
|
|
157
|
+
0
|
|
158
|
+
])) return isPublicIpv4(bytes.slice(12));
|
|
159
|
+
if (startsWith(bytes, [32, 2])) return isPublicIpv4(bytes.slice(2, 6));
|
|
160
|
+
const [first = 0, second = 0] = bytes;
|
|
161
|
+
return !((first & 254) === 252 || first === 254 && (second & 128) === 128 || first === 255 || startsWith(bytes, [
|
|
162
|
+
0,
|
|
163
|
+
100,
|
|
164
|
+
255,
|
|
165
|
+
155,
|
|
166
|
+
0,
|
|
167
|
+
1
|
|
168
|
+
]) || startsWith(bytes, [
|
|
169
|
+
1,
|
|
170
|
+
0,
|
|
171
|
+
0,
|
|
172
|
+
0,
|
|
173
|
+
0,
|
|
174
|
+
0,
|
|
175
|
+
0,
|
|
176
|
+
0
|
|
177
|
+
]) || startsWith(bytes, [
|
|
178
|
+
32,
|
|
179
|
+
1,
|
|
180
|
+
13,
|
|
181
|
+
184
|
|
182
|
+
]) || startsWith(bytes, [
|
|
183
|
+
32,
|
|
184
|
+
1,
|
|
185
|
+
0,
|
|
186
|
+
0
|
|
187
|
+
]));
|
|
188
|
+
}
|
|
189
|
+
/** True when `address` is an IP literal; brackets and an IPv6 zone are allowed. */
|
|
190
|
+
function isIpLiteral(address) {
|
|
191
|
+
const bare = address.replace(/^\[(.*)\]$/, "$1");
|
|
192
|
+
return parseIpv4(bare) !== null || parseIpv6(bare) !== null;
|
|
193
|
+
}
|
|
194
|
+
/** True only for an IP literal routable on the public internet; anything unparseable is not public. */
|
|
195
|
+
function isPublicIp(address) {
|
|
196
|
+
const bare = address.replace(/^\[(.*)\]$/, "$1");
|
|
197
|
+
const v4 = parseIpv4(bare);
|
|
198
|
+
if (v4) return isPublicIpv4(v4);
|
|
199
|
+
const v6 = parseIpv6(bare);
|
|
200
|
+
return v6 !== null && isPublicIpv6(v6);
|
|
201
|
+
}
|
|
202
|
+
/** False for localhost names and for IP literals outside the public internet. */
|
|
203
|
+
function isPublicHostname(hostname) {
|
|
204
|
+
const host = hostname.toLowerCase().replace(/\.$/, "");
|
|
205
|
+
if (host === "localhost" || host.endsWith(".localhost")) return false;
|
|
206
|
+
return isIpLiteral(host) ? isPublicIp(host) : true;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
export { isIpLiteral, isPublicHostname, isPublicIp };
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","names":[],"sources":["../../src/shared/network.ts"],"sourcesContent":["const NON_PUBLIC_IPV4: ReadonlyArray<readonly [number, number]> = [\n [ipv4Number([0, 0, 0, 0]), 8],\n [ipv4Number([10, 0, 0, 0]), 8],\n [ipv4Number([100, 64, 0, 0]), 10],\n [ipv4Number([127, 0, 0, 0]), 8],\n [ipv4Number([169, 254, 0, 0]), 16],\n [ipv4Number([172, 16, 0, 0]), 12],\n [ipv4Number([192, 0, 0, 0]), 24],\n [ipv4Number([192, 0, 2, 0]), 24],\n [ipv4Number([192, 88, 99, 0]), 24],\n [ipv4Number([192, 168, 0, 0]), 16],\n [ipv4Number([198, 18, 0, 0]), 15],\n [ipv4Number([198, 51, 100, 0]), 24],\n [ipv4Number([203, 0, 113, 0]), 24],\n [ipv4Number([224, 0, 0, 0]), 4],\n [ipv4Number([240, 0, 0, 0]), 4],\n];\n\nfunction ipv4Number(octets: number[]): number {\n return ((octets[0]! << 24) | (octets[1]! << 16) | (octets[2]! << 8) | octets[3]!) >>> 0;\n}\n\nfunction parseIpv4(value: string): number[] | null {\n const parts = value.split('.');\n if (parts.length !== 4 || !parts.every((part) => /^\\d{1,3}$/.test(part))) {\n return null;\n }\n const octets = parts.map(Number);\n return octets.every((octet) => octet <= 255) ? octets : null;\n}\n\nfunction parseHextets(part: string): number[] | null {\n if (part === '') {\n return [];\n }\n const groups = part.split(':');\n const hextets: number[] = [];\n for (const [i, group] of groups.entries()) {\n if (i === groups.length - 1 && group.includes('.')) {\n const octets = parseIpv4(group);\n if (!octets) {\n return null;\n }\n hextets.push((octets[0]! << 8) | octets[1]!, (octets[2]! << 8) | octets[3]!);\n } else if (/^[0-9a-f]{1,4}$/i.test(group)) {\n hextets.push(parseInt(group, 16));\n } else {\n return null;\n }\n }\n return hextets;\n}\n\nfunction parseIpv6(value: string): number[] | null {\n const address = value.split('%')[0]!;\n const halves = address.split('::');\n if (halves.length > 2) {\n return null;\n }\n const head = parseHextets(halves[0]!);\n const tail = halves.length === 2 ? parseHextets(halves[1]!) : [];\n if (!head || !tail) {\n return null;\n }\n const missing = 8 - head.length - tail.length;\n if (halves.length === 2 ? missing < 1 : missing !== 0) {\n return null;\n }\n const hextets = [...head, ...new Array<number>(missing).fill(0), ...tail];\n return hextets.flatMap((hextet) => [hextet >> 8, hextet & 0xff]);\n}\n\nfunction isPublicIpv4(octets: number[]): boolean {\n const address = ipv4Number(octets);\n return NON_PUBLIC_IPV4.every(([network, bits]) => {\n const mask = bits === 0 ? 0 : (~0 << (32 - bits)) >>> 0;\n return (address & mask) >>> 0 !== network;\n });\n}\n\nfunction startsWith(bytes: number[], prefix: number[]): boolean {\n return prefix.every((byte, i) => bytes[i] === byte);\n}\n\nfunction isPublicIpv6(bytes: number[]): boolean {\n if (bytes.slice(0, 10).every((b) => b === 0)) {\n const mapped = bytes[10] === 0xff && bytes[11] === 0xff;\n const compatible = bytes[10] === 0 && bytes[11] === 0;\n return (mapped || compatible) && isPublicIpv4(bytes.slice(12));\n }\n if (startsWith(bytes, [0x00, 0x64, 0xff, 0x9b, 0, 0, 0, 0, 0, 0, 0, 0])) {\n return isPublicIpv4(bytes.slice(12));\n }\n if (startsWith(bytes, [0x20, 0x02])) {\n return isPublicIpv4(bytes.slice(2, 6));\n }\n const [first = 0, second = 0] = bytes;\n return !(\n (first & 0xfe) === 0xfc ||\n (first === 0xfe && (second & 0x80) === 0x80) ||\n first === 0xff ||\n startsWith(bytes, [0x00, 0x64, 0xff, 0x9b, 0x00, 0x01]) ||\n startsWith(bytes, [0x01, 0x00, 0, 0, 0, 0, 0, 0]) ||\n startsWith(bytes, [0x20, 0x01, 0x0d, 0xb8]) ||\n startsWith(bytes, [0x20, 0x01, 0x00, 0x00])\n );\n}\n\n/** True when `address` is an IP literal; brackets and an IPv6 zone are allowed. */\nexport function isIpLiteral(address: string): boolean {\n const bare = address.replace(/^\\[(.*)\\]$/, '$1');\n return parseIpv4(bare) !== null || parseIpv6(bare) !== null;\n}\n\n/** True only for an IP literal routable on the public internet; anything unparseable is not public. */\nexport function isPublicIp(address: string): boolean {\n const bare = address.replace(/^\\[(.*)\\]$/, '$1');\n const v4 = parseIpv4(bare);\n if (v4) {\n return isPublicIpv4(v4);\n }\n const v6 = parseIpv6(bare);\n return v6 !== null && isPublicIpv6(v6);\n}\n\n/** False for localhost names and for IP literals outside the public internet. */\nexport function isPublicHostname(hostname: string): boolean {\n const host = hostname.toLowerCase().replace(/\\.$/, '');\n if (host === 'localhost' || host.endsWith('.localhost')) {\n return false;\n }\n return isIpLiteral(host) ? isPublicIp(host) : true;\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","names":[],"sources":["../../src/shared/settings.ts"],"sourcesContent":["// Cross-cutting settings: storage, scoping and resolution for every domain's\n// configuration. Not a bounded context: it is a leaf every context may import, and it imports\n// no context.\n\nexport interface SettingsRecord {\n namespace: string;\n scopeId: string;\n value?: Record<string,unknown>;\n}\n\nexport enum SettingsNamespace {\n content = 'content',\n}\n\nexport interface SettingsRepository {\n /** Rows for the given scopes, optionally narrowed to one namespace. */\n find(orgId: string, scopeId: string, namespace?: string): Promise<SettingsRecord[]>;\n /** Deep-merges the patch into the row's value, inserting when absent. Nested\n * objects merge key by key; arrays and scalars are replaced outright. */\n patch(orgId: string, namespace: string, scopeId: string, value: unknown): Promise<SettingsRecord>;\n}\n\nexport class SettingsService {\n constructor(private readonly repo: SettingsRepository) {}\n\n async get<T>(\n orgId: string,\n namespace: string,\n scopeId: string,\n defaultIfNull?: T,\n ): Promise<T | undefined> {\n const rows = await this.repo.find(orgId, scopeId, namespace);\n return (rows[0]?.value as T) ?? defaultIfNull;\n }\n\n async patch<T>(orgId: string, namespace: string, scopeId: string, value: unknown): Promise<T> {\n const row = await this.repo.patch(orgId, namespace, scopeId, value);\n return row.value as T;\n }\n}\n"],"mappings":";AAUA,IAAY,oBAAL,yBAAA,mBAAA;CACL,kBAAA,aAAA;;AACF,EAAA,CAAA,CAAA;AAUA,IAAa,kBAAb,MAA6B;CACE;CAA7B,YAAY,MAA2C;EAA1B,KAAA,OAAA;CAA2B;CAExD,MAAM,IACJ,OACA,WACA,SACA,eACwB;EAExB,QAAQ,MADW,KAAK,KAAK,KAAK,OAAO,SAAS,SAAS,EAAA,CAC9C,EAAE,EAAE,SAAe;CAClC;CAEA,MAAM,MAAS,OAAe,WAAmB,SAAiB,OAA4B;EAE5F,QAAO,MADW,KAAK,KAAK,MAAM,OAAO,WAAW,SAAS,KAAK,EAAA,CACvD;CACb;AACF"}
|
|
1
|
+
{"version":3,"file":"settings.js","names":[],"sources":["../../src/shared/settings.ts"],"sourcesContent":["// Cross-cutting settings: storage, scoping and resolution for every domain's\n// configuration. Not a bounded context: it is a leaf every context may import, and it imports\n// no context.\n\nexport interface SettingsRecord {\n namespace: string;\n scopeId: string;\n value?: Record<string, unknown>;\n}\n\nexport enum SettingsNamespace {\n content = 'content',\n}\n\nexport interface SettingsRepository {\n /** Rows for the given scopes, optionally narrowed to one namespace. */\n find(orgId: string, scopeId: string, namespace?: string): Promise<SettingsRecord[]>;\n /** Deep-merges the patch into the row's value, inserting when absent. Nested\n * objects merge key by key; arrays and scalars are replaced outright. */\n patch(orgId: string, namespace: string, scopeId: string, value: unknown): Promise<SettingsRecord>;\n}\n\nexport class SettingsService {\n constructor(private readonly repo: SettingsRepository) {}\n\n async get<T>(\n orgId: string,\n namespace: string,\n scopeId: string,\n defaultIfNull?: T,\n ): Promise<T | undefined> {\n const rows = await this.repo.find(orgId, scopeId, namespace);\n return (rows[0]?.value as T) ?? defaultIfNull;\n }\n\n async patch<T>(orgId: string, namespace: string, scopeId: string, value: unknown): Promise<T> {\n const row = await this.repo.patch(orgId, namespace, scopeId, value);\n return row.value as T;\n }\n}\n"],"mappings":";AAUA,IAAY,oBAAL,yBAAA,mBAAA;CACL,kBAAA,aAAA;;AACF,EAAA,CAAA,CAAA;AAUA,IAAa,kBAAb,MAA6B;CACE;CAA7B,YAAY,MAA2C;EAA1B,KAAA,OAAA;CAA2B;CAExD,MAAM,IACJ,OACA,WACA,SACA,eACwB;EAExB,QAAQ,MADW,KAAK,KAAK,KAAK,OAAO,SAAS,SAAS,EAAA,CAC9C,EAAE,EAAE,SAAe;CAClC;CAEA,MAAM,MAAS,OAAe,WAAmB,SAAiB,OAA4B;EAE5F,QAAO,MADW,KAAK,KAAK,MAAM,OAAO,WAAW,SAAS,KAAK,EAAA,CACvD;CACb;AACF"}
|
package/dist/types/assets.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Asset, AssetKind, AssetStatus,
|
|
2
|
-
export type { Asset, AssetKind, AssetStatus,
|
|
1
|
+
import { Asset, AssetKind, AssetSource, AssetStatus, AssetUrls, AssetView, AssetsQuery, RequestUploadInput, UploadTicket } from "./schemas/assets.js";
|
|
2
|
+
export type { Asset, AssetKind, AssetSource, AssetStatus, AssetUrls, AssetView, AssetsQuery, RequestUploadInput, UploadTicket };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DomainEvent } from "./shared.js";
|
|
2
|
-
import { Automation, AutomationAction, AutomationActionResult, AutomationRun, AutomationRunStatus, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, UpdateAutomationInput } from "./schemas/automations.js";
|
|
2
|
+
import { Automation, AutomationAction, AutomationActionResult, AutomationKind, AutomationRun, AutomationRunStatus, AutomationRunsQuery, AutomationSource, AutomationTrigger, AutomationsQuery, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, CreateWebhookInput, CreatedWebhook, DeliverWebhookInput, UpdateAutomationInput, UpdateWebhookInput, Webhook, WebhookSecret } from "./schemas/automations.js";
|
|
3
3
|
//#region src/types/automations.d.ts
|
|
4
4
|
interface AutomationDispatch {
|
|
5
5
|
runId: string;
|
|
@@ -8,16 +8,35 @@ interface AutomationDispatch {
|
|
|
8
8
|
actions: AutomationAction[];
|
|
9
9
|
event: DomainEvent;
|
|
10
10
|
}
|
|
11
|
+
interface ScheduledAutomation {
|
|
12
|
+
orgId: string;
|
|
13
|
+
automationId: string;
|
|
14
|
+
cron: string;
|
|
15
|
+
}
|
|
11
16
|
interface AutomationExecutor {
|
|
12
17
|
runAction(d: AutomationDispatch, index: number): Promise<AutomationActionResult>;
|
|
13
18
|
finalize(d: AutomationDispatch, results: AutomationActionResult[]): Promise<void>;
|
|
19
|
+
listSchedules?(): Promise<ScheduledAutomation[]>;
|
|
20
|
+
fireSchedule?(orgId: string, automationId: string, firedAt: Date): Promise<void>;
|
|
14
21
|
}
|
|
15
22
|
interface AutomationEngine {
|
|
16
23
|
register(executor: AutomationExecutor): void;
|
|
17
24
|
dispatch(d: AutomationDispatch): Promise<void>;
|
|
18
25
|
start(): Promise<void>;
|
|
19
26
|
stop(): Promise<void>;
|
|
27
|
+
syncSchedules?(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
interface WebhookRequest {
|
|
30
|
+
url: string;
|
|
31
|
+
headers: Record<string, string>;
|
|
32
|
+
body: string;
|
|
33
|
+
}
|
|
34
|
+
interface WebhookResponse {
|
|
35
|
+
status: number;
|
|
36
|
+
}
|
|
37
|
+
interface WebhookSender {
|
|
38
|
+
send(request: WebhookRequest): Promise<WebhookResponse>;
|
|
20
39
|
}
|
|
21
40
|
//#endregion
|
|
22
|
-
export { type Automation, type AutomationAction, type AutomationActionResult, AutomationDispatch, AutomationEngine, AutomationExecutor, type AutomationRun, type AutomationRunStatus, type AutomationRunsQuery, type AutomationTrigger, type AvailableAction, type AvailableActions, type AvailableTriggers, type CreateAutomationInput, type UpdateAutomationInput };
|
|
41
|
+
export { type Automation, type AutomationAction, type AutomationActionResult, AutomationDispatch, AutomationEngine, AutomationExecutor, type AutomationKind, type AutomationRun, type AutomationRunStatus, type AutomationRunsQuery, type AutomationSource, type AutomationTrigger, type AutomationsQuery, type AvailableAction, type AvailableActions, type AvailableTriggers, type CreateAutomationInput, type CreateWebhookInput, type CreatedWebhook, type DeliverWebhookInput, ScheduledAutomation, type UpdateAutomationInput, type UpdateWebhookInput, type Webhook, WebhookRequest, WebhookResponse, type WebhookSecret, WebhookSender };
|
|
23
42
|
//# sourceMappingURL=automations.d.ts.map
|
package/dist/types/content.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Activity, ActivityAsset,
|
|
2
|
-
export type { Activity, ActivityAsset,
|
|
1
|
+
import { Activity, ActivityAsset, ActivitySettings, ActivityView, AddDownloadAssetInput, AddSpaceLinkInput, Bundle, BundleItem, Community, CommunitySettings, CommunityStatus, CommunityView, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CourseView, CreateBundleInput, CreateCommunityInput, CreateCourseInput, CreateDownloadInput, CreateSpaceInput, DmSettings, Download, DownloadAsset, DownloadFile, DownloadStatus, DownloadView, ListBundlesQuery, ListCommunitiesQuery, ListCoursesQuery, ListDownloadsQuery, Module, PatchDmSettingsInput, ReorderDownloadAssetsInput, SaveActivityInput, SetSpaceTopicsInput, Space, SpaceAccessRule, SpaceDetail, SpaceLink, SpaceSettings, SpaceTopic, UpdateBundleInput, UpdateCommunityInput, UpdateCourseInput, UpdateDownloadInput, UpdateSpaceInput } from "./schemas/content.js";
|
|
2
|
+
export type { Activity, ActivityAsset, ActivitySettings, ActivityView, AddDownloadAssetInput, AddSpaceLinkInput, Bundle, BundleItem, Community, CommunitySettings, CommunityStatus, CommunityView, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CourseView, CreateBundleInput, CreateCommunityInput, CreateCourseInput, CreateDownloadInput, CreateSpaceInput, DmSettings, Download, DownloadAsset, DownloadFile, DownloadStatus, DownloadView, ListBundlesQuery, ListCommunitiesQuery, ListCoursesQuery, ListDownloadsQuery, Module, PatchDmSettingsInput, ReorderDownloadAssetsInput, SaveActivityInput, SetSpaceTopicsInput, Space, SpaceAccessRule, SpaceDetail, SpaceLink, SpaceSettings, SpaceTopic, UpdateBundleInput, UpdateCommunityInput, UpdateCourseInput, UpdateDownloadInput, UpdateSpaceInput };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Page } from "./shared.js";
|
|
2
2
|
import { Role } from "./schemas/organizations.js";
|
|
3
3
|
import "./organizations.js";
|
|
4
|
-
import { CommentListItem, CommentReaction, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, ListCommentsQuery, ReactionCounts, ReactionEmoji } from "./schemas/discussion.js";
|
|
4
|
+
import { ActivityCommentsRule, BlockedUser, Chat, ChatKind, ChatLastMessage, ChatStatus, ChatUser, CommentFlagResolution, CommentListItem, CommentReaction, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, FlaggedComment, ListCommentsQuery, Message, MessageAttachment, MessageFile, MessageFlag, MessageFlagResolution, MessageReaction, MessageView, Post, PostBookmark, PostFlag, PostFlagResolution, PostFollow, PostReaction, PostStatus, PostView, ReactionCounts, ReactionEmoji } from "./schemas/discussion.js";
|
|
5
5
|
//#region src/types/discussion.d.ts
|
|
6
6
|
interface Comment {
|
|
7
7
|
readonly id: string;
|
|
8
8
|
readonly orgId: string;
|
|
9
|
-
readonly activityId: string;
|
|
9
|
+
readonly activityId: string | null;
|
|
10
|
+
readonly postId: string | null;
|
|
11
|
+
readonly communityId: string | null;
|
|
10
12
|
readonly parentId: string | null;
|
|
11
13
|
readonly orgUserId: string;
|
|
12
14
|
body: string;
|
|
@@ -19,7 +21,11 @@ interface CommentAuthor {
|
|
|
19
21
|
id: string;
|
|
20
22
|
firstName: string | null;
|
|
21
23
|
lastName: string | null;
|
|
24
|
+
displayName: string | null;
|
|
25
|
+
headline: string | null;
|
|
22
26
|
image: string | null;
|
|
27
|
+
imageAssetId: string | null;
|
|
28
|
+
imageUrl: string | null;
|
|
23
29
|
role: Role;
|
|
24
30
|
}
|
|
25
31
|
interface CommentReport {
|
|
@@ -29,8 +35,11 @@ interface CommentReport {
|
|
|
29
35
|
readonly orgUserId: string;
|
|
30
36
|
readonly reason: string;
|
|
31
37
|
resolvedAt: Date | null;
|
|
38
|
+
resolution: 'dismissed' | 'removed' | null;
|
|
39
|
+
resolvedBy: string | null;
|
|
32
40
|
readonly createdAt: Date;
|
|
41
|
+
updatedAt: Date;
|
|
33
42
|
}
|
|
34
43
|
//#endregion
|
|
35
|
-
export { Comment, CommentAuthor, type CommentListItem, type CommentReaction, CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentsConfig, type ListCommentsQuery, type Page, type ReactionCounts, type ReactionEmoji };
|
|
44
|
+
export { type ActivityCommentsRule, type BlockedUser, type Chat, type ChatKind, type ChatLastMessage, type ChatStatus, type ChatUser, Comment, CommentAuthor, type CommentFlagResolution, type CommentListItem, type CommentReaction, CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentsConfig, type FlaggedComment, type ListCommentsQuery, type Message, type MessageAttachment, type MessageFile, type MessageFlag, type MessageFlagResolution, type MessageReaction, type MessageView, type Page, type Post, type PostBookmark, type PostFlag, type PostFlagResolution, type PostFollow, type PostReaction, type PostStatus, type PostView, type ReactionCounts, type ReactionEmoji };
|
|
36
45
|
//# sourceMappingURL=discussion.d.ts.map
|