@shipfox/annotations 5.0.0 → 6.0.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.
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 16 files with swc (242.21ms)
2
+ Successfully compiled: 17 files with swc (471.49ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @shipfox/annotations
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 9cb2442: Moves workflow capability-warning annotations behind the producer-owned inter-module API.
8
+
9
+ ### Patch Changes
10
+
11
+ - f73da5d: Enforces bounded API context imports and routes inter-module consumers through producer contracts.
12
+ - Updated dependencies [9cb2442]
13
+ - Updated dependencies [54ce48b]
14
+ - Updated dependencies [c0162b0]
15
+ - Updated dependencies [7ac43a4]
16
+ - Updated dependencies [a01e917]
17
+ - Updated dependencies [8bdc149]
18
+ - Updated dependencies [3810996]
19
+ - Updated dependencies [b00ed29]
20
+ - Updated dependencies [8aa7cd3]
21
+ - Updated dependencies [81f9544]
22
+ - @shipfox/annotations-dto@6.0.0
23
+ - @shipfox/node-module@0.4.0
24
+ - @shipfox/node-drizzle@0.3.2
25
+ - @shipfox/api-auth-context@6.0.0
26
+ - @shipfox/node-fastify@0.2.4
27
+ - @shipfox/inter-module@0.2.0
28
+
3
29
  ## 5.0.0
4
30
 
5
31
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
1
  import type { ShipfoxModule } from '@shipfox/node-module';
2
- export { AnnotationBodyTooLargeError, AnnotationCountLimitExceededError, AnnotationTotalBytesLimitExceededError, } from '#core/errors.js';
3
- export { type WriteAnnotationsParams, writeAnnotations } from '#core/write-annotations.js';
4
2
  export declare const annotationsModule: ShipfoxModule;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAKxD,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,EACjC,sCAAsC,GACvC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,KAAK,sBAAsB,EAAE,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAEzF,eAAO,MAAM,iBAAiB,EAAE,aAI/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAMxD,eAAO,MAAM,iBAAiB,EAAE,aAK/B,CAAC"}
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
1
  import { db } from '#db/db.js';
2
2
  import { migrationsPath } from '#db/index.js';
3
+ import { createAnnotationsInterModulePresentation } from '#presentation/inter-module.js';
3
4
  import { annotationsRoutes } from '#presentation/routes/index.js';
4
- export { AnnotationBodyTooLargeError, AnnotationCountLimitExceededError, AnnotationTotalBytesLimitExceededError } from '#core/errors.js';
5
- export { writeAnnotations } from '#core/write-annotations.js';
6
5
  export const annotationsModule = {
7
6
  name: 'annotations',
8
7
  database: {
9
8
  db,
10
9
  migrationsPath
11
10
  },
12
- routes: annotationsRoutes
11
+ routes: annotationsRoutes,
12
+ interModulePresentations: [
13
+ createAnnotationsInterModulePresentation()
14
+ ]
13
15
  };
14
16
 
15
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {ShipfoxModule} from '@shipfox/node-module';\nimport {db} from '#db/db.js';\nimport {migrationsPath} from '#db/index.js';\nimport {annotationsRoutes} from '#presentation/routes/index.js';\n\nexport {\n AnnotationBodyTooLargeError,\n AnnotationCountLimitExceededError,\n AnnotationTotalBytesLimitExceededError,\n} from '#core/errors.js';\nexport {type WriteAnnotationsParams, writeAnnotations} from '#core/write-annotations.js';\n\nexport const annotationsModule: ShipfoxModule = {\n name: 'annotations',\n database: {db, migrationsPath},\n routes: annotationsRoutes,\n};\n"],"names":["db","migrationsPath","annotationsRoutes","AnnotationBodyTooLargeError","AnnotationCountLimitExceededError","AnnotationTotalBytesLimitExceededError","writeAnnotations","annotationsModule","name","database","routes"],"mappings":"AACA,SAAQA,EAAE,QAAO,YAAY;AAC7B,SAAQC,cAAc,QAAO,eAAe;AAC5C,SAAQC,iBAAiB,QAAO,gCAAgC;AAEhE,SACEC,2BAA2B,EAC3BC,iCAAiC,EACjCC,sCAAsC,QACjC,kBAAkB;AACzB,SAAqCC,gBAAgB,QAAO,6BAA6B;AAEzF,OAAO,MAAMC,oBAAmC;IAC9CC,MAAM;IACNC,UAAU;QAACT;QAAIC;IAAc;IAC7BS,QAAQR;AACV,EAAE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {ShipfoxModule} from '@shipfox/node-module';\nimport {db} from '#db/db.js';\nimport {migrationsPath} from '#db/index.js';\nimport {createAnnotationsInterModulePresentation} from '#presentation/inter-module.js';\nimport {annotationsRoutes} from '#presentation/routes/index.js';\n\nexport const annotationsModule: ShipfoxModule = {\n name: 'annotations',\n database: {db, migrationsPath},\n routes: annotationsRoutes,\n interModulePresentations: [createAnnotationsInterModulePresentation()],\n};\n"],"names":["db","migrationsPath","createAnnotationsInterModulePresentation","annotationsRoutes","annotationsModule","name","database","routes","interModulePresentations"],"mappings":"AACA,SAAQA,EAAE,QAAO,YAAY;AAC7B,SAAQC,cAAc,QAAO,eAAe;AAC5C,SAAQC,wCAAwC,QAAO,gCAAgC;AACvF,SAAQC,iBAAiB,QAAO,gCAAgC;AAEhE,OAAO,MAAMC,oBAAmC;IAC9CC,MAAM;IACNC,UAAU;QAACN;QAAIC;IAAc;IAC7BM,QAAQJ;IACRK,0BAA0B;QAACN;KAA2C;AACxE,EAAE"}
@@ -0,0 +1,5 @@
1
+ import { annotationsInterModuleContract } from '@shipfox/annotations-dto/inter-module';
2
+ import { type InterModulePresentation } from '@shipfox/inter-module';
3
+ export declare function createAnnotationsInterModulePresentation(): InterModulePresentation<typeof annotationsInterModuleContract>;
4
+ export declare function toReplaceOrRemoveAnnotationKnownError(error: unknown): unknown;
5
+ //# sourceMappingURL=inter-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,8BAA8B,EAAC,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAQ/B,wBAAgB,wCAAwC,IAAI,uBAAuB,CACjF,OAAO,8BAA8B,CACtC,CAmBA;AAED,wBAAgB,qCAAqC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAkB7E"}
@@ -0,0 +1,50 @@
1
+ import { annotationsInterModuleContract } from '@shipfox/annotations-dto/inter-module';
2
+ import { createInterModuleKnownError, defineInterModulePresentation } from '@shipfox/inter-module';
3
+ import { AnnotationBodyTooLargeError, AnnotationCountLimitExceededError, AnnotationTotalBytesLimitExceededError } from '#core/errors.js';
4
+ import { writeAnnotations } from '#core/write-annotations.js';
5
+ export function createAnnotationsInterModulePresentation() {
6
+ return defineInterModulePresentation(annotationsInterModuleContract, {
7
+ replaceOrRemoveAnnotation: async (input)=>{
8
+ try {
9
+ const { annotation, context, ...target } = input;
10
+ await writeAnnotations({
11
+ ...target,
12
+ operations: [
13
+ annotation.op === 'remove' ? {
14
+ context,
15
+ style: 'warning',
16
+ op: 'remove'
17
+ } : {
18
+ context,
19
+ ...annotation
20
+ }
21
+ ]
22
+ });
23
+ return {};
24
+ } catch (error) {
25
+ throw toReplaceOrRemoveAnnotationKnownError(error);
26
+ }
27
+ }
28
+ });
29
+ }
30
+ export function toReplaceOrRemoveAnnotationKnownError(error) {
31
+ const method = annotationsInterModuleContract.methods.replaceOrRemoveAnnotation;
32
+ if (error instanceof AnnotationBodyTooLargeError) {
33
+ return createInterModuleKnownError(method, 'annotation-body-too-large', {
34
+ maxBytes: error.maxBytes
35
+ });
36
+ }
37
+ if (error instanceof AnnotationCountLimitExceededError) {
38
+ return createInterModuleKnownError(method, 'annotation-count-limit-exceeded', {
39
+ maxAnnotations: error.maxAnnotations
40
+ });
41
+ }
42
+ if (error instanceof AnnotationTotalBytesLimitExceededError) {
43
+ return createInterModuleKnownError(method, 'annotation-total-bytes-limit-exceeded', {
44
+ maxBytes: error.maxBytes
45
+ });
46
+ }
47
+ return error;
48
+ }
49
+
50
+ //# sourceMappingURL=inter-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/presentation/inter-module.ts"],"sourcesContent":["import {annotationsInterModuleContract} from '@shipfox/annotations-dto/inter-module';\nimport {\n createInterModuleKnownError,\n defineInterModulePresentation,\n type InterModulePresentation,\n} from '@shipfox/inter-module';\nimport {\n AnnotationBodyTooLargeError,\n AnnotationCountLimitExceededError,\n AnnotationTotalBytesLimitExceededError,\n} from '#core/errors.js';\nimport {writeAnnotations} from '#core/write-annotations.js';\n\nexport function createAnnotationsInterModulePresentation(): InterModulePresentation<\n typeof annotationsInterModuleContract\n> {\n return defineInterModulePresentation(annotationsInterModuleContract, {\n replaceOrRemoveAnnotation: async (input) => {\n try {\n const {annotation, context, ...target} = input;\n await writeAnnotations({\n ...target,\n operations: [\n annotation.op === 'remove'\n ? {context, style: 'warning', op: 'remove'}\n : {context, ...annotation},\n ],\n });\n return {};\n } catch (error) {\n throw toReplaceOrRemoveAnnotationKnownError(error);\n }\n },\n });\n}\n\nexport function toReplaceOrRemoveAnnotationKnownError(error: unknown): unknown {\n const method = annotationsInterModuleContract.methods.replaceOrRemoveAnnotation;\n if (error instanceof AnnotationBodyTooLargeError) {\n return createInterModuleKnownError(method, 'annotation-body-too-large', {\n maxBytes: error.maxBytes,\n });\n }\n if (error instanceof AnnotationCountLimitExceededError) {\n return createInterModuleKnownError(method, 'annotation-count-limit-exceeded', {\n maxAnnotations: error.maxAnnotations,\n });\n }\n if (error instanceof AnnotationTotalBytesLimitExceededError) {\n return createInterModuleKnownError(method, 'annotation-total-bytes-limit-exceeded', {\n maxBytes: error.maxBytes,\n });\n }\n return error;\n}\n"],"names":["annotationsInterModuleContract","createInterModuleKnownError","defineInterModulePresentation","AnnotationBodyTooLargeError","AnnotationCountLimitExceededError","AnnotationTotalBytesLimitExceededError","writeAnnotations","createAnnotationsInterModulePresentation","replaceOrRemoveAnnotation","input","annotation","context","target","operations","op","style","error","toReplaceOrRemoveAnnotationKnownError","method","methods","maxBytes","maxAnnotations"],"mappings":"AAAA,SAAQA,8BAA8B,QAAO,wCAAwC;AACrF,SACEC,2BAA2B,EAC3BC,6BAA6B,QAExB,wBAAwB;AAC/B,SACEC,2BAA2B,EAC3BC,iCAAiC,EACjCC,sCAAsC,QACjC,kBAAkB;AACzB,SAAQC,gBAAgB,QAAO,6BAA6B;AAE5D,OAAO,SAASC;IAGd,OAAOL,8BAA8BF,gCAAgC;QACnEQ,2BAA2B,OAAOC;YAChC,IAAI;gBACF,MAAM,EAACC,UAAU,EAAEC,OAAO,EAAE,GAAGC,QAAO,GAAGH;gBACzC,MAAMH,iBAAiB;oBACrB,GAAGM,MAAM;oBACTC,YAAY;wBACVH,WAAWI,EAAE,KAAK,WACd;4BAACH;4BAASI,OAAO;4BAAWD,IAAI;wBAAQ,IACxC;4BAACH;4BAAS,GAAGD,UAAU;wBAAA;qBAC5B;gBACH;gBACA,OAAO,CAAC;YACV,EAAE,OAAOM,OAAO;gBACd,MAAMC,sCAAsCD;YAC9C;QACF;IACF;AACF;AAEA,OAAO,SAASC,sCAAsCD,KAAc;IAClE,MAAME,SAASlB,+BAA+BmB,OAAO,CAACX,yBAAyB;IAC/E,IAAIQ,iBAAiBb,6BAA6B;QAChD,OAAOF,4BAA4BiB,QAAQ,6BAA6B;YACtEE,UAAUJ,MAAMI,QAAQ;QAC1B;IACF;IACA,IAAIJ,iBAAiBZ,mCAAmC;QACtD,OAAOH,4BAA4BiB,QAAQ,mCAAmC;YAC5EG,gBAAgBL,MAAMK,cAAc;QACtC;IACF;IACA,IAAIL,iBAAiBX,wCAAwC;QAC3D,OAAOJ,4BAA4BiB,QAAQ,yCAAyC;YAClFE,UAAUJ,MAAMI,QAAQ;QAC1B;IACF;IACA,OAAOJ;AACT"}