@nx-ddd/notion 19.51.0 → 19.81.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.
|
@@ -5,13 +5,6 @@ import { InjectionToken, inject, Injectable } from '@angular/core';
|
|
|
5
5
|
import { Client } from '@notionhq/client';
|
|
6
6
|
import { Repository } from '@nx-ddd/common/domain';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Notion API type definitions
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Converts a value to its Notion API representation based on annotation type
|
|
14
|
-
*/
|
|
15
8
|
function toNotionValue(value, annotation) {
|
|
16
9
|
switch (annotation.type) {
|
|
17
10
|
case 'title': return toNotionTitle(value);
|
|
@@ -74,9 +67,6 @@ function toNotionEmail(value) {
|
|
|
74
67
|
return value ? { type: 'email', email: value } : undefined;
|
|
75
68
|
}
|
|
76
69
|
|
|
77
|
-
/**
|
|
78
|
-
* Converts a Notion API value to its JavaScript representation
|
|
79
|
-
*/
|
|
80
70
|
function fromNotionValue(value, annotation) {
|
|
81
71
|
switch (value.type) {
|
|
82
72
|
case 'title': return fromNotionTitle(value);
|
|
@@ -179,13 +169,7 @@ function fromNotionUniqueID(value) {
|
|
|
179
169
|
return value.unique_id.number;
|
|
180
170
|
}
|
|
181
171
|
|
|
182
|
-
// Re-export types for backward compatibility
|
|
183
|
-
/**
|
|
184
|
-
* NotionUtils class for backward compatibility
|
|
185
|
-
* @deprecated Use individual functions from './to-notion' and './from-notion' instead
|
|
186
|
-
*/
|
|
187
172
|
class NotionUtils {
|
|
188
|
-
// toNotion methods
|
|
189
173
|
static toNotionValue = toNotionValue;
|
|
190
174
|
static toNotionTitle = toNotionTitle;
|
|
191
175
|
static toNotionStatus = toNotionStatus;
|
|
@@ -200,7 +184,6 @@ class NotionUtils {
|
|
|
200
184
|
static toNotionPhoneNumber = toNotionPhoneNumber;
|
|
201
185
|
static toNotionNumber = toNotionNumber;
|
|
202
186
|
static toNotionEmail = toNotionEmail;
|
|
203
|
-
// fromNotion methods
|
|
204
187
|
static fromNotionValue = fromNotionValue;
|
|
205
188
|
static fromNotionTitle = fromNotionTitle;
|
|
206
189
|
static fromNotionUrl = fromNotionUrl;
|
|
@@ -249,27 +232,11 @@ const Select = createDecorator('select');
|
|
|
249
232
|
const PhoneNumber = createDecorator('phone_number');
|
|
250
233
|
const Email = createDecorator('email');
|
|
251
234
|
const UniqueID = createDecorator('unique_id');
|
|
252
|
-
// Not implemented below props!
|
|
253
|
-
// export const Checkbox = createDecorator('checkbox');
|
|
254
|
-
// export const CreatedBy = createDecorator('created_by');
|
|
255
|
-
// export const Files = createDecorator('files');
|
|
256
|
-
// export const LastEditedBy = createDecorator('last_edited_by');
|
|
257
|
-
// export const MultiSelect = createDecorator('multi_select');
|
|
258
|
-
// export const People = createDecorator('people');
|
|
259
|
-
/**
|
|
260
|
-
* Class decorator to specify Notion database ID
|
|
261
|
-
* @param databaseId - The Notion database ID
|
|
262
|
-
*/
|
|
263
235
|
function Database(databaseId) {
|
|
264
236
|
return (target) => {
|
|
265
237
|
target[NOTION_DATABASE_ANNOTATION] = databaseId;
|
|
266
238
|
};
|
|
267
239
|
}
|
|
268
|
-
/**
|
|
269
|
-
* Get database ID from class decorator
|
|
270
|
-
* @param target - Entity class with @Notion.Database decorator
|
|
271
|
-
* @returns Database ID or undefined if not decorated
|
|
272
|
-
*/
|
|
273
240
|
function getDatabaseId(target) {
|
|
274
241
|
return target[NOTION_DATABASE_ANNOTATION];
|
|
275
242
|
}
|
|
@@ -361,7 +328,6 @@ class N {
|
|
|
361
328
|
}
|
|
362
329
|
static Status(property, evaluation, value) {
|
|
363
330
|
const query = evaluation === '==' ? 'equals' : '';
|
|
364
|
-
// TODO(nontangent): 'ステータス'を修正
|
|
365
331
|
return { property: 'ステータス', status: { [query]: value } };
|
|
366
332
|
}
|
|
367
333
|
static Relation(property, evaluation, value) {
|
|
@@ -438,9 +404,6 @@ class NotionOr extends NotionBaseQuery {
|
|
|
438
404
|
const Query = (Entity) => {
|
|
439
405
|
const Filter = (_propName, evaluation, value) => {
|
|
440
406
|
const annotation = Entity[NOTION_ANNOTATIONS].find(({ propName }) => propName === _propName);
|
|
441
|
-
// if(!annotation) {
|
|
442
|
-
// throw new Error(`NotionFilter: ${Entity} does not have ${_propName}.`);
|
|
443
|
-
// }
|
|
444
407
|
return new NotionFilter(annotation?.type, annotation?.fieldName ?? _propName, evaluation, value);
|
|
445
408
|
};
|
|
446
409
|
const OrderBy = (_propName, direction) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-notion.mjs","sources":["../../../../../packages/@nx-ddd/notion/src/lib/types.ts","../../../../../packages/@nx-ddd/notion/src/lib/to-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/from-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/utils.ts","../../../../../packages/@nx-ddd/notion/src/lib/decorators/decorators.ts","../../../../../packages/@nx-ddd/notion/src/lib/converter/converter.ts","../../../../../packages/@nx-ddd/notion/src/lib/notion/notion.service.ts","../../../../../packages/@nx-ddd/notion/src/lib/query/query.ts","../../../../../packages/@nx-ddd/notion/src/lib/query-builder/query-builder.ts","../../../../../packages/@nx-ddd/notion/src/lib/repository/repository.ts","../../../../../packages/@nx-ddd/notion/src/lib/nx-ddd-notion.ts"],"sourcesContent":["/**\n * Notion API type definitions\n */\n\ntype NotionText = {\n type: 'text',\n text: { content: string },\n plain_text: string,\n}\n\ntype NotionArray = {\n type: 'array',\n array: (NotionRichText[] | NotionNumber[]),\n function: 'show_original'\n}\n\nexport type NotionTitle = {type: 'title', title: {text: {content: string}}[]};\nexport type NotionUrl = {id: string, type: 'url', url: string | null};\nexport type NotionRichText = {\n id: string,\n type: 'rich_text',\n rich_text: NotionText[]\n};\nexport type NotionNumber = {id: string, type: 'number', number: number};\nexport type NotionRelation = {id: string, type: 'relation', relation: {id: string}[], has_more: boolean};\nexport type NotionStatus = {id: string, type: 'status', status: {id: string, name: string, color: string}};\nexport type NotionFormula = {\n id: string,\n type: 'formula',\n formula: {\n type: 'string',\n string: string\n } | {\n type: 'number',\n number: number\n } | {\n type: 'date',\n date: {\n start: string,\n end: string,\n time_zone: null,\n }\n }\n};\nexport type NotionRollup = {id: string, type: 'rollup', rollup: NotionArray | NotionNumber};\n\nexport type NotionCreatedTime = {id: string, type: 'created_time', created_time: string};\nexport type NotionLastEditedTime = {id: string, type: 'last_edited_time', last_edited_time: string};\nexport type NotionDate = {id: string, type: 'date', date: any };\nexport type NotionSelect = {id: string, type: 'select', select: {id: string, name: string, color: string}};\n\nexport type NotionPhoneNumber = {id: string, type: 'phone_number', phone_number: string};\nexport type NotionEmail = {id: string, type: 'email', email: string};\nexport type NotionID = {id: string, type: 'unique_id', unique_id: {prefix: string | null, number: number}};\n\nexport type NotionValue = NotionTitle | NotionUrl | NotionRichText | NotionNumber\n | NotionRelation | NotionStatus | NotionFormula | NotionRollup\n | NotionCreatedTime | NotionLastEditedTime | NotionDate | NotionSelect\n | NotionPhoneNumber | NotionEmail | NotionID;\n","import dayjs from \"dayjs\";\nimport { NotionAnnotation } from \"./decorators\";\n\n/**\n * Converts a value to its Notion API representation based on annotation type\n */\nexport function toNotionValue(value: any, annotation: NotionAnnotation) {\n switch(annotation.type) {\n case 'title': return toNotionTitle(value);\n case 'status': return toNotionStatus(value);\n case 'relation':\n if ((annotation.options as any).multi) {\n return toNotionRelationMulti(value);\n } else {\n return toNotionRelation(value);\n }\n case 'formula': return toNotionFormula(value);\n case 'rich_text': return toNotionRichText(value);\n case 'rollup': return toNotionRollup(value);\n case 'url': return toNotionUrl(value);\n case 'date': return toNotionDate(value);\n case 'select': return toNotionSelect(value);\n case 'number': return toNotionNumber(value);\n case 'phone_number': return toNotionPhoneNumber(value);\n case 'email': return toNotionEmail(value);\n }\n}\n\nexport function toNotionTitle(value: string) {\n return value ? {type: 'title', title: [{text: {content: value}}]} : undefined;\n}\n\nexport function toNotionStatus(value: string) {\n return value ? {type: 'status', status: {name: value}} : undefined;\n}\n\nexport function toNotionRelationMulti(ids: string[]) {\n return Array.isArray(ids) ? {type: 'relation', relation: (ids).map(id => ({id}))} : undefined;\n}\n\nexport function toNotionRelation(value: string) {\n return value ? toNotionRelationMulti([value]) : undefined;\n}\n\nexport function toNotionRichText(text?: string) {\n return text ? {type: 'rich_text', rich_text: [{text: {content: text}}]} : undefined;\n}\n\nexport function toNotionFormula(value: string): void {\n return;\n}\n\nexport function toNotionRollup(value: string): void {\n return;\n}\n\nexport function toNotionUrl(value: string) {\n return value ? {type: 'url', url: value} : undefined;\n}\n\nexport function toNotionDate(value: Date) {\n return value ? {type: 'date', date: {start: dayjs(value).format() }} : undefined;\n}\n\nexport function toNotionSelect(value: string) {\n return value ? {type: 'select', select: {name: value}} : undefined;\n}\n\nexport function toNotionPhoneNumber(value: string) {\n return value ? {type: 'phone_number', phone_number: value} : undefined;\n}\n\nexport function toNotionNumber(value: number) {\n return value ? {type: 'number', number: value} : undefined;\n}\n\nexport function toNotionEmail(value: string) {\n return value ? {type: 'email', email: value} : undefined;\n}\n","import dayjs from \"dayjs\";\nimport { NotionAnnotation } from \"./decorators\";\nimport {\n NotionValue, NotionTitle, NotionUrl, NotionRichText, NotionRelation,\n NotionStatus, NotionFormula, NotionRollup, NotionCreatedTime,\n NotionLastEditedTime, NotionDate, NotionNumber, NotionSelect,\n NotionPhoneNumber, NotionEmail, NotionID\n} from \"./types\";\n\n/**\n * Converts a Notion API value to its JavaScript representation\n */\nexport function fromNotionValue(value: NotionValue, annotation: NotionAnnotation) {\n switch(value.type) {\n case 'title': return fromNotionTitle(value);\n case 'formula': return fromNotionFormula(value);\n case 'relation':\n if ((annotation.options as any).multi) {\n return fromNotionRelationMulti(value);\n } else {\n return fromNotionRelation(value);\n }\n case 'rich_text': return fromNotionRichText(value);\n case 'status': return fromNotionStatus(value);\n case 'url': return fromNotionUrl(value);\n case 'rollup':\n if ((annotation.options as any).multi) {\n return fromNotionRollupMulti(value);\n } else {\n return fromNotionRollup(value);\n }\n case 'created_time': return fromNotionCreatedTime(value);\n case 'last_edited_time': return fromNotionLastEditedTime(value);\n case 'date': return fromNotionDate(value);\n case 'number': return fromNotionNumber(value);\n case 'select': return fromNotionSelect(value);\n case 'phone_number': return fromNotionPhoneNumber(value);\n case 'email': return fromNotionEmail(value);\n case 'unique_id': return fromNotionUniqueID(value);\n }\n}\n\nexport function fromNotionTitle(notionTitle: NotionTitle): string {\n return notionTitle?.title?.[0]?.text?.content ?? '';\n}\n\nexport function fromNotionUrl(notionUrl: NotionUrl): string | null {\n return notionUrl.url;\n}\n\nexport function fromNotionRichText(notionRichText: NotionRichText): string | null {\n return notionRichText.rich_text.map(({plain_text}) => plain_text).join('') || null;\n}\n\nexport function fromNotionRelation(notionRelation: NotionRelation): string | null {\n return fromNotionRelationMulti(notionRelation)?.[0] ?? null;\n}\n\nexport function fromNotionRelationMulti(notionRelation: NotionRelation): string[] {\n return notionRelation.relation.map(r => r.id);\n}\n\nexport function fromNotionStatus(notionStatus: NotionStatus): string | null {\n return notionStatus.status?.name ?? null;\n}\n\nexport function fromNotionFormula(notionFormula: NotionFormula): string | number | Date | null {\n switch(notionFormula.formula?.type) {\n case 'string': return notionFormula.formula.string;\n case 'number': return notionFormula.formula.number;\n case 'date': return fromNotionDate(notionFormula.formula as any);\n default: return null;\n }\n}\n\nexport function fromNotionRollup(notionRollup: NotionRollup): string | number {\n if (notionRollup.rollup.type === 'number') {\n return fromNotionNumber(notionRollup.rollup);\n }\n return fromNotionRollupMulti(notionRollup)?.[0] ?? null;\n}\n\nexport function fromNotionRollupMulti(notionRollup: NotionRollup): string[] | number[] {\n if (notionRollup.rollup.type === 'number') {\n return [];\n }\n return (notionRollup.rollup.array ?? []).map(notionValue => {\n if (notionValue.type === 'rich_text') {\n return (notionValue.rich_text ?? []).map(text => text.plain_text).join();\n } else if (notionValue.type === 'number') {\n return notionValue.number ?? null;\n }\n return [];\n }) as unknown as string[] | number[];\n}\n\nexport function fromNotionCreatedTime(notionCreatedTime: NotionCreatedTime): dayjs.Dayjs {\n return dayjs(notionCreatedTime.created_time);\n}\n\nexport function fromNotionLastEditedTime(notionLastEditedTime: NotionLastEditedTime): dayjs.Dayjs {\n return dayjs(notionLastEditedTime.last_edited_time);\n}\n\nexport function fromNotionDate(notionDate: NotionDate): Date | null {\n return notionDate.date?.start ? dayjs(notionDate.date?.start).toDate() : null;\n}\n\nexport function fromNotionNumber(notionNumber: NotionNumber) {\n return notionNumber.number ?? null;\n}\n\nexport function fromNotionSelect(notionSelect: NotionSelect) {\n return notionSelect.select?.name ?? null;\n}\n\nexport function fromNotionPhoneNumber(notionPhoneNumber: NotionPhoneNumber) {\n return notionPhoneNumber.phone_number ?? null;\n}\n\nexport function fromNotionEmail(notionEmail: NotionEmail) {\n return notionEmail.email ?? null;\n}\n\nexport function fromNotionUniqueID(value: NotionID) {\n return value.unique_id.number;\n}\n","// Re-export types for backward compatibility\nexport * from './types';\n\n// Import functions for NotionUtils class\nimport * as toNotion from './to-notion';\nimport * as fromNotion from './from-notion';\n\n// Re-export individual functions\nexport * from './to-notion';\nexport * from './from-notion';\n\n/**\n * NotionUtils class for backward compatibility\n * @deprecated Use individual functions from './to-notion' and './from-notion' instead\n */\nexport class NotionUtils {\n // toNotion methods\n static toNotionValue = toNotion.toNotionValue;\n static toNotionTitle = toNotion.toNotionTitle;\n static toNotionStatus = toNotion.toNotionStatus;\n static toNotionRelationMulti = toNotion.toNotionRelationMulti;\n static toNotionRelation = toNotion.toNotionRelation;\n static toNotionRichText = toNotion.toNotionRichText;\n static toNotionFormula = toNotion.toNotionFormula;\n static toNotionRollup = toNotion.toNotionRollup;\n static toNotionUrl = toNotion.toNotionUrl;\n static toNotionDate = toNotion.toNotionDate;\n static toNotionSelect = toNotion.toNotionSelect;\n static toNotionPhoneNumber = toNotion.toNotionPhoneNumber;\n static toNotionNumber = toNotion.toNotionNumber;\n static toNotionEmail = toNotion.toNotionEmail;\n\n // fromNotion methods\n static fromNotionValue = fromNotion.fromNotionValue;\n static fromNotionTitle = fromNotion.fromNotionTitle;\n static fromNotionUrl = fromNotion.fromNotionUrl;\n static fromNotionRichText = fromNotion.fromNotionRichText;\n static fromNotionRelation = fromNotion.fromNotionRelation;\n static fromNotionRelationMulti = fromNotion.fromNotionRelationMulti;\n static fromNotionStatus = fromNotion.fromNotionStatus;\n static fromNotionFormula = fromNotion.fromNotionFormula;\n static fromNotionRollup = fromNotion.fromNotionRollup;\n static fromNotionRollupMulti = fromNotion.fromNotionRollupMulti;\n static fromNotionCreatedTime = fromNotion.fromNotionCreatedTime;\n static fromNotionLastEditedTime = fromNotion.fromNotionLastEditedTime;\n static fromNotionDate = fromNotion.fromNotionDate;\n static fromNotionNumber = fromNotion.fromNotionNumber;\n static fromNotionSelect = fromNotion.fromNotionSelect;\n static fromNotionPhoneNumber = fromNotion.fromNotionPhoneNumber;\n static fromNotionEmail = fromNotion.fromNotionEmail;\n static fromNotionUniqueID = fromNotion.fromNotionUniqueID;\n}\n","export const NOTION_ANNOTATIONS = 'notion_annotations';\nexport const NOTION_DATABASE_ANNOTATION = 'notion_database_annotation';\nexport type NotionFieldType = 'title' | 'url' | 'rich_text' \n | 'relation' | 'status' | 'formula' | 'rollup' | 'timestamp'\n | 'number' | 'created_time' | 'last_edited_time' | 'date' | 'select'\n | 'phone_number' | 'email' | 'checkbox' | 'created_by' | 'files'\n | 'last_edited_by' | 'multi_select' | 'people' | 'unique_id';\nexport interface NotionAnnotation<T extends object = Record<string, never>> {\n type: NotionFieldType;\n fieldName: string;\n propName: string;\n options?: T;\n}\n\nfunction createDecorator<T extends object = Record<string, never>>(type: NotionFieldType, defaultOptions?: T) {\n return (name?: string, options?: Partial<T>) => {\n return (target: any, propName: string) => {\n const fieldName = name || propName;\n const ANNOTATION: NotionAnnotation<T> = {type, fieldName, propName, options: {...defaultOptions, ...options} as T};\n target.constructor[NOTION_ANNOTATIONS] ??= [];\n target.constructor[NOTION_ANNOTATIONS].push(ANNOTATION);\n };\n };\n}\n\nexport const Title = createDecorator('title');\nexport const Url = createDecorator('url');\nexport const RichText = createDecorator('rich_text');\nexport const Relation = createDecorator<{multi: boolean}>('relation', {multi: false});\nexport const Status = createDecorator('status');\nexport const Formula = createDecorator('formula');\nexport const Rollup = createDecorator<{multi: boolean}>('rollup', {multi: false});\nexport const Timestamp = createDecorator('timestamp');\nexport const Number = createDecorator('number');\nexport const CreatedTime = createDecorator('created_time');\nexport const LastEditedTime = createDecorator('last_edited_time');\nexport const Date = createDecorator('date');\nexport const Select = createDecorator('select');\nexport const PhoneNumber = createDecorator('phone_number');\nexport const Email = createDecorator('email');\nexport const UniqueID = createDecorator('unique_id');\n// Not implemented below props!\n// export const Checkbox = createDecorator('checkbox');\n// export const CreatedBy = createDecorator('created_by');\n// export const Files = createDecorator('files');\n// export const LastEditedBy = createDecorator('last_edited_by');\n// export const MultiSelect = createDecorator('multi_select');\n// export const People = createDecorator('people');\n\n/**\n * Class decorator to specify Notion database ID\n * @param databaseId - The Notion database ID\n */\nfunction Database(databaseId: string) {\n return (target: any) => {\n target[NOTION_DATABASE_ANNOTATION] = databaseId;\n };\n}\n\n/**\n * Get database ID from class decorator\n * @param target - Entity class with @Notion.Database decorator\n * @returns Database ID or undefined if not decorated\n */\nexport function getDatabaseId(target: any): string | undefined {\n return target[NOTION_DATABASE_ANNOTATION];\n}\n\nexport const Notion = {\n Database,\n Title,\n Url,\n RichText,\n Relation,\n Status,\n Formula,\n Rollup,\n Timestamp,\n Number,\n CreatedTime,\n LastEditedTime,\n Date,\n Select,\n PhoneNumber,\n Email,\n UniqueID,\n};\n","import { PageObjectResponse, PartialPageObjectResponse, PartialDatabaseObjectResponse, DatabaseObjectResponse } from \"@notionhq/client/build/src/api-endpoints\";\nimport { NotionUtils } from \"../utils\";\nimport { NotionAnnotation, NOTION_ANNOTATIONS } from \"../decorators\";\nimport { omitBy } from \"lodash-es\";\nimport { Type } from \"@nx-ddd/common/domain\";\n\nexport class NotionHelper {\n static fromNotion<E>(\n page: PageObjectResponse | PartialPageObjectResponse | PartialDatabaseObjectResponse | DatabaseObjectResponse,\n Entity: Type<E>\n ): E {\n const annotations: NotionAnnotation[] = (Entity as any)[NOTION_ANNOTATIONS] ?? [];\n const obj = annotations.reduce((obj, annotation) => {\n const value = (page as any)['properties'][annotation.fieldName]\n ? NotionUtils.fromNotionValue((page as any)['properties'][annotation.fieldName], annotation)\n : undefined;\n return {...obj, [annotation.propName]: value};\n }, {id: page.id});\n return (Entity as any).from(obj);\n }\n\n static toNotion<E>(entity: Partial<E>, Entity: Type<E>): object {\n const annotations: NotionAnnotation[] = (Entity as any)[NOTION_ANNOTATIONS] ?? [];\n const data = annotations.reduce((obj, annotation) => ({\n ...obj,\n [annotation.fieldName]: NotionUtils.toNotionValue((entity as Record<string, any>)[annotation.propName], annotation),\n }), {});\n return omitBy(data, (value) => typeof value === 'undefined');\n }\n}\n\nexport abstract class NotionConverter<E> {\n protected abstract Entity: Type<E>;\n\n fromNotion(page: PageObjectResponse | PartialPageObjectResponse | PartialDatabaseObjectResponse | DatabaseObjectResponse): E {\n return NotionHelper.fromNotion<E>(page, this.Entity);\n }\n\n toNotion(entity: Partial<E>): object {\n return NotionHelper.toNotion<E>(entity, this.Entity);\n }\n}\n\nexport function createConverter<E = any>(Entity: any): NotionConverter<E> {\n class Converter extends NotionConverter<E> {\n protected Entity = Entity;\n }\n\n return new Converter();\n}\n","import { inject, InjectionToken } from \"@angular/core\";\nimport type { NotionService } from \"./notion.service.impl\";\n\nexport interface NotionConfig {\n token: string;\n}\n\nexport const NOTION_SERVICE = new InjectionToken<NotionService>('NOTION_SERVICE');\nexport const NOTION_CONFIG = new InjectionToken<NotionConfig>('NOTION_CONFIG');\n\nexport function injectNotion(): NotionService | null {\n return inject(NOTION_SERVICE, { optional: true }) ?? null;\n}\n","import { NotionAnnotation, NOTION_ANNOTATIONS } from \"../decorators\";\nimport { Entity } from \"@nx-ddd/common/domain\";\n\ntype Evaluation = '==' | '>' | '>=' | '<' | '<=' | '!=' | 'in';\n\nexport class N {\n static RollupPropQuery(property: string, evaluation: Evaluation, value: string | number) {\n return { property, rollup: { every: { rich_text: { equals: value } } } };\n }\n\n static FormulaQuery(property: string, evaluation: Evaluation, value: string | number) {\n return { property, formula: {}};\n }\n\n static LastEditedTime(property: string, evaluation: Evaluation, value: string | number) {\n const query = evaluation === '>' ? 'after' \n : evaluation === '<' ? 'before'\n : evaluation === '==' ? 'equals'\n : evaluation === '<=' ? 'on_or_before'\n : evaluation === '>=' ? 'on_or_after'\n : evaluation === '!=' ? '' : '';\n return { timestamp: 'last_edited_time', last_edited_time: {[query]: value} };\n }\n\n static Timestamp(property: string, evaluation: Evaluation, value: string) {\n const query = evaluation === '>' ? 'after' \n : evaluation === '<' ? 'before'\n : evaluation === '==' ? 'equals'\n : evaluation === '<=' ? 'on_or_before'\n : evaluation === '>=' ? 'on_or_after'\n : evaluation === '!=' ? '' : '';\n return { property, timestamp: {[query]: value} };\n }\n\n static Status(property: string, evaluation: Evaluation, value: string) {\n const query = evaluation === '==' ? 'equals' : '';\n // TODO(nontangent): 'ステータス'を修正\n return { property: 'ステータス', status: {[query]: value} };\n }\n \n static Relation(property: string, evaluation: Evaluation, value: string) {\n const query = evaluation === 'in' ? 'contains': '';\n return { property, relation: {[query]: value} };\n }\n}\n\nexport abstract class NotionBaseQuery {\n type!: 'and' | 'or' | 'filter' | 'sort';\n abstract build(): unknown;\n}\n\nexport class NotionFilter extends NotionBaseQuery {\n readonly type = 'filter' as const;\n\n constructor(\n public propertyType: any,\n public propertyName: string,\n public evaluation: Evaluation,\n public value: string | number,\n ) { super(); }\n\n build() {\n switch(this.propertyName) {\n case 'last_edited_time': return N.LastEditedTime(this.propertyName, this.evaluation, this.value);\n }\n\n switch(this.propertyType) {\n case 'rollup': return N.RollupPropQuery(this.propertyName, this.evaluation, this.value);\n case 'formula': return N.FormulaQuery(this.propertyName, this.evaluation, this.value);\n case 'status': return N.Status(this.propertyName, this.evaluation, this.value as string);\n case 'relation': return N.Relation(this.propertyName, this.evaluation, this.value as string);\n }\n }\n}\n\nexport class NotionSort extends NotionBaseQuery {\n readonly type = 'sort' as const;\n constructor(\n public property: string,\n public direction: 'asc' | 'desc' = 'asc',\n ) { super(); }\n\n build() {\n return {\n property: this.property,\n direction: this.direction === 'asc' ? 'ascending' : 'descending',\n };\n }\n}\n\nexport class NotionAnd extends NotionBaseQuery {\n readonly type = 'and' as const;\n arr: NotionFilter[];\n\n constructor(...filters: NotionFilter[]) {\n super();\n this.arr = filters;\n }\n\n build() {\n return {and: this.arr.map(filter => filter.build())};\n }\n}\n\nexport class NotionOr extends NotionBaseQuery {\n readonly type = 'or' as const;\n arr: NotionFilter[];\n\n constructor(...filters: NotionFilter[]) {\n super();\n this.arr = filters;\n }\n\n build() {\n return {or: this.arr.map(filter => filter.build())};\n }\n}\n\nexport const Query = <E = any>(Entity: E) => {\n const Filter = (_propName: string, evaluation: Evaluation, value: string | number): NotionFilter => {\n const annotation: NotionAnnotation = (Entity as Record<string, any>)[NOTION_ANNOTATIONS].find(({propName}: {propName: string}) => propName === _propName);\n\n // if(!annotation) {\n // throw new Error(`NotionFilter: ${Entity} does not have ${_propName}.`);\n // }\n\n return new NotionFilter(annotation?.type, annotation?.fieldName ?? _propName, evaluation, value);\n };\n const OrderBy = (_propName: string, direction: 'asc' | 'desc'): NotionSort => {\n const annotation: NotionAnnotation = (Entity as Record<string, any>)[NOTION_ANNOTATIONS].find(({propName}: {propName: string}) => propName === _propName);\n return new NotionSort(annotation?.fieldName ?? _propName, direction);\n };\n \n const And = (...args: NotionFilter[]): NotionAnd => new NotionAnd(...args);\n const Or = (...args: NotionFilter[]): NotionOr => new NotionOr(...args);\n\n return {Filter, OrderBy, And, Or};\n}\n","import { NotionBaseQuery } from \"../query\";\n\nexport class NotionQueryBuilder {\n constructor() { }\n\n build(filterQuery?: NotionBaseQuery, sortQuery?: NotionBaseQuery) {\n return {\n ...(filterQuery ? this.buildFilterQuery(filterQuery) : {}),\n ...(sortQuery ? this.buildSortQuery(sortQuery) : {}),\n }\n }\n\n protected buildSortQuery(query: NotionBaseQuery) {\n if (query.type === 'sort') {\n return { sorts: [query.build()]};\n } else {\n return {};\n }\n }\n\n protected buildFilterQuery(query: NotionBaseQuery) {\n if (query.type === 'filter') {\n return { filter: { and: [query.build()] } };\n } else if (['and', 'or'].includes(query.type)) {\n return { filter: query.build() };\n } else {\n return {};\n }\n }\n}\n","import { Client } from '@notionhq/client';\nimport { Entity } from '@nx-ddd/common/domain';\nimport { Repository } from '@nx-ddd/common/domain';\nimport { inject, Injectable, InjectionToken } from '@angular/core';\nimport { NotionConverter } from '../converter';\nimport { NotionBaseQuery } from '../query';\nimport { NotionQueryBuilder } from '../query-builder';\nimport { Observable } from 'rxjs';\n\nexport const NOTION_ACCESS_TOKEN = new InjectionToken<string>('[@nx-ddd/notion] Notion Access Token');\nexport const NOTION_DATABASE_ID = new InjectionToken('[@nx-ddd/notion] Notion Database Id');\n\nexport function provideNotionConfig(config: {accessToken: string}) {\n return { provide: NOTION_ACCESS_TOKEN, useValue: config.accessToken };\n}\n\n@Injectable()\nexport abstract class NotionRepository<E extends Entity & {id: string}> extends Repository<E> {\n protected abstract databaseId: string;\n protected abstract converter: NotionConverter<E>;\n\n protected token: string = inject(NOTION_ACCESS_TOKEN);\n protected client = new Client({auth: this.token});\n protected queryBuilder = new NotionQueryBuilder();\n protected get parent(): {type: 'database_id', database_id: string} {\n return { type: 'database_id', database_id: this.databaseId };\n }\n\n async query(\n filterQuery?: NotionBaseQuery, \n sortQuery?: NotionBaseQuery,\n startCursor?: string,\n pageSize?: number,\n ) {\n try {\n const obj = this.queryBuilder.build(filterQuery, sortQuery);\n const res = await this.client.databases.query({\n database_id: this.databaseId,\n ...obj as any,\n start_cursor: startCursor,\n page_size: pageSize,\n });\n return {\n results: res.results.map(result => this.converter.fromNotion(result)),\n nextCursor: res.next_cursor,\n hasMore: res.has_more,\n }\n } catch (error) {\n throw error;\n }\n }\n\n async queryV2(args?: any) {\n try {\n const res = await this.client.databases.query({\n database_id: this.databaseId,\n ...(args ?? {}),\n });\n return {\n results: res.results.map(result => this.converter.fromNotion(result)),\n nextCursor: res.next_cursor,\n hasMore: res.has_more,\n }\n } catch (error) {\n throw error;\n }\n }\n\n async list({\n batchSize = 100,\n }: {\n batchSize?: number,\n } = {}): Promise<E[]> {\n const items: E[] = [];\n let nextCursor: string | undefined = undefined;\n let pageCount = 0;\n\n console.log(`[NotionRepository] Starting pagination with batch size: ${batchSize}`);\n\n // eslint-disable-next-line no-constant-condition\n while(true) {\n pageCount++;\n const res = await this.query(undefined, undefined, nextCursor, batchSize);\n console.log(`[NotionRepository] Page ${pageCount}: Retrieved ${res.results.length} items, hasMore: ${res.hasMore}, nextCursor: ${res.nextCursor ? 'present' : 'null'}`);\n\n items.push(...res.results);\n nextCursor = res.nextCursor ?? undefined;\n \n if (!res.hasMore) {\n console.log(`[NotionRepository] Pagination complete. Total items: ${items.length} from ${pageCount} pages`);\n break;\n }\n }\n \n return items;\n }\n\n listChanges(): Observable<E[]> {\n throw new Error('NotionRepository.listChanges() is not implemented');\n }\n\n async get({id}: {id: string}): Promise<E> {\n const data = await this.client.pages.retrieve({page_id: id});\n return this.converter.fromNotion(data);\n }\n\n async create(entity: Omit<E, 'id' | 'createdAt' | 'updatedAt'> & Partial<Pick<E, 'id'>>): Promise<E> {\n try {\n const res = await this.client.pages.create({\n parent: this.parent,\n properties: {...this.converter.toNotion(entity as E)},\n }); \n return this.converter.fromNotion(res);\n } catch (error) {\n throw error;\n }\n }\n\n async createMany(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'>[]): Promise<E[]> {\n throw new Error('NotionRepository.createMany() is not implemented');\n }\n\n async update(entity: Partial<E>) {\n const data = {\n page_id: (entity as any).id,\n properties: {...this.converter.toNotion(entity)},\n };\n await this.client.pages.update(data);\n }\n\n async save(data: Partial<E>): Promise<boolean | [E, boolean]> {\n throw new Error('NotionRepository.save() is not implemented');\n }\n\n async saveMany(entities: E[]): Promise<void> {\n throw new Error('NotionRepository.saveMany() is not implemented');\n }\n\n async updateMany(data: Partial<E>[]) {\n throw new Error('NotionRepository.updateMany() is not implemented');\n }\n\n async delete({id}: {id: string}) {\n throw new Error('NotionRepository.delete() is not implemented');\n }\n\n async deleteMany(params: { id: string; }[]): Promise<number> {\n throw new Error('NotionRepository.deleteMany() is not implemented');\n }\n\n async deleteAll(): Promise<void> {\n throw new Error('NotionRepository.deleteAll() is not implemented');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["toNotion.toNotionValue","toNotion.toNotionTitle","toNotion.toNotionStatus","toNotion.toNotionRelationMulti","toNotion.toNotionRelation","toNotion.toNotionRichText","toNotion.toNotionFormula","toNotion.toNotionRollup","toNotion.toNotionUrl","toNotion.toNotionDate","toNotion.toNotionSelect","toNotion.toNotionPhoneNumber","toNotion.toNotionNumber","toNotion.toNotionEmail","fromNotion.fromNotionValue","fromNotion.fromNotionTitle","fromNotion.fromNotionUrl","fromNotion.fromNotionRichText","fromNotion.fromNotionRelation","fromNotion.fromNotionRelationMulti","fromNotion.fromNotionStatus","fromNotion.fromNotionFormula","fromNotion.fromNotionRollup","fromNotion.fromNotionRollupMulti","fromNotion.fromNotionCreatedTime","fromNotion.fromNotionLastEditedTime","fromNotion.fromNotionDate","fromNotion.fromNotionNumber","fromNotion.fromNotionSelect","fromNotion.fromNotionPhoneNumber","fromNotion.fromNotionEmail","fromNotion.fromNotionUniqueID"],"mappings":";;;;;;;AAAA;;AAEG;;ACCH;;AAEG;AACG,SAAU,aAAa,CAAC,KAAU,EAAE,UAA4B,EAAA;AACpE,IAAA,QAAO,UAAU,CAAC,IAAI;QACpB,KAAK,OAAO,EAAE,OAAO,aAAa,CAAC,KAAK,CAAC;QACzC,KAAK,QAAQ,EAAE,OAAO,cAAc,CAAC,KAAK,CAAC;AAC3C,QAAA,KAAK,UAAU;AACb,YAAA,IAAK,UAAU,CAAC,OAAe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AC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;IACtC;IAEA,MAAM,IAAI,CAAC,IAAgB,EAAA;AACzB,QAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IAC/D;IAEA,MAAM,QAAQ,CAAC,QAAa,EAAA;AAC1B,QAAA,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC;IACnE;IAEA,MAAM,UAAU,CAAC,IAAkB,EAAA;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;IACrE;AAEA,IAAA,MAAM,MAAM,CAAC,EAAC,EAAE,EAAe,EAAA;AAC7B,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;IAEA,MAAM,UAAU,CAAC,MAAyB,EAAA;AACxC,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;IACrE;AAEA,IAAA,MAAM,SAAS,GAAA;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;IACpE;uGAvIoB,gBAAgB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAAhB,gBAAgB,EAAA,CAAA;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBADrC;;;AChBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"nx-ddd-notion.mjs","sources":["../../../../../packages/@nx-ddd/notion/src/lib/to-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/from-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/utils.ts","../../../../../packages/@nx-ddd/notion/src/lib/decorators/decorators.ts","../../../../../packages/@nx-ddd/notion/src/lib/converter/converter.ts","../../../../../packages/@nx-ddd/notion/src/lib/notion/notion.service.ts","../../../../../packages/@nx-ddd/notion/src/lib/query/query.ts","../../../../../packages/@nx-ddd/notion/src/lib/query-builder/query-builder.ts","../../../../../packages/@nx-ddd/notion/src/lib/repository/repository.ts","../../../../../packages/@nx-ddd/notion/src/lib/nx-ddd-notion.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport { NotionAnnotation } from \"./decorators\";\n\n\nexport function toNotionValue(value: any, annotation: NotionAnnotation) {\n switch(annotation.type) {\n case 'title': return toNotionTitle(value);\n case 'status': return toNotionStatus(value);\n case 'relation':\n if ((annotation.options as any).multi) {\n return toNotionRelationMulti(value);\n } else {\n return toNotionRelation(value);\n }\n case 'formula': return toNotionFormula(value);\n case 'rich_text': return toNotionRichText(value);\n case 'rollup': return toNotionRollup(value);\n case 'url': return toNotionUrl(value);\n case 'date': return toNotionDate(value);\n case 'select': return toNotionSelect(value);\n case 'number': return toNotionNumber(value);\n case 'phone_number': return toNotionPhoneNumber(value);\n case 'email': return toNotionEmail(value);\n }\n}\n\nexport function toNotionTitle(value: string) {\n return value ? {type: 'title', title: [{text: {content: value}}]} : undefined;\n}\n\nexport function toNotionStatus(value: string) {\n return value ? {type: 'status', status: {name: value}} : undefined;\n}\n\nexport function toNotionRelationMulti(ids: string[]) {\n return Array.isArray(ids) ? {type: 'relation', relation: (ids).map(id => ({id}))} : undefined;\n}\n\nexport function toNotionRelation(value: string) {\n return value ? toNotionRelationMulti([value]) : undefined;\n}\n\nexport function toNotionRichText(text?: string) {\n return text ? {type: 'rich_text', rich_text: [{text: {content: text}}]} : undefined;\n}\n\nexport function toNotionFormula(value: string): void {\n return;\n}\n\nexport function toNotionRollup(value: string): void {\n return;\n}\n\nexport function toNotionUrl(value: string) {\n return value ? {type: 'url', url: value} : undefined;\n}\n\nexport function toNotionDate(value: Date) {\n return value ? {type: 'date', date: {start: dayjs(value).format() }} : undefined;\n}\n\nexport function toNotionSelect(value: string) {\n return value ? {type: 'select', select: {name: value}} : undefined;\n}\n\nexport function toNotionPhoneNumber(value: string) {\n return value ? {type: 'phone_number', phone_number: value} : undefined;\n}\n\nexport function toNotionNumber(value: number) {\n return value ? {type: 'number', number: value} : undefined;\n}\n\nexport function toNotionEmail(value: string) {\n return value ? {type: 'email', email: value} : undefined;\n}\n","import dayjs from \"dayjs\";\nimport { NotionAnnotation } from \"./decorators\";\nimport {\n NotionValue, NotionTitle, NotionUrl, NotionRichText, NotionRelation,\n NotionStatus, NotionFormula, NotionRollup, NotionCreatedTime,\n NotionLastEditedTime, NotionDate, NotionNumber, NotionSelect,\n NotionPhoneNumber, NotionEmail, NotionID\n} from \"./types\";\n\n\nexport function fromNotionValue(value: NotionValue, annotation: NotionAnnotation) {\n switch(value.type) {\n case 'title': return fromNotionTitle(value);\n case 'formula': return fromNotionFormula(value);\n case 'relation':\n if ((annotation.options as any).multi) {\n return fromNotionRelationMulti(value);\n } else {\n return fromNotionRelation(value);\n }\n case 'rich_text': return fromNotionRichText(value);\n case 'status': return fromNotionStatus(value);\n case 'url': return fromNotionUrl(value);\n case 'rollup':\n if ((annotation.options as any).multi) {\n return fromNotionRollupMulti(value);\n } else {\n return fromNotionRollup(value);\n }\n case 'created_time': return fromNotionCreatedTime(value);\n case 'last_edited_time': return fromNotionLastEditedTime(value);\n case 'date': return fromNotionDate(value);\n case 'number': return fromNotionNumber(value);\n case 'select': return fromNotionSelect(value);\n case 'phone_number': return fromNotionPhoneNumber(value);\n case 'email': return fromNotionEmail(value);\n case 'unique_id': return fromNotionUniqueID(value);\n }\n}\n\nexport function fromNotionTitle(notionTitle: NotionTitle): string {\n return notionTitle?.title?.[0]?.text?.content ?? '';\n}\n\nexport function fromNotionUrl(notionUrl: NotionUrl): string | null {\n return notionUrl.url;\n}\n\nexport function fromNotionRichText(notionRichText: NotionRichText): string | null {\n return notionRichText.rich_text.map(({plain_text}) => plain_text).join('') || null;\n}\n\nexport function fromNotionRelation(notionRelation: NotionRelation): string | null {\n return fromNotionRelationMulti(notionRelation)?.[0] ?? null;\n}\n\nexport function fromNotionRelationMulti(notionRelation: NotionRelation): string[] {\n return notionRelation.relation.map(r => r.id);\n}\n\nexport function fromNotionStatus(notionStatus: NotionStatus): string | null {\n return notionStatus.status?.name ?? null;\n}\n\nexport function fromNotionFormula(notionFormula: NotionFormula): string | number | Date | null {\n switch(notionFormula.formula?.type) {\n case 'string': return notionFormula.formula.string;\n case 'number': return notionFormula.formula.number;\n case 'date': return fromNotionDate(notionFormula.formula as any);\n default: return null;\n }\n}\n\nexport function fromNotionRollup(notionRollup: NotionRollup): string | number {\n if (notionRollup.rollup.type === 'number') {\n return fromNotionNumber(notionRollup.rollup);\n }\n return fromNotionRollupMulti(notionRollup)?.[0] ?? null;\n}\n\nexport function fromNotionRollupMulti(notionRollup: NotionRollup): string[] | number[] {\n if (notionRollup.rollup.type === 'number') {\n return [];\n }\n return (notionRollup.rollup.array ?? []).map(notionValue => {\n if (notionValue.type === 'rich_text') {\n return (notionValue.rich_text ?? []).map(text => text.plain_text).join();\n } else if (notionValue.type === 'number') {\n return notionValue.number ?? null;\n }\n return [];\n }) as unknown as string[] | number[];\n}\n\nexport function fromNotionCreatedTime(notionCreatedTime: NotionCreatedTime): dayjs.Dayjs {\n return dayjs(notionCreatedTime.created_time);\n}\n\nexport function fromNotionLastEditedTime(notionLastEditedTime: NotionLastEditedTime): dayjs.Dayjs {\n return dayjs(notionLastEditedTime.last_edited_time);\n}\n\nexport function fromNotionDate(notionDate: NotionDate): Date | null {\n return notionDate.date?.start ? dayjs(notionDate.date?.start).toDate() : null;\n}\n\nexport function fromNotionNumber(notionNumber: NotionNumber) {\n return notionNumber.number ?? null;\n}\n\nexport function fromNotionSelect(notionSelect: NotionSelect) {\n return notionSelect.select?.name ?? null;\n}\n\nexport function fromNotionPhoneNumber(notionPhoneNumber: NotionPhoneNumber) {\n return notionPhoneNumber.phone_number ?? null;\n}\n\nexport function fromNotionEmail(notionEmail: NotionEmail) {\n return notionEmail.email ?? null;\n}\n\nexport function fromNotionUniqueID(value: NotionID) {\n return value.unique_id.number;\n}\n","\nexport * from './types';\n\n\nimport * as toNotion from './to-notion';\nimport * as fromNotion from './from-notion';\n\n\nexport * from './to-notion';\nexport * from './from-notion';\n\n\nexport class NotionUtils {\n \n static toNotionValue = toNotion.toNotionValue;\n static toNotionTitle = toNotion.toNotionTitle;\n static toNotionStatus = toNotion.toNotionStatus;\n static toNotionRelationMulti = toNotion.toNotionRelationMulti;\n static toNotionRelation = toNotion.toNotionRelation;\n static toNotionRichText = toNotion.toNotionRichText;\n static toNotionFormula = toNotion.toNotionFormula;\n static toNotionRollup = toNotion.toNotionRollup;\n static toNotionUrl = toNotion.toNotionUrl;\n static toNotionDate = toNotion.toNotionDate;\n static toNotionSelect = toNotion.toNotionSelect;\n static toNotionPhoneNumber = toNotion.toNotionPhoneNumber;\n static toNotionNumber = toNotion.toNotionNumber;\n static toNotionEmail = toNotion.toNotionEmail;\n\n \n static fromNotionValue = fromNotion.fromNotionValue;\n static fromNotionTitle = fromNotion.fromNotionTitle;\n static fromNotionUrl = fromNotion.fromNotionUrl;\n static fromNotionRichText = fromNotion.fromNotionRichText;\n static fromNotionRelation = fromNotion.fromNotionRelation;\n static fromNotionRelationMulti = fromNotion.fromNotionRelationMulti;\n static fromNotionStatus = fromNotion.fromNotionStatus;\n static fromNotionFormula = fromNotion.fromNotionFormula;\n static fromNotionRollup = fromNotion.fromNotionRollup;\n static fromNotionRollupMulti = fromNotion.fromNotionRollupMulti;\n static fromNotionCreatedTime = fromNotion.fromNotionCreatedTime;\n static fromNotionLastEditedTime = fromNotion.fromNotionLastEditedTime;\n static fromNotionDate = fromNotion.fromNotionDate;\n static fromNotionNumber = fromNotion.fromNotionNumber;\n static fromNotionSelect = fromNotion.fromNotionSelect;\n static fromNotionPhoneNumber = fromNotion.fromNotionPhoneNumber;\n static fromNotionEmail = fromNotion.fromNotionEmail;\n static fromNotionUniqueID = fromNotion.fromNotionUniqueID;\n}\n","export const NOTION_ANNOTATIONS = 'notion_annotations';\nexport const NOTION_DATABASE_ANNOTATION = 'notion_database_annotation';\nexport type NotionFieldType = 'title' | 'url' | 'rich_text' \n | 'relation' | 'status' | 'formula' | 'rollup' | 'timestamp'\n | 'number' | 'created_time' | 'last_edited_time' | 'date' | 'select'\n | 'phone_number' | 'email' | 'checkbox' | 'created_by' | 'files'\n | 'last_edited_by' | 'multi_select' | 'people' | 'unique_id';\nexport interface NotionAnnotation<T extends object = Record<string, never>> {\n type: NotionFieldType;\n fieldName: string;\n propName: string;\n options?: T;\n}\n\nfunction createDecorator<T extends object = Record<string, never>>(type: NotionFieldType, defaultOptions?: T) {\n return (name?: string, options?: Partial<T>) => {\n return (target: any, propName: string) => {\n const fieldName = name || propName;\n const ANNOTATION: NotionAnnotation<T> = {type, fieldName, propName, options: {...defaultOptions, ...options} as T};\n target.constructor[NOTION_ANNOTATIONS] ??= [];\n target.constructor[NOTION_ANNOTATIONS].push(ANNOTATION);\n };\n };\n}\n\nexport const Title = createDecorator('title');\nexport const Url = createDecorator('url');\nexport const RichText = createDecorator('rich_text');\nexport const Relation = createDecorator<{multi: boolean}>('relation', {multi: false});\nexport const Status = createDecorator('status');\nexport const Formula = createDecorator('formula');\nexport const Rollup = createDecorator<{multi: boolean}>('rollup', {multi: false});\nexport const Timestamp = createDecorator('timestamp');\nexport const Number = createDecorator('number');\nexport const CreatedTime = createDecorator('created_time');\nexport const LastEditedTime = createDecorator('last_edited_time');\nexport const Date = createDecorator('date');\nexport const Select = createDecorator('select');\nexport const PhoneNumber = createDecorator('phone_number');\nexport const Email = createDecorator('email');\nexport const UniqueID = createDecorator('unique_id');\n\n\n\n\n\n\n\n\n\nfunction Database(databaseId: string) {\n return (target: any) => {\n target[NOTION_DATABASE_ANNOTATION] = databaseId;\n };\n}\n\n\nexport function getDatabaseId(target: any): string | undefined {\n return target[NOTION_DATABASE_ANNOTATION];\n}\n\nexport const Notion = {\n Database,\n Title,\n Url,\n RichText,\n Relation,\n Status,\n Formula,\n Rollup,\n Timestamp,\n Number,\n CreatedTime,\n LastEditedTime,\n Date,\n Select,\n PhoneNumber,\n Email,\n UniqueID,\n};\n","import { PageObjectResponse, PartialPageObjectResponse, PartialDatabaseObjectResponse, DatabaseObjectResponse } from \"@notionhq/client/build/src/api-endpoints\";\nimport { NotionUtils } from \"../utils\";\nimport { NotionAnnotation, NOTION_ANNOTATIONS } from \"../decorators\";\nimport { omitBy } from \"lodash-es\";\nimport { Type } from \"@nx-ddd/common/domain\";\n\nexport class NotionHelper {\n static fromNotion<E>(\n page: PageObjectResponse | PartialPageObjectResponse | PartialDatabaseObjectResponse | DatabaseObjectResponse,\n Entity: Type<E>\n ): E {\n const annotations: NotionAnnotation[] = (Entity as any)[NOTION_ANNOTATIONS] ?? [];\n const obj = annotations.reduce((obj, annotation) => {\n const value = (page as any)['properties'][annotation.fieldName]\n ? NotionUtils.fromNotionValue((page as any)['properties'][annotation.fieldName], annotation)\n : undefined;\n return {...obj, [annotation.propName]: value};\n }, {id: page.id});\n return (Entity as any).from(obj);\n }\n\n static toNotion<E>(entity: Partial<E>, Entity: Type<E>): object {\n const annotations: NotionAnnotation[] = (Entity as any)[NOTION_ANNOTATIONS] ?? [];\n const data = annotations.reduce((obj, annotation) => ({\n ...obj,\n [annotation.fieldName]: NotionUtils.toNotionValue((entity as Record<string, any>)[annotation.propName], annotation),\n }), {});\n return omitBy(data, (value) => typeof value === 'undefined');\n }\n}\n\nexport abstract class NotionConverter<E> {\n protected abstract Entity: Type<E>;\n\n fromNotion(page: PageObjectResponse | PartialPageObjectResponse | PartialDatabaseObjectResponse | DatabaseObjectResponse): E {\n return NotionHelper.fromNotion<E>(page, this.Entity);\n }\n\n toNotion(entity: Partial<E>): object {\n return NotionHelper.toNotion<E>(entity, this.Entity);\n }\n}\n\nexport function createConverter<E = any>(Entity: any): NotionConverter<E> {\n class Converter extends NotionConverter<E> {\n protected Entity = Entity;\n }\n\n return new Converter();\n}\n","import { inject, InjectionToken } from \"@angular/core\";\nimport type { NotionService } from \"./notion.service.impl\";\n\nexport interface NotionConfig {\n token: string;\n}\n\nexport const NOTION_SERVICE = new InjectionToken<NotionService>('NOTION_SERVICE');\nexport const NOTION_CONFIG = new InjectionToken<NotionConfig>('NOTION_CONFIG');\n\nexport function injectNotion(): NotionService | null {\n return inject(NOTION_SERVICE, { optional: true }) ?? null;\n}\n","import { NotionAnnotation, NOTION_ANNOTATIONS } from \"../decorators\";\nimport { Entity } from \"@nx-ddd/common/domain\";\n\ntype Evaluation = '==' | '>' | '>=' | '<' | '<=' | '!=' | 'in';\n\nexport class N {\n static RollupPropQuery(property: string, evaluation: Evaluation, value: string | number) {\n return { property, rollup: { every: { rich_text: { equals: value } } } };\n }\n\n static FormulaQuery(property: string, evaluation: Evaluation, value: string | number) {\n return { property, formula: {}};\n }\n\n static LastEditedTime(property: string, evaluation: Evaluation, value: string | number) {\n const query = evaluation === '>' ? 'after' \n : evaluation === '<' ? 'before'\n : evaluation === '==' ? 'equals'\n : evaluation === '<=' ? 'on_or_before'\n : evaluation === '>=' ? 'on_or_after'\n : evaluation === '!=' ? '' : '';\n return { timestamp: 'last_edited_time', last_edited_time: {[query]: value} };\n }\n\n static Timestamp(property: string, evaluation: Evaluation, value: string) {\n const query = evaluation === '>' ? 'after' \n : evaluation === '<' ? 'before'\n : evaluation === '==' ? 'equals'\n : evaluation === '<=' ? 'on_or_before'\n : evaluation === '>=' ? 'on_or_after'\n : evaluation === '!=' ? '' : '';\n return { property, timestamp: {[query]: value} };\n }\n\n static Status(property: string, evaluation: Evaluation, value: string) {\n const query = evaluation === '==' ? 'equals' : '';\n \n return { property: 'ステータス', status: {[query]: value} };\n }\n \n static Relation(property: string, evaluation: Evaluation, value: string) {\n const query = evaluation === 'in' ? 'contains': '';\n return { property, relation: {[query]: value} };\n }\n}\n\nexport abstract class NotionBaseQuery {\n type!: 'and' | 'or' | 'filter' | 'sort';\n abstract build(): unknown;\n}\n\nexport class NotionFilter extends NotionBaseQuery {\n readonly type = 'filter' as const;\n\n constructor(\n public propertyType: any,\n public propertyName: string,\n public evaluation: Evaluation,\n public value: string | number,\n ) { super(); }\n\n build() {\n switch(this.propertyName) {\n case 'last_edited_time': return N.LastEditedTime(this.propertyName, this.evaluation, this.value);\n }\n\n switch(this.propertyType) {\n case 'rollup': return N.RollupPropQuery(this.propertyName, this.evaluation, this.value);\n case 'formula': return N.FormulaQuery(this.propertyName, this.evaluation, this.value);\n case 'status': return N.Status(this.propertyName, this.evaluation, this.value as string);\n case 'relation': return N.Relation(this.propertyName, this.evaluation, this.value as string);\n }\n }\n}\n\nexport class NotionSort extends NotionBaseQuery {\n readonly type = 'sort' as const;\n constructor(\n public property: string,\n public direction: 'asc' | 'desc' = 'asc',\n ) { super(); }\n\n build() {\n return {\n property: this.property,\n direction: this.direction === 'asc' ? 'ascending' : 'descending',\n };\n }\n}\n\nexport class NotionAnd extends NotionBaseQuery {\n readonly type = 'and' as const;\n arr: NotionFilter[];\n\n constructor(...filters: NotionFilter[]) {\n super();\n this.arr = filters;\n }\n\n build() {\n return {and: this.arr.map(filter => filter.build())};\n }\n}\n\nexport class NotionOr extends NotionBaseQuery {\n readonly type = 'or' as const;\n arr: NotionFilter[];\n\n constructor(...filters: NotionFilter[]) {\n super();\n this.arr = filters;\n }\n\n build() {\n return {or: this.arr.map(filter => filter.build())};\n }\n}\n\nexport const Query = <E = any>(Entity: E) => {\n const Filter = (_propName: string, evaluation: Evaluation, value: string | number): NotionFilter => {\n const annotation: NotionAnnotation = (Entity as Record<string, any>)[NOTION_ANNOTATIONS].find(({propName}: {propName: string}) => propName === _propName);\n\n \n \n \n\n return new NotionFilter(annotation?.type, annotation?.fieldName ?? _propName, evaluation, value);\n };\n const OrderBy = (_propName: string, direction: 'asc' | 'desc'): NotionSort => {\n const annotation: NotionAnnotation = (Entity as Record<string, any>)[NOTION_ANNOTATIONS].find(({propName}: {propName: string}) => propName === _propName);\n return new NotionSort(annotation?.fieldName ?? _propName, direction);\n };\n \n const And = (...args: NotionFilter[]): NotionAnd => new NotionAnd(...args);\n const Or = (...args: NotionFilter[]): NotionOr => new NotionOr(...args);\n\n return {Filter, OrderBy, And, Or};\n}\n","import { NotionBaseQuery } from \"../query\";\n\nexport class NotionQueryBuilder {\n constructor() { }\n\n build(filterQuery?: NotionBaseQuery, sortQuery?: NotionBaseQuery) {\n return {\n ...(filterQuery ? this.buildFilterQuery(filterQuery) : {}),\n ...(sortQuery ? this.buildSortQuery(sortQuery) : {}),\n }\n }\n\n protected buildSortQuery(query: NotionBaseQuery) {\n if (query.type === 'sort') {\n return { sorts: [query.build()]};\n } else {\n return {};\n }\n }\n\n protected buildFilterQuery(query: NotionBaseQuery) {\n if (query.type === 'filter') {\n return { filter: { and: [query.build()] } };\n } else if (['and', 'or'].includes(query.type)) {\n return { filter: query.build() };\n } else {\n return {};\n }\n }\n}\n","import { Client } from '@notionhq/client';\nimport { Entity } from '@nx-ddd/common/domain';\nimport { Repository } from '@nx-ddd/common/domain';\nimport { inject, Injectable, InjectionToken } from '@angular/core';\nimport { NotionConverter } from '../converter';\nimport { NotionBaseQuery } from '../query';\nimport { NotionQueryBuilder } from '../query-builder';\nimport { Observable } from 'rxjs';\n\nexport const NOTION_ACCESS_TOKEN = new InjectionToken<string>('[@nx-ddd/notion] Notion Access Token');\nexport const NOTION_DATABASE_ID = new InjectionToken('[@nx-ddd/notion] Notion Database Id');\n\nexport function provideNotionConfig(config: {accessToken: string}) {\n return { provide: NOTION_ACCESS_TOKEN, useValue: config.accessToken };\n}\n\n@Injectable()\nexport abstract class NotionRepository<E extends Entity & {id: string}> extends Repository<E> {\n protected abstract databaseId: string;\n protected abstract converter: NotionConverter<E>;\n\n protected token: string = inject(NOTION_ACCESS_TOKEN);\n protected client = new Client({auth: this.token});\n protected queryBuilder = new NotionQueryBuilder();\n protected get parent(): {type: 'database_id', database_id: string} {\n return { type: 'database_id', database_id: this.databaseId };\n }\n\n async query(\n filterQuery?: NotionBaseQuery, \n sortQuery?: NotionBaseQuery,\n startCursor?: string,\n pageSize?: number,\n ) {\n try {\n const obj = this.queryBuilder.build(filterQuery, sortQuery);\n const res = await this.client.databases.query({\n database_id: this.databaseId,\n ...obj as any,\n start_cursor: startCursor,\n page_size: pageSize,\n });\n return {\n results: res.results.map(result => this.converter.fromNotion(result)),\n nextCursor: res.next_cursor,\n hasMore: res.has_more,\n }\n } catch (error) {\n throw error;\n }\n }\n\n async queryV2(args?: any) {\n try {\n const res = await this.client.databases.query({\n database_id: this.databaseId,\n ...(args ?? {}),\n });\n return {\n results: res.results.map(result => this.converter.fromNotion(result)),\n nextCursor: res.next_cursor,\n hasMore: res.has_more,\n }\n } catch (error) {\n throw error;\n }\n }\n\n async list({\n batchSize = 100,\n }: {\n batchSize?: number,\n } = {}): Promise<E[]> {\n const items: E[] = [];\n let nextCursor: string | undefined = undefined;\n let pageCount = 0;\n\n console.log(`[NotionRepository] Starting pagination with batch size: ${batchSize}`);\n\n // eslint-disable-next-line no-constant-condition\n while(true) {\n pageCount++;\n const res = await this.query(undefined, undefined, nextCursor, batchSize);\n console.log(`[NotionRepository] Page ${pageCount}: Retrieved ${res.results.length} items, hasMore: ${res.hasMore}, nextCursor: ${res.nextCursor ? 'present' : 'null'}`);\n\n items.push(...res.results);\n nextCursor = res.nextCursor ?? undefined;\n \n if (!res.hasMore) {\n console.log(`[NotionRepository] Pagination complete. Total items: ${items.length} from ${pageCount} pages`);\n break;\n }\n }\n \n return items;\n }\n\n listChanges(): Observable<E[]> {\n throw new Error('NotionRepository.listChanges() is not implemented');\n }\n\n async get({id}: {id: string}): Promise<E> {\n const data = await this.client.pages.retrieve({page_id: id});\n return this.converter.fromNotion(data);\n }\n\n async create(entity: Omit<E, 'id' | 'createdAt' | 'updatedAt'> & Partial<Pick<E, 'id'>>): Promise<E> {\n try {\n const res = await this.client.pages.create({\n parent: this.parent,\n properties: {...this.converter.toNotion(entity as E)},\n }); \n return this.converter.fromNotion(res);\n } catch (error) {\n throw error;\n }\n }\n\n async createMany(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'>[]): Promise<E[]> {\n throw new Error('NotionRepository.createMany() is not implemented');\n }\n\n async update(entity: Partial<E>) {\n const data = {\n page_id: (entity as any).id,\n properties: {...this.converter.toNotion(entity)},\n };\n await this.client.pages.update(data);\n }\n\n async save(data: Partial<E>): Promise<boolean | [E, boolean]> {\n throw new Error('NotionRepository.save() is not implemented');\n }\n\n async saveMany(entities: E[]): Promise<void> {\n throw new Error('NotionRepository.saveMany() is not implemented');\n }\n\n async updateMany(data: Partial<E>[]) {\n throw new Error('NotionRepository.updateMany() is not implemented');\n }\n\n async delete({id}: {id: string}) {\n throw new Error('NotionRepository.delete() is not implemented');\n }\n\n async deleteMany(params: { id: string; }[]): Promise<number> {\n throw new Error('NotionRepository.deleteMany() is not implemented');\n }\n\n async deleteAll(): Promise<void> {\n throw new Error('NotionRepository.deleteAll() is not implemented');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["toNotion.toNotionValue","toNotion.toNotionTitle","toNotion.toNotionStatus","toNotion.toNotionRelationMulti","toNotion.toNotionRelation","toNotion.toNotionRichText","toNotion.toNotionFormula","toNotion.toNotionRollup","toNotion.toNotionUrl","toNotion.toNotionDate","toNotion.toNotionSelect","toNotion.toNotionPhoneNumber","toNotion.toNotionNumber","toNotion.toNotionEmail","fromNotion.fromNotionValue","fromNotion.fromNotionTitle","fromNotion.fromNotionUrl","fromNotion.fromNotionRichText","fromNotion.fromNotionRelation","fromNotion.fromNotionRelationMulti","fromNotion.fromNotionStatus","fromNotion.fromNotionFormula","fromNotion.fromNotionRollup","fromNotion.fromNotionRollupMulti","fromNotion.fromNotionCreatedTime","fromNotion.fromNotionLastEditedTime","fromNotion.fromNotionDate","fromNotion.fromNotionNumber","fromNotion.fromNotionSelect","fromNotion.fromNotionPhoneNumber","fromNotion.fromNotionEmail","fromNotion.fromNotionUniqueID"],"mappings":";;;;;;;AAIM,SAAU,aAAa,CAAC,KAAU,EAAE,UAA4B,EAAA;AACpE,IAAA,QAAO,UAAU,CAAC,IAAI;QACpB,KAAK,OAAO,EAAE,OAAO,aAAa,CAAC,KAAK,CAAC;QACzC,KAAK,QAAQ,EAAE,OAAO,cAAc,CAAC,KAAK,C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C,IAAI,CAAC;IACtC;IAEA,MAAM,IAAI,CAAC,IAAgB,EAAA;AACzB,QAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IAC/D;IAEA,MAAM,QAAQ,CAAC,QAAa,EAAA;AAC1B,QAAA,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC;IACnE;IAEA,MAAM,UAAU,CAAC,IAAkB,EAAA;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;IACrE;AAEA,IAAA,MAAM,MAAM,CAAC,EAAC,EAAE,EAAe,EAAA;AAC7B,QAAA,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC;IACjE;IAEA,MAAM,UAAU,CAAC,MAAyB,EAAA;AACxC,QAAA,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC;IACrE;AAEA,IAAA,MAAM,SAAS,GAAA;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;IACpE;uGAvIoB,gBAAgB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAAhB,gBAAgB,EAAA,CAAA;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBADrC;;;AChBD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/notion",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.81.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@notionhq/client": "^2.2.2",
|
|
7
|
-
"@nx-ddd/common": "19.
|
|
7
|
+
"@nx-ddd/common": "19.81.0",
|
|
8
8
|
"dayjs": "1.11.13",
|
|
9
9
|
"lodash-es": "^4.17.15",
|
|
10
10
|
"@angular/core": "19.1.4",
|
package/types/nx-ddd-notion.d.ts
CHANGED
|
@@ -47,16 +47,7 @@ declare const Select: (name?: string, options?: Partial<Record<string, never>> |
|
|
|
47
47
|
declare const PhoneNumber: (name?: string, options?: Partial<Record<string, never>> | undefined) => (target: any, propName: string) => void;
|
|
48
48
|
declare const Email: (name?: string, options?: Partial<Record<string, never>> | undefined) => (target: any, propName: string) => void;
|
|
49
49
|
declare const UniqueID: (name?: string, options?: Partial<Record<string, never>> | undefined) => (target: any, propName: string) => void;
|
|
50
|
-
/**
|
|
51
|
-
* Class decorator to specify Notion database ID
|
|
52
|
-
* @param databaseId - The Notion database ID
|
|
53
|
-
*/
|
|
54
50
|
declare function Database(databaseId: string): (target: any) => void;
|
|
55
|
-
/**
|
|
56
|
-
* Get database ID from class decorator
|
|
57
|
-
* @param target - Entity class with @Notion.Database decorator
|
|
58
|
-
* @returns Database ID or undefined if not decorated
|
|
59
|
-
*/
|
|
60
51
|
declare function getDatabaseId(target: any): string | undefined;
|
|
61
52
|
declare const Notion: {
|
|
62
53
|
Database: typeof Database;
|
|
@@ -354,9 +345,6 @@ declare abstract class NotionRepository<E extends Entity & {
|
|
|
354
345
|
static ɵprov: i0.ɵɵInjectableDeclaration<NotionRepository<any>>;
|
|
355
346
|
}
|
|
356
347
|
|
|
357
|
-
/**
|
|
358
|
-
* Notion API type definitions
|
|
359
|
-
*/
|
|
360
348
|
type NotionText = {
|
|
361
349
|
type: 'text';
|
|
362
350
|
text: {
|
|
@@ -476,9 +464,6 @@ type NotionID = {
|
|
|
476
464
|
};
|
|
477
465
|
type NotionValue = NotionTitle | NotionUrl | NotionRichText | NotionNumber | NotionRelation | NotionStatus | NotionFormula | NotionRollup | NotionCreatedTime | NotionLastEditedTime | NotionDate | NotionSelect | NotionPhoneNumber | NotionEmail | NotionID;
|
|
478
466
|
|
|
479
|
-
/**
|
|
480
|
-
* Converts a value to its Notion API representation based on annotation type
|
|
481
|
-
*/
|
|
482
467
|
declare function toNotionValue(value: any, annotation: NotionAnnotation): void | {
|
|
483
468
|
type: string;
|
|
484
469
|
title: {
|
|
@@ -591,9 +576,6 @@ declare function toNotionEmail(value: string): {
|
|
|
591
576
|
email: string;
|
|
592
577
|
} | undefined;
|
|
593
578
|
|
|
594
|
-
/**
|
|
595
|
-
* Converts a Notion API value to its JavaScript representation
|
|
596
|
-
*/
|
|
597
579
|
declare function fromNotionValue(value: NotionValue, annotation: NotionAnnotation): string | number | string[] | Date | dayjs.Dayjs | number[] | null;
|
|
598
580
|
declare function fromNotionTitle(notionTitle: NotionTitle): string;
|
|
599
581
|
declare function fromNotionUrl(notionUrl: NotionUrl): string | null;
|
|
@@ -613,10 +595,6 @@ declare function fromNotionPhoneNumber(notionPhoneNumber: NotionPhoneNumber): st
|
|
|
613
595
|
declare function fromNotionEmail(notionEmail: NotionEmail): string;
|
|
614
596
|
declare function fromNotionUniqueID(value: NotionID): number;
|
|
615
597
|
|
|
616
|
-
/**
|
|
617
|
-
* NotionUtils class for backward compatibility
|
|
618
|
-
* @deprecated Use individual functions from './to-notion' and './from-notion' instead
|
|
619
|
-
*/
|
|
620
598
|
declare class NotionUtils {
|
|
621
599
|
static toNotionValue: typeof toNotionValue;
|
|
622
600
|
static toNotionTitle: typeof toNotionTitle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-ddd-notion.d.ts","sources":["../../../../../packages/@nx-ddd/notion/src/lib/converter/converter.ts","../../../../../packages/@nx-ddd/notion/src/lib/decorators/decorators.ts","../../../../../packages/@nx-ddd/notion/src/lib/notion/notion.service.impl.ts","../../../../../packages/@nx-ddd/notion/src/lib/notion/notion.service.ts","../../../../../packages/@nx-ddd/notion/src/lib/query/query.ts","../../../../../packages/@nx-ddd/notion/src/lib/query-builder/query-builder.ts","../../../../../packages/@nx-ddd/notion/src/lib/repository/repository.ts","../../../../../packages/@nx-ddd/notion/src/lib/types.ts","../../../../../packages/@nx-ddd/notion/src/lib/to-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/from-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/utils.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;AAMA;;AAeE;AAQD;AAED;;;;AAUC;AAED;;AC3CA;AACA;AACM;AAKA;;;;;AAKL;AAaD;AACA;AACA;AACA;;AAZY;AAaZ;AACA;AACA;;AAfY;AAgBZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":"nx-ddd-notion.d.ts","sources":["../../../../../packages/@nx-ddd/notion/src/lib/converter/converter.ts","../../../../../packages/@nx-ddd/notion/src/lib/decorators/decorators.ts","../../../../../packages/@nx-ddd/notion/src/lib/notion/notion.service.impl.ts","../../../../../packages/@nx-ddd/notion/src/lib/notion/notion.service.ts","../../../../../packages/@nx-ddd/notion/src/lib/query/query.ts","../../../../../packages/@nx-ddd/notion/src/lib/query-builder/query-builder.ts","../../../../../packages/@nx-ddd/notion/src/lib/repository/repository.ts","../../../../../packages/@nx-ddd/notion/src/lib/types.ts","../../../../../packages/@nx-ddd/notion/src/lib/to-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/from-notion.ts","../../../../../packages/@nx-ddd/notion/src/lib/utils.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;AAMA;;AAeE;AAQD;AAED;;;;AAUC;AAED;;AC3CA;AACA;AACM;AAKA;;;;;AAKL;AAaD;AACA;AACA;AACA;;AAZY;AAaZ;AACA;AACA;;AAfY;AAgBZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AAOA;AAIA;;AA9CiB;AAAA;AAAA;;;;AAAA;AAAA;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiDjB;;;;;AAYQ;;;AAqBA;;AAgBA;;;;AAaP;;;;ACzHA;AAED;AACA;AAEA;;ACPA;AAEA;AACE;;;;;;;;;;AAIA;;;;AAIA;;;;;;AAUA;;;;;;AAUA;;;;;;AAMA;;;;;;AAID;AAED;;;AAGC;AAED;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