@kaspernj/api-maker 1.0.204 → 1.0.207
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/{.eslintrc.js → .eslintrc.cjs} +0 -0
- package/__tests__/base-model.test.js +11 -9
- package/__tests__/cable-connection-pool.test.js +5 -3
- package/__tests__/cable-subscription-pool.test.js +1 -1
- package/__tests__/can-can.test.js +4 -3
- package/__tests__/collection.test.js +1 -1
- package/__tests__/custom-error.test.js +1 -1
- package/__tests__/merge.test.js +1 -1
- package/__tests__/model-name.test.js +3 -2
- package/__tests__/model-prop-type.test.js +3 -3
- package/__tests__/params.test.js +1 -1
- package/__tests__/routes-native.test.js +4 -4
- package/__tests__/routes.test.js +1 -1
- package/__tests__/serializer.test.js +2 -2
- package/__tests__/support/task.js +1 -1
- package/__tests__/support/user.js +2 -2
- package/jest.config.js +3 -2
- package/package.json +3 -2
- package/src/{api.js → api.mjs} +2 -2
- package/src/attribute-not-loaded-error.mjs +1 -0
- package/src/{base-error.cjs → base-error.mjs} +3 -3
- package/src/{base-model.cjs → base-model.mjs} +28 -28
- package/src/{cable-connection-pool.cjs → cable-connection-pool.mjs} +8 -7
- package/src/{cable-subscription-pool.cjs → cable-subscription-pool.mjs} +8 -8
- package/src/{cable-subscription.cjs → cable-subscription.mjs} +3 -3
- package/src/can-can-loader.jsx +4 -4
- package/src/{can-can.cjs → can-can.mjs} +10 -10
- package/src/channels-consumer.mjs +3 -0
- package/src/collection-loader.jsx +10 -10
- package/src/{collection.cjs → collection.mjs} +8 -8
- package/src/{command-submit-data.cjs → command-submit-data.mjs} +3 -3
- package/src/{commands-pool.cjs → commands-pool.mjs} +16 -16
- package/src/{config.js → config.mjs} +2 -2
- package/src/{custom-error.cjs → custom-error.mjs} +2 -2
- package/src/{deserializer.cjs → deserializer.mjs} +6 -6
- package/src/{destroy-error.cjs → destroy-error.mjs} +2 -2
- package/src/devise.mjs +4 -4
- package/src/{error-logger.cjs → error-logger.mjs} +5 -5
- package/src/{error-messages.cjs → error-messages.mjs} +2 -2
- package/src/event-connection.jsx +4 -4
- package/src/event-created.jsx +5 -5
- package/src/event-destroyed.jsx +4 -4
- package/src/event-emitter-listener.jsx +3 -3
- package/src/event-listener.jsx +3 -3
- package/src/event-model-class.jsx +4 -4
- package/src/event-updated.jsx +5 -5
- package/src/{instance-of-class-name.cjs → instance-of-class-name.mjs} +2 -2
- package/src/{key-value-store.cjs → key-value-store.mjs} +6 -5
- package/src/{logger.cjs → logger.mjs} +7 -5
- package/src/{merge.cjs → merge.mjs} +1 -1
- package/src/model-class-require.mjs +10 -0
- package/src/{model-events.cjs → model-events.mjs} +3 -3
- package/src/model-load-wrapper.jsx +9 -4
- package/src/{model-name.cjs → model-name.mjs} +5 -5
- package/src/{model-prop-type.cjs → model-prop-type.mjs} +3 -3
- package/src/model-recipes-model-loader.mjs +2 -2
- package/src/{models-response-reader.cjs → models-response-reader.mjs} +5 -5
- package/src/models.mjs.erb +16 -0
- package/src/{money-formatter.cjs → money-formatter.mjs} +4 -4
- package/src/not-loaded-error.mjs +1 -0
- package/src/{params.cjs → params.mjs} +5 -5
- package/src/{preloaded.cjs → preloaded.mjs} +3 -3
- package/src/{result.cjs → result.mjs} +1 -1
- package/src/{routes-native.cjs → routes-native.mjs} +8 -8
- package/src/{routes.cjs → routes.mjs} +3 -3
- package/src/{serializer.cjs → serializer.mjs} +2 -2
- package/src/{services.cjs → services.mjs} +6 -6
- package/src/{source-maps-loader.cjs → source-maps-loader.mjs} +4 -4
- package/src/updated-attribute.jsx +5 -5
- package/src/{validation-error.cjs → validation-error.mjs} +3 -3
- package/src/{validation-errors.cjs → validation-errors.mjs} +4 -4
- package/src/with-router.jsx +1 -1
- package/src/attribute-not-loaded-error.cjs +0 -1
- package/src/channels-consumer.cjs +0 -3
- package/src/model-class-require.cjs +0 -9
- package/src/model-recipes.mjs.erb +0 -3
- package/src/models.cjs +0 -7
- package/src/not-loaded-error.cjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
|
+
import SourceMapsLoader from "./source-maps-loader.mjs"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default class ErrorLogger {
|
|
5
5
|
constructor () {
|
|
6
6
|
this.debug = true
|
|
7
7
|
this.errorOccurred = false
|
|
@@ -40,7 +40,7 @@ module.exports = class ErrorLogger {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
connectOnError () {
|
|
43
|
-
|
|
43
|
+
globalThis.addEventListener("error", (event) => {
|
|
44
44
|
this.errorOccurred = true
|
|
45
45
|
|
|
46
46
|
if (!this.isHandlingError) {
|
|
@@ -53,7 +53,7 @@ module.exports = class ErrorLogger {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
connectUnhandledRejection () {
|
|
56
|
-
|
|
56
|
+
globalThis.addEventListener("unhandledrejection", (event) => {
|
|
57
57
|
this.errorOccurred = true
|
|
58
58
|
|
|
59
59
|
if (!this.isHandlingError) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
2
|
const errorMessages = (args) => {
|
|
3
3
|
if (typeof args.response == "object") {
|
|
4
4
|
return digg(args, "response", "errors").map((error) => {
|
|
@@ -11,4 +11,4 @@ const errorMessages = (args) => {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
export default errorMessages
|
package/src/event-connection.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import ModelEvents from "./model-events.mjs"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import propTypesExact from "prop-types-exact"
|
|
4
|
+
import React from "react"
|
|
5
5
|
|
|
6
6
|
export default class ApiMakerEventConnection extends React.PureComponent {
|
|
7
7
|
static defaultProps = {
|
package/src/event-created.jsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import debounce from "debounce"
|
|
2
|
+
import ModelEvents from "./model-events.mjs"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import propTypesExact from "prop-types-exact"
|
|
5
|
+
import React from "react"
|
|
6
6
|
|
|
7
7
|
export default class ApiMakerEventCreated extends React.PureComponent {
|
|
8
8
|
static defaultProps = {
|
package/src/event-destroyed.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import ModelEvents from "./model-events.mjs"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import propTypesExact from "prop-types-exact"
|
|
4
|
+
import React from "react"
|
|
5
5
|
|
|
6
6
|
export default class ApiMakerEventDestroyed extends React.PureComponent {
|
|
7
7
|
static propTypes = propTypesExact({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import EventEmitter from "events"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import React from "react"
|
|
4
4
|
|
|
5
5
|
export default class ApiMakerEventEmitterListener extends React.PureComponent {
|
|
6
6
|
static propTypes = {
|
package/src/event-listener.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import PropTypes from "prop-types"
|
|
2
|
+
import propTypesExact from "prop-types-exact"
|
|
3
|
+
import React from "react"
|
|
4
4
|
|
|
5
5
|
export default class ApiMakerEventListener extends React.PureComponent {
|
|
6
6
|
static callEvent (target, eventName, args = []) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import ModelEvents from "./model-events.mjs"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import propTypesExact from "prop-types-exact"
|
|
4
|
+
import React from "react"
|
|
5
5
|
|
|
6
6
|
export default class ApiMakerEventModelClass extends React.PureComponent {
|
|
7
7
|
static propTypes = propTypesExact({
|
package/src/event-updated.jsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import debounce from "debounce"
|
|
2
|
+
import ModelEvents from "./model-events.mjs"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import propTypesExact from "prop-types-exact"
|
|
5
|
+
import React from "react"
|
|
6
6
|
|
|
7
7
|
export default class ApiMakerEventUpdated extends React.PureComponent {
|
|
8
8
|
static defaultProps = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
2
|
|
|
3
3
|
const propTypesValidator = (expectedClassName, args = {}) => (props, propName, componentName) => {
|
|
4
4
|
const prop = digg(props, propName)
|
|
@@ -26,4 +26,4 @@ const instanceOfClassName = (expectedClassName) => {
|
|
|
26
26
|
return validator
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
export default instanceOfClassName
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import Params from "./params.mjs"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const shared = {}
|
|
4
|
+
|
|
5
|
+
export default class KeyValueStore {
|
|
4
6
|
static current () {
|
|
5
|
-
if (!
|
|
6
|
-
global.currentKeyValueStore = new KeyValueStore()
|
|
7
|
+
if (!shared.currentKeyValueStore) shared.currentKeyValueStore = new KeyValueStore()
|
|
7
8
|
|
|
8
|
-
return
|
|
9
|
+
return shared.currentKeyValueStore
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
static get (key) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
const shared = {}
|
|
2
|
+
|
|
3
|
+
export default class ApiMakerLogger {
|
|
2
4
|
static current () {
|
|
3
|
-
if (!
|
|
4
|
-
|
|
5
|
-
//
|
|
5
|
+
if (!shared.apiMakerLogger) {
|
|
6
|
+
shared.apiMakerLogger = new ApiMakerLogger()
|
|
7
|
+
// shared.apiMakerLogger.setDebug(true)
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
return
|
|
10
|
+
return shared.apiMakerLogger
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
static log (message) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
|
+
import inflection from "inflection"
|
|
3
|
+
import * as models from "@kaspernj/api-maker/src/models.mjs.erb"
|
|
4
|
+
|
|
5
|
+
export default (modelName) => {
|
|
6
|
+
const requireName = inflection.camelize(modelName)
|
|
7
|
+
const ModelClass = digg(models, requireName)
|
|
8
|
+
|
|
9
|
+
return ModelClass
|
|
10
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import CableConnectionPool from "./cable-connection-pool.mjs"
|
|
2
|
+
import {digg} from "diggerize"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default class ModelEvents {
|
|
5
5
|
static connect (model, eventName, callback) {
|
|
6
6
|
const modelClassName = digg(model.modelClassData(), "name")
|
|
7
7
|
const cableSubscription = CableConnectionPool.current().connectEvent(modelClassName, model.primaryKey(), eventName, callback)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EventUpdated from "./event-updated"
|
|
2
|
-
import Params from "./params.
|
|
2
|
+
import Params from "./params.mjs"
|
|
3
3
|
import React from "react"
|
|
4
4
|
|
|
5
5
|
export default (WrappedComponent, ModelClass, args = {}) => class modelLoadWrapper extends React.PureComponent {
|
|
@@ -8,7 +8,8 @@ export default (WrappedComponent, ModelClass, args = {}) => class modelLoadWrapp
|
|
|
8
8
|
|
|
9
9
|
state = {
|
|
10
10
|
model: undefined,
|
|
11
|
-
modelId: this.props.match.params[this.paramsVariableName] || this.props.match.params.id
|
|
11
|
+
modelId: this.props.match.params[this.paramsVariableName] || this.props.match.params.id,
|
|
12
|
+
notFound: undefined
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
componentDidMount() {
|
|
@@ -37,7 +38,10 @@ export default (WrappedComponent, ModelClass, args = {}) => class modelLoadWrapp
|
|
|
37
38
|
|
|
38
39
|
const model = await query.first()
|
|
39
40
|
|
|
40
|
-
this.setState({
|
|
41
|
+
this.setState({
|
|
42
|
+
model,
|
|
43
|
+
notFound: !model
|
|
44
|
+
})
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
async loadNewModel() {
|
|
@@ -62,11 +66,12 @@ export default (WrappedComponent, ModelClass, args = {}) => class modelLoadWrapp
|
|
|
62
66
|
|
|
63
67
|
render() {
|
|
64
68
|
const {onUpdated, reloadModel} = digs(this, "onUpdated", "reloadModel")
|
|
65
|
-
const {model, modelId} = digs(this.state, "model", "modelId")
|
|
69
|
+
const {model, modelId, notFound} = digs(this.state, "model", "modelId", "notFound")
|
|
66
70
|
const wrappedComponentProps = {}
|
|
67
71
|
|
|
68
72
|
wrappedComponentProps[this.camelizedLower] = model
|
|
69
73
|
wrappedComponentProps[`${this.camelizedLower}Id`] = modelId
|
|
74
|
+
wrappedComponentProps[`${this.camelizedLower}NotFound`] = notFound
|
|
70
75
|
|
|
71
76
|
return (
|
|
72
77
|
<>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import Config from "@kaspernj/api-maker/src/config.mjs"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
constructor
|
|
3
|
+
export default class ModelName {
|
|
4
|
+
constructor(data) {
|
|
5
5
|
this.data = data
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -9,10 +9,10 @@ module.exports = class ModelName {
|
|
|
9
9
|
return this.data.modelClassData.camelizedLower
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
human
|
|
12
|
+
human(args) {
|
|
13
13
|
let argsToUse = args
|
|
14
14
|
|
|
15
|
-
if (!argsToUse) argsToUse = {count: 1}
|
|
15
|
+
if (!argsToUse) argsToUse = { count: 1 }
|
|
16
16
|
|
|
17
17
|
let countKey
|
|
18
18
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
|
+
import Inflection from "inflection"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default class ApiMakerModelPropType {
|
|
5
5
|
static ofModel (modelClass) {
|
|
6
6
|
const modelPropTypeInstance = new ApiMakerModelPropType()
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
|
+
import inflection from "inflection"
|
|
3
|
+
import modelClassRequire from "./model-class-require.mjs"
|
|
4
|
+
import Preloaded from "./preloaded.mjs"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export default class ModelsResponseReader {
|
|
7
7
|
static first (response) {
|
|
8
8
|
return ModelsResponseReader.collection(response)[0]
|
|
9
9
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* rails-erb-loader-dependencies api_maker/resources/ models/ */
|
|
2
|
+
|
|
3
|
+
import {digg} from "diggerize"
|
|
4
|
+
import ModelRecipesLoader from "./model-recipes-loader.mjs"
|
|
5
|
+
|
|
6
|
+
const modelRecipes = <%= ApiMaker::ModelClassesJavaScriptGeneratorService.execute!.to_json %>
|
|
7
|
+
const loader = new ModelRecipesLoader({recipes: modelRecipes})
|
|
8
|
+
const result = loader.load()
|
|
9
|
+
|
|
10
|
+
<% model_class_names = [] %>
|
|
11
|
+
<% ApiMaker::ModelClassesJavaScriptGeneratorService.new.resources.each do |resource| %>
|
|
12
|
+
<% model_class_names << resource.short_name %>
|
|
13
|
+
const <%= resource.short_name %> = digg(result, "<%= resource.short_name %>")
|
|
14
|
+
<% end %>
|
|
15
|
+
|
|
16
|
+
export {<%= model_class_names.join(", ") %>}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import Money from "js-money"
|
|
2
|
+
import formatNumber from "format-number"
|
|
3
|
+
import replaceall from "replaceall"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default class MoneyFormatter {
|
|
6
6
|
static fromMoney (money, args = {}) {
|
|
7
7
|
return new MoneyFormatter(money, args)
|
|
8
8
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default class NotLoadedError extends Error {}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import formSerialize from "form-serialize"
|
|
2
|
+
import {merge} from "./merge.mjs"
|
|
3
|
+
import qs from "qs"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default class Params {
|
|
6
6
|
static parse () {
|
|
7
|
-
return qs.parse(
|
|
7
|
+
return qs.parse(globalThis.location.search.substr(1))
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
static change (given) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import inflection from "inflection"
|
|
2
|
+
import modelClassRequire from "./model-class-require.mjs"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default class ApiMakerPreloaded {
|
|
5
5
|
constructor (response) {
|
|
6
6
|
this.response = response
|
|
7
7
|
this.loadPreloadedModels()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {dig, digg, digs} from "diggerize"
|
|
2
|
+
import inflection from "inflection"
|
|
3
|
+
import qs from "qs"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default class ApiMakerRoutesNative {
|
|
6
6
|
constructor ({getLocale}) {
|
|
7
7
|
this.getLocale = getLocale
|
|
8
8
|
this.routeDefinitions = []
|
|
@@ -141,15 +141,15 @@ module.exports = class ApiMakerRoutesNative {
|
|
|
141
141
|
addHostToRoute ({host, port, protocol, translatedRoute}) {
|
|
142
142
|
let fullUrl = ""
|
|
143
143
|
|
|
144
|
-
const hostToUse = host ||
|
|
145
|
-
const portToUse = port ||
|
|
144
|
+
const hostToUse = host || globalThis.location && globalThis.location.host
|
|
145
|
+
const portToUse = port || globalThis.location && globalThis.location.port
|
|
146
146
|
|
|
147
147
|
if (!hostToUse) throw new Error("Unable to detect host")
|
|
148
148
|
|
|
149
149
|
if (protocol) {
|
|
150
150
|
fullUrl += `${protocol}://`
|
|
151
|
-
} else if (
|
|
152
|
-
fullUrl += `${
|
|
151
|
+
} else if (globalThis.location && globalThis.location.protocol) {
|
|
152
|
+
fullUrl += `${globalThis.location.protocol}//`
|
|
153
153
|
} else {
|
|
154
154
|
fullUrl += "https://"
|
|
155
155
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
|
+
import inflection from "inflection"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default class ApiMakerRoutes {
|
|
5
5
|
constructor ({jsRoutes, locale, routeDefinitions}) {
|
|
6
6
|
if (!jsRoutes) throw new Error("'jsRoutes' wasn't given")
|
|
7
7
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import CommandsPool from "./commands-pool.mjs"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const shared = {}
|
|
4
|
+
|
|
5
|
+
export default class ApiMakerServices {
|
|
4
6
|
static current () {
|
|
5
|
-
if (!
|
|
6
|
-
global.currentApiMakerService = new ApiMakerServices()
|
|
7
|
-
}
|
|
7
|
+
if (!shared.currentApiMakerService) shared.currentApiMakerService = new ApiMakerServices()
|
|
8
8
|
|
|
9
|
-
return
|
|
9
|
+
return shared.currentApiMakerService
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
sendRequest (serviceName, args) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as stackTraceParser from "stacktrace-parser"
|
|
2
|
+
import {SourceMapConsumer} from "source-map"
|
|
3
|
+
import uniqunize from "uniqunize"
|
|
4
4
|
|
|
5
5
|
// Sometimes this needs to be called and sometimes not
|
|
6
6
|
if (SourceMapConsumer.initialize) {
|
|
@@ -9,7 +9,7 @@ if (SourceMapConsumer.initialize) {
|
|
|
9
9
|
})
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
export default class SourceMapsLoader {
|
|
13
13
|
constructor () {
|
|
14
14
|
this.debug = false
|
|
15
15
|
this.isLoadingSourceMaps = false
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {digg} from "diggerize"
|
|
2
|
+
import ModelEvents from "./model-events.mjs"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import propTypesExact from "prop-types-exact"
|
|
5
|
+
import React from "react"
|
|
6
6
|
|
|
7
7
|
export default class ApiMakerUpdatedAttribute extends React.PureComponent {
|
|
8
8
|
static propTypes = propTypesExact({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import BaseError from "./base-error.mjs"
|
|
2
|
+
import inflection from "inflection"
|
|
3
3
|
|
|
4
4
|
class ValidationError extends BaseError {
|
|
5
5
|
constructor (validationErrors, args) {
|
|
@@ -28,4 +28,4 @@ class ValidationError extends BaseError {
|
|
|
28
28
|
|
|
29
29
|
ValidationError.apiMakerType = "ValidationError"
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
export default ValidationError
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {digg, digs} from "diggerize"
|
|
2
|
+
import inflection from "inflection"
|
|
3
|
+
import modelClassRequire from "./model-class-require.mjs"
|
|
4
4
|
|
|
5
5
|
class ValidationError {
|
|
6
6
|
constructor (args) {
|
|
@@ -127,7 +127,7 @@ class ValidationErrors {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
export {
|
|
131
131
|
ValidationError,
|
|
132
132
|
ValidationErrors
|
|
133
133
|
}
|
package/src/with-router.jsx
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = class AttributeNotLoadedError extends Error {}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const {digg} = require("diggerize")
|
|
2
|
-
const inflection = require("inflection")
|
|
3
|
-
|
|
4
|
-
module.exports = (modelName) => {
|
|
5
|
-
const requireName = inflection.camelize(modelName)
|
|
6
|
-
const ModelClass = digg(require("@kaspernj/api-maker/src/models.cjs"), requireName)
|
|
7
|
-
|
|
8
|
-
return ModelClass
|
|
9
|
-
}
|
package/src/models.cjs
DELETED
package/src/not-loaded-error.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = class NotLoadedError extends Error {}
|