@redocly/redoc 0.129.0-next.2 → 0.129.0-next.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 +36 -0
- package/dist/bin.js +1 -1
- package/dist/cli/develop.d.ts +1 -1
- package/dist/cli/develop.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-file-extensions-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-frontmatter-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-markdoc-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-nested-configs-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-refs-usage.js +1 -1
- package/dist/cli/prepare/index.d.ts +1 -1
- package/dist/cli/translations/collect-config-translations.js +1 -1
- package/dist/cli/translations/update-translations.js +1 -1
- package/dist/client/TestProvider.js +1 -1
- package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
- package/dist/client/app/Sidebar/Sidebar.js +7 -2
- package/dist/client/app/Sidebar/useSidebarItems.d.ts +1 -0
- package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntities.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntitiesRelations.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntityRevisions.d.ts +10 -0
- package/dist/client/app/hooks/catalog/useFetchCatalogEntityRevisions.js +1 -0
- package/dist/client/app/hooks/index.d.ts +1 -0
- package/dist/client/app/hooks/index.js +1 -1
- package/dist/client/app/hooks/useLoginUrl.js +1 -1
- package/dist/client/app/pages/DevLogin/DevLogin.js +1 -1
- package/dist/client/app/pages/Login/Login.js +1 -1
- package/dist/client/app/utils/loadAndNavigate.js +1 -1
- package/dist/client/browser-entry.js +2 -2
- package/dist/client/providers/page-data/hooks.d.ts +2 -1
- package/dist/client/providers/page-data/hooks.js +1 -1
- package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
- package/dist/client/runtime/loader.js +1 -1
- package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
- package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
- package/dist/constants/common.d.ts +0 -4
- package/dist/constants/common.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/server/api-routes/execute-api-route.d.ts +0 -7
- package/dist/server/api-routes/execute-api-route.js +1 -1
- package/dist/server/api-routes/helpers/setup-logger.d.ts +2 -2
- package/dist/server/api-routes/helpers/setup-logger.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/fs/cache.d.ts +1 -2
- package/dist/server/fs/cache.js +1 -1
- package/dist/server/fs/content-fs.d.ts +9 -4
- package/dist/server/fs/content-fs.js +1 -1
- package/dist/server/fs/fs.d.ts +6 -6
- package/dist/server/fs/fs.js +1 -3
- package/dist/server/fs/load-error.d.ts +2 -2
- package/dist/server/fs/load-error.js +1 -1
- package/dist/server/fs/utils/async-storage.d.ts +0 -8
- package/dist/server/fs/utils/async-storage.js +1 -1
- package/dist/server/fs/utils/isVirtualFile.d.ts +1 -1
- package/dist/server/fs/utils/isVirtualFile.js +1 -1
- package/dist/server/plugins/api-functions/index.js +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +2 -2
- package/dist/server/plugins/arazzo-docs/index.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.d.ts +1 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.js +2 -2
- package/dist/server/plugins/asyncapi-docs/index.d.ts +1 -1
- package/dist/server/plugins/asyncapi-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/is-asyncapi-doc.js +1 -1
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +23 -18
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-entity.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-related-entity.d.ts +9 -0
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-related-entity.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.d.ts +1 -0
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-read-model.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-db-record-from-dto.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-db-record-from-file-schema.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/map-entity-relation-row.d.ts +12 -0
- package/dist/server/plugins/catalog-entities/database/mappers/map-entity-relation-row.js +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.d.ts +15 -4
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.js +67 -55
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +21 -15
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.d.ts +16 -3
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-relations-repository.d.ts +17 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-relations-repository.js +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/utils.d.ts +4 -4
- package/dist/server/plugins/catalog-entities/database/repositories/utils.js +1 -1
- package/dist/server/plugins/catalog-entities/entities/{extract-entities-content.d.ts → extract-file-content.d.ts} +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/get-server-props.d.ts +1 -2
- package/dist/server/plugins/catalog-entities/get-server-props.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/database-schemas.d.ts +64 -0
- package/dist/server/plugins/catalog-entities/schemas/database-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/dto-schemas.d.ts +6 -12
- package/dist/server/plugins/catalog-entities/schemas/dto-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.d.ts +4 -8
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/utils/catalog-data-collector.js +1 -1
- package/dist/server/plugins/catalog-entities/utils/read-string.d.ts +7 -0
- package/dist/server/plugins/catalog-entities/utils/read-string.js +1 -0
- package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/nearest-redocly-config-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/config-parser/loaders/yaml-parser.js +1 -1
- package/dist/server/plugins/default-theme/resolve-products-config.js +1 -1
- package/dist/server/plugins/ensure-frontmatter-theme-compatibility.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/graphql-docs/index.js +1 -1
- package/dist/server/plugins/l10n/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
- package/dist/server/plugins/markdown/compiler.js +1 -1
- package/dist/server/plugins/markdown/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
- package/dist/server/plugins/markdown/markdoc/resolve-raw-partials.js +1 -1
- package/dist/server/plugins/markdown/markdown-static-data-loader.js +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.d.ts +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +4 -3
- package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.d.ts +5 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/utils.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/utils.js +6 -6
- package/dist/server/plugins/mcp/docs-mcp/tools/whoami.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/utils.d.ts +3 -3
- package/dist/server/plugins/mcp/docs-mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +10 -3
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +26 -2
- package/dist/server/plugins/mcp/utils.d.ts +9 -8
- package/dist/server/plugins/mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/workers/run-api-routes-worker.js +1 -1
- package/dist/server/plugins/nav-utils.js +1 -1
- package/dist/server/plugins/openapi-docs/decorators.d.ts +3 -2
- package/dist/server/plugins/openapi-docs/decorators.js +1 -1
- package/dist/server/plugins/openapi-docs/index.d.ts +2 -2
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/openapi-docs/is-openapi-doc.js +1 -1
- package/dist/server/plugins/openapi-docs/load-definition.d.ts +1 -1
- package/dist/server/plugins/openapi-docs/load-definition.js +3 -3
- package/dist/server/plugins/pages/index.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.js +5 -5
- package/dist/server/plugins/sidebars/index.js +3 -3
- package/dist/server/plugins/utils.js +1 -1
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-relations-table.d.ts +25 -46
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js +1 -1
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.d.ts +20 -3
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.js +1 -1
- package/dist/server/providers/database/pagination/combined-filters.d.ts +4 -1
- package/dist/server/providers/database/pagination/combined-filters.js +1 -1
- package/dist/server/providers/database/pagination/filter.d.ts +1 -0
- package/dist/server/providers/database/pagination/filter.js +1 -1
- package/dist/server/providers/database/pagination/index.d.ts +4 -1
- package/dist/server/store.js +1 -1
- package/dist/server/tools/notifiers/formatter.d.ts +2 -0
- package/dist/server/tools/notifiers/formatter.js +3 -3
- package/dist/server/tools/notifiers/logger.d.ts +18 -39
- package/dist/server/tools/notifiers/logger.js +2 -6
- package/dist/server/tools/notifiers/reporter.js +9 -9
- package/dist/server/tools/notifiers/terminal-manager.d.ts +8 -0
- package/dist/server/tools/notifiers/terminal-manager.js +5 -0
- package/dist/server/types/fs.d.ts +5 -10
- package/dist/server/types/plugins/api-routes.d.ts +0 -3
- package/dist/server/types/plugins/common.d.ts +0 -1
- package/dist/server/utils/is-valid-iso-date.d.ts +5 -0
- package/dist/server/utils/is-valid-iso-date.js +1 -0
- package/dist/server/utils/lifecycle-hooks.js +1 -1
- package/dist/server/utils/queue.js +1 -1
- package/dist/server/utils/redirects/find-redirect.d.ts +4 -2
- package/dist/server/utils/redirects/find-redirect.js +1 -1
- package/dist/server/utils/resolve-asset-path.js +1 -1
- package/dist/server/utils/validate-and-sanitize-string.d.ts +29 -0
- package/dist/server/utils/validate-and-sanitize-string.js +1 -0
- package/dist/server/web-server/auth.d.ts +5 -0
- package/dist/server/web-server/auth.js +3 -3
- package/dist/server/web-server/http.js +2 -2
- package/dist/server/web-server/middleware/loggerMiddleware.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/catalog/bff-catalog-related-entities.js +1 -1
- package/dist/server/web-server/routes/catalog/bff-catalog.js +1 -1
- package/dist/server/web-server/routes/catalog/catalog-relations.js +1 -1
- package/dist/server/web-server/routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/search.js +1 -1
- package/dist/server/web-server/utils/get-redirect-login-url.js +1 -1
- package/dist/utils/auth/build-login-url.d.ts +1 -3
- package/dist/utils/auth/build-login-url.js +1 -1
- package/dist/utils/env/is-local-development.d.ts +13 -0
- package/dist/utils/env/is-local-development.js +1 -0
- package/dist/utils/env/is-production.d.ts +13 -0
- package/dist/utils/env/is-production.js +1 -0
- package/dist/utils/env/is-web-view.d.ts +14 -0
- package/dist/utils/env/is-web-view.js +1 -0
- package/dist/utils/path/remove-fragment.d.ts +16 -0
- package/dist/utils/path/remove-fragment.js +1 -0
- package/package.json +10 -10
- package/dist/server/web-server/routes/otel/types.d.ts +0 -61
- package/dist/server/web-server/routes/otel/types.js +0 -1
- /package/dist/server/plugins/catalog-entities/entities/{extract-entities-content.js → extract-file-content.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"path";import{DEFAULT_LOCALE_PLACEHOLDER as s}from"../../constants/common.js";import{normalizeRouteSlug as m}from"../../utils/path/normalize-route-slug.js";import{logger as l}from"../tools/notifiers/logger.js";import{getLocaleFromRelativePath as p}from"../fs/utils/get-locale-from-relative-path.js";import{isL10nPath as f}from"../fs/utils/is-l10n-path.js";import{removeL10nPrefix as u}from"../fs/utils/remove-l10n-prefix.js";import{resolveSidebarId as c}from"./sidebars/index.js";function E(e,o){return(Array.isArray(e)?e:e?[e]:[]).map(r=>d(r,o))}function d(e,o){const t=p(o).toLowerCase(),r=m(e);return t!==s?`/${t}${r}`:r}function b(e){const o=e.endsWith(".page.tsx")?".page.tsx":a.posix.extname(e),t=a.posix.basename(e,o);return{baseName:t,isIndexFile:t==="index"}}async function R(e,o,t,r){if(t?.slug||!f(e))return t?.slug;const n=u(e);if(!r.fs.exists(n))return;const{data:i}=await r.cache.load(n,o);return i?.frontmatter?.slug}async function I(e,o,t){const r=typeof e=="string",n=r?e:e.path;return r&&l.warnForRealFile("The 'sidebar' property in the front matter of %rp is deprecated. Use 'sidebar.path' instead.",o,t),n?c(o,n,t):null}export{R as findFrontmatterSlugs,I as getSidebarSharedDataId,b as parseBaseName,E as resolveFrontmatterSlugs};
|
|
@@ -78,25 +78,6 @@ export declare const entitiesRelationsTable: import("drizzle-orm/sqlite-core").S
|
|
|
78
78
|
}, {}, {
|
|
79
79
|
length: number | undefined;
|
|
80
80
|
}>;
|
|
81
|
-
sourceId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
82
|
-
name: "source_id";
|
|
83
|
-
tableName: "entities_relations";
|
|
84
|
-
dataType: "string";
|
|
85
|
-
columnType: "SQLiteText";
|
|
86
|
-
data: string;
|
|
87
|
-
driverParam: string;
|
|
88
|
-
notNull: false;
|
|
89
|
-
hasDefault: false;
|
|
90
|
-
isPrimaryKey: false;
|
|
91
|
-
isAutoincrement: false;
|
|
92
|
-
hasRuntimeDefault: false;
|
|
93
|
-
enumValues: [string, ...string[]];
|
|
94
|
-
baseColumn: never;
|
|
95
|
-
identity: undefined;
|
|
96
|
-
generated: undefined;
|
|
97
|
-
}, {}, {
|
|
98
|
-
length: number | undefined;
|
|
99
|
-
}>;
|
|
100
81
|
sourceVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
101
82
|
name: "source_version";
|
|
102
83
|
tableName: "entities_relations";
|
|
@@ -104,8 +85,8 @@ export declare const entitiesRelationsTable: import("drizzle-orm/sqlite-core").S
|
|
|
104
85
|
columnType: "SQLiteText";
|
|
105
86
|
data: string;
|
|
106
87
|
driverParam: string;
|
|
107
|
-
notNull:
|
|
108
|
-
hasDefault:
|
|
88
|
+
notNull: true;
|
|
89
|
+
hasDefault: true;
|
|
109
90
|
isPrimaryKey: false;
|
|
110
91
|
isAutoincrement: false;
|
|
111
92
|
hasRuntimeDefault: false;
|
|
@@ -123,8 +104,8 @@ export declare const entitiesRelationsTable: import("drizzle-orm/sqlite-core").S
|
|
|
123
104
|
columnType: "SQLiteText";
|
|
124
105
|
data: string;
|
|
125
106
|
driverParam: string;
|
|
126
|
-
notNull:
|
|
127
|
-
hasDefault:
|
|
107
|
+
notNull: true;
|
|
108
|
+
hasDefault: true;
|
|
128
109
|
isPrimaryKey: false;
|
|
129
110
|
isAutoincrement: false;
|
|
130
111
|
hasRuntimeDefault: false;
|
|
@@ -173,25 +154,6 @@ export declare const entitiesRelationsTable: import("drizzle-orm/sqlite-core").S
|
|
|
173
154
|
}, {}, {
|
|
174
155
|
length: number | undefined;
|
|
175
156
|
}>;
|
|
176
|
-
targetId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
177
|
-
name: "target_id";
|
|
178
|
-
tableName: "entities_relations";
|
|
179
|
-
dataType: "string";
|
|
180
|
-
columnType: "SQLiteText";
|
|
181
|
-
data: string;
|
|
182
|
-
driverParam: string;
|
|
183
|
-
notNull: false;
|
|
184
|
-
hasDefault: false;
|
|
185
|
-
isPrimaryKey: false;
|
|
186
|
-
isAutoincrement: false;
|
|
187
|
-
hasRuntimeDefault: false;
|
|
188
|
-
enumValues: [string, ...string[]];
|
|
189
|
-
baseColumn: never;
|
|
190
|
-
identity: undefined;
|
|
191
|
-
generated: undefined;
|
|
192
|
-
}, {}, {
|
|
193
|
-
length: number | undefined;
|
|
194
|
-
}>;
|
|
195
157
|
targetVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
196
158
|
name: "target_version";
|
|
197
159
|
tableName: "entities_relations";
|
|
@@ -199,8 +161,8 @@ export declare const entitiesRelationsTable: import("drizzle-orm/sqlite-core").S
|
|
|
199
161
|
columnType: "SQLiteText";
|
|
200
162
|
data: string;
|
|
201
163
|
driverParam: string;
|
|
202
|
-
notNull:
|
|
203
|
-
hasDefault:
|
|
164
|
+
notNull: true;
|
|
165
|
+
hasDefault: true;
|
|
204
166
|
isPrimaryKey: false;
|
|
205
167
|
isAutoincrement: false;
|
|
206
168
|
hasRuntimeDefault: false;
|
|
@@ -218,8 +180,8 @@ export declare const entitiesRelationsTable: import("drizzle-orm/sqlite-core").S
|
|
|
218
180
|
columnType: "SQLiteText";
|
|
219
181
|
data: string;
|
|
220
182
|
driverParam: string;
|
|
221
|
-
notNull:
|
|
222
|
-
hasDefault:
|
|
183
|
+
notNull: true;
|
|
184
|
+
hasDefault: true;
|
|
223
185
|
isPrimaryKey: false;
|
|
224
186
|
isAutoincrement: false;
|
|
225
187
|
hasRuntimeDefault: false;
|
|
@@ -287,6 +249,23 @@ export declare const entitiesRelationsTable: import("drizzle-orm/sqlite-core").S
|
|
|
287
249
|
}, {}, {
|
|
288
250
|
length: number | undefined;
|
|
289
251
|
}>;
|
|
252
|
+
isDeleted: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
253
|
+
name: "is_deleted";
|
|
254
|
+
tableName: "entities_relations";
|
|
255
|
+
dataType: "boolean";
|
|
256
|
+
columnType: "SQLiteBoolean";
|
|
257
|
+
data: boolean;
|
|
258
|
+
driverParam: number;
|
|
259
|
+
notNull: false;
|
|
260
|
+
hasDefault: true;
|
|
261
|
+
isPrimaryKey: false;
|
|
262
|
+
isAutoincrement: false;
|
|
263
|
+
hasRuntimeDefault: false;
|
|
264
|
+
enumValues: undefined;
|
|
265
|
+
baseColumn: never;
|
|
266
|
+
identity: undefined;
|
|
267
|
+
generated: undefined;
|
|
268
|
+
}, {}, {}>;
|
|
290
269
|
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
291
270
|
name: "created_at";
|
|
292
271
|
tableName: "entities_relations";
|
package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sqliteTable as
|
|
1
|
+
import{sqliteTable as i,text as e,integer as r,index as o,uniqueIndex as n}from"drizzle-orm/sqlite-core";const l=i("entities_relations",{id:e("id").primaryKey(),organizationId:e("organization_id").notNull(),projectId:e("project_id").notNull(),sourceKey:e("source_key").notNull(),sourceVersion:e("source_version").default("").notNull(),sourceRevision:e("source_revision").default("").notNull(),sourceToTargetRelation:e("source_to_target_relation").notNull(),targetKey:e("target_key").notNull(),targetVersion:e("target_version").default("").notNull(),targetRevision:e("target_revision").default("").notNull(),targetToSourceRelation:e("target_to_source_relation").notNull(),sourceFile:e("source_file"),fileHash:e("file_hash"),isDeleted:r("is_deleted",{mode:"boolean"}).default(!1),createdAt:e("created_at").notNull(),updatedAt:e("updated_at").notNull()},t=>[o("idx_entities_relations_source_key").on(t.sourceKey,t.isDeleted),o("idx_entities_relations_target_key").on(t.targetKey,t.isDeleted),o("idx_entities_relations_source_target").on(t.sourceToTargetRelation),o("idx_entities_relations_target_source").on(t.targetToSourceRelation),n("idx_entities_relations_unique").on(t.sourceKey,t.targetKey,t.sourceVersion,t.targetVersion,t.sourceRevision,t.targetRevision)]);export{l as entitiesRelationsTable};
|
|
@@ -332,8 +332,8 @@ export declare const entitiesTable: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
332
332
|
columnType: "SQLiteText";
|
|
333
333
|
data: string;
|
|
334
334
|
driverParam: string;
|
|
335
|
-
notNull:
|
|
336
|
-
hasDefault:
|
|
335
|
+
notNull: true;
|
|
336
|
+
hasDefault: true;
|
|
337
337
|
isPrimaryKey: false;
|
|
338
338
|
isAutoincrement: false;
|
|
339
339
|
hasRuntimeDefault: false;
|
|
@@ -351,7 +351,7 @@ export declare const entitiesTable: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
351
351
|
columnType: "SQLiteText";
|
|
352
352
|
data: string;
|
|
353
353
|
driverParam: string;
|
|
354
|
-
notNull:
|
|
354
|
+
notNull: true;
|
|
355
355
|
hasDefault: false;
|
|
356
356
|
isPrimaryKey: false;
|
|
357
357
|
isAutoincrement: false;
|
|
@@ -416,6 +416,23 @@ export declare const entitiesTable: import("drizzle-orm/sqlite-core").SQLiteTabl
|
|
|
416
416
|
identity: undefined;
|
|
417
417
|
generated: undefined;
|
|
418
418
|
}, {}, {}>;
|
|
419
|
+
isDeleted: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
420
|
+
name: "is_deleted";
|
|
421
|
+
tableName: "entities";
|
|
422
|
+
dataType: "boolean";
|
|
423
|
+
columnType: "SQLiteBoolean";
|
|
424
|
+
data: boolean;
|
|
425
|
+
driverParam: number;
|
|
426
|
+
notNull: false;
|
|
427
|
+
hasDefault: true;
|
|
428
|
+
isPrimaryKey: false;
|
|
429
|
+
isAutoincrement: false;
|
|
430
|
+
hasRuntimeDefault: false;
|
|
431
|
+
enumValues: undefined;
|
|
432
|
+
baseColumn: never;
|
|
433
|
+
identity: undefined;
|
|
434
|
+
generated: undefined;
|
|
435
|
+
}, {}, {}>;
|
|
419
436
|
scorecardsStatus: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
420
437
|
name: "scorecards_status";
|
|
421
438
|
tableName: "entities";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sqliteTable as o,text as e,integer as s,index as i,uniqueIndex as n}from"drizzle-orm/sqlite-core";const
|
|
1
|
+
import{sqliteTable as o,text as e,integer as s,index as i,uniqueIndex as n}from"drizzle-orm/sqlite-core";const d=o("entities",{id:e("id").primaryKey(),organizationId:e("organization_id").notNull(),projectId:e("project_id").notNull(),key:e("key").notNull(),type:e("type").notNull(),title:e("title").notNull(),summary:e("summary"),tags:e("tags"),metadata:e("metadata"),git:e("git"),contact:e("contact"),links:e("links"),createdAt:e("created_at").notNull(),updatedAt:e("updated_at").notNull(),source:e("source").default("file"),sourceFile:e("source_file"),fileHash:e("file_hash"),version:e("version").default("not_specified_version").notNull(),revision:e("revision").notNull(),hash:e("hash"),isCurrent:s("is_current",{mode:"boolean"}).default(!0),isDefaultVersion:s("is_default_version",{mode:"boolean"}).default(!1),isDeleted:s("is_deleted",{mode:"boolean"}).default(!1),scorecardsStatus:e("scorecards_status")},t=>[i("idx_entities_type").on(t.type),i("idx_entities_hash").on(t.hash),i("idx_entities_key_source_created_at").on(t.key,t.createdAt),i("idx_entities_key_source_is_current").on(t.key,t.isCurrent,t.isDeleted),i("idx_entities_key_source_is_default").on(t.key,t.isDefaultVersion),n("idx_entities_key_source").on(t.key,t.source,t.revision,t.version)]);export{d as entitiesTable};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { SQLiteSelect } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
import type { SQL } from 'drizzle-orm';
|
|
2
3
|
import type { PaginationParams } from './schemas.js';
|
|
3
|
-
export declare const applyCombinedFilters: <T extends SQLiteSelect>(sqlBuilder: T, paginationParams: PaginationParams
|
|
4
|
+
export declare const applyCombinedFilters: <T extends SQLiteSelect>(sqlBuilder: T, paginationParams: PaginationParams & {
|
|
5
|
+
baseWhereCondition?: SQL;
|
|
6
|
+
}) => T;
|
|
4
7
|
//# sourceMappingURL=combined-filters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{and as
|
|
1
|
+
import{and as h}from"drizzle-orm";import{applyFilter as f}from"./filter.js";import{applySearch as p}from"./search.js";import{applyAfterAndBefore as C}from"./after-and-before.js";const m=(o,t)=>{const e=[];t.baseWhereCondition&&e.push(t.baseWhereCondition);const{whereCondition:r}=f(o,t.filter);r&&e.push(r);const{whereCondition:n}=p(o,t);n&&e.push(n);const{whereCondition:i}=C(o,t);return i&&e.push(i),e.length===0?o:e.length===1?o.where(e[0]):o.where(h(...e))};export{m as applyCombinedFilters};
|
|
@@ -8,4 +8,5 @@ export declare function applyFilter<T extends SQLiteSelect | SQLiteDelete>(sqlBu
|
|
|
8
8
|
export declare function convertFilterToWhereCondition(filter?: Filter): SQL | undefined;
|
|
9
9
|
export declare function getFirstFilterFieldValue(filter: Filter | undefined, fieldName: string): FilterClause['value'] | undefined;
|
|
10
10
|
export declare function parseFilterQuery(query?: string, availableFields?: string[], fieldsTransformations?: Record<string, string>): Filter | undefined;
|
|
11
|
+
export declare function excludeFieldsFromFilter(filter: Filter | undefined, fieldsToExclude: string[]): Filter | undefined;
|
|
11
12
|
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{and as
|
|
1
|
+
import{and as O,between as R,eq as T,inArray as C,isNotNull as L,isNull as I,like as v,ne as k,notBetween as y,notInArray as W,notLike as b,or as d,sql as a}from"drizzle-orm";import{isFilterCondition as F}from"./types.js";import{transformToSnakeCase as q}from"./utils/transform-to-snake-case.js";import{isFieldAllowed as D}from"./utils/field-pattern-matcher.js";import{OPERATORS as h}from"./constants.js";const U=["domains","owners"],P=["tags"];function z(t,e){const o=J(e);return o?{sqlBuilder:t,whereCondition:o}:{sqlBuilder:t,whereCondition:null}}function J(t){if(t)return F(t)?j(t):x(t)}const j=t=>{const{op:e,conditions:o}=t,n=[];for(const l of o){if(F(l)){const r=j(l);r&&n.push(r);continue}const i=x(l);i&&n.push(i)}return e===h.AND?O(...n):d(...n)},H=(t,e)=>e.length>1?`$.${e.slice(1).join(".")}.${t}`:`$.${t}`,m=({operator:t,value:e,field:o,parentFields:n,negation:l})=>{const i=a.identifier(n[0]),r=H(o,n);switch(t){case"equal":return l?a`(json_extract(${i}, ${r}) != ${e} OR json_extract(${i}, ${r}) IS NULL)`:a`json_extract(${i}, ${r}) == ${e}`;case"equalNull":return l?a`json_extract(${i}, ${r}) IS NOT NULL`:a`json_extract(${i}, ${r}) IS NULL`;case"contains":return l?a`(json_extract(${i}, ${r}) NOT LIKE ${e} OR json_extract(${i}, ${r}) IS NULL)`:a`json_extract(${i}, ${r}) LIKE ${e}`;case"in":if(Array.isArray(e)){const s=e.map(c=>a`json_extract(${i}, ${r}) == ${c}`);return l?a`(NOT (${d(...s)}) OR json_extract(${i}, ${r}) IS NULL)`:d(...s)}break;case"between":if(Array.isArray(e)&&e.length===2)return l?a`(NOT (json_extract(${i}, ${r}) BETWEEN ${e[0]} AND ${e[1]}) OR json_extract(${i}, ${r}) IS NULL)`:a`json_extract(${i}, ${r}) BETWEEN ${e[0]} AND ${e[1]}`;break;default:throw new Error(`Unsupported operator: ${t} for json path`)}};function G(t,e){if(!t)return;const o=l=>{if(F(l)){for(const i of l.conditions){const r=o(i);if(r!==void 0)return r}return}if(l.field===e)return l.value},n=o(t);return typeof n=="string"?n.trim()===""?null:n.trim():n??null}const M=t=>{const{field:e,operator:o,value:n,modifier:l,parentFields:i}=t,r=l==="not";if(!i||i.length<1)throw new Error("convertNestedFilterClauseToSql called without parentFields");switch(o){case"equal":return m(n===null?{operator:"equalNull",value:n,field:e,parentFields:i,negation:r}:{operator:o,value:n,field:e,parentFields:i,negation:r});case"contains":if(typeof n=="string"){const s=n.startsWith("%")||n.endsWith("%")?n:`%${n}%`;return m({operator:o,value:s,field:e,parentFields:i,negation:r})}break;case"in":if(Array.isArray(n))return m({operator:o,value:n,field:e,parentFields:i,negation:r});break;case"between":if(Array.isArray(n)&&n.length===2)return m({operator:o,value:n,field:e,parentFields:i,negation:r});break;default:throw new Error(`Unsupported filter operator: ${o}`)}},x=t=>{const{field:e,operator:o,value:n,modifier:l,parentFields:i}=t;if(i&&i.length>=1)return M(t);const r=l==="not",s=a.identifier(e),c=P.includes(e),f=U.includes(e);switch(o){case"equal":return n===null?r?L(s):I(s):f?r?a`NOT EXISTS (SELECT 1 FROM json_each(${s}) WHERE json_extract(json_each.value, '$.key') = ${n})`:a`EXISTS (SELECT 1 FROM json_each(${s}) WHERE json_extract(json_each.value, '$.key') = ${n})`:c?r?a`NOT EXISTS (SELECT 1 FROM json_each(${s}) WHERE json_each.value = ${n})`:a`EXISTS (SELECT 1 FROM json_each(${s}) WHERE json_each.value = ${n})`:r?k(s,n):T(s,n);case"contains":if(typeof n=="string"){const u=n.startsWith("%")||n.endsWith("%")?n:`%${n}%`;return r?b(s,u):v(s,u)}break;case"in":if(Array.isArray(n)){if(f){const u=n.map(p=>a`EXISTS (SELECT 1 FROM json_each(${s}) WHERE json_extract(json_each.value, '$.key') = ${p})`);return r?a`NOT (${d(...u)})`:d(...u)}else if(c){const u=n.map(p=>a`EXISTS (SELECT 1 FROM json_each(${s}) WHERE json_each.value = ${p})`);return r?a`NOT (${d(...u)})`:d(...u)}return r?W(s,n):C(s,n)}break;case"between":if(Array.isArray(n)&&n.length===2)return r?y(s,n[0],n[1]):R(s,n[0],n[1]);break;default:throw new Error(`Unsupported filter operator: ${o}`)}},A=["'",'"'];function Z(t="",e=[],o={}){if(!t||!t.trim())return;const n=g(t);return w(n,e,o)}function S(t){const e=X(t);if(e.operator===":"){const o=N(e.value,",");if(o.length>1)return{operator:"in",field:e.field,parentFields:e.parentFields,value:o.map(E),modifier:e.modifier};const n=N(e.value,"..");return n.length===2?{operator:"between",field:e.field,parentFields:e.parentFields,value:[E(n[0]),E(n[1])],modifier:e.modifier}:{operator:"equal",field:e.field,parentFields:e.parentFields,value:e.value==="null"?null:E(e.value),modifier:e.modifier}}else if(e.operator==="~")return{operator:"contains",field:e.field,parentFields:e.parentFields,value:E(e.value),modifier:e.modifier};throw new Error(`Unsupported filter clause: ${t}`)}function X(t){const e="^(?<modifier>^-?)",o="(?<field>[a-z][\\w.]*)",n="(?<operator>:|~)",l="(?<value>.+)",i=new RegExp(`^${e}${o}${n}${l}$`,"i"),r=t.match(i);if(!r||!r.groups)throw new Error(`Invalid filter clause: ${t}`);const{operator:s,value:c,modifier:f}=r.groups,u=r.groups.field.split(".");return{field:u.pop(),parentFields:u,operator:s,value:c,modifier:f==="-"?"not":void 0}}function N(t,e){const o=[];let n="",l=!1,i=0;for(let r=0;r<t.length;r++){const s=t[r-1],c=t[r];if(i>0){i--;continue}s!=="\\"&&A.includes(c)&&(l=!l),!l&&t.slice(r,r+e.length)===e?(o.push(n),n="",i=e.length-1):n+=c}return n&&o.push(n),o}function E(t){for(const e of A)if(t.startsWith(e)&&t.endsWith(e))return t.slice(1,-1);return t}function g(t){let e="",o=0,n=!1,l="";const i=[];for(let s=0;s<t.length;s++){const c=t[s],f=t[s+1];if(['"',"'"].includes(c)&&(s===0||t[s-1]!=="\\")){if(!n){n=!0,l=c,e+=c;continue}if(c===l){n=!1,l="",e+=c;continue}}if(n){e+=c;continue}if(o===0){const u=f==="A"&&t.slice(s+1,s+5)===`${h.AND} `;if(c===" "&&u){const $=e.trim();$&&(i.push(S($)),e="");const _=g(t.slice(s+5));return{op:h.AND,conditions:[...i,_]}}const p=f==="O"&&t.slice(s+1,s+4)===`${h.OR} `;if(c===" "&&p){const $=e.trim();$&&(i.push(S($)),e="");const _=g(t.slice(s+4));return{op:h.OR,conditions:[...i,_]}}}if(c==="("){const u=e.trim();o===0&&u&&(i.push(S(u)),e=""),o++,e+=c;continue}if(c===")"){if(o--,e+=c,o===0){const u=e.slice(1,-1);i.push(g(u)),e=""}continue}e+=c}const r=e.trim();return r&&i.push(S(r)),i.length===1?i[0]:{op:h.AND,conditions:i}}function w(t,e,o){if("field"in t){const n=t.parentFields?.length?`${t.parentFields.join(".")}.${t.field}`:t.field;if(!D(n,e))throw new Error(`Invalid filter field: ${n}`);const l=t.parentFields?.length?t.field:o[t.field]||q(t.field);return{...t,field:l}}else return{...t,conditions:t.conditions.map(n=>w(n,e,o))}}function ee(t,e){if(!t)return;const o=i=>e.includes(i),n=i=>{if(F(i)){const r=i.conditions.map(n).filter(s=>s!==null);return r.length===0?null:r.length===1?r[0]:{...i,conditions:r}}else return o(i.field)?null:i};return n(t)||void 0}export{z as applyFilter,J as convertFilterToWhereCondition,ee as excludeFieldsFromFilter,G as getFirstFilterFieldValue,Z as parseFilterQuery};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { SQLiteSelect } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
import type { SQL } from 'drizzle-orm';
|
|
2
3
|
import type { PaginationParams } from './schemas.js';
|
|
3
|
-
export declare const applyPagination: <T extends SQLiteSelect>(sqlBuilderInstance: T, paginationParams: PaginationParams
|
|
4
|
+
export declare const applyPagination: <T extends SQLiteSelect>(sqlBuilderInstance: T, paginationParams: PaginationParams & {
|
|
5
|
+
baseWhereCondition?: SQL;
|
|
6
|
+
}, tableAlias?: string) => T;
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/server/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import A from"@markdoc/markdoc";import{getPathnameForLocale as C}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as f}from"../constants/common.js";import{DEFAULT_TITLE as P}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as T}from"../utils/guards/is-object.js";import{mapObject as O}from"../utils/object/map-object.js";import{getValueDeep as w}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as l}from"../utils/path/normalize-route-slug.js";import{isLocalLink as k}from"../utils/path/is-local-link.js";import{reporter as S}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as L}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{readEnvVariable as F}from"./utils/envs/read-env-variable.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as G}from"./ssr/render.js";import{readStaticData as I,writeStaticData as N}from"./utils/static-data.js";import{parseAndResolveMarkdoc as V}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as j}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as H}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as J}from"./utils/globs.js";import{replaceEnvVariablesDeep as U}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as K}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as q}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map"},g="markdown/partials",Ee="markdown/partials-deps",v="PLAN_GATES",$=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORG_ID"],be="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#e={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#t=new Map;constructor({outdir:e,contentDir:t,serverMode:s=!1,serverOutDir:r}){this.#r=t,this.outdir=e,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(e,t){const s=this.listeners.get(e);s?s.add(t):this.listeners.set(e,new Set([t]))}queueEvent=(e,t,...s)=>{this.#t.set(e+String(t),[e,t,...s])};runListeners=(e,t,...s)=>{for(const r of this.listeners.get(e)||new Set)t?r(t,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(e=>{this.#i=e})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const e of this.#t.values())this.runListeners(...e);this.#t.clear()}startEsbuildRun(){this.#n=new Promise(e=>{this.#c=e})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await q("build.reload_markdoc_options",async()=>{const e=y.instance(),t=await j(this.serverOutDir),s=Object.fromEntries(Object.entries(t.tags).filter(([r])=>D[r]!=null?e.canAccessFeature(D[r]):!0));this.#s={...t,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=e=>{const t=this.globalData,s={...this.globalData,...e};this.globalData=s,JSON.stringify(s)!==JSON.stringify(t)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;parseMarkdoc=async(e,t,s)=>{const{data:{info:r,ast:a},compoundHash:i}=await V(e,this.markdocOptions,{actions:this,context:t});for(const o of r.sharedDataDeps||[]){for(const n of s?.routeSlugs||[])this.addRouteSharedData(n,o,o);for(const n of s?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(o),this.sharedDataDeps.set(n,c)}}for(const o of r.dynamicMarkdocComponents||[]){for(const n of s?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(o),this.routesDynamicComponents.set(n,c)}for(const n of s?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(o),this.sharedDataMarkdocComponents.set(n,c)}}return{info:r,ast:a,compoundHash:i}};async loadOpenApiDefinitions(e){return(await e.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(e){return(await e.cache.load(".","asyncapi-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const t=Object.keys(e);for(const i of t)for(const o in this.replacedEnvVars)if(o===i||o.startsWith(`${i}:`)){const n=o.split(":"),{error:c,value:d}=w(e,n);(c||d!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=U(e);for(const i of r)this.unsetEnvVars.add(i);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,t)=>{if(!y.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const a=l(e).toLowerCase();this.config.redirects[a]=t,a.endsWith("*")&&K(this.config.wildcardRedirectsTree,a)};getRedirect=e=>{const t=l(e).toLowerCase();return x(t,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(e,t,s)=>{if(s&&this.#e[e]===s)return e;const r=JSON.stringify(t),a=s??L(r);return this.#e[e]===a||(this.#e[e]=a,await B(e,r,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,t,s)=>{const r=M(e),a=this.routesSharedData.get(r)||{};a[t]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${e}, ${t}, ${s}`)};getRouteSharedDataByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.routesSharedData.get(t)||{}:{}};addRoute=e=>{const s={...J(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:s}),p.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,t,s)=>{const r=[f,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const i=C(e,f,a.code,r);this.addRouteSharedData(i,t,s)}};addApiRoute=e=>{this.apiRoutes.push(e),p.verbose("Created API route %s",e.slug)};addMiddleware=e=>{this.middleware.push(e),p.verbose("Created middleware %s",e.id)};getRouteByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.getRouteBySlug(t):void 0};getRouteBySlug=(e,t={})=>{const{followRedirect:s=!0}=t,r=this.getRedirect(e);return s&&r?this.routesBySlug.get(l(r.to)):this.routesBySlug.get(e)};slugHasRouteOrRedirect=e=>{const t=l(e);if(this.routesBySlug.has(t))return!0;const s=this.getRedirect(e);if(!s)return!1;if(!k(s.to))return!0;const r=l(s.to);return this.routesBySlug.has(r)};getRoutesByTemplateId=e=>this.newRoutes.filter(t=>t.templateId===e);getAllRoutesForLocale=(e=f)=>{const t=Array.from(this.routesBySlug.values()),s=e.toLowerCase();return t.filter(r=>e===f?!H(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,t)=>(this.templates.set(e,t),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,t)=>(this.apiRoutesRequestHandlers.set(e,t),e);registerServerPropsGetter=(e,t)=>(this.serverPropsGetters.set(e,t),e);registerPagePropsGetter=(e,t)=>{this.pagePropsGetters.set(e,t)};async writeRouteStaticData(e,t){const s=await this.resolveRouteStaticData(e,t,!1);s&&N(e.slug,s,this.outdir)}async resolveRouteStaticData(e,t,s){if(this.serverMode)return I(e.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(d,h)=>this.parseMarkdoc(d,h,{routeSlugs:[e.slug]})},a=await e.getStaticData?.(e,r)||{},i=new Set(this.routesDynamicComponents.get(e.slug)),o=this.routesSharedData.get(e.slug)||{};for(const d of Object.values(o)){const h=this.sharedDataMarkdocComponents.get(d);h&&h.forEach(u=>i.add(u));const m=this.sharedDataDeps.get(d);m&&m.forEach(u=>this.addRouteSharedData(e.slug,u,u))}const n=this.getGlobalConfig("seo"),c=a?.frontmatter||{};return{...a,frontmatter:{...c,seo:{...c?.seo,title:c?.seo?.title||await e.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(i),metadata:{...a?.props?.metadata,...e.metadata},seo:{title:P,...n,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,t){if(!e?.length)return;const s=typeof e[0]=="string"?e.join(""):G(e);s&&(t==="head"?this.ssr.headTags.push(s):t==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());e.push([s,a]);break;case"object":s==="config"&&e.push([s,await this.getConfigWithEnvPlaceholders()]),e.push([s,this[s]]);break;default:throw new Error("Invalid format")}const t=Object.fromEntries(e);return t[v]=F("PLAN_GATES"),t}static fromJson(e,t){const s=new E(t);for(const[a,i]of Object.entries(R))switch(i){case"map":s[a]=new Map(e[a]);break;case"object":if(a==="config"){s.setGlobalConfig(e[a]);break}s[a]=e[a];break;default:throw new Error("Invalid format")}s.config[g]=z(s.config[g]||{});const r=e[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const t in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[t],r=t.split(":"),a=r.pop(),{error:i,value:o}=w(e,r);if(i||!T(o)&&!Array.isArray(o)){await S.panicOnBuild(`Failed to replace env var with env name for ${t}`);continue}o[a]=s}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(s=>!$.includes(s));if(e.length===0)return;const t=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await S.panicOnBuildContentError(t)}}function z(b){return O(b,e=>A.Ast.fromJSON(JSON.stringify(e)))}export{g as MARKDOC_PARTIALS_DATA_KEY,Ee as MARKDOC_PARTIALS_DEPS_KEY,E as Store,be as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
|
|
1
|
+
import A from"@markdoc/markdoc";import{getPathnameForLocale as C}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as u}from"../constants/common.js";import{DEFAULT_TITLE as P}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as T}from"../utils/guards/is-object.js";import{mapObject as O}from"../utils/object/map-object.js";import{getValueDeep as w}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as f}from"../utils/path/normalize-route-slug.js";import{isLocalLink as k}from"../utils/path/is-local-link.js";import{reporter as S}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as L}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{readEnvVariable as F}from"./utils/envs/read-env-variable.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as G}from"./ssr/render.js";import{readStaticData as I,writeStaticData as N}from"./utils/static-data.js";import{parseAndResolveMarkdoc as V}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as j}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as H}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as J}from"./utils/globs.js";import{replaceEnvVariablesDeep as U}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as K}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as q}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map"},g="markdown/partials",Ee="markdown/partials-deps",v="PLAN_GATES",$=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORG_ID"],be="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#e={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#t=new Map;constructor({outdir:e,contentDir:t,serverMode:s=!1,serverOutDir:r}){this.#r=t,this.outdir=e,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(e,t){const s=this.listeners.get(e);s?s.add(t):this.listeners.set(e,new Set([t]))}queueEvent=(e,t,...s)=>{this.#t.set(e+String(t),[e,t,...s])};runListeners=(e,t,...s)=>{for(const r of this.listeners.get(e)||new Set)t?r(t,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(e=>{this.#i=e})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const e of this.#t.values())this.runListeners(...e);this.#t.clear()}startEsbuildRun(){this.#n=new Promise(e=>{this.#c=e})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await q("build.reload_markdoc_options",async()=>{const e=y.instance(),t=await j(this.serverOutDir),s=Object.fromEntries(Object.entries(t.tags).filter(([r])=>D[r]!=null?e.canAccessFeature(D[r]):!0));this.#s={...t,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=e=>{const t=this.globalData,s={...this.globalData,...e};this.globalData=s,JSON.stringify(s)!==JSON.stringify(t)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;parseMarkdoc=async(e,t,s)=>{const{data:{info:r,ast:a},compoundHash:i}=await V(e,this.markdocOptions,{actions:this,context:t});for(const o of r.sharedDataDeps||[]){for(const n of s?.routeSlugs||[])this.addRouteSharedData(n,o,o);for(const n of s?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(o),this.sharedDataDeps.set(n,c)}}for(const o of r.dynamicMarkdocComponents||[]){for(const n of s?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(o),this.routesDynamicComponents.set(n,c)}for(const n of s?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(o),this.sharedDataMarkdocComponents.set(n,c)}}return{info:r,ast:a,compoundHash:i}};async loadOpenApiDefinitions(e){return(await e.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(e){return(await e.cache.load(".","asyncapi-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const t=Object.keys(e);for(const i of t)for(const o in this.replacedEnvVars)if(o===i||o.startsWith(`${i}:`)){const n=o.split(":"),{error:c,value:d}=w(e,n);(c||d!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=U(e);for(const i of r)this.unsetEnvVars.add(i);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,t)=>{if(!y.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const a=f(e).toLowerCase();this.config.redirects[a]=t,a.endsWith("*")&&K(this.config.wildcardRedirectsTree,a)};getRedirect=e=>{const t=f(e).toLowerCase();return x(t,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(e,t,s)=>{if(s&&this.#e[e]===s)return e;const r=JSON.stringify(t),a=s??L(r);return this.#e[e]===a||(this.#e[e]=a,await B(e,r,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,t,s)=>{const r=M(e),a=this.routesSharedData.get(r)||{};a[t]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${e}, ${t}, ${s}`)};getRouteSharedDataByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.routesSharedData.get(t)||{}:{}};addRoute=e=>{const s={...J(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:s}),p.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,t,s)=>{const r=[u,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const i=C(e,u,a.code,r);this.addRouteSharedData(i,t,s)}};addApiRoute=e=>{this.apiRoutes.push(e),p.verbose("Created API route %s",e.slug)};addMiddleware=e=>{this.middleware.push(e),p.verbose("Created middleware %s",e.id)};getRouteByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.getRouteBySlug(t):void 0};getRouteBySlug=(e,t={})=>{const{followRedirect:s=!0}=t,r=this.getRedirect(e);return s&&r?this.routesBySlug.get(f(r.to)):this.routesBySlug.get(e)};slugHasRouteOrRedirect=e=>{if(this.routesBySlug.has(e))return!0;const t=this.getRedirect(e);if(!t)return!1;if(!k(t.to))return!0;const s=f(t.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=e=>this.newRoutes.filter(t=>t.templateId===e);getAllRoutesForLocale=(e=u)=>{const t=Array.from(this.routesBySlug.values()),s=e.toLowerCase();return t.filter(r=>e===u?!H(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,t)=>(this.templates.set(e,t),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,t)=>(this.apiRoutesRequestHandlers.set(e,t),e);registerServerPropsGetter=(e,t)=>(this.serverPropsGetters.set(e,t),e);registerPagePropsGetter=(e,t)=>{this.pagePropsGetters.set(e,t)};async writeRouteStaticData(e,t){const s=await this.resolveRouteStaticData(e,t,!1);s&&N(e.slug,s,this.outdir)}async resolveRouteStaticData(e,t,s){if(this.serverMode)return I(e.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(d,l)=>this.parseMarkdoc(d,l,{routeSlugs:[e.slug]})},a=await e.getStaticData?.(e,r)||{},i=new Set(this.routesDynamicComponents.get(e.slug)),o=this.routesSharedData.get(e.slug)||{};for(const d of Object.values(o)){const l=this.sharedDataMarkdocComponents.get(d);l&&l.forEach(h=>i.add(h));const m=this.sharedDataDeps.get(d);m&&m.forEach(h=>this.addRouteSharedData(e.slug,h,h))}const n=this.getGlobalConfig("seo"),c=a?.frontmatter||{};return{...a,frontmatter:{...c,seo:{...c?.seo,title:c?.seo?.title||await e.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(i),metadata:{...a?.props?.metadata,...e.metadata},seo:{title:P,...n,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,t){if(!e?.length)return;const s=typeof e[0]=="string"?e.join(""):G(e);s&&(t==="head"?this.ssr.headTags.push(s):t==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());e.push([s,a]);break;case"object":s==="config"&&e.push([s,await this.getConfigWithEnvPlaceholders()]),e.push([s,this[s]]);break;default:throw new Error("Invalid format")}const t=Object.fromEntries(e);return t[v]=F("PLAN_GATES"),t}static fromJson(e,t){const s=new E(t);for(const[a,i]of Object.entries(R))switch(i){case"map":s[a]=new Map(e[a]);break;case"object":if(a==="config"){s.setGlobalConfig(e[a]);break}s[a]=e[a];break;default:throw new Error("Invalid format")}s.config[g]=W(s.config[g]||{});const r=e[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const t in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[t],r=t.split(":"),a=r.pop(),{error:i,value:o}=w(e,r);if(i||!T(o)&&!Array.isArray(o)){await S.panicOnBuild(`Failed to replace env var with env name for ${t}`);continue}o[a]=s}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(s=>!$.includes(s));if(e.length===0)return;const t=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await S.panicOnBuildContentError(t)}}function W(b){return O(b,e=>A.Ast.fromJSON(JSON.stringify(e)))}export{g as MARKDOC_PARTIALS_DATA_KEY,Ee as MARKDOC_PARTIALS_DEPS_KEY,E as Store,be as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
|
|
@@ -15,6 +15,8 @@ export declare enum LogLevel {
|
|
|
15
15
|
VERBOSE = "VERBOSE",
|
|
16
16
|
HTTP = "HTTP"
|
|
17
17
|
}
|
|
18
|
+
export declare function shouldLog(level: LogLevel, minLevel: LogLevel): boolean;
|
|
19
|
+
export declare function parseLogLevel(levelStr: string | undefined): LogLevel | undefined;
|
|
18
20
|
declare const formatter: {
|
|
19
21
|
format(log: LogData): string;
|
|
20
22
|
interpolate(pattern: string, ...args: any[]): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as O from"node:path";import{isProductionMode as
|
|
2
|
-
`},
|
|
3
|
-
`},y=e=>(e%500<100
|
|
1
|
+
import*as O from"node:path";import{isProductionMode as g}from"../../utils/envs/is-production-mode.js";import{maskEmail as T}from"./helpers/privacy/mask-email.js";import{maskSubject as E}from"./helpers/privacy/mask-subject.js";import{removePii as A}from"./helpers/privacy/remove-pii.js";import{removePiiFromUrl as P}from"./helpers/privacy/remove-pii-from-url.js";import{red as $,green as x,bold as j,blue as p,gray as i,yellow as C,cyan as w}from"./helpers/colors.js";var n;(function(e){e.INFO="INFO",e.WARN="WARN",e.ERROR="ERROR",e.SUCCESS="SUCCESS",e.VERBOSE="VERBOSE",e.HTTP="HTTP"})(n||(n={}));const b={[n.VERBOSE]:0,[n.HTTP]:1,[n.INFO]:2,[n.SUCCESS]:2,[n.WARN]:3,[n.ERROR]:4};function W(e,s){return b[e]>=b[s]}function L(e){if(!e)return;const s=e.toUpperCase();if(s in n)return s}const F={[n.INFO]:p,[n.SUCCESS]:x,[n.WARN]:C,[n.ERROR]:$,[n.HTTP]:w,[n.VERBOSE]:i},I={"%ap":e=>p(O.resolve(e)),"%rp":e=>p(O.relative(process.cwd(),e)),"%s":e=>e?.toString(),"%c":e=>p(e)},v={format(e){switch(process.env.PORTAL_LOG_FORMAT){case"JSON":return U(e);default:return H(e)}},interpolate(e,...s){const a=Object.keys(I).map(t=>`(${t})`).join("|"),m=new RegExp(a,"g");let r,u=e;for(;(r=m.exec(e))!==null;){r.index===m.lastIndex&&m.lastIndex++;const t=s.shift();if(t===void 0)break;const o=r[0];u=u.replace(o,I[o](t))}return u}};var z=v;const H=e=>{const{level:s,message:a,duration:m,context:r}=e,u=g(),t=[F[s](j(`[${s.toLowerCase()}]`))];if(u&&t.push(i(`time="${N()}"`)),r){const{email:o,ipAddress:c,subject:l,method:d,pathname:f,statusCode:S,teams:h,apiFunction:R}=r;R&&t.push(p(`fn="${R}"`)),S&&t.push(y(S)),e.level===n.HTTP&&(d&&t.push(i(`method="${d}"`)),f&&t.push(i(`path="${P(f)}"`))),c&&t.push(i(`ip="${c}"`)),o&&t.push(i(`email="${T(o)}"`)),l&&t.push(i(`sub="${E(l)}"`)),h?.length&&t.push(i(`teams="${h.join(", ")}"`))}if(a){const o=u?`msg="${String(A(a)).replaceAll?.('"','\\"')}"`:String(a);t.push(o)}return e.level===n.HTTP&&r?.userAgent&&t.push(i(`agent="${r.userAgent}"`)),m&&t.push(M(m)),t.join(" ")+`
|
|
2
|
+
`},U=({context:e,message:s,...a})=>{const{method:m,pathname:r,statusCode:u,userAgent:t,subject:o,email:c,teams:l,apiFunction:d}=e||{},f={...a,email:c&&T(c),subject:o&&E(o),teams:l,apiFunction:d,...a.level===n.HTTP?{method:m,pathname:String(P(r)),statusCode:u,userAgent:t}:{message:String(A(s))}};return g()&&(f.time=N()),JSON.stringify(f,["time","level","scope","message","duration","method","pathname","statusCode","userAgent","subject","ipAddress","email","apiFunction"])+`
|
|
3
|
+
`},y=e=>(e%500<100?$:e%400<100?C:x)(`status="${e}"`),N=()=>{let e=new Date().getTimezoneOffset()*6e4;return new Date(Date.now()-e).toISOString().slice(0,-1)},M=e=>i(`dur="${Math.round(e)}ms"`);export{n as LogLevel,z as default,L as parseLogLevel,W as shouldLog};
|
|
@@ -12,34 +12,32 @@ export type LoggerContext = {
|
|
|
12
12
|
apiFunction?: string;
|
|
13
13
|
requestHandlerId?: string;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}[];
|
|
20
|
-
prevStickyLines: number;
|
|
15
|
+
type LoggerOptions = {
|
|
16
|
+
context?: LoggerContext;
|
|
17
|
+
forceNonInteractive?: boolean;
|
|
18
|
+
minLogLevel?: LogLevel;
|
|
21
19
|
};
|
|
22
20
|
export declare class Logger {
|
|
23
21
|
#private;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
info(message: string, ...args:
|
|
27
|
-
infoTime(timingId: symbol | string, message: string, ...args:
|
|
22
|
+
constructor({ context, forceNonInteractive, minLogLevel }?: LoggerOptions);
|
|
23
|
+
shouldLog(level: LogLevel): boolean;
|
|
24
|
+
info(message: string, ...args: unknown[]): void;
|
|
25
|
+
infoTime(timingId: symbol | string, message: string, ...args: unknown[]): {
|
|
28
26
|
message: string;
|
|
29
27
|
timeMs: number;
|
|
30
28
|
} | undefined;
|
|
31
|
-
success(message: string, ...args:
|
|
32
|
-
|
|
33
|
-
successTime(timingId: symbol | string, message: string, ...args:
|
|
29
|
+
success(message: string, ...args: unknown[]): void;
|
|
30
|
+
logInFooter(id: string, message: string, ...args: unknown[]): void;
|
|
31
|
+
successTime(timingId: symbol | string, message: string, ...args: unknown[]): {
|
|
34
32
|
message: string;
|
|
35
33
|
timeMs: number;
|
|
36
34
|
} | undefined;
|
|
37
|
-
warn(message: string, ...args:
|
|
38
|
-
warnProd(message: string, ...args:
|
|
39
|
-
error(message: string, ...args:
|
|
40
|
-
contentError(message: string, ...args:
|
|
41
|
-
verbose(message: string, ...args:
|
|
42
|
-
verboseTime(timingId: symbol | string, message: string, ...args:
|
|
35
|
+
warn(message: string, ...args: unknown[]): void;
|
|
36
|
+
warnProd(message: string, ...args: unknown[]): void;
|
|
37
|
+
error(message: string, ...args: unknown[]): void;
|
|
38
|
+
contentError(message: string, ...args: unknown[]): void;
|
|
39
|
+
verbose(message: string, ...args: unknown[]): void;
|
|
40
|
+
verboseTime(timingId: symbol | string, message: string, ...args: unknown[]): {
|
|
43
41
|
message: string;
|
|
44
42
|
timeMs: number;
|
|
45
43
|
} | undefined;
|
|
@@ -50,28 +48,9 @@ export declare class Logger {
|
|
|
50
48
|
startTiming(label?: string): symbol | string;
|
|
51
49
|
updateContext(context: Partial<LoggerContext>): void;
|
|
52
50
|
clearAllTimeouts(): void;
|
|
53
|
-
setStickyState({ globalStickyLines, prevStickyLines, }: {
|
|
54
|
-
globalStickyLines: {
|
|
55
|
-
id: string;
|
|
56
|
-
content: string;
|
|
57
|
-
}[];
|
|
58
|
-
prevStickyLines: number;
|
|
59
|
-
}): void;
|
|
60
|
-
getStickyState(): {
|
|
61
|
-
globalStickyLines: {
|
|
62
|
-
id: string;
|
|
63
|
-
content: string;
|
|
64
|
-
}[];
|
|
65
|
-
prevStickyLines: number;
|
|
66
|
-
};
|
|
67
|
-
printSticky(): void;
|
|
68
|
-
clearSticky(): void;
|
|
69
51
|
isInteractive(): boolean;
|
|
70
|
-
warnForRealFile(message: string, relativePath: string, fs: ContentFs, ...args:
|
|
71
|
-
patchConsole(): void;
|
|
72
|
-
static getLogLevel(method: (typeof monkeyPatchedMethods)[number]): LogLevel;
|
|
52
|
+
warnForRealFile(message: string, relativePath: string, fs: ContentFs, ...args: unknown[]): void;
|
|
73
53
|
}
|
|
74
54
|
export declare const logger: Logger;
|
|
75
|
-
declare const monkeyPatchedMethods: readonly ["log", "warn", "error", "info", "debug", "trace", "dir", "table", "assert"];
|
|
76
55
|
export {};
|
|
77
56
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
`},{id:"sep3",content:`
|
|
4
|
-
`}];class h{#t=[];#s=0;#i;#c;#r=new Map;#o=new Map;disableSticky=!1;constructor(t){this.#i=t,this.#c=u()}info(t,...e){this.#e({level:i.INFO,message:t,args:e})}infoTime(t,e,...s){return this.#n(i.INFO,e,t,...s)}success(t,...e){this.#e({level:i.SUCCESS,message:t,args:e})}logSticky(t,e,...s){const o=this.#t.find(r=>r.id===t),n=l.interpolate(e,...s)+`
|
|
5
|
-
`;if(!this.isInteractive()){this.#e({level:i.INFO,message:e,args:s});return}o?o.content=n:(this.#t.length===0&&this.#t.push(...g),this.#t.push({id:t,content:n}));for(let r=0;r<this.#s;r++)c.moveCursor(process.stderr,0,-1),c.clearLine(process.stderr,1);this.printSticky(),this.#s=this.#t.length}successTime(t,e,...s){return this.#n(i.SUCCESS,e,t,...s)}warn(t,...e){this.#e({level:i.WARN,message:t,args:e})}warnProd(t,...e){this.#c?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#e({level:i.ERROR,message:t,args:e})}contentError(t,...e){this.#e({level:i.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){process.env.REPORTER_VERBOSE==="true"&&this.#e({level:i.VERBOSE,message:t,args:e})}verboseTime(t,e,...s){if(process.env.REPORTER_VERBOSE==="true")return this.#n(i.VERBOSE,e,t,...s)}httpTime(t){return this.#n(i.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const s=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,s),e}updateContext(t){this.#i={...this.#i,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}#n(t,e,s,...o){const n=this.#r.get(s);if(!n)return;const r=Math.round(performance.now()-n);return this.#r.delete(s),this.#e({level:t,message:e,duration:r,args:o}),{message:e,timeMs:r}}setStickyState({globalStickyLines:t,prevStickyLines:e}){this.#t=t,this.#s=e}getStickyState(){return{globalStickyLines:this.#t,prevStickyLines:this.#s}}printSticky(){this.#t.forEach(t=>{process.stderr.write(t.content)})}clearSticky(){if(this.isInteractive())for(let t=0;t<this.#s;t++)c.moveCursor(process.stderr,0,-1),c.clearLine(process.stderr,1)}#e({level:t,message:e,duration:s,scope:o,args:n}){!this.disableSticky&&this.isInteractive()&&this.clearSticky();let r=e&&l.interpolate(e,...n);r&&s!=null&&t!==i.VERBOSE&&m.sendTimingPerformedMessage({timeMs:s,message:r});const a={level:t,message:r,duration:s,scope:o,context:this.#i};process.stderr.write(l.format(a)),!this.disableSticky&&this.isInteractive()&&this.printSticky()}isInteractive(){return!!(process.stderr&&process.stderr.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env)&&f())}async warnForRealFile(t,e,s,...o){await v(e,s)||this.warn(t,e,...o)}patchConsole(){for(const t of y)console[t]=(...e)=>{!this.disableSticky&&this.isInteractive()&&this.clearSticky();const s=[],o=new d({write(a,E,p){s.push(a.toString()),p()}});new console.Console({stdout:o,stderr:o})[t](...e);let r="";t==="table"||t==="dir"?r=`
|
|
6
|
-
${s.join("").slice(0,-1)}`:r=s.join("").slice(0,-1),process.stderr.write(l.format({level:h.getLogLevel(t),context:this.#i,message:r})),!this.disableSticky&&this.isInteractive()&&this.printSticky()}}static getLogLevel(t){switch(t){case"error":return i.ERROR;case"warn":return i.WARN;case"debug":case"trace":return i.VERBOSE;case"info":case"log":case"dir":case"table":case"assert":return i.INFO;default:const e=t;throw new Error(`Unhandled method: ${e}`)}}}const M=new h,y=["log","warn","error","info","debug","trace","dir","table","assert"];export{h as Logger,M as logger};
|
|
1
|
+
import{telemetry as a}from"../../telemetry/index.js";import{isProductionMode as c}from"../../utils/envs/is-production-mode.js";import l,{LogLevel as r,shouldLog as h,parseLogLevel as u}from"./formatter.js";import{isVirtualFile as f}from"../../fs/utils/isVirtualFile.js";import{TerminalManager as p}from"./terminal-manager.js";import{isDevelopMode as g}from"../../utils/envs/is-develop-mode.js";class d{#e;#l;#i;#n;#r=new Map;#o=new Map;constructor({context:t,forceNonInteractive:e,minLogLevel:i}={}){this.#e=t,this.#l=c(),this.#i=new p(e),this.#n=i??u(process.env.REDOCLY_LOG_LEVEL)??(g()?r.INFO:r.HTTP)}shouldLog(t){return h(t,this.#n)}info(t,...e){this.#t({level:r.INFO,message:t,args:e})}infoTime(t,e,...i){return this.#s(r.INFO,e,t,...i)}success(t,...e){this.#t({level:r.SUCCESS,message:t,args:e})}logInFooter(t,e,...i){const o=l.interpolate(e,...i)+`
|
|
2
|
+
`;this.isInteractive()||this.#i.isFooterChanged(t,o)&&this.#t({level:r.INFO,message:e,args:i}),this.#i.updateFooter(t,o)}successTime(t,e,...i){return this.#s(r.SUCCESS,e,t,...i)}warn(t,...e){this.#t({level:r.WARN,message:t,args:e})}warnProd(t,...e){this.#l?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#t({level:r.ERROR,message:t,args:e})}contentError(t,...e){this.#t({level:r.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){this.#t({level:r.VERBOSE,message:t,args:e})}verboseTime(t,e,...i){return this.#s(r.VERBOSE,e,t,...i)}httpTime(t){return this.#s(r.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const i=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,i),e}updateContext(t){this.#e={...this.#e,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}isInteractive(){return this.#i.isInteractive()}warnForRealFile(t,e,i,...o){f(e,i)||this.warn(t,e,...o)}#s(t,e,i,...o){const n=this.#r.get(i);if(!n)return;const s=Math.round(performance.now()-n);return this.#r.delete(i),this.#t({level:t,message:e,duration:s,args:o}),{message:e,timeMs:s}}#t({level:t,message:e,duration:i,scope:o,args:n}){if(!h(t,this.#n))return;let s=e&&l.interpolate(e,...n);s&&i!=null&&t!==r.VERBOSE&&a.sendTimingPerformedMessage({timeMs:i,message:s});const m={level:t,message:s,duration:i,scope:o,context:this.#e};process.stderr.write(l.format(m))}}const O=new d;export{d as Logger,O as logger};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{isBuildMode as h}from"../../utils/envs/is-build-mode.js";import{logger as
|
|
2
|
-
`+r.stack),h()?await this.panic(r,...t):this.pushError(r,"PANIC",...t)}async panicOnBuildContentErrorForRealFile(r,t,
|
|
3
|
-
`+r.stack),h()?await this.panicOnContentError(r,...t):this.pushError(r,"PANIC",...t)}async panic(r,...t){let
|
|
4
|
-
`+r.stack):
|
|
5
|
-
`+r.stack):
|
|
6
|
-
`)
|
|
1
|
+
import{isBuildMode as h}from"../../utils/envs/is-build-mode.js";import{logger as e}from"../../tools/notifiers/logger.js";import P from"./formatter.js";import{blue as g,gray as p,red as a}from"./helpers/colors.js";import{isVirtualFile as b}from"../../fs/utils/isVirtualFile.js";import{telemetry as u}from"../../telemetry/index.js";import{shutdowner as f}from"../shutdowner.js";const c=30;class C{#r=[];#o=[];#e=new Map;#t=[];pushError(r,t,...o){const n=P.interpolate(r,...o);this.#r.push({severity:t,message:n,type:"ERROR"})}reportBrokenLink(r){this.#r.push(r)}reportCompilationError(r){const t=`${r.message}::${r.sourceFileRelativePath}::${r?.sourceFileLocation?.line}`;this.#e.has(t)||this.#e.set(t,r)}reportPageRenderError(r){this.#t.push(r)}async panicOnBuild(r,...t){r instanceof Error&&(r=r.message+`
|
|
2
|
+
`+r.stack),h()?await this.panic(r,...t):this.pushError(r,"PANIC",...t)}async panicOnBuildContentErrorForRealFile(r,t,o,...n){b(t,o)||await this.panicOnBuildContentError(r,...n)}async panicOnBuildContentError(r,...t){r instanceof Error&&(r=r.message+`
|
|
3
|
+
`+r.stack),h()?await this.panicOnContentError(r,...t):this.pushError(r,"PANIC",...t)}async panic(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
|
|
4
|
+
`+r.stack):o=new Error(r),e.error(r,...t),u.sendCliErrorCaughtMessage({message:r}),await f.exitWithCode(1,o)}async panicOnContentError(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
|
|
5
|
+
`+r.stack):o=new Error(r),e.contentError(r,...t),u.sendCliErrorCaughtMessage({message:r,scope:"content"}),await f.exitWithCode(1,o)}reportMarkdocProblem(r){this.#o.push(r)}clearErrors(){this.#r=[]}clearMarkdocProblems(){this.#o=[]}clearEsbuildProblems(){this.#e.clear()}clearPageRenderProblems(){this.#t=[]}getCompilationProblem(r){return this.#e.get(r)}getCompilationProblems(){return[...this.#e.values()]}getPageRenderProblems(){return this.#t}getPageRenderProblem(r){return this.#t.find(t=>t.sourceFileRelativePath===r)}getProblems(){return[...this.#r,...this.getCompilationProblems(),...this.#o,...this.#t]}summary(r,t=0){const o=this.getProblems(),n=this.#o.filter(l=>l.type==="BROKEN_LINK").length,s=this.#r.filter(l=>l.type==="BROKEN_LINK").length,m=this.#o.length-n,E=this.#r.length-s+this.getCompilationProblems().length+this.#t.length;return e.logInFooter("validate",o.length?a(" \u274C Status: %s markdoc errors, %s broken links, %s other errors"):" \u2705 Status: No errors found",m,n+s,E),t!==0&&e.logInFooter("pages",` \u{1F4C4} Total pages: ${t}`),e.logInFooter("timing",r),e.logInFooter("validate-sep",""),e.isInteractive()&&(o.length?e.logInFooter("actions","Press (e) to print all errors, (q) to quit"):e.logInFooter("actions",p("Press (q) to quit"))),o}printErrors(r=[]){const t=this.#r.length,o=r.length?r:this.getProblems();let n=0;for(const s of o.slice(0,c))n>=t?e.contentError(a(`[${++n}] `)+d(s)):e.error(a(`[${++n}] `)+d(s));o.length>c&&e.error(`... and ${o.length-c} more errors`)}listenStdin(){if(!e.isInteractive())return;process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8");const r=this.printErrors.bind(this);process.stdin.on("data",function(t){if(t===""&&process.exit(),t==="\x7F"){process.stdout.write("\b \b");return}if(t==="\r"){process.stdout.write(`
|
|
6
|
+
`);return}if(t==="e"){r();return}t==="q"&&process.exit(0)})}}const B=new C;function d(i){const r=i.sourceFileLocation,t=r?`:${r.line}:${r.character??1}`:"";return i.message+(i.codeframe?`
|
|
7
7
|
|
|
8
|
-
`+
|
|
8
|
+
`+i.codeframe+`
|
|
9
9
|
|
|
10
10
|
`:`
|
|
11
|
-
`)+(
|
|
12
|
-
`:"")}export{
|
|
11
|
+
`)+(i.sourceFileRelativePath?p(`at ${g("./"+i.sourceFileRelativePath)}${t}`)+`
|
|
12
|
+
`:"")}export{C as Reporter,B as reporter};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class TerminalManager {
|
|
2
|
+
#private;
|
|
3
|
+
constructor(forceNonInteractive?: boolean);
|
|
4
|
+
isInteractive(): boolean;
|
|
5
|
+
isFooterChanged(id: string, content: string): boolean;
|
|
6
|
+
updateFooter(id: string, content: string): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=terminal-manager.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{isDevelopMode as h}from"../../utils/envs/is-develop-mode.js";import{gray as p}from"./helpers/colors.js";const t="\x1B[",i=`${t}s`,o=`${t}u`,d=`${t}J`,a=c=>`${t}1;${c}r`,f=`${t}r`,w=`${t}?25h`,R=`${t}?25l`,l=()=>`${p("\u2500".repeat(process.stderr.columns||80))}
|
|
2
|
+
|
|
3
|
+
`,u=3;class I{#s=new Map;#r=process.stderr.rows;#e=0;#t=!1;#i=!1;constructor(s=!1){this.#i=s}isInteractive(){return!!(!this.#i&&process.stderr&&process.stderr.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env)&&h())}isFooterChanged(s,r){return this.#s.get(s)!==r}updateFooter(s,r){const e=!this.#s.has(s);this.#s.set(s,r),this.isInteractive()&&(e?this.#n():this.#c())}get#o(){if(this.#s.size===0)return 0;let s=u;for(const r of this.#s.values())s+=(r.match(/\n/g)||[]).length;return s}#c(){if(!this.isInteractive()||this.#s.size===0)return;this.#h();const s=this.#o,r=process.stderr.rows;if(!(s>r)){process.stderr.write(i),process.stderr.cursorTo(0,r-s+1),process.stderr.write(l());for(const e of this.#s.values())process.stderr.write(e);process.stderr.write(o)}}#n(s=0){if(!this.isInteractive())return;const r=process.stderr.rows;let e=this.#o;e>r&&(e=0);const n=e-this.#e;this.#e=e,n>0&&(process.stderr.write(i),process.stderr.write(`
|
|
4
|
+
`.repeat(n)),process.stderr.write(o)),process.stderr.write(i),process.stderr.write(d),s<0&&process.stderr.write(`
|
|
5
|
+
`.repeat(e)),process.stderr.write(a(r-e)),process.stderr.write(o),this.#c()}#h(){this.#t||(this.#t=!0,process.stderr.write(R),process.on("exit",this.#p),process.stderr.on("resize",this.#d))}#p=()=>{this.isInteractive()&&(process.stderr.write(f),process.stderr.write(`${t}${process.stderr.rows};1H`),process.stderr.write(w))};#d=()=>{const s=process.stderr.rows-this.#r;this.#r=process.stderr.rows,this.#n(s)}}export{I as TerminalManager};
|
|
@@ -4,9 +4,8 @@ import type { MarkdocError } from '../../types/index.js';
|
|
|
4
4
|
export type FileInfo = {
|
|
5
5
|
relativePath: string;
|
|
6
6
|
realRelativePath: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
hash?: string;
|
|
7
|
+
isVirtual: boolean;
|
|
8
|
+
hash: string | undefined;
|
|
10
9
|
};
|
|
11
10
|
/**
|
|
12
11
|
* Information about fs acccess operations.
|
|
@@ -20,21 +19,17 @@ export type FileInfo = {
|
|
|
20
19
|
*/
|
|
21
20
|
export type AccessRecord = {
|
|
22
21
|
type: 'load';
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
loaderId: string;
|
|
23
|
+
resource: string;
|
|
25
24
|
hash: string;
|
|
26
25
|
} | {
|
|
27
|
-
type: 'read' | 'exists'
|
|
26
|
+
type: 'read' | 'exists';
|
|
28
27
|
path: string;
|
|
29
28
|
hash: string;
|
|
30
29
|
} | {
|
|
31
30
|
type: 'scan';
|
|
32
|
-
path: string;
|
|
33
31
|
hash: string;
|
|
34
32
|
pattern?: RegExp;
|
|
35
|
-
} | {
|
|
36
|
-
type: 'dependencies';
|
|
37
|
-
hash: string;
|
|
38
33
|
};
|
|
39
34
|
export type LoadResult<T> = {
|
|
40
35
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ApiFunctionsBasicContext } from '../../types';
|
|
2
|
-
import type { LoggerStickyState } from '../../tools/notifiers/logger.js';
|
|
3
2
|
export type ApiRoutesWorkerParams = {
|
|
4
3
|
maxResponseSizeMB?: number;
|
|
5
4
|
slug: string;
|
|
@@ -22,7 +21,6 @@ export type ApiRoutesWorkerParams = {
|
|
|
22
21
|
referrer: string;
|
|
23
22
|
referrerPolicy: ReferrerPolicy;
|
|
24
23
|
};
|
|
25
|
-
loggerStickyState: LoggerStickyState;
|
|
26
24
|
sqldRemoteDatabaseUrl?: string;
|
|
27
25
|
sqldRemoteDatabaseAuthToken?: string;
|
|
28
26
|
};
|
|
@@ -33,6 +31,5 @@ export type ApiRoutesWorkerResponse = {
|
|
|
33
31
|
type: 'Buffer';
|
|
34
32
|
data: number[];
|
|
35
33
|
};
|
|
36
|
-
loggerStickyState: LoggerStickyState;
|
|
37
34
|
};
|
|
38
35
|
//# sourceMappingURL=api-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function d(t){if(typeof t!="string")return!1;const e=new Date(t);return!isNaN(e.getTime())&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)}export{d as isValidIsoDate};
|