@protobase/schema 0.119.6 → 0.120.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.
@@ -27,6 +27,7 @@ import { PropShapes, RefShape, pruneByShape, shapes } from "./ref-shape.js";
27
27
  import { SearchTerm, matchedSearchField, matchesSearch, searchTerms, termMatches } from "./search-match.js";
28
28
  import { defaultRecentLimit, navRecentErrors, statusTones } from "./nav-recent.js";
29
29
  import { navStartErrors } from "./nav-start.js";
30
+ import { PluginCapabilities, missingCapabilities } from "./plugin-capabilities.js";
30
31
  import { PluginHost, PluginRequirement, inRange, pluginProblem } from "./plugin-version.js";
31
32
  import { redactSecrets } from "./redact-secrets.js";
32
33
  import { firstPartyCodeKey } from "./first-party-code.js";
@@ -67,4 +68,4 @@ import { guestCallsPath } from "./calls/call-guests.js";
67
68
  import { CallRing, callsChannelEvent, declineWord, ringNotice, ringsPath } from "./calls/call-rings.js";
68
69
  import { ReorderSpan, reorderSpan } from "./reorder-span.js";
69
70
  import { MovePlan, Ranked, movePlan } from "./move-plan.js";
70
- export { type AddressCheck, type Availability, type CallCandidate, type CallClientMessage, type CallDescription, type CallGuestLink, type CallGuestRefusal, type CallGuestState, type CallLeftReason, type CallLobbyGuest, type CallMode, type CallRemoteTrack, type CallResume, type CallRing, type CallRosterMember, type CallServerMessage, type CallTrackRequest, type CallTrackSource, type CallVideoLayer, type FormulaNode, type KeyType, type Locale, type MobileReleaseAnswer, type MovePlan, type PathLookup, type PersonStatus, type PluginHost, type PluginRequirement, type PropShapes, type Ranked, type RecordUse, type RefShape, type ReleaseBinding, type ReorderSpan, type RunnerRegistration, type SearchTerm, type StatusInput, type TemplatePath, type WorkflowCacheAdvice, type WorkflowRunTrace, type WorkflowStatus, type WorkflowTraceHeld, type WorkflowTraceStep, type WorkflowTypeEntry, type WorkflowTypeList, actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, appReadMaxBytes, appReadParam, appReadUrl, applyAssistantEvent, authBasePath, availabilities, bareFilterFields, boardErrors, bottomBarFor, bridgeSocketPath, bridgeTokenParam, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, embeddedFilterFields, emptyAssistantState, encodeKey, fieldRefsIn, filePath, filesPath, fillAddress, fillAddressFrom, fillFilter, fillText, filterField, findField, firstPartyCodeKey, followableRowButton, grantsOf, guestCallsPath, heldCapabilities, heldStatus, historyIdParam, historyIdPattern, historyPath, hostPlaceholder, hrefField, hrefPlaceholders, humanize, inRange, isAppRead, isFieldRef, isGroupChart, isLocale, isUserTableName, keyTypes, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, lookupLink, markFieldRefs, matchedSearchField, matchesSearch, maxLabelLength, maxNameBytes, maxOrganizationNameBytes, maxRelatedDepth, maxRelatedTerms, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, movePlan, navRecentErrors, navStartErrors, organizationColumn, parseCapability, parseFormula, parseSize, parseTable, parseTemplatePath, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordJsonSchema, recordTitle, recordTitleField, recordValueAt, redactSecrets, relatedErrors, relatedTarget, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, reorderSpan, reservedFieldNames, reservedWords, resolvableStatuses, resourceField, ringNotice, ringsPath, rowButtonChoiceFields, rowButtonChoices, rowButtonErrors, rowButtonFields, rowButtonTarget, runnerRegistrationParam, runnerRegistrationPath, runnerRegistrationRoute, searchTerms, secondStepParam, serviceWorkerFile, shapes, shownInputs, splitRelated, statusPath, statusRuns, statusTextProblem, statusTones, storageNamePattern, storedFileRef, tableDisplay, tapUrl, templatePlaceholders, termMatches, textPlaceholders, unmarkFieldRefs, updateSetErrors, updateValues, userTableName, valueText, viewOfList, webhookResources, wholePlaceholder, withLookups, workflowResources, workflowRunParam, workflowRunTracePath, workflowRunTraceRoute, workflowRunsPath, workflowStatusTones, workflowStatuses, workflowTraceAfterParam, workflowTraceRevision, workflowTraceRevisionParam, workflowTypesPath };
71
+ export { type AddressCheck, type Availability, type CallCandidate, type CallClientMessage, type CallDescription, type CallGuestLink, type CallGuestRefusal, type CallGuestState, type CallLeftReason, type CallLobbyGuest, type CallMode, type CallRemoteTrack, type CallResume, type CallRing, type CallRosterMember, type CallServerMessage, type CallTrackRequest, type CallTrackSource, type CallVideoLayer, type FormulaNode, type KeyType, type Locale, type MobileReleaseAnswer, type MovePlan, type PathLookup, type PersonStatus, type PluginCapabilities, type PluginHost, type PluginRequirement, type PropShapes, type Ranked, type RecordUse, type RefShape, type ReleaseBinding, type ReorderSpan, type RunnerRegistration, type SearchTerm, type StatusInput, type TemplatePath, type WorkflowCacheAdvice, type WorkflowRunTrace, type WorkflowStatus, type WorkflowTraceHeld, type WorkflowTraceStep, type WorkflowTypeEntry, type WorkflowTypeList, actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, appReadMaxBytes, appReadParam, appReadUrl, applyAssistantEvent, authBasePath, availabilities, bareFilterFields, boardErrors, bottomBarFor, bridgeSocketPath, bridgeTokenParam, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, embeddedFilterFields, emptyAssistantState, encodeKey, fieldRefsIn, filePath, filesPath, fillAddress, fillAddressFrom, fillFilter, fillText, filterField, findField, firstPartyCodeKey, followableRowButton, grantsOf, guestCallsPath, heldCapabilities, heldStatus, historyIdParam, historyIdPattern, historyPath, hostPlaceholder, hrefField, hrefPlaceholders, humanize, inRange, isAppRead, isFieldRef, isGroupChart, isLocale, isUserTableName, keyTypes, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, lookupLink, markFieldRefs, matchedSearchField, matchesSearch, maxLabelLength, maxNameBytes, maxOrganizationNameBytes, maxRelatedDepth, maxRelatedTerms, maxStatusText, missingCapabilities, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, movePlan, navRecentErrors, navStartErrors, organizationColumn, parseCapability, parseFormula, parseSize, parseTable, parseTemplatePath, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordJsonSchema, recordTitle, recordTitleField, recordValueAt, redactSecrets, relatedErrors, relatedTarget, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, reorderSpan, reservedFieldNames, reservedWords, resolvableStatuses, resourceField, ringNotice, ringsPath, rowButtonChoiceFields, rowButtonChoices, rowButtonErrors, rowButtonFields, rowButtonTarget, runnerRegistrationParam, runnerRegistrationPath, runnerRegistrationRoute, searchTerms, secondStepParam, serviceWorkerFile, shapes, shownInputs, splitRelated, statusPath, statusRuns, statusTextProblem, statusTones, storageNamePattern, storedFileRef, tableDisplay, tapUrl, templatePlaceholders, termMatches, textPlaceholders, unmarkFieldRefs, updateSetErrors, updateValues, userTableName, valueText, viewOfList, webhookResources, wholePlaceholder, withLookups, workflowResources, workflowRunParam, workflowRunTracePath, workflowRunTraceRoute, workflowRunsPath, workflowStatusTones, workflowStatuses, workflowTraceAfterParam, workflowTraceRevision, workflowTraceRevisionParam, workflowTypesPath };
package/dist/internal.js CHANGED
@@ -34,6 +34,7 @@ import { runnerRegistrationParam, runnerRegistrationPath, runnerRegistrationRout
34
34
  import { workflowRunParam, workflowRunTracePath, workflowRunTraceRoute, workflowRunsPath, workflowTraceAfterParam, workflowTraceRevisionParam } from "./workflows/workflow-trace-path.js";
35
35
  import { workflowTraceRevision } from "./workflows/workflow-trace-revision.js";
36
36
  import { pruneByShape, shapes } from "./ref-shape.js";
37
+ import { missingCapabilities } from "./plugin-capabilities.js";
37
38
  import { inRange, pluginProblem } from "./plugin-version.js";
38
39
  import { redactSecrets } from "./redact-secrets.js";
39
40
  import { firstPartyCodeKey } from "./first-party-code.js";
@@ -66,4 +67,4 @@ import { guestCallsPath } from "./calls/call-guests.js";
66
67
  import { callsChannelEvent, declineWord, ringNotice, ringsPath } from "./calls/call-rings.js";
67
68
  import { reorderSpan } from "./reorder-span.js";
68
69
  import { movePlan } from "./move-plan.js";
69
- export { actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, appReadMaxBytes, appReadParam, appReadUrl, applyAssistantEvent, authBasePath, availabilities, bareFilterFields, boardErrors, bottomBarFor, bridgeSocketPath, bridgeTokenParam, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, embeddedFilterFields, emptyAssistantState, encodeKey, fieldRefsIn, filePath, filesPath, fillAddress, fillAddressFrom, fillFilter, fillText, filterField, findField, firstPartyCodeKey, followableRowButton, grantsOf, guestCallsPath, heldCapabilities, heldStatus, historyIdParam, historyIdPattern, historyPath, hostPlaceholder, hrefField, hrefPlaceholders, humanize, inRange, isAppRead, isFieldRef, isGroupChart, isLocale, isUserTableName, keyTypes, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, lookupLink, markFieldRefs, matchedSearchField, matchesSearch, maxLabelLength, maxNameBytes, maxOrganizationNameBytes, maxRelatedDepth, maxRelatedTerms, maxStatusText, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, movePlan, navRecentErrors, navStartErrors, organizationColumn, parseCapability, parseFormula, parseSize, parseTable, parseTemplatePath, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordJsonSchema, recordTitle, recordTitleField, recordValueAt, redactSecrets, relatedErrors, relatedTarget, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, reorderSpan, reservedFieldNames, reservedWords, resolvableStatuses, resourceField, ringNotice, ringsPath, rowButtonChoiceFields, rowButtonChoices, rowButtonErrors, rowButtonFields, rowButtonTarget, runnerRegistrationParam, runnerRegistrationPath, runnerRegistrationRoute, searchTerms, secondStepParam, serviceWorkerFile, shapes, shownInputs, splitRelated, statusPath, statusRuns, statusTextProblem, statusTones, storageNamePattern, storedFileRef, tableDisplay, tapUrl, templatePlaceholders, termMatches, textPlaceholders, unmarkFieldRefs, updateSetErrors, updateValues, userTableName, valueText, viewOfList, webhookResources, wholePlaceholder, withLookups, workflowResources, workflowRunParam, workflowRunTracePath, workflowRunTraceRoute, workflowRunsPath, workflowStatusTones, workflowStatuses, workflowTraceAfterParam, workflowTraceRevision, workflowTraceRevisionParam, workflowTypesPath };
70
+ export { actionConditionError, actionInputErrors, addressErrors, addressPlaceholders, apiOriginMeta, appHrefError, appReadMaxBytes, appReadParam, appReadUrl, applyAssistantEvent, authBasePath, availabilities, bareFilterFields, boardErrors, bottomBarFor, bridgeSocketPath, bridgeTokenParam, builtInFieldTypes, callsChannelEvent, capacitorOrigin, cardPhotoLimit, chartFields, checkEventFilter, checkedAccept, checkedProvider, confirmationMinutes, datesErrors, declineWord, decodeKey, defaultRecentLimit, deviceIdParam, devicesPath, displayFields, emailCodeMinutes, embeddedFilterFields, emptyAssistantState, encodeKey, fieldRefsIn, filePath, filesPath, fillAddress, fillAddressFrom, fillFilter, fillText, filterField, findField, firstPartyCodeKey, followableRowButton, grantsOf, guestCallsPath, heldCapabilities, heldStatus, historyIdParam, historyIdPattern, historyPath, hostPlaceholder, hrefField, hrefPlaceholders, humanize, inRange, isAppRead, isFieldRef, isGroupChart, isLocale, isUserTableName, keyTypes, labelFieldOf, layoutItems, leavesApp, linkActionError, listColumnNames, locales, lookupLink, markFieldRefs, matchedSearchField, matchesSearch, maxLabelLength, maxNameBytes, maxOrganizationNameBytes, maxRelatedDepth, maxRelatedTerms, maxStatusText, missingCapabilities, mobileReleaseBasePath, mobileReleaseParams, mobileReleasePath, mobileReleaseQuery, mobileReleasesPath, movePlan, navRecentErrors, navStartErrors, organizationColumn, parseCapability, parseFormula, parseSize, parseTable, parseTemplatePath, pickLocale, pluginProblem, promptError, promptFields, pruneByShape, pushRecord, readEventStream, recordJsonSchema, recordTitle, recordTitleField, recordValueAt, redactSecrets, relatedErrors, relatedTarget, releaseManifestFile, releaseStatementContext, releaseStatementFile, renderPrompt, reorderSpan, reservedFieldNames, reservedWords, resolvableStatuses, resourceField, ringNotice, ringsPath, rowButtonChoiceFields, rowButtonChoices, rowButtonErrors, rowButtonFields, rowButtonTarget, runnerRegistrationParam, runnerRegistrationPath, runnerRegistrationRoute, searchTerms, secondStepParam, serviceWorkerFile, shapes, shownInputs, splitRelated, statusPath, statusRuns, statusTextProblem, statusTones, storageNamePattern, storedFileRef, tableDisplay, tapUrl, templatePlaceholders, termMatches, textPlaceholders, unmarkFieldRefs, updateSetErrors, updateValues, userTableName, valueText, viewOfList, webhookResources, wholePlaceholder, withLookups, workflowResources, workflowRunParam, workflowRunTracePath, workflowRunTraceRoute, workflowRunsPath, workflowStatusTones, workflowStatuses, workflowTraceAfterParam, workflowTraceRevision, workflowTraceRevisionParam, workflowTypesPath };
@@ -0,0 +1,16 @@
1
+ //#region src/plugin-capabilities.d.ts
2
+ /**
3
+ * What a plugin uses from Protobase, as `protobase build-plugin` records it in plugin.json, or what an app provides:
4
+ * the names imported from each module the app shares with plugins (`*` for the whole module, as `import * as` takes
5
+ * it), and the extension points filled, such as `components` or `shell.rightPanel`.
6
+ */
7
+ export type PluginCapabilities = {
8
+ imports: Record<string, readonly string[]>;
9
+ extensionPoints: readonly string[];
10
+ };
11
+ /**
12
+ * What `uses` names that `has` lacks, each as the notice shows it: `Name from module`, a whole `module`, or `the
13
+ * extension point name`. Empty when the app provides all of it, whatever versions it has.
14
+ */
15
+ export declare const missingCapabilities: (uses: PluginCapabilities, has: PluginCapabilities) => string[];
16
+ //#endregion
@@ -0,0 +1,16 @@
1
+ //#region src/plugin-capabilities.ts
2
+ /**
3
+ * What `uses` names that `has` lacks, each as the notice shows it: `Name from module`, a whole `module`, or `the
4
+ * extension point name`. Empty when the app provides all of it, whatever versions it has.
5
+ */
6
+ const missingCapabilities = (uses, has) => {
7
+ const imports = Object.entries(uses.imports).flatMap(([module, names]) => {
8
+ const provided = has.imports[module];
9
+ if (provided === void 0) return [module];
10
+ return names.filter((name) => name !== "*" && !provided.includes(name)).map((name) => `${name} from ${module}`);
11
+ });
12
+ const extensionPoints = uses.extensionPoints.filter((point) => !has.extensionPoints.includes(point)).map((point) => `the extension point ${point}`);
13
+ return [...imports, ...extensionPoints];
14
+ };
15
+ //#endregion
16
+ export { missingCapabilities };
@@ -1,3 +1,4 @@
1
+ import { PluginCapabilities } from "./plugin-capabilities.js";
1
2
  //#region src/plugin-version.d.ts
2
3
  /**
3
4
  * Whether `version` is in `range`: comparators such as `>=0.12.0 <1.0.0`, separated by spaces, all of which must hold.
@@ -5,19 +6,23 @@
5
6
  * in >=0.12.9 and <0.13.0, not in >=0.13.0. Undefined when the range is not one of those, or the version is no semver version.
6
7
  */
7
8
  export declare const inRange: (version: string, range: string) => boolean | undefined;
8
- /** What a plugin's plugin.json says it is built for: a plugin API, and the Protobase versions it runs on. */
9
- export type PluginRequirement = {
9
+ /**
10
+ * What a plugin's plugin.json says it is built for: a plugin API, what it uses from Protobase, and the Protobase versions
11
+ * it runs on when its author names them (`engines.protobase`).
12
+ */
13
+ export type PluginRequirement = PluginCapabilities & {
10
14
  api: number;
11
- protobase: string;
15
+ protobase?: string;
12
16
  };
13
- /** An app that loads plugins: the plugin API its @protobase/ui provides, and its Protobase version. */
14
- export type PluginHost = {
17
+ /** An app that loads plugins: the plugin API its @protobase/ui provides, its Protobase version, and what it provides. */
18
+ export type PluginHost = PluginCapabilities & {
15
19
  api: number;
16
20
  version: string;
17
21
  };
18
22
  /**
19
23
  * Why an app does not load a plugin built for `requirement`, or undefined when it does: the plugin API must be the
20
- * app's, and the app's Protobase version in the plugin's range.
24
+ * app's, the app's Protobase version in the plugin's range when it names one, and the app must provide everything the
25
+ * plugin uses.
21
26
  */
22
27
  export declare const pluginProblem: (requirement: PluginRequirement, host: PluginHost) => string | undefined;
23
28
  //#endregion
@@ -1,3 +1,4 @@
1
+ import { missingCapabilities } from "./plugin-capabilities.js";
1
2
  import semver from "semver";
2
3
  //#region src/plugin-version.ts
3
4
  const isComparator = (text) => {
@@ -21,13 +22,18 @@ const inRange = (version, range) => {
21
22
  };
22
23
  /**
23
24
  * Why an app does not load a plugin built for `requirement`, or undefined when it does: the plugin API must be the
24
- * app's, and the app's Protobase version in the plugin's range.
25
+ * app's, the app's Protobase version in the plugin's range when it names one, and the app must provide everything the
26
+ * plugin uses.
25
27
  */
26
28
  const pluginProblem = (requirement, host) => {
27
29
  if (requirement.api !== host.api) return `it is built for plugin API ${requirement.api}, and this app has plugin API ${host.api}`;
28
- const fits = inRange(host.version, requirement.protobase);
29
- if (fits === void 0) return `its Protobase range "${requirement.protobase}" is not one this app reads, such as >=0.12.0`;
30
- if (!fits) return `it needs Protobase ${requirement.protobase}, and this app runs ${host.version}`;
30
+ if (requirement.protobase !== void 0) {
31
+ const fits = inRange(host.version, requirement.protobase);
32
+ if (fits === void 0) return `its Protobase range "${requirement.protobase}" is not one this app reads, such as >=0.12.0`;
33
+ if (!fits) return `it needs Protobase ${requirement.protobase}, and this app runs ${host.version}`;
34
+ }
35
+ const missing = missingCapabilities(requirement, host);
36
+ if (missing.length > 0) return `it uses what this app does not have: ${missing.join(", ")}`;
31
37
  };
32
38
  //#endregion
33
39
  export { inRange, pluginProblem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/schema",
3
- "version": "0.119.6",
3
+ "version": "0.120.0",
4
4
  "description": "Resource, field, view and access definitions for Protobase configs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {