@qikdev/sdk 0.1.5 → 0.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qikdev/sdk",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "Promise based Javascript SDK",
6
6
  "scripts": {
@@ -36,140 +36,135 @@ import { EventDispatcher } from './qik.utils.js';
36
36
  * var link = qik.asset.imageUrl('5ca3d64dd2bb085eb9d450db', 1920, 1080)
37
37
  */
38
38
 
39
- const QikCore = function(options) {
40
-
41
- if (!options) {
42
- options = {
43
- // apiURL,
44
- // applicationToken,
45
- // api:{}
46
- };
47
- }
48
-
49
- ///////////////////////////////////////
39
+ import {version} from '../version.js';
40
+
41
+
42
+ export default class QikCore {
43
+ constructor(options) {
44
+ if (!options) {
45
+ options = {
46
+ // apiURL,
47
+ // applicationToken,
48
+ // api:{}
49
+ }
50
+ }
51
+
52
+ ///////////////////////////////////////
53
+
54
+ if (!options.apiURL || !options.apiURL.length) {
55
+ options.apiURL = 'staging';
56
+ }
57
+
58
+ ///////////////////////////////////////
59
+
60
+ switch (String(options.apiURL).toLowerCase()) {
61
+ case 'production':
62
+ options.apiURL = 'https://api.qik.dev';
63
+ break;
64
+ case 'staging':
65
+ options.apiURL = 'https://api.staging.qik.dev';
66
+ break;
67
+ case 'local':
68
+ options.apiURL = 'http://localhost:4001';
69
+ break;
70
+ }
71
+
72
+ ///////////////////////////////////////
73
+
74
+ var core = Object.assign(options, {
75
+ //Other options
76
+ // domain:'',
77
+ version,
78
+ })
79
+
80
+
81
+
82
+ ///////////////////////////////////////
83
+
84
+ /**
85
+ * Provides a cache service, used for creating, clearing
86
+ * and storing API requests and other information in memory
87
+ * @type {QikCache}
88
+ */
89
+ var cache = QikCache;
90
+ Object.defineProperty(core, 'cache', {
91
+ value: cache,
92
+ writable: false,
93
+ });
94
+ ///////////////////////////////////////
95
+
96
+ /**
97
+ * Provides helper functions for working
98
+ * with Qik data
99
+ * @type {QikUtils}
100
+ */
101
+ var utils = QikUtils;
102
+ Object.defineProperty(core, 'utils', {
103
+ value: utils,
104
+ writable: false,
105
+ });
106
+
107
+ ///////////////////////////////////////
108
+
109
+ //Create a new global dispatcher so we can trigger events
110
+ var dispatcher = new EventDispatcher();
111
+ dispatcher.bootstrap(core);
112
+
113
+ //Set the function
114
+ core.error = function(err) {
115
+ //Dispatch an error event
116
+ return core.dispatch('error', utils.errorMessage(err));
117
+ }
118
+
119
+ //And enable notifications with a short message
120
+ core.notify = function(message, options) {
121
+ return core.dispatch('notification', { message, options });
122
+ }
123
+
124
+ ///////////////////////////////////////
125
+
126
+ /**
127
+ * The default service for interacting with
128
+ * the Qik REST API, it's a wrapper around the axios library
129
+ * that works in conjunction with the other Qik modules
130
+ * @type {QikAPI}
131
+ */
132
+ var api = new QikAPI(core);
133
+ Object.defineProperty(core, 'api', {
134
+ value: api,
135
+ writable: false,
136
+ });
137
+
138
+ /**
139
+ * The default service for managing authentication
140
+ * handles automatic refreshing of access tokens, and provides login, logout
141
+ * and other user/application specific functionality
142
+ * @type {QikAuth}
143
+ */
144
+ var auth = new QikAuth(core);
145
+ Object.defineProperty(core, 'auth', {
146
+ value: auth,
147
+ writable: false,
148
+ });
149
+
150
+ ///////////////////////////////////////
151
+
152
+ /**
153
+ * A helper service for understanding a user's access permissions
154
+ * @type {QikAccess}
155
+ */
156
+ var access = new QikAccess(core);
157
+ Object.defineProperty(core, 'access', {
158
+ value: access,
159
+ writable: false,
160
+ });
161
+
162
+
163
+
164
+ ///////////////////////////////////////
165
+
166
+
167
+ return core;
50
168
 
51
- if (!options.apiURL || !options.apiURL.length) {
52
- options.apiURL = 'staging';
53
169
  }
54
-
55
- ///////////////////////////////////////
56
-
57
- switch (String(options.apiURL).toLowerCase()) {
58
- case 'production':
59
- options.apiURL = 'https://api.qik.dev';
60
- break;
61
- case 'staging':
62
- options.apiURL = 'https://api.staging.qik.dev';
63
- break;
64
- case 'local':
65
- options.apiURL = 'http://localhost:4001';
66
- break;
67
- }
68
-
69
- ///////////////////////////////////////
70
-
71
- var core = Object.assign(options, {
72
- //Other options
73
- // domain:'',
74
- version:'0.1.0',
75
- })
76
-
77
-
78
-
79
- ///////////////////////////////////////
80
-
81
- /**
82
- * Provides a cache service, used for creating, clearing
83
- * and storing API requests and other information in memory
84
- * @type {QikCache}
85
- */
86
- var cache = QikCache;
87
- Object.defineProperty(core, 'cache', {
88
- value: cache,
89
- writable: false,
90
- });
91
- ///////////////////////////////////////
92
-
93
- /**
94
- * Provides helper functions for working
95
- * with Qik data
96
- * @type {QikUtils}
97
- */
98
- var utils = QikUtils;
99
- Object.defineProperty(core, 'utils', {
100
- value: utils,
101
- writable: false,
102
- });
103
-
104
- ///////////////////////////////////////
105
-
106
- //Create a new global dispatcher so we can trigger events
107
- var dispatcher = new EventDispatcher();
108
- dispatcher.bootstrap(core);
109
-
110
- //Set the function
111
- core.error = function(err) {
112
- //Dispatch an error event
113
- return core.dispatch('error', utils.errorMessage(err));
114
- }
115
-
116
- //And enable notifications with a short message
117
- core.notify = function(message, options) {
118
- return core.dispatch('notification', {message, options});
119
- }
120
-
121
- ///////////////////////////////////////
122
-
123
- /**
124
- * The default service for interacting with
125
- * the Qik REST API, it's a wrapper around the axios library
126
- * that works in conjunction with the other Qik modules
127
- * @type {QikAPI}
128
- */
129
- var api = new QikAPI(core);
130
- Object.defineProperty(core, 'api', {
131
- value: api,
132
- writable: false,
133
- });
134
-
135
- /**
136
- * The default service for managing authentication
137
- * handles automatic refreshing of access tokens, and provides login, logout
138
- * and other user/application specific functionality
139
- * @type {QikAuth}
140
- */
141
- var auth = new QikAuth(core);
142
- Object.defineProperty(core, 'auth', {
143
- value: auth,
144
- writable: false,
145
- });
146
-
147
- ///////////////////////////////////////
148
-
149
- /**
150
- * A helper service for understanding a user's access permissions
151
- * @type {QikAccess}
152
- */
153
- var access = new QikAccess(core);
154
- Object.defineProperty(core, 'access', {
155
- value: access,
156
- writable: false,
157
- });
158
-
159
-
160
-
161
- ///////////////////////////////////////
162
-
163
-
164
- return core;
165
-
166
- }
167
-
168
- ///////////////////////////////////////
169
- ///////////////////////////////////////
170
-
171
-
172
- ///////////////////////////////////////
173
- ///////////////////////////////////////
174
-
175
- export default QikCore;
170
+ }
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '0.1.0'
1
+ export const version = '0.1.6'