@nx-ddd/common 19.50.0 → 19.80.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/fesm2022/nx-ddd-common-domain.mjs +0 -15
- package/fesm2022/nx-ddd-common-domain.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium-impl.mjs +0 -4
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium-impl.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-cloud-storage.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-browser.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-server.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-token.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-stripe-impl.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-browser.mjs +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-browser.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-server.mjs +13 -5
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-server.mjs.map +1 -1
- package/fesm2022/nx-ddd-common-infrastructure.mjs.map +1 -1
- package/fesm2022/nx-ddd-common.mjs +0 -3
- package/fesm2022/nx-ddd-common.mjs.map +1 -1
- package/package.json +2 -2
- package/types/nx-ddd-common-infrastructure-externals-crypto-impl-browser.d.ts.map +1 -1
- package/types/nx-ddd-common-infrastructure-externals-crypto-token.d.ts +1 -2
- package/types/nx-ddd-common-infrastructure-externals-crypto-token.d.ts.map +1 -1
- package/types/nx-ddd-common-infrastructure-externals-crypto.d.ts +1 -2
- package/types/nx-ddd-common-infrastructure-externals-crypto.d.ts.map +1 -1
- package/types/nx-ddd-common-infrastructure-externals-websocket-impl-server.d.ts.map +1 -1
- package/types/nx-ddd-common-infrastructure.d.ts +1 -2
- package/types/nx-ddd-common-infrastructure.d.ts.map +1 -1
|
@@ -27,7 +27,6 @@ class Domain {
|
|
|
27
27
|
this.registerAnnotation(target.constructor, { propName, typeFactory, type: 'prop:type' });
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
// classをデコレートしてnameをアノテーションする
|
|
31
30
|
static Entity(propsOrName) {
|
|
32
31
|
const props = typeof propsOrName === 'string' ? { name: propsOrName } : propsOrName;
|
|
33
32
|
return (target) => {
|
|
@@ -163,7 +162,6 @@ class BaseResolver {
|
|
|
163
162
|
class Resolver extends BaseResolver {
|
|
164
163
|
constructor(params = {}) {
|
|
165
164
|
super();
|
|
166
|
-
// Register entity maps for each entity type in the params
|
|
167
165
|
console.debug('[Resolver] params', params);
|
|
168
166
|
Object.entries(params).forEach(([entityName, entities]) => {
|
|
169
167
|
if (entities && Array.isArray(entities) && entities.length > 0) {
|
|
@@ -173,22 +171,16 @@ class Resolver extends BaseResolver {
|
|
|
173
171
|
}
|
|
174
172
|
resolve(entity) {
|
|
175
173
|
const result = { ...entity };
|
|
176
|
-
// Look for properties that end with 'Ids' or 'Id' to resolve related entities
|
|
177
174
|
Object.keys(entity).forEach(key => {
|
|
178
|
-
// Handle plural relationships (e.g., invoiceIds -> invoices)
|
|
179
175
|
if (key.endsWith('Ids') && Array.isArray(entity[key])) {
|
|
180
176
|
const baseName = key.replace(/Ids$/, '');
|
|
181
|
-
// 英語の複数形ルールを考慮する
|
|
182
177
|
let entityName;
|
|
183
|
-
// companyのような語尾がyで終わる場合はiesに変換
|
|
184
178
|
if (baseName.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(baseName.charAt(baseName.length - 2))) {
|
|
185
179
|
entityName = baseName.slice(0, -1) + 'ies';
|
|
186
180
|
}
|
|
187
|
-
// すでに語尾がsやxなどの場合はesを追加
|
|
188
181
|
else if (['s', 'x', 'z', 'ch', 'sh'].some(ending => baseName.endsWith(ending))) {
|
|
189
182
|
entityName = baseName + 'es';
|
|
190
183
|
}
|
|
191
|
-
// それ以外は単純にsを追加
|
|
192
184
|
else {
|
|
193
185
|
entityName = baseName + 's';
|
|
194
186
|
}
|
|
@@ -198,24 +190,18 @@ class Resolver extends BaseResolver {
|
|
|
198
190
|
result[entityName] = resolvedEntities;
|
|
199
191
|
}
|
|
200
192
|
}
|
|
201
|
-
// Handle singular relationships (e.g., addressId -> address)
|
|
202
193
|
else if (key.endsWith('Id') && !key.endsWith('Ids') && typeof entity[key] === 'string') {
|
|
203
194
|
const baseName = key.replace(/Id$/, '');
|
|
204
|
-
// 英語の複数形ルールを考慮して複数形を生成
|
|
205
195
|
let pluralEntityName;
|
|
206
|
-
// companyのような語尾がyで終わる場合はiesに変換
|
|
207
196
|
if (baseName.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(baseName.charAt(baseName.length - 2))) {
|
|
208
197
|
pluralEntityName = baseName.slice(0, -1) + 'ies';
|
|
209
198
|
}
|
|
210
|
-
// すでに語尾がsやxなどの場合はesを追加
|
|
211
199
|
else if (['s', 'x', 'z', 'ch', 'sh'].some(ending => baseName.endsWith(ending))) {
|
|
212
200
|
pluralEntityName = baseName + 'es';
|
|
213
201
|
}
|
|
214
|
-
// それ以外は単純にsを追加
|
|
215
202
|
else {
|
|
216
203
|
pluralEntityName = baseName + 's';
|
|
217
204
|
}
|
|
218
|
-
// まず複数形でエンティティを探す
|
|
219
205
|
let entityMap = this.getEntityMap(pluralEntityName);
|
|
220
206
|
if (entityMap) {
|
|
221
207
|
const resolvedEntity = this.getEntity(pluralEntityName, entity[key]);
|
|
@@ -224,7 +210,6 @@ class Resolver extends BaseResolver {
|
|
|
224
210
|
}
|
|
225
211
|
}
|
|
226
212
|
else {
|
|
227
|
-
// 複数形で見つからない場合は単数形を試す
|
|
228
213
|
entityMap = this.getEntityMap(baseName);
|
|
229
214
|
if (entityMap) {
|
|
230
215
|
const resolvedEntity = this.getEntity(baseName, entity[key]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-domain.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/domain/models/decorators/decorators.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/entity/entity.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-entity-name/get-entity-name.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-lang-map/get-lang-map.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-model-name/get-model-name.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-props/get-props.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/transformers/index.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/repository.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/resolver/resolver.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/nx-ddd-common-domain.ts"],"sourcesContent":["export type Type<E> = { new(...args: any[]): E};\nexport type DomainLangMap<Entity> = Partial<{[K in keyof Entity]: string}>\n\ninterface Target {\n constructor: {\n [Domain.ANNOTATIONS]?: DomainAnnotation[];\n }\n}\n\nexport type OmitGetter<T> = {\n [P in keyof T as string extends P ? never : number extends P ? never : P]: T[P];\n};\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: DeepPartial<T[P]>;\n};\n\ninterface BaseDomainAnnotation {\n type: 'model:lang' | 'prop:lang' | 'prop:type';\n}\n\nexport interface DomainModelLangAnnotation extends BaseDomainAnnotation {\n type: 'model:lang';\n modelName: string;\n name: string;\n typeFactory?: () => any;\n}\n\nexport interface DomainPropLangAnnotation extends BaseDomainAnnotation {\n type: 'prop:lang';\n propName: string;\n name: string;\n}\n\nexport interface DomainPropTypeAnnotation extends BaseDomainAnnotation {\n type: 'prop:type';\n propName: string;\n typeFactory: () => any;\n}\n\nexport type DomainAnnotation = DomainModelLangAnnotation\n | DomainPropLangAnnotation\n | DomainPropTypeAnnotation;\n\n\nexport function getAnnotations<E>(target: Type<E>): DomainAnnotation[] {\n return (target as any)?.[Domain.ANNOTATIONS] ?? [];\n}\n\n\nexport class Domain {\n static readonly ANNOTATIONS = Symbol('annotations');\n\n static Lang(name: string) {\n return (target: any, propName: string) => {\n this.registerAnnotation(target.constructor, {propName, type: 'prop:lang', name});\n };\n }\n\n static Type<T>(typeFactory?: () => T) {\n return (target: any, propName: string) => {\n if (!typeFactory) {\n const type = Reflect.getMetadata('design:type', target as any, propName);\n typeFactory = () => type;\n }\n this.registerAnnotation(target.constructor, {propName, typeFactory, type: 'prop:type'});\n };\n }\n\n // classをデコレートしてnameをアノテーションする\n static Entity(propsOrName: {name: string} | string) {\n const props = typeof propsOrName === 'string' ? {name: propsOrName} : propsOrName;\n return (target: any) => {\n this.registerAnnotation(target, {name: props.name, type: 'model:lang', modelName: target.name});\n };\n }\n\n static registerAnnotation(constructor: Target['constructor'], annotation: DomainAnnotation) {\n constructor[this.ANNOTATIONS] ??= [];\n constructor[this.ANNOTATIONS]!.push(annotation);\n }\n}","import { toObject } from '@nx-ddd/common';\n\nexport interface Entity<Id = string> {\n id: Id | null;\n}\n\nexport class Entity { \n static fromObj<T extends Entity = Entity>(obj: object): T {\n return Object.assign(new this(), {\n id: null,\n createdAt: null,\n updatedAt: null,\n ...obj\n }) as never as T;\n }\n\n static toObj(entity: Entity): Entity {\n return toObject(entity) as Entity;\n }\n}\n","import { DomainModelLangAnnotation, getAnnotations, Type } from '../decorators';\n\nexport function getEntityName<E>(target: Type<E>): string {\n return (getAnnotations(target).find(annotation => {\n return annotation.type === 'model:lang';\n }) as DomainModelLangAnnotation)?.name ?? target.name;\n}\n","import { flatten } from \"flat\";\nimport { merge } from \"lodash-es\";\nimport { DomainAnnotation, Type, getAnnotations } from '../decorators';\n\n// フラット化された言語マップの型定義(ネストされたプロパティを含む)\nexport type LangMap<E> = Partial<Record<keyof E | string, string>>;\n\nexport function getLangMap<E>(domain: Type<E>, mergeObj: object = {}): LangMap<E> {\n return flatten(merge(_getLangMap(domain), mergeObj));\n}\n\nfunction _getLangMap<E>(target: Type<E>): Record<string, any> {\n const result = getAnnotations(target).reduce((acc: Record<string, any>, annotation: DomainAnnotation) => {\n switch(annotation.type) {\n case 'prop:lang': {\n acc[annotation.propName] = annotation.name;\n break;\n }\n case 'prop:type': {\n if (annotation.typeFactory) {\n const type = annotation.typeFactory();\n if (type) {\n const childProps = _getLangMap(type);\n for (const [childKey, childValue] of Object.entries(childProps)) {\n acc[`${annotation.propName}.${childKey}`] = childValue;\n }\n }\n }\n break;\n }\n }\n return acc;\n }, {});\n\n return result;\n}\n","import { Type, getAnnotations, DomainModelLangAnnotation } from \"../decorators\";\n\nexport function getModelName<E>(target: Type<E>): string {\n return (getAnnotations(target).find(annotation => {\n return annotation.type === 'model:lang';\n }) as DomainModelLangAnnotation)?.name ?? target.name;\n}\n","import { DomainAnnotation, Type, getAnnotations } from \"../decorators\";\n\nexport function getProps<E>(target: Type<E>, deps = 3, path = ''): string[] {\n return getAnnotations(target).map((annotation: DomainAnnotation) => {\n switch (annotation.type) {\n case 'prop:lang': {\n return `${path}${annotation.propName}`;\n }\n case 'prop:type': {\n if (deps > 0) {\n const type = annotation.typeFactory?.();\n return getProps(type, deps - 1, `${path}${annotation.propName}.`);\n }\n return [];\n }\n default: return [];\n }\n }).flat();\n}\n","import { Transform } from \"class-transformer\";\nimport { parseISO } from \"date-fns\";\nimport dayjs from \"dayjs\";\n\nexport function TransformToDayjs() {\n return Transform(({ value }) => {\n if (typeof value === 'undefined') return undefined;\n if (dayjs(value).isValid()) return dayjs(value);\n return value;\n }, {});\n}\n\nexport function TransformToDate() {\n return Transform(({ value }) => {\n if (typeof value === 'undefined') return undefined;\n if (value === null) return null;\n if (value instanceof Date) return value;\n const date = parseISO(value);\n return date;\n }, {});\n}\n","import { Injectable } from '@angular/core';\nimport { Entity } from './models';\nimport { Observable } from 'rxjs';\n\nexport type PartialWithId<E extends Entity> = Pick<E, 'id'> & Partial<E>;\n\n@Injectable()\nexport abstract class Repository<E extends {id: string}> {\n abstract get(params: {id: string}): Promise<E>;\n abstract list(): Promise<E[]>;\n abstract listChanges(): Observable<E[]>;\n abstract create(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'> & Partial<Pick<E, 'id'>>): Promise<E>;\n abstract createMany(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'>[]): Promise<E[]>;\n abstract update(data: Partial<E> & {id: string}): Promise<void>;\n abstract updateMany(data: Partial<E>[]): Promise<void>;\n abstract save(data: Partial<E>): Promise<boolean | [E, boolean]>;\n abstract saveMany(entities: E[]): Promise<void>;\n abstract delete(params: {id: string}): Promise<void>;\n abstract deleteMany(params: {id: string}[]): Promise<number>;\n abstract deleteAll(): Promise<void>;\n}\n","export abstract class BaseResolver<E> {\n\tprotected entiityMap = new Map<string, Map<string, any>>();\n\n\tprotected makeEntityMap(entities: E[], key: keyof E): Map<string, E>{\n\t\treturn new Map(entities.map((entity) => [entity[key] as string, entity]));\n\t}\n\n\tprotected setEntityMap(name: string, entityMap: Map<string, E>): void {\n\t\tthis.entiityMap.set(name, entityMap);\n\t}\n\n\tprotected getEntityMap(name: string): Map<string, E> {\n\t\treturn this.entiityMap.get(name) as Map<string, E>;\n\t}\n\n\tprotected registerEntityMap(name: string, entities: E[], key: keyof E): void {\n\t\tthis.setEntityMap(name, this.makeEntityMap(entities, key));\n\t}\n\n\tprotected getEntity(name: string, key: string): E {\n\t\treturn this.getEntityMap(name).get(key) as E;\n\t}\n\n\tabstract resolve(entity: any): any;\n\tabstract resolveMany(entities: any[]): any[];\n}\n\n\nexport class Resolver<E> extends BaseResolver<E> {\n\tconstructor(params: Record<string, any[]> = {}) {\n\t\tsuper();\n\t\t// Register entity maps for each entity type in the params\n\t\tconsole.debug('[Resolver] params', params);\n\t\tObject.entries(params).forEach(([entityName, entities]) => {\n\t\t\tif (entities && Array.isArray(entities) && entities.length > 0) {\n\t\t\t\tthis.registerEntityMap(entityName, entities, 'id' as any);\n\t\t\t}\n\t\t});\n\t}\n\n\tresolve(entity: any) {\n\t\tconst result = { ...entity };\n\t\t\n\t\t// Look for properties that end with 'Ids' or 'Id' to resolve related entities\n\t\tObject.keys(entity).forEach(key => {\n\t\t\t// Handle plural relationships (e.g., invoiceIds -> invoices)\n\t\t\tif (key.endsWith('Ids') && Array.isArray(entity[key])) {\n\t\t\t\tconst baseName = key.replace(/Ids$/, '');\n\t\t\t\t// 英語の複数形ルールを考慮する\n\t\t\t\tlet entityName;\n\t\t\t\t// companyのような語尾がyで終わる場合はiesに変換\n\t\t\t\tif (baseName.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(baseName.charAt(baseName.length - 2))) {\n\t\t\t\t\tentityName = baseName.slice(0, -1) + 'ies';\n\t\t\t\t}\n\t\t\t\t// すでに語尾がsやxなどの場合はesを追加\n\t\t\t\telse if (['s', 'x', 'z', 'ch', 'sh'].some(ending => baseName.endsWith(ending))) {\n\t\t\t\t\tentityName = baseName + 'es';\n\t\t\t\t}\n\t\t\t\t// それ以外は単純にsを追加\n\t\t\t\telse {\n\t\t\t\t\tentityName = baseName + 's';\n\t\t\t\t}\n\t\t\t\tconst entityMap = this.getEntityMap(entityName);\n\t\t\t\t\n\t\t\t\tif (entityMap) {\n\t\t\t\t\tconst resolvedEntities = entity[key].map((id: string) => this.getEntity(entityName, id));\n\t\t\t\t\tresult[entityName] = resolvedEntities;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Handle singular relationships (e.g., addressId -> address)\n\t\t\telse if (key.endsWith('Id') && !key.endsWith('Ids') && typeof entity[key] === 'string') {\n\t\t\t\tconst baseName = key.replace(/Id$/, '');\n\t\t\t\t\n\t\t\t\t// 英語の複数形ルールを考慮して複数形を生成\n\t\t\t\tlet pluralEntityName;\n\t\t\t\t// companyのような語尾がyで終わる場合はiesに変換\n\t\t\t\tif (baseName.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(baseName.charAt(baseName.length - 2))) {\n\t\t\t\t\tpluralEntityName = baseName.slice(0, -1) + 'ies';\n\t\t\t\t}\n\t\t\t\t// すでに語尾がsやxなどの場合はesを追加\n\t\t\t\telse if (['s', 'x', 'z', 'ch', 'sh'].some(ending => baseName.endsWith(ending))) {\n\t\t\t\t\tpluralEntityName = baseName + 'es';\n\t\t\t\t}\n\t\t\t\t// それ以外は単純にsを追加\n\t\t\t\telse {\n\t\t\t\t\tpluralEntityName = baseName + 's';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// まず複数形でエンティティを探す\n\t\t\t\tlet entityMap = this.getEntityMap(pluralEntityName);\n\t\t\t\t\n\t\t\t\tif (entityMap) {\n\t\t\t\t\tconst resolvedEntity = this.getEntity(pluralEntityName, entity[key]);\n\n\t\t\t\t\tif (resolvedEntity) {\n\t\t\t\t\t\tresult[baseName] = resolvedEntity;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// 複数形で見つからない場合は単数形を試す\n\t\t\t\t\tentityMap = this.getEntityMap(baseName);\n\t\t\t\t\tif (entityMap) {\n\t\t\t\t\t\tconst resolvedEntity = this.getEntity(baseName, entity[key]);\n\t\t\t\t\t\tif (resolvedEntity) {\n\t\t\t\t\t\t\tresult[baseName] = resolvedEntity;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn result;\n\t}\n\n\tresolveMany(entities: any[]) {\n\t\treturn entities.map(entity => this.resolve(entity));\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AA6CM,SAAU,cAAc,CAAI,MAAe,EAAA;IAC/C,OAAQ,MAAc,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE;AACpD;MAGa,MAAM,CAAA;AACjB,IAAA,OAAgB,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC;IAEnD,OAAO,IAAI,CAAC,IAAY,EAAA;AACtB,QAAA,OAAO,CAAC,MAAW,EAAE,QAAgB,KAAI;AACvC,YAAA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":"nx-ddd-common-domain.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/domain/models/decorators/decorators.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/entity/entity.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-entity-name/get-entity-name.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-lang-map/get-lang-map.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-model-name/get-model-name.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/get-props/get-props.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/models/transformers/index.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/repository.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/resolver/resolver.ts","../../../../../packages/@nx-ddd/common/src/lib/domain/nx-ddd-common-domain.ts"],"sourcesContent":["export type Type<E> = { new(...args: any[]): E};\nexport type DomainLangMap<Entity> = Partial<{[K in keyof Entity]: string}>\n\ninterface Target {\n constructor: {\n [Domain.ANNOTATIONS]?: DomainAnnotation[];\n }\n}\n\nexport type OmitGetter<T> = {\n [P in keyof T as string extends P ? never : number extends P ? never : P]: T[P];\n};\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: DeepPartial<T[P]>;\n};\n\ninterface BaseDomainAnnotation {\n type: 'model:lang' | 'prop:lang' | 'prop:type';\n}\n\nexport interface DomainModelLangAnnotation extends BaseDomainAnnotation {\n type: 'model:lang';\n modelName: string;\n name: string;\n typeFactory?: () => any;\n}\n\nexport interface DomainPropLangAnnotation extends BaseDomainAnnotation {\n type: 'prop:lang';\n propName: string;\n name: string;\n}\n\nexport interface DomainPropTypeAnnotation extends BaseDomainAnnotation {\n type: 'prop:type';\n propName: string;\n typeFactory: () => any;\n}\n\nexport type DomainAnnotation = DomainModelLangAnnotation\n | DomainPropLangAnnotation\n | DomainPropTypeAnnotation;\n\n\nexport function getAnnotations<E>(target: Type<E>): DomainAnnotation[] {\n return (target as any)?.[Domain.ANNOTATIONS] ?? [];\n}\n\n\nexport class Domain {\n static readonly ANNOTATIONS = Symbol('annotations');\n\n static Lang(name: string) {\n return (target: any, propName: string) => {\n this.registerAnnotation(target.constructor, {propName, type: 'prop:lang', name});\n };\n }\n\n static Type<T>(typeFactory?: () => T) {\n return (target: any, propName: string) => {\n if (!typeFactory) {\n const type = Reflect.getMetadata('design:type', target as any, propName);\n typeFactory = () => type;\n }\n this.registerAnnotation(target.constructor, {propName, typeFactory, type: 'prop:type'});\n };\n }\n\n \n static Entity(propsOrName: {name: string} | string) {\n const props = typeof propsOrName === 'string' ? {name: propsOrName} : propsOrName;\n return (target: any) => {\n this.registerAnnotation(target, {name: props.name, type: 'model:lang', modelName: target.name});\n };\n }\n\n static registerAnnotation(constructor: Target['constructor'], annotation: DomainAnnotation) {\n constructor[this.ANNOTATIONS] ??= [];\n constructor[this.ANNOTATIONS]!.push(annotation);\n }\n}","import { toObject } from '@nx-ddd/common';\n\nexport interface Entity<Id = string> {\n id: Id | null;\n}\n\nexport class Entity { \n static fromObj<T extends Entity = Entity>(obj: object): T {\n return Object.assign(new this(), {\n id: null,\n createdAt: null,\n updatedAt: null,\n ...obj\n }) as never as T;\n }\n\n static toObj(entity: Entity): Entity {\n return toObject(entity) as Entity;\n }\n}\n","import { DomainModelLangAnnotation, getAnnotations, Type } from '../decorators';\n\nexport function getEntityName<E>(target: Type<E>): string {\n return (getAnnotations(target).find(annotation => {\n return annotation.type === 'model:lang';\n }) as DomainModelLangAnnotation)?.name ?? target.name;\n}\n","import { flatten } from \"flat\";\nimport { merge } from \"lodash-es\";\nimport { DomainAnnotation, Type, getAnnotations } from '../decorators';\n\n\nexport type LangMap<E> = Partial<Record<keyof E | string, string>>;\n\nexport function getLangMap<E>(domain: Type<E>, mergeObj: object = {}): LangMap<E> {\n return flatten(merge(_getLangMap(domain), mergeObj));\n}\n\nfunction _getLangMap<E>(target: Type<E>): Record<string, any> {\n const result = getAnnotations(target).reduce((acc: Record<string, any>, annotation: DomainAnnotation) => {\n switch(annotation.type) {\n case 'prop:lang': {\n acc[annotation.propName] = annotation.name;\n break;\n }\n case 'prop:type': {\n if (annotation.typeFactory) {\n const type = annotation.typeFactory();\n if (type) {\n const childProps = _getLangMap(type);\n for (const [childKey, childValue] of Object.entries(childProps)) {\n acc[`${annotation.propName}.${childKey}`] = childValue;\n }\n }\n }\n break;\n }\n }\n return acc;\n }, {});\n\n return result;\n}\n","import { Type, getAnnotations, DomainModelLangAnnotation } from \"../decorators\";\n\nexport function getModelName<E>(target: Type<E>): string {\n return (getAnnotations(target).find(annotation => {\n return annotation.type === 'model:lang';\n }) as DomainModelLangAnnotation)?.name ?? target.name;\n}\n","import { DomainAnnotation, Type, getAnnotations } from \"../decorators\";\n\nexport function getProps<E>(target: Type<E>, deps = 3, path = ''): string[] {\n return getAnnotations(target).map((annotation: DomainAnnotation) => {\n switch (annotation.type) {\n case 'prop:lang': {\n return `${path}${annotation.propName}`;\n }\n case 'prop:type': {\n if (deps > 0) {\n const type = annotation.typeFactory?.();\n return getProps(type, deps - 1, `${path}${annotation.propName}.`);\n }\n return [];\n }\n default: return [];\n }\n }).flat();\n}\n","import { Transform } from \"class-transformer\";\nimport { parseISO } from \"date-fns\";\nimport dayjs from \"dayjs\";\n\nexport function TransformToDayjs() {\n return Transform(({ value }) => {\n if (typeof value === 'undefined') return undefined;\n if (dayjs(value).isValid()) return dayjs(value);\n return value;\n }, {});\n}\n\nexport function TransformToDate() {\n return Transform(({ value }) => {\n if (typeof value === 'undefined') return undefined;\n if (value === null) return null;\n if (value instanceof Date) return value;\n const date = parseISO(value);\n return date;\n }, {});\n}\n","import { Injectable } from '@angular/core';\nimport { Entity } from './models';\nimport { Observable } from 'rxjs';\n\nexport type PartialWithId<E extends Entity> = Pick<E, 'id'> & Partial<E>;\n\n@Injectable()\nexport abstract class Repository<E extends {id: string}> {\n abstract get(params: {id: string}): Promise<E>;\n abstract list(): Promise<E[]>;\n abstract listChanges(): Observable<E[]>;\n abstract create(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'> & Partial<Pick<E, 'id'>>): Promise<E>;\n abstract createMany(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'>[]): Promise<E[]>;\n abstract update(data: Partial<E> & {id: string}): Promise<void>;\n abstract updateMany(data: Partial<E>[]): Promise<void>;\n abstract save(data: Partial<E>): Promise<boolean | [E, boolean]>;\n abstract saveMany(entities: E[]): Promise<void>;\n abstract delete(params: {id: string}): Promise<void>;\n abstract deleteMany(params: {id: string}[]): Promise<number>;\n abstract deleteAll(): Promise<void>;\n}\n","export abstract class BaseResolver<E> {\n\tprotected entiityMap = new Map<string, Map<string, any>>();\n\n\tprotected makeEntityMap(entities: E[], key: keyof E): Map<string, E>{\n\t\treturn new Map(entities.map((entity) => [entity[key] as string, entity]));\n\t}\n\n\tprotected setEntityMap(name: string, entityMap: Map<string, E>): void {\n\t\tthis.entiityMap.set(name, entityMap);\n\t}\n\n\tprotected getEntityMap(name: string): Map<string, E> {\n\t\treturn this.entiityMap.get(name) as Map<string, E>;\n\t}\n\n\tprotected registerEntityMap(name: string, entities: E[], key: keyof E): void {\n\t\tthis.setEntityMap(name, this.makeEntityMap(entities, key));\n\t}\n\n\tprotected getEntity(name: string, key: string): E {\n\t\treturn this.getEntityMap(name).get(key) as E;\n\t}\n\n\tabstract resolve(entity: any): any;\n\tabstract resolveMany(entities: any[]): any[];\n}\n\n\nexport class Resolver<E> extends BaseResolver<E> {\n\tconstructor(params: Record<string, any[]> = {}) {\n\t\tsuper();\n\t\t\n\t\tconsole.debug('[Resolver] params', params);\n\t\tObject.entries(params).forEach(([entityName, entities]) => {\n\t\t\tif (entities && Array.isArray(entities) && entities.length > 0) {\n\t\t\t\tthis.registerEntityMap(entityName, entities, 'id' as any);\n\t\t\t}\n\t\t});\n\t}\n\n\tresolve(entity: any) {\n\t\tconst result = { ...entity };\n\t\t\n\t\t\n\t\tObject.keys(entity).forEach(key => {\n\t\t\t\n\t\t\tif (key.endsWith('Ids') && Array.isArray(entity[key])) {\n\t\t\t\tconst baseName = key.replace(/Ids$/, '');\n\t\t\t\t\n\t\t\t\tlet entityName;\n\t\t\t\t\n\t\t\t\tif (baseName.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(baseName.charAt(baseName.length - 2))) {\n\t\t\t\t\tentityName = baseName.slice(0, -1) + 'ies';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if (['s', 'x', 'z', 'ch', 'sh'].some(ending => baseName.endsWith(ending))) {\n\t\t\t\t\tentityName = baseName + 'es';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tentityName = baseName + 's';\n\t\t\t\t}\n\t\t\t\tconst entityMap = this.getEntityMap(entityName);\n\t\t\t\t\n\t\t\t\tif (entityMap) {\n\t\t\t\t\tconst resolvedEntities = entity[key].map((id: string) => this.getEntity(entityName, id));\n\t\t\t\t\tresult[entityName] = resolvedEntities;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\telse if (key.endsWith('Id') && !key.endsWith('Ids') && typeof entity[key] === 'string') {\n\t\t\t\tconst baseName = key.replace(/Id$/, '');\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tlet pluralEntityName;\n\t\t\t\t\n\t\t\t\tif (baseName.endsWith('y') && !['a', 'e', 'i', 'o', 'u'].includes(baseName.charAt(baseName.length - 2))) {\n\t\t\t\t\tpluralEntityName = baseName.slice(0, -1) + 'ies';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if (['s', 'x', 'z', 'ch', 'sh'].some(ending => baseName.endsWith(ending))) {\n\t\t\t\t\tpluralEntityName = baseName + 'es';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse {\n\t\t\t\t\tpluralEntityName = baseName + 's';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tlet entityMap = this.getEntityMap(pluralEntityName);\n\t\t\t\t\n\t\t\t\tif (entityMap) {\n\t\t\t\t\tconst resolvedEntity = this.getEntity(pluralEntityName, entity[key]);\n\n\t\t\t\t\tif (resolvedEntity) {\n\t\t\t\t\t\tresult[baseName] = resolvedEntity;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tentityMap = this.getEntityMap(baseName);\n\t\t\t\t\tif (entityMap) {\n\t\t\t\t\t\tconst resolvedEntity = this.getEntity(baseName, entity[key]);\n\t\t\t\t\t\tif (resolvedEntity) {\n\t\t\t\t\t\t\tresult[baseName] = resolvedEntity;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn result;\n\t}\n\n\tresolveMany(entities: any[]) {\n\t\treturn entities.map(entity => this.resolve(entity));\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AA6CM,SAAU,cAAc,CAAI,MAAe,EAAA;IAC/C,OAAQ,MAAc,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE;AACpD;MAGa,MAAM,CAAA;AACjB,IAAA,OAAgB,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC;IAEnD,OAAO,IAAI,CAAC,IAAY,EAAA;AACtB,QAAA,OAAO,CAAC,MAAW,EAAE,QAAgB,KAAI;AACvC,YAAA,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;AAClF,QAAA,CAAC;IACH;IAEA,OAAO,IAAI,CAAI,WAAqB,EAAA;AAClC,QAAA,OAAO,CAAC,MAAW,EAAE,QAAgB,KAAI;YACvC,IAAI,CAAC,WAAW,EAAE;AAChB,gBAAA,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAa,EAAE,QAAQ,CAAC;AACxE,gBAAA,WAAW,GAAG,MAAM,IAAI;YAC1B;AACA,YAAA,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,WAAW,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AC,gBAAgB,CAAC;gBAEnD,IAAI,SAAS,EAAE;AACd,oBAAA,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;oBAEpE,IAAI,cAAc,EAAE;AACnB,wBAAA,MAAM,CAAC,QAAQ,CAAC,GAAG,cAAc;oBAClC;gBACD;qBAAO;AAEN,oBAAA,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;oBACvC,IAAI,SAAS,EAAE;AACd,wBAAA,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;wBAC5D,IAAI,cAAc,EAAE;AACnB,4BAAA,MAAM,CAAC,QAAQ,CAAC,GAAG,cAAc;wBAClC;oBACD;gBACD;YACD;AACD,QAAA,CAAC,CAAC;AAEF,QAAA,OAAO,MAAM;IACd;AAEA,IAAA,WAAW,CAAC,QAAe,EAAA;AAC1B,QAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD;AACA;;ACpHD;;AAEG;;;;"}
|
|
@@ -18,7 +18,6 @@ class ChromiumService {
|
|
|
18
18
|
'--disable-gpu',
|
|
19
19
|
'--disable-software-rasterizer',
|
|
20
20
|
];
|
|
21
|
-
// executablePathの決定: config > @sparticuz/chromium > undefined(省略)
|
|
22
21
|
let executablePath;
|
|
23
22
|
if (this.config.executablePath) {
|
|
24
23
|
executablePath = this.config.executablePath;
|
|
@@ -31,7 +30,6 @@ class ChromiumService {
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
catch (e) {
|
|
34
|
-
// @sparticuz/chromiumが使えない環境では無視
|
|
35
33
|
console.debug('[@sparticuz/chromium not available, using system chromium');
|
|
36
34
|
}
|
|
37
35
|
}
|
|
@@ -41,7 +39,6 @@ class ChromiumService {
|
|
|
41
39
|
args: this.config.args || defaultArgs
|
|
42
40
|
}, options);
|
|
43
41
|
console.debug('[ChromiumService] launchOptions:', launchOptions);
|
|
44
|
-
// executablePathが有効な値の場合のみ設定
|
|
45
42
|
if (executablePath) {
|
|
46
43
|
launchOptions.executablePath = executablePath;
|
|
47
44
|
}
|
|
@@ -56,7 +53,6 @@ class ChromiumService {
|
|
|
56
53
|
finally {
|
|
57
54
|
try {
|
|
58
55
|
await browser.close();
|
|
59
|
-
// Cloud Functions環境での確実な終了のため
|
|
60
56
|
if (browser.isConnected()) {
|
|
61
57
|
console.warn('Browser still connected after close, forcing disconnect');
|
|
62
58
|
await browser.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-chromium-impl.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/chromium/impl/chromium.service.impl.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/chromium/impl/nx-ddd-common-infrastructure-externals-chromium-impl.ts"],"sourcesContent":["import { EnvironmentProviders, Injectable, makeEnvironmentProviders } from \"@angular/core\";\nimport { makeDI } from \"@nx-ddd/core\";\nimport { CHROMIUM } from \"@nx-ddd/common/infrastructure/externals/chromium/token\";\nimport { Browser, chromium, LaunchOptions } from \"playwright\";\nimport Chromium from '@sparticuz/chromium';\nimport { merge } from \"lodash-es\";\n\nexport interface ChromiumConfig {\n headless: boolean;\n args?: string[];\n executablePath?: string;\n}\n\nexport const CHROMIUM_CONFIG = makeDI<ChromiumConfig>('[@nx-ddd/common] ChromiumConfig', {optional: false});\n\n@Injectable({providedIn: 'root'})\nexport class ChromiumService {\n protected readonly config = CHROMIUM_CONFIG.inject()!;\n\n async start<R = any>(\n callback: (browser: Browser) => Promise<R>,\n options: LaunchOptions = {}\n ): Promise<R> {\n const defaultArgs = [\n '--no-sandbox',\n '--disable-setuid-sandbox',\n '--disable-dev-shm-usage',\n '--disable-extensions',\n '--disable-gpu',\n '--disable-software-rasterizer',\n ];\n\n
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-chromium-impl.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/chromium/impl/chromium.service.impl.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/chromium/impl/nx-ddd-common-infrastructure-externals-chromium-impl.ts"],"sourcesContent":["import { EnvironmentProviders, Injectable, makeEnvironmentProviders } from \"@angular/core\";\nimport { makeDI } from \"@nx-ddd/core\";\nimport { CHROMIUM } from \"@nx-ddd/common/infrastructure/externals/chromium/token\";\nimport { Browser, chromium, LaunchOptions } from \"playwright\";\nimport Chromium from '@sparticuz/chromium';\nimport { merge } from \"lodash-es\";\n\nexport interface ChromiumConfig {\n headless: boolean;\n args?: string[];\n executablePath?: string;\n}\n\nexport const CHROMIUM_CONFIG = makeDI<ChromiumConfig>('[@nx-ddd/common] ChromiumConfig', {optional: false});\n\n@Injectable({providedIn: 'root'})\nexport class ChromiumService {\n protected readonly config = CHROMIUM_CONFIG.inject()!;\n\n async start<R = any>(\n callback: (browser: Browser) => Promise<R>,\n options: LaunchOptions = {}\n ): Promise<R> {\n const defaultArgs = [\n '--no-sandbox',\n '--disable-setuid-sandbox',\n '--disable-dev-shm-usage',\n '--disable-extensions',\n '--disable-gpu',\n '--disable-software-rasterizer',\n ];\n\n \n let executablePath: string | undefined;\n if (this.config.executablePath) {\n executablePath = this.config.executablePath;\n } else {\n try {\n const sparticzuPath = await Chromium.executablePath();\n if (sparticzuPath) {\n executablePath = sparticzuPath;\n }\n } catch (e) {\n \n console.debug('[@sparticuz/chromium not available, using system chromium');\n }\n }\n\n const launchOptions: LaunchOptions = merge({\n headless: this.config.headless,\n timeout: 60 * 1000,\n args: this.config.args || defaultArgs\n }, options);\n\n console.debug('[ChromiumService] launchOptions:', launchOptions);\n\n \n if (executablePath) {\n launchOptions.executablePath = executablePath;\n }\n\n const browser = await chromium.launch(launchOptions);\n try {\n const result = await callback(browser);\n return result;\n } catch(error) {\n throw error;\n } finally {\n try {\n await browser.close();\n \n if (browser.isConnected()) {\n console.warn('Browser still connected after close, forcing disconnect');\n await browser.close();\n }\n } catch (closeError) {\n console.error('Error closing browser:', closeError);\n }\n }\n }\n}\n\nexport function provideChromium(useFactory: () => ChromiumConfig = () => ({headless: true})): EnvironmentProviders {\n return makeEnvironmentProviders([\n CHROMIUM_CONFIG.provide(useFactory),\n CHROMIUM.provide(() => new ChromiumService()),\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAaO,MAAM,eAAe,GAAG,MAAM,CAAiB,iCAAiC,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC;MAG7F,eAAe,CAAA;AACP,IAAA,MAAM,GAAG,eAAe,CAAC,MAAM,EAAG;AAErD,IAAA,MAAM,KAAK,CACT,QAA0C,EAC1C,UAAyB,EAAE,EAAA;AAE3B,QAAA,MAAM,WAAW,GAAG;YAClB,cAAc;YACd,0BAA0B;YAC1B,yBAAyB;YACzB,sBAAsB;YACtB,eAAe;YACf,+BAA+B;SAChC;AAGD,QAAA,IAAI,cAAkC;AACtC,QAAA,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;AAC9B,YAAA,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc;QAC7C;aAAO;AACL,YAAA,IAAI;AACF,gBAAA,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,cAAc,EAAE;gBACrD,IAAI,aAAa,EAAE;oBACjB,cAAc,GAAG,aAAa;gBAChC;YACF;YAAE,OAAO,CAAC,EAAE;AAEV,gBAAA,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC;YAC5E;QACF;QAEA,MAAM,aAAa,GAAkB,KAAK,CAAC;AACzC,YAAA,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC9B,OAAO,EAAE,EAAE,GAAG,IAAI;AAClB,YAAA,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,I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AAC,OAAO,CAAC,UAAU,CAAC;QACnC,QAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,eAAe,EAAE,CAAC;AAC9C,KAAA,CAAC;AACJ;;ACvFA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-cloud-storage.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/cloud-storage/cloud-storage.service.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/cloud-storage/nx-ddd-common-infrastructure-externals-cloud-storage.ts"],"sourcesContent":["import { inject, signal, Injectable } from '@angular/core';\nimport { Storage, UploadTask, getDownloadURL, ref, uploadBytesResumable } from '@angular/fire/storage';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { Observable, of, switchMap } from 'rxjs';\n\n@Injectable({providedIn: 'any'})\nexport class CloudStorageService {\n private storage = inject(Storage);\n private task = signal<UploadTask | null>(null);\n private task$ = toObservable(this.task);\n\n readonly progress = toSignal(this.task$.pipe(\n switchMap(task => task ? this.convertToObservable(task) : of(null)),\n
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-cloud-storage.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/cloud-storage/cloud-storage.service.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/cloud-storage/nx-ddd-common-infrastructure-externals-cloud-storage.ts"],"sourcesContent":["import { inject, signal, Injectable } from '@angular/core';\nimport { Storage, UploadTask, getDownloadURL, ref, uploadBytesResumable } from '@angular/fire/storage';\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop';\nimport { Observable, of, switchMap } from 'rxjs';\n\n@Injectable({providedIn: 'any'})\nexport class CloudStorageService {\n private storage = inject(Storage);\n private task = signal<UploadTask | null>(null);\n private task$ = toObservable(this.task);\n\n readonly progress = toSignal(this.task$.pipe(\n switchMap(task => task ? this.convertToObservable(task) : of(null)),\n \n ));\n readonly progress$ = toObservable(this.progress);\n\n getDownloadUrl(filePath: string) {\n return getDownloadURL(ref(this.storage, filePath));\n }\n\n private convertToObservable(task: UploadTask): Observable<number | null> {\n return new Observable<number | null>(sub => {\n task.on('state_changed', snapshot => sub.next(snapshot.bytesTransferred / snapshot.totalBytes * 100));\n task.then(() => (sub.next(null), sub.complete()));\n });\n }\n\n upload(path: string, file: File) {\n this.cancel();\n const storageRef = ref(this.storage, path);\n const task = uploadBytesResumable(storageRef, file);\n this.task.set(task);\n return task;\n }\n\n cancel() {\n this.task()?.cancel();\n this.task.set(null);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAMa,mBAAmB,CAAA;AACtB,IAAA,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,GAAG,MAAM,CAAoB,IAAI,gDAAC;AACtC,IAAA,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;AAE9B,IAAA,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAC1C,SAAS,CAAC,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAEpE,CAAC;AACO,IAAA,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC;AAEhD,IAAA,cAAc,CAAC,QAAgB,EAAA;QAC7B,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACpD;AAEQ,IAAA,mBAAmB,CAAC,IAAgB,EAAA;AAC1C,QAAA,OAAO,IAAI,UAAU,CAAgB,GAAG,IAAG;YACzC,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,GAAG,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;YACrG,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;AACnD,QAAA,CAAC,CAAC;IACJ;IAEA,MAAM,CAAC,IAAY,EAAE,IAAU,EAAA;QAC7B,IAAI,CAAC,MAAM,EAAE;QACb,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;QAC1C,MAAM,IAAI,GAAG,oBAAoB,CAAC,UAAU,EAAE,IAAI,CAAC;AACnD,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;AACnB,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,GAAA;AACJ,QAAA,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE;AACrB,QAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACrB;uGAjCW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADP,KAAK,EAAA,CAAA;;2FACjB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAC,UAAU,EAAE,KAAK,EAAC;;;ACL/B;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-impl-browser.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/browser/provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/browser/nx-ddd-common-infrastructure-externals-crypto-impl-browser.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { CRYPTO } from '@nx-ddd/common/infrastructure/externals/crypto/token';\
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-impl-browser.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/browser/provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/browser/nx-ddd-common-infrastructure-externals-crypto-impl-browser.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { CRYPTO } from '@nx-ddd/common/infrastructure/externals/crypto/token';\n\nexport function provideCrypto(): Provider {\n return CRYPTO.provide(() => crypto);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;SAGgB,aAAa,GAAA;IAC3B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,MAAM,CAAC;AACrC;;ACLA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-impl-server.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/server/provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/server/nx-ddd-common-infrastructure-externals-crypto-impl-server.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { CRYPTO } from '@nx-ddd/common/infrastructure/externals/crypto/token';\nimport { webcrypto } from 'crypto';\n\nexport function provideCrypto(): Provider {\n return CRYPTO.provide(() => webcrypto);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;SAIgB,aAAa,GAAA;IAC3B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-impl-server.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/server/provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/server/nx-ddd-common-infrastructure-externals-crypto-impl-server.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { CRYPTO } from '@nx-ddd/common/infrastructure/externals/crypto/token';\nimport { webcrypto } from 'crypto';\n\nexport function provideCrypto(): Provider {\n return CRYPTO.provide(() => webcrypto as unknown as Crypto);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;SAIgB,aAAa,GAAA;IAC3B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,SAA8B,CAAC;AAC7D;;ACNA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-token.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/nx-ddd-common-infrastructure-externals-crypto-token.ts"],"sourcesContent":["import { makeDI } from '@nx-ddd/core';\
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-token.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/nx-ddd-common-infrastructure-externals-crypto-token.ts"],"sourcesContent":["import { makeDI } from '@nx-ddd/core';\n\nexport const CRYPTO = makeDI<Crypto>('[@nx-dd/common] Crypto');\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;MAEa,MAAM,GAAG,MAAM,CAAS,wBAAwB;;ACF7D;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/nx-ddd-common-infrastructure-externals-crypto.ts"],"sourcesContent":["import { makeDI } from '@nx-ddd/core';\
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/nx-ddd-common-infrastructure-externals-crypto.ts"],"sourcesContent":["import { makeDI } from '@nx-ddd/core';\n\nexport const CRYPTO = makeDI<Crypto>('[@nx-dd/common] Crypto');\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;MAEa,MAAM,GAAG,MAAM,CAAS,wBAAwB;;ACF7D;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-stripe-impl.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/stripe/impl/stripe.service.impl.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/stripe/impl/stripe.config.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/stripe/impl/nx-ddd-common-infrastructure-externals-stripe-impl.ts"],"sourcesContent":["import { Inject, Injectable } from '@angular/core';\nimport { STRIPE_CONFIG, StripeConfig } from './stripe.config';\nimport Stripe from \"stripe\";\n\n@Injectable()\nexport class StripeServiceImpl extends Stripe {\n constructor(\n @Inject(STRIPE_CONFIG) config: StripeConfig,\n ) {\n super(config.secretKey);\n }\n}\n\n
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-stripe-impl.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/stripe/impl/stripe.service.impl.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/stripe/impl/stripe.config.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/stripe/impl/nx-ddd-common-infrastructure-externals-stripe-impl.ts"],"sourcesContent":["import { Inject, Injectable } from '@angular/core';\nimport { STRIPE_CONFIG, StripeConfig } from './stripe.config';\nimport Stripe from \"stripe\";\n\n@Injectable()\nexport class StripeServiceImpl extends Stripe {\n constructor(\n @Inject(STRIPE_CONFIG) config: StripeConfig,\n ) {\n super(config.secretKey);\n }\n}\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","import { InjectionToken, Injector } from \"@angular/core\";\nimport { StripeServiceImpl } from \"./stripe.service.impl\";\nimport { STRIPE_SERVICE } from \"@nx-ddd/common/infrastructure/externals/stripe/token\";\n\nexport interface StripeConfig {\n secretKey: string;\n}\n\nexport const STRIPE_CONFIG = new InjectionToken<StripeConfig>('STRIPE_CONFIG');\n\nexport function provideStripe(configFactory: (injector: Injector) => StripeConfig) {\n return [\n { provide: STRIPE_SERVICE, useClass: StripeServiceImpl, deps: [STRIPE_CONFIG] },\n { provide: STRIPE_CONFIG, useFactory: configFactory, deps: [Injector] },\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAKM,MAAO,iBAAkB,SAAQ,MAAM,CAAA;AAC3C,IAAA,WAAA,CACyB,MAAoB,EAAA;AAE3C,QAAA,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;IACzB;AALW,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,kBAElB,aAAa,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAFZ,iBAAiB,EAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAD7B;;0BAGI,MAAM;2BAAC,aAAa;;;MCCZ,aAAa,GAAG,IAAI,cAAc,CAAe,eAAe;AAEvE,SAAU,aAAa,CAAC,aAAmD,EAAA;IAC/E,OAAO;AACL,QAAA,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE;AAC/E,QAAA,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;KACxE;AACH;;ACfA;;AAEG;;;;"}
|
|
@@ -3,7 +3,7 @@ import { WEBSOCKET, WEBSOCKET_SERVER } from '@nx-ddd/common/infrastructure/exter
|
|
|
3
3
|
function provideWebSocket() {
|
|
4
4
|
return [
|
|
5
5
|
WEBSOCKET.provide(() => WebSocket),
|
|
6
|
-
WEBSOCKET_SERVER.provide(() => null),
|
|
6
|
+
WEBSOCKET_SERVER.provide(() => null),
|
|
7
7
|
];
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-websocket-impl-browser.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/browser/browser-websocket.provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/browser/nx-ddd-common-infrastructure-externals-websocket-impl-browser.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { WEBSOCKET, WEBSOCKET_SERVER } from '@nx-ddd/common/infrastructure/externals/websocket/token';\n\nexport function provideWebSocket(): Provider[] {\n return [\n WEBSOCKET.provide(() => WebSocket),\n WEBSOCKET_SERVER.provide(() => null),
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-websocket-impl-browser.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/browser/browser-websocket.provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/browser/nx-ddd-common-infrastructure-externals-websocket-impl-browser.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { WEBSOCKET, WEBSOCKET_SERVER } from '@nx-ddd/common/infrastructure/externals/websocket/token';\n\nexport function provideWebSocket(): Provider[] {\n return [\n WEBSOCKET.provide(() => WebSocket),\n WEBSOCKET_SERVER.provide(() => null), \n ];\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;SAGgB,gBAAgB,GAAA;IAC9B,OAAO;AACL,QAAA,SAAS,CAAC,OAAO,CAAC,MAAM,SAAS,CAAC;AAClC,QAAA,gBAAgB,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;KACrC;AACH;;ACRA;;AAEG;;;;"}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { WEBSOCKET, WEBSOCKET_SERVER } from '@nx-ddd/common/infrastructure/externals/websocket/token';
|
|
2
|
-
import
|
|
2
|
+
import NodeWebSocketImpl from 'ws';
|
|
3
3
|
|
|
4
|
+
function resolveWebSocketImpl() {
|
|
5
|
+
if (typeof globalThis !== 'undefined' && globalThis.WebSocket) {
|
|
6
|
+
return globalThis.WebSocket;
|
|
7
|
+
}
|
|
8
|
+
return NodeWebSocketImpl;
|
|
9
|
+
}
|
|
10
|
+
function resolveWebSocketServerImpl() {
|
|
11
|
+
return NodeWebSocketImpl.Server;
|
|
12
|
+
}
|
|
4
13
|
function provideWebSocket() {
|
|
5
|
-
|
|
6
|
-
if (typeof global !== 'undefined') {
|
|
14
|
+
const WebSocketImpl = resolveWebSocketImpl();
|
|
15
|
+
if (typeof global !== 'undefined' && !global.WebSocket) {
|
|
7
16
|
global.WebSocket = WebSocketImpl;
|
|
8
17
|
}
|
|
9
18
|
return [
|
|
10
|
-
// Type assertion needed because Node.js ws types differ from browser WebSocket types
|
|
11
19
|
WEBSOCKET.provide(() => WebSocketImpl),
|
|
12
|
-
WEBSOCKET_SERVER.provide(() =>
|
|
20
|
+
WEBSOCKET_SERVER.provide(() => resolveWebSocketServerImpl()),
|
|
13
21
|
];
|
|
14
22
|
}
|
|
15
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-websocket-impl-server.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/server/node-websocket.provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/server/nx-ddd-common-infrastructure-externals-websocket-impl-server.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { WEBSOCKET, WEBSOCKET_SERVER } from '@nx-ddd/common/infrastructure/externals/websocket/token';\nimport
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-websocket-impl-server.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/server/node-websocket.provider.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/server/nx-ddd-common-infrastructure-externals-websocket-impl-server.ts"],"sourcesContent":["import { Provider } from '@angular/core';\nimport { WEBSOCKET, WEBSOCKET_SERVER } from '@nx-ddd/common/infrastructure/externals/websocket/token';\nimport NodeWebSocketImpl from 'ws';\n\n\nfunction resolveWebSocketImpl(): unknown {\n if (typeof globalThis !== 'undefined' && (globalThis as { WebSocket?: unknown }).WebSocket) {\n return (globalThis as { WebSocket?: unknown }).WebSocket;\n }\n return NodeWebSocketImpl;\n}\n\nfunction resolveWebSocketServerImpl(): unknown {\n \n \n return (NodeWebSocketImpl as unknown as { Server: unknown }).Server;\n}\n\nexport function provideWebSocket(): Provider[] {\n const WebSocketImpl = resolveWebSocketImpl();\n\n \n \n if (typeof global !== 'undefined' && !(global as { WebSocket?: unknown }).WebSocket) {\n (global as { WebSocket?: unknown }).WebSocket = WebSocketImpl;\n }\n\n return [\n \n WEBSOCKET.provide(() => WebSocketImpl as never),\n WEBSOCKET_SERVER.provide(() => resolveWebSocketServerImpl() as never),\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAKA,SAAS,oBAAoB,GAAA;IAC3B,IAAI,OAAO,UAAU,KAAK,WAAW,IAAK,UAAsC,CAAC,SAAS,EAAE;QAC1F,OAAQ,UAAsC,CAAC,SAAS;IAC1D;AACA,IAAA,OAAO,iBAAiB;AAC1B;AAEA,SAAS,0BAA0B,GAAA;IAGjC,OAAQ,iBAAoD,CAAC,MAAM;AACrE;SAEgB,gBAAgB,GAAA;AAC9B,IAAA,MAAM,aAAa,GAAG,oBAAoB,EAAE;IAI5C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAE,MAAkC,CAAC,SAAS,EAAE;AAClF,QAAA,MAAkC,CAAC,SAAS,GAAG,aAAa;IAC/D;IAEA,OAAO;AAEL,QAAA,SAAS,CAAC,OAAO,CAAC,MAAM,aAAsB,CAAC;QAC/C,gBAAgB,CAAC,OAAO,CAAC,MAAM,0BAA0B,EAAW,CAAC;KACtE;AACH;;AChCA;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/converter.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/synchronizer.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/token/websocket.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/nx-ddd-common-infrastructure.ts"],"sourcesContent":["export abstract class Converter<E> {\n abstract fromRecord(record: object): E\n abstract toRecord(entity: E): object\n}\n","import dayjs from 'dayjs';\nimport { catchError, combineLatest, map, NEVER, Observable, of, retry, shareReplay, switchMap, tap } from 'rxjs';\n\ninterface RepositorySynchronizerConfig<T> {\n listChangesAfter: (updatedAt: dayjs.Dayjs) => Observable<T[]>;\n lastUpdatedAtChanges: () => Observable<dayjs.Dayjs>;\n saveMany: (entities: T[]) => void;\n srcCount: () => Observable<number>;\n destCount: () => Observable<number>;\n}\n\nexport class RepositorySynchronizer<T> {\n constructor(private config: RepositorySynchronizerConfig<T>) { }\n\n readonly progress$ = combineLatest({\n srcCount: of(null).pipe(switchMap(() => this.config.srcCount())),\n destCount: of(null).pipe(switchMap(() => this.config.destCount())),\n }).pipe(\n map(({srcCount, destCount}) => destCount / srcCount),\n shareReplay(1),\n );\n\n sync(): Observable<any[]> {\n return this.config.lastUpdatedAtChanges().pipe(\n switchMap((lastUpdatedAt) => this.config.listChangesAfter(lastUpdatedAt).pipe(\n retry(3),\n tap((updated) => this.config.saveMany(updated)),\n catchError((error) => (console.error(error), NEVER)),\n )),\n );\n }\n}\n","import { makeDI } from '@nx-ddd/core';\
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/converter.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/synchronizer.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/token/websocket.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/nx-ddd-common-infrastructure.ts"],"sourcesContent":["export abstract class Converter<E> {\n abstract fromRecord(record: object): E\n abstract toRecord(entity: E): object\n}\n","import dayjs from 'dayjs';\nimport { catchError, combineLatest, map, NEVER, Observable, of, retry, shareReplay, switchMap, tap } from 'rxjs';\n\ninterface RepositorySynchronizerConfig<T> {\n listChangesAfter: (updatedAt: dayjs.Dayjs) => Observable<T[]>;\n lastUpdatedAtChanges: () => Observable<dayjs.Dayjs>;\n saveMany: (entities: T[]) => void;\n srcCount: () => Observable<number>;\n destCount: () => Observable<number>;\n}\n\nexport class RepositorySynchronizer<T> {\n constructor(private config: RepositorySynchronizerConfig<T>) { }\n\n readonly progress$ = combineLatest({\n srcCount: of(null).pipe(switchMap(() => this.config.srcCount())),\n destCount: of(null).pipe(switchMap(() => this.config.destCount())),\n }).pipe(\n map(({srcCount, destCount}) => destCount / srcCount),\n shareReplay(1),\n );\n\n sync(): Observable<any[]> {\n return this.config.lastUpdatedAtChanges().pipe(\n switchMap((lastUpdatedAt) => this.config.listChangesAfter(lastUpdatedAt).pipe(\n retry(3),\n tap((updated) => this.config.saveMany(updated)),\n catchError((error) => (console.error(error), NEVER)),\n )),\n );\n }\n}\n","import { makeDI } from '@nx-ddd/core';\n\nexport const CRYPTO = makeDI<Crypto>('[@nx-dd/common] Crypto');\n","import { makeDI } from '@nx-ddd/core';\n\nexport const WEBSOCKET = makeDI<typeof WebSocket>('[@nx-ddd/common] WebSocket');\nexport const WEBSOCKET_SERVER = makeDI<any>('[@nx-ddd/common] WebSocket.Server');","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAAsB,SAAS,CAAA;AAG9B;;MCQY,sBAAsB,CAAA;AACb,IAAA,MAAA;AAApB,IAAA,WAAA,CAAoB,MAAuC,EAAA;QAAvC,IAAA,CAAA,MAAM,GAAN,MAAM;IAAqC;IAEtD,SAAS,GAAG,aAAa,CAAC;QACjC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChE,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;KACnE,CAAC,CAAC,IAAI,CACL,GAAG,CAAC,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAC,KAAK,SAAS,GAAG,QAAQ,CAAC,EACpD,WAAW,CAAC,CAAC,CAAC,CACf;IAED,IAAI,GAAA;AACF,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAC5C,SAAS,CAAC,CAAC,aAAa,KAAK,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,IAAI,CAC3E,KAAK,CAAC,CAAC,CAAC,EACR,GAAG,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAC/C,UAAU,CAAC,CAAC,KAAK,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CACrD,CAAC,CACH;IACH;AACD;;MC7BY,MAAM,GAAG,MAAM,CAAS,wBAAwB;;MCAhD,SAAS,GAAG,MAAM,CAAmB,4BAA4B;MACjE,gBAAgB,GAAG,MAAM,CAAM,mCAAmC;;ACH/E;;AAEG;;;;"}
|
|
@@ -22,11 +22,9 @@ function format(strings, ...keys) {
|
|
|
22
22
|
const key = keys[index - 1];
|
|
23
23
|
return `${prev}${key}${current}`;
|
|
24
24
|
});
|
|
25
|
-
// 先頭が開業でなくなるまで改行コードを削除
|
|
26
25
|
while (result.startsWith('\n')) {
|
|
27
26
|
result = result.slice(1);
|
|
28
27
|
}
|
|
29
|
-
// 1行目のインデントの数を取得して、各行のインデントを同じ数削除
|
|
30
28
|
const firstLineIndent = result.match(/^(\s*)/)?.[1];
|
|
31
29
|
if (firstLineIndent) {
|
|
32
30
|
const regExp = new RegExp(`^${firstLineIndent}`);
|
|
@@ -35,7 +33,6 @@ function format(strings, ...keys) {
|
|
|
35
33
|
.map((line) => line.replace(regExp, ''))
|
|
36
34
|
.join('\n');
|
|
37
35
|
}
|
|
38
|
-
// 最初のスペースの数を取得して、各行のスペースを同じ数削除
|
|
39
36
|
return result;
|
|
40
37
|
}
|
|
41
38
|
const message = format;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/utilities/generate-id.ts","../../../../../packages/@nx-ddd/common/src/lib/utilities/message.ts","../../../../../packages/@nx-ddd/common/src/lib/utilities/to-object.ts","../../../../../packages/@nx-ddd/common/src/lib/nx-ddd-common.ts"],"sourcesContent":["interface Options {\n letters: boolean;\n upperCase: boolean;\n numbers: boolean;\n symbols: boolean;\n}\n\nconst defaultOptions: Options = {\n letters: true,\n upperCase: true,\n numbers: true,\n symbols: false,\n}\n\nconst CHARACTERS = {\n letters: 'abcdefghijklmnopqrstuvwxyz',\n upperCase: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n numbers: '0123456789',\n symbols: '!#$%&()',\n};\n\nconst generateRandomString = (n: number, options: Options = defaultOptions): string => {\n const characters = Object.entries(CHARACTERS).filter(([k]) => options[k as keyof Options]).map(([_, v]) => v).join('');\n const genChar = (): string => characters.charAt(Math.floor(Math.random() * characters.length));\n\n return [...Array(n)].map(() => genChar()).join('');\n}\n\nexport const generateId = (n = 20): string => generateRandomString(n);\n","export function format(\n strings: TemplateStringsArray,\n ...keys: (string | number)[]\n): string {\n let result = strings.reduce((prev, current, index) => {\n const key = keys[index - 1];\n return `${prev}${key}${current}`;\n });\n\n
|
|
1
|
+
{"version":3,"file":"nx-ddd-common.mjs","sources":["../../../../../packages/@nx-ddd/common/src/lib/utilities/generate-id.ts","../../../../../packages/@nx-ddd/common/src/lib/utilities/message.ts","../../../../../packages/@nx-ddd/common/src/lib/utilities/to-object.ts","../../../../../packages/@nx-ddd/common/src/lib/nx-ddd-common.ts"],"sourcesContent":["interface Options {\n letters: boolean;\n upperCase: boolean;\n numbers: boolean;\n symbols: boolean;\n}\n\nconst defaultOptions: Options = {\n letters: true,\n upperCase: true,\n numbers: true,\n symbols: false,\n}\n\nconst CHARACTERS = {\n letters: 'abcdefghijklmnopqrstuvwxyz',\n upperCase: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n numbers: '0123456789',\n symbols: '!#$%&()',\n};\n\nconst generateRandomString = (n: number, options: Options = defaultOptions): string => {\n const characters = Object.entries(CHARACTERS).filter(([k]) => options[k as keyof Options]).map(([_, v]) => v).join('');\n const genChar = (): string => characters.charAt(Math.floor(Math.random() * characters.length));\n\n return [...Array(n)].map(() => genChar()).join('');\n}\n\nexport const generateId = (n = 20): string => generateRandomString(n);\n","export function format(\n strings: TemplateStringsArray,\n ...keys: (string | number)[]\n): string {\n let result = strings.reduce((prev, current, index) => {\n const key = keys[index - 1];\n return `${prev}${key}${current}`;\n });\n\n \n while (result.startsWith('\\n')) {\n result = result.slice(1);\n }\n\n \n const firstLineIndent = result.match(/^(\\s*)/)?.[1];\n if (firstLineIndent) {\n const regExp = new RegExp(`^${firstLineIndent}`);\n result = result\n .split('\\n')\n .map((line) => line.replace(regExp, ''))\n .join('\\n');\n }\n \n\n return result;\n}\n\nexport const message = format","const getAllProps = (obj: object, keys: string[] = Object.keys(obj)): string[] => {\n const proto = Object.getPrototypeOf(obj);\n keys = Object.getOwnPropertyNames(proto)\n .filter(v => v !== '__proto__')\n .filter(v => Object.getOwnPropertyDescriptor(proto, v)?.get instanceof Function)\n .concat(keys);\n\n return proto.constructor.name === 'Object' ? keys : getAllProps(proto, keys);\n}\n\nexport const toObject = (obj: object): object => getAllProps(obj).reduce((p, k) => ({...p, [k]: (obj as Record<string, unknown>)[k]}), {});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAOA,MAAM,cAAc,GAAY;AAC9B,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,OAAO,EAAE,KAAK;CACf;AAED,MAAM,UAAU,GAAG;AACjB,IAAA,OAAO,EAAE,4BAA4B;AACrC,IAAA,SAAS,EAAE,4BAA4B;AACvC,IAAA,OAAO,EAAE,YAAY;AACrB,IAAA,OAAO,EAAE,SAAS;CACnB;AAED,MAAM,oBAAoB,GAAG,CAAC,CAAS,EAAE,OAAA,GAAmB,cAAc,KAAY;AACpF,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAkB,CA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;aACtC,IAAI,CAAC,IAAI,CAAC;IACf;AAGA,IAAA,OAAO,MAAM;AACf;AAEO,MAAM,OAAO,GAAG;;AC5BvB,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,IAAA,GAAiB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAc;IAC/E,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC;AACxC,IAAA,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC,KAAK;SACpC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,WAAW;AAC7B,SAAA,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,YAAY,QAAQ;SAC9E,MAAM,CAAC,IAAI,CAAC;IAEf,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC;AAC9E,CAAC;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAW,KAAa,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAI,GAA+B,CAAC,CAAC,CAAC,EAAC,CAAC,EAAE,EAAE;;ACVzI;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-impl-browser.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/browser/provider.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-impl-browser.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/impl/browser/provider.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA,iBAAA,aAAA,IAAA,QAAA;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as _nx_ddd_core from '@nx-ddd/core';
|
|
2
|
-
import { webcrypto } from 'crypto';
|
|
3
2
|
|
|
4
|
-
declare const CRYPTO: _nx_ddd_core.DiToken<
|
|
3
|
+
declare const CRYPTO: _nx_ddd_core.DiToken<Crypto>;
|
|
5
4
|
|
|
6
5
|
export { CRYPTO };
|
|
7
6
|
//# sourceMappingURL=nx-ddd-common-infrastructure-externals-crypto-token.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-token.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto-token.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,cAAA,MAAA,EAAmB,YAAA,CAAA,OAAA,CAAA,MAAA;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as _nx_ddd_core from '@nx-ddd/core';
|
|
2
|
-
import { webcrypto } from 'crypto';
|
|
3
2
|
|
|
4
|
-
declare const CRYPTO: _nx_ddd_core.DiToken<
|
|
3
|
+
declare const CRYPTO: _nx_ddd_core.DiToken<Crypto>;
|
|
5
4
|
|
|
6
5
|
export { CRYPTO };
|
|
7
6
|
//# sourceMappingURL=nx-ddd-common-infrastructure-externals-crypto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-crypto.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,cAAA,MAAA,EAAmB,YAAA,CAAA,OAAA,CAAA,MAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure-externals-websocket-impl-server.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/server/node-websocket.provider.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure-externals-websocket-impl-server.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/impl/server/node-websocket.provider.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAkBA,iBAAA,gBAAA,IAAA,QAAA;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import * as _nx_ddd_core from '@nx-ddd/core';
|
|
4
|
-
import { webcrypto } from 'crypto';
|
|
5
4
|
|
|
6
5
|
declare abstract class Converter<E> {
|
|
7
6
|
abstract fromRecord(record: object): E;
|
|
@@ -22,7 +21,7 @@ declare class RepositorySynchronizer<T> {
|
|
|
22
21
|
sync(): Observable<any[]>;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
declare const CRYPTO: _nx_ddd_core.DiToken<
|
|
24
|
+
declare const CRYPTO: _nx_ddd_core.DiToken<Crypto>;
|
|
26
25
|
|
|
27
26
|
declare const WEBSOCKET: _nx_ddd_core.DiToken<{
|
|
28
27
|
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-common-infrastructure.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/converter.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/synchronizer.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/token/websocket.token.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nx-ddd-common-infrastructure.d.ts","sources":["../../../../../packages/@nx-ddd/common/src/lib/infrastructure/converter.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/synchronizer.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/crypto/token/crypto.token.ts","../../../../../packages/@nx-ddd/common/src/lib/infrastructure/externals/websocket/token/websocket.token.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;;AAAA;AACE;AACA;AACD;;ACAD;AACE;;;AAGA;AACA;AACD;AAED;AACc;AAAQ;;AAUpB;AASD;;AC7BD;;ACAA;;;;;;;;AACA;;"}
|