@djangocfg/ext-base 1.0.8 → 1.0.12
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/api.cjs +7 -0
- package/dist/api.d.cts +25 -1
- package/dist/api.d.ts +25 -1
- package/dist/api.js +1 -1
- package/dist/{chunk-K4SSDOMF.js → chunk-HZVDD6LB.js} +10 -4
- package/dist/{chunk-NQEDFJXQ.js → chunk-KX3TLGDE.js} +1 -1
- package/dist/hooks.cjs +10 -3
- package/dist/hooks.d.cts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +4 -4
- package/dist/index.cjs +10 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +6 -6
- package/src/api/createExtensionAPI.ts +30 -0
package/dist/api.cjs
CHANGED
|
@@ -16,6 +16,12 @@ function getApiUrl() {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// src/api/createExtensionAPI.ts
|
|
19
|
+
function initializeExtensionAPI(configureAPIFn) {
|
|
20
|
+
const apiUrl = isStaticBuild ? "" : getApiUrl();
|
|
21
|
+
if (apiUrl) {
|
|
22
|
+
configureAPIFn({ baseUrl: apiUrl });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
19
25
|
function createExtensionAPI(APIClass) {
|
|
20
26
|
let storage;
|
|
21
27
|
try {
|
|
@@ -38,3 +44,4 @@ function getSharedAuthStorage() {
|
|
|
38
44
|
|
|
39
45
|
exports.createExtensionAPI = createExtensionAPI;
|
|
40
46
|
exports.getSharedAuthStorage = getSharedAuthStorage;
|
|
47
|
+
exports.initializeExtensionAPI = initializeExtensionAPI;
|
package/dist/api.d.cts
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides consistent API setup across all extensions with shared authentication
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Initialize extension API global singleton for hooks and fetchers
|
|
8
|
+
*
|
|
9
|
+
* Call this before using any generated hooks to configure the global API instance.
|
|
10
|
+
*
|
|
11
|
+
* @param configureAPIFn - The configureAPI function from your generated api-instance.ts
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // In your extension's api/index.ts
|
|
16
|
+
* import { initializeExtensionAPI, createExtensionAPI } from '@djangocfg/ext-base/api';
|
|
17
|
+
* import { API } from './generated/ext_support';
|
|
18
|
+
* import { configureAPI } from './generated/ext_support/api-instance';
|
|
19
|
+
*
|
|
20
|
+
* // Initialize global singleton for hooks
|
|
21
|
+
* initializeExtensionAPI(configureAPI);
|
|
22
|
+
*
|
|
23
|
+
* // Create instance for direct usage
|
|
24
|
+
* export const apiSupport = createExtensionAPI(API);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare function initializeExtensionAPI(configureAPIFn: (config: {
|
|
28
|
+
baseUrl: string;
|
|
29
|
+
}) => void): void;
|
|
6
30
|
/**
|
|
7
31
|
* Creates an extension API instance with shared authentication storage
|
|
8
32
|
*
|
|
@@ -32,4 +56,4 @@ declare function createExtensionAPI<T>(APIClass: new (url: string, options?: any
|
|
|
32
56
|
*/
|
|
33
57
|
declare function getSharedAuthStorage(): any | undefined;
|
|
34
58
|
|
|
35
|
-
export { createExtensionAPI, getSharedAuthStorage };
|
|
59
|
+
export { createExtensionAPI, getSharedAuthStorage, initializeExtensionAPI };
|
package/dist/api.d.ts
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides consistent API setup across all extensions with shared authentication
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Initialize extension API global singleton for hooks and fetchers
|
|
8
|
+
*
|
|
9
|
+
* Call this before using any generated hooks to configure the global API instance.
|
|
10
|
+
*
|
|
11
|
+
* @param configureAPIFn - The configureAPI function from your generated api-instance.ts
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // In your extension's api/index.ts
|
|
16
|
+
* import { initializeExtensionAPI, createExtensionAPI } from '@djangocfg/ext-base/api';
|
|
17
|
+
* import { API } from './generated/ext_support';
|
|
18
|
+
* import { configureAPI } from './generated/ext_support/api-instance';
|
|
19
|
+
*
|
|
20
|
+
* // Initialize global singleton for hooks
|
|
21
|
+
* initializeExtensionAPI(configureAPI);
|
|
22
|
+
*
|
|
23
|
+
* // Create instance for direct usage
|
|
24
|
+
* export const apiSupport = createExtensionAPI(API);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare function initializeExtensionAPI(configureAPIFn: (config: {
|
|
28
|
+
baseUrl: string;
|
|
29
|
+
}) => void): void;
|
|
6
30
|
/**
|
|
7
31
|
* Creates an extension API instance with shared authentication storage
|
|
8
32
|
*
|
|
@@ -32,4 +56,4 @@ declare function createExtensionAPI<T>(APIClass: new (url: string, options?: any
|
|
|
32
56
|
*/
|
|
33
57
|
declare function getSharedAuthStorage(): any | undefined;
|
|
34
58
|
|
|
35
|
-
export { createExtensionAPI, getSharedAuthStorage };
|
|
59
|
+
export { createExtensionAPI, getSharedAuthStorage, initializeExtensionAPI };
|
package/dist/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createExtensionAPI, getSharedAuthStorage } from './chunk-
|
|
1
|
+
export { createExtensionAPI, getSharedAuthStorage, initializeExtensionAPI } from './chunk-HZVDD6LB.js';
|
|
2
2
|
import './chunk-3RG5ZIWI.js';
|
|
@@ -3,7 +3,7 @@ import { __require } from './chunk-3RG5ZIWI.js';
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@djangocfg/ext-base",
|
|
6
|
-
version: "1.0.
|
|
6
|
+
version: "1.0.12",
|
|
7
7
|
description: "Base utilities and common code for DjangoCFG extensions",
|
|
8
8
|
keywords: [
|
|
9
9
|
"django",
|
|
@@ -78,8 +78,8 @@ var package_default = {
|
|
|
78
78
|
peerDependencies: {
|
|
79
79
|
"@djangocfg/api": "workspace:*",
|
|
80
80
|
consola: "^3.4.2",
|
|
81
|
-
react: "^
|
|
82
|
-
"react-dom": "^
|
|
81
|
+
react: "^19",
|
|
82
|
+
"react-dom": "^19",
|
|
83
83
|
swr: "^2.3.7"
|
|
84
84
|
},
|
|
85
85
|
dependencies: {
|
|
@@ -117,6 +117,12 @@ function getApiUrl() {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// src/api/createExtensionAPI.ts
|
|
120
|
+
function initializeExtensionAPI(configureAPIFn) {
|
|
121
|
+
const apiUrl = isStaticBuild ? "" : getApiUrl();
|
|
122
|
+
if (apiUrl) {
|
|
123
|
+
configureAPIFn({ baseUrl: apiUrl });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
120
126
|
function createExtensionAPI(APIClass) {
|
|
121
127
|
let storage;
|
|
122
128
|
try {
|
|
@@ -137,4 +143,4 @@ function getSharedAuthStorage() {
|
|
|
137
143
|
}
|
|
138
144
|
}
|
|
139
145
|
|
|
140
|
-
export { createExtensionAPI, getApiUrl, getSharedAuthStorage, isDevelopment, isProduction, isStaticBuild, package_default };
|
|
146
|
+
export { createExtensionAPI, getApiUrl, getSharedAuthStorage, initializeExtensionAPI, isDevelopment, isProduction, isStaticBuild, package_default };
|
package/dist/hooks.cjs
CHANGED
|
@@ -33,7 +33,7 @@ var EXTENSION_CATEGORIES = [
|
|
|
33
33
|
// package.json
|
|
34
34
|
var package_default = {
|
|
35
35
|
name: "@djangocfg/ext-base",
|
|
36
|
-
version: "1.0.
|
|
36
|
+
version: "1.0.12",
|
|
37
37
|
description: "Base utilities and common code for DjangoCFG extensions",
|
|
38
38
|
keywords: [
|
|
39
39
|
"django",
|
|
@@ -58,8 +58,8 @@ var package_default = {
|
|
|
58
58
|
peerDependencies: {
|
|
59
59
|
"@djangocfg/api": "workspace:*",
|
|
60
60
|
consola: "^3.4.2",
|
|
61
|
-
react: "^
|
|
62
|
-
"react-dom": "^
|
|
61
|
+
react: "^19",
|
|
62
|
+
"react-dom": "^19",
|
|
63
63
|
swr: "^2.3.7"
|
|
64
64
|
},
|
|
65
65
|
dependencies: {
|
|
@@ -253,6 +253,12 @@ function getApiUrl() {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
// src/api/createExtensionAPI.ts
|
|
256
|
+
function initializeExtensionAPI(configureAPIFn) {
|
|
257
|
+
const apiUrl = isStaticBuild ? "" : getApiUrl();
|
|
258
|
+
if (apiUrl) {
|
|
259
|
+
configureAPIFn({ baseUrl: apiUrl });
|
|
260
|
+
}
|
|
261
|
+
}
|
|
256
262
|
function createExtensionAPI(APIClass) {
|
|
257
263
|
let storage;
|
|
258
264
|
try {
|
|
@@ -431,6 +437,7 @@ exports.formatErrorMessage = formatErrorMessage;
|
|
|
431
437
|
exports.getApiUrl = getApiUrl;
|
|
432
438
|
exports.getSharedAuthStorage = getSharedAuthStorage;
|
|
433
439
|
exports.handleExtensionError = handleExtensionError;
|
|
440
|
+
exports.initializeExtensionAPI = initializeExtensionAPI;
|
|
434
441
|
exports.isDevelopment = isDevelopment;
|
|
435
442
|
exports.isExtensionError = isExtensionError;
|
|
436
443
|
exports.isProduction = isProduction;
|
package/dist/hooks.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtensionProviderProps } from './index.cjs';
|
|
2
2
|
export { EXTENSION_CATEGORIES, ErrorHandler, ExtensionCategory, ExtensionConfigInput, ExtensionContextOptions, ExtensionError, ExtensionExample, ExtensionLogger, ExtensionMetadata, InfinitePaginationOptions, InfinitePaginationReturn, LoggerOptions, PaginatedResponse, PaginationParams, PaginationState, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, getApiUrl, handleExtensionError, isDevelopment, isExtensionError, isProduction, isStaticBuild } from './index.cjs';
|
|
3
|
-
export { createExtensionAPI, getSharedAuthStorage } from './api.cjs';
|
|
3
|
+
export { createExtensionAPI, getSharedAuthStorage, initializeExtensionAPI } from './api.cjs';
|
|
4
4
|
import { Context, ReactNode, ReactElement } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtensionProviderProps } from './index.js';
|
|
2
2
|
export { EXTENSION_CATEGORIES, ErrorHandler, ExtensionCategory, ExtensionConfigInput, ExtensionContextOptions, ExtensionError, ExtensionExample, ExtensionLogger, ExtensionMetadata, InfinitePaginationOptions, InfinitePaginationReturn, LoggerOptions, PaginatedResponse, PaginationParams, PaginationState, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, getApiUrl, handleExtensionError, isDevelopment, isExtensionError, isProduction, isStaticBuild } from './index.js';
|
|
3
|
-
export { createExtensionAPI, getSharedAuthStorage } from './api.js';
|
|
3
|
+
export { createExtensionAPI, getSharedAuthStorage, initializeExtensionAPI } from './api.js';
|
|
4
4
|
import { Context, ReactNode, ReactElement } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
|
package/dist/hooks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createExtensionLogger } from './chunk-
|
|
2
|
-
export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-
|
|
3
|
-
import { isDevelopment } from './chunk-
|
|
4
|
-
export { createExtensionAPI, getApiUrl, getSharedAuthStorage, isDevelopment, isProduction, isStaticBuild } from './chunk-
|
|
1
|
+
import { createExtensionLogger } from './chunk-KX3TLGDE.js';
|
|
2
|
+
export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-KX3TLGDE.js';
|
|
3
|
+
import { isDevelopment } from './chunk-HZVDD6LB.js';
|
|
4
|
+
export { createExtensionAPI, getApiUrl, getSharedAuthStorage, initializeExtensionAPI, isDevelopment, isProduction, isStaticBuild } from './chunk-HZVDD6LB.js';
|
|
5
5
|
import './chunk-3RG5ZIWI.js';
|
|
6
6
|
import React, { createContext, useEffect, useContext } from 'react';
|
|
7
7
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
package/dist/index.cjs
CHANGED
|
@@ -25,7 +25,7 @@ var EXTENSION_CATEGORIES = [
|
|
|
25
25
|
// package.json
|
|
26
26
|
var package_default = {
|
|
27
27
|
name: "@djangocfg/ext-base",
|
|
28
|
-
version: "1.0.
|
|
28
|
+
version: "1.0.12",
|
|
29
29
|
description: "Base utilities and common code for DjangoCFG extensions",
|
|
30
30
|
keywords: [
|
|
31
31
|
"django",
|
|
@@ -50,8 +50,8 @@ var package_default = {
|
|
|
50
50
|
peerDependencies: {
|
|
51
51
|
"@djangocfg/api": "workspace:*",
|
|
52
52
|
consola: "^3.4.2",
|
|
53
|
-
react: "^
|
|
54
|
-
"react-dom": "^
|
|
53
|
+
react: "^19",
|
|
54
|
+
"react-dom": "^19",
|
|
55
55
|
swr: "^2.3.7"
|
|
56
56
|
},
|
|
57
57
|
dependencies: {
|
|
@@ -245,6 +245,12 @@ function getApiUrl() {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// src/api/createExtensionAPI.ts
|
|
248
|
+
function initializeExtensionAPI(configureAPIFn) {
|
|
249
|
+
const apiUrl = isStaticBuild ? "" : getApiUrl();
|
|
250
|
+
if (apiUrl) {
|
|
251
|
+
configureAPIFn({ baseUrl: apiUrl });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
248
254
|
function createExtensionAPI(APIClass) {
|
|
249
255
|
let storage;
|
|
250
256
|
try {
|
|
@@ -339,6 +345,7 @@ exports.formatErrorMessage = formatErrorMessage;
|
|
|
339
345
|
exports.getApiUrl = getApiUrl;
|
|
340
346
|
exports.getSharedAuthStorage = getSharedAuthStorage;
|
|
341
347
|
exports.handleExtensionError = handleExtensionError;
|
|
348
|
+
exports.initializeExtensionAPI = initializeExtensionAPI;
|
|
342
349
|
exports.isDevelopment = isDevelopment;
|
|
343
350
|
exports.isExtensionError = isExtensionError;
|
|
344
351
|
exports.isProduction = isProduction;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-
|
|
2
|
-
export { createExtensionAPI, getApiUrl, getSharedAuthStorage, isDevelopment, isProduction, isStaticBuild } from './chunk-
|
|
1
|
+
export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-KX3TLGDE.js';
|
|
2
|
+
export { createExtensionAPI, getApiUrl, getSharedAuthStorage, initializeExtensionAPI, isDevelopment, isProduction, isStaticBuild } from './chunk-HZVDD6LB.js';
|
|
3
3
|
import './chunk-3RG5ZIWI.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ext-base",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Base utilities and common code for DjangoCFG extensions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"django",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"cli:info": "tsx src/cli/index.ts info"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@djangocfg/api": "^2.1.
|
|
76
|
+
"@djangocfg/api": "^2.1.108",
|
|
77
77
|
"consola": "^3.4.2",
|
|
78
|
-
"react": "^
|
|
79
|
-
"react-dom": "^
|
|
78
|
+
"react": "^19",
|
|
79
|
+
"react-dom": "^19",
|
|
80
80
|
"swr": "^2.3.7"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"prompts": "^2.4.2"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@djangocfg/api": "^2.1.
|
|
90
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
89
|
+
"@djangocfg/api": "^2.1.108",
|
|
90
|
+
"@djangocfg/typescript-config": "^2.1.108",
|
|
91
91
|
"@types/node": "^24.7.2",
|
|
92
92
|
"@types/prompts": "^2.4.9",
|
|
93
93
|
"@types/react": "^19.0.0",
|
|
@@ -6,6 +6,36 @@
|
|
|
6
6
|
|
|
7
7
|
import { getApiUrl, isStaticBuild } from '../config';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Initialize extension API global singleton for hooks and fetchers
|
|
11
|
+
*
|
|
12
|
+
* Call this before using any generated hooks to configure the global API instance.
|
|
13
|
+
*
|
|
14
|
+
* @param configureAPIFn - The configureAPI function from your generated api-instance.ts
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // In your extension's api/index.ts
|
|
19
|
+
* import { initializeExtensionAPI, createExtensionAPI } from '@djangocfg/ext-base/api';
|
|
20
|
+
* import { API } from './generated/ext_support';
|
|
21
|
+
* import { configureAPI } from './generated/ext_support/api-instance';
|
|
22
|
+
*
|
|
23
|
+
* // Initialize global singleton for hooks
|
|
24
|
+
* initializeExtensionAPI(configureAPI);
|
|
25
|
+
*
|
|
26
|
+
* // Create instance for direct usage
|
|
27
|
+
* export const apiSupport = createExtensionAPI(API);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function initializeExtensionAPI(
|
|
31
|
+
configureAPIFn: (config: { baseUrl: string }) => void
|
|
32
|
+
): void {
|
|
33
|
+
const apiUrl = isStaticBuild ? '' : getApiUrl();
|
|
34
|
+
if (apiUrl) {
|
|
35
|
+
configureAPIFn({ baseUrl: apiUrl });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
9
39
|
/**
|
|
10
40
|
* Creates an extension API instance with shared authentication storage
|
|
11
41
|
*
|