@trackunit/custom-field-api 0.0.1
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/README.md +26 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.js +4723 -0
- package/index.esm.js +4716 -0
- package/package.json +12 -0
- package/src/generated/graphql-api/fragment-masking.d.ts +15 -0
- package/src/generated/graphql-api/gql.d.ts +37 -0
- package/src/generated/graphql-api/graphql.d.ts +757 -0
- package/src/generated/graphql-api/index.d.ts +2 -0
- package/src/generated/graphql-api/mock.d.ts +8 -0
- package/src/index.d.ts +2 -0
- package/src/useCustomFieldsValueAndDefinition.d.ts +33 -0
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trackunit/custom-field-api",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=18.x"
|
|
6
|
+
},
|
|
7
|
+
"repository": "https://github.com/Trackunit/manager",
|
|
8
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
|
+
"dependencies": {},
|
|
10
|
+
"module": "./index.esm.js",
|
|
11
|
+
"main": "./index.cjs.js"
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
import { Incremental } from './graphql';
|
|
3
|
+
export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<infer TType, any> ? [TType] extends [{
|
|
4
|
+
' $fragmentName'?: infer TKey;
|
|
5
|
+
}] ? TKey extends string ? {
|
|
6
|
+
' $fragmentRefs'?: {
|
|
7
|
+
[key in TKey]: TType;
|
|
8
|
+
};
|
|
9
|
+
} : never : never : never;
|
|
10
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>): TType;
|
|
11
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined): TType | null | undefined;
|
|
12
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
|
|
13
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
|
|
14
|
+
export declare function makeFragmentData<F extends DocumentTypeDecoration<any, any>, FT extends ResultOf<F>>(data: FT, _fragment: F): FragmentType<F>;
|
|
15
|
+
export declare function isFragmentReady<TQuery, TFrag>(queryNode: DocumentTypeDecoration<TQuery, any>, fragmentNode: TypedDocumentNode<TFrag>, data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined): data is FragmentType<typeof fragmentNode>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as types from './graphql';
|
|
2
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
+
/**
|
|
4
|
+
* Map of all GraphQL operations in the project.
|
|
5
|
+
*
|
|
6
|
+
* This map has several performance disadvantages:
|
|
7
|
+
* 1. It is not tree-shakeable, so it will include all operations in the project.
|
|
8
|
+
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
|
|
9
|
+
* 3. It does not support dead code elimination, so it will add unused operations.
|
|
10
|
+
*
|
|
11
|
+
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
12
|
+
*/
|
|
13
|
+
declare const documents: {
|
|
14
|
+
"query GetCustomFieldsForAsset($entityId: String!, $systemOfMeasurement: SystemOfMeasurement) {\n asset(id: $entityId) {\n customFields(systemOfMeasurement: $systemOfMeasurement) {\n edges {\n node {\n ...CustomFieldValueAndDefinition\n }\n }\n }\n }\n}\n\nquery GetCustomFieldsForSite($entityId: ID!, $systemOfMeasurement: SystemOfMeasurement) {\n site(id: $entityId) {\n customFields(systemOfMeasurement: $systemOfMeasurement) {\n edges {\n node {\n ...CustomFieldValueAndDefinition\n }\n }\n }\n }\n}\n\nfragment CustomFieldValueAndDefinition on CustomFieldValueAndDefinition {\n __typename\n type\n definition {\n definitionId\n owner {\n irisAppId\n marketplaceEntry {\n name\n }\n }\n entityType\n title\n description\n uiVisible\n uiEditable\n key\n }\n ... on BooleanFieldValueAndDefinition {\n booleanValue\n }\n ... on DateFieldValueAndDefinition {\n dateValue\n }\n ... on DropDownFieldValueAndDefinition {\n stringArrayValue\n definition {\n allValues\n multiSelect\n }\n }\n ... on EmailFieldValueAndDefinition {\n stringValue\n }\n ... on JsonFieldValueAndDefinition {\n jsonValue\n }\n ... on NumberFieldValueAndDefinition {\n numberValue\n definition {\n minimumNumber\n maximumNumber\n unitSi\n unitUs\n isInteger\n }\n }\n ... on MonetaryFieldValueAndDefinition {\n numberValue\n definition {\n minimumNumber\n maximumNumber\n currency\n }\n }\n ... on PhoneNumberFieldValueAndDefinition {\n stringValue\n }\n ... on StringFieldValueAndDefinition {\n stringValue\n definition {\n maximumLength\n minimumLength\n pattern\n }\n }\n ... on WebAddressFieldValueAndDefinition {\n stringValue\n }\n}": DocumentNode<types.GetCustomFieldsForAssetQuery, types.Exact<{
|
|
15
|
+
entityId: string;
|
|
16
|
+
systemOfMeasurement?: types.InputMaybe<types.SystemOfMeasurement> | undefined;
|
|
17
|
+
}>>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* The query argument is unknown!
|
|
29
|
+
* Please regenerate the types.
|
|
30
|
+
*/
|
|
31
|
+
export declare function graphql(source: string): unknown;
|
|
32
|
+
/**
|
|
33
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
34
|
+
*/
|
|
35
|
+
export declare function graphql(source: "query GetCustomFieldsForAsset($entityId: String!, $systemOfMeasurement: SystemOfMeasurement) {\n asset(id: $entityId) {\n customFields(systemOfMeasurement: $systemOfMeasurement) {\n edges {\n node {\n ...CustomFieldValueAndDefinition\n }\n }\n }\n }\n}\n\nquery GetCustomFieldsForSite($entityId: ID!, $systemOfMeasurement: SystemOfMeasurement) {\n site(id: $entityId) {\n customFields(systemOfMeasurement: $systemOfMeasurement) {\n edges {\n node {\n ...CustomFieldValueAndDefinition\n }\n }\n }\n }\n}\n\nfragment CustomFieldValueAndDefinition on CustomFieldValueAndDefinition {\n __typename\n type\n definition {\n definitionId\n owner {\n irisAppId\n marketplaceEntry {\n name\n }\n }\n entityType\n title\n description\n uiVisible\n uiEditable\n key\n }\n ... on BooleanFieldValueAndDefinition {\n booleanValue\n }\n ... on DateFieldValueAndDefinition {\n dateValue\n }\n ... on DropDownFieldValueAndDefinition {\n stringArrayValue\n definition {\n allValues\n multiSelect\n }\n }\n ... on EmailFieldValueAndDefinition {\n stringValue\n }\n ... on JsonFieldValueAndDefinition {\n jsonValue\n }\n ... on NumberFieldValueAndDefinition {\n numberValue\n definition {\n minimumNumber\n maximumNumber\n unitSi\n unitUs\n isInteger\n }\n }\n ... on MonetaryFieldValueAndDefinition {\n numberValue\n definition {\n minimumNumber\n maximumNumber\n currency\n }\n }\n ... on PhoneNumberFieldValueAndDefinition {\n stringValue\n }\n ... on StringFieldValueAndDefinition {\n stringValue\n definition {\n maximumLength\n minimumLength\n pattern\n }\n }\n ... on WebAddressFieldValueAndDefinition {\n stringValue\n }\n}"): (typeof documents)["query GetCustomFieldsForAsset($entityId: String!, $systemOfMeasurement: SystemOfMeasurement) {\n asset(id: $entityId) {\n customFields(systemOfMeasurement: $systemOfMeasurement) {\n edges {\n node {\n ...CustomFieldValueAndDefinition\n }\n }\n }\n }\n}\n\nquery GetCustomFieldsForSite($entityId: ID!, $systemOfMeasurement: SystemOfMeasurement) {\n site(id: $entityId) {\n customFields(systemOfMeasurement: $systemOfMeasurement) {\n edges {\n node {\n ...CustomFieldValueAndDefinition\n }\n }\n }\n }\n}\n\nfragment CustomFieldValueAndDefinition on CustomFieldValueAndDefinition {\n __typename\n type\n definition {\n definitionId\n owner {\n irisAppId\n marketplaceEntry {\n name\n }\n }\n entityType\n title\n description\n uiVisible\n uiEditable\n key\n }\n ... on BooleanFieldValueAndDefinition {\n booleanValue\n }\n ... on DateFieldValueAndDefinition {\n dateValue\n }\n ... on DropDownFieldValueAndDefinition {\n stringArrayValue\n definition {\n allValues\n multiSelect\n }\n }\n ... on EmailFieldValueAndDefinition {\n stringValue\n }\n ... on JsonFieldValueAndDefinition {\n jsonValue\n }\n ... on NumberFieldValueAndDefinition {\n numberValue\n definition {\n minimumNumber\n maximumNumber\n unitSi\n unitUs\n isInteger\n }\n }\n ... on MonetaryFieldValueAndDefinition {\n numberValue\n definition {\n minimumNumber\n maximumNumber\n currency\n }\n }\n ... on PhoneNumberFieldValueAndDefinition {\n stringValue\n }\n ... on StringFieldValueAndDefinition {\n stringValue\n definition {\n maximumLength\n minimumLength\n pattern\n }\n }\n ... on WebAddressFieldValueAndDefinition {\n stringValue\n }\n}"];
|
|
36
|
+
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|
|
37
|
+
export {};
|