@teambit/component 0.0.1081 → 0.0.1083
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/dist/index.d.ts +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/{preview-1687058340034.js → preview-1687231140262.js} +2 -2
- package/dist/ui/use-component-logs.js +20 -1
- package/dist/ui/use-component-logs.js.map +1 -1
- package/dist/ui/use-component.fragments.js +2 -0
- package/dist/ui/use-component.fragments.js.map +1 -1
- package/dist/ui/use-component.model.d.ts +4 -0
- package/dist/ui/use-component.model.js.map +1 -1
- package/package-tar/teambit-component-0.0.1083.tgz +0 -0
- package/package.json +13 -13
- package/ui/use-component-logs.ts +14 -0
- package/ui/use-component.fragments.ts +2 -0
- package/ui/use-component.model.ts +4 -0
- package/package-tar/teambit-component-0.0.1081.tgz +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,6 @@ export { ComponentModel, ComponentModelProps } from './ui/component-model';
|
|
|
30
30
|
export { TopBarNav } from './ui/top-bar-nav';
|
|
31
31
|
export type { ShowFragment, ShowRow, ShowJSONRow } from './show';
|
|
32
32
|
export { default as Config } from './config';
|
|
33
|
-
export { useComponent, useIdFromLocation } from './ui';
|
|
33
|
+
export { useComponent, useIdFromLocation, useComponentLogs, ComponentLogsResult, Filters } from './ui';
|
|
34
34
|
export { ComponentAspect };
|
|
35
35
|
export default ComponentAspect;
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,12 @@ Object.defineProperty(exports, "ComponentID", {
|
|
|
64
64
|
return _componentId().ComponentID;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
+
Object.defineProperty(exports, "ComponentLogsResult", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _ui().ComponentLogsResult;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
67
73
|
Object.defineProperty(exports, "ComponentMap", {
|
|
68
74
|
enumerable: true,
|
|
69
75
|
get: function () {
|
|
@@ -112,6 +118,12 @@ Object.defineProperty(exports, "ConsumePlugin", {
|
|
|
112
118
|
return _menu().ConsumePlugin;
|
|
113
119
|
}
|
|
114
120
|
});
|
|
121
|
+
Object.defineProperty(exports, "Filters", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
return _ui().Filters;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
115
127
|
Object.defineProperty(exports, "InvalidComponent", {
|
|
116
128
|
enumerable: true,
|
|
117
129
|
get: function () {
|
|
@@ -233,6 +245,12 @@ Object.defineProperty(exports, "useComponentHost", {
|
|
|
233
245
|
return _host().useComponentHost;
|
|
234
246
|
}
|
|
235
247
|
});
|
|
248
|
+
Object.defineProperty(exports, "useComponentLogs", {
|
|
249
|
+
enumerable: true,
|
|
250
|
+
get: function () {
|
|
251
|
+
return _ui().useComponentLogs;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
236
254
|
Object.defineProperty(exports, "useIdFromLocation", {
|
|
237
255
|
enumerable: true,
|
|
238
256
|
get: function () {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentAspect"],"sources":["index.ts"],"sourcesContent":["import { ComponentAspect } from './component.aspect';\n\nexport type { GetComponentsOptions } from './get-component-opts';\nexport type { UseComponentType } from './ui/use-component';\nexport { useComponentHost } from './host';\nexport { Component, InvalidComponent } from './component';\nexport { ComponentID } from '@teambit/component-id';\nexport { default as ComponentFS } from './component-fs';\nexport type { default as ComponentConfig } from './config';\nexport type {\n ComponentFactory,\n ResolveAspectsOptions,\n FilterAspectsOptions,\n LoadAspectsOptions,\n} from './component-factory';\nexport type { AspectList } from './aspect-list';\nexport { AspectEntry, AspectData, ResolveComponentIdFunc } from './aspect-entry';\n// TODO: check why it's not working when using the index in snap dir like this:\n// export { Snap, Author } from './snap';\nexport { Snap, SnapProps } from './snap/snap';\nexport type { Author } from './snap/author';\n// TODO: check why it's not working when using the index in tag dir like this:\n// export { Tag } from './tag';\nexport { Tag, TagProps } from './tag/tag';\nexport type { IComponent } from './component-interface';\nexport { State } from './state';\nexport type { Hash } from './hash';\nexport { TagMap } from './tag-map';\nexport { ComponentMap } from './component-map';\nexport type { ComponentMain } from './component.main.runtime';\nexport type { ComponentUI } from './component.ui.runtime';\nexport { Section } from './section';\nexport { ComponentContext, ComponentDescriptorContext, useComponentDescriptor } from './ui/context/component-context';\nexport type { ComponentProviderProps, ComponentDescriptorProviderProps } from './ui/context';\nexport { ComponentProvider, ComponentDescriptorProvider } from './ui/context';\nexport { componentFields, componentIdFields, componentOverviewFields } from './ui';\nexport {\n NavPlugin,\n ConsumePlugin,\n CollapsibleMenuNav,\n MenuNavProps,\n ComponentMenu,\n VersionRelatedDropdowns,\n} from './ui/menu';\nexport { RegisteredComponentRoute, ComponentUrlParams } from './component.route';\nexport { ComponentModel, ComponentModelProps } from './ui/component-model';\nexport { TopBarNav } from './ui/top-bar-nav';\nexport type { ShowFragment, ShowRow, ShowJSONRow } from './show';\nexport { default as Config } from './config';\nexport { useComponent, useIdFromLocation } from './ui';\n\n// export { AspectList } from './aspect-list';\n// export { AspectEntry } from './aspect-entry';\nexport { ComponentAspect };\nexport default ComponentAspect;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentAspect"],"sources":["index.ts"],"sourcesContent":["import { ComponentAspect } from './component.aspect';\n\nexport type { GetComponentsOptions } from './get-component-opts';\nexport type { UseComponentType } from './ui/use-component';\nexport { useComponentHost } from './host';\nexport { Component, InvalidComponent } from './component';\nexport { ComponentID } from '@teambit/component-id';\nexport { default as ComponentFS } from './component-fs';\nexport type { default as ComponentConfig } from './config';\nexport type {\n ComponentFactory,\n ResolveAspectsOptions,\n FilterAspectsOptions,\n LoadAspectsOptions,\n} from './component-factory';\nexport type { AspectList } from './aspect-list';\nexport { AspectEntry, AspectData, ResolveComponentIdFunc } from './aspect-entry';\n// TODO: check why it's not working when using the index in snap dir like this:\n// export { Snap, Author } from './snap';\nexport { Snap, SnapProps } from './snap/snap';\nexport type { Author } from './snap/author';\n// TODO: check why it's not working when using the index in tag dir like this:\n// export { Tag } from './tag';\nexport { Tag, TagProps } from './tag/tag';\nexport type { IComponent } from './component-interface';\nexport { State } from './state';\nexport type { Hash } from './hash';\nexport { TagMap } from './tag-map';\nexport { ComponentMap } from './component-map';\nexport type { ComponentMain } from './component.main.runtime';\nexport type { ComponentUI } from './component.ui.runtime';\nexport { Section } from './section';\nexport { ComponentContext, ComponentDescriptorContext, useComponentDescriptor } from './ui/context/component-context';\nexport type { ComponentProviderProps, ComponentDescriptorProviderProps } from './ui/context';\nexport { ComponentProvider, ComponentDescriptorProvider } from './ui/context';\nexport { componentFields, componentIdFields, componentOverviewFields } from './ui';\nexport {\n NavPlugin,\n ConsumePlugin,\n CollapsibleMenuNav,\n MenuNavProps,\n ComponentMenu,\n VersionRelatedDropdowns,\n} from './ui/menu';\nexport { RegisteredComponentRoute, ComponentUrlParams } from './component.route';\nexport { ComponentModel, ComponentModelProps } from './ui/component-model';\nexport { TopBarNav } from './ui/top-bar-nav';\nexport type { ShowFragment, ShowRow, ShowJSONRow } from './show';\nexport { default as Config } from './config';\nexport { useComponent, useIdFromLocation, useComponentLogs, ComponentLogsResult, Filters } from './ui';\n\n// export { AspectList } from './aspect-list';\n// export { AspectEntry } from './aspect-entry';\nexport { ComponentAspect };\nexport default ComponentAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AASA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AA/BA;AACA;AAGA;AACA;AA6BA;AACA;AAAA,eAEeA,4BAAe;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.1083/dist/component.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.1083/dist/component.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -6,6 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useComponentLogs = useComponentLogs;
|
|
8
8
|
exports.useComponentLogsInit = useComponentLogsInit;
|
|
9
|
+
function _react() {
|
|
10
|
+
const data = require("react");
|
|
11
|
+
_react = function () {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
9
16
|
function _uiFoundationUiHooks() {
|
|
10
17
|
const data = require("@teambit/ui-foundation.ui.hooks.use-data-query");
|
|
11
18
|
_uiFoundationUiHooks = function () {
|
|
@@ -34,8 +41,15 @@ function _useComponent2() {
|
|
|
34
41
|
};
|
|
35
42
|
return data;
|
|
36
43
|
}
|
|
44
|
+
function _() {
|
|
45
|
+
const data = require("..");
|
|
46
|
+
_ = function () {
|
|
47
|
+
return data;
|
|
48
|
+
};
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
37
51
|
function useComponentLogs(componentId, host, filters, skipFromProps) {
|
|
38
|
-
var _data$getHost;
|
|
52
|
+
var _data$getHost, _rawComponent$id, _rawComponent$id2, _rawComponent$id3;
|
|
39
53
|
const {
|
|
40
54
|
variables,
|
|
41
55
|
skip
|
|
@@ -52,8 +66,13 @@ function useComponentLogs(componentId, host, filters, skipFromProps) {
|
|
|
52
66
|
const rawComponent = data === null || data === void 0 ? void 0 : (_data$getHost = data.getHost) === null || _data$getHost === void 0 ? void 0 : _data$getHost.get;
|
|
53
67
|
const rawCompLogs = rawComponent === null || rawComponent === void 0 ? void 0 : rawComponent.logs;
|
|
54
68
|
const componentError = error && !data ? new (_componentError().ComponentError)(500, error.message) : !rawComponent && !loading && new (_componentError().ComponentError)(404) || undefined;
|
|
69
|
+
const idDepKey = rawComponent !== null && rawComponent !== void 0 && rawComponent.id ? `${rawComponent === null || rawComponent === void 0 ? void 0 : (_rawComponent$id = rawComponent.id) === null || _rawComponent$id === void 0 ? void 0 : _rawComponent$id.scope}/${rawComponent === null || rawComponent === void 0 ? void 0 : (_rawComponent$id2 = rawComponent.id) === null || _rawComponent$id2 === void 0 ? void 0 : _rawComponent$id2.name}@${rawComponent === null || rawComponent === void 0 ? void 0 : (_rawComponent$id3 = rawComponent.id) === null || _rawComponent$id3 === void 0 ? void 0 : _rawComponent$id3.version}}` : undefined;
|
|
70
|
+
const id = (0, _react().useMemo)(() => rawComponent ? _().ComponentID.fromObject(rawComponent.id) : undefined, [idDepKey]);
|
|
55
71
|
return {
|
|
56
72
|
loading,
|
|
73
|
+
id,
|
|
74
|
+
packageName: rawComponent === null || rawComponent === void 0 ? void 0 : rawComponent.packageName,
|
|
75
|
+
latest: rawComponent === null || rawComponent === void 0 ? void 0 : rawComponent.latest,
|
|
57
76
|
error: componentError,
|
|
58
77
|
componentLogs: {
|
|
59
78
|
logs: rawCompLogs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useComponentLogs","componentId","host","filters","skipFromProps","variables","skip","useComponentLogsInit","data","error","loading","useDataQuery","GET_COMPONENT_WITH_LOGS","errorPolicy","rawComponent","getHost","get","rawCompLogs","logs","componentError","ComponentError","message","undefined","componentLogs","log","head","logHead","offset","logOffset","sort","logSort","limit","logLimit","type","logType","takeHeadFromComponent","logTakeHeadFromComponent","
|
|
1
|
+
{"version":3,"names":["useComponentLogs","componentId","host","filters","skipFromProps","variables","skip","useComponentLogsInit","data","error","loading","useDataQuery","GET_COMPONENT_WITH_LOGS","errorPolicy","rawComponent","getHost","get","rawCompLogs","logs","componentError","ComponentError","message","undefined","idDepKey","id","scope","name","version","useMemo","ComponentID","fromObject","packageName","latest","componentLogs","log","head","logHead","offset","logOffset","sort","logSort","limit","logLimit","type","logType","takeHeadFromComponent","logTakeHeadFromComponent","extensionId","getOffsetValue"],"sources":["use-component-logs.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentLogsResult, Filters } from './use-component.model';\nimport { GET_COMPONENT_WITH_LOGS } from './use-component.fragments';\nimport { ComponentError } from './component-error';\nimport { getOffsetValue } from './use-component.utils';\nimport { ComponentID } from '..';\n\nexport function useComponentLogs(\n componentId: string,\n host: string,\n filters?: Filters,\n skipFromProps?: boolean\n): ComponentLogsResult {\n const { variables, skip } = useComponentLogsInit(componentId, host, filters, skipFromProps);\n\n const { data, error, loading } = useDataQuery(GET_COMPONENT_WITH_LOGS, {\n variables,\n skip,\n errorPolicy: 'all',\n });\n\n const rawComponent = data?.getHost?.get;\n const rawCompLogs: Array<LegacyComponentLog> = rawComponent?.logs;\n\n const componentError =\n error && !data\n ? new ComponentError(500, error.message)\n : (!rawComponent && !loading && new ComponentError(404)) || undefined;\n\n const idDepKey = rawComponent?.id\n ? `${rawComponent?.id?.scope}/${rawComponent?.id?.name}@${rawComponent?.id?.version}}`\n : undefined;\n\n const id: ComponentID | undefined = useMemo(\n () => (rawComponent ? ComponentID.fromObject(rawComponent.id) : undefined),\n [idDepKey]\n );\n\n return {\n loading,\n id,\n packageName: rawComponent?.packageName,\n latest: rawComponent?.latest,\n error: componentError,\n componentLogs: {\n logs: rawCompLogs,\n loading,\n },\n };\n}\n\nexport function useComponentLogsInit(componentId: string, host: string, filters?: Filters, skip?: boolean) {\n const { log } = filters || {};\n const {\n head: logHead,\n offset: logOffset,\n sort: logSort,\n limit: logLimit,\n type: logType,\n takeHeadFromComponent: logTakeHeadFromComponent,\n } = log || {};\n const variables = {\n id: componentId,\n extensionId: host,\n logOffset: getOffsetValue(logOffset, logLimit),\n logLimit,\n logType,\n logHead,\n logSort,\n logTakeHeadFromComponent,\n };\n return {\n logOffset,\n variables,\n skip,\n };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dFields","gql","componentOverviewFields","componentFields","componentFieldsWithLogs","COMPONENT_QUERY_LOG_FIELDS","GET_COMPONENT","GET_COMPONENT_WITH_LOGS","SUB_SUBSCRIPTION_ADDED","SUB_COMPONENT_CHANGED","SUB_COMPONENT_REMOVED"],"sources":["use-component.fragments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const componentIdFields = gql`\n fragment componentIdFields on ComponentID {\n name\n version\n scope\n }\n`;\n\nexport const componentOverviewFields = gql`\n fragment componentOverviewFields on Component {\n id {\n ...componentIdFields\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n id\n data\n }\n elementsUrl\n description\n deprecation {\n isDeprecate\n newId\n }\n labels\n displayName\n server {\n env\n url\n host\n basePath\n }\n buildStatus\n env {\n id\n icon\n }\n size {\n compressedTotal\n }\n preview {\n includesEnvTemplate\n legacyHeader\n isScaling\n skipIncludes\n }\n compositions {\n identifier\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const componentFields = gql`\n fragment componentFields on Component {\n ...componentOverviewFields\n packageName\n latest\n compositions {\n identifier\n displayName\n }\n tags {\n version\n }\n }\n ${componentOverviewFields}\n`;\n\nexport const componentFieldsWithLogs = gql`\n fragment componentFieldWithLogs on Component {\n id {\n ...componentIdFields\n }\n logs(\n type: $logType\n offset: $logOffset\n limit: $logLimit\n sort: $logSort\n head: $logHead\n takeHeadFromComponent: $logTakeHeadFromComponent\n ) {\n id\n message\n username\n email\n date\n hash\n tag\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const COMPONENT_QUERY_LOG_FIELDS = `\n $logOffset: Int\n $logLimit: Int\n $logType: String\n $logHead: String\n $logSort: String\n $logTakeHeadFromComponent: Boolean\n`;\n\nexport const GET_COMPONENT = gql`\n query Component($extensionId: String!, $id: String!) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nexport const GET_COMPONENT_WITH_LOGS = gql`\n query Component(\n $extensionId: String!\n $id: String!\n ${COMPONENT_QUERY_LOG_FIELDS}\n ) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFieldWithLogs\n }\n }\n }\n ${componentFieldsWithLogs}\n`;\n\nexport const SUB_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded {\n componentAdded {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nexport const SUB_COMPONENT_CHANGED = gql`\n subscription OnComponentChanged {\n componentChanged {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nexport const SUB_COMPONENT_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n ...componentIdFields\n }\n }\n }\n ${componentIdFields}\n`;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,iBAAiB,GAAG,IAAAC,aAAG,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA,CAAC;AAAC;AAEK,MAAMC,uBAAuB,GAAG,IAAAD,aAAG,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAAC;AAEK,MAAMG,eAAe,GAAG,IAAAF,aAAG,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,uBAAwB;AAC5B,CAAC;AAAC;AAEK,MAAME,uBAAuB,GAAG,IAAAH,aAAG,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAAC;AAEK,MAAMK,0BAA0B,GAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAC;AAEK,MAAMC,aAAa,GAAG,IAAAL,aAAG,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAAC;AAEK,MAAMI,uBAAuB,GAAG,IAAAN,aAAG,CAAC;AAC3C;AACA;AACA;AACA,MAAMI,0BAA2B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,uBAAwB;AAC5B,CAAC;AAAC;AAEK,MAAMI,sBAAsB,GAAG,IAAAP,aAAG,CAAC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAAC;AAEK,MAAMM,qBAAqB,GAAG,IAAAR,aAAG,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAAC;AAEK,MAAMO,qBAAqB,GAAG,IAAAT,aAAG,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAAC"}
|
|
1
|
+
{"version":3,"names":["componentIdFields","gql","componentOverviewFields","componentFields","componentFieldsWithLogs","COMPONENT_QUERY_LOG_FIELDS","GET_COMPONENT","GET_COMPONENT_WITH_LOGS","SUB_SUBSCRIPTION_ADDED","SUB_COMPONENT_CHANGED","SUB_COMPONENT_REMOVED"],"sources":["use-component.fragments.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const componentIdFields = gql`\n fragment componentIdFields on ComponentID {\n name\n version\n scope\n }\n`;\n\nexport const componentOverviewFields = gql`\n fragment componentOverviewFields on Component {\n id {\n ...componentIdFields\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n id\n data\n }\n elementsUrl\n description\n deprecation {\n isDeprecate\n newId\n }\n labels\n displayName\n server {\n env\n url\n host\n basePath\n }\n buildStatus\n env {\n id\n icon\n }\n size {\n compressedTotal\n }\n preview {\n includesEnvTemplate\n legacyHeader\n isScaling\n skipIncludes\n }\n compositions {\n identifier\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const componentFields = gql`\n fragment componentFields on Component {\n ...componentOverviewFields\n packageName\n latest\n compositions {\n identifier\n displayName\n }\n tags {\n version\n }\n }\n ${componentOverviewFields}\n`;\n\nexport const componentFieldsWithLogs = gql`\n fragment componentFieldWithLogs on Component {\n id {\n ...componentIdFields\n }\n packageName\n latest\n logs(\n type: $logType\n offset: $logOffset\n limit: $logLimit\n sort: $logSort\n head: $logHead\n takeHeadFromComponent: $logTakeHeadFromComponent\n ) {\n id\n message\n username\n email\n date\n hash\n tag\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const COMPONENT_QUERY_LOG_FIELDS = `\n $logOffset: Int\n $logLimit: Int\n $logType: String\n $logHead: String\n $logSort: String\n $logTakeHeadFromComponent: Boolean\n`;\n\nexport const GET_COMPONENT = gql`\n query Component($extensionId: String!, $id: String!) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nexport const GET_COMPONENT_WITH_LOGS = gql`\n query Component(\n $extensionId: String!\n $id: String!\n ${COMPONENT_QUERY_LOG_FIELDS}\n ) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFieldWithLogs\n }\n }\n }\n ${componentFieldsWithLogs}\n`;\n\nexport const SUB_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded {\n componentAdded {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nexport const SUB_COMPONENT_CHANGED = gql`\n subscription OnComponentChanged {\n componentChanged {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nexport const SUB_COMPONENT_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n ...componentIdFields\n }\n }\n }\n ${componentIdFields}\n`;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,iBAAiB,GAAG,IAAAC,aAAG,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA,CAAC;AAAC;AAEK,MAAMC,uBAAuB,GAAG,IAAAD,aAAG,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAAC;AAEK,MAAMG,eAAe,GAAG,IAAAF,aAAG,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,uBAAwB;AAC5B,CAAC;AAAC;AAEK,MAAME,uBAAuB,GAAG,IAAAH,aAAG,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAAC;AAEK,MAAMK,0BAA0B,GAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAC;AAEK,MAAMC,aAAa,GAAG,IAAAL,aAAG,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAAC;AAEK,MAAMI,uBAAuB,GAAG,IAAAN,aAAG,CAAC;AAC3C;AACA;AACA;AACA,MAAMI,0BAA2B;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,uBAAwB;AAC5B,CAAC;AAAC;AAEK,MAAMI,sBAAsB,GAAG,IAAAP,aAAG,CAAC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAAC;AAEK,MAAMM,qBAAqB,GAAG,IAAAR,aAAG,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAAC;AAEK,MAAMO,qBAAqB,GAAG,IAAAT,aAAG,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
2
2
|
import { LegacyComponentLog } from '@teambit/legacy-component-log';
|
|
3
|
+
import { ComponentID } from '../';
|
|
3
4
|
import { ComponentError } from './component-error';
|
|
4
5
|
import { ComponentModel } from './component-model';
|
|
5
6
|
export declare type LogFilter = {
|
|
@@ -29,7 +30,10 @@ export declare type ComponentQueryResult = {
|
|
|
29
30
|
error?: ComponentError;
|
|
30
31
|
};
|
|
31
32
|
export declare type ComponentLogsResult = {
|
|
33
|
+
id?: ComponentID;
|
|
32
34
|
componentLogs?: ComponentLogs;
|
|
35
|
+
latest?: string;
|
|
36
|
+
packageName?: string;
|
|
33
37
|
error?: ComponentError;
|
|
34
38
|
loading?: boolean;
|
|
35
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["use-component.model.ts"],"sourcesContent":["import { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { ComponentError } from './component-error';\nimport { ComponentModel } from './component-model';\n\nexport type LogFilter = {\n offset?: number;\n limit?: number;\n head?: string;\n sort?: string;\n takeHeadFromComponent?: boolean;\n};\n\nexport type Filters = {\n log?: LogFilter & { type?: string };\n loading?: boolean;\n};\n\nexport type UseComponentOptions = {\n version?: string;\n logFilters?: Filters;\n customUseComponent?: UseComponentType;\n skip?: boolean;\n};\n\nexport type ComponentQueryResult = {\n component?: ComponentModel;\n componentDescriptor?: ComponentDescriptor;\n componentLogs?: ComponentLogs;\n loading?: boolean;\n error?: ComponentError;\n};\n\nexport type ComponentLogsResult = {\n componentLogs?: ComponentLogs;\n error?: ComponentError;\n loading?: boolean;\n};\n\nexport type ComponentLogs = {\n logs?: LegacyComponentLog[];\n loading?: boolean;\n};\n\nexport type UseComponentType = (id: string, host: string, filters?: Filters, skip?: boolean) => ComponentQueryResult;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["use-component.model.ts"],"sourcesContent":["import { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { ComponentID } from '../';\nimport { ComponentError } from './component-error';\nimport { ComponentModel } from './component-model';\n\nexport type LogFilter = {\n offset?: number;\n limit?: number;\n head?: string;\n sort?: string;\n takeHeadFromComponent?: boolean;\n};\n\nexport type Filters = {\n log?: LogFilter & { type?: string };\n loading?: boolean;\n};\n\nexport type UseComponentOptions = {\n version?: string;\n logFilters?: Filters;\n customUseComponent?: UseComponentType;\n skip?: boolean;\n};\n\nexport type ComponentQueryResult = {\n component?: ComponentModel;\n componentDescriptor?: ComponentDescriptor;\n componentLogs?: ComponentLogs;\n loading?: boolean;\n error?: ComponentError;\n};\n\nexport type ComponentLogsResult = {\n id?: ComponentID;\n componentLogs?: ComponentLogs;\n latest?: string;\n packageName?: string;\n error?: ComponentError;\n loading?: boolean;\n};\n\nexport type ComponentLogs = {\n logs?: LegacyComponentLog[];\n loading?: boolean;\n};\n\nexport type UseComponentType = (id: string, host: string, filters?: Filters, skip?: boolean) => ComponentQueryResult;\n"],"mappings":""}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1083",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.1083"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/any-fs": "0.0.5",
|
|
@@ -36,25 +36,25 @@
|
|
|
36
36
|
"@teambit/design.navigation.responsive-navbar": "0.0.5",
|
|
37
37
|
"@teambit/base-ui.layout.breakpoints": "1.0.0",
|
|
38
38
|
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.497",
|
|
39
|
-
"@teambit/aspect-loader": "0.0.
|
|
40
|
-
"@teambit/graph": "0.0.
|
|
39
|
+
"@teambit/aspect-loader": "0.0.1083",
|
|
40
|
+
"@teambit/graph": "0.0.1083",
|
|
41
41
|
"@teambit/toolbox.path.match-patterns": "0.0.9",
|
|
42
42
|
"@teambit/toolbox.string.capitalize": "0.0.490",
|
|
43
43
|
"@teambit/cli": "0.0.727",
|
|
44
44
|
"@teambit/express": "0.0.825",
|
|
45
|
-
"@teambit/graphql": "0.0.
|
|
45
|
+
"@teambit/graphql": "0.0.1083",
|
|
46
46
|
"@teambit/bit-error": "0.0.402",
|
|
47
|
-
"@teambit/command-bar": "0.0.
|
|
47
|
+
"@teambit/command-bar": "0.0.1083",
|
|
48
48
|
"@teambit/component-package-version": "0.0.422",
|
|
49
49
|
"@teambit/component.ui.deprecation-icon": "0.0.504",
|
|
50
|
-
"@teambit/preview": "0.0.
|
|
51
|
-
"@teambit/pubsub": "0.0.
|
|
52
|
-
"@teambit/react-router": "0.0.
|
|
50
|
+
"@teambit/preview": "0.0.1083",
|
|
51
|
+
"@teambit/pubsub": "0.0.1083",
|
|
52
|
+
"@teambit/react-router": "0.0.1083",
|
|
53
53
|
"@teambit/ui-foundation.ui.is-browser": "0.0.495",
|
|
54
54
|
"@teambit/ui-foundation.ui.main-dropdown": "0.0.497",
|
|
55
55
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
|
|
56
56
|
"@teambit/ui-foundation.ui.use-box.menu": "0.0.135",
|
|
57
|
-
"@teambit/ui": "0.0.
|
|
57
|
+
"@teambit/ui": "0.0.1083",
|
|
58
58
|
"@teambit/component-issues": "0.0.92",
|
|
59
59
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.500",
|
|
60
60
|
"@teambit/cli-table": "0.0.41",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"@teambit/component-descriptor": "0.0.296",
|
|
63
63
|
"@teambit/ui-foundation.ui.react-router.use-query": "0.0.496",
|
|
64
64
|
"@teambit/harmony.ui.aspect-box": "0.0.497",
|
|
65
|
-
"@teambit/compositions": "0.0.
|
|
66
|
-
"@teambit/deprecation": "0.0.
|
|
67
|
-
"@teambit/envs": "0.0.
|
|
65
|
+
"@teambit/compositions": "0.0.1083",
|
|
66
|
+
"@teambit/deprecation": "0.0.1083",
|
|
67
|
+
"@teambit/envs": "0.0.1083",
|
|
68
68
|
"@teambit/envs.ui.env-icon": "0.0.495",
|
|
69
69
|
"@teambit/component.ui.version-dropdown": "0.0.786",
|
|
70
70
|
"@teambit/lanes.hooks.use-lanes": "0.0.191",
|
package/ui/use-component-logs.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
1
2
|
import { LegacyComponentLog } from '@teambit/legacy-component-log';
|
|
2
3
|
import { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
|
3
4
|
import { ComponentLogsResult, Filters } from './use-component.model';
|
|
4
5
|
import { GET_COMPONENT_WITH_LOGS } from './use-component.fragments';
|
|
5
6
|
import { ComponentError } from './component-error';
|
|
6
7
|
import { getOffsetValue } from './use-component.utils';
|
|
8
|
+
import { ComponentID } from '..';
|
|
7
9
|
|
|
8
10
|
export function useComponentLogs(
|
|
9
11
|
componentId: string,
|
|
@@ -27,8 +29,20 @@ export function useComponentLogs(
|
|
|
27
29
|
? new ComponentError(500, error.message)
|
|
28
30
|
: (!rawComponent && !loading && new ComponentError(404)) || undefined;
|
|
29
31
|
|
|
32
|
+
const idDepKey = rawComponent?.id
|
|
33
|
+
? `${rawComponent?.id?.scope}/${rawComponent?.id?.name}@${rawComponent?.id?.version}}`
|
|
34
|
+
: undefined;
|
|
35
|
+
|
|
36
|
+
const id: ComponentID | undefined = useMemo(
|
|
37
|
+
() => (rawComponent ? ComponentID.fromObject(rawComponent.id) : undefined),
|
|
38
|
+
[idDepKey]
|
|
39
|
+
);
|
|
40
|
+
|
|
30
41
|
return {
|
|
31
42
|
loading,
|
|
43
|
+
id,
|
|
44
|
+
packageName: rawComponent?.packageName,
|
|
45
|
+
latest: rawComponent?.latest,
|
|
32
46
|
error: componentError,
|
|
33
47
|
componentLogs: {
|
|
34
48
|
logs: rawCompLogs,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
2
2
|
import { LegacyComponentLog } from '@teambit/legacy-component-log';
|
|
3
|
+
import { ComponentID } from '../';
|
|
3
4
|
import { ComponentError } from './component-error';
|
|
4
5
|
import { ComponentModel } from './component-model';
|
|
5
6
|
|
|
@@ -32,7 +33,10 @@ export type ComponentQueryResult = {
|
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
export type ComponentLogsResult = {
|
|
36
|
+
id?: ComponentID;
|
|
35
37
|
componentLogs?: ComponentLogs;
|
|
38
|
+
latest?: string;
|
|
39
|
+
packageName?: string;
|
|
36
40
|
error?: ComponentError;
|
|
37
41
|
loading?: boolean;
|
|
38
42
|
};
|
|
Binary file
|