@innvoid/getmarket-contracts 0.1.3 → 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 +6 -9
- package/dist/headers.js.map +1 -1
- package/dist/index.cjs +27 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -0
- package/package.json +1 -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
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
EMPLOYEE_UID: "x-employee-uid",
|
|
6
|
-
REQUEST_ID: "x-request-id",
|
|
7
|
-
INTERNAL_API_KEY: "x-internal-api-key"
|
|
8
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
getBranchUidFromHeaders,
|
|
3
|
+
getCompanyUidFromHeaders
|
|
4
|
+
} from "./chunk-UPZZPOS5.js";
|
|
9
5
|
export {
|
|
10
|
-
|
|
6
|
+
getBranchUidFromHeaders,
|
|
7
|
+
getCompanyUidFromHeaders
|
|
11
8
|
};
|
|
12
9
|
//# sourceMappingURL=headers.js.map
|
package/dist/headers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -15,5 +19,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
15
19
|
|
|
16
20
|
// src/index.ts
|
|
17
21
|
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
getBranchUidFromHeaders: () => getBranchUidFromHeaders,
|
|
24
|
+
getCompanyUidFromHeaders: () => getCompanyUidFromHeaders
|
|
25
|
+
});
|
|
18
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/headers.ts
|
|
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
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
getBranchUidFromHeaders,
|
|
44
|
+
getCompanyUidFromHeaders
|
|
45
|
+
});
|
|
19
46
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./common\";\nexport * from \"./auth\";\nexport * from \"./platform\";\nexport * from \"./md\";\nexport * from \"./res\";\nexport * from \"./fis\";\n"],"mappings":"
|
|
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,3 +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 { HeadersLike, getBranchUidFromHeaders, getCompanyUidFromHeaders } from './headers.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,3 +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 { HeadersLike, getBranchUidFromHeaders, getCompanyUidFromHeaders } from './headers.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import "./chunk-5CHG5ZVH.js";
|
|
2
2
|
import "./chunk-GYQ2KZV6.js";
|
|
3
|
+
import {
|
|
4
|
+
getBranchUidFromHeaders,
|
|
5
|
+
getCompanyUidFromHeaders
|
|
6
|
+
} from "./chunk-UPZZPOS5.js";
|
|
3
7
|
import "./chunk-PAA2WCJ2.js";
|
|
4
8
|
import "./chunk-EAJW72VX.js";
|
|
5
9
|
import "./chunk-PDYRRMMO.js";
|
|
6
10
|
import "./chunk-YLVXY5BQ.js";
|
|
11
|
+
export {
|
|
12
|
+
getBranchUidFromHeaders,
|
|
13
|
+
getCompanyUidFromHeaders
|
|
14
|
+
};
|
|
7
15
|
//# sourceMappingURL=index.js.map
|