@openapi-qraft/react 2.11.0 → 2.12.0
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 +10 -0
- package/dist/cjs/lib/composeMutationKey.cjs +0 -1
- package/dist/cjs/lib/composeMutationKey.cjs.map +1 -1
- package/dist/esm/lib/composeMutationKey.js +1 -1
- package/dist/esm/lib/composeMutationKey.js.map +1 -1
- package/dist/types/lib/composeMutationKey.d.ts +0 -1
- package/dist/types/lib/composeMutationKey.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/lib/composeMutationKey.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeMutationKey.cjs","sources":["../../../src/lib/composeMutationKey.ts"],"sourcesContent":["import type { ServiceOperationMutationKey } from '@openapi-qraft/tanstack-query-react-types';\nimport type { OperationSchema } from './requestFn.js';\n\n/**\n * Omit `body` or `requestBody` from mutation parameters if exists\n * and return the rest of the parameters\n */\nexport function composeMutationKey<TSchema extends OperationSchema>(\n schema: TSchema,\n parameters: undefined\n): ServiceOperationMutationKey<TSchema, undefined>;\nexport function composeMutationKey<TSchema extends OperationSchema, TParams>(\n schema: TSchema,\n parameters: TParams\n): ServiceOperationMutationKey<TSchema, TParams>;\nexport function composeMutationKey<\n TSchema extends OperationSchema,\n TParams = unknown,\n>(schema: TSchema, parameters: TParams | undefined) {\n return parameters === undefined\n ? [{ url: schema.url, method: schema.method }, {}]\n : [\n {\n url: schema.url,\n method: schema.method,\n },\n omitMutationPayload(parameters),\n ];\n}\n\
|
|
1
|
+
{"version":3,"file":"composeMutationKey.cjs","sources":["../../../src/lib/composeMutationKey.ts"],"sourcesContent":["import type { ServiceOperationMutationKey } from '@openapi-qraft/tanstack-query-react-types';\nimport type { OperationSchema } from './requestFn.js';\n\n/**\n * Omit `body` or `requestBody` from mutation parameters if exists\n * and return the rest of the parameters\n */\nexport function composeMutationKey<TSchema extends OperationSchema>(\n schema: TSchema,\n parameters: undefined\n): ServiceOperationMutationKey<TSchema, undefined>;\nexport function composeMutationKey<TSchema extends OperationSchema, TParams>(\n schema: TSchema,\n parameters: TParams\n): ServiceOperationMutationKey<TSchema, TParams>;\nexport function composeMutationKey<\n TSchema extends OperationSchema,\n TParams = unknown,\n>(schema: TSchema, parameters: TParams | undefined) {\n return parameters === undefined\n ? [{ url: schema.url, method: schema.method }, {}]\n : [\n {\n url: schema.url,\n method: schema.method,\n },\n omitMutationPayload(parameters),\n ];\n}\n\nfunction omitMutationPayload<T>(params: T) {\n if (!params || typeof params !== 'object')\n throw new Error('`params` must be object');\n\n if ('body' in params || 'requestBody' in params) {\n const {\n body: _,\n requestBody: __,\n ...paramsRest\n } = params as Record<'body' | 'requestBody', unknown>;\n return paramsRest;\n }\n\n return params as Omit<T, 'body' | 'requestBody'>;\n}\n"],"names":["composeMutationKey","schema","parameters","undefined","url","method","omitMutationPayload","params","Error","body","_","requestBody","__","paramsRest"],"mappings":";;AAeO,SAASA,kBAAAA,CAGdC,MAAe,EAAEC,UAA+B,EAAA;AAChD,IAAA,OAAOA,eAAeC,SAClB,GAAA;AAAC,QAAA;AAAEC,YAAAA,GAAAA,EAAKH,OAAOG,GAAG;AAAEC,YAAAA,MAAAA,EAAQJ,OAAOI,MAAM;AAAC,SAAA;QAAG,EAAC;KAAE,GAChD;AACE,QAAA;AACED,YAAAA,GAAAA,EAAKH,OAAOG,GAAG;AACfC,YAAAA,MAAAA,EAAQJ,OAAOI,MAAM;AACvB,SAAA;QACAC,mBAAoBJ,CAAAA,UAAAA,CAAAA;AACrB,KAAA,CAAA;AACP,CAAA;AAEA,SAASI,oBAAuBC,MAAS,EAAA;AACvC,IAAA,IAAI,CAACA,MAAU,IAAA,OAAOA,WAAW,QAC/B,EAAA,MAAM,IAAIC,KAAM,CAAA,yBAAA,CAAA,CAAA;IAElB,IAAI,MAAA,IAAUD,MAAU,IAAA,aAAA,IAAiBA,MAAQ,EAAA;QAC/C,MAAM,EACJE,MAAMC,CAAC,EACPC,aAAaC,EAAE,EACf,GAAGC,UAAAA,EACJ,GAAGN,MAAAA,CAAAA;QACJ,OAAOM,UAAAA,CAAAA;AACT,KAAA;IAEA,OAAON,MAAAA,CAAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeMutationKey.js","sources":["../../../src/lib/composeMutationKey.ts"],"sourcesContent":["import type { ServiceOperationMutationKey } from '@openapi-qraft/tanstack-query-react-types';\nimport type { OperationSchema } from './requestFn.js';\n\n/**\n * Omit `body` or `requestBody` from mutation parameters if exists\n * and return the rest of the parameters\n */\nexport function composeMutationKey<TSchema extends OperationSchema>(\n schema: TSchema,\n parameters: undefined\n): ServiceOperationMutationKey<TSchema, undefined>;\nexport function composeMutationKey<TSchema extends OperationSchema, TParams>(\n schema: TSchema,\n parameters: TParams\n): ServiceOperationMutationKey<TSchema, TParams>;\nexport function composeMutationKey<\n TSchema extends OperationSchema,\n TParams = unknown,\n>(schema: TSchema, parameters: TParams | undefined) {\n return parameters === undefined\n ? [{ url: schema.url, method: schema.method }, {}]\n : [\n {\n url: schema.url,\n method: schema.method,\n },\n omitMutationPayload(parameters),\n ];\n}\n\
|
|
1
|
+
{"version":3,"file":"composeMutationKey.js","sources":["../../../src/lib/composeMutationKey.ts"],"sourcesContent":["import type { ServiceOperationMutationKey } from '@openapi-qraft/tanstack-query-react-types';\nimport type { OperationSchema } from './requestFn.js';\n\n/**\n * Omit `body` or `requestBody` from mutation parameters if exists\n * and return the rest of the parameters\n */\nexport function composeMutationKey<TSchema extends OperationSchema>(\n schema: TSchema,\n parameters: undefined\n): ServiceOperationMutationKey<TSchema, undefined>;\nexport function composeMutationKey<TSchema extends OperationSchema, TParams>(\n schema: TSchema,\n parameters: TParams\n): ServiceOperationMutationKey<TSchema, TParams>;\nexport function composeMutationKey<\n TSchema extends OperationSchema,\n TParams = unknown,\n>(schema: TSchema, parameters: TParams | undefined) {\n return parameters === undefined\n ? [{ url: schema.url, method: schema.method }, {}]\n : [\n {\n url: schema.url,\n method: schema.method,\n },\n omitMutationPayload(parameters),\n ];\n}\n\nfunction omitMutationPayload<T>(params: T) {\n if (!params || typeof params !== 'object')\n throw new Error('`params` must be object');\n\n if ('body' in params || 'requestBody' in params) {\n const {\n body: _,\n requestBody: __,\n ...paramsRest\n } = params as Record<'body' | 'requestBody', unknown>;\n return paramsRest;\n }\n\n return params as Omit<T, 'body' | 'requestBody'>;\n}\n"],"names":["composeMutationKey","schema","parameters","undefined","url","method","omitMutationPayload","params","Error","body","_","requestBody","__","paramsRest"],"mappings":"AAeO,SAASA,kBAAAA,CAGdC,MAAe,EAAEC,UAA+B,EAAA;AAChD,IAAA,OAAOA,eAAeC,SAClB,GAAA;AAAC,QAAA;AAAEC,YAAAA,GAAAA,EAAKH,OAAOG,GAAG;AAAEC,YAAAA,MAAAA,EAAQJ,OAAOI,MAAM;AAAC,SAAA;QAAG,EAAC;KAAE,GAChD;AACE,QAAA;AACED,YAAAA,GAAAA,EAAKH,OAAOG,GAAG;AACfC,YAAAA,MAAAA,EAAQJ,OAAOI,MAAM;AACvB,SAAA;QACAC,mBAAoBJ,CAAAA,UAAAA,CAAAA;AACrB,KAAA,CAAA;AACP,CAAA;AAEA,SAASI,oBAAuBC,MAAS,EAAA;AACvC,IAAA,IAAI,CAACA,MAAU,IAAA,OAAOA,WAAW,QAC/B,EAAA,MAAM,IAAIC,KAAM,CAAA,yBAAA,CAAA,CAAA;IAElB,IAAI,MAAA,IAAUD,MAAU,IAAA,aAAA,IAAiBA,MAAQ,EAAA;QAC/C,MAAM,EACJE,MAAMC,CAAC,EACPC,aAAaC,EAAE,EACf,GAAGC,UAAAA,EACJ,GAAGN,MAAAA,CAAAA;QACJ,OAAOM,UAAAA,CAAAA;AACT,KAAA;IAEA,OAAON,MAAAA,CAAAA;AACT;;;;"}
|
|
@@ -6,5 +6,4 @@ import type { OperationSchema } from './requestFn.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function composeMutationKey<TSchema extends OperationSchema>(schema: TSchema, parameters: undefined): ServiceOperationMutationKey<TSchema, undefined>;
|
|
8
8
|
export declare function composeMutationKey<TSchema extends OperationSchema, TParams>(schema: TSchema, parameters: TParams): ServiceOperationMutationKey<TSchema, TParams>;
|
|
9
|
-
export declare function omitMutationPayload<T>(params: T): {};
|
|
10
9
|
//# sourceMappingURL=composeMutationKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeMutationKey.d.ts","sourceRoot":"","sources":["../../../src/lib/composeMutationKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,eAAe,EAChE,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,SAAS,GACpB,2BAA2B,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACnD,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,eAAe,EAAE,OAAO,EACzE,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,OAAO,GAClB,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"composeMutationKey.d.ts","sourceRoot":"","sources":["../../../src/lib/composeMutationKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,eAAe,EAChE,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,SAAS,GACpB,2BAA2B,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACnD,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,eAAe,EAAE,OAAO,EACzE,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,OAAO,GAClB,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openapi-qraft/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "OpenAPI client for React, providing type-safe requests and dynamic TanStack Query React Hooks via a modular, Proxy-based architecture.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "NODE_ENV=production rollup --config rollup.config.mjs && tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@openapi-qraft/tanstack-query-react-types": "2.
|
|
18
|
+
"@openapi-qraft/tanstack-query-react-types": "2.12.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@tanstack/react-query": "^5.80.0",
|
|
22
22
|
"react": "^18 || ^19"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@openapi-qraft/cli": "2.
|
|
25
|
+
"@openapi-qraft/cli": "2.12.0",
|
|
26
26
|
"@openapi-qraft/eslint-config": "1.0.1",
|
|
27
|
-
"@openapi-qraft/
|
|
27
|
+
"@openapi-qraft/eslint-plugin-query": "2.12.0",
|
|
28
|
+
"@openapi-qraft/openapi-typescript-plugin": "^2.12.0",
|
|
28
29
|
"@openapi-qraft/rollup-config": "1.1.1",
|
|
29
|
-
"@openapi-qraft/tanstack-query-react-plugin": "2.
|
|
30
|
+
"@openapi-qraft/tanstack-query-react-plugin": "2.12.0",
|
|
30
31
|
"@openapi-qraft/test-fixtures": "1.1.1",
|
|
31
32
|
"@tanstack/react-query": "^5.80.6",
|
|
32
33
|
"@testing-library/dom": "^10.4.0",
|