@datapos/datapos-shared 0.3.394 → 0.3.396

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.
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_LOCALE_CODE as a } from "./datapos-shared.es.js";
2
- import { componentConfigSchema as s } from "./datapos-shared.es.js";
3
- const r = [
2
+ import { componentConfigSchema as d } from "./datapos-shared.es.js";
3
+ const n = [
4
4
  { id: "alpha", color: "red", labels: { "en-gb": "alpha" } },
5
5
  { id: "beta", color: "amber", labels: { "en-gb": "beta" } },
6
6
  { id: "generalAvailability", color: "green", labels: { "en-gb": "" } },
@@ -11,16 +11,15 @@ const r = [
11
11
  { id: "unavailable", color: "other", labels: { "en-gb": "unavailable" } },
12
12
  { id: "underReview", color: "other", labels: { "en-gb": "under-review" } }
13
13
  ];
14
- function b(l, n = a) {
15
- console.log(1111, r);
16
- const e = r.find((o) => o.id === l);
14
+ function b(l, r = a) {
15
+ const e = n.find((o) => o.id === l);
17
16
  if (e) {
18
- const o = e.labels[n] ?? e.labels[a] ?? e.id;
17
+ const o = e.labels[r] ?? e.labels[a] ?? e.id;
19
18
  return { id: e.id, color: e.color, label: o };
20
19
  }
21
20
  return { id: l, color: "other", label: l };
22
21
  }
23
22
  export {
24
- s as componentConfigSchema,
23
+ d as componentConfigSchema,
25
24
  b as getComponentStatus
26
25
  };
@@ -1,9 +1,27 @@
1
- import { connectorConfigSchema as r } from "./datapos-shared.es.js";
2
- const e = (a) => {
3
- const t = Object.entries(a).filter((n) => typeof n[1] == "string");
4
- return new Map(t);
1
+ import { DEFAULT_LOCALE_CODE as a } from "./datapos-shared.es.js";
2
+ import { connectorConfigSchema as g } from "./datapos-shared.es.js";
3
+ const n = (t) => {
4
+ const o = Object.entries(t).filter((e) => typeof e[1] == "string");
5
+ return new Map(o);
6
+ }, i = [
7
+ { id: "application", labels: n({ "en-gb": "Application" }) },
8
+ { id: "curatedDataset", labels: n({ "en-gb": "Curated Dataset" }) },
9
+ { id: "database", labels: n({ "en-gb": "Database" }) },
10
+ { id: "fileStore", labels: n({ "en-gb": "File Store" }) }
11
+ ], l = (t, o, e = a) => {
12
+ const r = t.get(o);
13
+ if (r !== void 0) return r;
14
+ if (e !== o)
15
+ return t.get(e);
16
+ }, c = (t, o = a) => {
17
+ const e = i.find((r) => r.id === t);
18
+ if (e) {
19
+ const r = l(e.labels, o);
20
+ return { id: e.id, label: r ?? e.id };
21
+ }
22
+ return { id: t, label: t };
5
23
  };
6
- e({ "en-gb": "Application" }), e({ "en-gb": "Curated Dataset" }), e({ "en-gb": "Database" }), e({ "en-gb": "File Store" });
7
24
  export {
8
- r as connectorConfigSchema
25
+ g as connectorConfigSchema,
26
+ c as getConnectorCategory
9
27
  };
@@ -2,8 +2,8 @@ import { InferOutput } from 'valibot';
2
2
  import { Component } from '..';
3
3
  import { connectorConfigSchema } from './connectorConfig.schema';
4
4
  import { ToolConfig } from '../tool';
5
- import { ConnectionConfig, ConnectionDescription, ConnectionNodeConfig } from './connection';
6
5
  import { ValueDelimiterId } from '../dataView';
6
+ import { ConnectionConfig, ConnectionDescription, ConnectionNodeConfig } from './connection';
7
7
  /** Authentication method identifiers supported by a connector implementation. */
8
8
  /** Connector implementation. */
9
9
  /** Category identifiers used for grouping and filtering connectors. */
@@ -36,6 +36,15 @@ interface Connector extends Component {
36
36
  retrieveRecords?(connector: Connector, settings: RetrieveRecordsSettings, chunk: (records: (string[] | Record<string, unknown>)[]) => void, complete: (result: RetrieveRecordsSummary) => void): Promise<void>;
37
37
  upsertRecords?(connector: Connector, settings: UpsertSettings): Promise<void>;
38
38
  }
39
+ interface ConnectorCallbackData {
40
+ typeId: string;
41
+ properties: Record<string, unknown>;
42
+ }
43
+ interface ConnectorOperationSettings {
44
+ accountId?: string;
45
+ appCheckToken?: string;
46
+ sessionAccessToken?: string;
47
+ }
39
48
  /** Get readable stream result and settings. */
40
49
  interface GetReadableStreamResult {
41
50
  readable?: ReadableStream<unknown>;
@@ -44,11 +53,6 @@ interface GetReadableStreamSettings extends ConnectorOperationSettings {
44
53
  id: string;
45
54
  path: string;
46
55
  }
47
- interface ConnectorOperationSettings {
48
- accountId?: string;
49
- appCheckToken?: string;
50
- sessionAccessToken?: string;
51
- }
52
56
  interface CreateSettings extends ConnectorOperationSettings {
53
57
  accountId?: string;
54
58
  path: string;
@@ -138,11 +142,14 @@ interface UpsertSettings extends ConnectorOperationSettings {
138
142
  records: Record<string, unknown>[];
139
143
  path: string;
140
144
  }
141
- interface ConnectorCallbackData {
142
- typeId: string;
143
- properties: Record<string, unknown>;
145
+ /** Types/Interfaces/Operations - Connector category. */
146
+ interface ConnectorCategory {
147
+ id: string;
148
+ label: string;
144
149
  }
150
+ declare const getConnectorCategory: (id: string, localeId?: import('../../index').LocaleCode) => ConnectorCategory;
145
151
  /** Exports. */
152
+ export { getConnectorCategory };
146
153
  export type { ConnectionColumnConfig, ConnectionConfig, ConnectionNodeConfig, Encoding, UsageTypeId } from './connection';
147
154
  export type { Connector, ConnectorCallbackData, ConnectorConfig, ConnectorLocalisedConfig, ConnectorOperationSettings };
148
155
  export type { CreateSettings, DropSettings, FindResult, FindSettings, GetReadableStreamResult, GetReadableStreamSettings, GetRecordResult, GetRecordSettings, ListResult, ListSettings, PreviewResult, PreviewSettings, RemoveSettings, RetrieveChunksResult, RetrieveChunksSettings, RetrieveChunksSummary, RetrieveRecordsResult, RetrieveRecordsSettings, RetrieveRecordsSummary, UpsertSettings };
@@ -1,5 +1,5 @@
1
1
  import { InferOutput } from 'valibot';
2
- import { componentConfigSchema, componentReferenceSchema, componentStatusColorIdSchema, componentStatusIdSchema, componentStatusSchema, componentTypeIdSchema } from './componentConfig.schema';
2
+ import { componentConfigSchema, componentStatusSchema } from './componentConfig.schema';
3
3
  import { LocaleCode } from '../index';
4
4
  /** Component. */
5
5
  interface Component {
@@ -7,14 +7,10 @@ interface Component {
7
7
  }
8
8
  /** */
9
9
  type ComponentConfig = InferOutput<typeof componentConfigSchema>;
10
- type ComponentReference = InferOutput<typeof componentReferenceSchema>;
11
10
  type ComponentStatus = InferOutput<typeof componentStatusSchema>;
12
- type ComponentStatusColorId = InferOutput<typeof componentStatusColorIdSchema>;
13
- type ComponentStatusId = InferOutput<typeof componentStatusIdSchema>;
14
- type ComponentTypeId = InferOutput<typeof componentTypeIdSchema>;
15
11
  declare function getComponentStatus(id: string, localeId?: LocaleCode): ComponentStatus;
16
12
  /** Exports */
17
13
  export { getComponentStatus };
18
14
  export { componentConfigSchema } from './componentConfig.schema';
19
- export type { Component, ComponentConfig, ComponentReference, ComponentStatus, ComponentStatusId, ComponentTypeId, ComponentStatusColorId };
15
+ export type { Component, ComponentConfig };
20
16
  export type { ModuleConfig, ModuleTypeId } from './module';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-shared",
3
- "version": "0.3.394",
3
+ "version": "0.3.396",
4
4
  "description": "A library containing common constants, types and utilities used across all Data Positioning projects.",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Terrell <terrell.jm@gmail.com>",