@yappkit/front-module-map 0.1.0

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.
@@ -0,0 +1,237 @@
1
+ import { c as m } from "../_commonjsHelpers.js";
2
+ import { i as h, m as V, b as N } from "./browser-client.js";
3
+ var R = Object.prototype.toString, _ = function(r) {
4
+ var e;
5
+ return R.call(r) === "[object Object]" && (e = Object.getPrototypeOf(r), e === null || e === Object.getPrototypeOf({}));
6
+ }, E = _, M = h, A = "value", y = `
7
+ `, u = {};
8
+ u.assert = function(r, e) {
9
+ return e = e || {}, function(n) {
10
+ var t = c(r, n);
11
+ if (t) {
12
+ var a = v(t, e);
13
+ throw e.apiName && (a = e.apiName + ": " + a), new Error(a);
14
+ }
15
+ };
16
+ };
17
+ u.shape = function(e) {
18
+ var n = F(e);
19
+ return function(a) {
20
+ var i = c(u.plainObject, a);
21
+ if (i)
22
+ return i;
23
+ for (var o, s, f = [], p = 0; p < n.length; p++)
24
+ o = n[p].key, s = n[p].value, i = c(s, a[o]), i && f.push([o].concat(i));
25
+ return f.length < 2 ? f[0] : function(d) {
26
+ f = f.map(function(b) {
27
+ var S = b[0], q = v(b, d).split(`
28
+ `).join(y);
29
+ return "- " + S + ": " + q;
30
+ });
31
+ var g = d.path.join("."), w = g === A ? "" : " of " + g;
32
+ return "The following properties" + w + " have invalid values:" + y + f.join(y);
33
+ };
34
+ };
35
+ };
36
+ u.strictShape = function(e) {
37
+ var n = u.shape(e);
38
+ return function(a) {
39
+ var i = n(a);
40
+ if (i)
41
+ return i;
42
+ var o = Object.keys(a).reduce(function(s, f) {
43
+ return e[f] === void 0 && s.push(f), s;
44
+ }, []);
45
+ if (o.length !== 0)
46
+ return function() {
47
+ return "The following keys are invalid: " + o.join(", ");
48
+ };
49
+ };
50
+ };
51
+ u.arrayOf = function(e) {
52
+ return O(e);
53
+ };
54
+ u.tuple = function() {
55
+ var e = Array.isArray(arguments[0]) ? arguments[0] : Array.prototype.slice.call(arguments);
56
+ return O(e);
57
+ };
58
+ function O(r) {
59
+ var e = Array.isArray(r), n = function(t) {
60
+ return e ? r[t] : r;
61
+ };
62
+ return function(a) {
63
+ var i = c(u.plainArray, a);
64
+ if (i)
65
+ return i;
66
+ if (e && a.length !== r.length)
67
+ return "an array with " + r.length + " items";
68
+ for (var o = 0; o < a.length; o++)
69
+ if (i = c(n(o), a[o]), i)
70
+ return [o].concat(i);
71
+ };
72
+ }
73
+ u.required = function(e) {
74
+ function n(t) {
75
+ return t == null ? function(a) {
76
+ return j(
77
+ a,
78
+ T(a.path) ? "cannot be undefined/null." : "is required."
79
+ );
80
+ } : e.apply(this, arguments);
81
+ }
82
+ return n.__required = !0, n;
83
+ };
84
+ u.oneOfType = function() {
85
+ var e = Array.isArray(arguments[0]) ? arguments[0] : Array.prototype.slice.call(arguments);
86
+ return function(t) {
87
+ var a = e.map(function(i) {
88
+ return c(i, t);
89
+ }).filter(Boolean);
90
+ if (a.length === e.length)
91
+ return a.every(function(i) {
92
+ return i.length === 1 && typeof i[0] == "string";
93
+ }) ? k(
94
+ a.map(function(i) {
95
+ return i[0];
96
+ })
97
+ ) : a.reduce(function(i, o) {
98
+ return o.length > i.length ? o : i;
99
+ });
100
+ };
101
+ };
102
+ u.equal = function(e) {
103
+ return function(t) {
104
+ if (t !== e)
105
+ return JSON.stringify(e);
106
+ };
107
+ };
108
+ u.oneOf = function() {
109
+ var e = Array.isArray(arguments[0]) ? arguments[0] : Array.prototype.slice.call(arguments), n = e.map(function(t) {
110
+ return u.equal(t);
111
+ });
112
+ return u.oneOfType.apply(this, n);
113
+ };
114
+ u.range = function(e) {
115
+ var n = e[0], t = e[1];
116
+ return function(i) {
117
+ var o = c(u.number, i);
118
+ if (o || i < n || i > t)
119
+ return "number between " + n + " & " + t + " (inclusive)";
120
+ };
121
+ };
122
+ u.any = function() {
123
+ };
124
+ u.boolean = function(e) {
125
+ if (typeof e != "boolean")
126
+ return "boolean";
127
+ };
128
+ u.number = function(e) {
129
+ if (typeof e != "number")
130
+ return "number";
131
+ };
132
+ u.plainArray = function(e) {
133
+ if (!Array.isArray(e))
134
+ return "array";
135
+ };
136
+ u.plainObject = function(e) {
137
+ if (!E(e))
138
+ return "object";
139
+ };
140
+ u.string = function(e) {
141
+ if (typeof e != "string")
142
+ return "string";
143
+ };
144
+ u.func = function(e) {
145
+ if (typeof e != "function")
146
+ return "function";
147
+ };
148
+ function c(r, e) {
149
+ if (!(e == null && !r.hasOwnProperty("__required"))) {
150
+ var n = r(e);
151
+ if (n)
152
+ return Array.isArray(n) ? n : [n];
153
+ }
154
+ }
155
+ function v(r, e) {
156
+ var n = r.length, t = r[n - 1], a = r.slice(0, n - 1);
157
+ return a.length === 0 && (a = [A]), e = M(e, { path: a }), typeof t == "function" ? t(e) : j(e, B(t));
158
+ }
159
+ function k(r) {
160
+ return r.length < 2 ? r[0] : r.length === 2 ? r.join(" or ") : r.slice(0, -1).join(", ") + ", or " + r.slice(-1);
161
+ }
162
+ function B(r) {
163
+ return "must be " + C(r) + ".";
164
+ }
165
+ function C(r) {
166
+ return /^an? /.test(r) ? r : /^[aeiou]/i.test(r) ? "an " + r : /^[a-z]/i.test(r) ? "a " + r : r;
167
+ }
168
+ function j(r, e) {
169
+ var n = T(r.path), t = r.path.join(".") + " " + e, a = n ? "Item at position " : "";
170
+ return a + t;
171
+ }
172
+ function T(r) {
173
+ return typeof r[r.length - 1] == "number" || typeof r[0] == "number";
174
+ }
175
+ function F(r) {
176
+ return Object.keys(r || {}).map(function(e) {
177
+ return { key: e, value: r[e] };
178
+ });
179
+ }
180
+ u.validate = c;
181
+ u.processMessage = v;
182
+ var I = u, x = h, l = I;
183
+ function D(r) {
184
+ if (typeof window < "u")
185
+ return r instanceof m.Blob || r instanceof m.ArrayBuffer ? void 0 : "Blob or ArrayBuffer";
186
+ if (!(typeof r == "string" || r.pipe !== void 0))
187
+ return "Filename or Readable stream";
188
+ }
189
+ function L(r, e) {
190
+ return l.assert(l.strictShape(r), e);
191
+ }
192
+ function P(r) {
193
+ var e = "date";
194
+ if (typeof r == "boolean")
195
+ return e;
196
+ try {
197
+ var n = new Date(r);
198
+ if (n.getTime && isNaN(n.getTime()))
199
+ return e;
200
+ } catch {
201
+ return e;
202
+ }
203
+ }
204
+ function $(r) {
205
+ return l.tuple(l.number, l.number)(r);
206
+ }
207
+ var Q = x(l, {
208
+ file: D,
209
+ date: P,
210
+ coordinates: $,
211
+ assertShape: L
212
+ });
213
+ function z(r, e) {
214
+ var n = function(t, a) {
215
+ return e.indexOf(t) !== -1 && a !== void 0;
216
+ };
217
+ return typeof e == "function" && (n = e), Object.keys(r).filter(function(t) {
218
+ return n(t, r[t]);
219
+ }).reduce(function(t, a) {
220
+ return t[a] = r[a], t;
221
+ }, {});
222
+ }
223
+ var X = z, G = V, H = N;
224
+ function J(r) {
225
+ return function(e) {
226
+ var n;
227
+ G.prototype.isPrototypeOf(e) ? n = e : n = H(e);
228
+ var t = Object.create(r);
229
+ return t.client = n, t;
230
+ };
231
+ }
232
+ var Y = J;
233
+ export {
234
+ Y as c,
235
+ X as p,
236
+ Q as v
237
+ };
@@ -0,0 +1,123 @@
1
+ import { g as p } from "../_commonjsHelpers.js";
2
+ import { c as h, v as c, p as I } from "./create-service-factory.js";
3
+ function m(t, n) {
4
+ for (var i = 0; i < n.length; i++) {
5
+ const s = n[i];
6
+ if (typeof s != "string" && !Array.isArray(s)) {
7
+ for (const d in s)
8
+ if (d !== "default" && !(d in t)) {
9
+ const u = Object.getOwnPropertyDescriptor(s, d);
10
+ u && Object.defineProperty(t, d, u.get ? u : {
11
+ enumerable: !0,
12
+ get: () => s[d]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var e = c, r = I, f = h, a = {};
20
+ a.listDatasets = function(t) {
21
+ return e.assertShape({
22
+ sortby: e.oneOf("created", "modified")
23
+ })(t), this.client.createRequest({
24
+ method: "GET",
25
+ path: "/datasets/v1/:ownerId",
26
+ query: t ? r(t, ["sortby"]) : {}
27
+ });
28
+ };
29
+ a.createDataset = function(t) {
30
+ return e.assertShape({
31
+ name: e.string,
32
+ description: e.string
33
+ })(t), this.client.createRequest({
34
+ method: "POST",
35
+ path: "/datasets/v1/:ownerId",
36
+ body: t
37
+ });
38
+ };
39
+ a.getMetadata = function(t) {
40
+ return e.assertShape({
41
+ datasetId: e.required(e.string),
42
+ description: e.string
43
+ })(t), this.client.createRequest({
44
+ method: "GET",
45
+ path: "/datasets/v1/:ownerId/:datasetId",
46
+ params: t
47
+ });
48
+ };
49
+ a.updateMetadata = function(t) {
50
+ return e.assertShape({
51
+ datasetId: e.required(e.string),
52
+ name: e.string,
53
+ description: e.string
54
+ })(t), this.client.createRequest({
55
+ method: "PATCH",
56
+ path: "/datasets/v1/:ownerId/:datasetId",
57
+ params: r(t, ["datasetId"]),
58
+ body: r(t, ["name", "description"])
59
+ });
60
+ };
61
+ a.deleteDataset = function(t) {
62
+ return e.assertShape({
63
+ datasetId: e.required(e.string)
64
+ })(t), this.client.createRequest({
65
+ method: "DELETE",
66
+ path: "/datasets/v1/:ownerId/:datasetId",
67
+ params: t
68
+ });
69
+ };
70
+ a.listFeatures = function(t) {
71
+ return e.assertShape({
72
+ datasetId: e.required(e.string),
73
+ limit: e.number,
74
+ start: e.string
75
+ })(t), this.client.createRequest({
76
+ method: "GET",
77
+ path: "/datasets/v1/:ownerId/:datasetId/features",
78
+ params: r(t, ["datasetId"]),
79
+ query: r(t, ["limit", "start"])
80
+ });
81
+ };
82
+ a.putFeature = function(t) {
83
+ if (e.assertShape({
84
+ datasetId: e.required(e.string),
85
+ featureId: e.required(e.string),
86
+ feature: e.required(e.plainObject)
87
+ })(t), t.feature.id !== void 0 && t.feature.id !== t.featureId)
88
+ throw new Error("featureId must match the id property of the feature");
89
+ return this.client.createRequest({
90
+ method: "PUT",
91
+ path: "/datasets/v1/:ownerId/:datasetId/features/:featureId",
92
+ params: r(t, ["datasetId", "featureId"]),
93
+ body: t.feature
94
+ });
95
+ };
96
+ a.getFeature = function(t) {
97
+ return e.assertShape({
98
+ datasetId: e.required(e.string),
99
+ featureId: e.required(e.string)
100
+ })(t), this.client.createRequest({
101
+ method: "GET",
102
+ path: "/datasets/v1/:ownerId/:datasetId/features/:featureId",
103
+ params: t
104
+ });
105
+ };
106
+ a.deleteFeature = function(t) {
107
+ return e.assertShape({
108
+ datasetId: e.required(e.string),
109
+ featureId: e.required(e.string)
110
+ })(t), this.client.createRequest({
111
+ method: "DELETE",
112
+ path: "/datasets/v1/:ownerId/:datasetId/features/:featureId",
113
+ params: t
114
+ });
115
+ };
116
+ var o = f(a);
117
+ const l = /* @__PURE__ */ p(o), y = /* @__PURE__ */ m({
118
+ __proto__: null,
119
+ default: l
120
+ }, [o]);
121
+ export {
122
+ y as d
123
+ };
@@ -0,0 +1,155 @@
1
+ import { g as c } from "../_commonjsHelpers.js";
2
+ import { c as u, v } from "./create-service-factory.js";
3
+ import { o as g } from "./object-clean.js";
4
+ import { s as m } from "./stringify-booleans.js";
5
+ function d(r, a) {
6
+ for (var o = 0; o < a.length; o++) {
7
+ const i = a[o];
8
+ if (typeof i != "string" && !Array.isArray(i)) {
9
+ for (const t in i)
10
+ if (t !== "default" && !(t in r)) {
11
+ const n = Object.getOwnPropertyDescriptor(i, t);
12
+ n && Object.defineProperty(r, t, n.get ? n : {
13
+ enumerable: !0,
14
+ get: () => i[t]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
20
+ }
21
+ var e = v, h = u, l = g, p = m, s = {};
22
+ s.getDirections = function(r) {
23
+ e.assertShape({
24
+ profile: e.oneOf("driving-traffic", "driving", "walking", "cycling"),
25
+ waypoints: e.required(
26
+ e.arrayOf(
27
+ e.shape({
28
+ coordinates: e.required(e.coordinates),
29
+ approach: e.oneOf("unrestricted", "curb"),
30
+ bearing: e.arrayOf(e.range([0, 360])),
31
+ radius: e.oneOfType(e.number, e.equal("unlimited")),
32
+ waypointName: e.string
33
+ })
34
+ )
35
+ ),
36
+ alternatives: e.boolean,
37
+ annotations: e.arrayOf(
38
+ e.oneOf(
39
+ "duration",
40
+ "distance",
41
+ "speed",
42
+ "congestion",
43
+ "congestion_numeric",
44
+ "max_speed",
45
+ "closure",
46
+ "state_of_charge"
47
+ )
48
+ ),
49
+ bannerInstructions: e.boolean,
50
+ continueStraight: e.boolean,
51
+ exclude: e.string,
52
+ geometries: e.string,
53
+ language: e.string,
54
+ overview: e.string,
55
+ roundaboutExits: e.boolean,
56
+ steps: e.boolean,
57
+ voiceInstructions: e.boolean,
58
+ voiceUnits: e.string,
59
+ engine: e.string,
60
+ ev_initial_charge: e.number,
61
+ ev_max_charge: e.number,
62
+ ev_connector_types: e.string,
63
+ energy_consumption_curve: e.string,
64
+ ev_charging_curve: e.string,
65
+ ev_unconditioned_charging_curve: e.string,
66
+ ev_pre_conditioning_time: e.number,
67
+ ev_max_ac_charging_power: e.number,
68
+ ev_min_charge_at_destination: e.number,
69
+ ev_min_charge_at_charging_station: e.number,
70
+ auxiliary_consumption: e.number,
71
+ maxHeight: e.number,
72
+ maxWidth: e.number,
73
+ maxWeight: e.number,
74
+ notifications: e.string,
75
+ departAt: e.string,
76
+ arriveBy: e.string
77
+ })(r), r.profile = r.profile || "driving";
78
+ var a = {
79
+ coordinates: [],
80
+ approach: [],
81
+ bearing: [],
82
+ radius: [],
83
+ waypointName: []
84
+ }, o = r.waypoints.length;
85
+ if (o < 2 || o > 25)
86
+ throw new Error(
87
+ "waypoints must include between 2 and 25 DirectionsWaypoints"
88
+ );
89
+ r.waypoints.forEach(function(t) {
90
+ a.coordinates.push(
91
+ t.coordinates[0] + "," + t.coordinates[1]
92
+ ), ["bearing"].forEach(function(n) {
93
+ t.hasOwnProperty(n) && t[n] != null && (t[n] = t[n].join(","));
94
+ }), ["approach", "bearing", "radius", "waypointName"].forEach(function(n) {
95
+ t.hasOwnProperty(n) && t[n] != null ? a[n].push(t[n]) : a[n].push("");
96
+ });
97
+ }), ["approach", "bearing", "radius", "waypointName"].forEach(function(t) {
98
+ a[t].every(function(n) {
99
+ return n === "";
100
+ }) ? delete a[t] : a[t] = a[t].join(";");
101
+ });
102
+ var i = p({
103
+ alternatives: r.alternatives,
104
+ annotations: r.annotations,
105
+ banner_instructions: r.bannerInstructions,
106
+ continue_straight: r.continueStraight,
107
+ exclude: r.exclude,
108
+ geometries: r.geometries,
109
+ language: r.language,
110
+ overview: r.overview,
111
+ roundabout_exits: r.roundaboutExits,
112
+ steps: r.steps,
113
+ voice_instructions: r.voiceInstructions,
114
+ voice_units: r.voiceUnits,
115
+ approaches: a.approach,
116
+ bearings: a.bearing,
117
+ radiuses: a.radius,
118
+ waypoint_names: a.waypointName,
119
+ engine: r.engine,
120
+ ev_initial_charge: r.ev_initial_charge,
121
+ ev_max_charge: r.ev_max_charge,
122
+ ev_connector_types: r.ev_connector_types,
123
+ energy_consumption_curve: r.energy_consumption_curve,
124
+ ev_charging_curve: r.ev_charging_curve,
125
+ ev_unconditioned_charging_curve: r.ev_unconditioned_charging_curve,
126
+ ev_pre_conditioning_time: r.ev_pre_conditioning_time,
127
+ ev_max_ac_charging_power: r.ev_max_ac_charging_power,
128
+ ev_min_charge_at_destination: r.ev_min_charge_at_destination,
129
+ ev_min_charge_at_charging_station: r.ev_min_charge_at_charging_station,
130
+ auxiliary_consumption: r.auxiliary_consumption,
131
+ max_height: r.maxHeight,
132
+ max_width: r.maxWidth,
133
+ max_weight: r.maxWeight,
134
+ notifications: r.notifications,
135
+ depart_at: r.departAt,
136
+ arrive_by: r.arriveBy
137
+ });
138
+ return this.client.createRequest({
139
+ method: "GET",
140
+ path: "/directions/v5/mapbox/:profile/:coordinates",
141
+ params: {
142
+ profile: r.profile,
143
+ coordinates: a.coordinates.join(";")
144
+ },
145
+ query: l(i)
146
+ });
147
+ };
148
+ var _ = h(s);
149
+ const b = /* @__PURE__ */ c(_), O = /* @__PURE__ */ d({
150
+ __proto__: null,
151
+ default: b
152
+ }, [_]);
153
+ export {
154
+ O as d
155
+ };
@@ -0,0 +1,129 @@
1
+ import { g as m } from "../_commonjsHelpers.js";
2
+ import { i as p } from "./browser-client.js";
3
+ import { c as y, v as b, p as v } from "./create-service-factory.js";
4
+ import { s as f } from "./stringify-booleans.js";
5
+ function h(r, t) {
6
+ for (var n = 0; n < t.length; n++) {
7
+ const o = t[n];
8
+ if (typeof o != "string" && !Array.isArray(o)) {
9
+ for (const a in o)
10
+ if (a !== "default" && !(a in r)) {
11
+ const s = Object.getOwnPropertyDescriptor(o, a);
12
+ s && Object.defineProperty(r, a, s.get ? s : {
13
+ enumerable: !0,
14
+ get: () => o[a]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
20
+ }
21
+ var i = p, e = b, d = v, l = f, O = y, u = {}, c = [
22
+ "street",
23
+ "country",
24
+ "region",
25
+ "postcode",
26
+ "district",
27
+ "place",
28
+ "locality",
29
+ "neighborhood",
30
+ "address"
31
+ ];
32
+ u.forwardGeocode = function(r) {
33
+ r.mode = r.mode || "standard", e.assertShape(
34
+ i(r.mode === "standard" ? { query: e.required(e.string) } : {}, {
35
+ mode: e.oneOf("standard", "structured"),
36
+ countries: r.mode === "standard" ? e.arrayOf(e.string) : e.string,
37
+ proximity: e.oneOf(e.coordinates, "ip"),
38
+ types: e.arrayOf(e.oneOf(c)),
39
+ bbox: e.arrayOf(e.number),
40
+ format: e.oneOf("geojson", "v5"),
41
+ language: e.string,
42
+ limit: e.number,
43
+ worldview: e.string,
44
+ autocomplete: e.boolean,
45
+ permanent: e.boolean,
46
+ // structured input fields
47
+ address_line1: e.string,
48
+ address_number: e.string,
49
+ street: e.string,
50
+ block: e.string,
51
+ place: e.string,
52
+ region: e.string,
53
+ neighborhood: e.string,
54
+ postcode: e.string,
55
+ locality: e.string
56
+ })
57
+ )(r);
58
+ var t = l(
59
+ i(
60
+ r.mode === "standard" ? { q: r.query } : d(r, [
61
+ "address_line1",
62
+ "address_number",
63
+ "street",
64
+ "block",
65
+ "place",
66
+ "region",
67
+ "neighborhood",
68
+ "postcode",
69
+ "locality"
70
+ ]),
71
+ { country: r.countries },
72
+ d(r, [
73
+ "proximity",
74
+ "types",
75
+ "bbox",
76
+ "format",
77
+ "language",
78
+ "limit",
79
+ "worldview",
80
+ "autocomplete",
81
+ "permanent"
82
+ ])
83
+ )
84
+ );
85
+ return this.client.createRequest({
86
+ method: "GET",
87
+ path: "/search/geocode/v6/forward",
88
+ query: t
89
+ });
90
+ };
91
+ u.reverseGeocode = function(r) {
92
+ e.assertShape({
93
+ longitude: e.required(e.number),
94
+ latitude: e.required(e.number),
95
+ countries: e.arrayOf(e.string),
96
+ types: e.arrayOf(e.oneOf(c)),
97
+ limit: e.number,
98
+ language: e.string,
99
+ worldview: e.string,
100
+ permanent: e.boolean
101
+ })(r);
102
+ var t = l(
103
+ i(
104
+ { country: r.countries },
105
+ d(r, [
106
+ "longitude",
107
+ "latitude",
108
+ "types",
109
+ "limit",
110
+ "language",
111
+ "worldview",
112
+ "permanent"
113
+ ])
114
+ )
115
+ );
116
+ return this.client.createRequest({
117
+ method: "GET",
118
+ path: "/search/geocode/v6/reverse",
119
+ query: t
120
+ });
121
+ };
122
+ var g = O(u);
123
+ const q = /* @__PURE__ */ m(g), S = /* @__PURE__ */ h({
124
+ __proto__: null,
125
+ default: q
126
+ }, [g]);
127
+ export {
128
+ S as g
129
+ };