@plitzi/sdk-shared 0.39.1 → 0.39.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.
- package/CHANGELOG.md +11 -0
- package/dist/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/actions/access.mjs +1 -2
- package/dist/actions/cron.mjs +1 -2
- package/dist/actions/failureHandler.mjs +1 -2
- package/dist/actions/flowDelay.d.ts +6 -0
- package/dist/actions/flowDelay.mjs +3 -0
- package/dist/actions/functions.d.ts +6 -3
- package/dist/actions/functions.mjs +12 -8
- package/dist/actions/index.d.ts +2 -1
- package/dist/actions/index.mjs +10 -9
- package/dist/actions/jobs.mjs +1 -2
- package/dist/actions/smtp.mjs +1 -2
- package/dist/actions/triggerParams.mjs +1 -2
- package/dist/actions/triggers.mjs +1 -2
- package/dist/actions/validateDocument.mjs +133 -123
- package/dist/activity/describe.mjs +1 -2
- package/dist/activity/guard.mjs +1 -2
- package/dist/activity/types.mjs +1 -2
- package/dist/auth/failureChannel.mjs +1 -2
- package/dist/auth/visitorRoles.mjs +1 -2
- package/dist/authoring/builder.mjs +1 -2
- package/dist/authoring/declare.mjs +1 -2
- package/dist/authoring/elementCallbacks.mjs +1 -2
- package/dist/authoring/index.mjs +3 -3
- package/dist/authoring/paramSpec.mjs +1 -2
- package/dist/authoring/spaceCallbacks.mjs +1 -2
- package/dist/builder/contexts/BuilderContext.mjs +1 -2
- package/dist/builder/contexts/index.mjs +1 -2
- package/dist/conditions/dates.d.ts +2 -0
- package/dist/conditions/dates.mjs +12 -0
- package/dist/conditions/evaluateRuleGroup.d.ts +13 -0
- package/dist/conditions/evaluateRuleGroup.mjs +4 -0
- package/dist/conditions/evaluator.d.ts +39 -0
- package/dist/conditions/evaluator.mjs +75 -0
- package/dist/conditions/index.d.ts +10 -0
- package/dist/conditions/index.mjs +5 -0
- package/dist/conditions/rules.d.ts +3 -0
- package/dist/conditions/rules.mjs +3 -0
- package/dist/conditions/types.d.ts +44 -0
- package/dist/connectors/constants.mjs +1 -2
- package/dist/connectors/manifestTokens.mjs +1 -2
- package/dist/connectors/presets.mjs +1 -2
- package/dist/connectors/validateManifest.mjs +56 -57
- package/dist/dataSource/computed.mjs +16 -17
- package/dist/dataSource/getBindingsDetails.d.ts +5 -6
- package/dist/dataSource/getBindingsDetails.mjs +65 -40
- package/dist/dataSource/globalSources.d.ts +1 -1
- package/dist/dataSource/globalSources.mjs +1 -2
- package/dist/dataSource/helpers/getSourceName.mjs +1 -2
- package/dist/dataSource/index.mjs +5 -5
- package/dist/dataSource/utility/arrayMap.mjs +2 -2
- package/dist/dataSource/utility/capitalize.mjs +1 -2
- package/dist/dataSource/utility/checkboxParams.mjs +1 -2
- package/dist/dataSource/utility/dateConverter.mjs +0 -1
- package/dist/dataSource/utility/index.mjs +15 -16
- package/dist/dataSource/utility/not.mjs +1 -2
- package/dist/dataSource/utility/staticValue.mjs +0 -1
- package/dist/dataSource/utility/stringToArray.mjs +0 -1
- package/dist/dataSource/utility/styleSelector.mjs +1 -2
- package/dist/dataSource/utility/styleVariant.mjs +2 -3
- package/dist/dataSource/utility/truthiness.mjs +1 -2
- package/dist/dataSource/utility/twigTemplate.mjs +0 -1
- package/dist/dataSource/variables/resolveVariables.mjs +2 -3
- package/dist/dates/formatDate.mjs +29 -30
- package/dist/dates/isDate.mjs +1 -2
- package/dist/devTools/chrome.mjs +1 -2
- package/dist/devTools/debugCookie.mjs +1 -2
- package/dist/devTools/index.mjs +5 -5
- package/dist/devTools/interactionLog.mjs +1 -2
- package/dist/devTools/react/DevToolsContext.mjs +1 -2
- package/dist/devTools/sight/sight.mjs +1 -2
- package/dist/devTools/utils/PlitziConsole.mjs +1 -2
- package/dist/elements/ComponentContext.mjs +1 -2
- package/dist/flags/flagsCookie.mjs +5 -6
- package/dist/flags/index.d.ts +1 -0
- package/dist/flags/index.mjs +4 -3
- package/dist/flags/overrides.d.ts +36 -0
- package/dist/flags/overrides.mjs +13 -0
- package/dist/flags/react/useFlagResolution.mjs +5 -6
- package/dist/flags/resolveFlags.d.ts +1 -1
- package/dist/flags/resolveFlags.mjs +2 -3
- package/dist/flags/schemaFlag.mjs +1 -2
- package/dist/functions/contract.d.ts +326 -0
- package/dist/functions/contract.mjs +3 -0
- package/dist/functions/index.d.ts +15 -0
- package/dist/functions/index.mjs +9 -0
- package/dist/functions/kv.d.ts +80 -0
- package/dist/functions/kvChange.d.ts +67 -0
- package/dist/functions/kvChange.mjs +24 -0
- package/dist/functions/later.d.ts +18 -0
- package/dist/functions/messages.d.ts +4 -0
- package/dist/functions/messages.mjs +205 -0
- package/dist/functions/protocol.d.ts +416 -0
- package/dist/functions/protocol.mjs +37 -0
- package/dist/functions/rateLimit.d.ts +17 -0
- package/dist/functions/rateLimit.mjs +0 -0
- package/dist/functions/refusal.d.ts +26 -0
- package/dist/functions/refusal.mjs +11 -0
- package/dist/functions/runtime.d.ts +44 -0
- package/dist/functions/runtime.mjs +13 -0
- package/dist/functions/sizes.d.ts +27 -0
- package/dist/functions/sizes.mjs +7 -0
- package/dist/functions/wire.d.ts +11 -0
- package/dist/functions/wire.mjs +39 -0
- package/dist/helpers/canonicalJson.mjs +1 -2
- package/dist/helpers/clipboard.mjs +1 -2
- package/dist/helpers/cookies.mjs +1 -2
- package/dist/helpers/deepEqual/deepEqual.d.ts +5 -0
- package/dist/helpers/deepEqual/deepEqual.mjs +44 -0
- package/dist/helpers/deepEqual/index.d.ts +1 -0
- package/dist/helpers/deepEqual/index.mjs +1 -0
- package/dist/helpers/eventTarget.mjs +1 -2
- package/dist/helpers/fetchManifest.mjs +1 -2
- package/dist/helpers/images.mjs +1 -2
- package/dist/helpers/index.d.ts +4 -6
- package/dist/helpers/index.mjs +24 -20
- package/dist/helpers/interval.mjs +1 -2
- package/dist/helpers/isRecord.mjs +1 -2
- package/dist/helpers/keys.mjs +1 -2
- package/dist/helpers/lodash/camelCase.d.ts +1 -0
- package/dist/helpers/lodash/camelCase.mjs +7 -0
- package/dist/helpers/lodash/capitalize.d.ts +1 -0
- package/dist/helpers/lodash/capitalize.mjs +5 -0
- package/dist/helpers/lodash/cloneDeep.d.ts +8 -0
- package/dist/helpers/lodash/cloneDeep.mjs +53 -0
- package/dist/helpers/lodash/get.d.ts +11 -0
- package/dist/helpers/lodash/get.mjs +14 -0
- package/dist/helpers/lodash/has.d.ts +2 -0
- package/dist/helpers/lodash/has.mjs +12 -0
- package/dist/helpers/lodash/index.d.ts +11 -0
- package/dist/helpers/lodash/index.mjs +7 -0
- package/dist/helpers/lodash/omit.d.ts +4 -0
- package/dist/helpers/lodash/omit.mjs +35 -0
- package/dist/helpers/lodash/set.d.ts +2 -0
- package/dist/helpers/lodash/set.mjs +20 -0
- package/dist/helpers/lodash/shared.d.ts +2 -0
- package/dist/helpers/lodash/shared.mjs +37 -0
- package/dist/helpers/reducerOrigin.mjs +1 -2
- package/dist/helpers/replaceEqualDeep/index.d.ts +1 -0
- package/dist/helpers/replaceEqualDeep/index.mjs +1 -0
- package/dist/helpers/replaceEqualDeep/replaceEqualDeep.d.ts +12 -0
- package/dist/helpers/replaceEqualDeep/replaceEqualDeep.mjs +30 -0
- package/dist/helpers/resources.d.ts +21 -0
- package/dist/helpers/resources.mjs +40 -0
- package/dist/helpers/scroll.mjs +1 -2
- package/dist/helpers/security.d.ts +15 -0
- package/dist/helpers/security.mjs +8 -4
- package/dist/helpers/spaceRoot.mjs +1 -2
- package/dist/helpers/syntaxHighlight.mjs +1 -2
- package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +75 -76
- package/dist/helpers/twigWrapper/Evaluator/helpers.mjs +1 -2
- package/dist/helpers/twigWrapper/Lexer/Lexer.mjs +1 -2
- package/dist/helpers/twigWrapper/Lexer/types.mjs +1 -2
- package/dist/helpers/twigWrapper/Parser/Cursor.mjs +1 -2
- package/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs +1 -2
- package/dist/helpers/twigWrapper/Parser/Parser.mjs +1 -2
- package/dist/helpers/twigWrapper/Parser/helpers.mjs +1 -2
- package/dist/helpers/twigWrapper/TemplateCache/TemplateCache.mjs +1 -2
- package/dist/helpers/twigWrapper/charClass.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/arrays.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/catalog/index.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/dateParts.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/dates.mjs +13 -14
- package/dist/helpers/twigWrapper/filters/filters.mjs +21 -22
- package/dist/helpers/twigWrapper/filters/hashing.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/misc.mjs +27 -28
- package/dist/helpers/twigWrapper/filters/numbers.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/objects.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/raw.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/strings.mjs +23 -24
- package/dist/helpers/twigWrapper/filters/types.mjs +1 -2
- package/dist/helpers/twigWrapper/filters/values.mjs +1 -2
- package/dist/helpers/twigWrapper/index.mjs +8 -8
- package/dist/helpers/twigWrapper/inspectTemplate.mjs +12 -13
- package/dist/helpers/twigWrapper/processTwig/helpers.mjs +1 -2
- package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +1 -2
- package/dist/helpers/twigWrapper/processTwig/resolveStepParam.mjs +1 -2
- package/dist/helpers/twigWrapper/templateRoots.d.ts +3 -9
- package/dist/helpers/twigWrapper/templateRoots.mjs +14 -9
- package/dist/helpers/twigWrapper/tokens/hasTemplateSyntax.mjs +1 -2
- package/dist/helpers/twigWrapper/tokens/hasValidToken.mjs +1 -2
- package/dist/helpers/twigWrapper/tokens/tokenPatterns.mjs +1 -2
- package/dist/helpers/utils.mjs +2 -3
- package/dist/history/describe.mjs +1 -2
- package/dist/history/diff.mjs +1 -2
- package/dist/hooks/index.mjs +5 -5
- package/dist/hooks/useFontHead.mjs +1 -2
- package/dist/hooks/useNetwork.mjs +1 -2
- package/dist/hooks/usePlitzi.d.ts +7 -6
- package/dist/hooks/usePlitzi.mjs +1 -2
- package/dist/hooks/useStableValue.mjs +5 -6
- package/dist/navigation/index.mjs +3 -3
- package/dist/navigation/matchPath.mjs +19 -11
- package/dist/navigation/routes.mjs +57 -38
- package/dist/navigation/sitemap.mjs +9 -10
- package/dist/network/entitlements.d.ts +21 -0
- package/dist/network/entitlements.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddElementMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddPluginMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceCloneElementMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceDeployMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceMoveElementMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpacePublishMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceRemoveElementMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceRemovePluginMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceRenameElementMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateElementMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateElementsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSchemaMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/actions/SpaceAddActionMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRemoveActionMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRunActionMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/actions/SpaceUpdateActionMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceAddCdnBucketMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceAddCdnMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceRemoveCdnBucketMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceRemoveCdnMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceSetCdnCredentialMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceUpdateCdnBucketMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceUpdateCdnMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceAddConnectorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceRemoveConnectorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceUpdateConnectorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceAddCredentialMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceRemoveCredentialMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceUpdateCredentialMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/folders/SpaceAddPageFolderMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/folders/SpaceRemovePageFolderMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/folders/SpaceUpdatePageFolderMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceInstallTemplateFunctionsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/jobs/SpaceControlJobMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/pages/SpaceAddPageMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/pages/SpaceHomePageMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/pages/SpaceRemovePageMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/pages/SpaceUpdatePageMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/resources/SpaceAddResourceMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/resources/SpaceMoveResourceMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/resources/SpaceRemoveResourceMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/variables/SpaceAddVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/variables/SpaceRemoveVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/variables/SpaceUpdateVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/StyleUpdateMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/StyleUpdateSettingsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/fonts/StyleAddFontMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/fonts/StyleRemoveFontMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/fonts/StyleUpdateFontMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleAddSelectorVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleRemoveSelectorVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleUpdateSelectorVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/selectors/StyleAddSelectorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/selectors/StyleRemoveSelectorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/selectors/StyleRemoveSelectorsMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/selectors/StyleUpdateSelectorMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/variables/StyleAddVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/variables/StyleRemoveVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/Style/variables/StyleUpdateVariableMutation.mjs +1 -2
- package/dist/network/graphql/builder/Mutations/index.mjs +155 -156
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceActionEventsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceActionsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceCdnsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceCheckActionQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceConnectorsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceCredentialsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.d.ts +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.mjs +2 -3
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceJobsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceLatestRevisionQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceQuotaQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceResourcesQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.d.ts +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.mjs +2 -3
- package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.mjs +1 -2
- package/dist/network/graphql/builder/Queries/index.mjs +37 -38
- package/dist/network/graphql/builder/Subscriptions/SpaceEventSubscription.mjs +1 -2
- package/dist/network/graphql/builder/Subscriptions/index.mjs +1 -2
- package/dist/network/graphql/builder/fragments/cdnFields.mjs +1 -2
- package/dist/network/graphql/index.d.ts +0 -1
- package/dist/network/graphql/index.mjs +1 -3
- package/dist/network/index.d.ts +1 -5
- package/dist/network/index.mjs +7 -11
- package/dist/network/{NetworkContext.d.ts → react/NetworkContext.d.ts} +12 -11
- package/dist/network/{NetworkContext.mjs → react/NetworkContext.mjs} +1 -2
- package/dist/network/{NetworkInternalContext.d.ts → react/NetworkInternalContext.d.ts} +1 -1
- package/dist/network/react/NetworkInternalContext.mjs +4 -0
- package/dist/network/react/index.d.ts +5 -0
- package/dist/network/react/index.mjs +3 -0
- package/dist/network/spaceEvents.mjs +16 -17
- package/dist/plugins/bundle/bundle.mjs +1 -2
- package/dist/plugins/declaration.mjs +1 -2
- package/dist/plugins/react/ElementRegistryContext.d.ts +26 -0
- package/dist/plugins/react/ElementRegistryContext.mjs +17 -0
- package/dist/plugins/react/PluginAssetsContext.d.ts +11 -0
- package/dist/plugins/react/PluginAssetsContext.mjs +4 -0
- package/dist/plugins/react/PluginsContext.mjs +6 -3
- package/dist/plugins/react/index.d.ts +3 -0
- package/dist/plugins/react/index.mjs +4 -1
- package/dist/project/index.mjs +7 -7
- package/dist/project/layout/check.mjs +26 -27
- package/dist/project/layout/codes.mjs +1 -2
- package/dist/project/layout/contents.mjs +12 -13
- package/dist/project/layout/files.mjs +1 -2
- package/dist/project/layout/folders.mjs +43 -44
- package/dist/project/layout/index.mjs +3 -3
- package/dist/project/layout/plugins.mjs +56 -57
- package/dist/project/layout/vendor.mjs +14 -15
- package/dist/project/network.mjs +1 -2
- package/dist/project/pages/index.mjs +1 -2
- package/dist/project/paths/index.d.ts +8 -2
- package/dist/project/paths/index.mjs +3 -4
- package/dist/project/root.mjs +1 -2
- package/dist/queries/index.mjs +1 -2
- package/dist/queries/queryCache.mjs +1 -2
- package/dist/queries/serverQueries.mjs +1 -2
- package/dist/queries/useQuery.mjs +1 -2
- package/dist/queries/useServerQuery.mjs +1 -2
- package/dist/{helpers → react}/enclosingSpace.mjs +1 -2
- package/dist/react/generateFacade.d.ts +1 -0
- package/dist/{helpers → react}/generateFacade.mjs +4 -5
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.mjs +4 -0
- package/dist/{helpers → react}/sharedContext.mjs +0 -1
- package/dist/realtime/client.mjs +3 -4
- package/dist/realtime/index.mjs +4 -4
- package/dist/realtime/presence.mjs +1 -2
- package/dist/realtime/topics.mjs +1 -2
- package/dist/runs/index.mjs +1 -2
- package/dist/runs/report.mjs +1 -2
- package/dist/schema/anchor.mjs +1 -2
- package/dist/schema/index.mjs +18 -18
- package/dist/schema/layoutChain.mjs +1 -2
- package/dist/schema/markdownHeadings.mjs +1 -2
- package/dist/schema/motion.mjs +1 -2
- package/dist/schema/motionReveal.mjs +1 -2
- package/dist/schema/pageAccess.d.ts +9 -0
- package/dist/schema/pageAccess.mjs +42 -36
- package/dist/schema/pageElements.d.ts +3 -1
- package/dist/schema/pageElements.mjs +9 -3
- package/dist/schema/pageHead.d.ts +5 -2
- package/dist/schema/pageHead.mjs +3 -4
- package/dist/schema/providerAnswer.mjs +1 -2
- package/dist/schema/providerWhen.d.ts +1 -1
- package/dist/schema/providerWhen.mjs +6 -7
- package/dist/schema/react/SchemaContext.mjs +1 -2
- package/dist/schema/schemaConstants.mjs +1 -2
- package/dist/schema/schemaSettings.mjs +1 -2
- package/dist/schema/serverElements.d.ts +0 -24
- package/dist/schema/serverElements.mjs +60 -39
- package/dist/schema/serverInput.mjs +23 -24
- package/dist/schema/serverQuery.d.ts +15 -5
- package/dist/schema/serverQuery.mjs +47 -35
- package/dist/schema/snippet.mjs +1 -2
- package/dist/schema/wire.mjs +1 -2
- package/dist/security/index.d.ts +49 -0
- package/dist/security/index.mjs +44 -0
- package/dist/server/actions/useActionsSync.mjs +1 -2
- package/dist/server/actions/useImagesSync.mjs +1 -2
- package/dist/server/actions/useRealtimeSync.mjs +1 -2
- package/dist/server/index.mjs +7 -7
- package/dist/server/rsc/refreshRsc.mjs +23 -24
- package/dist/server/rsc/useRscRefresh.mjs +1 -2
- package/dist/server/rsc/useRscSync.mjs +1 -2
- package/dist/server/usePluginRoute.mjs +1 -2
- package/dist/source/export.d.ts +1 -1
- package/dist/source/export.mjs +1 -2
- package/dist/source/import.mjs +1 -2
- package/dist/source/index.mjs +4 -4
- package/dist/source/snapshot.mjs +1 -2
- package/dist/state/index.d.ts +0 -1
- package/dist/state/index.mjs +1 -3
- package/dist/state/paintedState.mjs +10 -11
- package/dist/store/actionRuns/actionRunsRecorder.mjs +1 -2
- package/dist/store/actionRuns/actionRunsStore.mjs +1 -2
- package/dist/store/actionRuns/index.mjs +3 -3
- package/dist/store/actionRuns/useActionRuns.mjs +5 -6
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.mjs +2 -1
- package/dist/store/renderSettings.d.ts +1 -1
- package/dist/store/renderSettings.mjs +1 -2
- package/dist/{state → store}/runtimeStatePersist.mjs +29 -30
- package/dist/store/storeHooks.d.ts +45 -45
- package/dist/store/storeHooks.mjs +1 -2
- package/dist/store/tracing/index.mjs +5 -5
- package/dist/store/tracing/preview.mjs +1 -2
- package/dist/store/tracing/tracingCollector.d.ts +2 -2
- package/dist/store/tracing/tracingCollector.mjs +79 -78
- package/dist/store/tracing/tracingMiddleware.mjs +1 -2
- package/dist/store/tracing/tracingStore.mjs +1 -2
- package/dist/store/tracing/useTracing.mjs +6 -7
- package/dist/style/breakpoints.mjs +1 -2
- package/dist/style/cssLayers.mjs +1 -2
- package/dist/style/displayModes.mjs +1 -2
- package/dist/style/fontAssets.mjs +1 -2
- package/dist/style/fontValidation.mjs +14 -15
- package/dist/style/fonts.d.ts +5 -3
- package/dist/style/fonts.mjs +23 -24
- package/dist/style/fontsFromCss.mjs +1 -2
- package/dist/style/index.mjs +18 -18
- package/dist/style/keyframes.mjs +1 -2
- package/dist/style/layoutGrid.mjs +1 -2
- package/dist/style/notifications.mjs +1 -2
- package/dist/style/react/useDisplayMode.mjs +1 -2
- package/dist/style/react/useElementSize.mjs +1 -2
- package/dist/style/runtimeStyle.d.ts +19 -21
- package/dist/style/runtimeStyle.mjs +4 -7
- package/dist/style/snippetStyle.mjs +5 -6
- package/dist/style/styleConditions.mjs +1 -2
- package/dist/style/styleConstants.mjs +1 -2
- package/dist/style/stylePseudos.mjs +1 -2
- package/dist/style/styleStates.mjs +1 -2
- package/dist/style/styleTarget.mjs +24 -25
- package/dist/theme/cookie/index.mjs +1 -1
- package/dist/theme/cookie/themeCookie.d.ts +21 -1
- package/dist/theme/cookie/themeCookie.mjs +19 -4
- package/dist/theme/index.d.ts +1 -9
- package/dist/theme/index.mjs +1 -6
- package/dist/theme/{ThemeProvider.d.ts → react/ThemeProvider.d.ts} +8 -2
- package/dist/theme/react/ThemeProvider.mjs +78 -0
- package/dist/theme/{ThemeScope.d.ts → react/ThemeScope.d.ts} +6 -2
- package/dist/theme/react/ThemeScope.mjs +9 -0
- package/dist/theme/react/index.d.ts +9 -0
- package/dist/theme/react/index.mjs +5 -0
- package/dist/theme/{themeStore.d.ts → react/themeStore.d.ts} +5 -5
- package/dist/theme/{themeStore.mjs → react/themeStore.mjs} +4 -4
- package/dist/theme/{useTheme.d.ts → react/useTheme.d.ts} +1 -1
- package/dist/theme/react/useTheme.mjs +19 -0
- package/dist/types/ActionTypes.d.ts +33 -0
- package/dist/types/AuthTypes.d.ts +6 -0
- package/dist/types/CommonTypes.d.ts +14 -3
- package/dist/types/DataSourceTypes.d.ts +1 -1
- package/dist/types/FunctionTypes.d.ts +16 -6
- package/dist/types/InteractionTypes.d.ts +1 -1
- package/dist/types/JobTypes.d.ts +56 -182
- package/dist/types/PluginTypes.d.ts +8 -1
- package/dist/types/SchemaTypes.d.ts +1 -1
- package/dist/types/SchemaTypes.mjs +1 -2
- package/dist/types/ServerAdapterTypes.d.ts +0 -326
- package/dist/types/ServerTypes.d.ts +0 -311
- package/dist/types/SpaceTypes.d.ts +5 -2
- package/dist/types/StoreTypes.d.ts +9 -3
- package/dist/types/StyleTypes.d.ts +6 -0
- package/dist/types/StyleTypes.mjs +1 -2
- package/dist/types/index.d.ts +0 -3
- package/dist/websockets/RTCodec.mjs +1 -2
- package/eslint.config.mjs +25 -0
- package/package.json +29 -18
- package/vite.config.ts +58 -0
- package/dist/helpers/generateFacade.d.ts +0 -2
- package/dist/helpers/ruleEvaluator.d.ts +0 -16
- package/dist/helpers/ruleEvaluator.mjs +0 -5
- package/dist/network/NetworkInternalContext.mjs +0 -5
- package/dist/network/graphql/sdk/Mutations/index.d.ts +0 -3
- package/dist/network/graphql/sdk/Mutations/index.mjs +0 -4
- package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +0 -16
- package/dist/network/graphql/sdk/Queries/InitQuery.mjs +0 -4
- package/dist/network/graphql/sdk/Queries/index.d.ts +0 -6
- package/dist/network/graphql/sdk/Queries/index.mjs +0 -5
- package/dist/network/graphql/sdk/index.d.ts +0 -5
- package/dist/network/graphql/sdk/index.mjs +0 -3
- package/dist/theme/ThemeProvider.mjs +0 -69
- package/dist/theme/ThemeScope.mjs +0 -10
- package/dist/theme/useTheme.mjs +0 -20
- package/dist/types/OAuthTypes.d.ts +0 -246
- package/dist/types/ServerConfigTypes.d.ts +0 -527
- package/dist/types/ServerLogTypes.d.ts +0 -119
- /package/dist/{types/OAuthTypes.mjs → conditions/types.mjs} +0 -0
- /package/dist/{types/ServerConfigTypes.mjs → functions/kv.mjs} +0 -0
- /package/dist/{types/ServerLogTypes.mjs → functions/later.mjs} +0 -0
- /package/dist/{helpers → react}/enclosingSpace.d.ts +0 -0
- /package/dist/{helpers → react}/sharedContext.d.ts +0 -0
- /package/dist/{state → store}/runtimeStatePersist.d.ts +0 -0
package/dist/activity/guard.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
2
|
-
|
|
2
|
+
// src/activity/guard.ts
|
|
3
3
|
var t = (t) => {
|
|
4
4
|
if (!e(t) || typeof t.at != "number") return !1;
|
|
5
5
|
switch (t.kind) {
|
|
@@ -9,5 +9,4 @@ var t = (t) => {
|
|
|
9
9
|
default: return !1;
|
|
10
10
|
}
|
|
11
11
|
}, n = (n) => e(n) && Array.isArray(n.activity) && n.activity.every(t) && typeof n.cursor == "string" && typeof n.more == "boolean" && typeof n.waitedMs == "number" && typeof n.skippedMine == "number";
|
|
12
|
-
//#endregion
|
|
13
12
|
export { n as isSpaceActivityPage };
|
package/dist/activity/types.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/activity/types.ts
|
|
2
2
|
var e = 50, t = 45, n = 20, r = 100, i = 20;
|
|
3
|
-
//#endregion
|
|
4
3
|
export { n as ACTIVITY_LIMIT_DEFAULT, r as ACTIVITY_LIMIT_MAX, i as ACTIVITY_TOUCHED_MAX, t as ACTIVITY_WAIT_DEFAULT_SECONDS, e as ACTIVITY_WAIT_MAX_SECONDS };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/auth/failureChannel.ts
|
|
2
2
|
var e = /* @__PURE__ */ new Set(), t = async (t) => (await Promise.all([...e].map(async (e) => e(t)))).some((e) => e === !0), n = (t) => (e.add(t), () => e.delete(t)), r = [
|
|
3
3
|
"missing",
|
|
4
4
|
"expired",
|
|
@@ -22,5 +22,4 @@ var e = /* @__PURE__ */ new Set(), t = async (t) => (await Promise.all([...e].ma
|
|
|
22
22
|
return !1;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
25
|
export { i as authFailureFromResponse, n as onAuthFailure, t as reportAuthFailure, o as sameRegistrableDomain };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/auth/visitorRoles.ts
|
|
2
2
|
var e = /^[A-Za-z][\w-]{0,63}$/, t = "`visitorRoles: { author: [\"postPublish\"], editor: [\"postPublish\", \"postEdit\"] }`", n = (n) => {
|
|
3
3
|
if (typeof n != "object" || !n || Array.isArray(n)) return {
|
|
4
4
|
ok: !1,
|
|
@@ -47,5 +47,4 @@ var e = /^[A-Za-z][\w-]{0,63}$/, t = "`visitorRoles: { author: [\"postPublish\"]
|
|
|
47
47
|
permissions: [...new Set(t.flatMap((t) => e?.[t] ?? []))],
|
|
48
48
|
missing: t.filter((t) => !e || !Object.hasOwn(e, t))
|
|
49
49
|
});
|
|
50
|
-
//#endregion
|
|
51
50
|
export { e as VISITOR_NAME, n as checkVisitorRoles, i as rolesGrant, r as visitorAccess };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/authoring/builder.ts
|
|
2
2
|
var e = {
|
|
3
3
|
text: "text",
|
|
4
4
|
textarea: "textarea",
|
|
@@ -31,5 +31,4 @@ var e = {
|
|
|
31
31
|
params: i(t.params),
|
|
32
32
|
...r
|
|
33
33
|
}), o = (e, t, n = {}) => Object.fromEntries(Object.keys(e).map((r) => [r, a(r, e[r], t[r], n[r] ?? {})]));
|
|
34
|
-
//#endregion
|
|
35
34
|
export { i as toBuilderParams, a as toInteractionCallback, o as toInteractionCallbacks };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/authoring/declare.ts
|
|
2
2
|
var e = () => (e) => e, t = () => ({
|
|
3
3
|
canDelete: !0,
|
|
4
4
|
canSelect: !0,
|
|
@@ -93,5 +93,4 @@ var e = () => (e) => e, t = () => ({
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
|
-
//#endregion
|
|
97
96
|
export { a as definePlugin, r as elementDeclaration, e as valuesOf };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { reconcileParams as e } from "./paramSpec.mjs";
|
|
2
2
|
import { SCROLL_BEHAVIORS as t, SCROLL_POSITIONS as n } from "../helpers/scroll.mjs";
|
|
3
|
-
|
|
3
|
+
// src/authoring/elementCallbacks.ts
|
|
4
4
|
var r = {
|
|
5
5
|
type: "select",
|
|
6
6
|
description: "How it moves: \"smooth\" glides there, \"auto\" jumps.",
|
|
@@ -137,5 +137,4 @@ var r = {
|
|
|
137
137
|
params: n
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
|
-
//#endregion
|
|
141
140
|
export { o as BUILTIN_ELEMENT_CALLBACKS, a as FOCUS_CALLBACKS, i as SCROLL_CALLBACKS, c as applyElementCallback, s as getElementCallback };
|
package/dist/authoring/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toBuilderParams as e, toInteractionCallback as t, toInteractionCallbacks as n } from "./builder.mjs";
|
|
2
2
|
import { definePlugin as r, elementDeclaration as i, valuesOf as a } from "./declare.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { BUILTIN_ELEMENT_CALLBACKS as o, FOCUS_CALLBACKS as s, SCROLL_CALLBACKS as c, applyElementCallback as l, getElementCallback as u } from "./elementCallbacks.mjs";
|
|
4
|
+
import { BUILTIN_PARAM_TYPES as d, hiddenParams as f, invalidParams as p, missingRequiredParams as m, reconcileParams as h } from "./paramSpec.mjs";
|
|
5
5
|
import { NOTIFICATION_APPEARANCES as g, NOTIFICATION_DEFAULTS as _, NOTIFICATION_PLACEMENTS as v, readNotificationOptions as y, spaceCallbacks as b } from "./spaceCallbacks.mjs";
|
|
6
|
-
export {
|
|
6
|
+
export { o as BUILTIN_ELEMENT_CALLBACKS, d as BUILTIN_PARAM_TYPES, s as FOCUS_CALLBACKS, g as NOTIFICATION_APPEARANCES, _ as NOTIFICATION_DEFAULTS, v as NOTIFICATION_PLACEMENTS, c as SCROLL_CALLBACKS, l as applyElementCallback, r as definePlugin, i as elementDeclaration, u as getElementCallback, f as hiddenParams, p as invalidParams, m as missingRequiredParams, y as readNotificationOptions, h as reconcileParams, b as spaceCallbacks, e as toBuilderParams, t as toInteractionCallback, n as toInteractionCallbacks, a as valuesOf };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hasValidToken as e } from "../helpers/twigWrapper/tokens/hasValidToken.mjs";
|
|
2
|
-
|
|
2
|
+
// src/authoring/paramSpec.ts
|
|
3
3
|
var t = [
|
|
4
4
|
"text",
|
|
5
5
|
"textarea",
|
|
@@ -47,5 +47,4 @@ var t = [
|
|
|
47
47
|
for (let [e, n] of Object.entries(t)) n.default === void 0 || r[e] !== void 0 || n.when && !n.when(r) || (r[e] = n.default);
|
|
48
48
|
return r;
|
|
49
49
|
};
|
|
50
|
-
//#endregion
|
|
51
50
|
export { t as BUILTIN_PARAM_TYPES, n as hiddenParams, s as invalidParams, r as missingRequiredParams, c as reconcileParams };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/authoring/spaceCallbacks.ts
|
|
2
2
|
var e = [
|
|
3
3
|
"top-right",
|
|
4
4
|
"top-center",
|
|
@@ -68,5 +68,4 @@ var e = [
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
} };
|
|
71
|
-
//#endregion
|
|
72
71
|
export { t as NOTIFICATION_APPEARANCES, r as NOTIFICATION_DEFAULTS, e as NOTIFICATION_PLACEMENTS, n as readNotificationOptions, i as spaceCallbacks };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __exportAll as e } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import t from "./BuilderContext.mjs";
|
|
3
|
-
|
|
3
|
+
// src/builder/contexts/index.ts
|
|
4
4
|
var n = /* @__PURE__ */ e({ BuilderContext: () => t });
|
|
5
|
-
//#endregion
|
|
6
5
|
export { t as BuilderContext, n as contexts_exports };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getTime as e } from "date-fns/getTime";
|
|
2
|
+
import { parseISO as t } from "date-fns/parseISO";
|
|
3
|
+
// src/conditions/dates.ts
|
|
4
|
+
var n = (n) => {
|
|
5
|
+
let r;
|
|
6
|
+
return r = typeof n == "number" ? n < 0xe8d4a51000 ? /* @__PURE__ */ new Date(n * 1e3) : new Date(n) : typeof n == "string" ? t(n) : n, Math.floor(e(r) / 1e3).toString();
|
|
7
|
+
}, r = (e) => {
|
|
8
|
+
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
|
|
9
|
+
let [t, n, r] = e.split("-").map(Number), i = /* @__PURE__ */ new Date(0);
|
|
10
|
+
return i.setFullYear(t, n - 1, r), i.getFullYear() === t && i.getMonth() === n - 1 && i.getDate() === r;
|
|
11
|
+
};
|
|
12
|
+
export { r as isDate, n as toUnixSeconds };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RuleGroup, RuleValue } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Evaluates a `when` rule group against a value bag: how every reader decides one — an interaction in the browser, the
|
|
4
|
+
* builder's preview, a flag, an action on the server.
|
|
5
|
+
*
|
|
6
|
+
* `whenMissing` is what a rule whose field the bag does not have answers: `false` by default, `true` for a binding's
|
|
7
|
+
* condition, which reads a source that may not have loaded yet.
|
|
8
|
+
*/
|
|
9
|
+
export declare const evaluateRuleGroup: (group: RuleGroup, values: Record<string, RuleValue>, { whenMissing }?: {
|
|
10
|
+
whenMissing?: boolean;
|
|
11
|
+
}) => boolean;
|
|
12
|
+
/** A value bag as a rule group reads it: what no rule can compare — a function, a symbol — left out. */
|
|
13
|
+
export declare const ruleValuesOf: (values: Record<string, unknown>) => Record<string, RuleValue>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { evaluateRules as e } from "./evaluator.mjs";
|
|
2
|
+
// src/conditions/evaluateRuleGroup.ts
|
|
3
|
+
var t = (t, n, { whenMissing: r = !1 } = {}) => !!e(t, n, !1, r), n = (e) => typeof e != "function" && typeof e != "symbol" && typeof e != "bigint", r = (e) => Object.fromEntries(Object.entries(e).filter((e) => n(e[1])));
|
|
4
|
+
export { t as evaluateRuleGroup, r as ruleValuesOf };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Rule, RuleGroup, RuleValue } from './types';
|
|
2
|
+
type NestedBoolean = boolean | NestedBoolean[];
|
|
3
|
+
export declare const transformQueryJson: (raw?: RuleGroup) => {
|
|
4
|
+
rules: (Rule | RuleGroup)[];
|
|
5
|
+
combinator: import('./types').Combinator;
|
|
6
|
+
enabled: boolean | undefined;
|
|
7
|
+
} | undefined;
|
|
8
|
+
export declare const transformQuery: (raw?: RuleGroup, transformTo?: string) => {
|
|
9
|
+
rules: (Rule | RuleGroup)[];
|
|
10
|
+
combinator: import('./types').Combinator;
|
|
11
|
+
enabled: boolean | undefined;
|
|
12
|
+
} | undefined;
|
|
13
|
+
export declare const evaluateEquals: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
14
|
+
export declare const evaluateGreaterThan: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
15
|
+
export declare const evaluateGreaterThanOrEqual: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
16
|
+
export declare const evaluateLessThan: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
17
|
+
export declare const evaluateLessThanOrEqual: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the field holds the rule's value: a case-insensitive substring of a text, or an entry of a list.
|
|
20
|
+
*
|
|
21
|
+
* The list reading is what anybody means by "the picks contain rpg", and until it existed the rule was simply false
|
|
22
|
+
* against every array — so a flow gated on a list never ran, and nothing said why. An entry is matched the way `=`
|
|
23
|
+
* matches, so `'3'` finds `3` and `'true'` finds `true`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const evaluateContains: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
26
|
+
export declare const evaluateBeginsWith: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
27
|
+
export declare const evaluateEndsWith: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
28
|
+
export declare const evaluateEmpty: (valueToCompare: RuleValue) => boolean;
|
|
29
|
+
export declare const evaluateIn: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
30
|
+
export declare const evaluateBetween: (value: RuleValue, valueToCompare: RuleValue) => boolean;
|
|
31
|
+
export declare const evaluateRules: (queryRAW: RuleGroup, values?: {
|
|
32
|
+
[key: string]: RuleValue;
|
|
33
|
+
}, granulated?: boolean, fallbackValue?: boolean) => NestedBoolean;
|
|
34
|
+
export declare const getValuesRequired: (queryRAW: RuleGroup, values?: {
|
|
35
|
+
[key: string]: RuleValue;
|
|
36
|
+
}, fallbackValue?: undefined) => {
|
|
37
|
+
[key: string]: RuleValue;
|
|
38
|
+
} | Rule[];
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isDate as e, toUnixSeconds as t } from "./dates.mjs";
|
|
2
|
+
import { isNumeric as n, isRuleGroup as r } from "./rules.mjs";
|
|
3
|
+
import { get as i } from "../helpers/lodash/get.mjs";
|
|
4
|
+
import { set as a } from "../helpers/lodash/set.mjs";
|
|
5
|
+
// src/conditions/evaluator.ts
|
|
6
|
+
var o = (e) => {
|
|
7
|
+
if (!e || typeof e != "object") return;
|
|
8
|
+
let { combinator: t, enabled: n } = e, { rules: i } = e;
|
|
9
|
+
if (Array.isArray(i)) return i = i.map((e) => {
|
|
10
|
+
if (r(e)) return o(e);
|
|
11
|
+
let { field: t, value: n, operator: i, enabled: a, isBinding: s } = e;
|
|
12
|
+
return {
|
|
13
|
+
field: t,
|
|
14
|
+
value: n,
|
|
15
|
+
operator: i,
|
|
16
|
+
enabled: a,
|
|
17
|
+
isBinding: s
|
|
18
|
+
};
|
|
19
|
+
}).filter(Boolean), {
|
|
20
|
+
rules: i,
|
|
21
|
+
combinator: t,
|
|
22
|
+
enabled: n
|
|
23
|
+
};
|
|
24
|
+
}, s = (e, t = "json") => o(e), c = (e, t) => typeof e == "boolean" && typeof t == "string" ? (t = t.toLowerCase(), t = t === "true" || t === "1", e === t) : typeof e == "string" && typeof t == "boolean" ? (e = e.toLowerCase(), e = e === "true" || e === "1", e === t) : (typeof e == "number" && (e = `${e}`), typeof t == "number" && (t = `${t}`), e === t), l = (r, i) => r == null || i == null ? !1 : e(r) && e(i) ? (r = t(r), i = t(i), parseFloat(i) > parseFloat(r)) : n(r) ? (r = parseFloat(r), i = parseFloat(i), n(i) && i > r) : i > r, u = (e, t) => l(e, t) || c(e, t), d = (r, i) => r == null || i == null ? !1 : e(r) && e(i) ? (r = t(r), i = t(i), parseFloat(i) < parseFloat(r)) : n(r) ? (r = parseFloat(r), i = parseFloat(i), n(i) && i < r) : i < r, f = (e, t) => d(e, t) || c(e, t), p = (e, t) => Array.isArray(t) ? t.some((t) => c(e, t)) : typeof e == "string" && typeof t == "string" && t.toLowerCase().includes(e.toLowerCase()), m = (e, t) => typeof t == "string" && typeof e == "string" && t.toLowerCase().startsWith(e.toLowerCase()), h = (e, t) => typeof t == "string" && typeof e == "string" && t.toLowerCase().endsWith(e.toLowerCase()), g = (e) => {
|
|
25
|
+
switch (typeof e) {
|
|
26
|
+
case "boolean":
|
|
27
|
+
case "number":
|
|
28
|
+
case "function": return !1;
|
|
29
|
+
case "object":
|
|
30
|
+
case "undefined": return e == null || Object.keys(e).length === 0;
|
|
31
|
+
default: return !e;
|
|
32
|
+
}
|
|
33
|
+
}, _ = (e, t) => (typeof e == "string" && e.includes(",") ? e = e.split(",").map((e) => e.trim()) : (typeof e == "string" || typeof e == "number") && (e = [e]), Array.isArray(e) ? (typeof t == "string" && t.includes(",") && (t = t.split(",").map((e) => e.trim())), Array.isArray(t) ? t.some((t) => n(t) ? e.includes(`${t}`) || e.includes(parseFloat(t)) : e.includes(t)) : n(t) ? e.includes(`${t}`) || e.includes(parseFloat(t)) : e.includes(t)) : !1), v = (e, t) => {
|
|
34
|
+
let n = [];
|
|
35
|
+
return typeof e == "string" && (n = e.split(",").map((e) => e.trim())), n.length < 2 ? !1 : u(n[0], t) && f(n[1], t);
|
|
36
|
+
}, y = (e, t) => {
|
|
37
|
+
let { field: n, operator: r, isBinding: a } = e, { value: o } = e, s = i(t, n);
|
|
38
|
+
switch (a && (o = i(t, e.value)), r) {
|
|
39
|
+
case "=": return c(o, s);
|
|
40
|
+
case "!=": return !c(o, s);
|
|
41
|
+
case "<": return d(o, s);
|
|
42
|
+
case ">": return l(o, s);
|
|
43
|
+
case "<=": return f(o, s);
|
|
44
|
+
case ">=": return u(o, s);
|
|
45
|
+
case "contains": return p(o, s);
|
|
46
|
+
case "doesNotContain": return !p(o, s);
|
|
47
|
+
case "beginsWith": return m(o, s);
|
|
48
|
+
case "doesNotBeginWith": return !m(o, s);
|
|
49
|
+
case "endsWith": return h(o, s);
|
|
50
|
+
case "doesNotEndWith": return !h(o, s);
|
|
51
|
+
case "empty": return g(s);
|
|
52
|
+
case "notEmpty": return !g(s);
|
|
53
|
+
case "in": return _(o, s);
|
|
54
|
+
case "notIn": return !_(o, s);
|
|
55
|
+
case "between": return v(o, s);
|
|
56
|
+
case "notBetween": return !v(o, s);
|
|
57
|
+
default: return !1;
|
|
58
|
+
}
|
|
59
|
+
}, b = (e, t = {}, n = !1, r = !1) => {
|
|
60
|
+
if (!e) return r;
|
|
61
|
+
let { combinator: i, rules: a, enabled: o } = e;
|
|
62
|
+
if (!Array.isArray(a)) return r;
|
|
63
|
+
if (o === !1) return !0;
|
|
64
|
+
let s = a.filter((e) => e.enabled !== !1).map((e) => "rules" in e ? b(e, t, n) : y(e, t));
|
|
65
|
+
return n ? s : i === "and" ? !s.includes(!1) : s.includes(!0);
|
|
66
|
+
}, x = (e, t = {}, n = !1, r = !1) => b(s(e), t, n, r), S = (e, t, n, r = !1) => {
|
|
67
|
+
let { rules: o, enabled: s } = e;
|
|
68
|
+
if (!Array.isArray(o) || s === !1) return {};
|
|
69
|
+
let c = o.filter((e) => e.enabled !== !1).flatMap((e) => "rules" in e ? S(e, t, n, !0) : e);
|
|
70
|
+
return r ? c : c.reduce((e, r) => {
|
|
71
|
+
let { field: o, isBinding: s, value: c } = r;
|
|
72
|
+
return s && a(e, c, i(t, c, n)), a(e, o, i(t, o, n)), e;
|
|
73
|
+
}, {});
|
|
74
|
+
}, C = (e, t = {}, n = void 0) => S(s(e), t, n);
|
|
75
|
+
export { m as evaluateBeginsWith, v as evaluateBetween, p as evaluateContains, g as evaluateEmpty, h as evaluateEndsWith, c as evaluateEquals, l as evaluateGreaterThan, u as evaluateGreaterThanOrEqual, _ as evaluateIn, d as evaluateLessThan, f as evaluateLessThanOrEqual, x as evaluateRules, C as getValuesRequired, s as transformQuery, o as transformQueryJson };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conditions as Plitzi evaluates them: the rule evaluator and the stored format it reads. One evaluator for every reader
|
|
3
|
+
* — the builder's preview, the SDK, a page server, a worker — so one condition is never decided two ways. Server-safe:
|
|
4
|
+
* no React, no UI library.
|
|
5
|
+
*/
|
|
6
|
+
export { evaluateRuleGroup, ruleValuesOf } from './evaluateRuleGroup';
|
|
7
|
+
export * from './evaluator';
|
|
8
|
+
export { isNumeric, isRuleGroup } from './rules';
|
|
9
|
+
export { isDate, toUnixSeconds } from './dates';
|
|
10
|
+
export type { Combinator, Field, Operator, Rule, RuleGroup, RuleValue } from './types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { evaluateRuleGroup as e, ruleValuesOf as t } from "./evaluateRuleGroup.mjs";
|
|
2
|
+
import { evaluateBeginsWith as n, evaluateBetween as r, evaluateContains as i, evaluateEmpty as a, evaluateEndsWith as o, evaluateEquals as s, evaluateGreaterThan as c, evaluateGreaterThanOrEqual as l, evaluateIn as u, evaluateLessThan as d, evaluateLessThanOrEqual as f, evaluateRules as p, getValuesRequired as m, transformQuery as h, transformQueryJson as g } from "./evaluator.mjs";
|
|
3
|
+
import { isNumeric as _, isRuleGroup as v } from "./rules.mjs";
|
|
4
|
+
import { isDate as y, toUnixSeconds as b } from "./dates.mjs";
|
|
5
|
+
export { n as evaluateBeginsWith, r as evaluateBetween, i as evaluateContains, a as evaluateEmpty, o as evaluateEndsWith, s as evaluateEquals, c as evaluateGreaterThan, l as evaluateGreaterThanOrEqual, u as evaluateIn, d as evaluateLessThan, f as evaluateLessThanOrEqual, e as evaluateRuleGroup, p as evaluateRules, m as getValuesRequired, y as isDate, _ as isNumeric, v as isRuleGroup, t as ruleValuesOf, b as toUnixSeconds, h as transformQuery, g as transformQueryJson };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A condition as Plitzi stores it — a flag's rules, an interaction's `when`, a binding's condition: the schema's own
|
|
3
|
+
* format, so sdk-shared defines it (RFC 0032, D13). plitzi-ui's QueryBuilder edits the same shape with prop types of its
|
|
4
|
+
* own, and a type test in the builder, where the two meet, holds them assignable both ways.
|
|
5
|
+
*/
|
|
6
|
+
export type RuleValue = Date | string | number | boolean | undefined | null | object;
|
|
7
|
+
export type Combinator = 'and' | 'or';
|
|
8
|
+
export type Operator = '' | '=' | '!=' | '<' | '>' | '<=' | '>=' | 'contains' | 'doesNotContain' | 'beginsWith' | 'doesNotBeginWith' | 'endsWith' | 'doesNotEndWith' | 'empty' | 'notEmpty' | 'in' | 'notIn' | 'between' | 'notBetween';
|
|
9
|
+
export type RuleGroup = {
|
|
10
|
+
id?: string;
|
|
11
|
+
combinator: Combinator;
|
|
12
|
+
rules: (Rule | RuleGroup)[];
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type Rule = {
|
|
16
|
+
id?: string;
|
|
17
|
+
field: string;
|
|
18
|
+
operator: Operator;
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
} & ({
|
|
21
|
+
isBinding: true;
|
|
22
|
+
value: string;
|
|
23
|
+
} | {
|
|
24
|
+
isBinding?: false;
|
|
25
|
+
value: RuleValue;
|
|
26
|
+
});
|
|
27
|
+
export type Field = {
|
|
28
|
+
name: string;
|
|
29
|
+
label: string;
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
defaultOperator?: Operator;
|
|
32
|
+
operators?: {
|
|
33
|
+
value: Operator;
|
|
34
|
+
label: string;
|
|
35
|
+
}[];
|
|
36
|
+
group?: string;
|
|
37
|
+
inputType?: 'checkbox' | 'radio' | 'multiselect' | 'select' | 'text' | 'number' | 'date' | 'time' | 'datetime' | 'textarea';
|
|
38
|
+
defaultValue?: RuleValue;
|
|
39
|
+
validator?: (value?: string | number | boolean) => boolean | string;
|
|
40
|
+
options?: {
|
|
41
|
+
value: RuleValue;
|
|
42
|
+
label: string;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/connectors/constants.ts
|
|
2
2
|
var e = "list", t = [
|
|
3
3
|
"GET",
|
|
4
4
|
"POST",
|
|
@@ -25,5 +25,4 @@ var e = "list", t = [
|
|
|
25
25
|
"update",
|
|
26
26
|
"delete"
|
|
27
27
|
];
|
|
28
|
-
//#endregion
|
|
29
28
|
export { n as BODYLESS_METHODS, t as CONNECTOR_HTTP_METHODS, e as DEFAULT_READ_ENDPOINT, r as EMPTY_RESPONSE_METHODS, i as READ_ENDPOINT_NAMES, a as WRITE_ENDPOINT_NAMES };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/connectors/manifestTokens.ts
|
|
2
2
|
var e = [
|
|
3
3
|
{
|
|
4
4
|
value: "resource",
|
|
@@ -66,5 +66,4 @@ var e = [
|
|
|
66
66
|
scopes: ["write"]
|
|
67
67
|
}
|
|
68
68
|
], t = (t) => e.filter((e) => e.scopes.includes(t));
|
|
69
|
-
//#endregion
|
|
70
69
|
export { e as connectorTokens, e as default, t as getConnectorTokens };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { BODYLESS_METHODS as e, CONNECTOR_HTTP_METHODS as t } from "./constants.mjs";
|
|
2
|
+
import { connectorTokens as n } from "./manifestTokens.mjs";
|
|
3
|
+
import { isRecord as r } from "../helpers/isRecord.mjs";
|
|
4
|
+
// src/connectors/validateManifest.ts
|
|
5
5
|
var i = [
|
|
6
6
|
"offset",
|
|
7
7
|
"page",
|
|
@@ -21,7 +21,7 @@ var i = [
|
|
|
21
21
|
"color",
|
|
22
22
|
"option",
|
|
23
23
|
"file"
|
|
24
|
-
], o = /\{\{\s*([^}]+?)\s*\}\}/g, s = (e) => typeof e == "string" && e.trim() !== "", c = (e) => typeof e == "string" ? e : JSON.stringify(e), l = (e) => [...e.matchAll(o)].map((e) => e[1]), u = (e, t) =>
|
|
24
|
+
], o = /\{\{\s*([^}]+?)\s*\}\}/g, s = (e) => typeof e == "string" && e.trim() !== "", c = (e) => typeof e == "string" ? e : JSON.stringify(e), l = (e) => [...e.matchAll(o)].map((e) => e[1]), u = (e, t) => n.some((n) => n.scopes.includes(t) ? n.value.endsWith(".") ? e.startsWith(n.value) : e === n.value : !1), d = (e, t, n, r) => {
|
|
25
25
|
e.errors.push({
|
|
26
26
|
path: t,
|
|
27
27
|
message: n,
|
|
@@ -33,22 +33,22 @@ var i = [
|
|
|
33
33
|
message: n,
|
|
34
34
|
...r === void 0 ? {} : { hint: r }
|
|
35
35
|
});
|
|
36
|
-
}, p = (t, n,
|
|
37
|
-
if (
|
|
38
|
-
if (!
|
|
36
|
+
}, p = (e, t, n, i) => {
|
|
37
|
+
if (t !== void 0) {
|
|
38
|
+
if (!r(t)) d(e, n, "Must be an object of string values", "Each entry is one name and its templated value");
|
|
39
39
|
else {
|
|
40
|
-
for (let [
|
|
41
|
-
path: `${
|
|
40
|
+
for (let [r, a] of Object.entries(t)) typeof a == "string" ? e.templates.push({
|
|
41
|
+
path: `${n}.${r}`,
|
|
42
42
|
value: a,
|
|
43
43
|
scope: i
|
|
44
|
-
}) : d(
|
|
45
|
-
return
|
|
44
|
+
}) : d(e, `${n}.${r}`, "Must be a string", "Values are Twig templates the server renders per request");
|
|
45
|
+
return t;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
}, m = (e,
|
|
49
|
-
if (
|
|
50
|
-
else if (typeof
|
|
51
|
-
else return
|
|
48
|
+
}, m = (e, n, r, i) => {
|
|
49
|
+
if (n === void 0) i && d(e, r, "A write endpoint must declare its method", `One of ${t.join(", ")}`);
|
|
50
|
+
else if (typeof n != "string" || !t.includes(n)) d(e, r, `"${c(n)}" is not an HTTP method`, `One of ${t.join(", ")}`);
|
|
51
|
+
else return n;
|
|
52
52
|
}, h = (e, t, n, r) => {
|
|
53
53
|
s(t.path) ? e.templates.push({
|
|
54
54
|
path: `${n}.path`,
|
|
@@ -60,17 +60,17 @@ var i = [
|
|
|
60
60
|
if (typeof t != "string" || !i.includes(t)) d(e, n, `"${c(t)}" is not a paging style`, `One of ${i.join(", ")}`);
|
|
61
61
|
else return t;
|
|
62
62
|
}
|
|
63
|
-
}, _ = (
|
|
64
|
-
let o = `endpoints.read.${
|
|
65
|
-
if (!
|
|
66
|
-
d(
|
|
63
|
+
}, _ = (t, n, i, a) => {
|
|
64
|
+
let o = `endpoints.read.${n}`;
|
|
65
|
+
if (!r(i)) {
|
|
66
|
+
d(t, o, "A read endpoint must be an object", "It declares at least a path");
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
h(
|
|
70
|
-
let s = m(
|
|
71
|
-
p(
|
|
72
|
-
let l = p(
|
|
73
|
-
if (l &&
|
|
69
|
+
h(t, i, o, "request");
|
|
70
|
+
let s = m(t, i.method, `${o}.method`, !1) ?? "GET", c = p(t, i.query, `${o}.query`, "request");
|
|
71
|
+
p(t, i.headers, `${o}.headers`, "request");
|
|
72
|
+
let l = p(t, i.body, `${o}.body`, "request"), u = g(t, i.pagination, `${o}.pagination`) ?? a;
|
|
73
|
+
if (l && e.includes(s) && f(t, `${o}.body`, `A ${s} request carries no body, so this one is never sent`, "Move these values into `query`, or read through POST if the provider expects a body"), u === void 0) return;
|
|
74
74
|
let _ = JSON.stringify({
|
|
75
75
|
path: i.path,
|
|
76
76
|
query: c ?? {},
|
|
@@ -80,45 +80,45 @@ var i = [
|
|
|
80
80
|
page: "{{page}}",
|
|
81
81
|
cursor: "{{cursor}}"
|
|
82
82
|
}[u];
|
|
83
|
-
v !== void 0 && !_.includes(v) && f(
|
|
84
|
-
}, v = (t, n
|
|
85
|
-
let i = `endpoints.write.${
|
|
86
|
-
|
|
87
|
-
}, y = (t, n
|
|
88
|
-
if (!
|
|
83
|
+
v !== void 0 && !_.includes(v) && f(t, `${o}.query`, `"${n}" pages by ${u} but never uses ${v}, so every page resolves to the first one`, `Put ${v} in the query (or the path) this endpoint sends`);
|
|
84
|
+
}, v = (e, t, n) => {
|
|
85
|
+
let i = `endpoints.write.${t}`;
|
|
86
|
+
r(n) ? (h(e, n, i, "write"), m(e, n.method, `${i}.method`, !0), p(e, n.query, `${i}.query`, "write"), p(e, n.headers, `${i}.headers`, "write"), n.bodyPath !== void 0 && typeof n.bodyPath != "string" && d(e, `${i}.bodyPath`, "Must be a string", "It names where to nest the values, e.g. \"data\"")) : d(e, i, "A write endpoint must be an object", "It declares at least a method and a path");
|
|
87
|
+
}, y = (e, t, n) => {
|
|
88
|
+
if (!r(t)) d(e, "endpoints", "A connector must declare its endpoints", "At least one read endpoint, usually \"list\"");
|
|
89
89
|
else {
|
|
90
|
-
if (!
|
|
91
|
-
else for (let [
|
|
92
|
-
if (
|
|
93
|
-
if (!
|
|
94
|
-
else for (let [
|
|
90
|
+
if (!r(t.read) || Object.keys(t.read).length === 0) d(e, "endpoints.read", "A connector needs at least one read endpoint", "Name it \"list\" — that is the one a provider element addresses when it names none");
|
|
91
|
+
else for (let [r, i] of Object.entries(t.read)) _(e, r, i, n);
|
|
92
|
+
if (t.write !== void 0) {
|
|
93
|
+
if (!r(t.write)) d(e, "endpoints.write", "Must be an object of endpoints keyed by name", "Omit it for a read-only connector");
|
|
94
|
+
else for (let [n, r] of Object.entries(t.write)) v(e, n, r);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
}, b = (
|
|
98
|
-
|
|
97
|
+
}, b = (e, t) => {
|
|
98
|
+
t !== void 0 && (r(t) ? (t.in !== "header" && t.in !== "query" && d(e, "auth.in", "Auth travels in a header or a query parameter", "One of header, query"), s(t.name) || d(e, "auth.name", "Auth needs the name it is sent under", "e.g. \"Authorization\" for a bearer token"), typeof t.value == "string" ? e.templates.push({
|
|
99
99
|
path: "auth.value",
|
|
100
|
-
value:
|
|
100
|
+
value: t.value,
|
|
101
101
|
scope: "request"
|
|
102
|
-
}) : d(
|
|
102
|
+
}) : d(e, "auth.value", "Must be a string", "A template, e.g. \"Bearer {{credential.token}}\"")) : d(e, "auth", "Must be an object", "Shape: { in, name, value }"));
|
|
103
103
|
}, x = (e, t) => {
|
|
104
104
|
let n = p(e, t, "operators", "filter");
|
|
105
105
|
if (n) for (let [t, r] of Object.entries(n)) typeof r == "string" && !r.includes("=") && d(e, `operators.${t}`, `Operator "${t}" renders no "key=value" pair, so a filter using it is dropped`, "Write the full query entry, e.g. \"filters[{{field}}][$eq]={{value}}\"");
|
|
106
|
-
}, S = (
|
|
107
|
-
if (
|
|
108
|
-
if (!
|
|
109
|
-
else for (let [
|
|
106
|
+
}, S = (e, t) => {
|
|
107
|
+
if (t !== void 0) {
|
|
108
|
+
if (!r(t)) d(e, "fields", "Must be an object of field name → type", `Types: ${a.join(", ")}`);
|
|
109
|
+
else for (let [n, r] of Object.entries(t)) typeof r == "string" && a.includes(r) || d(e, `fields.${n}`, `"${c(r)}" is not a field type`, `One of ${a.join(", ")}`);
|
|
110
110
|
}
|
|
111
111
|
}, C = (e, t) => {
|
|
112
|
-
let
|
|
113
|
-
for (let t of e.templates) for (let i of l(t.value)) i.startsWith("credential.") && (
|
|
114
|
-
|
|
115
|
-
}, w = (
|
|
116
|
-
let
|
|
112
|
+
let r = !1;
|
|
113
|
+
for (let t of e.templates) for (let i of l(t.value)) i.startsWith("credential.") && (r = !0), u(i, t.scope) || f(e, t.path, `{{${i}}} is not a value the engine binds here, so it renders empty`, `Tokens available in this position: ${n.filter((e) => e.scopes.includes(t.scope)).map((e) => e.value).join(", ")}`);
|
|
114
|
+
r && !s(t) ? f(e, "credential", "This manifest reads {{credential.…}} but names no credential, so every request goes unauthenticated", "The connector still saves. Ask the space owner to create the credential and attach it — the secret is never part of the manifest.") : !r && s(t) && f(e, "credential", "A credential is attached but no template reads {{credential.…}}, so it is never sent", "Reference it where the provider expects it, e.g. auth.value = \"Bearer {{credential.token}}\"");
|
|
115
|
+
}, w = (e) => {
|
|
116
|
+
let t = {
|
|
117
117
|
errors: [],
|
|
118
118
|
warnings: [],
|
|
119
119
|
templates: []
|
|
120
120
|
};
|
|
121
|
-
if (!e
|
|
121
|
+
if (!r(e)) return {
|
|
122
122
|
valid: !1,
|
|
123
123
|
errors: [{
|
|
124
124
|
path: "",
|
|
@@ -127,13 +127,12 @@ var i = [
|
|
|
127
127
|
}],
|
|
128
128
|
warnings: []
|
|
129
129
|
};
|
|
130
|
-
s(
|
|
131
|
-
let
|
|
132
|
-
return b(
|
|
133
|
-
valid:
|
|
134
|
-
errors:
|
|
135
|
-
warnings:
|
|
130
|
+
s(e.baseUrl) ? /^https?:\/\//.test(e.baseUrl) || d(t, "baseUrl", "Base URL must start with http:// or https://", "The engine resolves paths against it") : d(t, "baseUrl", "A connector needs a base URL", "The origin every endpoint path is appended to"), e.credential !== void 0 && typeof e.credential != "string" && d(t, "credential", "Must be the identifier of a stored credential", "The secret itself never goes here");
|
|
131
|
+
let n = g(t, e.pagination, "pagination");
|
|
132
|
+
return b(t, e.auth), p(t, e.headers, "headers", "request"), y(t, e.endpoints, n), x(t, e.operators), S(t, e.fields), e.media !== void 0 && (r(e.media) ? e.media.baseUrl !== void 0 && !s(e.media.baseUrl) && d(t, "media.baseUrl", "Must be a non-empty string", "The origin relative media paths are rebased onto") : d(t, "media", "Must be an object", "Shape: { baseUrl }")), e.projection !== void 0 && e.projection !== "full" && d(t, "projection", "The only projection is \"full\"", "Omit it to send only the paths the page binds"), C(t, e.credential), {
|
|
133
|
+
valid: t.errors.length === 0,
|
|
134
|
+
errors: t.errors,
|
|
135
|
+
warnings: t.warnings
|
|
136
136
|
};
|
|
137
137
|
}, T = (e) => w(e).valid;
|
|
138
|
-
//#endregion
|
|
139
138
|
export { T as isConnectorManifestDraft, w as validateConnectorManifest };
|