commandbar 1.3.1 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/build/commandbar-js/src/index.d.ts +10 -0
  2. package/build/commandbar-js/src/index.js +1 -0
  3. package/build/commandbar-js/src/init.d.ts +17 -0
  4. package/build/commandbar-js/src/snippet.d.ts +1 -0
  5. package/build/internal/src/client/AddContextOptions.d.ts +57 -0
  6. package/build/internal/src/client/CommandBarClientSDK.d.ts +182 -0
  7. package/build/internal/src/client/CommandBarProxySDK.d.ts +48 -0
  8. package/build/internal/src/client/CommandBarSDK.d.ts +42 -0
  9. package/build/internal/src/client/EventHandler.d.ts +54 -0
  10. package/build/internal/src/client/Reporting.d.ts +1 -0
  11. package/build/internal/src/client/SDKConfig.d.ts +7 -0
  12. package/build/internal/src/client/SentryReporter.d.ts +41 -0
  13. package/build/internal/src/client/proxy.d.ts +15 -0
  14. package/build/internal/src/client/symbols.d.ts +27 -0
  15. package/build/internal/src/middleware/CommandFromClientV.d.ts +128 -0
  16. package/build/internal/src/middleware/ICommandFromClientType.d.ts +3 -0
  17. package/build/internal/src/middleware/IResourceSettings.d.ts +3 -0
  18. package/build/internal/src/middleware/OrganizationV.d.ts +42 -0
  19. package/build/internal/src/middleware/ResourceSettingsV.d.ts +33 -0
  20. package/build/internal/src/middleware/helpers/argument.d.ts +404 -0
  21. package/build/internal/src/middleware/helpers/commandTemplate.d.ts +129 -0
  22. package/build/internal/src/util/Disposable.d.ts +17 -0
  23. package/package.json +12 -14
  24. package/scripts/minify-snippet.ts +36 -0
  25. package/scripts/watch.ts +5 -0
  26. package/src/index.ts +11 -2
  27. package/src/init.ts +29 -88
  28. package/src/snippet.ts +57 -45
  29. package/tsconfig.json +5 -3
  30. package/webpack.config.js +8 -13
  31. package/yarn-error.log +20216 -0
  32. package/build/commandbar.d.ts +0 -67
  33. package/build/commandbar.d.ts.map +0 -1
  34. package/build/commandbar.js +0 -3
  35. package/build/commandbar.js.map +0 -1
  36. package/build/index.d.ts +0 -3
  37. package/build/index.d.ts.map +0 -1
  38. package/build/index.js +0 -27
  39. package/build/index.js.map +0 -1
  40. package/build/init.d.ts +0 -17
  41. package/build/init.d.ts.map +0 -1
  42. package/build/init.js +0 -116
  43. package/build/init.js.map +0 -1
  44. package/build/snippet.d.ts +0 -2
  45. package/build/snippet.d.ts.map +0 -1
  46. package/build/snippet.js +0 -55
  47. package/build/snippet.js.map +0 -1
  48. package/src/commandbar.ts +0 -76
