@teambit/code.ui.queries.get-file-content 0.0.487 → 0.0.490

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.
@@ -12,22 +12,22 @@ declare type FileResult = {
12
12
  };
13
13
  };
14
14
  };
15
- export declare function useFileContent(componentId: ComponentID, filePath?: string): {
15
+ export declare function useFileContent(componentId?: ComponentID, filePath?: string): {
16
16
  client: import("@apollo/client").ApolloClient<any>;
17
17
  previousData?: FileResult;
18
18
  error?: import("@apollo/client").ApolloError;
19
19
  loading: boolean;
20
20
  networkStatus: import("@apollo/client").NetworkStatus;
21
21
  called: true;
22
+ variables: import("@apollo/client").OperationVariables;
22
23
  startPolling: (pollInterval: number) => void;
23
24
  stopPolling: () => void;
24
25
  subscribeToMore: <TSubscriptionData = FileResult, TSubscriptionVariables = import("@apollo/client").OperationVariables>(options: import("@apollo/client").SubscribeToMoreOptions<FileResult, TSubscriptionVariables, TSubscriptionData>) => () => void;
25
26
  updateQuery: <TVars = import("@apollo/client").OperationVariables>(mapFn: (previousQueryResult: FileResult, options: Pick<import("@apollo/client").WatchQueryOptions<TVars, FileResult>, "variables">) => FileResult) => void;
26
27
  refetch: (variables?: Partial<import("@apollo/client").OperationVariables>) => Promise<import("@apollo/client").ApolloQueryResult<FileResult>>;
27
- variables: import("@apollo/client").OperationVariables;
28
- fetchMore: (<K extends string>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<import("@apollo/client").OperationVariables, K, FileResult> & import("@apollo/client").FetchMoreOptions<FileResult, import("@apollo/client").OperationVariables>) => Promise<import("@apollo/client").ApolloQueryResult<FileResult>>) & (<TData2, TVariables2, K_1 extends keyof TVariables2>(fetchMoreOptions: {
28
+ fetchMore: ((fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<import("@apollo/client").OperationVariables, FileResult> & import("@apollo/client").FetchMoreOptions<FileResult, import("@apollo/client").OperationVariables>) => Promise<import("@apollo/client").ApolloQueryResult<FileResult>>) & (<TData2, TVariables2>(fetchMoreOptions: {
29
29
  query?: import("@apollo/client").DocumentNode | import("@graphql-typed-document-node/core").TypedDocumentNode<FileResult, import("@apollo/client").OperationVariables>;
30
- } & import("@apollo/client").FetchMoreQueryOptions<TVariables2, K_1, FileResult> & import("@apollo/client").FetchMoreOptions<TData2, TVariables2>) => Promise<import("@apollo/client").ApolloQueryResult<TData2>>);
30
+ } & import("@apollo/client").FetchMoreQueryOptions<TVariables2, FileResult> & import("@apollo/client").FetchMoreOptions<TData2, TVariables2>) => Promise<import("@apollo/client").ApolloQueryResult<TData2>>);
31
31
  fileContent: string;
32
32
  };
33
33
  export {};
@@ -32,10 +32,10 @@ const getFile = (0, client_1.gql) `
32
32
  `;
33
33
  function useFileContent(componentId, filePath) {
34
34
  var _a;
35
- const id = componentId.toString();
35
+ const id = componentId === null || componentId === void 0 ? void 0 : componentId.toString();
36
36
  const _b = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(getFile, {
37
37
  variables: { id, path: filePath },
38
- skip: filePath === undefined,
38
+ skip: !componentId || filePath === undefined,
39
39
  }), { data } = _b, rest = __rest(_b, ["data"]);
40
40
  const fileContent = (_a = data === null || data === void 0 ? void 0 : data.getHost) === null || _a === void 0 ? void 0 : _a.get.getFile;
41
41
  return Object.assign({ fileContent }, rest);
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAqC;AACrC,0GAA8E;AAG9E,MAAM,OAAO,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;CAelB,CAAC;AAgBF,SAAgB,cAAc,CAAC,WAAwB,EAAE,QAAiB;;IACxE,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,KAAoB,IAAA,oDAAY,EAAa,OAAO,EAAE;QAC1D,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,IAAI,EAAE,QAAQ,KAAK,SAAS;KAC7B,CAAC,EAHI,EAAE,IAAI,OAGV,EAHe,IAAI,cAAf,QAAiB,CAGrB,CAAC;IAEH,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,GAAG,CAAC,OAAO,CAAC;IAE/C,uBAAS,WAAW,IAAK,IAAI,EAAG;AAClC,CAAC;AAVD,wCAUC"}
1
+ {"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAqC;AACrC,0GAA8E;AAG9E,MAAM,OAAO,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;CAelB,CAAC;AAgBF,SAAgB,cAAc,CAAC,WAAyB,EAAE,QAAiB;;IACzE,MAAM,EAAE,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,EAAE,CAAC;IACnC,MAAM,KAAoB,IAAA,oDAAY,EAAa,OAAO,EAAE;QAC1D,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,IAAI,EAAE,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS;KAC7C,CAAC,EAHI,EAAE,IAAI,OAGV,EAHe,IAAI,cAAf,QAAiB,CAGrB,CAAC;IAEH,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,GAAG,CAAC,OAAO,CAAC;IAE/C,uBAAS,WAAW,IAAK,IAAI,EAAG;AAClC,CAAC;AAVD,wCAUC"}
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "es2019",
5
+ "DOM",
6
+ "ES6",
7
+ "DOM.Iterable"
8
+ ],
9
+ "target": "es2015",
10
+ "module": "CommonJS",
11
+ "jsx": "react",
12
+ "allowJs": true,
13
+ "composite": true,
14
+ "declaration": true,
15
+ "sourceMap": true,
16
+ "skipLibCheck": true,
17
+ "experimentalDecorators": true,
18
+ "outDir": "dist",
19
+ "moduleResolution": "node",
20
+ "esModuleInterop": true,
21
+ "rootDir": ".",
22
+ "resolveJsonModule": true
23
+ },
24
+ "exclude": [
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
31
+ ]
32
+ }
@@ -33,11 +33,11 @@ type FileResult = {
33
33
  };
