@qikdev/sdk 0.1.2 → 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 +1 -1
- package/src/api/qik.core.js +131 -135
- package/src/version.js +1 -1
package/package.json
CHANGED
package/src/api/qik.core.js
CHANGED
|
@@ -19,7 +19,7 @@ import { EventDispatcher } from './qik.utils.js';
|
|
|
19
19
|
* @example
|
|
20
20
|
*
|
|
21
21
|
* //Import the Qik package
|
|
22
|
-
* import Qik from '
|
|
22
|
+
* import Qik from '@qikdev/sdk';
|
|
23
23
|
*
|
|
24
24
|
* //Create a new Qik instance
|
|
25
25
|
* var qik = new Qik();
|
|
@@ -35,140 +35,136 @@ import { EventDispatcher } from './qik.utils.js';
|
|
|
35
35
|
* //Use the QikAsset package to generate an image url
|
|
36
36
|
* var link = qik.asset.imageUrl('5ca3d64dd2bb085eb9d450db', 1920, 1080)
|
|
37
37
|
*/
|
|
38
|
-
var QikCore = function(options) {
|
|
39
|
-
|
|
40
|
-
if (!options) {
|
|
41
|
-
options = {
|
|
42
|
-
// apiURL,
|
|
43
|
-
// applicationToken,
|
|
44
|
-
// api:{}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
///////////////////////////////////////
|
|
49
|
-
|
|
50
|
-
if (!options.apiURL || !options.apiURL.length) {
|
|
51
|
-
options.apiURL = 'staging';
|
|
52
|
-
}
|
|
53
38
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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;
|
|
114
168
|
|
|
115
|
-
//And enable notifications with a short message
|
|
116
|
-
core.notify = function(message, options) {
|
|
117
|
-
return core.dispatch('notification', {message, options});
|
|
118
169
|
}
|
|
119
|
-
|
|
120
|
-
///////////////////////////////////////
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* The default service for interacting with
|
|
124
|
-
* the Qik REST API, it's a wrapper around the axios library
|
|
125
|
-
* that works in conjunction with the other Qik modules
|
|
126
|
-
* @type {QikAPI}
|
|
127
|
-
*/
|
|
128
|
-
var api = new QikAPI(core);
|
|
129
|
-
Object.defineProperty(core, 'api', {
|
|
130
|
-
value: api,
|
|
131
|
-
writable: false,
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* The default service for managing authentication
|
|
136
|
-
* handles automatic refreshing of access tokens, and provides login, logout
|
|
137
|
-
* and other user/application specific functionality
|
|
138
|
-
* @type {QikAuth}
|
|
139
|
-
*/
|
|
140
|
-
var auth = new QikAuth(core);
|
|
141
|
-
Object.defineProperty(core, 'auth', {
|
|
142
|
-
value: auth,
|
|
143
|
-
writable: false,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
///////////////////////////////////////
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* A helper service for understanding a user's access permissions
|
|
150
|
-
* @type {QikAccess}
|
|
151
|
-
*/
|
|
152
|
-
var access = new QikAccess(core);
|
|
153
|
-
Object.defineProperty(core, 'access', {
|
|
154
|
-
value: access,
|
|
155
|
-
writable: false,
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
///////////////////////////////////////
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return core;
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
///////////////////////////////////////
|
|
168
|
-
///////////////////////////////////////
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
///////////////////////////////////////
|
|
172
|
-
///////////////////////////////////////
|
|
173
|
-
|
|
174
|
-
export default QikCore;
|
|
170
|
+
}
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.1.
|
|
1
|
+
export const version = '0.1.6'
|