@venizia/ignis-connectors 0.4.1 → 0.4.3

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.
Files changed (170) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/common/scope-filter.d.ts +1 -1
  3. package/dist/cjs/common/scope-filter.d.ts.map +1 -1
  4. package/dist/cjs/common/scope-filter.js +33 -7
  5. package/dist/cjs/common/scope-filter.js.map +1 -1
  6. package/dist/cjs/http/common/constants.d.ts +11 -0
  7. package/dist/cjs/http/common/constants.d.ts.map +1 -0
  8. package/dist/cjs/http/common/constants.js +14 -0
  9. package/dist/cjs/http/common/constants.js.map +1 -0
  10. package/dist/cjs/http/common/wire.d.ts +2 -1
  11. package/dist/cjs/http/common/wire.d.ts.map +1 -1
  12. package/dist/cjs/http/common/wire.js +2 -1
  13. package/dist/cjs/http/common/wire.js.map +1 -1
  14. package/dist/cjs/http/datasource.d.ts +2 -1
  15. package/dist/cjs/http/datasource.d.ts.map +1 -1
  16. package/dist/cjs/http/datasource.js +2 -1
  17. package/dist/cjs/http/datasource.js.map +1 -1
  18. package/dist/cjs/http/index.d.ts +1 -0
  19. package/dist/cjs/http/index.d.ts.map +1 -1
  20. package/dist/cjs/http/index.js +1 -0
  21. package/dist/cjs/http/index.js.map +1 -1
  22. package/dist/cjs/http/repository.d.ts.map +1 -1
  23. package/dist/cjs/http/repository.js +5 -4
  24. package/dist/cjs/http/repository.js.map +1 -1
  25. package/dist/cjs/relational/core/repositories/common/constants.d.ts +11 -0
  26. package/dist/cjs/relational/core/repositories/common/constants.d.ts.map +1 -0
  27. package/dist/cjs/relational/core/repositories/common/constants.js +14 -0
  28. package/dist/cjs/relational/core/repositories/common/constants.js.map +1 -0
  29. package/dist/cjs/relational/core/repositories/common/index.d.ts +1 -0
  30. package/dist/cjs/relational/core/repositories/common/index.d.ts.map +1 -1
  31. package/dist/cjs/relational/core/repositories/common/index.js +1 -0
  32. package/dist/cjs/relational/core/repositories/common/index.js.map +1 -1
  33. package/dist/cjs/relational/core/repositories/common/scope-write-guard.d.ts +71 -0
  34. package/dist/cjs/relational/core/repositories/common/scope-write-guard.d.ts.map +1 -0
  35. package/dist/cjs/relational/core/repositories/common/scope-write-guard.js +377 -0
  36. package/dist/cjs/relational/core/repositories/common/scope-write-guard.js.map +1 -0
  37. package/dist/cjs/relational/core/repositories/core/base.d.ts +22 -4
  38. package/dist/cjs/relational/core/repositories/core/base.d.ts.map +1 -1
  39. package/dist/cjs/relational/core/repositories/core/base.js +49 -10
  40. package/dist/cjs/relational/core/repositories/core/base.js.map +1 -1
  41. package/dist/cjs/relational/core/repositories/core/persistable.d.ts.map +1 -1
  42. package/dist/cjs/relational/core/repositories/core/persistable.js +8 -1
  43. package/dist/cjs/relational/core/repositories/core/persistable.js.map +1 -1
  44. package/dist/cjs/relational/core/repositories/dialect/filter.d.ts +2 -2
  45. package/dist/cjs/relational/core/repositories/dialect/filter.js +3 -3
  46. package/dist/cjs/relational/core/repositories/dialect/filter.js.map +1 -1
  47. package/dist/cjs/relational/core/repositories/sqls/recursive-tree.d.ts +9 -0
  48. package/dist/cjs/relational/core/repositories/sqls/recursive-tree.d.ts.map +1 -1
  49. package/dist/cjs/relational/core/repositories/sqls/recursive-tree.js +14 -3
  50. package/dist/cjs/relational/core/repositories/sqls/recursive-tree.js.map +1 -1
  51. package/dist/cjs/relational/postgres/models/common/constants.d.ts +11 -0
  52. package/dist/cjs/relational/postgres/models/common/constants.d.ts.map +1 -0
  53. package/dist/cjs/relational/postgres/models/common/constants.js +14 -0
  54. package/dist/cjs/relational/postgres/models/common/constants.js.map +1 -0
  55. package/dist/cjs/relational/postgres/models/common/index.d.ts +1 -0
  56. package/dist/cjs/relational/postgres/models/common/index.d.ts.map +1 -1
  57. package/dist/cjs/relational/postgres/models/common/index.js +1 -0
  58. package/dist/cjs/relational/postgres/models/common/index.js.map +1 -1
  59. package/dist/cjs/relational/postgres/models/common/types/enrichers.d.ts +5 -3
  60. package/dist/cjs/relational/postgres/models/common/types/enrichers.d.ts.map +1 -1
  61. package/dist/cjs/relational/postgres/models/common/types/enrichers.js.map +1 -1
  62. package/dist/cjs/relational/postgres/models/enrichers/principal.enricher.d.ts +4 -3
  63. package/dist/cjs/relational/postgres/models/enrichers/principal.enricher.d.ts.map +1 -1
  64. package/dist/cjs/relational/postgres/models/enrichers/principal.enricher.js.map +1 -1
  65. package/dist/cjs/relational/sqlite/models/common/types/enrichers.d.ts +3 -2
  66. package/dist/cjs/relational/sqlite/models/common/types/enrichers.d.ts.map +1 -1
  67. package/dist/cjs/relational/sqlite/models/common/types/enrichers.js.map +1 -1
  68. package/dist/cjs/relational/sqlite/models/enrichers/principal.enricher.d.ts +4 -3
  69. package/dist/cjs/relational/sqlite/models/enrichers/principal.enricher.d.ts.map +1 -1
  70. package/dist/cjs/relational/sqlite/models/enrichers/principal.enricher.js.map +1 -1
  71. package/dist/cjs/search/core/controllers/abstract.d.ts +4 -0
  72. package/dist/cjs/search/core/controllers/abstract.d.ts.map +1 -1
  73. package/dist/cjs/search/core/controllers/abstract.js +15 -1
  74. package/dist/cjs/search/core/controllers/abstract.js.map +1 -1
  75. package/dist/cjs/search/core/controllers/factory.d.ts +15 -1
  76. package/dist/cjs/search/core/controllers/factory.d.ts.map +1 -1
  77. package/dist/cjs/search/core/controllers/factory.js +7 -1
  78. package/dist/cjs/search/core/controllers/factory.js.map +1 -1
  79. package/dist/cjs/search/core/controllers/index.d.ts +1 -0
  80. package/dist/cjs/search/core/controllers/index.d.ts.map +1 -1
  81. package/dist/cjs/search/core/controllers/index.js.map +1 -1
  82. package/dist/cjs/search/core/controllers/scope.d.ts +28 -0
  83. package/dist/cjs/search/core/controllers/scope.d.ts.map +1 -0
  84. package/dist/cjs/search/core/controllers/scope.js +68 -0
  85. package/dist/cjs/search/core/controllers/scope.js.map +1 -0
  86. package/dist/esm/common/scope-filter.d.ts +1 -1
  87. package/dist/esm/common/scope-filter.d.ts.map +1 -1
  88. package/dist/esm/common/scope-filter.js +34 -8
  89. package/dist/esm/common/scope-filter.js.map +1 -1
  90. package/dist/esm/http/common/constants.d.ts +11 -0
  91. package/dist/esm/http/common/constants.d.ts.map +1 -0
  92. package/dist/esm/http/common/constants.js +10 -0
  93. package/dist/esm/http/common/constants.js.map +1 -0
  94. package/dist/esm/http/common/wire.d.ts +2 -1
  95. package/dist/esm/http/common/wire.d.ts.map +1 -1
  96. package/dist/esm/http/common/wire.js +2 -1
  97. package/dist/esm/http/common/wire.js.map +1 -1
  98. package/dist/esm/http/datasource.d.ts +2 -1
  99. package/dist/esm/http/datasource.d.ts.map +1 -1
  100. package/dist/esm/http/datasource.js +2 -1
  101. package/dist/esm/http/datasource.js.map +1 -1
  102. package/dist/esm/http/index.d.ts +1 -0
  103. package/dist/esm/http/index.d.ts.map +1 -1
  104. package/dist/esm/http/index.js +1 -0
  105. package/dist/esm/http/index.js.map +1 -1
  106. package/dist/esm/http/repository.d.ts.map +1 -1
  107. package/dist/esm/http/repository.js +5 -4
  108. package/dist/esm/http/repository.js.map +1 -1
  109. package/dist/esm/relational/core/repositories/common/constants.d.ts +11 -0
  110. package/dist/esm/relational/core/repositories/common/constants.d.ts.map +1 -0
  111. package/dist/esm/relational/core/repositories/common/constants.js +10 -0
  112. package/dist/esm/relational/core/repositories/common/constants.js.map +1 -0
  113. package/dist/esm/relational/core/repositories/common/index.d.ts +1 -0
  114. package/dist/esm/relational/core/repositories/common/index.d.ts.map +1 -1
  115. package/dist/esm/relational/core/repositories/common/index.js +1 -0
  116. package/dist/esm/relational/core/repositories/common/index.js.map +1 -1
  117. package/dist/esm/relational/core/repositories/common/scope-write-guard.d.ts +71 -0
  118. package/dist/esm/relational/core/repositories/common/scope-write-guard.d.ts.map +1 -0
  119. package/dist/esm/relational/core/repositories/common/scope-write-guard.js +373 -0
  120. package/dist/esm/relational/core/repositories/common/scope-write-guard.js.map +1 -0
  121. package/dist/esm/relational/core/repositories/core/base.d.ts +22 -4
  122. package/dist/esm/relational/core/repositories/core/base.d.ts.map +1 -1
  123. package/dist/esm/relational/core/repositories/core/base.js +49 -10
  124. package/dist/esm/relational/core/repositories/core/base.js.map +1 -1
  125. package/dist/esm/relational/core/repositories/core/persistable.d.ts.map +1 -1
  126. package/dist/esm/relational/core/repositories/core/persistable.js +8 -1
  127. package/dist/esm/relational/core/repositories/core/persistable.js.map +1 -1
  128. package/dist/esm/relational/core/repositories/dialect/filter.d.ts +2 -2
  129. package/dist/esm/relational/core/repositories/dialect/filter.js +3 -3
  130. package/dist/esm/relational/core/repositories/dialect/filter.js.map +1 -1
  131. package/dist/esm/relational/core/repositories/sqls/recursive-tree.d.ts +9 -0
  132. package/dist/esm/relational/core/repositories/sqls/recursive-tree.d.ts.map +1 -1
  133. package/dist/esm/relational/core/repositories/sqls/recursive-tree.js +15 -4
  134. package/dist/esm/relational/core/repositories/sqls/recursive-tree.js.map +1 -1
  135. package/dist/esm/relational/postgres/models/common/constants.d.ts +11 -0
  136. package/dist/esm/relational/postgres/models/common/constants.d.ts.map +1 -0
  137. package/dist/esm/relational/postgres/models/common/constants.js +10 -0
  138. package/dist/esm/relational/postgres/models/common/constants.js.map +1 -0
  139. package/dist/esm/relational/postgres/models/common/index.d.ts +1 -0
  140. package/dist/esm/relational/postgres/models/common/index.d.ts.map +1 -1
  141. package/dist/esm/relational/postgres/models/common/index.js +1 -0
  142. package/dist/esm/relational/postgres/models/common/index.js.map +1 -1
  143. package/dist/esm/relational/postgres/models/common/types/enrichers.d.ts +5 -3
  144. package/dist/esm/relational/postgres/models/common/types/enrichers.d.ts.map +1 -1
  145. package/dist/esm/relational/postgres/models/common/types/enrichers.js.map +1 -1
  146. package/dist/esm/relational/postgres/models/enrichers/principal.enricher.d.ts +4 -3
  147. package/dist/esm/relational/postgres/models/enrichers/principal.enricher.d.ts.map +1 -1
  148. package/dist/esm/relational/postgres/models/enrichers/principal.enricher.js.map +1 -1
  149. package/dist/esm/relational/sqlite/models/common/types/enrichers.d.ts +3 -2
  150. package/dist/esm/relational/sqlite/models/common/types/enrichers.d.ts.map +1 -1
  151. package/dist/esm/relational/sqlite/models/common/types/enrichers.js.map +1 -1
  152. package/dist/esm/relational/sqlite/models/enrichers/principal.enricher.d.ts +4 -3
  153. package/dist/esm/relational/sqlite/models/enrichers/principal.enricher.d.ts.map +1 -1
  154. package/dist/esm/relational/sqlite/models/enrichers/principal.enricher.js.map +1 -1
  155. package/dist/esm/search/core/controllers/abstract.d.ts +4 -0
  156. package/dist/esm/search/core/controllers/abstract.d.ts.map +1 -1
  157. package/dist/esm/search/core/controllers/abstract.js +15 -1
  158. package/dist/esm/search/core/controllers/abstract.js.map +1 -1
  159. package/dist/esm/search/core/controllers/factory.d.ts +15 -1
  160. package/dist/esm/search/core/controllers/factory.d.ts.map +1 -1
  161. package/dist/esm/search/core/controllers/factory.js +7 -1
  162. package/dist/esm/search/core/controllers/factory.js.map +1 -1
  163. package/dist/esm/search/core/controllers/index.d.ts +1 -0
  164. package/dist/esm/search/core/controllers/index.d.ts.map +1 -1
  165. package/dist/esm/search/core/controllers/index.js.map +1 -1
  166. package/dist/esm/search/core/controllers/scope.d.ts +28 -0
  167. package/dist/esm/search/core/controllers/scope.d.ts.map +1 -0
  168. package/dist/esm/search/core/controllers/scope.js +64 -0
  169. package/dist/esm/search/core/controllers/scope.js.map +1 -0
  170. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/http/repository.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AACrD,sDAAuD;AAcvD,iEAAkF;AAqBlF,wDAAwD;AACxD,MAAa,kBAAmB,SAAQ,2BAAc;IACpD,SAAS,CAAc,KAA4B;QACjD,OAAO,EAAO,CAAC;IACjB,CAAC;CACF;AAJD,gDAIC;AAED;;;;GAIG;AACH,MAAa,cAAc;IAmBzB,YAAY,IAOX;QACC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;QAE9B,IAAI,YAAY,KAAK,SAAS,IAAI,CAA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Gf;QACC,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IAUD,6BAA6B;IAC7B,KAAK,CAAC,QAAQ,CAAC,IAGd;QACC,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAC3D,CAAC;IAES,KAAK,CAAC,WAAW,CAAC,IAI3B;QACC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAE/E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAW;YACnD,KAAK,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;YACtB,MAAM,EAAE,aAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,IAAI,EAAE,EAAE,KAAK,EAAE;YACf,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;SACjD,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;CACF;AAniBD,wCAmiBC","sourcesContent":["import type { AnyType } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type {\n IDeletableRepository,\n IReadableRepository,\n IUpdatableRepository,\n TCount,\n TDataWithRange,\n TByIdFilter,\n TFields,\n TFilter,\n TRow,\n TSchemaType,\n TWhere,\n} from '@venizia/ignis-kernel/repository';\nimport { AbstractEntity, buildDataRange } from '@venizia/ignis-kernel/repository';\nimport type { TSearchInput } from '../search/core/repositories/common/constants';\nimport type {\n IHttpCallOptions,\n IHttpSearchResult,\n IHttpWriteResult,\n THttpExtraQuery,\n TExtraRequest,\n TExtraResult,\n} from './common/types';\nimport type { HttpDataSource } from './datasource';\n\n/**\n * What a repository call takes. Only `headers` and `signal` cross HTTP; the shared repository\n * options (`transaction`, `log`, ...) are accepted for the common contract and have no effect.\n */\nexport type THttpRepositoryOptions = NonNullable<\n Parameters<IReadableRepository['existsWith']>[0]['options']\n> &\n IHttpCallOptions;\n\n/** A remote resource has a name but no local schema. */\nexport class HttpResourceEntity extends AbstractEntity {\n getSchema<T = unknown>(_opts: { type: TSchemaType }): T {\n return {} as T;\n }\n}\n\n/**\n * One remote resource, read and written through the IGNIS CRUD routes, in the `@venizia/ignis-filter`\n * vocabulary. `P` is what a write sends - a partial row by default, since the server fills ids and\n * defaults. There is no `createAll`: the IGNIS REST contract has no bulk-create route.\n */\nexport class HttpRepository<E extends object = AnyType, P extends object = Partial<E>>\n implements\n IReadableRepository<E, THttpRepositoryOptions>,\n IUpdatableRepository<E, P, THttpRepositoryOptions>,\n IDeletableRepository<E, THttpRepositoryOptions>\n{\n dataSource: HttpDataSource;\n entity: AbstractEntity;\n\n protected resource: string;\n /** A count route, if the API has one. Absent, the total comes from `Content-Range`. */\n protected countPath?: string;\n /** The segment after the resource that names the IGNIS find-one route. Absent, `findOne` asks the list route for one row. */\n protected findOnePath?: string;\n /** The page size `find` asks for when its filter names no limit. Absent, the server's own default applies. */\n protected defaultLimit?: number;\n /** The segment after the resource that names the IGNIS search route. */\n protected searchPath: string;\n\n constructor(opts: {\n dataSource: HttpDataSource;\n resource: string;\n countPath?: string;\n findOnePath?: string;\n defaultLimit?: number;\n searchPath?: string;\n }) {\n const { defaultLimit } = opts;\n\n if (defaultLimit !== undefined && !(Number.isInteger(defaultLimit) && defaultLimit > 0)) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: `[${opts.resource}] defaultLimit must be a positive integer | Got ${defaultLimit}`,\n });\n }\n\n this.dataSource = opts.dataSource;\n this.resource = opts.resource;\n this.countPath = opts.countPath;\n this.findOnePath = opts.findOnePath;\n this.defaultLimit = defaultLimit;\n this.searchPath = opts.searchPath ?? 'search';\n this.entity = new HttpResourceEntity({ name: opts.resource });\n }\n\n getEntity(): AbstractEntity {\n return this.entity;\n }\n\n /**\n * The query string of a read: the caller's extra `query` with the call's own `params` (`filter`,\n * `where`) over it. `method` names the repository verb, so a subclass can reshape one route - a\n * keyword into the object its server reads - and leave the others.\n */\n protected buildQuery(opts: {\n method: string;\n query?: THttpExtraQuery;\n params: Record<string, unknown>;\n }): Record<string, unknown> {\n return { ...opts.query, ...opts.params };\n }\n\n /** The filter `find` sends: the caller's, with `defaultLimit` filled in when it names no limit. */\n protected resolveFindFilter(opts: { filter?: TFilter<E> }): TFilter<E> {\n const filter = opts.filter ?? {};\n\n return this.defaultLimit === undefined || filter.limit !== undefined\n ? filter\n : { ...filter, limit: this.defaultLimit };\n }\n\n /** `<resource>/<searchPath>`; override to move the route. */\n protected getSearchPaths(): Array<string> {\n return [this.resource, this.searchPath];\n }\n\n /** No header and an unreadable one (`/*`) have different fixes, so different messages. */\n protected getMissingTotalError(opts: {\n method: string;\n contentRange?: string;\n noHeader: string;\n }) {\n const { method, contentRange, noHeader } = opts;\n const message = contentRange\n ? `Content-Range \"${contentRange}\" carries no readable total - an unknown \"/*\" or an unparseable value. Check the server's count query.`\n : noHeader;\n\n return getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: `[${this.resource}][${method}] ${message}`,\n });\n }\n\n /** From `Content-Range`, or `countPath`. No total throws rather than reporting the page size. */\n async count(opts: {\n where: TWhere<E>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<TCount> {\n if (this.countPath) {\n const rs = await this.dataSource.read<{ count: number }>({\n paths: [this.resource, this.countPath],\n query: this.buildQuery({\n method: 'count',\n query: opts.query,\n params: { where: opts.where },\n }),\n shape: 'one',\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n const counted = rs.data?.count;\n if (typeof counted !== 'number' || !Number.isFinite(counted)) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: `[${this.resource}][count] The count route answered no numeric count - answering 0 would read as an empty table. Body: ${JSON.stringify(rs.data)?.slice(0, 120)}`,\n });\n }\n\n return { count: counted };\n }\n\n const rs = await this.dataSource.read<Array<E>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'count',\n query: opts.query,\n params: { filter: { where: opts.where, limit: 1 } },\n }),\n // Rows alone: a default extra would be computed and thrown away on every count or probe.\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n if (!rs.hasRange) {\n throw this.getMissingTotalError({\n method: 'count',\n contentRange: rs.contentRange,\n noHeader: `The response carried no Content-Range, so there is no total to report - answering with the page size would claim ${rs.dataLength}. Cross-origin, the server must list Content-Range in Access-Control-Expose-Headers; otherwise give this repository a countPath if the API publishes a count route.`,\n });\n }\n\n return { count: rs.total ?? 0 };\n }\n\n async existsWith(opts: {\n where: TWhere<E>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<boolean> {\n const rs = await this.dataSource.read<Array<E>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'existsWith',\n query: opts.query,\n params: { filter: { where: opts.where, limit: 1 } },\n }),\n // Rows alone: a default extra would be computed and thrown away on every count or probe.\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return rs.dataLength > 0;\n }\n\n /** With `extra`: what the route answered beside the rows, typed by what was asked for. */\n async find<\n R = unknown,\n const Extra extends TExtraRequest = TExtraRequest,\n const F extends TFields<E> = TFields<E>,\n >(opts: {\n filter: TFilter<E, F>;\n query?: THttpExtraQuery;\n options: THttpRepositoryOptions & { shouldQueryRange: true; extra: Extra };\n }): Promise<TDataWithRange<TRow<E, R, F>> & { extra: TExtraResult<Extra> }>;\n async find<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter: TFilter<E, F>;\n query?: THttpExtraQuery;\n options: THttpRepositoryOptions & { shouldQueryRange: true };\n }): Promise<TDataWithRange<TRow<E, R, F>>>;\n async find<\n R = unknown,\n const Extra extends TExtraRequest = TExtraRequest,\n const F extends TFields<E> = TFields<E>,\n >(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options: THttpRepositoryOptions & { extra: Extra };\n }): Promise<{ data: Array<TRow<E, R, F>>; extra: TExtraResult<Extra> }>;\n async find<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<Array<TRow<E, R, F>>>;\n /** `extra` or the range decided at run time: the caller narrows the union. */\n async find<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions & { shouldQueryRange?: boolean; extra?: TExtraRequest };\n }): Promise<\n | Array<TRow<E, R, F>>\n | TDataWithRange<TRow<E, R, F>>\n | { data: Array<TRow<E, R, F>>; extra: TExtraResult<TExtraRequest> }\n >;\n async find<R = E>(opts: {\n filter?: TFilter<E>;\n query?: THttpExtraQuery;\n options?: AnyType;\n }): Promise<Array<R> | TDataWithRange<R> | { data: Array<R>; extra?: Record<string, unknown> }> {\n const filter = this.resolveFindFilter({ filter: opts.filter });\n const rs = await this.dataSource.read<Array<R>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'find',\n query: opts.query,\n params: { filter },\n }),\n extra: opts.options?.extra,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n const data = rs.data ?? [];\n\n if (!opts.options?.shouldQueryRange) {\n return opts.options?.extra ? { data, extra: rs.extra ?? {} } : data;\n }\n\n if (!rs.hasRange) {\n throw this.getMissingTotalError({\n method: 'find',\n contentRange: rs.contentRange,\n noHeader: `A range was asked for and the response carried no Content-Range. Deriving it from the page would report ${data.length} as the total. Cross-origin, the server must list Content-Range in Access-Control-Expose-Headers.`,\n });\n }\n\n return {\n data,\n // An empty page names no start: take it from the filter, as the server did.\n range: buildDataRange({\n skip: rs.skip ?? filter.skip,\n offset: filter.offset,\n dataLength: data.length,\n total: rs.total ?? 0,\n }),\n // Asked for, `extra` is always there - empty when the route offered none.\n ...(opts.options?.extra ? { extra: rs.extra ?? {} } : {}),\n };\n }\n\n async findOne<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<TRow<E, R, F> | null> {\n if (this.findOnePath) {\n const one = await this.dataSource.read<TRow<E, R, F> | null>({\n paths: [this.resource, this.findOnePath],\n query: this.buildQuery({\n method: 'findOne',\n query: opts.query,\n params: { filter: opts.filter ?? {} },\n }),\n shape: 'one',\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n return one.data ?? null;\n }\n\n const rs = await this.dataSource.read<Array<TRow<E, R, F>>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'findOne',\n query: opts.query,\n params: { filter: { ...(opts.filter ?? {}), limit: 1 } },\n }),\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n return rs.data?.[0] ?? null;\n }\n\n /** The server answers `null`, never 404, for a missing id. A `where` would be replaced by the id. */\n async findById<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n id: string | number;\n filter?: TByIdFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<TRow<E, R, F> | null> {\n const rs = await this.dataSource.read<TRow<E, R, F>>({\n paths: this.getIdPaths({ id: opts.id }),\n query: this.buildQuery({\n method: 'findById',\n query: opts.query,\n params: { filter: opts.filter ?? {} },\n }),\n shape: 'one',\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return rs.data ?? null;\n }\n\n /**\n * POST `<resource>/search`, the IGNIS search route: `input` is its body (a keyword, semantic, hybrid\n * or raw search), the answer its `{ found, isFoundExact, hits }`. `found` is the total - there is no\n * count route for a search, and `isFoundExact` says when it is an estimate.\n */\n async search<R extends object = E>(opts: {\n input: TSearchInput;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<IHttpSearchResult<R>> {\n const rs = await this.dataSource.read<IHttpSearchResult<R> | null>({\n paths: this.getSearchPaths(),\n method: HTTP.Methods.POST,\n body: opts.input,\n query: this.buildQuery({ method: 'search', query: opts.query, params: {} }),\n shape: 'one',\n ...this.toCallOptions({ options: opts.options }),\n });\n\n const answer = rs.data;\n if (!answer || typeof answer.found !== 'number' || !Array.isArray(answer.hits)) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.BadGateway,\n message: `[${this.resource}][search] The search route answered no { found, hits } envelope - answering an empty page would read as no match. Body: ${JSON.stringify(answer)?.slice(0, 120)}`,\n });\n }\n\n return answer;\n }\n\n /**\n * `<resource>/<id>`, the id encoded: an id carrying `/` or `?` would otherwise name another route.\n * An empty, `.` or `..` id is refused: a URL resolves it, encoded or not, to `/<resource>/` or the\n * parent - a router or proxy that ignores the trailing slash then serves the list or bulk route.\n */\n protected getIdPaths(opts: { id: string | number }): Array<string> {\n const id = String(opts.id);\n\n if (id === '' || id === '.' || id === '..') {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n message: `[${this.resource}] Invalid id '${id}' | An empty, '.' or '..' id names another route`,\n });\n }\n\n return [this.resource, encodeURIComponent(id)];\n }\n\n /** What a call adds to its request: headers and an abort signal. Every other option stays local. */\n protected toCallOptions(opts: { options?: THttpRepositoryOptions }): IHttpCallOptions {\n return { headers: opts.options?.headers, signal: opts.options?.signal };\n }\n\n /** The IGNIS bulk routes answer an empty `where` with a 400; refused here before a request is spent. */\n protected assertBulkWhere(opts: { method: string; where?: TWhere<E> }): TWhere<E> {\n const { method, where } = opts;\n\n if (!where || Object.keys(where).length === 0) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n message: `[${this.resource}][${method}] where is required for a bulk write | The IGNIS bulk routes refuse an empty where, and force cannot cross HTTP`,\n });\n }\n\n return where;\n }\n\n /** The server always answers the rows; `shouldReturn: false` drops them here, as a database repository would not fetch them. */\n protected toWriteResult<R>(opts: {\n result: IHttpWriteResult<R>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): TCount & { data: R | null } {\n const { result, options } = opts;\n return { count: result.count, data: options?.shouldReturn === false ? null : result.data };\n }\n\n /** POST `/<resource>`. */\n async create<R = E>(opts: {\n data: P;\n options?: THttpRepositoryOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }> {\n const result = await this.dataSource.write<R>({\n paths: [this.resource],\n method: HTTP.Methods.POST,\n body: opts.data,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return { count: result.count, data: result.data };\n }\n\n async updateById(opts: {\n id: string | number;\n data: Partial<P>;\n options: THttpRepositoryOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n async updateById<R = E>(opts: {\n id: string | number;\n data: Partial<P>;\n options?: THttpRepositoryOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n /** PATCH `/<resource>/<id>`. */\n async updateById<R = E>(opts: {\n id: string | number;\n data: Partial<P>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const result = await this.dataSource.write<R>({\n paths: this.getIdPaths({ id: opts.id }),\n method: HTTP.Methods.PATCH,\n body: opts.data,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n\n async updateAll(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async updateAll<R = E>(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** PATCH `/<resource>`, the `where` in the body beside the data - a long id list outgrows a URL. */\n async updateAll(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.patchWhere({ ...opts, method: 'updateAll' });\n }\n\n async updateBy(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async updateBy<R = E>(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** Alias for `updateAll`. */\n async updateBy(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.patchWhere({ ...opts, method: 'updateBy' });\n }\n\n protected async patchWhere(opts: {\n method: string;\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const where = this.assertBulkWhere({ method: opts.method, where: opts.where });\n\n const result = await this.dataSource.write<Array<E>>({\n paths: [this.resource],\n method: HTTP.Methods.PATCH,\n body: { ...opts.data, where },\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n\n async deleteById(opts: {\n id: string | number;\n options: THttpRepositoryOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n async deleteById<R = E>(opts: {\n id: string | number;\n options?: THttpRepositoryOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n /** DELETE `/<resource>/<id>`. */\n async deleteById<R = E>(opts: {\n id: string | number;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const result = await this.dataSource.write<R>({\n paths: this.getIdPaths({ id: opts.id }),\n method: HTTP.Methods.DELETE,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n\n async deleteAll(opts: {\n where?: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async deleteAll<R = E>(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** DELETE `/<resource>`, the `where` in the body. */\n async deleteAll(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.deleteWhere({ ...opts, method: 'deleteAll' });\n }\n\n async deleteBy(opts: {\n where?: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async deleteBy<R = E>(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** Alias for `deleteAll`. */\n async deleteBy(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.deleteWhere({ ...opts, method: 'deleteBy' });\n }\n\n protected async deleteWhere(opts: {\n method: string;\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const where = this.assertBulkWhere({ method: opts.method, where: opts.where });\n\n const result = await this.dataSource.write<Array<E>>({\n paths: [this.resource],\n method: HTTP.Methods.DELETE,\n body: { where },\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n}\n"]}
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/http/repository.ts"],"names":[],"mappings":";;;AAAA,kDAAoD;AAEpD,0DAAqD;AACrD,sDAAuD;AAcvD,iEAAkF;AAq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common/constants';\nimport type { AnyType } from '@venizia/ignis-helpers/common';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type {\n IDeletableRepository,\n IReadableRepository,\n IUpdatableRepository,\n TCount,\n TDataWithRange,\n TByIdFilter,\n TFields,\n TFilter,\n TRow,\n TSchemaType,\n TWhere,\n} from '@venizia/ignis-kernel/repository';\nimport { AbstractEntity, buildDataRange } from '@venizia/ignis-kernel/repository';\nimport type { TSearchInput } from '../search/core/repositories/common/constants';\nimport type {\n IHttpCallOptions,\n IHttpSearchResult,\n IHttpWriteResult,\n THttpExtraQuery,\n TExtraRequest,\n TExtraResult,\n} from './common/types';\nimport type { HttpDataSource } from './datasource';\n\n/**\n * What a repository call takes. Only `headers` and `signal` cross HTTP; the shared repository\n * options (`transaction`, `log`, ...) are accepted for the common contract and have no effect.\n */\nexport type THttpRepositoryOptions = NonNullable<\n Parameters<IReadableRepository['existsWith']>[0]['options']\n> &\n IHttpCallOptions;\n\n/** A remote resource has a name but no local schema. */\nexport class HttpResourceEntity extends AbstractEntity {\n getSchema<T = unknown>(_opts: { type: TSchemaType }): T {\n return {} as T;\n }\n}\n\n/**\n * One remote resource, read and written through the IGNIS CRUD routes, in the `@venizia/ignis-filter`\n * vocabulary. `P` is what a write sends - a partial row by default, since the server fills ids and\n * defaults. There is no `createAll`: the IGNIS REST contract has no bulk-create route.\n */\nexport class HttpRepository<E extends object = AnyType, P extends object = Partial<E>>\n implements\n IReadableRepository<E, THttpRepositoryOptions>,\n IUpdatableRepository<E, P, THttpRepositoryOptions>,\n IDeletableRepository<E, THttpRepositoryOptions>\n{\n dataSource: HttpDataSource;\n entity: AbstractEntity;\n\n protected resource: string;\n /** A count route, if the API has one. Absent, the total comes from `Content-Range`. */\n protected countPath?: string;\n /** The segment after the resource that names the IGNIS find-one route. Absent, `findOne` asks the list route for one row. */\n protected findOnePath?: string;\n /** The page size `find` asks for when its filter names no limit. Absent, the server's own default applies. */\n protected defaultLimit?: number;\n /** The segment after the resource that names the IGNIS search route. */\n protected searchPath: string;\n\n constructor(opts: {\n dataSource: HttpDataSource;\n resource: string;\n countPath?: string;\n findOnePath?: string;\n defaultLimit?: number;\n searchPath?: string;\n }) {\n const { defaultLimit } = opts;\n\n if (defaultLimit !== undefined && !(Number.isInteger(defaultLimit) && defaultLimit > 0)) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: `[${opts.resource}] defaultLimit must be a positive integer | Got ${defaultLimit}`,\n });\n }\n\n this.dataSource = opts.dataSource;\n this.resource = opts.resource;\n this.countPath = opts.countPath;\n this.findOnePath = opts.findOnePath;\n this.defaultLimit = defaultLimit;\n this.searchPath = opts.searchPath ?? 'search';\n this.entity = new HttpResourceEntity({ name: opts.resource });\n }\n\n getEntity(): AbstractEntity {\n return this.entity;\n }\n\n /**\n * The query string of a read: the caller's extra `query` with the call's own `params` (`filter`,\n * `where`) over it. `method` names the repository verb, so a subclass can reshape one route - a\n * keyword into the object its server reads - and leave the others.\n */\n protected buildQuery(opts: {\n method: string;\n query?: THttpExtraQuery;\n params: Record<string, unknown>;\n }): Record<string, unknown> {\n return { ...opts.query, ...opts.params };\n }\n\n /** The filter `find` sends: the caller's, with `defaultLimit` filled in when it names no limit. */\n protected resolveFindFilter(opts: { filter?: TFilter<E> }): TFilter<E> {\n const filter = opts.filter ?? {};\n\n return this.defaultLimit === undefined || filter.limit !== undefined\n ? filter\n : { ...filter, limit: this.defaultLimit };\n }\n\n /** `<resource>/<searchPath>`; override to move the route. */\n protected getSearchPaths(): Array<string> {\n return [this.resource, this.searchPath];\n }\n\n /** No header and an unreadable one (`/*`) have different fixes, so different messages. */\n protected getMissingTotalError(opts: {\n method: string;\n contentRange?: string;\n noHeader: string;\n }) {\n const { method, contentRange, noHeader } = opts;\n const message = contentRange\n ? `Content-Range \"${contentRange}\" carries no readable total - an unknown \"/*\" or an unparseable value. Check the server's count query.`\n : noHeader;\n\n return getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: `[${this.resource}][${method}] ${message}`,\n });\n }\n\n /** From `Content-Range`, or `countPath`. No total throws rather than reporting the page size. */\n async count(opts: {\n where: TWhere<E>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<TCount> {\n if (this.countPath) {\n const rs = await this.dataSource.read<{ count: number }>({\n paths: [this.resource, this.countPath],\n query: this.buildQuery({\n method: 'count',\n query: opts.query,\n params: { where: opts.where },\n }),\n shape: HttpReadShapes.ONE,\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n const counted = rs.data?.count;\n if (typeof counted !== 'number' || !Number.isFinite(counted)) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n message: `[${this.resource}][count] The count route answered no numeric count - answering 0 would read as an empty table. Body: ${JSON.stringify(rs.data)?.slice(0, 120)}`,\n });\n }\n\n return { count: counted };\n }\n\n const rs = await this.dataSource.read<Array<E>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'count',\n query: opts.query,\n params: { filter: { where: opts.where, limit: 1 } },\n }),\n // Rows alone: a default extra would be computed and thrown away on every count or probe.\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n if (!rs.hasRange) {\n throw this.getMissingTotalError({\n method: 'count',\n contentRange: rs.contentRange,\n noHeader: `The response carried no Content-Range, so there is no total to report - answering with the page size would claim ${rs.dataLength}. Cross-origin, the server must list Content-Range in Access-Control-Expose-Headers; otherwise give this repository a countPath if the API publishes a count route.`,\n });\n }\n\n return { count: rs.total ?? 0 };\n }\n\n async existsWith(opts: {\n where: TWhere<E>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<boolean> {\n const rs = await this.dataSource.read<Array<E>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'existsWith',\n query: opts.query,\n params: { filter: { where: opts.where, limit: 1 } },\n }),\n // Rows alone: a default extra would be computed and thrown away on every count or probe.\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return rs.dataLength > 0;\n }\n\n /** With `extra`: what the route answered beside the rows, typed by what was asked for. */\n async find<\n R = unknown,\n const Extra extends TExtraRequest = TExtraRequest,\n const F extends TFields<E> = TFields<E>,\n >(opts: {\n filter: TFilter<E, F>;\n query?: THttpExtraQuery;\n options: THttpRepositoryOptions & { shouldQueryRange: true; extra: Extra };\n }): Promise<TDataWithRange<TRow<E, R, F>> & { extra: TExtraResult<Extra> }>;\n async find<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter: TFilter<E, F>;\n query?: THttpExtraQuery;\n options: THttpRepositoryOptions & { shouldQueryRange: true };\n }): Promise<TDataWithRange<TRow<E, R, F>>>;\n async find<\n R = unknown,\n const Extra extends TExtraRequest = TExtraRequest,\n const F extends TFields<E> = TFields<E>,\n >(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options: THttpRepositoryOptions & { extra: Extra };\n }): Promise<{ data: Array<TRow<E, R, F>>; extra: TExtraResult<Extra> }>;\n async find<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<Array<TRow<E, R, F>>>;\n /** `extra` or the range decided at run time: the caller narrows the union. */\n async find<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions & { shouldQueryRange?: boolean; extra?: TExtraRequest };\n }): Promise<\n | Array<TRow<E, R, F>>\n | TDataWithRange<TRow<E, R, F>>\n | { data: Array<TRow<E, R, F>>; extra: TExtraResult<TExtraRequest> }\n >;\n async find<R = E>(opts: {\n filter?: TFilter<E>;\n query?: THttpExtraQuery;\n options?: AnyType;\n }): Promise<Array<R> | TDataWithRange<R> | { data: Array<R>; extra?: Record<string, unknown> }> {\n const filter = this.resolveFindFilter({ filter: opts.filter });\n const rs = await this.dataSource.read<Array<R>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'find',\n query: opts.query,\n params: { filter },\n }),\n extra: opts.options?.extra,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n const data = rs.data ?? [];\n\n if (!opts.options?.shouldQueryRange) {\n return opts.options?.extra ? { data, extra: rs.extra ?? {} } : data;\n }\n\n if (!rs.hasRange) {\n throw this.getMissingTotalError({\n method: 'find',\n contentRange: rs.contentRange,\n noHeader: `A range was asked for and the response carried no Content-Range. Deriving it from the page would report ${data.length} as the total. Cross-origin, the server must list Content-Range in Access-Control-Expose-Headers.`,\n });\n }\n\n return {\n data,\n // An empty page names no start: take it from the filter, as the server did.\n range: buildDataRange({\n skip: rs.skip ?? filter.skip,\n offset: filter.offset,\n dataLength: data.length,\n total: rs.total ?? 0,\n }),\n // Asked for, `extra` is always there - empty when the route offered none.\n ...(opts.options?.extra ? { extra: rs.extra ?? {} } : {}),\n };\n }\n\n async findOne<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n filter?: TFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<TRow<E, R, F> | null> {\n if (this.findOnePath) {\n const one = await this.dataSource.read<TRow<E, R, F> | null>({\n paths: [this.resource, this.findOnePath],\n query: this.buildQuery({\n method: 'findOne',\n query: opts.query,\n params: { filter: opts.filter ?? {} },\n }),\n shape: HttpReadShapes.ONE,\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n return one.data ?? null;\n }\n\n const rs = await this.dataSource.read<Array<TRow<E, R, F>>>({\n paths: [this.resource],\n query: this.buildQuery({\n method: 'findOne',\n query: opts.query,\n params: { filter: { ...(opts.filter ?? {}), limit: 1 } },\n }),\n isEveryDefaultOff: true,\n ...this.toCallOptions({ options: opts.options }),\n });\n return rs.data?.[0] ?? null;\n }\n\n /** The server answers `null`, never 404, for a missing id. A `where` would be replaced by the id. */\n async findById<R = unknown, const F extends TFields<E> = TFields<E>>(opts: {\n id: string | number;\n filter?: TByIdFilter<E, F>;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<TRow<E, R, F> | null> {\n const rs = await this.dataSource.read<TRow<E, R, F>>({\n paths: this.getIdPaths({ id: opts.id }),\n query: this.buildQuery({\n method: 'findById',\n query: opts.query,\n params: { filter: opts.filter ?? {} },\n }),\n shape: HttpReadShapes.ONE,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return rs.data ?? null;\n }\n\n /**\n * POST `<resource>/search`, the IGNIS search route: `input` is its body (a keyword, semantic, hybrid\n * or raw search), the answer its `{ found, isFoundExact, hits }`. `found` is the total - there is no\n * count route for a search, and `isFoundExact` says when it is an estimate.\n */\n async search<R extends object = E>(opts: {\n input: TSearchInput;\n query?: THttpExtraQuery;\n options?: THttpRepositoryOptions;\n }): Promise<IHttpSearchResult<R>> {\n const rs = await this.dataSource.read<IHttpSearchResult<R> | null>({\n paths: this.getSearchPaths(),\n method: HTTP.Methods.POST,\n body: opts.input,\n query: this.buildQuery({ method: 'search', query: opts.query, params: {} }),\n shape: HttpReadShapes.ONE,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n const answer = rs.data;\n if (!answer || typeof answer.found !== 'number' || !Array.isArray(answer.hits)) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_5.BadGateway,\n message: `[${this.resource}][search] The search route answered no { found, hits } envelope - answering an empty page would read as no match. Body: ${JSON.stringify(answer)?.slice(0, 120)}`,\n });\n }\n\n return answer;\n }\n\n /**\n * `<resource>/<id>`, the id encoded: an id carrying `/` or `?` would otherwise name another route.\n * An empty, `.` or `..` id is refused: a URL resolves it, encoded or not, to `/<resource>/` or the\n * parent - a router or proxy that ignores the trailing slash then serves the list or bulk route.\n */\n protected getIdPaths(opts: { id: string | number }): Array<string> {\n const id = String(opts.id);\n\n if (id === '' || id === '.' || id === '..') {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n message: `[${this.resource}] Invalid id '${id}' | An empty, '.' or '..' id names another route`,\n });\n }\n\n return [this.resource, encodeURIComponent(id)];\n }\n\n /** What a call adds to its request: headers and an abort signal. Every other option stays local. */\n protected toCallOptions(opts: { options?: THttpRepositoryOptions }): IHttpCallOptions {\n return { headers: opts.options?.headers, signal: opts.options?.signal };\n }\n\n /** The IGNIS bulk routes answer an empty `where` with a 400; refused here before a request is spent. */\n protected assertBulkWhere(opts: { method: string; where?: TWhere<E> }): TWhere<E> {\n const { method, where } = opts;\n\n if (!where || Object.keys(where).length === 0) {\n throw getError({\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n message: `[${this.resource}][${method}] where is required for a bulk write | The IGNIS bulk routes refuse an empty where, and force cannot cross HTTP`,\n });\n }\n\n return where;\n }\n\n /** The server always answers the rows; `shouldReturn: false` drops them here, as a database repository would not fetch them. */\n protected toWriteResult<R>(opts: {\n result: IHttpWriteResult<R>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): TCount & { data: R | null } {\n const { result, options } = opts;\n return { count: result.count, data: options?.shouldReturn === false ? null : result.data };\n }\n\n /** POST `/<resource>`. */\n async create<R = E>(opts: {\n data: P;\n options?: THttpRepositoryOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }> {\n const result = await this.dataSource.write<R>({\n paths: [this.resource],\n method: HTTP.Methods.POST,\n body: opts.data,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return { count: result.count, data: result.data };\n }\n\n async updateById(opts: {\n id: string | number;\n data: Partial<P>;\n options: THttpRepositoryOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n async updateById<R = E>(opts: {\n id: string | number;\n data: Partial<P>;\n options?: THttpRepositoryOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n /** PATCH `/<resource>/<id>`. */\n async updateById<R = E>(opts: {\n id: string | number;\n data: Partial<P>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const result = await this.dataSource.write<R>({\n paths: this.getIdPaths({ id: opts.id }),\n method: HTTP.Methods.PATCH,\n body: opts.data,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n\n async updateAll(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async updateAll<R = E>(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** PATCH `/<resource>`, the `where` in the body beside the data - a long id list outgrows a URL. */\n async updateAll(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.patchWhere({ ...opts, method: 'updateAll' });\n }\n\n async updateBy(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async updateBy<R = E>(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** Alias for `updateAll`. */\n async updateBy(opts: {\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.patchWhere({ ...opts, method: 'updateBy' });\n }\n\n protected async patchWhere(opts: {\n method: string;\n data: Partial<P>;\n where: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const where = this.assertBulkWhere({ method: opts.method, where: opts.where });\n\n const result = await this.dataSource.write<Array<E>>({\n paths: [this.resource],\n method: HTTP.Methods.PATCH,\n body: { ...opts.data, where },\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n\n async deleteById(opts: {\n id: string | number;\n options: THttpRepositoryOptions & { shouldReturn: false };\n }): Promise<TCount & { data: undefined | null }>;\n async deleteById<R = E>(opts: {\n id: string | number;\n options?: THttpRepositoryOptions & { shouldReturn?: true };\n }): Promise<TCount & { data: R }>;\n /** DELETE `/<resource>/<id>`. */\n async deleteById<R = E>(opts: {\n id: string | number;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const result = await this.dataSource.write<R>({\n paths: this.getIdPaths({ id: opts.id }),\n method: HTTP.Methods.DELETE,\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n\n async deleteAll(opts: {\n where?: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async deleteAll<R = E>(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** DELETE `/<resource>`, the `where` in the body. */\n async deleteAll(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.deleteWhere({ ...opts, method: 'deleteAll' });\n }\n\n async deleteBy(opts: {\n where?: TWhere<E>;\n options: THttpRepositoryOptions & { shouldReturn: false; force?: boolean };\n }): Promise<TCount & { data: undefined | null }>;\n async deleteBy<R = E>(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: true; force?: boolean };\n }): Promise<TCount & { data: Array<R> | null }>;\n /** Alias for `deleteAll`. */\n async deleteBy(opts: {\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean; force?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n return this.deleteWhere({ ...opts, method: 'deleteBy' });\n }\n\n protected async deleteWhere(opts: {\n method: string;\n where?: TWhere<E>;\n options?: THttpRepositoryOptions & { shouldReturn?: boolean };\n }): Promise<TCount & { data: AnyType }> {\n const where = this.assertBulkWhere({ method: opts.method, where: opts.where });\n\n const result = await this.dataSource.write<Array<E>>({\n paths: [this.resource],\n method: HTTP.Methods.DELETE,\n body: { where },\n ...this.toCallOptions({ options: opts.options }),\n });\n\n return this.toWriteResult({ result, options: opts.options });\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { TConstValue } from '@venizia/ignis-helpers/common';
2
+ /** The writes the row scope holds a payload to: CREATE and UPDATE. */
3
+ export declare class ScopeWriteOperations {
4
+ static readonly CREATE = "create";
5
+ static readonly UPDATE = "update";
6
+ static readonly SCHEME_SET: Set<string>;
7
+ static isValid(value: string): boolean;
8
+ }
9
+ /** Valid scope write operation values. */
10
+ export type TScopeWriteOperation = TConstValue<typeof ScopeWriteOperations>;
11
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/relational/core/repositories/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,sEAAsE;AACtE,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAElC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA+C;IAEzE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,0CAA0C;AAC1C,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScopeWriteOperations = void 0;
4
+ /** The writes the row scope holds a payload to: CREATE and UPDATE. */
5
+ class ScopeWriteOperations {
6
+ static { this.CREATE = 'create'; }
7
+ static { this.UPDATE = 'update'; }
8
+ static { this.SCHEME_SET = new Set([this.CREATE, this.UPDATE]); }
9
+ static isValid(value) {
10
+ return this.SCHEME_SET.has(value);
11
+ }
12
+ }
13
+ exports.ScopeWriteOperations = ScopeWriteOperations;
14
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/relational/core/repositories/common/constants.ts"],"names":[],"mappings":";;;AAEA,sEAAsE;AACtE,MAAa,oBAAoB;aACf,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AARH,oDASC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\n/** The writes the row scope holds a payload to: CREATE and UPDATE. */\nexport class ScopeWriteOperations {\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n\n static readonly SCHEME_SET = new Set<string>([this.CREATE, this.UPDATE]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid scope write operation values. */\nexport type TScopeWriteOperation = TConstValue<typeof ScopeWriteOperations>;\n"]}
@@ -1,4 +1,5 @@
1
1
  export * from './types';
2
+ export * from './constants';
2
3
  export * from './executor';
3
4
  export * from './shared';
4
5
  export * from './scope-filter';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/relational/core/repositories/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/relational/core/repositories/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./types"), exports);
18
+ __exportStar(require("./constants"), exports);
18
19
  __exportStar(require("./executor"), exports);
19
20
  __exportStar(require("./shared"), exports);
20
21
  __exportStar(require("./scope-filter"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/relational/core/repositories/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,2CAAyB;AACzB,iDAA+B","sourcesContent":["export * from './types';\nexport * from './executor';\nexport * from './shared';\nexport * from './scope-filter';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/relational/core/repositories/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,iDAA+B","sourcesContent":["export * from './types';\nexport * from './constants';\nexport * from './executor';\nexport * from './shared';\nexport * from './scope-filter';\n"]}
@@ -0,0 +1,71 @@
1
+ import { type TScopeWriteOperation } from './constants';
2
+ import type { IModelAccessSettings, TWhere } from '@venizia/ignis-kernel';
3
+ /** The allowed values per scope column, each normalised so `1` and `'1'` and equal dates compare equal. */
4
+ type TConstraints = Map<string, Set<string | null>>;
5
+ type TExtraction = {
6
+ isVerifiable: true;
7
+ constraints: TConstraints;
8
+ } | {
9
+ isVerifiable: false;
10
+ reason: string;
11
+ };
12
+ /**
13
+ * The write side of `@model` settings.access. The resolved scope is a `where`; the guard reads
14
+ * from it the columns it constrains and the values it allows, and holds every written row to them.
15
+ *
16
+ * Only shapes that can be checked are read: a column equal to a scalar or `null`, `{ eq }`, `{ inq }`
17
+ * (or `in`), an array, `and` of those, and an `or` whose branches all constrain the same column. Anything
18
+ * else - an `or` over several columns, ranges, `like`, a nested path - makes
19
+ * the scope unverifiable, and the write is refused with its own message instead of being skipped.
20
+ */
21
+ export declare class ScopeWriteGuard {
22
+ static extractConstraints(opts: {
23
+ where: TWhere;
24
+ }): TExtraction;
25
+ /** Adds the where's constraints to `constraints`; returns the reason it cannot be verified, if any. */
26
+ private static collect;
27
+ /**
28
+ * An `or` is checkable only when every branch constrains the same single column with a scalar,
29
+ * `null`, `eq`, `in` or `inq`: the allowed values are then the union of the branches. This is the
30
+ * shared-rows scope, `{ or: [{ merchantId: { in: ids } }, { merchantId: null }] }`. Any other `or`
31
+ * (several columns, ranges, nested `and` or `or`) cannot be checked.
32
+ */
33
+ private static unionOfBranches;
34
+ /** The values one column's condition allows, or a string naming why it cannot be checked. */
35
+ private static allowedValues;
36
+ /**
37
+ * The scope as a MUTATION `where` (update, delete, soft delete, restore). A scope with a `null`
38
+ * branch - `{ or: [{ merchantId: { in: ids } }, { merchantId: null }] }` - lets the caller READ the
39
+ * shared rows. Changing or deleting one is the same permission as creating one, `write.sharedRows`,
40
+ * so without it the `null` branch is removed and only the caller's own rows match. With
41
+ * `sharedRows` the scope is returned as it is.
42
+ *
43
+ * Only the shapes the write guard can read are narrowed. Any other shape cannot be shown to exclude
44
+ * the shared rows, so the mutation is refused, as an update with a payload already is.
45
+ */
46
+ static mutationWhere(opts: {
47
+ settings: IModelAccessSettings;
48
+ model: string;
49
+ operation: string;
50
+ scopeWhere: TWhere;
51
+ }): TWhere;
52
+ /** `where` with every `null` the scope allows removed; `none` when nothing but `null` was allowed. */
53
+ private static withoutShared;
54
+ /** One column's condition without its `null` values, reading the same shapes `allowedValues` reads. */
55
+ private static conditionWithoutNull;
56
+ /**
57
+ * Holds `rows` to the scope `settings.resolve()` returns now. Returns the rows to write: the same
58
+ * objects when nothing changes, copies with the scope columns filled in for `assign`. Throws, and
59
+ * so writes nothing, when any row is outside the scope.
60
+ */
61
+ static apply<Row extends Record<string, unknown>>(opts: {
62
+ settings: IModelAccessSettings;
63
+ model: string;
64
+ rows: Row[];
65
+ operation: TScopeWriteOperation;
66
+ }): Row[];
67
+ /** Names the model and the column, never a value: the caller may be a request. */
68
+ private static denied;
69
+ }
70
+ export {};
71
+ //# sourceMappingURL=scope-write-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-write-guard.d.ts","sourceRoot":"","sources":["../../../../../../src/relational/core/repositories/common/scope-write-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAS9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM1E,2GAA2G;AAC3G,KAAK,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;AAEpD,KAAK,WAAW,GACZ;IAAE,YAAY,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,YAAY,CAAA;CAAE,GACjD;IAAE,YAAY,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAkC5C;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAC1B,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,WAAW;IAY/D,uGAAuG;IACvG,OAAO,CAAC,MAAM,CAAC,OAAO;IAuDtB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAuC9B,6FAA6F;IAC7F,OAAO,CAAC,MAAM,CAAC,aAAa;IAyC5B;;;;;;;;;OASG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE;QACzB,Q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