@milaboratories/pl-model-common 1.20.1 → 1.21.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/dist/bmodel/block_config.cjs +1 -1
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +1 -1
- package/dist/bmodel/block_config.d.ts.map +1 -1
- package/dist/bmodel/block_config.js +1 -1
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/code.cjs +11 -0
- package/dist/bmodel/code.cjs.map +1 -0
- package/dist/bmodel/code.d.ts +11 -3
- package/dist/bmodel/code.d.ts.map +1 -1
- package/dist/bmodel/code.js +9 -0
- package/dist/bmodel/code.js.map +1 -0
- package/dist/bmodel/container.d.ts +1 -1
- package/dist/bmodel/container.d.ts.map +1 -1
- package/dist/httpAuth.cjs +30 -0
- package/dist/httpAuth.cjs.map +1 -0
- package/dist/httpAuth.d.ts +9 -0
- package/dist/httpAuth.d.ts.map +1 -0
- package/dist/httpAuth.js +27 -0
- package/dist/httpAuth.js.map +1 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/bmodel/block_config.ts +2 -2
- package/src/bmodel/code.ts +7 -4
- package/src/bmodel/container.ts +1 -1
- package/src/httpAuth.ts +34 -0
- package/src/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_config.cjs","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo
|
|
1
|
+
{"version":3,"file":"block_config.cjs","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error('No code bundle');\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"names":[],"mappings":";;AAAA;AA6DM,SAAU,mBAAmB,CAAC,GAAyB,EAAA;AAC3D,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAC7D,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,YAAY,EAAE,GAAG,CAAC,YAAY;KAC/B;AACH;;;;"}
|
|
@@ -38,5 +38,5 @@ export type BlockConfigV3Generic<Args = unknown, UiState = unknown, BroadActiveH
|
|
|
38
38
|
readonly featureFlags?: BlockCodeFeatureFlags;
|
|
39
39
|
};
|
|
40
40
|
export type BlockConfigGeneric = BlockConfigV3Generic;
|
|
41
|
-
export declare function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo
|
|
41
|
+
export declare function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo;
|
|
42
42
|
//# sourceMappingURL=block_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_config.d.ts","sourceRoot":"","sources":["../../src/bmodel/block_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAC9B,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO,EACjB,2BAA2B,GAAG,OAAO,EACrC,4BAA4B,SAAS,2BAA2B,GAAG,2BAA2B,EAC9F,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,IACvG;IACF,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,wCAAwC;IACxC,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAE3C,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAE3B,oEAAoE;IACpE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC;;;;;SAKK;IACL,QAAQ,CAAC,WAAW,EAAE,2BAA2B,CAAC;IAElD,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;IAE/C,mCAAmC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,4BAA4B,CAAC;IAE9C;;;SAGK;IACL,QAAQ,CAAC,iBAAiB,CAAC,EAAE,4BAA4B,CAAC;IAE1D,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAErB,qDAAqD;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEtD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,oBAAoB,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"block_config.d.ts","sourceRoot":"","sources":["../../src/bmodel/block_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAC9B,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO,EACjB,2BAA2B,GAAG,OAAO,EACrC,4BAA4B,SAAS,2BAA2B,GAAG,2BAA2B,EAC9F,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,IACvG;IACF,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,wCAAwC;IACxC,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAE3C,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAE3B,oEAAoE;IACpE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC;;;;;SAKK;IACL,QAAQ,CAAC,WAAW,EAAE,2BAA2B,CAAC;IAElD,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;IAE/C,mCAAmC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,4BAA4B,CAAC;IAE9C;;;SAGK;IACL,QAAQ,CAAC,iBAAiB,CAAC,EAAE,4BAA4B,CAAC;IAE1D,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAErB,qDAAqD;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEtD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,oBAAoB,GAAG,iBAAiB,CAOhF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_config.js","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo
|
|
1
|
+
{"version":3,"file":"block_config.js","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error('No code bundle');\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"names":[],"mappings":"AAAA;AA6DM,SAAU,mBAAmB,CAAC,GAAyB,EAAA;AAC3D,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAC7D,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,YAAY,EAAE,GAAG,CAAC,YAAY;KAC/B;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.cjs","sources":["../../src/bmodel/code.ts"],"sourcesContent":["import type { BlockCodeFeatureFlags } from '../flags';\nimport { z } from 'zod';\n\nexport const Code = z.object({\n type: z.literal('plain'),\n content: z.string(),\n});\n\nexport type Code = z.infer<typeof Code>;\n\nexport type BlockCodeWithInfo = {\n readonly code: Code;\n readonly sdkVersion: string;\n readonly featureFlags: BlockCodeFeatureFlags | undefined;\n};\n"],"names":["z"],"mappings":";;;;AAGO,MAAM,IAAI,GAAGA,KAAC,CAAC,MAAM,CAAC;AAC3B,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AACxB,IAAA,OAAO,EAAEA,KAAC,CAAC,MAAM,EAAE;AACpB,CAAA;;;;"}
|
package/dist/bmodel/code.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { BlockCodeFeatureFlags } from '../flags';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const Code: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"plain">;
|
|
5
|
+
content: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "plain";
|
|
4
8
|
content: string;
|
|
5
|
-
}
|
|
9
|
+
}, {
|
|
10
|
+
type: "plain";
|
|
11
|
+
content: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type Code = z.infer<typeof Code>;
|
|
6
14
|
export type BlockCodeWithInfo = {
|
|
7
15
|
readonly code: Code;
|
|
8
16
|
readonly sdkVersion: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/bmodel/code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/bmodel/code.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,IAAI;;;;;;;;;EAGf,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","sources":["../../src/bmodel/code.ts"],"sourcesContent":["import type { BlockCodeFeatureFlags } from '../flags';\nimport { z } from 'zod';\n\nexport const Code = z.object({\n type: z.literal('plain'),\n content: z.string(),\n});\n\nexport type Code = z.infer<typeof Code>;\n\nexport type BlockCodeWithInfo = {\n readonly code: Code;\n readonly sdkVersion: string;\n readonly featureFlags: BlockCodeFeatureFlags | undefined;\n};\n"],"names":[],"mappings":";;AAGO,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;AAC3B,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;AACxB,IAAA,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;AACpB,CAAA;;;;"}
|
|
@@ -5,7 +5,7 @@ import type { BlockRenderingMode } from './types';
|
|
|
5
5
|
export type BlockConfigContainer = {
|
|
6
6
|
/** Actual config */
|
|
7
7
|
readonly v3: Omit<BlockConfigV3Generic, 'code'>;
|
|
8
|
-
/** Config code bundle */
|
|
8
|
+
/** Config code bundle. Actually is required, but we keep it optional for backward compatibility */
|
|
9
9
|
readonly code?: Code;
|
|
10
10
|
/**
|
|
11
11
|
* For backward compatibility
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/bmodel/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,oBAAoB;IACpB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAEhD,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/bmodel/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,oBAAoB;IACpB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAEhD,mGAAmG;IACnG,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAMrB;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */
|
|
4
|
+
function parseHttpAuth(input) {
|
|
5
|
+
const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);
|
|
6
|
+
if (match?.groups?.scheme === 'Basic') {
|
|
7
|
+
const credentialsMatch = /(?<username>.*?):(?<password>.*)/
|
|
8
|
+
.exec(atob(match.groups.parameters));
|
|
9
|
+
if (!credentialsMatch?.groups) {
|
|
10
|
+
throw new Error(`Malformed credentials.`);
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
scheme: 'Basic',
|
|
14
|
+
username: credentialsMatch.groups.username,
|
|
15
|
+
password: credentialsMatch.groups.password,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);
|
|
19
|
+
}
|
|
20
|
+
function serializeHttpAuth(input) {
|
|
21
|
+
if (input.scheme === 'Basic') {
|
|
22
|
+
return `Basic ${btoa(`${input.username}:${input.password}`)}`;
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
25
|
+
throw new Error(`Unsupported auth scheme: ${input.scheme}.`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.parseHttpAuth = parseHttpAuth;
|
|
29
|
+
exports.serializeHttpAuth = serializeHttpAuth;
|
|
30
|
+
//# sourceMappingURL=httpAuth.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpAuth.cjs","sources":["../src/httpAuth.ts"],"sourcesContent":["/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */\n\nexport function parseHttpAuth(input: string): HttpAuth {\n const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);\n if (match?.groups?.scheme === 'Basic') {\n const credentialsMatch = /(?<username>.*?):(?<password>.*)/\n .exec(atob(match.groups.parameters));\n if (!credentialsMatch?.groups) {\n throw new Error(`Malformed credentials.`);\n }\n return {\n scheme: 'Basic',\n username: credentialsMatch.groups.username,\n password: credentialsMatch.groups.password,\n };\n }\n throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);\n}\n\nexport function serializeHttpAuth(input: HttpAuth): string {\n if (input.scheme === 'Basic') {\n return `Basic ${btoa(`${input.username}:${input.password}`)}`;\n }\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n throw new Error(`Unsupported auth scheme: ${input.scheme}.`);\n}\n\nexport type HttpAuth = BasicHttpAuth;\n\nexport interface BasicHttpAuth {\n scheme: 'Basic';\n username: string;\n password: string;\n}\n"],"names":[],"mappings":";;AAAA;AAEM,SAAU,aAAa,CAAC,KAAa,EAAA;IACzC,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EAAE;QACrC,MAAM,gBAAgB,GAAG;aACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE;AAC7B,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,CAAwB,CAAC;QAC3C;QACA,OAAO;AACL,YAAA,MAAM,EAAE,OAAO;AACf,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;SAC3C;IACH;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,EAAE,MAAM,EAAE,MAAM,CAAA,CAAA,CAAG,CAAC;AACvE;AAEM,SAAU,iBAAiB,CAAC,KAAe,EAAA;AAC/C,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;AAC5B,QAAA,OAAO,CAAA,MAAA,EAAS,IAAI,CAAC,CAAA,EAAG,KAAK,CAAC,QAAQ,CAAA,CAAA,EAAI,KAAK,CAAC,QAAQ,CAAA,CAAE,CAAC,EAAE;IAC/D;;IAEA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,MAAM,CAAA,CAAA,CAAG,CAAC;AAC9D;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function parseHttpAuth(input: string): HttpAuth;
|
|
2
|
+
export declare function serializeHttpAuth(input: HttpAuth): string;
|
|
3
|
+
export type HttpAuth = BasicHttpAuth;
|
|
4
|
+
export interface BasicHttpAuth {
|
|
5
|
+
scheme: 'Basic';
|
|
6
|
+
username: string;
|
|
7
|
+
password: string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=httpAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpAuth.d.ts","sourceRoot":"","sources":["../src/httpAuth.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAerD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAMzD;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/httpAuth.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */
|
|
2
|
+
function parseHttpAuth(input) {
|
|
3
|
+
const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);
|
|
4
|
+
if (match?.groups?.scheme === 'Basic') {
|
|
5
|
+
const credentialsMatch = /(?<username>.*?):(?<password>.*)/
|
|
6
|
+
.exec(atob(match.groups.parameters));
|
|
7
|
+
if (!credentialsMatch?.groups) {
|
|
8
|
+
throw new Error(`Malformed credentials.`);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
scheme: 'Basic',
|
|
12
|
+
username: credentialsMatch.groups.username,
|
|
13
|
+
password: credentialsMatch.groups.password,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);
|
|
17
|
+
}
|
|
18
|
+
function serializeHttpAuth(input) {
|
|
19
|
+
if (input.scheme === 'Basic') {
|
|
20
|
+
return `Basic ${btoa(`${input.username}:${input.password}`)}`;
|
|
21
|
+
}
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
23
|
+
throw new Error(`Unsupported auth scheme: ${input.scheme}.`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { parseHttpAuth, serializeHttpAuth };
|
|
27
|
+
//# sourceMappingURL=httpAuth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpAuth.js","sources":["../src/httpAuth.ts"],"sourcesContent":["/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */\n\nexport function parseHttpAuth(input: string): HttpAuth {\n const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);\n if (match?.groups?.scheme === 'Basic') {\n const credentialsMatch = /(?<username>.*?):(?<password>.*)/\n .exec(atob(match.groups.parameters));\n if (!credentialsMatch?.groups) {\n throw new Error(`Malformed credentials.`);\n }\n return {\n scheme: 'Basic',\n username: credentialsMatch.groups.username,\n password: credentialsMatch.groups.password,\n };\n }\n throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);\n}\n\nexport function serializeHttpAuth(input: HttpAuth): string {\n if (input.scheme === 'Basic') {\n return `Basic ${btoa(`${input.username}:${input.password}`)}`;\n }\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n throw new Error(`Unsupported auth scheme: ${input.scheme}.`);\n}\n\nexport type HttpAuth = BasicHttpAuth;\n\nexport interface BasicHttpAuth {\n scheme: 'Basic';\n username: string;\n password: string;\n}\n"],"names":[],"mappings":"AAAA;AAEM,SAAU,aAAa,CAAC,KAAa,EAAA;IACzC,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EAAE;QACrC,MAAM,gBAAgB,GAAG;aACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE;AAC7B,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,CAAwB,CAAC;QAC3C;QACA,OAAO;AACL,YAAA,MAAM,EAAE,OAAO;AACf,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;SAC3C;IACH;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,EAAE,MAAM,EAAE,MAAM,CAAA,CAAA,CAAG,CAAC;AACvE;AAEM,SAAU,iBAAiB,CAAC,KAAe,EAAA;AAC/C,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;AAC5B,QAAA,OAAO,CAAA,MAAA,EAAS,IAAI,CAAC,CAAA,EAAG,KAAK,CAAC,QAAQ,CAAA,CAAA,EAAI,KAAK,CAAC,QAAQ,CAAA,CAAE,CAAC,EAAE;IAC/D;;IAEA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,MAAM,CAAA,CAAA,CAAG,CAAC;AAC9D;;;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var block_config = require('./bmodel/block_config.cjs');
|
|
4
|
+
var code = require('./bmodel/code.cjs');
|
|
4
5
|
var normalization = require('./bmodel/normalization.cjs');
|
|
5
6
|
var urls = require('./drivers/urls.cjs');
|
|
6
7
|
var blob = require('./drivers/blob.cjs');
|
|
@@ -29,10 +30,12 @@ var ref = require('./ref.cjs');
|
|
|
29
30
|
var value_or_error = require('./value_or_error.cjs');
|
|
30
31
|
var base64 = require('./base64.cjs');
|
|
31
32
|
var util = require('./util.cjs');
|
|
33
|
+
var httpAuth = require('./httpAuth.cjs');
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
exports.extractCodeWithInfo = block_config.extractCodeWithInfo;
|
|
38
|
+
exports.Code = code.Code;
|
|
36
39
|
exports.extractConfigGeneric = normalization.extractConfigGeneric;
|
|
37
40
|
exports.isBlockUIURL = urls.isBlockUIURL;
|
|
38
41
|
exports.isFolderURL = urls.isFolderURL;
|
|
@@ -153,4 +156,6 @@ exports.base64Decode = base64.base64Decode;
|
|
|
153
156
|
exports.base64Encode = base64.base64Encode;
|
|
154
157
|
exports.assertNever = util.assertNever;
|
|
155
158
|
exports.uniqueBy = util.uniqueBy;
|
|
159
|
+
exports.parseHttpAuth = httpAuth.parseHttpAuth;
|
|
160
|
+
exports.serializeHttpAuth = httpAuth.serializeHttpAuth;
|
|
156
161
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { extractCodeWithInfo } from './bmodel/block_config.js';
|
|
2
|
+
export { Code } from './bmodel/code.js';
|
|
2
3
|
export { extractConfigGeneric } from './bmodel/normalization.js';
|
|
3
4
|
export { isBlockUIURL, isFolderURL } from './drivers/urls.js';
|
|
4
5
|
export { RangeBytes, newRangeBytesOpt, validateRangeBytes } from './drivers/blob.js';
|
|
@@ -27,4 +28,5 @@ export { PlRef, createPlRef, isPlRef, plRefsEqual, withEnrichments } from './ref
|
|
|
27
28
|
export { mapValueInVOE } from './value_or_error.js';
|
|
28
29
|
export { base64Decode, base64Encode } from './base64.js';
|
|
29
30
|
export { assertNever, uniqueBy } from './util.js';
|
|
31
|
+
export { parseHttpAuth, serializeHttpAuth } from './httpAuth.js';
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "Platforma SDK Model",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"eslint": "^9.25.1",
|
|
26
26
|
"typescript": "~5.6.3",
|
|
27
27
|
"vitest": "^2.1.9",
|
|
28
|
-
"@milaboratories/build-configs": "1.0.8",
|
|
29
28
|
"@milaboratories/ts-builder": "1.0.5",
|
|
30
29
|
"@milaboratories/ts-configs": "1.0.6",
|
|
30
|
+
"@milaboratories/build-configs": "1.0.8",
|
|
31
31
|
"@platforma-sdk/eslint-config": "1.1.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
@@ -59,8 +59,8 @@ export type BlockConfigV3Generic<
|
|
|
59
59
|
|
|
60
60
|
export type BlockConfigGeneric = BlockConfigV3Generic;
|
|
61
61
|
|
|
62
|
-
export function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo
|
|
63
|
-
if (cfg.code === undefined)
|
|
62
|
+
export function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo {
|
|
63
|
+
if (cfg.code === undefined) throw new Error('No code bundle');
|
|
64
64
|
return {
|
|
65
65
|
code: cfg.code,
|
|
66
66
|
sdkVersion: cfg.sdkVersion,
|
package/src/bmodel/code.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { BlockCodeFeatureFlags } from '../flags';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
type: 'plain'
|
|
5
|
-
content: string
|
|
6
|
-
};
|
|
4
|
+
export const Code = z.object({
|
|
5
|
+
type: z.literal('plain'),
|
|
6
|
+
content: z.string(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Code = z.infer<typeof Code>;
|
|
7
10
|
|
|
8
11
|
export type BlockCodeWithInfo = {
|
|
9
12
|
readonly code: Code;
|
package/src/bmodel/container.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type BlockConfigContainer = {
|
|
|
7
7
|
/** Actual config */
|
|
8
8
|
readonly v3: Omit<BlockConfigV3Generic, 'code'>;
|
|
9
9
|
|
|
10
|
-
/** Config code bundle */
|
|
10
|
+
/** Config code bundle. Actually is required, but we keep it optional for backward compatibility */
|
|
11
11
|
readonly code?: Code;
|
|
12
12
|
|
|
13
13
|
//
|
package/src/httpAuth.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */
|
|
2
|
+
|
|
3
|
+
export function parseHttpAuth(input: string): HttpAuth {
|
|
4
|
+
const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);
|
|
5
|
+
if (match?.groups?.scheme === 'Basic') {
|
|
6
|
+
const credentialsMatch = /(?<username>.*?):(?<password>.*)/
|
|
7
|
+
.exec(atob(match.groups.parameters));
|
|
8
|
+
if (!credentialsMatch?.groups) {
|
|
9
|
+
throw new Error(`Malformed credentials.`);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
scheme: 'Basic',
|
|
13
|
+
username: credentialsMatch.groups.username,
|
|
14
|
+
password: credentialsMatch.groups.password,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function serializeHttpAuth(input: HttpAuth): string {
|
|
21
|
+
if (input.scheme === 'Basic') {
|
|
22
|
+
return `Basic ${btoa(`${input.username}:${input.password}`)}`;
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
25
|
+
throw new Error(`Unsupported auth scheme: ${input.scheme}.`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type HttpAuth = BasicHttpAuth;
|
|
29
|
+
|
|
30
|
+
export interface BasicHttpAuth {
|
|
31
|
+
scheme: 'Basic';
|
|
32
|
+
username: string;
|
|
33
|
+
password: string;
|
|
34
|
+
}
|
package/src/index.ts
CHANGED