@openbrf/plugin-sdk 0.0.0-stage → 1.2.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.
Files changed (134) hide show
  1. package/LICENSE +661 -0
  2. package/LICENSE-EXCEPTION.md +28 -0
  3. package/README.md +94 -2
  4. package/dist/abort-signal.d.ts +23 -0
  5. package/dist/abort-signal.d.ts.map +1 -0
  6. package/dist/abort-signal.js +2 -0
  7. package/dist/abort-signal.js.map +1 -0
  8. package/dist/action-refusal.d.ts +101 -0
  9. package/dist/action-refusal.d.ts.map +1 -0
  10. package/dist/action-refusal.js +96 -0
  11. package/dist/action-refusal.js.map +1 -0
  12. package/dist/action-schema.d.ts +42 -0
  13. package/dist/action-schema.d.ts.map +1 -0
  14. package/dist/action-schema.js +67 -0
  15. package/dist/action-schema.js.map +1 -0
  16. package/dist/actions.d.ts +287 -0
  17. package/dist/actions.d.ts.map +1 -0
  18. package/dist/actions.js +68 -0
  19. package/dist/actions.js.map +1 -0
  20. package/dist/api-version.d.ts +23 -0
  21. package/dist/api-version.d.ts.map +1 -0
  22. package/dist/api-version.js +27 -0
  23. package/dist/api-version.js.map +1 -0
  24. package/dist/blocks.d.ts +310 -0
  25. package/dist/blocks.d.ts.map +1 -0
  26. package/dist/blocks.js +185 -0
  27. package/dist/blocks.js.map +1 -0
  28. package/dist/catalog.d.ts +707 -0
  29. package/dist/catalog.d.ts.map +1 -0
  30. package/dist/catalog.js +567 -0
  31. package/dist/catalog.js.map +1 -0
  32. package/dist/define-plugin.d.ts +14 -0
  33. package/dist/define-plugin.d.ts.map +1 -0
  34. package/dist/define-plugin.js +15 -0
  35. package/dist/define-plugin.js.map +1 -0
  36. package/dist/entitlements.d.ts +117 -0
  37. package/dist/entitlements.d.ts.map +1 -0
  38. package/dist/entitlements.js +62 -0
  39. package/dist/entitlements.js.map +1 -0
  40. package/dist/extensions.d.ts +183 -0
  41. package/dist/extensions.d.ts.map +1 -0
  42. package/dist/extensions.js +67 -0
  43. package/dist/extensions.js.map +1 -0
  44. package/dist/finances.d.ts +294 -0
  45. package/dist/finances.d.ts.map +1 -0
  46. package/dist/finances.js +56 -0
  47. package/dist/finances.js.map +1 -0
  48. package/dist/findings.d.ts +156 -0
  49. package/dist/findings.d.ts.map +1 -0
  50. package/dist/findings.js +146 -0
  51. package/dist/findings.js.map +1 -0
  52. package/dist/host.d.ts +827 -0
  53. package/dist/host.d.ts.map +1 -0
  54. package/dist/host.js +80 -0
  55. package/dist/host.js.map +1 -0
  56. package/dist/imports.d.ts +104 -0
  57. package/dist/imports.d.ts.map +1 -0
  58. package/dist/imports.js +70 -0
  59. package/dist/imports.js.map +1 -0
  60. package/dist/index.d.ts +34 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +31 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/integrity.d.ts +38 -0
  65. package/dist/integrity.d.ts.map +1 -0
  66. package/dist/integrity.js +105 -0
  67. package/dist/integrity.js.map +1 -0
  68. package/dist/localized-text.d.ts +18 -0
  69. package/dist/localized-text.d.ts.map +1 -0
  70. package/dist/localized-text.js +17 -0
  71. package/dist/localized-text.js.map +1 -0
  72. package/dist/manifest.d.ts +1122 -0
  73. package/dist/manifest.d.ts.map +1 -0
  74. package/dist/manifest.js +1118 -0
  75. package/dist/manifest.js.map +1 -0
  76. package/dist/module.d.ts +35 -0
  77. package/dist/module.d.ts.map +1 -0
  78. package/dist/module.js +2 -0
  79. package/dist/module.js.map +1 -0
  80. package/dist/package-check.d.ts +66 -0
  81. package/dist/package-check.d.ts.map +1 -0
  82. package/dist/package-check.js +755 -0
  83. package/dist/package-check.js.map +1 -0
  84. package/dist/permissions.d.ts +224 -0
  85. package/dist/permissions.d.ts.map +1 -0
  86. package/dist/permissions.js +277 -0
  87. package/dist/permissions.js.map +1 -0
  88. package/dist/recipients.d.ts +139 -0
  89. package/dist/recipients.d.ts.map +1 -0
  90. package/dist/recipients.js +223 -0
  91. package/dist/recipients.js.map +1 -0
  92. package/dist/records.d.ts +130 -0
  93. package/dist/records.d.ts.map +1 -0
  94. package/dist/records.js +85 -0
  95. package/dist/records.js.map +1 -0
  96. package/dist/require-capability.d.ts +37 -0
  97. package/dist/require-capability.d.ts.map +1 -0
  98. package/dist/require-capability.js +88 -0
  99. package/dist/require-capability.js.map +1 -0
  100. package/dist/settings-schema.d.ts +130 -0
  101. package/dist/settings-schema.d.ts.map +1 -0
  102. package/dist/settings-schema.js +272 -0
  103. package/dist/settings-schema.js.map +1 -0
  104. package/dist/standard-schema.d.ts +43 -0
  105. package/dist/standard-schema.d.ts.map +1 -0
  106. package/dist/standard-schema.js +2 -0
  107. package/dist/standard-schema.js.map +1 -0
  108. package/package.json +55 -3
  109. package/src/abort-signal.ts +22 -0
  110. package/src/action-refusal.ts +178 -0
  111. package/src/action-schema.ts +89 -0
  112. package/src/actions.ts +344 -0
  113. package/src/api-version.ts +28 -0
  114. package/src/blocks.ts +289 -0
  115. package/src/catalog.ts +679 -0
  116. package/src/define-plugin.ts +18 -0
  117. package/src/entitlements.ts +150 -0
  118. package/src/extensions.ts +212 -0
  119. package/src/finances.ts +317 -0
  120. package/src/findings.ts +163 -0
  121. package/src/host.ts +894 -0
  122. package/src/imports.ts +135 -0
  123. package/src/index.ts +316 -0
  124. package/src/integrity.ts +125 -0
  125. package/src/localized-text.ts +19 -0
  126. package/src/manifest.ts +1412 -0
  127. package/src/module.ts +38 -0
  128. package/src/package-check.ts +894 -0
  129. package/src/permissions.ts +295 -0
  130. package/src/recipients.ts +294 -0
  131. package/src/records.ts +172 -0
  132. package/src/require-capability.ts +106 -0
  133. package/src/settings-schema.ts +334 -0
  134. package/src/standard-schema.ts +39 -0
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Why a plugin on the data volume is not running.
3
+ *
4
+ * A finding travels as one of these codes plus the values its sentence needs,
5
+ * never as a sentence composed by the host. The interface is Swedish by
6
+ * default and this package is English, so what a board reads has to be a
7
+ * translation of the code: a sentence written where the finding is produced
8
+ * reaches the board panel in the language the server happens to be written in.
9
+ *
10
+ * Listed as values rather than as a bare union so a caller can walk them and
11
+ * prove it has a sentence for each. Part of the contract rather than an
12
+ * implementation detail - docs/plugin-contract.md lists the same set, and a
13
+ * plugin author reading why their package was skipped is reading one of these.
14
+ */
15
+ export const PLUGIN_FINDING_REASONS = [
16
+ /** The `openbrf` field failed validation. */
17
+ "manifest-invalid",
18
+ /** Built against a contract version this instance does not implement. */
19
+ "api-version-unsupported",
20
+ /** A declared entry file is not in the package. */
21
+ "entry-missing",
22
+ /** The server bundle does not export `createPlugin`. */
23
+ "entry-invalid",
24
+ /** `createPlugin` returned no NestJS dynamic module. */
25
+ "module-invalid",
26
+ /** Its module declares behaviour a plugin may not register. */
27
+ "module-refused",
28
+ /** Its module could not be built into the application. */
29
+ "module-failed",
30
+ /** The package carries its own copy of a host package it must share. */
31
+ "module-identity",
32
+ /** It asks for more than was consented to. */
33
+ "permissions-widened",
34
+ /** It handles a personal-data category that was not consented to. */
35
+ "personal-data-widened",
36
+ /** On the volume with no record of consent. */
37
+ "not-consented",
38
+ /** Switched off in the admin interface. */
39
+ "disabled",
40
+ /** It threw while being loaded. */
41
+ "load-failed",
42
+ /** Recorded as installed but not present. */
43
+ "not-on-volume",
44
+ /** The installed version declares an action the board did not consent to. */
45
+ "actions-widened",
46
+ /** An action the manifest declares could not be registered. */
47
+ "action-refused",
48
+ /**
49
+ * The installed version says otherwise than the board consented to about
50
+ * whether it is an AI package, in either direction.
51
+ */
52
+ "ai-changed",
53
+ /**
54
+ * The installed version reads another entitlement than the board consented
55
+ * to, may present the licence to a service the board was not told of, or
56
+ * declares a key of its issuer's the board has not consented to.
57
+ */
58
+ "licence-widened",
59
+ /**
60
+ * The installed version names another issuer of its licence than the board
61
+ * consented to, or no longer declares a key the board consented to.
62
+ */
63
+ "licence-issuer-changed",
64
+ /** It registered a website block its manifest does not declare. */
65
+ "block-refused",
66
+ /** One of its providers reaches for a core service a plugin may not hold. */
67
+ "forbidden-injection",
68
+ /**
69
+ * It declares the OAuth protected resource, and another installed plugin
70
+ * already does. The one installed first keeps it: the resource URL is the
71
+ * audience every issued token carries, so moving it would strand them all.
72
+ */
73
+ "oauth-resource-conflict",
74
+ /**
75
+ * A plugin it extends is not installed, not loaded, or switched off. The
76
+ * detail names it. An addon does not serve while its host plugin does not.
77
+ */
78
+ "extension-host-missing",
79
+ /** A plugin it extends declares no such extension point. */
80
+ "extension-point-unknown",
81
+ /**
82
+ * A point it extends is at another major version than the one it was
83
+ * written for.
84
+ */
85
+ "extension-version-unsupported",
86
+ /** It hands over a category of personal data the point does not accept. */
87
+ "extension-personal-data-refused",
88
+ /**
89
+ * Of it and a plugin it extends, one puts blocks on the website and the
90
+ * other holds a permission that reads the register. The detail names
91
+ * those permissions.
92
+ */
93
+ "extension-permission-refused",
94
+ /**
95
+ * It puts blocks on the website, and a plugin it extends handles personal
96
+ * data. The detail names those categories.
97
+ */
98
+ "extension-host-personal-data-refused",
99
+ /**
100
+ * The plugins joined to it by extensions, through one host plugin or
101
+ * several, hold one that puts blocks on the website and one that reads the
102
+ * address book. The detail names both.
103
+ */
104
+ "extension-group-refused",
105
+ /**
106
+ * It declares an extension point, or extends one, in a way the board has not
107
+ * consented to.
108
+ */
109
+ "extensions-widened",
110
+ /** A definition or contribution it registered could not be accepted. */
111
+ "extension-refused",
112
+ /**
113
+ * The installed version declares a recipient the board did not consent to:
114
+ * a new one, one at another origin, or one receiving more personal data.
115
+ */
116
+ "recipients-widened",
117
+ /**
118
+ * The installed version declares a device route the board has not consented
119
+ * to, or moves one (ADR 0031).
120
+ */
121
+ "device-routes-widened",
122
+ ] as const;
123
+
124
+ export type PluginFindingReason = (typeof PLUGIN_FINDING_REASONS)[number];
125
+
126
+ /**
127
+ * The values a finding's sentence is completed with.
128
+ *
129
+ * Identifiers, paths, numbers and what a thrown error said - never a sentence,
130
+ * and never personal data. A list stays a list rather than being joined here,
131
+ * because its members can have sentences of their own: a board told that a
132
+ * package handles a category it never agreed to has to read that category in
133
+ * its own language, not as `residency`.
134
+ */
135
+ export type PluginFindingDetail = Readonly<
136
+ Record<string, string | number | readonly string[]>
137
+ >;
138
+
139
+ /**
140
+ * The manifest rules whose refusal a board reads in its own language.
141
+ *
142
+ * A manifest that fails validation is reported as `manifest-invalid`, and
143
+ * what Zod says about a field is English for the plugin's author. The rules
144
+ * below are not about one field: they hold two declarations against each
145
+ * other, and a board reading why a package was skipped needs to be told which
146
+ * in a sentence of its own. So the refusal carries the code with the English
147
+ * line, and the interface translates the code. Any other problem stays the
148
+ * English line, which is what an author fixes the package from.
149
+ */
150
+ export const PLUGIN_MANIFEST_RULES = [
151
+ /** A device route overlaps the OAuth protected resource. */
152
+ "device-route-overlaps-oauth-resource",
153
+ /** A plugin with a device route also reads the register or the finances. */
154
+ "device-route-reads-register",
155
+ /** A plugin with a website block also reads the register or the finances. */
156
+ "blocks-read-register",
157
+ /** A plugin with a device route also proposes imports. */
158
+ "device-route-proposes-import",
159
+ /** A plugin with a website block also proposes imports. */
160
+ "blocks-propose-import",
161
+ ] as const;
162
+
163
+ export type PluginManifestRule = (typeof PLUGIN_MANIFEST_RULES)[number];