@roostorg/types 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roostorg/types",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "description": "Shared types across Coop services",
6
6
  "module": "transpiled/index.js",
7
7
  "typings": "./transpiled/index.d.ts",
@@ -190,5 +190,5 @@ export declare const ItemTypeKind: {
190
190
  USER: "USER";
191
191
  };
192
192
  export type ItemTypeKind = keyof typeof ItemTypeKind;
193
- export type { CoopIntegrationConfigEntry, CoopIntegrationPlugin, CoopIntegrationsConfig, IntegrationCredentialField, IntegrationId, IntegrationManifest, ModelCard, ModelCardField, ModelCardSection, ModelCardSubsection, StoredIntegrationConfigPayload, } from './integration.js';
193
+ export type { CoopIntegrationConfigEntry, CoopIntegrationPlugin, CoopIntegrationsConfig, IntegrationConfigField, IntegrationId, IntegrationManifest, ModelCard, ModelCardField, ModelCardSection, ModelCardSubsection, PluginSignalContext, PluginSignalDescriptor, StoredIntegrationConfigPayload, } from './integration.js';
194
194
  export { assertModelCardHasRequiredSections, isCoopIntegrationPlugin, REQUIRED_MODEL_CARD_SECTION_IDS, } from './integration.js';
@@ -70,11 +70,11 @@ export declare const REQUIRED_MODEL_CARD_SECTION_IDS: readonly ["modelDetails",
70
70
  */
71
71
  export declare function assertModelCardHasRequiredSections(card: ModelCard): void;
72
72
  /**
73
- * Describes a single credential field for integrations that require
74
- * API keys or other secrets. Used to generate or validate credential forms.
73
+ * Describes a single configuration field for integrations that require
74
+ * user-supplied config (e.g. API keys or other settings). Used to generate or validate config forms.
75
75
  */
76
- export type IntegrationCredentialField = Readonly<{
77
- /** Form field key (e.g. "apiKey", "labelerVersions"). */
76
+ export type IntegrationConfigField = Readonly<{
77
+ /** Form field key (e.g. "apiKey", "truePercentage"). */
78
78
  key: string;
79
79
  /** Human-readable label for the field. */
80
80
  label: string;
@@ -94,7 +94,7 @@ export type IntegrationCredentialField = Readonly<{
94
94
  export type IntegrationManifest = Readonly<{
95
95
  /** Unique integration id. Must be UPPER_SNAKE_CASE to align with GraphQL enums when used in COOP. */
96
96
  id: IntegrationId;
97
- /** Human-readable display name (e.g. "Google Content Safety API"). */
97
+ /** Human-readable display name shown in the UI (e.g. signal modal, integration cards). Exposed as Signal.integrationTitle. */
98
98
  name: string;
99
99
  /** Semantic version of the integration plugin (e.g. "1.0.0"). */
100
100
  version: string;
@@ -102,17 +102,13 @@ export type IntegrationManifest = Readonly<{
102
102
  description?: string;
103
103
  /** Link to documentation or product page. */
104
104
  docsUrl?: string;
105
- /** Optional URL to a logo image (or asset key if using a bundler). */
106
- logoUrl?: string;
107
- /** Optional URL to a logo variant (e.g. with background) for cards. */
108
- logoWithBackgroundUrl?: string;
109
- /** Whether this integration requires the user to supply credentials (e.g. API key). */
110
- requiresCredentials: boolean;
105
+ /** Whether this integration requires the user to supply config (e.g. API key). */
106
+ requiresConfig: boolean;
111
107
  /**
112
- * Schema for credential fields when requiresCredentials is true.
108
+ * Schema for configuration fields when requiresConfig is true.
113
109
  * Enables UI generation and validation without hardcoding per-integration forms.
114
110
  */
115
- credentialFields?: readonly IntegrationCredentialField[];
111
+ configurationFields?: readonly IntegrationConfigField[];
116
112
  /**
117
113
  * Optional list of signal type ids this integration provides (e.g. "ZENTROPI_LABELER").
118
114
  * Used by the platform to associate signals with this integration for display and gating.
@@ -126,6 +122,75 @@ export type IntegrationManifest = Readonly<{
126
122
  * registering.
127
123
  */
128
124
  modelCard?: ModelCard;
125
+ /**
126
+ * ------------------------------------------------------------
127
+ * LOGO/IMAGE SECTION:
128
+ * ------------------------------------------------------------
129
+ * The following logo/image sections are optional. If none provided will use a fallback Coop logo.
130
+ *
131
+ * Provide either logoUrl and logoWithBackgroundUrl or logoPath and logoWithBackgroundPath.
132
+ *
133
+ * If you provide logoPath and logoWithBackgroundPath, the server will serve the files at
134
+ * GET /api/v1/integration-logos/:integrationId and GET /api/v1/integration-logos/:integrationId/with-background
135
+ * and set logoUrl and logoWithBackgroundUrl accordingly.
136
+ * If you provide logoUrl and logoWithBackgroundUrl, the server will use those URLs directly.
137
+ * Prefered size: ~180x180px for logoUrl and ~120x120px for logoWithBackgroundUrl.
138
+ * Prefer a square or horizontal logo that scales well.
139
+ */
140
+ logoUrl?: string;
141
+ logoWithBackgroundUrl?: string;
142
+ logoPath?: string;
143
+ logoWithBackgroundPath?: string;
144
+ }>;
145
+ /** Context passed to plugin.createSignals() so the plugin can build signal instances with credential access. */
146
+ export type PluginSignalContext = Readonly<{
147
+ /** Integration id (e.g. "ACME_API") from the plugin manifest. */
148
+ integrationId: string;
149
+ /** Get stored credential/config for an org. Resolves to the JSON stored for this integration. */
150
+ getCredential: (orgId: string) => Promise<Record<string, unknown>>;
151
+ }>;
152
+ /** Minimal signal descriptor returned by a plugin. The platform adapts this to its internal SignalBase. */
153
+ export type PluginSignalDescriptor = Readonly<{
154
+ /** Stable signal type id (e.g. "ACME_MODERATION_SIGNAL"). Must match one of manifest.signalTypeIds. */
155
+ id: Readonly<{
156
+ type: string;
157
+ }>;
158
+ displayName: string;
159
+ description: string;
160
+ docsUrl: string | null;
161
+ recommendedThresholds: Readonly<{
162
+ highPrecisionThreshold: string | number;
163
+ highRecallThreshold: string | number;
164
+ }> | null;
165
+ supportedLanguages: readonly string[] | 'ALL';
166
+ pricingStructure: Readonly<{
167
+ type: 'FREE' | 'SUBSCRIPTION';
168
+ }>;
169
+ eligibleInputs: readonly string[];
170
+ outputType: Readonly<{
171
+ scalarType: string;
172
+ }>;
173
+ getCost: () => number;
174
+ /** Run the signal. Input shape is platform-defined; result must have outputType and score. */
175
+ run: (input: unknown) => Promise<unknown>;
176
+ getDisabledInfo: (orgId: string) => Promise<{
177
+ disabled: false;
178
+ disabledMessage?: string;
179
+ } | {
180
+ disabled: true;
181
+ disabledMessage: string;
182
+ }>;
183
+ needsMatchingValues: boolean;
184
+ eligibleSubcategories: ReadonlyArray<{
185
+ id: string;
186
+ label: string;
187
+ description?: string;
188
+ childrenIds: readonly string[];
189
+ }>;
190
+ needsActionPenalties: boolean;
191
+ /** Integration id (same as context.integrationId). */
192
+ integration: string;
193
+ allowedInAutomatedRules: boolean;
129
194
  }>;
130
195
  /**
131
196
  * Plugin contract that third-party integration packages must implement.
@@ -136,6 +201,9 @@ export type IntegrationManifest = Readonly<{
136
201
  * const manifest: IntegrationManifest = { id: 'ACME_API', name: 'Acme API', ... };
137
202
  * const plugin: CoopIntegrationPlugin = { manifest };
138
203
  * export default plugin;
204
+ *
205
+ * To power routing/enforcement rules, also implement createSignals(context) and
206
+ * return one descriptor per manifest.signalTypeIds entry.
139
207
  */
140
208
  export type CoopIntegrationPlugin = Readonly<{
141
209
  manifest: IntegrationManifest;
@@ -144,6 +212,15 @@ export type CoopIntegrationPlugin = Readonly<{
144
212
  * If present, adopters can pass non-secret config in the integrations config file.
145
213
  */
146
214
  configSchema?: unknown;
215
+ /**
216
+ * Optional. If this integration provides signals for use in rules, implement this.
217
+ * Return one descriptor per signal type id listed in manifest.signalTypeIds.
218
+ * The platform will register these so they appear in the rule builder and can be used in conditions.
219
+ */
220
+ createSignals?: (context: PluginSignalContext) => ReadonlyArray<Readonly<{
221
+ signalTypeId: string;
222
+ signal: PluginSignalDescriptor;
223
+ }>>;
147
224
  }>;
148
225
  /**
149
226
  * Single entry in the adopters' integrations config file.
@@ -177,7 +254,7 @@ export type CoopIntegrationsConfig = Readonly<{
177
254
  * Shape of the config stored in the database for each integration (per org).
178
255
  * Stored in a generic table as JSON: one row per (org_id, integration_id) with
179
256
  * config as a JSON-serializable object. Each integration defines its own required
180
- * fields via IntegrationManifest.credentialFields; the app validates and
257
+ * fields via IntegrationManifest.configurationFields; the app validates and
181
258
  * serializes/deserializes to this type.
182
259
  *
183
260
  * Only JSON-serializable values (no functions, symbols, or BigInt) should be
@@ -44,5 +44,5 @@ export function isCoopIntegrationPlugin(value) {
44
44
  return (typeof m.id === 'string' &&
45
45
  typeof m.name === 'string' &&
46
46
  typeof m.version === 'string' &&
47
- typeof m.requiresCredentials === 'boolean');
47
+ typeof m.requiresConfig === 'boolean');
48
48
  }