@@ -1,67 +0,0 @@
1
- declare type BootParam = string | {
2
- id: string;
3
- [variable: string]: any;
4
- };
5
- export interface CommandBarClientAPI {
6
- dispose: () => void;
7
- config: (uuid: string) => void;
8
- boot: (id?: BootParam, eventMeta?: {
9
- [key: string]: any;
10
- }) => void;
11
- shutdown: () => void;
12
- reloadCommands: () => void;
13
- configUser: () => Promise<void>;
14
- setContext: (context: {
15
- [variable: string]: any;
16
- }, meta?: any) => void;
17
- reloadOrganization: () => void;
18
- addContext: (objOrKey: any, initialValue: any, meta: any) => void;
19
- addSearch: (name: string, func: (...args: any[]) => any, _opts?: any) => void;
20
- addCallback: (name: string, func: (...args: any[]) => any) => void;
21
- addCallbacks: (callbacks: {
22
- [name: string]: (...args: any[]) => any;
23
- }) => void;
24
- addEventHandler: (func: (eventName: string, attrs: Record<string, any>) => void) => void;
25
- addEventCallback: (eventName: string, preview?: boolean) => void;
26
- addCommand: (command: any) => void;
27
- removeCommand: (name: string) => void;
28
- removeCallback: (name: string) => void;
29
- addRouter: (func: (route: string) => void) => void;
30
- setDashboard: (element: HTMLElement) => void;
31
- setTestMode: (on: boolean) => void;
32
- setPreviewMode: (on: boolean) => void;
33
- setActiveObject: (contextKey: string, objectLabel: string | string[], categoryName?: string) => void;
34
- clearActiveObject: (contextKey: string) => void;
35
- loadEditor: () => void;
36
- onboard: () => void;
37
- open: (input?: string, options?: {
38
- categoryFilter?: number;
39
- }) => void;
40
- close: () => void;
41
- setTheme: (theme: string) => void;
42
- shareContext: () => any;
43
- shareCallbacks: () => any;
44
- execute: (id: number | string) => void;
45
- configuration: {
46
- uuid?: string;
47
- api: string;
48
- editor: string;
49
- proxy: string;
50
- session: string;
51
- };
52
- _disposed: boolean | undefined;
53
- _org: string | undefined;
54
- _session: string;
55
- _search: string;
56
- _user: string | undefined;
57
- _config: any;
58
- _eventMeta: Record<any, any> | undefined;
59
- uid: string;
60
- }
61
- declare global {
62
- interface Window {
63
- CommandBar: CommandBarClientAPI;
64
- }
65
- }
66
- export {};
67
- //# sourceMappingURL=commandbar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandbar.d.ts","sourceRoot":"","sources":["../src/commandbar.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,SAAS,GAClB,MAAM,GACN;IACE,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB,CAAC;AACN,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,IAAI,EAAE,CACJ,EAAE,CAAC,EAAE,SAAS,EACd,SAAS,CAAC,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,KACE,IAAI,CAAC;IACV,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,UAAU,EAAE,CACV,OAAO,EAAE;QACP,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;KACzB,EACD,IAAI,CAAC,EAAE,GAAG,KACP,IAAI,CAAC;IACV,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,UAAU,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAClE,SAAS,EAAE,CAAC,IAAI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{"version":3,"file":"commandbar.js","sourceRoot":"","sources":["../src/commandbar.ts"],"names":[],"mappings":""}
package/build/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import init, { initProxy, presentSnippet } from './init';
2
- export { init, initProxy, presentSnippet };
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
package/build/index.js DELETED
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.presentSnippet = exports.initProxy = exports.init = void 0;
23
- var init_1 = __importStar(require("./init"));
24
- exports.init = init_1.default;
25
- Object.defineProperty(exports, "initProxy", { enumerable: true, get: function () { return init_1.initProxy; } });
26
- Object.defineProperty(exports, "presentSnippet", { enumerable: true, get: function () { return init_1.presentSnippet; } });
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyD;AAEhD,eAFF,cAAI,CAEE;AAAE,0FAFA,gBAAS,OAEA;AAAE,+FAFA,qBAAc,OAEA"}
package/build/init.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { CommandBarClientAPI } from './commandbar';
2
- declare global {
3
- interface String {
4
- interpolate(templates: {
5
- [k: string]: string;
6
- }): string;
7
- }
8
- }
9
- interface IInitOptions {
10
- debug?: boolean;
11
- version?: string;
12
- }
13
- export declare const initProxy: () => CommandBarClientAPI;
14
- declare const init: (org: string, opts?: IInitOptions) => void;
15
- export declare const presentSnippet: (org: string) => string;
16
- export default init;
17
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,SAAS,EAAE;YAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,GAAG,MAAM,CAAC;KACzD;CACF;AAgBD,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AASD,eAAO,MAAM,SAAS,2BA0BrB,CAAC;AA2CF,QAAA,MAAM,IAAI,QAAS,MAAM,SAAQ,YAAY,SAe5C,CAAC;AAEF,eAAO,MAAM,cAAc,QAAS,MAAM,WAYzC,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/build/init.js DELETED
@@ -1,116 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
14
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
15
- to[j] = from[i];
16
- return to;
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.presentSnippet = exports.initProxy = void 0;
20
- var snippet_1 = require("./snippet");
21
- // eslint-disable-next-line no-extend-native
22
- String.prototype.interpolate = function (params) {
23
- var names = Object.keys(params);
24
- var vals = Object.values(params);
25
- // eslint-disable-next-line no-new-func
26
- return new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], names), ["return `" + this + "`;"])))().apply(void 0, vals);
27
- };
28
- var prepareSnippet = function (snippetString, templates) {
29
- var s = snippetString.interpolate(templates);
30
- s = '!(' + s + ')();';
31
- return s;
32
- };
33
- // eslint-disable-next-line @typescript-eslint/ban-types
34
- var hasProp = function (target, prop) { return prop in target; };
35
- var initProxy = function () {
36
- var _a;
37
- if (window.CommandBar === undefined || window.CommandBar._disposed === true) {
38
- // @ts-expect-error: Temporarily ignore CommandBarProxy definition
39
- var existingQueue = Array.isArray((_a = window.CommandBar) === null || _a === void 0 ? void 0 : _a.q) ? __spreadArray([], window.CommandBar.q) : [];
40
- existingQueue = existingQueue.filter(function (item) {
41
- return item.length > 0 && item[0] !== 'dispose';
42
- });
43
- var cb_1 = {
44
- q: existingQueue,
45
- };
46
- window.CommandBar = new Proxy(cb_1, {
47
- get: function (_, prop) {
48
- if (hasProp(cb_1, prop))
49
- return cb_1[prop];
50
- return function () {
51
- // eslint-disable-next-line prefer-rest-params
52
- var a = Array.prototype.slice.call(arguments);
53
- a.unshift(prop);
54
- cb_1.q.push(a);
55
- };
56
- },
57
- });
58
- }
59
- return window.CommandBar;
60
- };
61
- exports.initProxy = initProxy;
62
- var getSrc = function (org, version) {
63
- var origin = 'https://api.commandbar.com';
64
- var params = [];
65
- var lc = localStorage.getItem('commandbar.lc');
66
- if (lc && lc.includes('local')) {
67
- // for debugging purposes
68
- origin = 'http://localhost:8000';
69
- }
70
- var src = origin + '/latest/' + org;
71
- if (lc) {
72
- params.push('lc=' + lc);
73
- }
74
- if (!!version) {
75
- params.push('v=' + version);
76
- }
77
- src = src + '?' + params.join('&');
78
- return src;
79
- };
80
- // eslint-disable-next-line @typescript-eslint/no-empty-function
81
- var loadOrg = function () { };
82
- var loadLatest = function (org) {
83
- var src = getSrc(org);
84
- var el = document.createElement('script');
85
- el.type = 'text/javascript';
86
- el.async = true;
87
- el.src = src;
88
- document.head.appendChild(el);
89
- window.removeEventListener('load', loadOrg, false);
90
- };
91
- var DEFAULT_OPTS = { debug: false, version: '' };
92
- var init = function (org, opts) {
93
- if (opts === void 0) { opts = DEFAULT_OPTS; }
94
- var config = __assign(__assign({}, DEFAULT_OPTS), opts);
95
- if (!org) {
96
- console.error('No org specified for CommandBar.init');
97
- return;
98
- }
99
- config.debug && console.log('CommandBar init...');
100
- exports.initProxy();
101
- loadOrg = function () { return loadLatest(org); };
102
- window.addEventListener('load', loadOrg, false);
103
- };
104
- var presentSnippet = function (org) {
105
- var snippetString = prepareSnippet(snippet_1.snippet.toString(), { org: org, version: '' });
106
- var trimmedSnippet = snippetString
107
- .split('\n')
108
- .map(function (line) {
109
- return line.trim();
110
- })
111
- .join('');
112
- return "<script>\n " + trimmedSnippet + "\n</script>";
113
- };
114
- exports.presentSnippet = presentSnippet;
115
- exports.default = init;
116
- //# sourceMappingURL=init.js.map
package/build/init.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AASpC,4CAA4C;AAC5C,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,UAAU,MAAM;IAC7C,IAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,IAAM,IAAI,GAAG,MAAM,CA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AAE,CAAC,CAAC;IAEZ,OAAO,iBACL,cAAc,gBACR,CAAC;AACX,CAAC,CAAC;AAZW,QAAA,cAAc,kBAYzB;AAEF,kBAAe,IAAI,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const snippet: () => void;
2
- //# sourceMappingURL=snippet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../src/snippet.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,YAoDnB,CAAC"}
package/build/snippet.js DELETED
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.snippet = void 0;
4
- /* eslint-disable prefer-rest-params */
5
- /* eslint-disable no-template-curly-in-string */
6
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7
- // @ts-nocheck
8
- var snippet = function () {
9
- var org = '${org}';
10
- var cb = [];
11
- cb.q = [];
12
- window.CommandBar = new Proxy(cb, {
13
- get: function (f, n) {
14
- if (n in f) {
15
- return f[n];
16
- }
17
- return function () {
18
- var a = Array.prototype.slice.call(arguments);
19
- a.unshift(n);
20
- cb.q.push(a);
21
- };
22
- },
23
- });
24
- var load = function () {
25
- var origin = 'https://api.commandbar.com';
26
- var params = [];
27
- var lc = localStorage.getItem('commandbar.lc');
28
- if (lc && lc.includes('local')) {
29
- // for debugging purposes
30
- origin = 'http://localhost:8000';
31
- }
32
- var src = origin + '/latest/' + org;
33
- if (lc) {
34
- params.push('lc=' + lc);
35
- }
36
- var v = '${version}';
37
- if (!!v) {
38
- params.push('v=' + v);
39
- }
40
- src = src + '?' + params.join('&');
41
- var el = document.createElement('script');
42
- el.type = 'text/javascript';
43
- el.async = true;
44
- el.src = src;
45
- document.head.appendChild(el);
46
- };
47
- if (window.attachEvent) {
48
- window.attachEvent('onload', load);
49
- }
50
- else {
51
- window.addEventListener('load', load, false);
52
- }
53
- };
54
- exports.snippet = snippet;
55
- //# sourceMappingURL=snippet.js.map
@@ -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AAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;SACvB;QAED,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEnC,IAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC5C,EAAE,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC5B,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC;QAChB,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC;QACb,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,IAAI,MAAM,CAAC,WAAW,EAAE;QACtB,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;KACpC;SAAM;QACL,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;KAC9C;AACH,CAAC,CAAC;AApDW,QAAA,OAAO,WAoDlB"}
package/src/commandbar.ts DELETED
@@ -1,76 +0,0 @@
1
- declare type BootParam =
2
- | string
3
- | {
4
- id: string;
5
- [variable: string]: any;
6
- };
7
- export interface CommandBarClientAPI {
8
- dispose: () => void;
9
- config: (uuid: string) => void;
10
- boot: (
11
- id?: BootParam,
12
- eventMeta?: {
13
- [key: string]: any;
14
- },
15
- ) => void;
16
- shutdown: () => void;
17
- reloadCommands: () => void;
18
- configUser: () => Promise<void>;
19
- setContext: (
20
- context: {
21
- [variable: string]: any;
22
- },
23
- meta?: any,
24
- ) => void;
25
- reloadOrganization: () => void;
26
- addContext: (objOrKey: any, initialValue: any, meta: any) => void;
27
- addSearch: (name: string, func: (...args: any[]) => any, _opts?: any) => void;
28
- addCallback: (name: string, func: (...args: any[]) => any) => void;
29
- addCallbacks: (callbacks: { [name: string]: (...args: any[]) => any }) => void;
30
- addEventHandler: (func: (eventName: string, attrs: Record<string, any>) => void) => void;
31
- addEventCallback: (eventName: string, preview?: boolean) => void;
32
- addCommand: (command: any) => void;
33
- removeCommand: (name: string) => void;
34
- removeCallback: (name: string) => void;
35
- addRouter: (func: (route: string) => void) => void;
36
- setDashboard: (element: HTMLElement) => void;
37
- setTestMode: (on: boolean) => void;
38
- setPreviewMode: (on: boolean) => void;
39
- setActiveObject: (contextKey: string, objectLabel: string | string[], categoryName?: string) => void;
40
- clearActiveObject: (contextKey: string) => void;
41
- loadEditor: () => void;
42
- onboard: () => void;
43
- open: (
44
- input?: string,
45
- options?: {
46
- categoryFilter?: number;
47
- },
48
- ) => void;
49
- close: () => void;
50
- setTheme: (theme: string) => void;
51
- shareContext: () => any;
52
- shareCallbacks: () => any;
53
- execute: (id: number | string) => void;
54
- configuration: {
55
- uuid?: string;
56
- api: string;
57
- editor: string;
58
- proxy: string;
59
- session: string;
60
- };
61
- _disposed: boolean | undefined;
62
- _org: string | undefined;
63
- _session: string;
64
- _search: string;
65
- _user: string | undefined;
66
- _config: any;
67
- _eventMeta: Record<any, any> | undefined;
68
- uid: string;
69
- }
70
- declare global {
71
- interface Window {
72
- CommandBar: CommandBarClientAPI;
73
- }
74
- }
75
-
76
- export {};