34
34
  };
35
35
 
36
- export function useFileContent(componentId: ComponentID, filePath?: string) {
37
- const id = componentId.toString();
36
+ export function useFileContent(componentId?: ComponentID, filePath?: string) {
37
+ const id = componentId?.toString();
38
38
  const { data, ...rest } = useDataQuery<FileResult>(getFile, {
39
39
  variables: { id, path: filePath },
40
- skip: filePath === undefined,
40
+ skip: !componentId || filePath === undefined,
41
41
  });
42
42
 
43
43
  const fileContent = data?.getHost?.get.getFile;
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@teambit/code.ui.queries.get-file-content",
3
- "version": "0.0.487",
3
+ "version": "0.0.490",
4
4
  "homepage": "https://bit.dev/teambit/code/ui/queries/get-file-content",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.code",
8
8
  "name": "ui/queries/get-file-content",
9
- "version": "0.0.487"
9
+ "version": "0.0.490"
10
10
  },
11
11
  "dependencies": {
12
12
  "core-js": "^3.0.0",
13
- "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.487"
13
+ "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.489"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@types/mocha": "9.1.0",
@@ -22,39 +22,11 @@
22
22
  "@types/node": "12.20.4"
23
23
  },
24
24
  "peerDependencies": {
25
- "@apollo/client": "^3.0.0",
25
+ "@apollo/client": "^3.4.0",
26
26
  "react-dom": "^16.8.0 || ^17.0.0",
27
27
  "react": "^16.8.0 || ^17.0.0"
28
28
  },
29
29
  "license": "Apache-2.0",
30
- "bit": {
31
- "bindingPrefix": "@teambit",
32
- "env": {},
33
- "overrides": {
34
- "dependencies": {
35
- "@teambit/legacy": "-",
36
- "core-js": "^3.0.0",
37
- "react-dom": "-",
38
- "react": "-"
39
- },
40
- "devDependencies": {
41
- "@teambit/legacy": "-",
42
- "@types/mocha": "9.1.0",
43
- "@types/testing-library__jest-dom": "5.9.5",
44
- "@babel/runtime": "7.12.18",
45
- "@types/jest": "^26.0.0",
46
- "@types/react-dom": "^17.0.5",
47
- "@types/react": "^17.0.8",
48
- "@types/node": "12.20.4",
49
- "react-dom": "-",
50
- "react": "-"
51
- },
52
- "peerDependencies": {
53
- "react-dom": "^16.8.0 || ^17.0.0",
54
- "react": "^16.8.0 || ^17.0.0"
55
- }
56
- }
57
- },
58
30
  "private": false,
59
31
  "engines": {
60
32
  "node": ">=12.22.0"
@@ -0,0 +1,5 @@
1
+ ;
2
+ ;
3
+
4
+ export const compositions = [];
5
+ export const overview = [];
package/tsconfig.json CHANGED
@@ -7,13 +7,14 @@
7
7
  "DOM.Iterable"
8
8
  ],
9
9
  "target": "es2015",
10
- "module": "commonjs",
10
+ "module": "CommonJS",
11
11
  "jsx": "react",
12
12
  "allowJs": true,
13
13
  "composite": true,
14
14
  "declaration": true,
15
15
  "sourceMap": true,
16
16
  "skipLibCheck": true,
17
+ "experimentalDecorators": true,
17
18
  "outDir": "dist",
18
19
  "moduleResolution": "node",
19
20
  "esModuleInterop": true,
@@ -21,6 +22,11 @@
21
22
  "resolveJsonModule": true
22
23
  },
23
24
  "exclude": [
24
- "dist"
25
+ "dist",
26
+ "package.json"
27
+ ],
28
+ "include": [
29
+ "**/*",
30
+ "**/*.json"
25
31
  ]
26
32
  }
@@ -1 +0,0 @@
1
-