@innvoid/getmarket-contracts 0.1.4 → 0.1.5
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/chunk-UPZZPOS5.js +19 -0
- package/dist/chunk-UPZZPOS5.js.map +1 -0
- package/dist/headers.cjs +16 -9
- package/dist/headers.cjs.map +1 -1
- package/dist/headers.d.cts +14 -18
- package/dist/headers.d.ts +14 -18
- package/dist/headers.js +5 -3
- package/dist/index.cjs +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/package.json +1 -1
- package/dist/chunk-TBCODCKV.js +0 -13
- package/dist/chunk-TBCODCKV.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/headers.ts
|
|
2
|
+
function getHeader(h, name) {
|
|
3
|
+
const v = h?.[name] ?? h?.[name.toLowerCase()];
|
|
4
|
+
if (Array.isArray(v)) return String(v[0] ?? "").trim() || null;
|
|
5
|
+
const s = String(v ?? "").trim();
|
|
6
|
+
return s.length ? s : null;
|
|
7
|
+
}
|
|
8
|
+
function getCompanyUidFromHeaders(headers) {
|
|
9
|
+
return getHeader(headers, "x-company") || getHeader(headers, "x-company-uid") || getHeader(headers, "x-auth-company-uid") || null;
|
|
10
|
+
}
|
|
11
|
+
function getBranchUidFromHeaders(headers) {
|
|
12
|
+
return getHeader(headers, "x-branch") || getHeader(headers, "x-branch-uid") || getHeader(headers, "x-auth-branch-uid") || null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
getCompanyUidFromHeaders,
|
|
17
|
+
getBranchUidFromHeaders
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-UPZZPOS5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/headers.ts"],"sourcesContent":["// packages/contracts/src/headers.ts\nexport type HeadersLike =\n | Record<string, string | string[] | undefined>\n | { [k: string]: any };\n\nfunction getHeader(h: HeadersLike, name: string): string | null {\n const v = (h as any)?.[name] ?? (h as any)?.[name.toLowerCase()];\n if (Array.isArray(v)) return String(v[0] ?? \"\").trim() || null;\n const s = String(v ?? \"\").trim();\n return s.length ? s : null;\n}\n\n/**\n * Lee auth_company_uid desde headers.\n * Estándar: x-company\n * Compatibles (por si acaso): x-company-uid, x-auth-company-uid\n */\nexport function getCompanyUidFromHeaders(headers: HeadersLike): string | null {\n return (\n getHeader(headers, \"x-company\") ||\n getHeader(headers, \"x-company-uid\") ||\n getHeader(headers, \"x-auth-company-uid\") ||\n null\n );\n}\n\n/**\n * Lee auth_branch_uid desde headers (si aplica).\n * Estándar: x-branch\n */\nexport function getBranchUidFromHeaders(headers: HeadersLike): string | null {\n return (\n getHeader(headers, \"x-branch\") ||\n getHeader(headers, \"x-branch-uid\") ||\n getHeader(headers, \"x-auth-branch-uid\") ||\n null\n );\n}\n"],"mappings":";AAKA,SAAS,UAAU,GAAgB,MAA6B;AAC5D,QAAM,IAAK,IAAY,IAAI,KAAM,IAAY,KAAK,YAAY,CAAC;AAC/D,MAAI,MAAM,QAAQ,CAAC,EAAG,QAAO,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,KAAK;AAC1D,QAAM,IAAI,OAAO,KAAK,EAAE,EAAE,KAAK;AAC/B,SAAO,EAAE,SAAS,IAAI;AAC1B;AAOO,SAAS,yBAAyB,SAAqC;AAC1E,SACI,UAAU,SAAS,WAAW,KAC9B,UAAU,SAAS,eAAe,KAClC,UAAU,SAAS,oBAAoB,KACvC;AAER;AAMO,SAAS,wBAAwB,SAAqC;AACzE,SACI,UAAU,SAAS,UAAU,KAC7B,UAAU,SAAS,cAAc,KACjC,UAAU,SAAS,mBAAmB,KACtC;AAER;","names":[]}
|
package/dist/headers.cjs
CHANGED
|
@@ -20,18 +20,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/headers.ts
|
|
21
21
|
var headers_exports = {};
|
|
22
22
|
__export(headers_exports, {
|
|
23
|
-
|
|
23
|
+
getBranchUidFromHeaders: () => getBranchUidFromHeaders,
|
|
24
|
+
getCompanyUidFromHeaders: () => getCompanyUidFromHeaders
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(headers_exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
function getHeader(h, name) {
|
|
28
|
+
const v = h?.[name] ?? h?.[name.toLowerCase()];
|
|
29
|
+
if (Array.isArray(v)) return String(v[0] ?? "").trim() || null;
|
|
30
|
+
const s = String(v ?? "").trim();
|
|
31
|
+
return s.length ? s : null;
|
|
32
|
+
}
|
|
33
|
+
function getCompanyUidFromHeaders(headers) {
|
|
34
|
+
return getHeader(headers, "x-company") || getHeader(headers, "x-company-uid") || getHeader(headers, "x-auth-company-uid") || null;
|
|
35
|
+
}
|
|
36
|
+
function getBranchUidFromHeaders(headers) {
|
|
37
|
+
return getHeader(headers, "x-branch") || getHeader(headers, "x-branch-uid") || getHeader(headers, "x-auth-branch-uid") || null;
|
|
38
|
+
}
|
|
33
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
40
|
0 && (module.exports = {
|
|
35
|
-
|
|
41
|
+
getBranchUidFromHeaders,
|
|
42
|
+
getCompanyUidFromHeaders
|
|
36
43
|
});
|
|
37
44
|
//# sourceMappingURL=headers.cjs.map
|
package/dist/headers.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/headers.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/headers.ts"],"sourcesContent":["// packages/contracts/src/headers.ts\nexport type HeadersLike =\n | Record<string, string | string[] | undefined>\n | { [k: string]: any };\n\nfunction getHeader(h: HeadersLike, name: string): string | null {\n const v = (h as any)?.[name] ?? (h as any)?.[name.toLowerCase()];\n if (Array.isArray(v)) return String(v[0] ?? \"\").trim() || null;\n const s = String(v ?? \"\").trim();\n return s.length ? s : null;\n}\n\n/**\n * Lee auth_company_uid desde headers.\n * Estándar: x-company\n * Compatibles (por si acaso): x-company-uid, x-auth-company-uid\n */\nexport function getCompanyUidFromHeaders(headers: HeadersLike): string | null {\n return (\n getHeader(headers, \"x-company\") ||\n getHeader(headers, \"x-company-uid\") ||\n getHeader(headers, \"x-auth-company-uid\") ||\n null\n );\n}\n\n/**\n * Lee auth_branch_uid desde headers (si aplica).\n * Estándar: x-branch\n */\nexport function getBranchUidFromHeaders(headers: HeadersLike): string | null {\n return (\n getHeader(headers, \"x-branch\") ||\n getHeader(headers, \"x-branch-uid\") ||\n getHeader(headers, \"x-auth-branch-uid\") ||\n null\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,SAAS,UAAU,GAAgB,MAA6B;AAC5D,QAAM,IAAK,IAAY,IAAI,KAAM,IAAY,KAAK,YAAY,CAAC;AAC/D,MAAI,MAAM,QAAQ,CAAC,EAAG,QAAO,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,KAAK;AAC1D,QAAM,IAAI,OAAO,KAAK,EAAE,EAAE,KAAK;AAC/B,SAAO,EAAE,SAAS,IAAI;AAC1B;AAOO,SAAS,yBAAyB,SAAqC;AAC1E,SACI,UAAU,SAAS,WAAW,KAC9B,UAAU,SAAS,eAAe,KAClC,UAAU,SAAS,oBAAoB,KACvC;AAER;AAMO,SAAS,wBAAwB,SAAqC;AACzE,SACI,UAAU,SAAS,UAAU,KAC7B,UAAU,SAAS,cAAc,KACjC,UAAU,SAAS,mBAAmB,KACtC;AAER;","names":[]}
|
package/dist/headers.d.cts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const HEADERS: {
|
|
4
|
-
readonly COMPANY_UID: "x-company";
|
|
5
|
-
readonly BRANCH_UID: "x-branch";
|
|
6
|
-
readonly EMPLOYEE_UID: "x-employee-uid";
|
|
7
|
-
readonly REQUEST_ID: "x-request-id";
|
|
8
|
-
readonly INTERNAL_API_KEY: "x-internal-api-key";
|
|
9
|
-
};
|
|
10
|
-
type TenantHeaders = {
|
|
11
|
-
"x-company"?: UID;
|
|
12
|
-
"x-branch"?: UID;
|
|
13
|
-
"x-employee-uid"?: UID;
|
|
14
|
-
"x-request-id"?: string;
|
|
15
|
-
};
|
|
16
|
-
type InternalHeaders = TenantHeaders & {
|
|
17
|
-
"x-internal-api-key"?: string;
|
|
1
|
+
type HeadersLike = Record<string, string | string[] | undefined> | {
|
|
2
|
+
[k: string]: any;
|
|
18
3
|
};
|
|
4
|
+
/**
|
|
5
|
+
* Lee auth_company_uid desde headers.
|
|
6
|
+
* Estándar: x-company
|
|
7
|
+
* Compatibles (por si acaso): x-company-uid, x-auth-company-uid
|
|
8
|
+
*/
|
|
9
|
+
declare function getCompanyUidFromHeaders(headers: HeadersLike): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Lee auth_branch_uid desde headers (si aplica).
|
|
12
|
+
* Estándar: x-branch
|
|
13
|
+
*/
|
|
14
|
+
declare function getBranchUidFromHeaders(headers: HeadersLike): string | null;
|
|
19
15
|
|
|
20
|
-
export {
|
|
16
|
+
export { type HeadersLike, getBranchUidFromHeaders, getCompanyUidFromHeaders };
|
package/dist/headers.d.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const HEADERS: {
|
|
4
|
-
readonly COMPANY_UID: "x-company";
|
|
5
|
-
readonly BRANCH_UID: "x-branch";
|
|
6
|
-
readonly EMPLOYEE_UID: "x-employee-uid";
|
|
7
|
-
readonly REQUEST_ID: "x-request-id";
|
|
8
|
-
readonly INTERNAL_API_KEY: "x-internal-api-key";
|
|
9
|
-
};
|
|
10
|
-
type TenantHeaders = {
|
|
11
|
-
"x-company"?: UID;
|
|
12
|
-
"x-branch"?: UID;
|
|
13
|
-
"x-employee-uid"?: UID;
|
|
14
|
-
"x-request-id"?: string;
|
|
15
|
-
};
|
|
16
|
-
type InternalHeaders = TenantHeaders & {
|
|
17
|
-
"x-internal-api-key"?: string;
|
|
1
|
+
type HeadersLike = Record<string, string | string[] | undefined> | {
|
|
2
|
+
[k: string]: any;
|
|
18
3
|
};
|
|
4
|
+
/**
|
|
5
|
+
* Lee auth_company_uid desde headers.
|
|
6
|
+
* Estándar: x-company
|
|
7
|
+
* Compatibles (por si acaso): x-company-uid, x-auth-company-uid
|
|
8
|
+
*/
|
|
9
|
+
declare function getCompanyUidFromHeaders(headers: HeadersLike): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Lee auth_branch_uid desde headers (si aplica).
|
|
12
|
+
* Estándar: x-branch
|
|
13
|
+
*/
|
|
14
|
+
declare function getBranchUidFromHeaders(headers: HeadersLike): string | null;
|
|
19
15
|
|
|
20
|
-
export {
|
|
16
|
+
export { type HeadersLike, getBranchUidFromHeaders, getCompanyUidFromHeaders };
|
package/dist/headers.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -20,20 +20,27 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
-
|
|
23
|
+
getBranchUidFromHeaders: () => getBranchUidFromHeaders,
|
|
24
|
+
getCompanyUidFromHeaders: () => getCompanyUidFromHeaders
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(src_exports);
|
|
26
27
|
|
|
27
28
|
// src/headers.ts
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
function getHeader(h, name) {
|
|
30
|
+
const v = h?.[name] ?? h?.[name.toLowerCase()];
|
|
31
|
+
if (Array.isArray(v)) return String(v[0] ?? "").trim() || null;
|
|
32
|
+
const s = String(v ?? "").trim();
|
|
33
|
+
return s.length ? s : null;
|
|
34
|
+
}
|
|
35
|
+
function getCompanyUidFromHeaders(headers) {
|
|
36
|
+
return getHeader(headers, "x-company") || getHeader(headers, "x-company-uid") || getHeader(headers, "x-auth-company-uid") || null;
|
|
37
|
+
}
|
|
38
|
+
function getBranchUidFromHeaders(headers) {
|
|
39
|
+
return getHeader(headers, "x-branch") || getHeader(headers, "x-branch-uid") || getHeader(headers, "x-auth-branch-uid") || null;
|
|
40
|
+
}
|
|
35
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
42
|
0 && (module.exports = {
|
|
37
|
-
|
|
43
|
+
getBranchUidFromHeaders,
|
|
44
|
+
getCompanyUidFromHeaders
|
|
38
45
|
});
|
|
39
46
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/headers.ts"],"sourcesContent":["export * from \"./common\";\nexport * from \"./auth\";\nexport * from \"./platform\";\nexport * from \"./md\";\nexport * from \"./res\";\nexport * from \"./fis\";\nexport * from \"./headers\";\n","
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/headers.ts"],"sourcesContent":["export * from \"./common\";\nexport * from \"./auth\";\nexport * from \"./platform\";\nexport * from \"./md\";\nexport * from \"./res\";\nexport * from \"./fis\";\nexport * from \"./headers\";\n","// packages/contracts/src/headers.ts\nexport type HeadersLike =\n | Record<string, string | string[] | undefined>\n | { [k: string]: any };\n\nfunction getHeader(h: HeadersLike, name: string): string | null {\n const v = (h as any)?.[name] ?? (h as any)?.[name.toLowerCase()];\n if (Array.isArray(v)) return String(v[0] ?? \"\").trim() || null;\n const s = String(v ?? \"\").trim();\n return s.length ? s : null;\n}\n\n/**\n * Lee auth_company_uid desde headers.\n * Estándar: x-company\n * Compatibles (por si acaso): x-company-uid, x-auth-company-uid\n */\nexport function getCompanyUidFromHeaders(headers: HeadersLike): string | null {\n return (\n getHeader(headers, \"x-company\") ||\n getHeader(headers, \"x-company-uid\") ||\n getHeader(headers, \"x-auth-company-uid\") ||\n null\n );\n}\n\n/**\n * Lee auth_branch_uid desde headers (si aplica).\n * Estándar: x-branch\n */\nexport function getBranchUidFromHeaders(headers: HeadersLike): string | null {\n return (\n getHeader(headers, \"x-branch\") ||\n getHeader(headers, \"x-branch-uid\") ||\n getHeader(headers, \"x-auth-branch-uid\") ||\n null\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,SAAS,UAAU,GAAgB,MAA6B;AAC5D,QAAM,IAAK,IAAY,IAAI,KAAM,IAAY,KAAK,YAAY,CAAC;AAC/D,MAAI,MAAM,QAAQ,CAAC,EAAG,QAAO,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,KAAK;AAC1D,QAAM,IAAI,OAAO,KAAK,EAAE,EAAE,KAAK;AAC/B,SAAO,EAAE,SAAS,IAAI;AAC1B;AAOO,SAAS,yBAAyB,SAAqC;AAC1E,SACI,UAAU,SAAS,WAAW,KAC9B,UAAU,SAAS,eAAe,KAClC,UAAU,SAAS,oBAAoB,KACvC;AAER;AAMO,SAAS,wBAAwB,SAAqC;AACzE,SACI,UAAU,SAAS,UAAU,KAC7B,UAAU,SAAS,cAAc,KACjC,UAAU,SAAS,mBAAmB,KACtC;AAER;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -4,4 +4,4 @@ export { PlatformResolveTenantResponse, PlatformTenantResolved } from './platfor
|
|
|
4
4
|
export { MdCommuneRef, MdCommunesRefsRequest, MdCommunesRefsResponse, MdCountriesRefsRequest, MdCountriesRefsResponse, MdCountryRef, MdCurrenciesRefsRequest, MdCurrenciesRefsResponse, MdCurrencyRef, MdRegionRef, MdRegionsRefsRequest, MdRegionsRefsResponse, MdUnitRef, MdUnitsRefsRequest, MdUnitsRefsResponse } from './md.cjs';
|
|
5
5
|
export { ResAttributeOptionRef, ResAttributeRef, ResCategoryRef, ResResourceRef, ResResourcesRefsRequest, ResResourcesRefsResponse, ResVarietiesRefsRequest, ResVarietiesRefsResponse, ResVarietyRef } from './res.cjs';
|
|
6
6
|
export { FisTaxRef, FisTaxesRefsRequest, FisTaxesRefsResponse } from './fis.cjs';
|
|
7
|
-
export {
|
|
7
|
+
export { HeadersLike, getBranchUidFromHeaders, getCompanyUidFromHeaders } from './headers.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { PlatformResolveTenantResponse, PlatformTenantResolved } from './platfor
|
|
|
4
4
|
export { MdCommuneRef, MdCommunesRefsRequest, MdCommunesRefsResponse, MdCountriesRefsRequest, MdCountriesRefsResponse, MdCountryRef, MdCurrenciesRefsRequest, MdCurrenciesRefsResponse, MdCurrencyRef, MdRegionRef, MdRegionsRefsRequest, MdRegionsRefsResponse, MdUnitRef, MdUnitsRefsRequest, MdUnitsRefsResponse } from './md.js';
|
|
5
5
|
export { ResAttributeOptionRef, ResAttributeRef, ResCategoryRef, ResResourceRef, ResResourcesRefsRequest, ResResourcesRefsResponse, ResVarietiesRefsRequest, ResVarietiesRefsResponse, ResVarietyRef } from './res.js';
|
|
6
6
|
export { FisTaxRef, FisTaxesRefsRequest, FisTaxesRefsResponse } from './fis.js';
|
|
7
|
-
export {
|
|
7
|
+
export { HeadersLike, getBranchUidFromHeaders, getCompanyUidFromHeaders } from './headers.js';
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import "./chunk-5CHG5ZVH.js";
|
|
2
2
|
import "./chunk-GYQ2KZV6.js";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
getBranchUidFromHeaders,
|
|
5
|
+
getCompanyUidFromHeaders
|
|
6
|
+
} from "./chunk-UPZZPOS5.js";
|
|
6
7
|
import "./chunk-PAA2WCJ2.js";
|
|
7
8
|
import "./chunk-EAJW72VX.js";
|
|
8
9
|
import "./chunk-PDYRRMMO.js";
|
|
9
10
|
import "./chunk-YLVXY5BQ.js";
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
getBranchUidFromHeaders,
|
|
13
|
+
getCompanyUidFromHeaders
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
package/dist/chunk-TBCODCKV.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/headers.ts
|
|
2
|
-
var HEADERS = {
|
|
3
|
-
COMPANY_UID: "x-company",
|
|
4
|
-
BRANCH_UID: "x-branch",
|
|
5
|
-
EMPLOYEE_UID: "x-employee-uid",
|
|
6
|
-
REQUEST_ID: "x-request-id",
|
|
7
|
-
INTERNAL_API_KEY: "x-internal-api-key"
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
HEADERS
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=chunk-TBCODCKV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/headers.ts"],"sourcesContent":["import type {UID} from \"./common\";\n\nexport const HEADERS = {\n COMPANY_UID: \"x-company\",\n BRANCH_UID: \"x-branch\",\n EMPLOYEE_UID: \"x-employee-uid\",\n REQUEST_ID: \"x-request-id\",\n INTERNAL_API_KEY: \"x-internal-api-key\",\n} as const;\n\nexport type TenantHeaders = {\n \"x-company\"?: UID;\n \"x-branch\"?: UID;\n \"x-employee-uid\"?: UID;\n \"x-request-id\"?: string;\n};\n\nexport type InternalHeaders = TenantHeaders & {\n \"x-internal-api-key\"?: string;\n};\n"],"mappings":";AAEO,IAAM,UAAU;AAAA,EACnB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,kBAAkB;AACtB;","names":[]}
|